diff options
58 files changed, 374 insertions, 328 deletions
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 0f54333b0ff2..b6ce00b2be9a 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
| @@ -547,13 +547,11 @@ helper functions described in Section 4. In that case, pm_runtime_resume() | |||
| 547 | should be used. Of course, for this purpose the device's runtime PM has to be | 547 | should be used. Of course, for this purpose the device's runtime PM has to be |
| 548 | enabled earlier by calling pm_runtime_enable(). | 548 | enabled earlier by calling pm_runtime_enable(). |
| 549 | 549 | ||
| 550 | If the device bus type's or driver's ->probe() callback runs | 550 | It may be desirable to suspend the device once ->probe() has finished. |
| 551 | pm_runtime_suspend() or pm_runtime_idle() or their asynchronous counterparts, | 551 | Therefore the driver core uses the asyncronous pm_request_idle() to submit a |
| 552 | they will fail returning -EAGAIN, because the device's usage counter is | 552 | request to execute the subsystem-level idle callback for the device at that |
| 553 | incremented by the driver core before executing ->probe(). Still, it may be | 553 | time. A driver that makes use of the runtime autosuspend feature, may want to |
| 554 | desirable to suspend the device as soon as ->probe() has finished, so the driver | 554 | update the last busy mark before returning from ->probe(). |
| 555 | core uses pm_runtime_put_sync() to invoke the subsystem-level idle callback for | ||
| 556 | the device at that time. | ||
| 557 | 555 | ||
| 558 | Moreover, the driver core prevents runtime PM callbacks from racing with the bus | 556 | Moreover, the driver core prevents runtime PM callbacks from racing with the bus |
| 559 | notifier callback in __device_release_driver(), which is necessary, because the | 557 | notifier callback in __device_release_driver(), which is necessary, because the |
| @@ -656,7 +654,7 @@ out the following operations: | |||
| 656 | __pm_runtime_disable() with 'false' as the second argument for every device | 654 | __pm_runtime_disable() with 'false' as the second argument for every device |
| 657 | right before executing the subsystem-level .suspend_late() callback for it. | 655 | right before executing the subsystem-level .suspend_late() callback for it. |
| 658 | 656 | ||
| 659 | * During system resume it calls pm_runtime_enable() and pm_runtime_put_sync() | 657 | * During system resume it calls pm_runtime_enable() and pm_runtime_put() |
| 660 | for every device right after executing the subsystem-level .resume_early() | 658 | for every device right after executing the subsystem-level .resume_early() |
| 661 | callback and right after executing the subsystem-level .resume() callback | 659 | callback and right after executing the subsystem-level .resume() callback |
| 662 | for it, respectively. | 660 | for it, respectively. |
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index d43daf192b21..4c530a82fc46 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
| @@ -1992,7 +1992,7 @@ sba_connect_bus(struct pci_bus *bus) | |||
| 1992 | if (PCI_CONTROLLER(bus)->iommu) | 1992 | if (PCI_CONTROLLER(bus)->iommu) |
| 1993 | return; | 1993 | return; |
| 1994 | 1994 | ||
| 1995 | handle = PCI_CONTROLLER(bus)->acpi_handle; | 1995 | handle = acpi_device_handle(PCI_CONTROLLER(bus)->companion); |
| 1996 | if (!handle) | 1996 | if (!handle) |
| 1997 | return; | 1997 | return; |
| 1998 | 1998 | ||
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h index 80775f55f03f..71fbaaa495cc 100644 --- a/arch/ia64/include/asm/pci.h +++ b/arch/ia64/include/asm/pci.h | |||
| @@ -95,7 +95,7 @@ struct iospace_resource { | |||
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | struct pci_controller { | 97 | struct pci_controller { |
| 98 | void *acpi_handle; | 98 | struct acpi_device *companion; |
| 99 | void *iommu; | 99 | void *iommu; |
| 100 | int segment; | 100 | int segment; |
| 101 | int node; /* nearest node with memory or -1 for global allocation */ | 101 | int node; /* nearest node with memory or -1 for global allocation */ |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 2326790b7d8b..9e4938d8ca4d 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
| @@ -436,9 +436,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) | |||
| 436 | if (!controller) | 436 | if (!controller) |
| 437 | return NULL; | 437 | return NULL; |
| 438 | 438 | ||
| 439 | controller->acpi_handle = device->handle; | 439 | controller->companion = device; |
| 440 | 440 | ||
| 441 | pxm = acpi_get_pxm(controller->acpi_handle); | 441 | pxm = acpi_get_pxm(device->handle); |
| 442 | #ifdef CONFIG_NUMA | 442 | #ifdef CONFIG_NUMA |
| 443 | if (pxm >= 0) | 443 | if (pxm >= 0) |
| 444 | controller->node = pxm_to_node(pxm); | 444 | controller->node = pxm_to_node(pxm); |
| @@ -489,7 +489,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) | |||
| 489 | { | 489 | { |
| 490 | struct pci_controller *controller = bridge->bus->sysdata; | 490 | struct pci_controller *controller = bridge->bus->sysdata; |
| 491 | 491 | ||
| 492 | ACPI_HANDLE_SET(&bridge->dev, controller->acpi_handle); | 492 | ACPI_COMPANION_SET(&bridge->dev, controller->companion); |
| 493 | return 0; | 493 | return 0; |
| 494 | } | 494 | } |
| 495 | 495 | ||
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c index b1725398b5af..0640739cc20c 100644 --- a/arch/ia64/sn/kernel/io_acpi_init.c +++ b/arch/ia64/sn/kernel/io_acpi_init.c | |||
| @@ -132,7 +132,7 @@ sn_get_bussoft_ptr(struct pci_bus *bus) | |||
| 132 | struct acpi_resource_vendor_typed *vendor; | 132 | struct acpi_resource_vendor_typed *vendor; |
| 133 | 133 | ||
| 134 | 134 | ||
| 135 | handle = PCI_CONTROLLER(bus)->acpi_handle; | 135 | handle = acpi_device_handle(PCI_CONTROLLER(bus)->companion); |
| 136 | status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, | 136 | status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, |
| 137 | &sn_uuid, &buffer); | 137 | &sn_uuid, &buffer); |
| 138 | if (ACPI_FAILURE(status)) { | 138 | if (ACPI_FAILURE(status)) { |
| @@ -360,7 +360,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info, | |||
| 360 | acpi_status status; | 360 | acpi_status status; |
| 361 | struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 361 | struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 362 | 362 | ||
| 363 | rootbus_handle = PCI_CONTROLLER(dev)->acpi_handle; | 363 | rootbus_handle = acpi_device_handle(PCI_CONTROLLER(dev)->companion); |
| 364 | status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL, | 364 | status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL, |
| 365 | &segment); | 365 | &segment); |
| 366 | if (ACPI_SUCCESS(status)) { | 366 | if (ACPI_SUCCESS(status)) { |
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 7d7443283a9d..947b5c417e83 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h | |||
| @@ -15,7 +15,7 @@ struct pci_sysdata { | |||
| 15 | int domain; /* PCI domain */ | 15 | int domain; /* PCI domain */ |
| 16 | int node; /* NUMA node */ | 16 | int node; /* NUMA node */ |
| 17 | #ifdef CONFIG_ACPI | 17 | #ifdef CONFIG_ACPI |
| 18 | void *acpi; /* ACPI-specific data */ | 18 | struct acpi_device *companion; /* ACPI companion device */ |
| 19 | #endif | 19 | #endif |
| 20 | #ifdef CONFIG_X86_64 | 20 | #ifdef CONFIG_X86_64 |
| 21 | void *iommu; /* IOMMU private data */ | 21 | void *iommu; /* IOMMU private data */ |
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h index b93e09a0fa21..37813b5ddc37 100644 --- a/arch/x86/include/uapi/asm/msr-index.h +++ b/arch/x86/include/uapi/asm/msr-index.h | |||
| @@ -147,6 +147,8 @@ | |||
| 147 | #define MSR_PP1_ENERGY_STATUS 0x00000641 | 147 | #define MSR_PP1_ENERGY_STATUS 0x00000641 |
| 148 | #define MSR_PP1_POLICY 0x00000642 | 148 | #define MSR_PP1_POLICY 0x00000642 |
| 149 | 149 | ||
| 150 | #define MSR_CORE_C1_RES 0x00000660 | ||
| 151 | |||
| 150 | #define MSR_AMD64_MC0_MASK 0xc0010044 | 152 | #define MSR_AMD64_MC0_MASK 0xc0010044 |
| 151 | 153 | ||
| 152 | #define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x)) | 154 | #define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x)) |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 7fb24e53d4c8..4f25ec077552 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
| @@ -518,7 +518,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) | |||
| 518 | sd = &info->sd; | 518 | sd = &info->sd; |
| 519 | sd->domain = domain; | 519 | sd->domain = domain; |
| 520 | sd->node = node; | 520 | sd->node = node; |
| 521 | sd->acpi = device->handle; | 521 | sd->companion = device; |
| 522 | /* | 522 | /* |
| 523 | * Maybe the desired pci bus has been already scanned. In such case | 523 | * Maybe the desired pci bus has been already scanned. In such case |
| 524 | * it is unnecessary to scan the pci bus with the given domain,busnum. | 524 | * it is unnecessary to scan the pci bus with the given domain,busnum. |
| @@ -589,7 +589,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) | |||
| 589 | { | 589 | { |
| 590 | struct pci_sysdata *sd = bridge->bus->sysdata; | 590 | struct pci_sysdata *sd = bridge->bus->sysdata; |
| 591 | 591 | ||
| 592 | ACPI_HANDLE_SET(&bridge->dev, sd->acpi); | 592 | ACPI_COMPANION_SET(&bridge->dev, sd->companion); |
| 593 | return 0; | 593 | return 0; |
| 594 | } | 594 | } |
| 595 | 595 | ||
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index c95df0b8c880..5d9248526d78 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -235,17 +235,6 @@ config ACPI_INITRD_TABLE_OVERRIDE | |||
| 235 | initrd, therefore it's safe to say Y. | 235 | initrd, therefore it's safe to say Y. |
| 236 | See Documentation/acpi/initrd_table_override.txt for details | 236 | See Documentation/acpi/initrd_table_override.txt for details |
| 237 | 237 | ||
| 238 | config ACPI_BLACKLIST_YEAR | ||
| 239 | int "Disable ACPI for systems before Jan 1st this year" if X86_32 | ||
| 240 | default 0 | ||
| 241 | help | ||
| 242 | Enter a 4-digit year, e.g., 2001, to disable ACPI by default | ||
| 243 | on platforms with DMI BIOS date before January 1st that year. | ||
| 244 | "acpi=force" can be used to override this mechanism. | ||
| 245 | |||
| 246 | Enter 0 to disable this mechanism and allow ACPI to | ||
| 247 | run by default no matter what the year. (default) | ||
| 248 | |||
| 249 | config ACPI_DEBUG | 238 | config ACPI_DEBUG |
| 250 | bool "Debug Statements" | 239 | bool "Debug Statements" |
| 251 | default n | 240 | default n |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index b9f0d5f4bba5..8711e3797165 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
| @@ -56,7 +56,6 @@ static int ac_sleep_before_get_state_ms; | |||
| 56 | 56 | ||
| 57 | struct acpi_ac { | 57 | struct acpi_ac { |
| 58 | struct power_supply charger; | 58 | struct power_supply charger; |
| 59 | struct acpi_device *adev; | ||
| 60 | struct platform_device *pdev; | 59 | struct platform_device *pdev; |
| 61 | unsigned long long state; | 60 | unsigned long long state; |
| 62 | }; | 61 | }; |
| @@ -70,8 +69,9 @@ struct acpi_ac { | |||
| 70 | static int acpi_ac_get_state(struct acpi_ac *ac) | 69 | static int acpi_ac_get_state(struct acpi_ac *ac) |
| 71 | { | 70 | { |
| 72 | acpi_status status; | 71 | acpi_status status; |
| 72 | acpi_handle handle = ACPI_HANDLE(&ac->pdev->dev); | ||
| 73 | 73 | ||
| 74 | status = acpi_evaluate_integer(ac->adev->handle, "_PSR", NULL, | 74 | status = acpi_evaluate_integer(handle, "_PSR", NULL, |
| 75 | &ac->state); | 75 | &ac->state); |
| 76 | if (ACPI_FAILURE(status)) { | 76 | if (ACPI_FAILURE(status)) { |
| 77 | ACPI_EXCEPTION((AE_INFO, status, | 77 | ACPI_EXCEPTION((AE_INFO, status, |
| @@ -119,6 +119,7 @@ static enum power_supply_property ac_props[] = { | |||
| 119 | static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) | 119 | static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) |
| 120 | { | 120 | { |
| 121 | struct acpi_ac *ac = data; | 121 | struct acpi_ac *ac = data; |
| 122 | struct acpi_device *adev; | ||
| 122 | 123 | ||
| 123 | if (!ac) | 124 | if (!ac) |
| 124 | return; | 125 | return; |
| @@ -141,10 +142,11 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) | |||
| 141 | msleep(ac_sleep_before_get_state_ms); | 142 | msleep(ac_sleep_before_get_state_ms); |
| 142 | 143 | ||
| 143 | acpi_ac_get_state(ac); | 144 | acpi_ac_get_state(ac); |
| 144 | acpi_bus_generate_netlink_event(ac->adev->pnp.device_class, | 145 | adev = ACPI_COMPANION(&ac->pdev->dev); |
| 146 | acpi_bus_generate_netlink_event(adev->pnp.device_class, | ||
| 145 | dev_name(&ac->pdev->dev), | 147 | dev_name(&ac->pdev->dev), |
| 146 | event, (u32) ac->state); | 148 | event, (u32) ac->state); |
| 147 | acpi_notifier_call_chain(ac->adev, event, (u32) ac->state); | 149 | acpi_notifier_call_chain(adev, event, (u32) ac->state); |
| 148 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 150 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
| 149 | } | 151 | } |
| 150 | 152 | ||
| @@ -178,8 +180,8 @@ static int acpi_ac_probe(struct platform_device *pdev) | |||
| 178 | if (!pdev) | 180 | if (!pdev) |
| 179 | return -EINVAL; | 181 | return -EINVAL; |
| 180 | 182 | ||
| 181 | result = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev); | 183 | adev = ACPI_COMPANION(&pdev->dev); |
| 182 | if (result) | 184 | if (!adev) |
| 183 | return -ENODEV; | 185 | return -ENODEV; |
| 184 | 186 | ||
| 185 | ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL); | 187 | ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL); |
| @@ -188,7 +190,6 @@ static int acpi_ac_probe(struct platform_device *pdev) | |||
| 188 | 190 | ||
| 189 | strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME); | 191 | strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME); |
| 190 | strcpy(acpi_device_class(adev), ACPI_AC_CLASS); | 192 | strcpy(acpi_device_class(adev), ACPI_AC_CLASS); |
| 191 | ac->adev = adev; | ||
| 192 | ac->pdev = pdev; | 193 | ac->pdev = pdev; |
| 193 | platform_set_drvdata(pdev, ac); | 194 | platform_set_drvdata(pdev, ac); |
| 194 | 195 | ||
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index d3961014aad7..6745fe137b9e 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
| @@ -163,6 +163,15 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { | |||
| 163 | { "80860F41", (unsigned long)&byt_i2c_dev_desc }, | 163 | { "80860F41", (unsigned long)&byt_i2c_dev_desc }, |
| 164 | { "INT33B2", }, | 164 | { "INT33B2", }, |
| 165 | 165 | ||
| 166 | { "INT3430", (unsigned long)&lpt_dev_desc }, | ||
| 167 | { "INT3431", (unsigned long)&lpt_dev_desc }, | ||
| 168 | { "INT3432", (unsigned long)&lpt_dev_desc }, | ||
| 169 | { "INT3433", (unsigned long)&lpt_dev_desc }, | ||
| 170 | { "INT3434", (unsigned long)&lpt_uart_dev_desc }, | ||
| 171 | { "INT3435", (unsigned long)&lpt_uart_dev_desc }, | ||
| 172 | { "INT3436", (unsigned long)&lpt_sdio_dev_desc }, | ||
| 173 | { "INT3437", }, | ||
| 174 | |||
| 166 | { } | 175 | { } |
| 167 | }; | 176 | }; |
| 168 | 177 | ||
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 8a4cfc7e71f0..dbfe49e5fd63 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c | |||
| @@ -111,7 +111,7 @@ int acpi_create_platform_device(struct acpi_device *adev, | |||
| 111 | pdevinfo.id = -1; | 111 | pdevinfo.id = -1; |
| 112 | pdevinfo.res = resources; | 112 | pdevinfo.res = resources; |
| 113 | pdevinfo.num_res = count; | 113 | pdevinfo.num_res = count; |
| 114 | pdevinfo.acpi_node.handle = adev->handle; | 114 | pdevinfo.acpi_node.companion = adev; |
| 115 | pdev = platform_device_register_full(&pdevinfo); | 115 | pdev = platform_device_register_full(&pdevinfo); |
| 116 | if (IS_ERR(pdev)) { | 116 | if (IS_ERR(pdev)) { |
| 117 | dev_err(&adev->dev, "platform device creation failed: %ld\n", | 117 | dev_err(&adev->dev, "platform device creation failed: %ld\n", |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index fb848378d582..078c4f7fe2dd 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
| @@ -75,39 +75,6 @@ static struct acpi_blacklist_item acpi_blacklist[] __initdata = { | |||
| 75 | {""} | 75 | {""} |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | #if CONFIG_ACPI_BLACKLIST_YEAR | ||
| 79 | |||
| 80 | static int __init blacklist_by_year(void) | ||
| 81 | { | ||
| 82 | int year; | ||
| 83 | |||
| 84 | /* Doesn't exist? Likely an old system */ | ||
| 85 | if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) { | ||
| 86 | printk(KERN_ERR PREFIX "no DMI BIOS year, " | ||
| 87 | "acpi=force is required to enable ACPI\n" ); | ||
| 88 | return 1; | ||
| 89 | } | ||
| 90 | /* 0? Likely a buggy new BIOS */ | ||
| 91 | if (year == 0) { | ||
| 92 | printk(KERN_ERR PREFIX "DMI BIOS year==0, " | ||
| 93 | "assuming ACPI-capable machine\n" ); | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | if (year < CONFIG_ACPI_BLACKLIST_YEAR) { | ||
| 97 | printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " | ||
| 98 | "acpi=force is required to enable ACPI\n", | ||
| 99 | year, CONFIG_ACPI_BLACKLIST_YEAR); | ||
| 100 | return 1; | ||
| 101 | } | ||
| 102 | return 0; | ||
| 103 | } | ||
| 104 | #else | ||
| 105 | static inline int blacklist_by_year(void) | ||
| 106 | { | ||
| 107 | return 0; | ||
| 108 | } | ||
| 109 | #endif | ||
| 110 | |||
| 111 | int __init acpi_blacklisted(void) | 78 | int __init acpi_blacklisted(void) |
| 112 | { | 79 | { |
| 113 | int i = 0; | 80 | int i = 0; |
| @@ -166,8 +133,6 @@ int __init acpi_blacklisted(void) | |||
| 166 | } | 133 | } |
| 167 | } | 134 | } |
| 168 | 135 | ||
| 169 | blacklisted += blacklist_by_year(); | ||
| 170 | |||
| 171 | dmi_check_system(acpi_osi_dmi_table); | 136 | dmi_check_system(acpi_osi_dmi_table); |
| 172 | 137 | ||
| 173 | return blacklisted; | 138 | return blacklisted; |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index d42b2fb5a7e9..b3480cf7db1a 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
| @@ -22,16 +22,12 @@ | |||
| 22 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 22 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #include <linux/device.h> | 25 | #include <linux/acpi.h> |
| 26 | #include <linux/export.h> | 26 | #include <linux/export.h> |
| 27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 28 | #include <linux/pm_qos.h> | 28 | #include <linux/pm_qos.h> |
| 29 | #include <linux/pm_runtime.h> | 29 | #include <linux/pm_runtime.h> |
| 30 | 30 | ||
| 31 | #include <acpi/acpi.h> | ||
| 32 | #include <acpi/acpi_bus.h> | ||
| 33 | #include <acpi/acpi_drivers.h> | ||
| 34 | |||
| 35 | #include "internal.h" | 31 | #include "internal.h" |
| 36 | 32 | ||
| 37 | #define _COMPONENT ACPI_POWER_COMPONENT | 33 | #define _COMPONENT ACPI_POWER_COMPONENT |
| @@ -548,7 +544,7 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev, | |||
| 548 | */ | 544 | */ |
| 549 | int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) | 545 | int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) |
| 550 | { | 546 | { |
| 551 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | 547 | acpi_handle handle = ACPI_HANDLE(dev); |
| 552 | struct acpi_device *adev; | 548 | struct acpi_device *adev; |
| 553 | int ret, d_min, d_max; | 549 | int ret, d_min, d_max; |
| 554 | 550 | ||
| @@ -656,7 +652,7 @@ int acpi_pm_device_run_wake(struct device *phys_dev, bool enable) | |||
| 656 | if (!device_run_wake(phys_dev)) | 652 | if (!device_run_wake(phys_dev)) |
| 657 | return -EINVAL; | 653 | return -EINVAL; |
| 658 | 654 | ||
| 659 | handle = DEVICE_ACPI_HANDLE(phys_dev); | 655 | handle = ACPI_HANDLE(phys_dev); |
| 660 | if (!handle || acpi_bus_get_device(handle, &adev)) { | 656 | if (!handle || acpi_bus_get_device(handle, &adev)) { |
| 661 | dev_dbg(phys_dev, "ACPI handle without context in %s!\n", | 657 | dev_dbg(phys_dev, "ACPI handle without context in %s!\n", |
| 662 | __func__); | 658 | __func__); |
| @@ -700,7 +696,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
| 700 | if (!device_can_wakeup(dev)) | 696 | if (!device_can_wakeup(dev)) |
| 701 | return -EINVAL; | 697 | return -EINVAL; |
| 702 | 698 | ||
| 703 | handle = DEVICE_ACPI_HANDLE(dev); | 699 | handle = ACPI_HANDLE(dev); |
| 704 | if (!handle || acpi_bus_get_device(handle, &adev)) { | 700 | if (!handle || acpi_bus_get_device(handle, &adev)) { |
| 705 | dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); | 701 | dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); |
| 706 | return -ENODEV; | 702 | return -ENODEV; |
| @@ -722,7 +718,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
| 722 | */ | 718 | */ |
| 723 | struct acpi_device *acpi_dev_pm_get_node(struct device *dev) | 719 | struct acpi_device *acpi_dev_pm_get_node(struct device *dev) |
| 724 | { | 720 | { |
| 725 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | 721 | acpi_handle handle = ACPI_HANDLE(dev); |
| 726 | struct acpi_device *adev; | 722 | struct acpi_device *adev; |
| 727 | 723 | ||
| 728 | return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL; | 724 | return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d5309fd49458..ba5b56db9d27 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -173,9 +173,10 @@ static void start_transaction(struct acpi_ec *ec) | |||
| 173 | static void advance_transaction(struct acpi_ec *ec, u8 status) | 173 | static void advance_transaction(struct acpi_ec *ec, u8 status) |
| 174 | { | 174 | { |
| 175 | unsigned long flags; | 175 | unsigned long flags; |
| 176 | struct transaction *t = ec->curr; | 176 | struct transaction *t; |
| 177 | 177 | ||
| 178 | spin_lock_irqsave(&ec->lock, flags); | 178 | spin_lock_irqsave(&ec->lock, flags); |
| 179 | t = ec->curr; | ||
| 179 | if (!t) | 180 | if (!t) |
| 180 | goto unlock; | 181 | goto unlock; |
| 181 | if (t->wlen > t->wi) { | 182 | if (t->wlen > t->wi) { |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 10f0f40587bb..a22a295edb69 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -197,30 +197,28 @@ static void acpi_physnode_link_name(char *buf, unsigned int node_id) | |||
| 197 | 197 | ||
| 198 | int acpi_bind_one(struct device *dev, acpi_handle handle) | 198 | int acpi_bind_one(struct device *dev, acpi_handle handle) |
| 199 | { | 199 | { |
| 200 | struct acpi_device *acpi_dev; | 200 | struct acpi_device *acpi_dev = NULL; |
| 201 | acpi_status status; | ||
| 202 | struct acpi_device_physical_node *physical_node, *pn; | 201 | struct acpi_device_physical_node *physical_node, *pn; |
| 203 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; | 202 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; |
| 204 | struct list_head *physnode_list; | 203 | struct list_head *physnode_list; |
| 205 | unsigned int node_id; | 204 | unsigned int node_id; |
| 206 | int retval = -EINVAL; | 205 | int retval = -EINVAL; |
| 207 | 206 | ||
| 208 | if (ACPI_HANDLE(dev)) { | 207 | if (ACPI_COMPANION(dev)) { |
| 209 | if (handle) { | 208 | if (handle) { |
| 210 | dev_warn(dev, "ACPI handle is already set\n"); | 209 | dev_warn(dev, "ACPI companion already set\n"); |
| 211 | return -EINVAL; | 210 | return -EINVAL; |
| 212 | } else { | 211 | } else { |
| 213 | handle = ACPI_HANDLE(dev); | 212 | acpi_dev = ACPI_COMPANION(dev); |
| 214 | } | 213 | } |
| 214 | } else { | ||
| 215 | acpi_bus_get_device(handle, &acpi_dev); | ||
| 215 | } | 216 | } |
| 216 | if (!handle) | 217 | if (!acpi_dev) |
| 217 | return -EINVAL; | 218 | return -EINVAL; |
| 218 | 219 | ||
| 220 | get_device(&acpi_dev->dev); | ||
| 219 | get_device(dev); | 221 | get_device(dev); |
| 220 | status = acpi_bus_get_device(handle, &acpi_dev); | ||
| 221 | if (ACPI_FAILURE(status)) | ||
| 222 | goto err; | ||
| 223 | |||
| 224 | physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL); | 222 | physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL); |
| 225 | if (!physical_node) { | 223 | if (!physical_node) { |
| 226 | retval = -ENOMEM; | 224 | retval = -ENOMEM; |
| @@ -242,10 +240,11 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
| 242 | 240 | ||
| 243 | dev_warn(dev, "Already associated with ACPI node\n"); | 241 | dev_warn(dev, "Already associated with ACPI node\n"); |
| 244 | kfree(physical_node); | 242 | kfree(physical_node); |
| 245 | if (ACPI_HANDLE(dev) != handle) | 243 | if (ACPI_COMPANION(dev) != acpi_dev) |
| 246 | goto err; | 244 | goto err; |
| 247 | 245 | ||
| 248 | put_device(dev); | 246 | put_device(dev); |
| 247 | put_device(&acpi_dev->dev); | ||
| 249 | return 0; | 248 | return 0; |
| 250 | } | 249 | } |
| 251 | if (pn->node_id == node_id) { | 250 | if (pn->node_id == node_id) { |
| @@ -259,8 +258,8 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
| 259 | list_add(&physical_node->node, physnode_list); | 258 | list_add(&physical_node->node, physnode_list); |
| 260 | acpi_dev->physical_node_count++; | 259 | acpi_dev->physical_node_count++; |
| 261 | 260 | ||
| 262 | if (!ACPI_HANDLE(dev)) | 261 | if (!ACPI_COMPANION(dev)) |
| 263 | ACPI_HANDLE_SET(dev, acpi_dev->handle); | 262 | ACPI_COMPANION_SET(dev, acpi_dev); |
| 264 | 263 | ||
| 265 | acpi_physnode_link_name(physical_node_name, node_id); | 264 | acpi_physnode_link_name(physical_node_name, node_id); |
| 266 | retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | 265 | retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, |
| @@ -283,27 +282,21 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
| 283 | return 0; | 282 | return 0; |
| 284 | 283 | ||
| 285 | err: | 284 | err: |
| 286 | ACPI_HANDLE_SET(dev, NULL); | 285 | ACPI_COMPANION_SET(dev, NULL); |
| 287 | put_device(dev); | 286 | put_device(dev); |
| 287 | put_device(&acpi_dev->dev); | ||
| 288 | return retval; | 288 | return retval; |
| 289 | } | 289 | } |
| 290 | EXPORT_SYMBOL_GPL(acpi_bind_one); | 290 | EXPORT_SYMBOL_GPL(acpi_bind_one); |
| 291 | 291 | ||
| 292 | int acpi_unbind_one(struct device *dev) | 292 | int acpi_unbind_one(struct device *dev) |
| 293 | { | 293 | { |
| 294 | struct acpi_device *acpi_dev = ACPI_COMPANION(dev); | ||
| 294 | struct acpi_device_physical_node *entry; | 295 | struct acpi_device_physical_node *entry; |
| 295 | struct acpi_device *acpi_dev; | ||
| 296 | acpi_status status; | ||
| 297 | 296 | ||
| 298 | if (!ACPI_HANDLE(dev)) | 297 | if (!acpi_dev) |
| 299 | return 0; | 298 | return 0; |
| 300 | 299 | ||
| 301 | status = acpi_bus_get_device(ACPI_HANDLE(dev), &acpi_dev); | ||
| 302 | if (ACPI_FAILURE(status)) { | ||
| 303 | dev_err(dev, "Oops, ACPI handle corrupt in %s()\n", __func__); | ||
| 304 | return -EINVAL; | ||
| 305 | } | ||
| 306 | |||
| 307 | mutex_lock(&acpi_dev->physical_node_lock); | 300 | mutex_lock(&acpi_dev->physical_node_lock); |
| 308 | 301 | ||
| 309 | list_for_each_entry(entry, &acpi_dev->physical_node_list, node) | 302 | list_for_each_entry(entry, &acpi_dev->physical_node_list, node) |
| @@ -316,9 +309,10 @@ int acpi_unbind_one(struct device *dev) | |||
| 316 | acpi_physnode_link_name(physnode_name, entry->node_id); | 309 | acpi_physnode_link_name(physnode_name, entry->node_id); |
| 317 | sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name); | 310 | sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name); |
| 318 | sysfs_remove_link(&dev->kobj, "firmware_node"); | 311 | sysfs_remove_link(&dev->kobj, "firmware_node"); |
| 319 | ACPI_HANDLE_SET(dev, NULL); | 312 | ACPI_COMPANION_SET(dev, NULL); |
| 320 | /* acpi_bind_one() increase refcnt by one. */ | 313 | /* Drop references taken by acpi_bind_one(). */ |
| 321 | put_device(dev); | 314 | put_device(dev); |
| 315 | put_device(&acpi_dev->dev); | ||
| 322 | kfree(entry); | 316 | kfree(entry); |
| 323 | break; | 317 | break; |
| 324 | } | 318 | } |
| @@ -328,6 +322,15 @@ int acpi_unbind_one(struct device *dev) | |||
| 328 | } | 322 | } |
| 329 | EXPORT_SYMBOL_GPL(acpi_unbind_one); | 323 | EXPORT_SYMBOL_GPL(acpi_unbind_one); |
| 330 | 324 | ||
| 325 | void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr) | ||
| 326 | { | ||
| 327 | struct acpi_device *adev; | ||
| 328 | |||
| 329 | if (!acpi_bus_get_device(acpi_get_child(parent, addr), &adev)) | ||
| 330 | ACPI_COMPANION_SET(dev, adev); | ||
| 331 | } | ||
| 332 | EXPORT_SYMBOL_GPL(acpi_preset_companion); | ||
| 333 | |||
| 331 | static int acpi_platform_notify(struct device *dev) | 334 | static int acpi_platform_notify(struct device *dev) |
| 332 | { | 335 | { |
| 333 | struct acpi_bus_type *type = acpi_get_bus_type(dev); | 336 | struct acpi_bus_type *type = acpi_get_bus_type(dev); |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 56f05869b08d..0703bff5e60e 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
| @@ -575,6 +575,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
| 575 | dev_err(&device->dev, | 575 | dev_err(&device->dev, |
| 576 | "Bus %04x:%02x not present in PCI namespace\n", | 576 | "Bus %04x:%02x not present in PCI namespace\n", |
| 577 | root->segment, (unsigned int)root->secondary.start); | 577 | root->segment, (unsigned int)root->secondary.start); |
| 578 | device->driver_data = NULL; | ||
| 578 | result = -ENODEV; | 579 | result = -ENODEV; |
| 579 | goto end; | 580 | goto end; |
| 580 | } | 581 | } |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 55f9dedbbf9f..15daa21fcd05 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -289,24 +289,17 @@ void acpi_bus_device_eject(void *data, u32 ost_src) | |||
| 289 | { | 289 | { |
| 290 | struct acpi_device *device = data; | 290 | struct acpi_device *device = data; |
| 291 | acpi_handle handle = device->handle; | 291 | acpi_handle handle = device->handle; |
| 292 | struct acpi_scan_handler *handler; | ||
| 293 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | 292 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; |
| 294 | int error; | 293 | int error; |
| 295 | 294 | ||
| 296 | lock_device_hotplug(); | 295 | lock_device_hotplug(); |
| 297 | mutex_lock(&acpi_scan_lock); | 296 | mutex_lock(&acpi_scan_lock); |
| 298 | 297 | ||
| 299 | handler = device->handler; | ||
| 300 | if (!handler || !handler->hotplug.enabled) { | ||
| 301 | put_device(&device->dev); | ||
| 302 | goto err_support; | ||
| 303 | } | ||
| 304 | |||
| 305 | if (ost_src == ACPI_NOTIFY_EJECT_REQUEST) | 298 | if (ost_src == ACPI_NOTIFY_EJECT_REQUEST) |
| 306 | acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST, | 299 | acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST, |
| 307 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | 300 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); |
| 308 | 301 | ||
| 309 | if (handler->hotplug.mode == AHM_CONTAINER) | 302 | if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER) |
| 310 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | 303 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); |
| 311 | 304 | ||
| 312 | error = acpi_scan_hot_remove(device); | 305 | error = acpi_scan_hot_remove(device); |
| @@ -411,8 +404,7 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) | |||
| 411 | break; | 404 | break; |
| 412 | case ACPI_NOTIFY_EJECT_REQUEST: | 405 | case ACPI_NOTIFY_EJECT_REQUEST: |
| 413 | acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); | 406 | acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); |
| 414 | status = acpi_bus_get_device(handle, &adev); | 407 | if (acpi_bus_get_device(handle, &adev)) |
| 415 | if (ACPI_FAILURE(status)) | ||
| 416 | goto err_out; | 408 | goto err_out; |
| 417 | 409 | ||
| 418 | get_device(&adev->dev); | 410 | get_device(&adev->dev); |
| @@ -1997,6 +1989,7 @@ static int acpi_bus_scan_fixed(void) | |||
| 1997 | if (result) | 1989 | if (result) |
| 1998 | return result; | 1990 | return result; |
| 1999 | 1991 | ||
| 1992 | device->flags.match_driver = true; | ||
| 2000 | result = device_attach(&device->dev); | 1993 | result = device_attach(&device->dev); |
| 2001 | if (result < 0) | 1994 | if (result < 0) |
| 2002 | return result; | 1995 | return result; |
| @@ -2013,6 +2006,7 @@ static int acpi_bus_scan_fixed(void) | |||
| 2013 | if (result) | 2006 | if (result) |
| 2014 | return result; | 2007 | return result; |
| 2015 | 2008 | ||
| 2009 | device->flags.match_driver = true; | ||
| 2016 | result = device_attach(&device->dev); | 2010 | result = device_attach(&device->dev); |
| 2017 | } | 2011 | } |
| 2018 | 2012 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 18dbdff4656e..995e91bcb97b 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -82,13 +82,6 @@ static bool allow_duplicates; | |||
| 82 | module_param(allow_duplicates, bool, 0644); | 82 | module_param(allow_duplicates, bool, 0644); |
| 83 | 83 | ||
| 84 | /* | 84 | /* |
| 85 | * Some BIOSes claim they use minimum backlight at boot, | ||
| 86 | * and this may bring dimming screen after boot | ||
| 87 | */ | ||
| 88 | static bool use_bios_initial_backlight = 1; | ||
| 89 | module_param(use_bios_initial_backlight, bool, 0644); | ||
| 90 | |||
| 91 | /* | ||
| 92 | * For Windows 8 systems: if set ture and the GPU driver has | 85 | * For Windows 8 systems: if set ture and the GPU driver has |
| 93 | * registered a backlight interface, skip registering ACPI video's. | 86 | * registered a backlight interface, skip registering ACPI video's. |
| 94 | */ | 87 | */ |
| @@ -406,12 +399,6 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d) | |||
| 406 | return 0; | 399 | return 0; |
| 407 | } | 400 | } |
| 408 | 401 | ||
| 409 | static int video_ignore_initial_backlight(const struct dmi_system_id *d) | ||
| 410 | { | ||
| 411 | use_bios_initial_backlight = 0; | ||
| 412 | return 0; | ||
| 413 | } | ||
| 414 | |||
| 415 | static struct dmi_system_id video_dmi_table[] __initdata = { | 402 | static struct dmi_system_id video_dmi_table[] __initdata = { |
| 416 | /* | 403 | /* |
| 417 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 | 404 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
| @@ -456,54 +443,6 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
| 456 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), | 443 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), |
| 457 | }, | 444 | }, |
| 458 | }, | 445 | }, |
| 459 | { | ||
| 460 | .callback = video_ignore_initial_backlight, | ||
| 461 | .ident = "HP Folio 13-2000", | ||
| 462 | .matches = { | ||
| 463 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
| 464 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13 - 2000 Notebook PC"), | ||
| 465 | }, | ||
| 466 | }, | ||
| 467 | { | ||
| 468 | .callback = video_ignore_initial_backlight, | ||
| 469 | .ident = "Fujitsu E753", | ||
| 470 | .matches = { | ||
| 471 | DMI_MATCH(DMI_BOARD_VENDOR, "FUJITSU"), | ||
| 472 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E753"), | ||
| 473 | }, | ||
| 474 | }, | ||
| 475 | { | ||
| 476 | .callback = video_ignore_initial_backlight, | ||
| 477 | .ident = "HP Pavilion dm4", | ||
| 478 | .matches = { | ||
| 479 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
| 480 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"), | ||
| 481 | }, | ||
| 482 | }, | ||
| 483 | { | ||
| 484 | .callback = video_ignore_initial_backlight, | ||
| 485 | .ident = "HP Pavilion g6 Notebook PC", | ||
| 486 | .matches = { | ||
| 487 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
| 488 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion g6 Notebook PC"), | ||
| 489 | }, | ||
| 490 | }, | ||
| 491 | { | ||
| 492 | .callback = video_ignore_initial_backlight, | ||
| 493 | .ident = "HP 1000 Notebook PC", | ||
| 494 | .matches = { | ||
| 495 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
| 496 | DMI_MATCH(DMI_PRODUCT_NAME, "HP 1000 Notebook PC"), | ||
| 497 | }, | ||
| 498 | }, | ||
| 499 | { | ||
| 500 | .callback = video_ignore_initial_backlight, | ||
| 501 | .ident = "HP Pavilion m4", | ||
| 502 | .matches = { | ||
| 503 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
| 504 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion m4 Notebook PC"), | ||
| 505 | }, | ||
| 506 | }, | ||
| 507 | {} | 446 | {} |
| 508 | }; | 447 | }; |
| 509 | 448 | ||
| @@ -839,20 +778,18 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
| 839 | if (!device->cap._BQC) | 778 | if (!device->cap._BQC) |
| 840 | goto set_level; | 779 | goto set_level; |
| 841 | 780 | ||
| 842 | if (use_bios_initial_backlight) { | 781 | level = acpi_video_bqc_value_to_level(device, level_old); |
| 843 | level = acpi_video_bqc_value_to_level(device, level_old); | 782 | /* |
| 844 | /* | 783 | * On some buggy laptops, _BQC returns an uninitialized |
| 845 | * On some buggy laptops, _BQC returns an uninitialized | 784 | * value when invoked for the first time, i.e. |
| 846 | * value when invoked for the first time, i.e. | 785 | * level_old is invalid (no matter whether it's a level |
| 847 | * level_old is invalid (no matter whether it's a level | 786 | * or an index). Set the backlight to max_level in this case. |
| 848 | * or an index). Set the backlight to max_level in this case. | 787 | */ |
| 849 | */ | 788 | for (i = 2; i < br->count; i++) |
| 850 | for (i = 2; i < br->count; i++) | 789 | if (level == br->levels[i]) |
| 851 | if (level == br->levels[i]) | 790 | break; |
| 852 | break; | 791 | if (i == br->count || !level) |
| 853 | if (i == br->count || !level) | 792 | level = max_level; |
| 854 | level = max_level; | ||
| 855 | } | ||
| 856 | 793 | ||
| 857 | set_level: | 794 | set_level: |
| 858 | result = acpi_video_device_lcd_set_level(device, level); | 795 | result = acpi_video_device_lcd_set_level(device, level); |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index ab714d2ad978..4372cfa883c9 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
| @@ -185,7 +185,7 @@ void ata_acpi_bind_port(struct ata_port *ap) | |||
| 185 | if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle) | 185 | if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle) |
| 186 | return; | 186 | return; |
| 187 | 187 | ||
| 188 | ACPI_HANDLE_SET(&ap->tdev, acpi_get_child(host_handle, ap->port_no)); | 188 | acpi_preset_companion(&ap->tdev, host_handle, ap->port_no); |
| 189 | 189 | ||
| 190 | if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) | 190 | if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) |
| 191 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 191 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
| @@ -222,7 +222,7 @@ void ata_acpi_bind_dev(struct ata_device *dev) | |||
| 222 | parent_handle = port_handle; | 222 | parent_handle = port_handle; |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | ACPI_HANDLE_SET(&dev->tdev, acpi_get_child(parent_handle, adr)); | 225 | acpi_preset_companion(&dev->tdev, parent_handle, adr); |
| 226 | 226 | ||
| 227 | register_hotplug_dock_device(ata_dev_acpi_handle(dev), | 227 | register_hotplug_dock_device(ata_dev_acpi_handle(dev), |
| 228 | &ata_acpi_dev_dock_ops, dev, NULL, NULL); | 228 | &ata_acpi_dev_dock_ops, dev, NULL, NULL); |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 47051cd25113..3a94b799f166 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -432,7 +432,7 @@ struct platform_device *platform_device_register_full( | |||
| 432 | goto err_alloc; | 432 | goto err_alloc; |
| 433 | 433 | ||
| 434 | pdev->dev.parent = pdevinfo->parent; | 434 | pdev->dev.parent = pdevinfo->parent; |
| 435 | ACPI_HANDLE_SET(&pdev->dev, pdevinfo->acpi_node.handle); | 435 | ACPI_COMPANION_SET(&pdev->dev, pdevinfo->acpi_node.companion); |
| 436 | 436 | ||
| 437 | if (pdevinfo->dma_mask) { | 437 | if (pdevinfo->dma_mask) { |
| 438 | /* | 438 | /* |
| @@ -463,7 +463,7 @@ struct platform_device *platform_device_register_full( | |||
| 463 | ret = platform_device_add(pdev); | 463 | ret = platform_device_add(pdev); |
| 464 | if (ret) { | 464 | if (ret) { |
| 465 | err: | 465 | err: |
| 466 | ACPI_HANDLE_SET(&pdev->dev, NULL); | 466 | ACPI_COMPANION_SET(&pdev->dev, NULL); |
| 467 | kfree(pdev->dev.dma_mask); | 467 | kfree(pdev->dev.dma_mask); |
| 468 | 468 | ||
| 469 | err_alloc: | 469 | err_alloc: |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index c12e9b9556be..1b41fca3d65a 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -1350,6 +1350,9 @@ static int device_prepare(struct device *dev, pm_message_t state) | |||
| 1350 | 1350 | ||
| 1351 | device_unlock(dev); | 1351 | device_unlock(dev); |
| 1352 | 1352 | ||
| 1353 | if (error) | ||
| 1354 | pm_runtime_put(dev); | ||
| 1355 | |||
| 1353 | return error; | 1356 | return error; |
| 1354 | } | 1357 | } |
| 1355 | 1358 | ||
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 218460fcd2e4..25a70d06c5bf 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
| @@ -68,6 +68,9 @@ static void cs_check_cpu(int cpu, unsigned int load) | |||
| 68 | 68 | ||
| 69 | dbs_info->requested_freq += get_freq_target(cs_tuners, policy); | 69 | dbs_info->requested_freq += get_freq_target(cs_tuners, policy); |
| 70 | 70 | ||
| 71 | if (dbs_info->requested_freq > policy->max) | ||
| 72 | dbs_info->requested_freq = policy->max; | ||
| 73 | |||
| 71 | __cpufreq_driver_target(policy, dbs_info->requested_freq, | 74 | __cpufreq_driver_target(policy, dbs_info->requested_freq, |
| 72 | CPUFREQ_RELATION_H); | 75 | CPUFREQ_RELATION_H); |
| 73 | return; | 76 | return; |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 0806c31e5764..e6be63561fa6 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
| @@ -328,10 +328,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 328 | dbs_data->cdata->gov_dbs_timer); | 328 | dbs_data->cdata->gov_dbs_timer); |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | /* | ||
| 332 | * conservative does not implement micro like ondemand | ||
| 333 | * governor, thus we are bound to jiffes/HZ | ||
| 334 | */ | ||
| 335 | if (dbs_data->cdata->governor == GOV_CONSERVATIVE) { | 331 | if (dbs_data->cdata->governor == GOV_CONSERVATIVE) { |
| 336 | cs_dbs_info->down_skip = 0; | 332 | cs_dbs_info->down_skip = 0; |
| 337 | cs_dbs_info->enable = 1; | 333 | cs_dbs_info->enable = 1; |
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index be6d14307aa8..a0acd0bfba40 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c | |||
| @@ -53,6 +53,7 @@ static unsigned int omap_getspeed(unsigned int cpu) | |||
| 53 | 53 | ||
| 54 | static int omap_target(struct cpufreq_policy *policy, unsigned int index) | 54 | static int omap_target(struct cpufreq_policy *policy, unsigned int index) |
| 55 | { | 55 | { |
| 56 | int r, ret; | ||
| 56 | struct dev_pm_opp *opp; | 57 | struct dev_pm_opp *opp; |
| 57 | unsigned long freq, volt = 0, volt_old = 0, tol = 0; | 58 | unsigned long freq, volt = 0, volt_old = 0, tol = 0; |
| 58 | unsigned int old_freq, new_freq; | 59 | unsigned int old_freq, new_freq; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 7dd446150294..4e10b10d3ddd 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/acpi_gpio.h> | 13 | #include <linux/acpi_gpio.h> |
| 14 | #include <linux/idr.h> | 14 | #include <linux/idr.h> |
| 15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
| 16 | #include <linux/acpi.h> | ||
| 16 | 17 | ||
| 17 | #define CREATE_TRACE_POINTS | 18 | #define CREATE_TRACE_POINTS |
| 18 | #include <trace/events/gpio.h> | 19 | #include <trace/events/gpio.h> |
diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c index 43959edd4291..dfff0907f70e 100644 --- a/drivers/gpu/drm/i915/intel_acpi.c +++ b/drivers/gpu/drm/i915/intel_acpi.c | |||
| @@ -196,7 +196,7 @@ static bool intel_dsm_pci_probe(struct pci_dev *pdev) | |||
| 196 | acpi_handle dhandle; | 196 | acpi_handle dhandle; |
| 197 | int ret; | 197 | int ret; |
| 198 | 198 | ||
| 199 | dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); | 199 | dhandle = ACPI_HANDLE(&pdev->dev); |
| 200 | if (!dhandle) | 200 | if (!dhandle) |
| 201 | return false; | 201 | return false; |
| 202 | 202 | ||
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index 1b2f41c3f191..6d69a9bad865 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
| @@ -638,7 +638,7 @@ static void intel_didl_outputs(struct drm_device *dev) | |||
| 638 | u32 temp; | 638 | u32 temp; |
| 639 | int i = 0; | 639 | int i = 0; |
| 640 | 640 | ||
| 641 | handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev); | 641 | handle = ACPI_HANDLE(&dev->pdev->dev); |
| 642 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) | 642 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) |
| 643 | return; | 643 | return; |
| 644 | 644 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c index e286e132c7e7..129120473f6c 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c | |||
| @@ -116,7 +116,7 @@ mxm_shadow_dsm(struct nouveau_mxm *mxm, u8 version) | |||
| 116 | acpi_handle handle; | 116 | acpi_handle handle; |
| 117 | int ret; | 117 | int ret; |
| 118 | 118 | ||
| 119 | handle = DEVICE_ACPI_HANDLE(&device->pdev->dev); | 119 | handle = ACPI_HANDLE(&device->pdev->dev); |
| 120 | if (!handle) | 120 | if (!handle) |
| 121 | return false; | 121 | return false; |
| 122 | 122 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 07273a2ae62f..95c740454049 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
| @@ -256,7 +256,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) | |||
| 256 | acpi_handle dhandle; | 256 | acpi_handle dhandle; |
| 257 | int retval = 0; | 257 | int retval = 0; |
| 258 | 258 | ||
| 259 | dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); | 259 | dhandle = ACPI_HANDLE(&pdev->dev); |
| 260 | if (!dhandle) | 260 | if (!dhandle) |
| 261 | return false; | 261 | return false; |
| 262 | 262 | ||
| @@ -414,7 +414,7 @@ bool nouveau_acpi_rom_supported(struct pci_dev *pdev) | |||
| 414 | if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected) | 414 | if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected) |
| 415 | return false; | 415 | return false; |
| 416 | 416 | ||
| 417 | dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); | 417 | dhandle = ACPI_HANDLE(&pdev->dev); |
| 418 | if (!dhandle) | 418 | if (!dhandle) |
| 419 | return false; | 419 | return false; |
| 420 | 420 | ||
| @@ -448,7 +448,7 @@ nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) | |||
| 448 | return NULL; | 448 | return NULL; |
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev); | 451 | handle = ACPI_HANDLE(&dev->pdev->dev); |
| 452 | if (!handle) | 452 | if (!handle) |
| 453 | return NULL; | 453 | return NULL; |
| 454 | 454 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c index 10f98c7742d8..98a9074b306b 100644 --- a/drivers/gpu/drm/radeon/radeon_acpi.c +++ b/drivers/gpu/drm/radeon/radeon_acpi.c | |||
| @@ -369,7 +369,7 @@ int radeon_atif_handler(struct radeon_device *rdev, | |||
| 369 | return NOTIFY_DONE; | 369 | return NOTIFY_DONE; |
| 370 | 370 | ||
| 371 | /* Check pending SBIOS requests */ | 371 | /* Check pending SBIOS requests */ |
| 372 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); | 372 | handle = ACPI_HANDLE(&rdev->pdev->dev); |
| 373 | count = radeon_atif_get_sbios_requests(handle, &req); | 373 | count = radeon_atif_get_sbios_requests(handle, &req); |
| 374 | 374 | ||
| 375 | if (count <= 0) | 375 | if (count <= 0) |
| @@ -556,7 +556,7 @@ int radeon_acpi_pcie_notify_device_ready(struct radeon_device *rdev) | |||
| 556 | struct radeon_atcs *atcs = &rdev->atcs; | 556 | struct radeon_atcs *atcs = &rdev->atcs; |
| 557 | 557 | ||
| 558 | /* Get the device handle */ | 558 | /* Get the device handle */ |
| 559 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); | 559 | handle = ACPI_HANDLE(&rdev->pdev->dev); |
| 560 | if (!handle) | 560 | if (!handle) |
| 561 | return -EINVAL; | 561 | return -EINVAL; |
| 562 | 562 | ||
| @@ -596,7 +596,7 @@ int radeon_acpi_pcie_performance_request(struct radeon_device *rdev, | |||
| 596 | u32 retry = 3; | 596 | u32 retry = 3; |
| 597 | 597 | ||
| 598 | /* Get the device handle */ | 598 | /* Get the device handle */ |
| 599 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); | 599 | handle = ACPI_HANDLE(&rdev->pdev->dev); |
| 600 | if (!handle) | 600 | if (!handle) |
| 601 | return -EINVAL; | 601 | return -EINVAL; |
| 602 | 602 | ||
| @@ -699,7 +699,7 @@ int radeon_acpi_init(struct radeon_device *rdev) | |||
| 699 | int ret; | 699 | int ret; |
| 700 | 700 | ||
| 701 | /* Get the device handle */ | 701 | /* Get the device handle */ |
| 702 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); | 702 | handle = ACPI_HANDLE(&rdev->pdev->dev); |
| 703 | 703 | ||
| 704 | /* No need to proceed if we're sure that ATIF is not supported */ | 704 | /* No need to proceed if we're sure that ATIF is not supported */ |
| 705 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) | 705 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 6153ec18943a..9d302eaeea15 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
| @@ -8,8 +8,7 @@ | |||
| 8 | */ | 8 | */ |
| 9 | #include <linux/vga_switcheroo.h> | 9 | #include <linux/vga_switcheroo.h> |
| 10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
| 11 | #include <acpi/acpi.h> | 11 | #include <linux/acpi.h> |
| 12 | #include <acpi/acpi_bus.h> | ||
| 13 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
| 14 | 13 | ||
| 15 | #include "radeon_acpi.h" | 14 | #include "radeon_acpi.h" |
| @@ -447,7 +446,7 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | |||
| 447 | acpi_handle dhandle, atpx_handle; | 446 | acpi_handle dhandle, atpx_handle; |
| 448 | acpi_status status; | 447 | acpi_status status; |
| 449 | 448 | ||
| 450 | dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); | 449 | dhandle = ACPI_HANDLE(&pdev->dev); |
| 451 | if (!dhandle) | 450 | if (!dhandle) |
| 452 | return false; | 451 | return false; |
| 453 | 452 | ||
| @@ -493,7 +492,7 @@ static int radeon_atpx_init(void) | |||
| 493 | */ | 492 | */ |
| 494 | static int radeon_atpx_get_client_id(struct pci_dev *pdev) | 493 | static int radeon_atpx_get_client_id(struct pci_dev *pdev) |
| 495 | { | 494 | { |
| 496 | if (radeon_atpx_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev)) | 495 | if (radeon_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev)) |
| 497 | return VGA_SWITCHEROO_IGD; | 496 | return VGA_SWITCHEROO_IGD; |
| 498 | else | 497 | else |
| 499 | return VGA_SWITCHEROO_DIS; | 498 | return VGA_SWITCHEROO_DIS; |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index c155d6f3fa68..b3633d9a5317 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
| @@ -185,7 +185,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev) | |||
| 185 | return false; | 185 | return false; |
| 186 | 186 | ||
| 187 | while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { | 187 | while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { |
| 188 | dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); | 188 | dhandle = ACPI_HANDLE(&pdev->dev); |
| 189 | if (!dhandle) | 189 | if (!dhandle) |
| 190 | continue; | 190 | continue; |
| 191 | 191 | ||
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index ae48d18ee315..5f7e55f4b7f0 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
| @@ -1008,7 +1008,7 @@ static int i2c_hid_probe(struct i2c_client *client, | |||
| 1008 | hid->hid_get_raw_report = i2c_hid_get_raw_report; | 1008 | hid->hid_get_raw_report = i2c_hid_get_raw_report; |
| 1009 | hid->hid_output_raw_report = i2c_hid_output_raw_report; | 1009 | hid->hid_output_raw_report = i2c_hid_output_raw_report; |
| 1010 | hid->dev.parent = &client->dev; | 1010 | hid->dev.parent = &client->dev; |
| 1011 | ACPI_HANDLE_SET(&hid->dev, ACPI_HANDLE(&client->dev)); | 1011 | ACPI_COMPANION_SET(&hid->dev, ACPI_COMPANION(&client->dev)); |
| 1012 | hid->bus = BUS_I2C; | 1012 | hid->bus = BUS_I2C; |
| 1013 | hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); | 1013 | hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); |
| 1014 | hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); | 1014 | hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 5923cfa390c8..d74c0b34248e 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -615,6 +615,22 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter) | |||
| 615 | } | 615 | } |
| 616 | EXPORT_SYMBOL_GPL(i2c_unlock_adapter); | 616 | EXPORT_SYMBOL_GPL(i2c_unlock_adapter); |
| 617 | 617 | ||
| 618 | static void i2c_dev_set_name(struct i2c_adapter *adap, | ||
| 619 | struct i2c_client *client) | ||
| 620 | { | ||
| 621 | struct acpi_device *adev = ACPI_COMPANION(&client->dev); | ||
| 622 | |||
| 623 | if (adev) { | ||
| 624 | dev_set_name(&client->dev, "i2c-%s", acpi_dev_name(adev)); | ||
| 625 | return; | ||
| 626 | } | ||
| 627 | |||
| 628 | /* For 10-bit clients, add an arbitrary offset to avoid collisions */ | ||
| 629 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), | ||
| 630 | client->addr | ((client->flags & I2C_CLIENT_TEN) | ||
| 631 | ? 0xa000 : 0)); | ||
| 632 | } | ||
| 633 | |||
| 618 | /** | 634 | /** |
| 619 | * i2c_new_device - instantiate an i2c device | 635 | * i2c_new_device - instantiate an i2c device |
| 620 | * @adap: the adapter managing the device | 636 | * @adap: the adapter managing the device |
| @@ -671,12 +687,9 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | |||
| 671 | client->dev.bus = &i2c_bus_type; | 687 | client->dev.bus = &i2c_bus_type; |
| 672 | client->dev.type = &i2c_client_type; | 688 | client->dev.type = &i2c_client_type; |
| 673 | client->dev.of_node = info->of_node; | 689 | client->dev.of_node = info->of_node; |
| 674 | ACPI_HANDLE_SET(&client->dev, info->acpi_node.handle); | 690 | ACPI_COMPANION_SET(&client->dev, info->acpi_node.companion); |
| 675 | 691 | ||
| 676 | /* For 10-bit clients, add an arbitrary offset to avoid collisions */ | 692 | i2c_dev_set_name(adap, client); |
| 677 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), | ||
| 678 | client->addr | ((client->flags & I2C_CLIENT_TEN) | ||
| 679 | ? 0xa000 : 0)); | ||
| 680 | status = device_register(&client->dev); | 693 | status = device_register(&client->dev); |
| 681 | if (status) | 694 | if (status) |
| 682 | goto out_err; | 695 | goto out_err; |
| @@ -1100,7 +1113,7 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, | |||
| 1100 | return AE_OK; | 1113 | return AE_OK; |
| 1101 | 1114 | ||
| 1102 | memset(&info, 0, sizeof(info)); | 1115 | memset(&info, 0, sizeof(info)); |
| 1103 | info.acpi_node.handle = handle; | 1116 | info.acpi_node.companion = adev; |
| 1104 | info.irq = -1; | 1117 | info.irq = -1; |
| 1105 | 1118 | ||
| 1106 | INIT_LIST_HEAD(&resource_list); | 1119 | INIT_LIST_HEAD(&resource_list); |
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 140c8ef50529..d9e1f7ccfe6f 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | * Copyright (C) 2006 Hannes Reinecke | 7 | * Copyright (C) 2006 Hannes Reinecke |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include <linux/acpi.h> | ||
| 10 | #include <linux/ata.h> | 11 | #include <linux/ata.h> |
| 11 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
| 12 | #include <linux/device.h> | 13 | #include <linux/device.h> |
| @@ -19,8 +20,6 @@ | |||
| 19 | #include <linux/dmi.h> | 20 | #include <linux/dmi.h> |
| 20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 21 | 22 | ||
| 22 | #include <acpi/acpi_bus.h> | ||
| 23 | |||
| 24 | #define REGS_PER_GTF 7 | 23 | #define REGS_PER_GTF 7 |
| 25 | 24 | ||
| 26 | struct GTM_buffer { | 25 | struct GTM_buffer { |
| @@ -128,7 +127,7 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, | |||
| 128 | 127 | ||
| 129 | DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func); | 128 | DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func); |
| 130 | 129 | ||
| 131 | dev_handle = DEVICE_ACPI_HANDLE(dev); | 130 | dev_handle = ACPI_HANDLE(dev); |
| 132 | if (!dev_handle) { | 131 | if (!dev_handle) { |
| 133 | DEBPRINT("no acpi handle for device\n"); | 132 | DEBPRINT("no acpi handle for device\n"); |
| 134 | goto err; | 133 | goto err; |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 3226ce98fb18..cbd4e9abc47e 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * intel_idle.c - native hardware idle loop for modern Intel processors | 2 | * intel_idle.c - native hardware idle loop for modern Intel processors |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2010, Intel Corporation. | 4 | * Copyright (c) 2013, Intel Corporation. |
| 5 | * Len Brown <len.brown@intel.com> | 5 | * Len Brown <len.brown@intel.com> |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| @@ -329,6 +329,22 @@ static struct cpuidle_state atom_cstates[] __initdata = { | |||
| 329 | { | 329 | { |
| 330 | .enter = NULL } | 330 | .enter = NULL } |
| 331 | }; | 331 | }; |
| 332 | static struct cpuidle_state avn_cstates[CPUIDLE_STATE_MAX] = { | ||
| 333 | { | ||
| 334 | .name = "C1-AVN", | ||
| 335 | .desc = "MWAIT 0x00", | ||
| 336 | .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, | ||
| 337 | .exit_latency = 2, | ||
| 338 | .target_residency = 2, | ||
| 339 | .enter = &intel_idle }, | ||
| 340 | { | ||
| 341 | .name = "C6-AVN", | ||
| 342 | .desc = "MWAIT 0x51", | ||
| 343 | .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, | ||
| 344 | .exit_latency = 15, | ||
| 345 | .target_residency = 45, | ||
| 346 | .enter = &intel_idle }, | ||
| 347 | }; | ||
| 332 | 348 | ||
| 333 | /** | 349 | /** |
| 334 | * intel_idle | 350 | * intel_idle |
| @@ -462,6 +478,11 @@ static const struct idle_cpu idle_cpu_hsw = { | |||
| 462 | .disable_promotion_to_c1e = true, | 478 | .disable_promotion_to_c1e = true, |
| 463 | }; | 479 | }; |
| 464 | 480 | ||
| 481 | static const struct idle_cpu idle_cpu_avn = { | ||
| 482 | .state_table = avn_cstates, | ||
| 483 | .disable_promotion_to_c1e = true, | ||
| 484 | }; | ||
| 485 | |||
| 465 | #define ICPU(model, cpu) \ | 486 | #define ICPU(model, cpu) \ |
| 466 | { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu } | 487 | { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu } |
| 467 | 488 | ||
| @@ -483,6 +504,7 @@ static const struct x86_cpu_id intel_idle_ids[] = { | |||
| 483 | ICPU(0x3f, idle_cpu_hsw), | 504 | ICPU(0x3f, idle_cpu_hsw), |
| 484 | ICPU(0x45, idle_cpu_hsw), | 505 | ICPU(0x45, idle_cpu_hsw), |
| 485 | ICPU(0x46, idle_cpu_hsw), | 506 | ICPU(0x46, idle_cpu_hsw), |
| 507 | ICPU(0x4D, idle_cpu_avn), | ||
| 486 | {} | 508 | {} |
| 487 | }; | 509 | }; |
| 488 | MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); | 510 | MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); |
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index ef8956568c3a..157b570ba343 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c | |||
| @@ -308,8 +308,7 @@ static void sdio_acpi_set_handle(struct sdio_func *func) | |||
| 308 | struct mmc_host *host = func->card->host; | 308 | struct mmc_host *host = func->card->host; |
| 309 | u64 addr = (host->slotno << 16) | func->num; | 309 | u64 addr = (host->slotno << 16) | func->num; |
| 310 | 310 | ||
| 311 | ACPI_HANDLE_SET(&func->dev, | 311 | acpi_preset_companion(&func->dev, ACPI_HANDLE(host->parent), addr); |
| 312 | acpi_get_child(ACPI_HANDLE(host->parent), addr)); | ||
| 313 | } | 312 | } |
| 314 | #else | 313 | #else |
| 315 | static inline void sdio_acpi_set_handle(struct sdio_func *func) {} | 314 | static inline void sdio_acpi_set_handle(struct sdio_func *func) {} |
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index 1ce8ee054f1a..a94d850ae228 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c | |||
| @@ -367,7 +367,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) | |||
| 367 | string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL }; | 367 | string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL }; |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | handle = DEVICE_ACPI_HANDLE(&pdev->dev); | 370 | handle = ACPI_HANDLE(&pdev->dev); |
| 371 | if (!handle) { | 371 | if (!handle) { |
| 372 | /* | 372 | /* |
| 373 | * This hotplug controller was not listed in the ACPI name | 373 | * This hotplug controller was not listed in the ACPI name |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 26100f510b10..1592dbe4f904 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
| @@ -176,7 +176,6 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot); | |||
| 176 | u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot); | 176 | u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot); |
| 177 | 177 | ||
| 178 | /* variables */ | 178 | /* variables */ |
| 179 | extern bool acpiphp_debug; | ||
| 180 | extern bool acpiphp_disabled; | 179 | extern bool acpiphp_disabled; |
| 181 | 180 | ||
| 182 | #endif /* _ACPIPHP_H */ | 181 | #endif /* _ACPIPHP_H */ |
diff --git a/drivers/pci/hotplug/pciehp_acpi.c b/drivers/pci/hotplug/pciehp_acpi.c index ead7c534095e..cff7cadfc2e4 100644 --- a/drivers/pci/hotplug/pciehp_acpi.c +++ b/drivers/pci/hotplug/pciehp_acpi.c | |||
| @@ -54,7 +54,7 @@ int pciehp_acpi_slot_detection_check(struct pci_dev *dev) | |||
| 54 | { | 54 | { |
| 55 | if (slot_detection_mode != PCIEHP_DETECT_ACPI) | 55 | if (slot_detection_mode != PCIEHP_DETECT_ACPI) |
| 56 | return 0; | 56 | return 0; |
| 57 | if (acpi_pci_detect_ejectable(DEVICE_ACPI_HANDLE(&dev->dev))) | 57 | if (acpi_pci_detect_ejectable(ACPI_HANDLE(&dev->dev))) |
| 58 | return 0; | 58 | return 0; |
| 59 | return -ENODEV; | 59 | return -ENODEV; |
| 60 | } | 60 | } |
| @@ -96,7 +96,7 @@ static int __init dummy_probe(struct pcie_device *dev) | |||
| 96 | dup_slot_id++; | 96 | dup_slot_id++; |
| 97 | } | 97 | } |
| 98 | list_add_tail(&slot->list, &dummy_slots); | 98 | list_add_tail(&slot->list, &dummy_slots); |
| 99 | handle = DEVICE_ACPI_HANDLE(&pdev->dev); | 99 | handle = ACPI_HANDLE(&pdev->dev); |
| 100 | if (!acpi_slot_detected && acpi_pci_detect_ejectable(handle)) | 100 | if (!acpi_slot_detected && acpi_pci_detect_ejectable(handle)) |
| 101 | acpi_slot_detected = 1; | 101 | acpi_slot_detected = 1; |
| 102 | return -ENODEV; /* dummy driver always returns error */ | 102 | return -ENODEV; /* dummy driver always returns error */ |
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index b2781dfe60e9..5b05a68cca6c 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | * Work to add BIOS PROM support was completed by Mike Habeck. | 9 | * Work to add BIOS PROM support was completed by Mike Habeck. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/acpi.h> | ||
| 12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| @@ -29,7 +30,6 @@ | |||
| 29 | #include <asm/sn/sn_feature_sets.h> | 30 | #include <asm/sn/sn_feature_sets.h> |
| 30 | #include <asm/sn/sn_sal.h> | 31 | #include <asm/sn/sn_sal.h> |
| 31 | #include <asm/sn/types.h> | 32 | #include <asm/sn/types.h> |
| 32 | #include <linux/acpi.h> | ||
| 33 | #include <asm/sn/acpi.h> | 33 | #include <asm/sn/acpi.h> |
| 34 | 34 | ||
| 35 | #include "../pci.h" | 35 | #include "../pci.h" |
| @@ -414,7 +414,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
| 414 | acpi_handle rethandle; | 414 | acpi_handle rethandle; |
| 415 | acpi_status ret; | 415 | acpi_status ret; |
| 416 | 416 | ||
| 417 | phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; | 417 | phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion); |
| 418 | 418 | ||
| 419 | if (acpi_bus_get_device(phandle, &pdevice)) { | 419 | if (acpi_bus_get_device(phandle, &pdevice)) { |
| 420 | dev_dbg(&slot->pci_bus->self->dev, | 420 | dev_dbg(&slot->pci_bus->self->dev, |
| @@ -495,7 +495,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
| 495 | 495 | ||
| 496 | /* free the ACPI resources for the slot */ | 496 | /* free the ACPI resources for the slot */ |
| 497 | if (SN_ACPI_BASE_SUPPORT() && | 497 | if (SN_ACPI_BASE_SUPPORT() && |
| 498 | PCI_CONTROLLER(slot->pci_bus)->acpi_handle) { | 498 | PCI_CONTROLLER(slot->pci_bus)->companion) { |
| 499 | unsigned long long adr; | 499 | unsigned long long adr; |
| 500 | struct acpi_device *device; | 500 | struct acpi_device *device; |
| 501 | acpi_handle phandle; | 501 | acpi_handle phandle; |
| @@ -504,7 +504,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
| 504 | acpi_status ret; | 504 | acpi_status ret; |
| 505 | 505 | ||
| 506 | /* Get the rootbus node pointer */ | 506 | /* Get the rootbus node pointer */ |
| 507 | phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; | 507 | phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion); |
| 508 | 508 | ||
| 509 | acpi_scan_lock_acquire(); | 509 | acpi_scan_lock_acquire(); |
| 510 | /* | 510 | /* |
diff --git a/drivers/pci/ioapic.c b/drivers/pci/ioapic.c index 1b90579b233a..50ce68098298 100644 --- a/drivers/pci/ioapic.c +++ b/drivers/pci/ioapic.c | |||
| @@ -37,7 +37,7 @@ static int ioapic_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
| 37 | char *type; | 37 | char *type; |
| 38 | struct resource *res; | 38 | struct resource *res; |
| 39 | 39 | ||
| 40 | handle = DEVICE_ACPI_HANDLE(&dev->dev); | 40 | handle = ACPI_HANDLE(&dev->dev); |
| 41 | if (!handle) | 41 | if (!handle) |
| 42 | return -EINVAL; | 42 | return -EINVAL; |
| 43 | 43 | ||
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dfd1f59de729..f166126e28d1 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
| @@ -173,14 +173,14 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) | |||
| 173 | 173 | ||
| 174 | static bool acpi_pci_power_manageable(struct pci_dev *dev) | 174 | static bool acpi_pci_power_manageable(struct pci_dev *dev) |
| 175 | { | 175 | { |
| 176 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 176 | acpi_handle handle = ACPI_HANDLE(&dev->dev); |
| 177 | 177 | ||
| 178 | return handle ? acpi_bus_power_manageable(handle) : false; | 178 | return handle ? acpi_bus_power_manageable(handle) : false; |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 181 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
| 182 | { | 182 | { |
| 183 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 183 | acpi_handle handle = ACPI_HANDLE(&dev->dev); |
| 184 | static const u8 state_conv[] = { | 184 | static const u8 state_conv[] = { |
| 185 | [PCI_D0] = ACPI_STATE_D0, | 185 | [PCI_D0] = ACPI_STATE_D0, |
| 186 | [PCI_D1] = ACPI_STATE_D1, | 186 | [PCI_D1] = ACPI_STATE_D1, |
| @@ -217,7 +217,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
| 217 | 217 | ||
| 218 | static bool acpi_pci_can_wakeup(struct pci_dev *dev) | 218 | static bool acpi_pci_can_wakeup(struct pci_dev *dev) |
| 219 | { | 219 | { |
| 220 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 220 | acpi_handle handle = ACPI_HANDLE(&dev->dev); |
| 221 | 221 | ||
| 222 | return handle ? acpi_bus_can_wakeup(handle) : false; | 222 | return handle ? acpi_bus_can_wakeup(handle) : false; |
| 223 | } | 223 | } |
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index edaed6f4da6c..d51f45aa669e 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c | |||
| @@ -263,7 +263,7 @@ device_has_dsm(struct device *dev) | |||
| 263 | acpi_handle handle; | 263 | acpi_handle handle; |
| 264 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; | 264 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; |
| 265 | 265 | ||
| 266 | handle = DEVICE_ACPI_HANDLE(dev); | 266 | handle = ACPI_HANDLE(dev); |
| 267 | 267 | ||
| 268 | if (!handle) | 268 | if (!handle) |
| 269 | return FALSE; | 269 | return FALSE; |
| @@ -295,7 +295,7 @@ acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 295 | acpi_handle handle; | 295 | acpi_handle handle; |
| 296 | int length; | 296 | int length; |
| 297 | 297 | ||
| 298 | handle = DEVICE_ACPI_HANDLE(dev); | 298 | handle = ACPI_HANDLE(dev); |
| 299 | 299 | ||
| 300 | if (!handle) | 300 | if (!handle) |
| 301 | return -1; | 301 | return -1; |
| @@ -316,7 +316,7 @@ acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 316 | acpi_handle handle; | 316 | acpi_handle handle; |
| 317 | int length; | 317 | int length; |
| 318 | 318 | ||
| 319 | handle = DEVICE_ACPI_HANDLE(dev); | 319 | handle = ACPI_HANDLE(dev); |
| 320 | 320 | ||
| 321 | if (!handle) | 321 | if (!handle) |
| 322 | return -1; | 322 | return -1; |
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 605a9be55129..b9429fbf1cd8 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c | |||
| @@ -519,7 +519,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) | |||
| 519 | 519 | ||
| 520 | gmux_data->power_state = VGA_SWITCHEROO_ON; | 520 | gmux_data->power_state = VGA_SWITCHEROO_ON; |
| 521 | 521 | ||
| 522 | gmux_data->dhandle = DEVICE_ACPI_HANDLE(&pnp->dev); | 522 | gmux_data->dhandle = ACPI_HANDLE(&pnp->dev); |
| 523 | if (!gmux_data->dhandle) { | 523 | if (!gmux_data->dhandle) { |
| 524 | pr_err("Cannot find acpi handle for pnp device %s\n", | 524 | pr_err("Cannot find acpi handle for pnp device %s\n", |
| 525 | dev_name(&pnp->dev)); | 525 | dev_name(&pnp->dev)); |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 747826d99059..14655a0f0431 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
| @@ -89,7 +89,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) | |||
| 89 | 89 | ||
| 90 | pnp_dbg(&dev->dev, "set resources\n"); | 90 | pnp_dbg(&dev->dev, "set resources\n"); |
| 91 | 91 | ||
| 92 | handle = DEVICE_ACPI_HANDLE(&dev->dev); | 92 | handle = ACPI_HANDLE(&dev->dev); |
| 93 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { | 93 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { |
| 94 | dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); | 94 | dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); |
| 95 | return -ENODEV; | 95 | return -ENODEV; |
| @@ -122,7 +122,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) | |||
| 122 | 122 | ||
| 123 | dev_dbg(&dev->dev, "disable resources\n"); | 123 | dev_dbg(&dev->dev, "disable resources\n"); |
| 124 | 124 | ||
| 125 | handle = DEVICE_ACPI_HANDLE(&dev->dev); | 125 | handle = ACPI_HANDLE(&dev->dev); |
| 126 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { | 126 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { |
| 127 | dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); | 127 | dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); |
| 128 | return 0; | 128 | return 0; |
| @@ -144,7 +144,7 @@ static bool pnpacpi_can_wakeup(struct pnp_dev *dev) | |||
| 144 | struct acpi_device *acpi_dev; | 144 | struct acpi_device *acpi_dev; |
| 145 | acpi_handle handle; | 145 | acpi_handle handle; |
| 146 | 146 | ||
| 147 | handle = DEVICE_ACPI_HANDLE(&dev->dev); | 147 | handle = ACPI_HANDLE(&dev->dev); |
| 148 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { | 148 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { |
| 149 | dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); | 149 | dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); |
| 150 | return false; | 150 | return false; |
| @@ -159,7 +159,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) | |||
| 159 | acpi_handle handle; | 159 | acpi_handle handle; |
| 160 | int error = 0; | 160 | int error = 0; |
| 161 | 161 | ||
| 162 | handle = DEVICE_ACPI_HANDLE(&dev->dev); | 162 | handle = ACPI_HANDLE(&dev->dev); |
| 163 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { | 163 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { |
| 164 | dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); | 164 | dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); |
| 165 | return 0; | 165 | return 0; |
| @@ -194,7 +194,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) | |||
| 194 | static int pnpacpi_resume(struct pnp_dev *dev) | 194 | static int pnpacpi_resume(struct pnp_dev *dev) |
| 195 | { | 195 | { |
| 196 | struct acpi_device *acpi_dev; | 196 | struct acpi_device *acpi_dev; |
| 197 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 197 | acpi_handle handle = ACPI_HANDLE(&dev->dev); |
| 198 | int error = 0; | 198 | int error = 0; |
| 199 | 199 | ||
| 200 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { | 200 | if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 8d85ddc46011..18cc625d887f 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -357,6 +357,19 @@ struct spi_device *spi_alloc_device(struct spi_master *master) | |||
| 357 | } | 357 | } |
| 358 | EXPORT_SYMBOL_GPL(spi_alloc_device); | 358 | EXPORT_SYMBOL_GPL(spi_alloc_device); |
| 359 | 359 | ||
| 360 | static void spi_dev_set_name(struct spi_device *spi) | ||
| 361 | { | ||
| 362 | struct acpi_device *adev = ACPI_COMPANION(&spi->dev); | ||
| 363 | |||
| 364 | if (adev) { | ||
| 365 | dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev)); | ||
| 366 | return; | ||
| 367 | } | ||
| 368 | |||
| 369 | dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), | ||
| 370 | spi->chip_select); | ||
| 371 | } | ||
| 372 | |||
| 360 | /** | 373 | /** |
| 361 | * spi_add_device - Add spi_device allocated with spi_alloc_device | 374 | * spi_add_device - Add spi_device allocated with spi_alloc_device |
| 362 | * @spi: spi_device to register | 375 | * @spi: spi_device to register |
| @@ -383,9 +396,7 @@ int spi_add_device(struct spi_device *spi) | |||
| 383 | } | 396 | } |
| 384 | 397 | ||
| 385 | /* Set the bus ID string */ | 398 | /* Set the bus ID string */ |
| 386 | dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), | 399 | spi_dev_set_name(spi); |
| 387 | spi->chip_select); | ||
| 388 | |||
| 389 | 400 | ||
| 390 | /* We need to make sure there's no other device with this | 401 | /* We need to make sure there's no other device with this |
| 391 | * chipselect **BEFORE** we call setup(), else we'll trash | 402 | * chipselect **BEFORE** we call setup(), else we'll trash |
| @@ -1144,7 +1155,7 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level, | |||
| 1144 | return AE_NO_MEMORY; | 1155 | return AE_NO_MEMORY; |
| 1145 | } | 1156 | } |
| 1146 | 1157 | ||
| 1147 | ACPI_HANDLE_SET(&spi->dev, handle); | 1158 | ACPI_COMPANION_SET(&spi->dev, adev); |
| 1148 | spi->irq = -1; | 1159 | spi->irq = -1; |
| 1149 | 1160 | ||
| 1150 | INIT_LIST_HEAD(&resource_list); | 1161 | INIT_LIST_HEAD(&resource_list); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 06cec635e703..a7c04e24ca48 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -5501,6 +5501,6 @@ acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, | |||
| 5501 | if (!hub) | 5501 | if (!hub) |
| 5502 | return NULL; | 5502 | return NULL; |
| 5503 | 5503 | ||
| 5504 | return DEVICE_ACPI_HANDLE(&hub->ports[port1 - 1]->dev); | 5504 | return ACPI_HANDLE(&hub->ports[port1 - 1]->dev); |
| 5505 | } | 5505 | } |
| 5506 | #endif | 5506 | #endif |
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index 255c14464bf2..4e243c37f17f 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c | |||
| @@ -173,7 +173,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle) | |||
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | /* root hub's parent is the usb hcd. */ | 175 | /* root hub's parent is the usb hcd. */ |
| 176 | parent_handle = DEVICE_ACPI_HANDLE(dev->parent); | 176 | parent_handle = ACPI_HANDLE(dev->parent); |
| 177 | *handle = acpi_get_child(parent_handle, udev->portnum); | 177 | *handle = acpi_get_child(parent_handle, udev->portnum); |
| 178 | if (!*handle) | 178 | if (!*handle) |
| 179 | return -ENODEV; | 179 | return -ENODEV; |
| @@ -194,7 +194,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle) | |||
| 194 | 194 | ||
| 195 | raw_port_num = usb_hcd_find_raw_port_number(hcd, | 195 | raw_port_num = usb_hcd_find_raw_port_number(hcd, |
| 196 | port_num); | 196 | port_num); |
| 197 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(&udev->dev), | 197 | *handle = acpi_get_child(ACPI_HANDLE(&udev->dev), |
| 198 | raw_port_num); | 198 | raw_port_num); |
| 199 | if (!*handle) | 199 | if (!*handle) |
| 200 | return -ENODEV; | 200 | return -ENODEV; |
diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c index d15f6e80479f..188825122aae 100644 --- a/drivers/xen/pci.c +++ b/drivers/xen/pci.c | |||
| @@ -59,12 +59,12 @@ static int xen_add_device(struct device *dev) | |||
| 59 | add.flags = XEN_PCI_DEV_EXTFN; | 59 | add.flags = XEN_PCI_DEV_EXTFN; |
| 60 | 60 | ||
| 61 | #ifdef CONFIG_ACPI | 61 | #ifdef CONFIG_ACPI |
| 62 | handle = DEVICE_ACPI_HANDLE(&pci_dev->dev); | 62 | handle = ACPI_HANDLE(&pci_dev->dev); |
| 63 | if (!handle && pci_dev->bus->bridge) | 63 | if (!handle && pci_dev->bus->bridge) |
| 64 | handle = DEVICE_ACPI_HANDLE(pci_dev->bus->bridge); | 64 | handle = ACPI_HANDLE(pci_dev->bus->bridge); |
| 65 | #ifdef CONFIG_PCI_IOV | 65 | #ifdef CONFIG_PCI_IOV |
| 66 | if (!handle && pci_dev->is_virtfn) | 66 | if (!handle && pci_dev->is_virtfn) |
| 67 | handle = DEVICE_ACPI_HANDLE(physfn->bus->bridge); | 67 | handle = ACPI_HANDLE(physfn->bus->bridge); |
| 68 | #endif | 68 | #endif |
| 69 | if (handle) { | 69 | if (handle) { |
| 70 | acpi_status status; | 70 | acpi_status status; |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 89c60b0f6408..7b2de026a4f3 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -431,9 +431,9 @@ static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr) | |||
| 431 | { | 431 | { |
| 432 | return acpi_find_child(handle, addr, false); | 432 | return acpi_find_child(handle, addr, false); |
| 433 | } | 433 | } |
| 434 | void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr); | ||
| 434 | int acpi_is_root_bridge(acpi_handle); | 435 | int acpi_is_root_bridge(acpi_handle); |
| 435 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); | 436 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); |
| 436 | #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev)) | ||
| 437 | 437 | ||
| 438 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); | 438 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); |
| 439 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); | 439 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index b0972c4ce81c..d9099b15b472 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -44,6 +44,20 @@ | |||
| 44 | #include <acpi/acpi_numa.h> | 44 | #include <acpi/acpi_numa.h> |
| 45 | #include <asm/acpi.h> | 45 | #include <asm/acpi.h> |
| 46 | 46 | ||
| 47 | static inline acpi_handle acpi_device_handle(struct acpi_device *adev) | ||
| 48 | { | ||
| 49 | return adev ? adev->handle : NULL; | ||
| 50 | } | ||
| 51 | |||
| 52 | #define ACPI_COMPANION(dev) ((dev)->acpi_node.companion) | ||
| 53 | #define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev) | ||
| 54 | #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) | ||
| 55 | |||
| 56 | static inline const char *acpi_dev_name(struct acpi_device *adev) | ||
| 57 | { | ||
| 58 | return dev_name(&adev->dev); | ||
| 59 | } | ||
| 60 | |||
| 47 | enum acpi_irq_model_id { | 61 | enum acpi_irq_model_id { |
| 48 | ACPI_IRQ_MODEL_PIC = 0, | 62 | ACPI_IRQ_MODEL_PIC = 0, |
| 49 | ACPI_IRQ_MODEL_IOAPIC, | 63 | ACPI_IRQ_MODEL_IOAPIC, |
| @@ -401,6 +415,15 @@ static inline bool acpi_driver_match_device(struct device *dev, | |||
| 401 | 415 | ||
| 402 | #define acpi_disabled 1 | 416 | #define acpi_disabled 1 |
| 403 | 417 | ||
| 418 | #define ACPI_COMPANION(dev) (NULL) | ||
| 419 | #define ACPI_COMPANION_SET(dev, adev) do { } while (0) | ||
| 420 | #define ACPI_HANDLE(dev) (NULL) | ||
| 421 | |||
| 422 | static inline const char *acpi_dev_name(struct acpi_device *adev) | ||
| 423 | { | ||
| 424 | return NULL; | ||
| 425 | } | ||
| 426 | |||
| 404 | static inline void acpi_early_init(void) { } | 427 | static inline void acpi_early_init(void) { } |
| 405 | 428 | ||
| 406 | static inline int early_acpi_boot_init(void) | 429 | static inline int early_acpi_boot_init(void) |
diff --git a/include/linux/device.h b/include/linux/device.h index b025925df7f7..952b01033c32 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -644,9 +644,11 @@ struct device_dma_parameters { | |||
| 644 | unsigned long segment_boundary_mask; | 644 | unsigned long segment_boundary_mask; |
| 645 | }; | 645 | }; |
| 646 | 646 | ||
| 647 | struct acpi_device; | ||
| 648 | |||
| 647 | struct acpi_dev_node { | 649 | struct acpi_dev_node { |
| 648 | #ifdef CONFIG_ACPI | 650 | #ifdef CONFIG_ACPI |
| 649 | void *handle; | 651 | struct acpi_device *companion; |
| 650 | #endif | 652 | #endif |
| 651 | }; | 653 | }; |
| 652 | 654 | ||
| @@ -790,14 +792,6 @@ static inline struct device *kobj_to_dev(struct kobject *kobj) | |||
| 790 | return container_of(kobj, struct device, kobj); | 792 | return container_of(kobj, struct device, kobj); |
| 791 | } | 793 | } |
| 792 | 794 | ||
| 793 | #ifdef CONFIG_ACPI | ||
| 794 | #define ACPI_HANDLE(dev) ((dev)->acpi_node.handle) | ||
| 795 | #define ACPI_HANDLE_SET(dev, _handle_) (dev)->acpi_node.handle = (_handle_) | ||
| 796 | #else | ||
| 797 | #define ACPI_HANDLE(dev) (NULL) | ||
| 798 | #define ACPI_HANDLE_SET(dev, _handle_) do { } while (0) | ||
| 799 | #endif | ||
| 800 | |||
| 801 | /* Get the wakeup routines, which depend on struct device */ | 795 | /* Get the wakeup routines, which depend on struct device */ |
| 802 | #include <linux/pm_wakeup.h> | 796 | #include <linux/pm_wakeup.h> |
| 803 | 797 | ||
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index d006f0ca60f4..5a462c4e5009 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
| @@ -27,7 +27,7 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | |||
| 27 | while (!pci_is_root_bus(pbus)) | 27 | while (!pci_is_root_bus(pbus)) |
| 28 | pbus = pbus->parent; | 28 | pbus = pbus->parent; |
| 29 | 29 | ||
| 30 | return DEVICE_ACPI_HANDLE(pbus->bridge); | 30 | return ACPI_HANDLE(pbus->bridge); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) | 33 | static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) |
| @@ -39,7 +39,7 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) | |||
| 39 | else | 39 | else |
| 40 | dev = &pbus->self->dev; | 40 | dev = &pbus->self->dev; |
| 41 | 41 | ||
| 42 | return DEVICE_ACPI_HANDLE(dev); | 42 | return ACPI_HANDLE(dev); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | void acpi_pci_add_bus(struct pci_bus *bus); | 45 | void acpi_pci_add_bus(struct pci_bus *bus); |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 10c22cae83a0..b38109e204af 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
| @@ -792,7 +792,8 @@ void free_basic_memory_bitmaps(void) | |||
| 792 | { | 792 | { |
| 793 | struct memory_bitmap *bm1, *bm2; | 793 | struct memory_bitmap *bm1, *bm2; |
| 794 | 794 | ||
| 795 | BUG_ON(!(forbidden_pages_map && free_pages_map)); | 795 | if (WARN_ON(!(forbidden_pages_map && free_pages_map))) |
| 796 | return; | ||
| 796 | 797 | ||
| 797 | bm1 = forbidden_pages_map; | 798 | bm1 = forbidden_pages_map; |
| 798 | bm2 = free_pages_map; | 799 | bm2 = free_pages_map; |
diff --git a/kernel/power/user.c b/kernel/power/user.c index 24850270c802..98d357584cd6 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
| @@ -70,6 +70,7 @@ static int snapshot_open(struct inode *inode, struct file *filp) | |||
| 70 | data->swap = swsusp_resume_device ? | 70 | data->swap = swsusp_resume_device ? |
| 71 | swap_type_of(swsusp_resume_device, 0, NULL) : -1; | 71 | swap_type_of(swsusp_resume_device, 0, NULL) : -1; |
| 72 | data->mode = O_RDONLY; | 72 | data->mode = O_RDONLY; |
| 73 | data->free_bitmaps = false; | ||
| 73 | error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); | 74 | error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); |
| 74 | if (error) | 75 | if (error) |
| 75 | pm_notifier_call_chain(PM_POST_HIBERNATION); | 76 | pm_notifier_call_chain(PM_POST_HIBERNATION); |
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index fe702076ca46..9d77f13c2d25 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * turbostat -- show CPU frequency and C-state residency | 2 | * turbostat -- show CPU frequency and C-state residency |
| 3 | * on modern Intel turbo-capable processors. | 3 | * on modern Intel turbo-capable processors. |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2012 Intel Corporation. | 5 | * Copyright (c) 2013 Intel Corporation. |
| 6 | * Len Brown <len.brown@intel.com> | 6 | * Len Brown <len.brown@intel.com> |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
| @@ -47,6 +47,8 @@ unsigned int skip_c1; | |||
| 47 | unsigned int do_nhm_cstates; | 47 | unsigned int do_nhm_cstates; |
| 48 | unsigned int do_snb_cstates; | 48 | unsigned int do_snb_cstates; |
| 49 | unsigned int do_c8_c9_c10; | 49 | unsigned int do_c8_c9_c10; |
| 50 | unsigned int do_slm_cstates; | ||
| 51 | unsigned int use_c1_residency_msr; | ||
| 50 | unsigned int has_aperf; | 52 | unsigned int has_aperf; |
| 51 | unsigned int has_epb; | 53 | unsigned int has_epb; |
| 52 | unsigned int units = 1000000000; /* Ghz etc */ | 54 | unsigned int units = 1000000000; /* Ghz etc */ |
| @@ -81,6 +83,8 @@ double rapl_joule_counter_range; | |||
| 81 | #define RAPL_DRAM (1 << 3) | 83 | #define RAPL_DRAM (1 << 3) |
| 82 | #define RAPL_PKG_PERF_STATUS (1 << 4) | 84 | #define RAPL_PKG_PERF_STATUS (1 << 4) |
| 83 | #define RAPL_DRAM_PERF_STATUS (1 << 5) | 85 | #define RAPL_DRAM_PERF_STATUS (1 << 5) |
| 86 | #define RAPL_PKG_POWER_INFO (1 << 6) | ||
| 87 | #define RAPL_CORE_POLICY (1 << 7) | ||
| 84 | #define TJMAX_DEFAULT 100 | 88 | #define TJMAX_DEFAULT 100 |
| 85 | 89 | ||
| 86 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | 90 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
| @@ -96,7 +100,7 @@ struct thread_data { | |||
| 96 | unsigned long long tsc; | 100 | unsigned long long tsc; |
| 97 | unsigned long long aperf; | 101 | unsigned long long aperf; |
| 98 | unsigned long long mperf; | 102 | unsigned long long mperf; |
| 99 | unsigned long long c1; /* derived */ | 103 | unsigned long long c1; |
| 100 | unsigned long long extra_msr64; | 104 | unsigned long long extra_msr64; |
| 101 | unsigned long long extra_delta64; | 105 | unsigned long long extra_delta64; |
| 102 | unsigned long long extra_msr32; | 106 | unsigned long long extra_msr32; |
| @@ -266,7 +270,7 @@ void print_header(void) | |||
| 266 | outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset64); | 270 | outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset64); |
| 267 | if (do_nhm_cstates) | 271 | if (do_nhm_cstates) |
| 268 | outp += sprintf(outp, " %%c1"); | 272 | outp += sprintf(outp, " %%c1"); |
| 269 | if (do_nhm_cstates) | 273 | if (do_nhm_cstates && !do_slm_cstates) |
| 270 | outp += sprintf(outp, " %%c3"); | 274 | outp += sprintf(outp, " %%c3"); |
| 271 | if (do_nhm_cstates) | 275 | if (do_nhm_cstates) |
| 272 | outp += sprintf(outp, " %%c6"); | 276 | outp += sprintf(outp, " %%c6"); |
| @@ -280,9 +284,9 @@ void print_header(void) | |||
| 280 | 284 | ||
| 281 | if (do_snb_cstates) | 285 | if (do_snb_cstates) |
| 282 | outp += sprintf(outp, " %%pc2"); | 286 | outp += sprintf(outp, " %%pc2"); |
| 283 | if (do_nhm_cstates) | 287 | if (do_nhm_cstates && !do_slm_cstates) |
| 284 | outp += sprintf(outp, " %%pc3"); | 288 | outp += sprintf(outp, " %%pc3"); |
| 285 | if (do_nhm_cstates) | 289 | if (do_nhm_cstates && !do_slm_cstates) |
| 286 | outp += sprintf(outp, " %%pc6"); | 290 | outp += sprintf(outp, " %%pc6"); |
| 287 | if (do_snb_cstates) | 291 | if (do_snb_cstates) |
| 288 | outp += sprintf(outp, " %%pc7"); | 292 | outp += sprintf(outp, " %%pc7"); |
| @@ -480,7 +484,7 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
| 480 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 484 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
| 481 | goto done; | 485 | goto done; |
| 482 | 486 | ||
| 483 | if (do_nhm_cstates) | 487 | if (do_nhm_cstates && !do_slm_cstates) |
| 484 | outp += sprintf(outp, " %6.2f", 100.0 * c->c3/t->tsc); | 488 | outp += sprintf(outp, " %6.2f", 100.0 * c->c3/t->tsc); |
| 485 | if (do_nhm_cstates) | 489 | if (do_nhm_cstates) |
| 486 | outp += sprintf(outp, " %6.2f", 100.0 * c->c6/t->tsc); | 490 | outp += sprintf(outp, " %6.2f", 100.0 * c->c6/t->tsc); |
| @@ -499,9 +503,9 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
| 499 | 503 | ||
| 500 | if (do_snb_cstates) | 504 | if (do_snb_cstates) |
| 501 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc2/t->tsc); | 505 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc2/t->tsc); |
| 502 | if (do_nhm_cstates) | 506 | if (do_nhm_cstates && !do_slm_cstates) |
| 503 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc3/t->tsc); | 507 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc3/t->tsc); |
| 504 | if (do_nhm_cstates) | 508 | if (do_nhm_cstates && !do_slm_cstates) |
| 505 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc6/t->tsc); | 509 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc6/t->tsc); |
| 506 | if (do_snb_cstates) | 510 | if (do_snb_cstates) |
| 507 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc); | 511 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc); |
| @@ -648,17 +652,24 @@ delta_thread(struct thread_data *new, struct thread_data *old, | |||
| 648 | } | 652 | } |
| 649 | 653 | ||
| 650 | 654 | ||
| 651 | /* | 655 | if (use_c1_residency_msr) { |
| 652 | * As counter collection is not atomic, | 656 | /* |
| 653 | * it is possible for mperf's non-halted cycles + idle states | 657 | * Some models have a dedicated C1 residency MSR, |
| 654 | * to exceed TSC's all cycles: show c1 = 0% in that case. | 658 | * which should be more accurate than the derivation below. |
| 655 | */ | 659 | */ |
| 656 | if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > old->tsc) | 660 | } else { |
| 657 | old->c1 = 0; | 661 | /* |
| 658 | else { | 662 | * As counter collection is not atomic, |
| 659 | /* normal case, derive c1 */ | 663 | * it is possible for mperf's non-halted cycles + idle states |
| 660 | old->c1 = old->tsc - old->mperf - core_delta->c3 | 664 | * to exceed TSC's all cycles: show c1 = 0% in that case. |
| 665 | */ | ||
| 666 | if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > old->tsc) | ||
| 667 | old->c1 = 0; | ||
| 668 | else { | ||
| 669 | /* normal case, derive c1 */ | ||
| 670 | old->c1 = old->tsc - old->mperf - core_delta->c3 | ||
| 661 | - core_delta->c6 - core_delta->c7; | 671 | - core_delta->c6 - core_delta->c7; |
| 672 | } | ||
| 662 | } | 673 | } |
| 663 | 674 | ||
| 664 | if (old->mperf == 0) { | 675 | if (old->mperf == 0) { |
| @@ -872,13 +883,21 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 872 | if (get_msr(cpu, extra_msr_offset64, &t->extra_msr64)) | 883 | if (get_msr(cpu, extra_msr_offset64, &t->extra_msr64)) |
| 873 | return -5; | 884 | return -5; |
| 874 | 885 | ||
| 886 | if (use_c1_residency_msr) { | ||
| 887 | if (get_msr(cpu, MSR_CORE_C1_RES, &t->c1)) | ||
| 888 | return -6; | ||
| 889 | } | ||
| 890 | |||
| 875 | /* collect core counters only for 1st thread in core */ | 891 | /* collect core counters only for 1st thread in core */ |
| 876 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 892 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
| 877 | return 0; | 893 | return 0; |
| 878 | 894 | ||
| 879 | if (do_nhm_cstates) { | 895 | if (do_nhm_cstates && !do_slm_cstates) { |
| 880 | if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) | 896 | if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) |
| 881 | return -6; | 897 | return -6; |
| 898 | } | ||
| 899 | |||
| 900 | if (do_nhm_cstates) { | ||
| 882 | if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) | 901 | if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) |
| 883 | return -7; | 902 | return -7; |
| 884 | } | 903 | } |
| @@ -898,7 +917,7 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 898 | if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) | 917 | if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) |
| 899 | return 0; | 918 | return 0; |
| 900 | 919 | ||
| 901 | if (do_nhm_cstates) { | 920 | if (do_nhm_cstates && !do_slm_cstates) { |
| 902 | if (get_msr(cpu, MSR_PKG_C3_RESIDENCY, &p->pc3)) | 921 | if (get_msr(cpu, MSR_PKG_C3_RESIDENCY, &p->pc3)) |
| 903 | return -9; | 922 | return -9; |
| 904 | if (get_msr(cpu, MSR_PKG_C6_RESIDENCY, &p->pc6)) | 923 | if (get_msr(cpu, MSR_PKG_C6_RESIDENCY, &p->pc6)) |
| @@ -977,7 +996,7 @@ void print_verbose_header(void) | |||
| 977 | ratio, bclk, ratio * bclk); | 996 | ratio, bclk, ratio * bclk); |
| 978 | 997 | ||
| 979 | get_msr(0, MSR_IA32_POWER_CTL, &msr); | 998 | get_msr(0, MSR_IA32_POWER_CTL, &msr); |
| 980 | fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E: %sabled)\n", | 999 | fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", |
| 981 | msr, msr & 0x2 ? "EN" : "DIS"); | 1000 | msr, msr & 0x2 ? "EN" : "DIS"); |
| 982 | 1001 | ||
| 983 | if (!do_ivt_turbo_ratio_limit) | 1002 | if (!do_ivt_turbo_ratio_limit) |
| @@ -1046,25 +1065,28 @@ print_nhm_turbo_ratio_limits: | |||
| 1046 | 1065 | ||
| 1047 | switch(msr & 0x7) { | 1066 | switch(msr & 0x7) { |
| 1048 | case 0: | 1067 | case 0: |
| 1049 | fprintf(stderr, "pc0"); | 1068 | fprintf(stderr, do_slm_cstates ? "no pkg states" : "pc0"); |
| 1050 | break; | 1069 | break; |
| 1051 | case 1: | 1070 | case 1: |
| 1052 | fprintf(stderr, do_snb_cstates ? "pc2" : "pc0"); | 1071 | fprintf(stderr, do_slm_cstates ? "no pkg states" : do_snb_cstates ? "pc2" : "pc0"); |
| 1053 | break; | 1072 | break; |
| 1054 | case 2: | 1073 | case 2: |
| 1055 | fprintf(stderr, do_snb_cstates ? "pc6-noret" : "pc3"); | 1074 | fprintf(stderr, do_slm_cstates ? "invalid" : do_snb_cstates ? "pc6-noret" : "pc3"); |
| 1056 | break; | 1075 | break; |
| 1057 | case 3: | 1076 | case 3: |
| 1058 | fprintf(stderr, "pc6"); | 1077 | fprintf(stderr, do_slm_cstates ? "invalid" : "pc6"); |
| 1059 | break; | 1078 | break; |
| 1060 | case 4: | 1079 | case 4: |
| 1061 | fprintf(stderr, "pc7"); | 1080 | fprintf(stderr, do_slm_cstates ? "pc4" : "pc7"); |
| 1062 | break; | 1081 | break; |
| 1063 | case 5: | 1082 | case 5: |
| 1064 | fprintf(stderr, do_snb_cstates ? "pc7s" : "invalid"); | 1083 | fprintf(stderr, do_slm_cstates ? "invalid" : do_snb_cstates ? "pc7s" : "invalid"); |
| 1084 | break; | ||
| 1085 | case 6: | ||
| 1086 | fprintf(stderr, do_slm_cstates ? "pc6" : "invalid"); | ||
| 1065 | break; | 1087 | break; |
| 1066 | case 7: | 1088 | case 7: |
| 1067 | fprintf(stderr, "unlimited"); | 1089 | fprintf(stderr, do_slm_cstates ? "pc7" : "unlimited"); |
| 1068 | break; | 1090 | break; |
| 1069 | default: | 1091 | default: |
| 1070 | fprintf(stderr, "invalid"); | 1092 | fprintf(stderr, "invalid"); |
| @@ -1460,6 +1482,8 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model) | |||
| 1460 | case 0x3F: /* HSW */ | 1482 | case 0x3F: /* HSW */ |
| 1461 | case 0x45: /* HSW */ | 1483 | case 0x45: /* HSW */ |
| 1462 | case 0x46: /* HSW */ | 1484 | case 0x46: /* HSW */ |
| 1485 | case 0x37: /* BYT */ | ||
| 1486 | case 0x4D: /* AVN */ | ||
| 1463 | return 1; | 1487 | return 1; |
| 1464 | case 0x2E: /* Nehalem-EX Xeon - Beckton */ | 1488 | case 0x2E: /* Nehalem-EX Xeon - Beckton */ |
| 1465 | case 0x2F: /* Westmere-EX Xeon - Eagleton */ | 1489 | case 0x2F: /* Westmere-EX Xeon - Eagleton */ |
| @@ -1532,14 +1556,33 @@ int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 1532 | #define RAPL_POWER_GRANULARITY 0x7FFF /* 15 bit power granularity */ | 1556 | #define RAPL_POWER_GRANULARITY 0x7FFF /* 15 bit power granularity */ |
| 1533 | #define RAPL_TIME_GRANULARITY 0x3F /* 6 bit time granularity */ | 1557 | #define RAPL_TIME_GRANULARITY 0x3F /* 6 bit time granularity */ |
| 1534 | 1558 | ||
| 1559 | double get_tdp(model) | ||
| 1560 | { | ||
| 1561 | unsigned long long msr; | ||
| 1562 | |||
| 1563 | if (do_rapl & RAPL_PKG_POWER_INFO) | ||
| 1564 | if (!get_msr(0, MSR_PKG_POWER_INFO, &msr)) | ||
| 1565 | return ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units; | ||
| 1566 | |||
| 1567 | switch (model) { | ||
| 1568 | case 0x37: | ||
| 1569 | case 0x4D: | ||
| 1570 | return 30.0; | ||
| 1571 | default: | ||
| 1572 | return 135.0; | ||
| 1573 | } | ||
| 1574 | } | ||
| 1575 | |||
| 1576 | |||
| 1535 | /* | 1577 | /* |
| 1536 | * rapl_probe() | 1578 | * rapl_probe() |
| 1537 | * | 1579 | * |
| 1538 | * sets do_rapl | 1580 | * sets do_rapl, rapl_power_units, rapl_energy_units, rapl_time_units |
| 1539 | */ | 1581 | */ |
| 1540 | void rapl_probe(unsigned int family, unsigned int model) | 1582 | void rapl_probe(unsigned int family, unsigned int model) |
| 1541 | { | 1583 | { |
| 1542 | unsigned long long msr; | 1584 | unsigned long long msr; |
| 1585 | unsigned int time_unit; | ||
| 1543 | double tdp; | 1586 | double tdp; |
| 1544 | 1587 | ||
| 1545 | if (!genuine_intel) | 1588 | if (!genuine_intel) |
| @@ -1555,11 +1598,15 @@ void rapl_probe(unsigned int family, unsigned int model) | |||
| 1555 | case 0x3F: /* HSW */ | 1598 | case 0x3F: /* HSW */ |
| 1556 | case 0x45: /* HSW */ | 1599 | case 0x45: /* HSW */ |
| 1557 | case 0x46: /* HSW */ | 1600 | case 0x46: /* HSW */ |
| 1558 | do_rapl = RAPL_PKG | RAPL_CORES | RAPL_GFX; | 1601 | do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO; |
| 1559 | break; | 1602 | break; |
| 1560 | case 0x2D: | 1603 | case 0x2D: |
| 1561 | case 0x3E: | 1604 | case 0x3E: |
| 1562 | do_rapl = RAPL_PKG | RAPL_CORES | RAPL_DRAM | RAPL_PKG_PERF_STATUS | RAPL_DRAM_PERF_STATUS; | 1605 | do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_PKG_PERF_STATUS | RAPL_DRAM_PERF_STATUS | RAPL_PKG_POWER_INFO; |
| 1606 | break; | ||
| 1607 | case 0x37: /* BYT */ | ||
| 1608 | case 0x4D: /* AVN */ | ||
| 1609 | do_rapl = RAPL_PKG | RAPL_CORES ; | ||
| 1563 | break; | 1610 | break; |
| 1564 | default: | 1611 | default: |
| 1565 | return; | 1612 | return; |
| @@ -1570,19 +1617,22 @@ void rapl_probe(unsigned int family, unsigned int model) | |||
| 1570 | return; | 1617 | return; |
| 1571 | 1618 | ||
| 1572 | rapl_power_units = 1.0 / (1 << (msr & 0xF)); | 1619 | rapl_power_units = 1.0 / (1 << (msr & 0xF)); |
| 1573 | rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F)); | 1620 | if (model == 0x37) |
| 1574 | rapl_time_units = 1.0 / (1 << (msr >> 16 & 0xF)); | 1621 | rapl_energy_units = 1.0 * (1 << (msr >> 8 & 0x1F)) / 1000000; |
| 1622 | else | ||
| 1623 | rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F)); | ||
| 1575 | 1624 | ||
| 1576 | /* get TDP to determine energy counter range */ | 1625 | time_unit = msr >> 16 & 0xF; |
| 1577 | if (get_msr(0, MSR_PKG_POWER_INFO, &msr)) | 1626 | if (time_unit == 0) |
| 1578 | return; | 1627 | time_unit = 0xA; |
| 1579 | 1628 | ||
| 1580 | tdp = ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units; | 1629 | rapl_time_units = 1.0 / (1 << (time_unit)); |
| 1581 | 1630 | ||
| 1582 | rapl_joule_counter_range = 0xFFFFFFFF * rapl_energy_units / tdp; | 1631 | tdp = get_tdp(model); |
| 1583 | 1632 | ||
| 1633 | rapl_joule_counter_range = 0xFFFFFFFF * rapl_energy_units / tdp; | ||
| 1584 | if (verbose) | 1634 | if (verbose) |
| 1585 | fprintf(stderr, "RAPL: %.0f sec. Joule Counter Range\n", rapl_joule_counter_range); | 1635 | fprintf(stderr, "RAPL: %.0f sec. Joule Counter Range, at %.0f Watts\n", rapl_joule_counter_range, tdp); |
| 1586 | 1636 | ||
| 1587 | return; | 1637 | return; |
| 1588 | } | 1638 | } |
| @@ -1668,7 +1718,6 @@ int print_rapl(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 1668 | { | 1718 | { |
| 1669 | unsigned long long msr; | 1719 | unsigned long long msr; |
| 1670 | int cpu; | 1720 | int cpu; |
| 1671 | double local_rapl_power_units, local_rapl_energy_units, local_rapl_time_units; | ||
| 1672 | 1721 | ||
| 1673 | if (!do_rapl) | 1722 | if (!do_rapl) |
| 1674 | return 0; | 1723 | return 0; |
| @@ -1686,23 +1735,13 @@ int print_rapl(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 1686 | if (get_msr(cpu, MSR_RAPL_POWER_UNIT, &msr)) | 1735 | if (get_msr(cpu, MSR_RAPL_POWER_UNIT, &msr)) |
| 1687 | return -1; | 1736 | return -1; |
| 1688 | 1737 | ||
| 1689 | local_rapl_power_units = 1.0 / (1 << (msr & 0xF)); | ||
| 1690 | local_rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F)); | ||
| 1691 | local_rapl_time_units = 1.0 / (1 << (msr >> 16 & 0xF)); | ||
| 1692 | |||
| 1693 | if (local_rapl_power_units != rapl_power_units) | ||
| 1694 | fprintf(stderr, "cpu%d, ERROR: Power units mis-match\n", cpu); | ||
| 1695 | if (local_rapl_energy_units != rapl_energy_units) | ||
| 1696 | fprintf(stderr, "cpu%d, ERROR: Energy units mis-match\n", cpu); | ||
| 1697 | if (local_rapl_time_units != rapl_time_units) | ||
| 1698 | fprintf(stderr, "cpu%d, ERROR: Time units mis-match\n", cpu); | ||
| 1699 | |||
| 1700 | if (verbose) { | 1738 | if (verbose) { |
| 1701 | fprintf(stderr, "cpu%d: MSR_RAPL_POWER_UNIT: 0x%08llx " | 1739 | fprintf(stderr, "cpu%d: MSR_RAPL_POWER_UNIT: 0x%08llx " |
| 1702 | "(%f Watts, %f Joules, %f sec.)\n", cpu, msr, | 1740 | "(%f Watts, %f Joules, %f sec.)\n", cpu, msr, |
| 1703 | local_rapl_power_units, local_rapl_energy_units, local_rapl_time_units); | 1741 | rapl_power_units, rapl_energy_units, rapl_time_units); |
| 1704 | } | 1742 | } |
| 1705 | if (do_rapl & RAPL_PKG) { | 1743 | if (do_rapl & RAPL_PKG_POWER_INFO) { |
| 1744 | |||
| 1706 | if (get_msr(cpu, MSR_PKG_POWER_INFO, &msr)) | 1745 | if (get_msr(cpu, MSR_PKG_POWER_INFO, &msr)) |
| 1707 | return -5; | 1746 | return -5; |
| 1708 | 1747 | ||
| @@ -1714,6 +1753,9 @@ int print_rapl(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 1714 | ((msr >> 32) & RAPL_POWER_GRANULARITY) * rapl_power_units, | 1753 | ((msr >> 32) & RAPL_POWER_GRANULARITY) * rapl_power_units, |
| 1715 | ((msr >> 48) & RAPL_TIME_GRANULARITY) * rapl_time_units); | 1754 | ((msr >> 48) & RAPL_TIME_GRANULARITY) * rapl_time_units); |
| 1716 | 1755 | ||
| 1756 | } | ||
| 1757 | if (do_rapl & RAPL_PKG) { | ||
| 1758 | |||
| 1717 | if (get_msr(cpu, MSR_PKG_POWER_LIMIT, &msr)) | 1759 | if (get_msr(cpu, MSR_PKG_POWER_LIMIT, &msr)) |
| 1718 | return -9; | 1760 | return -9; |
| 1719 | 1761 | ||
| @@ -1749,12 +1791,16 @@ int print_rapl(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 1749 | 1791 | ||
| 1750 | print_power_limit_msr(cpu, msr, "DRAM Limit"); | 1792 | print_power_limit_msr(cpu, msr, "DRAM Limit"); |
| 1751 | } | 1793 | } |
| 1752 | if (do_rapl & RAPL_CORES) { | 1794 | if (do_rapl & RAPL_CORE_POLICY) { |
| 1753 | if (verbose) { | 1795 | if (verbose) { |
| 1754 | if (get_msr(cpu, MSR_PP0_POLICY, &msr)) | 1796 | if (get_msr(cpu, MSR_PP0_POLICY, &msr)) |
| 1755 | return -7; | 1797 | return -7; |
| 1756 | 1798 | ||
| 1757 | fprintf(stderr, "cpu%d: MSR_PP0_POLICY: %lld\n", cpu, msr & 0xF); | 1799 | fprintf(stderr, "cpu%d: MSR_PP0_POLICY: %lld\n", cpu, msr & 0xF); |
| 1800 | } | ||
| 1801 | } | ||
| 1802 | if (do_rapl & RAPL_CORES) { | ||
| 1803 | if (verbose) { | ||
| 1758 | 1804 | ||
| 1759 | if (get_msr(cpu, MSR_PP0_POWER_LIMIT, &msr)) | 1805 | if (get_msr(cpu, MSR_PP0_POWER_LIMIT, &msr)) |
| 1760 | return -9; | 1806 | return -9; |
| @@ -1813,10 +1859,48 @@ int has_c8_c9_c10(unsigned int family, unsigned int model) | |||
| 1813 | } | 1859 | } |
| 1814 | 1860 | ||
| 1815 | 1861 | ||
| 1862 | int is_slm(unsigned int family, unsigned int model) | ||
| 1863 | { | ||
| 1864 | if (!genuine_intel) | ||
| 1865 | return 0; | ||
| 1866 | switch (model) { | ||
| 1867 | case 0x37: /* BYT */ | ||
| 1868 | case 0x4D: /* AVN */ | ||
| 1869 | return 1; | ||
| 1870 | } | ||
| 1871 | return 0; | ||
| 1872 | } | ||
| 1873 | |||
| 1874 | #define SLM_BCLK_FREQS 5 | ||
| 1875 | double slm_freq_table[SLM_BCLK_FREQS] = { 83.3, 100.0, 133.3, 116.7, 80.0}; | ||
| 1876 | |||
| 1877 | double slm_bclk(void) | ||
| 1878 | { | ||
| 1879 | unsigned long long msr = 3; | ||
| 1880 | unsigned int i; | ||
| 1881 | double freq; | ||
| 1882 | |||
| 1883 | if (get_msr(0, MSR_FSB_FREQ, &msr)) | ||
| 1884 | fprintf(stderr, "SLM BCLK: unknown\n"); | ||
| 1885 | |||
| 1886 | i = msr & 0xf; | ||
| 1887 | if (i >= SLM_BCLK_FREQS) { | ||
| 1888 | fprintf(stderr, "SLM BCLK[%d] invalid\n", i); | ||
| 1889 | msr = 3; | ||
| 1890 | } | ||
| 1891 | freq = slm_freq_table[i]; | ||
| 1892 | |||
| 1893 | fprintf(stderr, "SLM BCLK: %.1f Mhz\n", freq); | ||
| 1894 | |||
| 1895 | return freq; | ||
| 1896 | } | ||
| 1897 | |||
| 1816 | double discover_bclk(unsigned int family, unsigned int model) | 1898 | double discover_bclk(unsigned int family, unsigned int model) |
| 1817 | { | 1899 | { |
| 1818 | if (is_snb(family, model)) | 1900 | if (is_snb(family, model)) |
| 1819 | return 100.00; | 1901 | return 100.00; |
| 1902 | else if (is_slm(family, model)) | ||
| 1903 | return slm_bclk(); | ||
| 1820 | else | 1904 | else |
| 1821 | return 133.33; | 1905 | return 133.33; |
| 1822 | } | 1906 | } |
| @@ -1873,7 +1957,7 @@ int set_temperature_target(struct thread_data *t, struct core_data *c, struct pk | |||
| 1873 | fprintf(stderr, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n", | 1957 | fprintf(stderr, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n", |
| 1874 | cpu, msr, target_c_local); | 1958 | cpu, msr, target_c_local); |
| 1875 | 1959 | ||
| 1876 | if (target_c_local < 85 || target_c_local > 120) | 1960 | if (target_c_local < 85 || target_c_local > 127) |
| 1877 | goto guess; | 1961 | goto guess; |
| 1878 | 1962 | ||
| 1879 | tcc_activation_temp = target_c_local; | 1963 | tcc_activation_temp = target_c_local; |
| @@ -1970,6 +2054,7 @@ void check_cpuid() | |||
| 1970 | do_smi = do_nhm_cstates; | 2054 | do_smi = do_nhm_cstates; |
| 1971 | do_snb_cstates = is_snb(family, model); | 2055 | do_snb_cstates = is_snb(family, model); |
| 1972 | do_c8_c9_c10 = has_c8_c9_c10(family, model); | 2056 | do_c8_c9_c10 = has_c8_c9_c10(family, model); |
| 2057 | do_slm_cstates = is_slm(family, model); | ||
| 1973 | bclk = discover_bclk(family, model); | 2058 | bclk = discover_bclk(family, model); |
| 1974 | 2059 | ||
| 1975 | do_nehalem_turbo_ratio_limit = has_nehalem_turbo_ratio_limit(family, model); | 2060 | do_nehalem_turbo_ratio_limit = has_nehalem_turbo_ratio_limit(family, model); |
| @@ -2331,7 +2416,7 @@ int main(int argc, char **argv) | |||
| 2331 | cmdline(argc, argv); | 2416 | cmdline(argc, argv); |
| 2332 | 2417 | ||
| 2333 | if (verbose) | 2418 | if (verbose) |
| 2334 | fprintf(stderr, "turbostat v3.4 April 17, 2013" | 2419 | fprintf(stderr, "turbostat v3.5 April 26, 2013" |
| 2335 | " - Len Brown <lenb@kernel.org>\n"); | 2420 | " - Len Brown <lenb@kernel.org>\n"); |
| 2336 | 2421 | ||
| 2337 | turbostat_init(); | 2422 | turbostat_init(); |
