diff options
| -rw-r--r-- | drivers/acpi/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/acpi/battery.c | 10 | ||||
| -rw-r--r-- | drivers/acpi/bus.c | 88 | ||||
| -rw-r--r-- | drivers/acpi/power.c | 2 | ||||
| -rw-r--r-- | drivers/acpi/processor_perflib.c | 30 | ||||
| -rw-r--r-- | drivers/acpi/scan.c | 1 | ||||
| -rw-r--r-- | drivers/acpi/sleep.c | 49 | ||||
| -rw-r--r-- | drivers/rtc/rtc-cmos.c | 9 | ||||
| -rw-r--r-- | include/acpi/acpi_bus.h | 4 | ||||
| -rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 30 |
10 files changed, 175 insertions, 50 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 47768ff87343..80998958cf45 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -208,7 +208,7 @@ config ACPI_IPMI | |||
| 208 | 208 | ||
| 209 | config ACPI_HOTPLUG_CPU | 209 | config ACPI_HOTPLUG_CPU |
| 210 | bool | 210 | bool |
| 211 | depends on ACPI_PROCESSOR && HOTPLUG_CPU | 211 | depends on EXPERIMENTAL && ACPI_PROCESSOR && HOTPLUG_CPU |
| 212 | select ACPI_CONTAINER | 212 | select ACPI_CONTAINER |
| 213 | default y | 213 | default y |
| 214 | 214 | ||
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 86933ca8b472..7dd3f9fb9f3f 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -643,11 +643,19 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
| 643 | 643 | ||
| 644 | static void acpi_battery_refresh(struct acpi_battery *battery) | 644 | static void acpi_battery_refresh(struct acpi_battery *battery) |
| 645 | { | 645 | { |
| 646 | int power_unit; | ||
| 647 | |||
| 646 | if (!battery->bat.dev) | 648 | if (!battery->bat.dev) |
| 647 | return; | 649 | return; |
| 648 | 650 | ||
| 651 | power_unit = battery->power_unit; | ||
| 652 | |||
| 649 | acpi_battery_get_info(battery); | 653 | acpi_battery_get_info(battery); |
| 650 | /* The battery may have changed its reporting units. */ | 654 | |
| 655 | if (power_unit == battery->power_unit) | ||
| 656 | return; | ||
| 657 | |||
| 658 | /* The battery has changed its reporting units. */ | ||
| 651 | sysfs_remove_battery(battery); | 659 | sysfs_remove_battery(battery); |
| 652 | sysfs_add_battery(battery); | 660 | sysfs_add_battery(battery); |
| 653 | } | 661 | } |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 3188da3df8da..adceafda9c17 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -182,41 +182,66 @@ EXPORT_SYMBOL(acpi_bus_get_private_data); | |||
| 182 | Power Management | 182 | Power Management |
| 183 | -------------------------------------------------------------------------- */ | 183 | -------------------------------------------------------------------------- */ |
| 184 | 184 | ||
| 185 | static const char *state_string(int state) | ||
| 186 | { | ||
| 187 | switch (state) { | ||
| 188 | case ACPI_STATE_D0: | ||
| 189 | return "D0"; | ||
| 190 | case ACPI_STATE_D1: | ||
| 191 | return "D1"; | ||
| 192 | case ACPI_STATE_D2: | ||
| 193 | return "D2"; | ||
| 194 | case ACPI_STATE_D3_HOT: | ||
| 195 | return "D3hot"; | ||
| 196 | case ACPI_STATE_D3_COLD: | ||
| 197 | return "D3"; | ||
| 198 | default: | ||
| 199 | return "(unknown)"; | ||
| 200 | } | ||
| 201 | } | ||
| 202 | |||
| 185 | static int __acpi_bus_get_power(struct acpi_device *device, int *state) | 203 | static int __acpi_bus_get_power(struct acpi_device *device, int *state) |
| 186 | { | 204 | { |
| 187 | int result = 0; | 205 | int result = ACPI_STATE_UNKNOWN; |
| 188 | acpi_status status = 0; | ||
| 189 | unsigned long long psc = 0; | ||
| 190 | 206 | ||
| 191 | if (!device || !state) | 207 | if (!device || !state) |
| 192 | return -EINVAL; | 208 | return -EINVAL; |
| 193 | 209 | ||
| 194 | *state = ACPI_STATE_UNKNOWN; | 210 | if (!device->flags.power_manageable) { |
| 195 | |||
| 196 | if (device->flags.power_manageable) { | ||
| 197 | /* | ||
| 198 | * Get the device's power state either directly (via _PSC) or | ||
| 199 | * indirectly (via power resources). | ||
| 200 | */ | ||
| 201 | if (device->power.flags.power_resources) { | ||
| 202 | result = acpi_power_get_inferred_state(device, state); | ||
| 203 | if (result) | ||
| 204 | return result; | ||
| 205 | } else if (device->power.flags.explicit_get) { | ||
| 206 | status = acpi_evaluate_integer(device->handle, "_PSC", | ||
| 207 | NULL, &psc); | ||
| 208 | if (ACPI_FAILURE(status)) | ||
| 209 | return -ENODEV; | ||
| 210 | *state = (int)psc; | ||
| 211 | } | ||
| 212 | } else { | ||
| 213 | /* TBD: Non-recursive algorithm for walking up hierarchy. */ | 211 | /* TBD: Non-recursive algorithm for walking up hierarchy. */ |
| 214 | *state = device->parent ? | 212 | *state = device->parent ? |
| 215 | device->parent->power.state : ACPI_STATE_D0; | 213 | device->parent->power.state : ACPI_STATE_D0; |
| 214 | goto out; | ||
| 215 | } | ||
| 216 | |||
| 217 | /* | ||
| 218 | * Get the device's power state either directly (via _PSC) or | ||
| 219 | * indirectly (via power resources). | ||
| 220 | */ | ||
| 221 | if (device->power.flags.explicit_get) { | ||
| 222 | unsigned long long psc; | ||
| 223 | acpi_status status = acpi_evaluate_integer(device->handle, | ||
| 224 | "_PSC", NULL, &psc); | ||
| 225 | if (ACPI_FAILURE(status)) | ||
| 226 | return -ENODEV; | ||
| 227 | |||
| 228 | result = psc; | ||
| 229 | } | ||
| 230 | /* The test below covers ACPI_STATE_UNKNOWN too. */ | ||
| 231 | if (result <= ACPI_STATE_D2) { | ||
| 232 | ; /* Do nothing. */ | ||
| 233 | } else if (device->power.flags.power_resources) { | ||
| 234 | int error = acpi_power_get_inferred_state(device, &result); | ||
| 235 | if (error) | ||
| 236 | return error; | ||
| 237 | } else if (result == ACPI_STATE_D3_HOT) { | ||
| 238 | result = ACPI_STATE_D3; | ||
| 216 | } | 239 | } |
| 240 | *state = result; | ||
| 217 | 241 | ||
| 218 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n", | 242 | out: |
| 219 | device->pnp.bus_id, *state)); | 243 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n", |
| 244 | device->pnp.bus_id, state_string(*state))); | ||
| 220 | 245 | ||
| 221 | return 0; | 246 | return 0; |
| 222 | } | 247 | } |
| @@ -234,13 +259,14 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state) | |||
| 234 | /* Make sure this is a valid target state */ | 259 | /* Make sure this is a valid target state */ |
| 235 | 260 | ||
| 236 | if (state == device->power.state) { | 261 | if (state == device->power.state) { |
| 237 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", | 262 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n", |
| 238 | state)); | 263 | state_string(state))); |
| 239 | return 0; | 264 | return 0; |
| 240 | } | 265 | } |
| 241 | 266 | ||
| 242 | if (!device->power.states[state].flags.valid) { | 267 | if (!device->power.states[state].flags.valid) { |
| 243 | printk(KERN_WARNING PREFIX "Device does not support D%d\n", state); | 268 | printk(KERN_WARNING PREFIX "Device does not support %s\n", |
| 269 | state_string(state)); | ||
| 244 | return -ENODEV; | 270 | return -ENODEV; |
| 245 | } | 271 | } |
| 246 | if (device->parent && (state < device->parent->power.state)) { | 272 | if (device->parent && (state < device->parent->power.state)) { |
| @@ -294,13 +320,13 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state) | |||
| 294 | end: | 320 | end: |
| 295 | if (result) | 321 | if (result) |
| 296 | printk(KERN_WARNING PREFIX | 322 | printk(KERN_WARNING PREFIX |
| 297 | "Device [%s] failed to transition to D%d\n", | 323 | "Device [%s] failed to transition to %s\n", |
| 298 | device->pnp.bus_id, state); | 324 | device->pnp.bus_id, state_string(state)); |
| 299 | else { | 325 | else { |
| 300 | device->power.state = state; | 326 | device->power.state = state; |
| 301 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 327 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 302 | "Device [%s] transitioned to D%d\n", | 328 | "Device [%s] transitioned to %s\n", |
| 303 | device->pnp.bus_id, state)); | 329 | device->pnp.bus_id, state_string(state))); |
| 304 | } | 330 | } |
| 305 | 331 | ||
| 306 | return result; | 332 | return result; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 0500f719f63e..dd6d6a3c6780 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -631,7 +631,7 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state) | |||
| 631 | * We know a device's inferred power state when all the resources | 631 | * We know a device's inferred power state when all the resources |
| 632 | * required for a given D-state are 'on'. | 632 | * required for a given D-state are 'on'. |
| 633 | */ | 633 | */ |
| 634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3_HOT; i++) { | 634 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { |
| 635 | list = &device->power.states[i].resources; | 635 | list = &device->power.states[i].resources; |
| 636 | if (list->count < 1) | 636 | if (list->count < 1) |
| 637 | continue; | 637 | continue; |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 0af48a8554cd..a093dc163a42 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
| @@ -333,6 +333,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |||
| 333 | struct acpi_buffer state = { 0, NULL }; | 333 | struct acpi_buffer state = { 0, NULL }; |
| 334 | union acpi_object *pss = NULL; | 334 | union acpi_object *pss = NULL; |
| 335 | int i; | 335 | int i; |
| 336 | int last_invalid = -1; | ||
| 336 | 337 | ||
| 337 | 338 | ||
| 338 | status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); | 339 | status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); |
| @@ -394,14 +395,33 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |||
| 394 | ((u32)(px->core_frequency * 1000) != | 395 | ((u32)(px->core_frequency * 1000) != |
| 395 | (px->core_frequency * 1000))) { | 396 | (px->core_frequency * 1000))) { |
| 396 | printk(KERN_ERR FW_BUG PREFIX | 397 | printk(KERN_ERR FW_BUG PREFIX |
| 397 | "Invalid BIOS _PSS frequency: 0x%llx MHz\n", | 398 | "Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n", |
| 398 | px->core_frequency); | 399 | pr->id, px->core_frequency); |
| 399 | result = -EFAULT; | 400 | if (last_invalid == -1) |
| 400 | kfree(pr->performance->states); | 401 | last_invalid = i; |
| 401 | goto end; | 402 | } else { |
| 403 | if (last_invalid != -1) { | ||
| 404 | /* | ||
| 405 | * Copy this valid entry over last_invalid entry | ||
| 406 | */ | ||
| 407 | memcpy(&(pr->performance->states[last_invalid]), | ||
| 408 | px, sizeof(struct acpi_processor_px)); | ||
| 409 | ++last_invalid; | ||
| 410 | } | ||
| 402 | } | 411 | } |
| 403 | } | 412 | } |
| 404 | 413 | ||
| 414 | if (last_invalid == 0) { | ||
| 415 | printk(KERN_ERR FW_BUG PREFIX | ||
| 416 | "No valid BIOS _PSS frequency found for processor %d\n", pr->id); | ||
| 417 | result = -EFAULT; | ||
| 418 | kfree(pr->performance->states); | ||
| 419 | pr->performance->states = NULL; | ||
| 420 | } | ||
| 421 | |||
| 422 | if (last_invalid > 0) | ||
| 423 | pr->performance->state_count = last_invalid; | ||
| 424 | |||
| 405 | end: | 425 | end: |
| 406 | kfree(buffer.pointer); | 426 | kfree(buffer.pointer); |
| 407 | 427 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 85cbfdccc97c..c8a1f3b68110 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -1567,6 +1567,7 @@ static int acpi_bus_scan_fixed(void) | |||
| 1567 | ACPI_BUS_TYPE_POWER_BUTTON, | 1567 | ACPI_BUS_TYPE_POWER_BUTTON, |
| 1568 | ACPI_STA_DEFAULT, | 1568 | ACPI_STA_DEFAULT, |
| 1569 | &ops); | 1569 | &ops); |
| 1570 | device_init_wakeup(&device->dev, true); | ||
| 1570 | } | 1571 | } |
| 1571 | 1572 | ||
| 1572 | if ((acpi_gbl_FADT.flags & ACPI_FADT_SLEEP_BUTTON) == 0) { | 1573 | if ((acpi_gbl_FADT.flags & ACPI_FADT_SLEEP_BUTTON) == 0) { |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 74ee4ab577b6..88561029cca8 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
| @@ -57,6 +57,7 @@ MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | |||
| 57 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | 57 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); |
| 58 | 58 | ||
| 59 | static u8 sleep_states[ACPI_S_STATE_COUNT]; | 59 | static u8 sleep_states[ACPI_S_STATE_COUNT]; |
| 60 | static bool pwr_btn_event_pending; | ||
| 60 | 61 | ||
| 61 | static void acpi_sleep_tts_switch(u32 acpi_state) | 62 | static void acpi_sleep_tts_switch(u32 acpi_state) |
| 62 | { | 63 | { |
| @@ -184,6 +185,14 @@ static int acpi_pm_prepare(void) | |||
| 184 | return error; | 185 | return error; |
| 185 | } | 186 | } |
| 186 | 187 | ||
| 188 | static int find_powerf_dev(struct device *dev, void *data) | ||
| 189 | { | ||
| 190 | struct acpi_device *device = to_acpi_device(dev); | ||
| 191 | const char *hid = acpi_device_hid(device); | ||
| 192 | |||
| 193 | return !strcmp(hid, ACPI_BUTTON_HID_POWERF); | ||
| 194 | } | ||
| 195 | |||
| 187 | /** | 196 | /** |
| 188 | * acpi_pm_finish - Instruct the platform to leave a sleep state. | 197 | * acpi_pm_finish - Instruct the platform to leave a sleep state. |
| 189 | * | 198 | * |
| @@ -192,6 +201,7 @@ static int acpi_pm_prepare(void) | |||
| 192 | */ | 201 | */ |
| 193 | static void acpi_pm_finish(void) | 202 | static void acpi_pm_finish(void) |
| 194 | { | 203 | { |
| 204 | struct device *pwr_btn_dev; | ||
| 195 | u32 acpi_state = acpi_target_sleep_state; | 205 | u32 acpi_state = acpi_target_sleep_state; |
| 196 | 206 | ||
| 197 | acpi_ec_unblock_transactions(); | 207 | acpi_ec_unblock_transactions(); |
| @@ -209,6 +219,23 @@ static void acpi_pm_finish(void) | |||
| 209 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | 219 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); |
| 210 | 220 | ||
| 211 | acpi_target_sleep_state = ACPI_STATE_S0; | 221 | acpi_target_sleep_state = ACPI_STATE_S0; |
| 222 | |||
| 223 | /* If we were woken with the fixed power button, provide a small | ||
| 224 | * hint to userspace in the form of a wakeup event on the fixed power | ||
| 225 | * button device (if it can be found). | ||
| 226 | * | ||
| 227 | * We delay the event generation til now, as the PM layer requires | ||
| 228 | * timekeeping to be running before we generate events. */ | ||
| 229 | if (!pwr_btn_event_pending) | ||
| 230 | return; | ||
| 231 | |||
| 232 | pwr_btn_event_pending = false; | ||
| 233 | pwr_btn_dev = bus_find_device(&acpi_bus_type, NULL, NULL, | ||
| 234 | find_powerf_dev); | ||
| 235 | if (pwr_btn_dev) { | ||
| 236 | pm_wakeup_event(pwr_btn_dev, 0); | ||
| 237 | put_device(pwr_btn_dev); | ||
| 238 | } | ||
| 212 | } | 239 | } |
| 213 | 240 | ||
| 214 | /** | 241 | /** |
| @@ -298,9 +325,23 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
| 298 | /* ACPI 3.0 specs (P62) says that it's the responsibility | 325 | /* ACPI 3.0 specs (P62) says that it's the responsibility |
| 299 | * of the OSPM to clear the status bit [ implying that the | 326 | * of the OSPM to clear the status bit [ implying that the |
| 300 | * POWER_BUTTON event should not reach userspace ] | 327 | * POWER_BUTTON event should not reach userspace ] |
| 328 | * | ||
| 329 | * However, we do generate a small hint for userspace in the form of | ||
| 330 | * a wakeup event. We flag this condition for now and generate the | ||
| 331 | * event later, as we're currently too early in resume to be able to | ||
| 332 | * generate wakeup events. | ||
| 301 | */ | 333 | */ |
| 302 | if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) | 334 | if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) { |
| 303 | acpi_clear_event(ACPI_EVENT_POWER_BUTTON); | 335 | acpi_event_status pwr_btn_status; |
| 336 | |||
| 337 | acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status); | ||
| 338 | |||
| 339 | if (pwr_btn_status & ACPI_EVENT_FLAG_SET) { | ||
| 340 | acpi_clear_event(ACPI_EVENT_POWER_BUTTON); | ||
| 341 | /* Flag for later */ | ||
| 342 | pwr_btn_event_pending = true; | ||
| 343 | } | ||
| 344 | } | ||
| 304 | 345 | ||
| 305 | /* | 346 | /* |
| 306 | * Disable and clear GPE status before interrupt is enabled. Some GPEs | 347 | * Disable and clear GPE status before interrupt is enabled. Some GPEs |
| @@ -730,8 +771,8 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) | |||
| 730 | * can wake the system. _S0W may be valid, too. | 771 | * can wake the system. _S0W may be valid, too. |
| 731 | */ | 772 | */ |
| 732 | if (acpi_target_sleep_state == ACPI_STATE_S0 || | 773 | if (acpi_target_sleep_state == ACPI_STATE_S0 || |
| 733 | (device_may_wakeup(dev) && | 774 | (device_may_wakeup(dev) && adev->wakeup.flags.valid && |
| 734 | adev->wakeup.sleep_state <= acpi_target_sleep_state)) { | 775 | adev->wakeup.sleep_state >= acpi_target_sleep_state)) { |
| 735 | acpi_status status; | 776 | acpi_status status; |
| 736 | 777 | ||
| 737 | acpi_method[3] = 'W'; | 778 | acpi_method[3] = 'W'; |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 7d5f56edb8ef..4267789ca995 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
| @@ -910,14 +910,17 @@ static inline int cmos_poweroff(struct device *dev) | |||
| 910 | 910 | ||
| 911 | static u32 rtc_handler(void *context) | 911 | static u32 rtc_handler(void *context) |
| 912 | { | 912 | { |
| 913 | struct device *dev = context; | ||
| 914 | |||
| 915 | pm_wakeup_event(dev, 0); | ||
| 913 | acpi_clear_event(ACPI_EVENT_RTC); | 916 | acpi_clear_event(ACPI_EVENT_RTC); |
| 914 | acpi_disable_event(ACPI_EVENT_RTC, 0); | 917 | acpi_disable_event(ACPI_EVENT_RTC, 0); |
| 915 | return ACPI_INTERRUPT_HANDLED; | 918 | return ACPI_INTERRUPT_HANDLED; |
| 916 | } | 919 | } |
| 917 | 920 | ||
| 918 | static inline void rtc_wake_setup(void) | 921 | static inline void rtc_wake_setup(struct device *dev) |
| 919 | { | 922 | { |
| 920 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); | 923 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev); |
| 921 | /* | 924 | /* |
| 922 | * After the RTC handler is installed, the Fixed_RTC event should | 925 | * After the RTC handler is installed, the Fixed_RTC event should |
| 923 | * be disabled. Only when the RTC alarm is set will it be enabled. | 926 | * be disabled. Only when the RTC alarm is set will it be enabled. |
| @@ -950,7 +953,7 @@ cmos_wake_setup(struct device *dev) | |||
| 950 | if (acpi_disabled) | 953 | if (acpi_disabled) |
| 951 | return; | 954 | return; |
| 952 | 955 | ||
| 953 | rtc_wake_setup(); | 956 | rtc_wake_setup(dev); |
| 954 | acpi_rtc_info.wake_on = rtc_wake_on; | 957 | acpi_rtc_info.wake_on = rtc_wake_on; |
| 955 | acpi_rtc_info.wake_off = rtc_wake_off; | 958 | acpi_rtc_info.wake_off = rtc_wake_off; |
| 956 | 959 | ||
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index b0d62820ada1..9e6e1c6eb60a 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -440,8 +440,8 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
| 440 | 440 | ||
| 441 | #else /* CONFIG_ACPI */ | 441 | #else /* CONFIG_ACPI */ |
| 442 | 442 | ||
| 443 | static int register_acpi_bus_type(struct acpi_bus_type *bus) { return 0; } | 443 | static inline int register_acpi_bus_type(void *bus) { return 0; } |
| 444 | static int unregister_acpi_bus_type(struct acpi_bus_type *bus) { return 0; } | 444 | static inline int unregister_acpi_bus_type(void *bus) { return 0; } |
| 445 | 445 | ||
| 446 | #endif /* CONFIG_ACPI */ | 446 | #endif /* CONFIG_ACPI */ |
| 447 | 447 | ||
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index ab2f682fd44c..16de7ad4850f 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
| @@ -73,8 +73,8 @@ int backwards_count; | |||
| 73 | char *progname; | 73 | char *progname; |
| 74 | 74 | ||
| 75 | int num_cpus; | 75 | int num_cpus; |
| 76 | cpu_set_t *cpu_mask; | 76 | cpu_set_t *cpu_present_set, *cpu_mask; |
| 77 | size_t cpu_mask_size; | 77 | size_t cpu_present_setsize, cpu_mask_size; |
| 78 | 78 | ||
| 79 | struct counters { | 79 | struct counters { |
| 80 | unsigned long long tsc; /* per thread */ | 80 | unsigned long long tsc; /* per thread */ |
| @@ -103,6 +103,12 @@ struct timeval tv_even; | |||
| 103 | struct timeval tv_odd; | 103 | struct timeval tv_odd; |
| 104 | struct timeval tv_delta; | 104 | struct timeval tv_delta; |
| 105 | 105 | ||
| 106 | int mark_cpu_present(int pkg, int core, int cpu) | ||
| 107 | { | ||
| 108 | CPU_SET_S(cpu, cpu_present_setsize, cpu_present_set); | ||
| 109 | return 0; | ||
| 110 | } | ||
| 111 | |||
| 106 | /* | 112 | /* |
| 107 | * cpu_mask_init(ncpus) | 113 | * cpu_mask_init(ncpus) |
| 108 | * | 114 | * |
| @@ -118,6 +124,18 @@ void cpu_mask_init(int ncpus) | |||
| 118 | } | 124 | } |
| 119 | cpu_mask_size = CPU_ALLOC_SIZE(ncpus); | 125 | cpu_mask_size = CPU_ALLOC_SIZE(ncpus); |
| 120 | CPU_ZERO_S(cpu_mask_size, cpu_mask); | 126 | CPU_ZERO_S(cpu_mask_size, cpu_mask); |
| 127 | |||
| 128 | /* | ||
| 129 | * Allocate and initialize cpu_present_set | ||
| 130 | */ | ||
| 131 | cpu_present_set = CPU_ALLOC(ncpus); | ||
| 132 | if (cpu_present_set == NULL) { | ||
| 133 | perror("CPU_ALLOC"); | ||
| 134 | exit(3); | ||
| 135 | } | ||
| 136 | cpu_present_setsize = CPU_ALLOC_SIZE(ncpus); | ||
| 137 | CPU_ZERO_S(cpu_present_setsize, cpu_present_set); | ||
| 138 | for_all_cpus(mark_cpu_present); | ||
| 121 | } | 139 | } |
| 122 | 140 | ||
| 123 | void cpu_mask_uninit() | 141 | void cpu_mask_uninit() |
| @@ -125,6 +143,9 @@ void cpu_mask_uninit() | |||
| 125 | CPU_FREE(cpu_mask); | 143 | CPU_FREE(cpu_mask); |
| 126 | cpu_mask = NULL; | 144 | cpu_mask = NULL; |
| 127 | cpu_mask_size = 0; | 145 | cpu_mask_size = 0; |
| 146 | CPU_FREE(cpu_present_set); | ||
| 147 | cpu_present_set = NULL; | ||
| 148 | cpu_present_setsize = 0; | ||
| 128 | } | 149 | } |
| 129 | 150 | ||
| 130 | int cpu_migrate(int cpu) | 151 | int cpu_migrate(int cpu) |
| @@ -912,6 +933,8 @@ int is_snb(unsigned int family, unsigned int model) | |||
| 912 | switch (model) { | 933 | switch (model) { |
| 913 | case 0x2A: | 934 | case 0x2A: |
| 914 | case 0x2D: | 935 | case 0x2D: |
| 936 | case 0x3A: /* IVB */ | ||
| 937 | case 0x3D: /* IVB Xeon */ | ||
| 915 | return 1; | 938 | return 1; |
| 916 | } | 939 | } |
| 917 | return 0; | 940 | return 0; |
| @@ -1047,6 +1070,9 @@ int fork_it(char **argv) | |||
| 1047 | int retval; | 1070 | int retval; |
| 1048 | pid_t child_pid; | 1071 | pid_t child_pid; |
| 1049 | get_counters(cnt_even); | 1072 | get_counters(cnt_even); |
| 1073 | |||
| 1074 | /* clear affinity side-effect of get_counters() */ | ||
| 1075 | sched_setaffinity(0, cpu_present_setsize, cpu_present_set); | ||
| 1050 | gettimeofday(&tv_even, (struct timezone *)NULL); | 1076 | gettimeofday(&tv_even, (struct timezone *)NULL); |
| 1051 | 1077 | ||
| 1052 | child_pid = fork(); | 1078 | child_pid = fork(); |
