aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-17 08:48:18 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-17 08:48:18 -0400
commit2eb060975df2aaca635801dcfb99eaa45ede98fe (patch)
tree0e8c5a409227b6d56665d1a149ea90985ab54ea2 /drivers
parent75c44eddcb4989b85826143bc09fd3ad120abd4e (diff)
parent700b8422fb9e6041907bda45a15f4e2ab0438a04 (diff)
Merge branch 'acpi-ost'
* acpi-ost: ACPI: Drop acpi_evaluate_hotplug_ost() and ACPI_HOTPLUG_OST ACPI: use device name LNXSYBUS.xx for ACPI \_SB and \_TZ objects ACPI / processor: use acpi_evaluate_ost() to replace open-coded version ACPI / PAD / xen: use acpi_evaluate_ost() to replace open-coded version ACPI / PAD: use acpi_evaluate_ost() to replace open-coded version ACPI: rename acpi_evaluate_hotplug_ost() to acpi_evaluate_ost()
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpi_pad.c24
-rw-r--r--drivers/acpi/bus.c4
-rw-r--r--drivers/acpi/processor_perflib.c14
-rw-r--r--drivers/acpi/scan.c30
-rw-r--r--drivers/acpi/utils.c16
-rw-r--r--drivers/xen/xen-acpi-cpuhotplug.c2
-rw-r--r--drivers/xen/xen-acpi-memhotplug.c2
-rw-r--r--drivers/xen/xen-acpi-pad.c26
8 files changed, 46 insertions, 72 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index df96a0fe4890..37d73024b82e 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -408,28 +408,14 @@ static int acpi_pad_pur(acpi_handle handle)
408 return num; 408 return num;
409} 409}
410 410
411/* Notify firmware how many CPUs are idle */
412static void acpi_pad_ost(acpi_handle handle, int stat,
413 uint32_t idle_cpus)
414{
415 union acpi_object params[3] = {
416 {.type = ACPI_TYPE_INTEGER,},
417 {.type = ACPI_TYPE_INTEGER,},
418 {.type = ACPI_TYPE_BUFFER,},
419 };
420 struct acpi_object_list arg_list = {3, params};
421
422 params[0].integer.value = ACPI_PROCESSOR_AGGREGATOR_NOTIFY;
423 params[1].integer.value = stat;
424 params[2].buffer.length = 4;
425 params[2].buffer.pointer = (void *)&idle_cpus;
426 acpi_evaluate_object(handle, "_OST", &arg_list, NULL);
427}
428
429static void acpi_pad_handle_notify(acpi_handle handle) 411static void acpi_pad_handle_notify(acpi_handle handle)
430{ 412{
431 int num_cpus; 413 int num_cpus;
432 uint32_t idle_cpus; 414 uint32_t idle_cpus;
415 struct acpi_buffer param = {
416 .length = 4,
417 .pointer = (void *)&idle_cpus,
418 };
433 419
434 mutex_lock(&isolated_cpus_lock); 420 mutex_lock(&isolated_cpus_lock);
435 num_cpus = acpi_pad_pur(handle); 421 num_cpus = acpi_pad_pur(handle);
@@ -439,7 +425,7 @@ static void acpi_pad_handle_notify(acpi_handle handle)
439 } 425 }
440 acpi_pad_idle_cpus(num_cpus); 426 acpi_pad_idle_cpus(num_cpus);
441 idle_cpus = acpi_pad_idle_cpus_num(); 427 idle_cpus = acpi_pad_idle_cpus_num();
442 acpi_pad_ost(handle, 0, idle_cpus); 428 acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, 0, &param);
443 mutex_unlock(&isolated_cpus_lock); 429 mutex_unlock(&isolated_cpus_lock);
444} 430}
445 431
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index afe6f9a919c1..e7e5844c87d0 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -311,9 +311,7 @@ static void acpi_bus_osc_support(void)
311 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT; 311 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;
312#endif 312#endif
313 313
314#ifdef ACPI_HOTPLUG_OST
315 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT; 314 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
316#endif
317 315
318 if (!ghes_disable) 316 if (!ghes_disable)
319 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT; 317 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT;
@@ -410,7 +408,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
410 return; 408 return;
411 409
412 err: 410 err:
413 acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); 411 acpi_evaluate_ost(handle, type, ost_code, NULL);
414} 412}
415 413
416/* -------------------------------------------------------------------------- 414/* --------------------------------------------------------------------------
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index ff90054f04fd..cfc8aba72f86 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -156,17 +156,9 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
156 */ 156 */
157static void acpi_processor_ppc_ost(acpi_handle handle, int status) 157static void acpi_processor_ppc_ost(acpi_handle handle, int status)
158{ 158{
159 union acpi_object params[2] = { 159 if (acpi_has_method(handle, "_OST"))
160 {.type = ACPI_TYPE_INTEGER,}, 160 acpi_evaluate_ost(handle, ACPI_PROCESSOR_NOTIFY_PERFORMANCE,
161 {.type = ACPI_TYPE_INTEGER,}, 161 status, NULL);
162 };
163 struct acpi_object_list arg_list = {2, params};
164
165 if (acpi_has_method(handle, "_OST")) {
166 params[0].integer.value = ACPI_PROCESSOR_NOTIFY_PERFORMANCE;
167 params[1].integer.value = status;
168 acpi_evaluate_object(handle, "_OST", &arg_list, NULL);
169 }
170} 162}
171 163
172int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag) 164int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index eb7a1ff224e7..1870223cb1a3 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -474,8 +474,8 @@ static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type)
474 dev_info(&adev->dev, "Eject disabled\n"); 474 dev_info(&adev->dev, "Eject disabled\n");
475 return -EPERM; 475 return -EPERM;
476 } 476 }
477 acpi_evaluate_hotplug_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST, 477 acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST,
478 ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); 478 ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
479 return acpi_scan_hot_remove(adev); 479 return acpi_scan_hot_remove(adev);
480 } 480 }
481 return -EINVAL; 481 return -EINVAL;
@@ -524,7 +524,7 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src)
524 ost_code = ACPI_OST_SC_SUCCESS; 524 ost_code = ACPI_OST_SC_SUCCESS;
525 525
526 err_out: 526 err_out:
527 acpi_evaluate_hotplug_ost(adev->handle, src, ost_code, NULL); 527 acpi_evaluate_ost(adev->handle, src, ost_code, NULL);
528 528
529 out: 529 out:
530 acpi_bus_put_acpi_device(adev); 530 acpi_bus_put_acpi_device(adev);
@@ -583,8 +583,8 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
583 return count; 583 return count;
584 584
585 put_device(&acpi_device->dev); 585 put_device(&acpi_device->dev);
586 acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT, 586 acpi_evaluate_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT,
587 ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL); 587 ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL);
588 return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN; 588 return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN;
589} 589}
590 590
@@ -1757,6 +1757,20 @@ static bool acpi_ibm_smbus_match(acpi_handle handle)
1757 return false; 1757 return false;
1758} 1758}
1759 1759
1760static bool acpi_object_is_system_bus(acpi_handle handle)
1761{
1762 acpi_handle tmp;
1763
1764 if (ACPI_SUCCESS(acpi_get_handle(NULL, "\\_SB", &tmp)) &&
1765 tmp == handle)
1766 return true;
1767 if (ACPI_SUCCESS(acpi_get_handle(NULL, "\\_TZ", &tmp)) &&
1768 tmp == handle)
1769 return true;
1770
1771 return false;
1772}
1773
1760static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, 1774static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
1761 int device_type) 1775 int device_type)
1762{ 1776{
@@ -1808,8 +1822,10 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
1808 acpi_add_id(pnp, ACPI_DOCK_HID); 1822 acpi_add_id(pnp, ACPI_DOCK_HID);
1809 else if (acpi_ibm_smbus_match(handle)) 1823 else if (acpi_ibm_smbus_match(handle))
1810 acpi_add_id(pnp, ACPI_SMBUS_IBM_HID); 1824 acpi_add_id(pnp, ACPI_SMBUS_IBM_HID);
1811 else if (list_empty(&pnp->ids) && handle == ACPI_ROOT_OBJECT) { 1825 else if (list_empty(&pnp->ids) &&
1812 acpi_add_id(pnp, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ 1826 acpi_object_is_system_bus(handle)) {
1827 /* \_SB, \_TZ, LNXSYBUS */
1828 acpi_add_id(pnp, ACPI_BUS_HID);
1813 strcpy(pnp->device_name, ACPI_BUS_DEVICE_NAME); 1829 strcpy(pnp->device_name, ACPI_BUS_DEVICE_NAME);
1814 strcpy(pnp->device_class, ACPI_BUS_CLASS); 1830 strcpy(pnp->device_class, ACPI_BUS_CLASS);
1815 } 1831 }
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 85e3b612bdc0..0f5f78fa6545 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -422,7 +422,7 @@ out:
422EXPORT_SYMBOL(acpi_get_physical_device_location); 422EXPORT_SYMBOL(acpi_get_physical_device_location);
423 423
424/** 424/**
425 * acpi_evaluate_hotplug_ost: Evaluate _OST for hotplug operations 425 * acpi_evaluate_ost: Evaluate _OST for hotplug operations
426 * @handle: ACPI device handle 426 * @handle: ACPI device handle
427 * @source_event: source event code 427 * @source_event: source event code
428 * @status_code: status code 428 * @status_code: status code
@@ -433,17 +433,15 @@ EXPORT_SYMBOL(acpi_get_physical_device_location);
433 * When the platform does not support _OST, this function has no effect. 433 * When the platform does not support _OST, this function has no effect.
434 */ 434 */
435acpi_status 435acpi_status
436acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, 436acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
437 u32 status_code, struct acpi_buffer *status_buf) 437 struct acpi_buffer *status_buf)
438{ 438{
439#ifdef ACPI_HOTPLUG_OST
440 union acpi_object params[3] = { 439 union acpi_object params[3] = {
441 {.type = ACPI_TYPE_INTEGER,}, 440 {.type = ACPI_TYPE_INTEGER,},
442 {.type = ACPI_TYPE_INTEGER,}, 441 {.type = ACPI_TYPE_INTEGER,},
443 {.type = ACPI_TYPE_BUFFER,} 442 {.type = ACPI_TYPE_BUFFER,}
444 }; 443 };
445 struct acpi_object_list arg_list = {3, params}; 444 struct acpi_object_list arg_list = {3, params};
446 acpi_status status;
447 445
448 params[0].integer.value = source_event; 446 params[0].integer.value = source_event;
449 params[1].integer.value = status_code; 447 params[1].integer.value = status_code;
@@ -455,13 +453,9 @@ acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
455 params[2].buffer.length = 0; 453 params[2].buffer.length = 0;
456 } 454 }
457 455
458 status = acpi_evaluate_object(handle, "_OST", &arg_list, NULL); 456 return acpi_evaluate_object(handle, "_OST", &arg_list, NULL);
459 return status;
460#else
461 return AE_OK;
462#endif
463} 457}
464EXPORT_SYMBOL(acpi_evaluate_hotplug_ost); 458EXPORT_SYMBOL(acpi_evaluate_ost);
465 459
466/** 460/**
467 * acpi_handle_printk: Print message with ACPI prefix and object path 461 * acpi_handle_printk: Print message with ACPI prefix and object path
diff --git a/drivers/xen/xen-acpi-cpuhotplug.c b/drivers/xen/xen-acpi-cpuhotplug.c
index 80875fb770ed..3e62ee4b3b66 100644
--- a/drivers/xen/xen-acpi-cpuhotplug.c
+++ b/drivers/xen/xen-acpi-cpuhotplug.c
@@ -313,7 +313,7 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
313 goto out; 313 goto out;
314 } 314 }
315 315
316 (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); 316 (void) acpi_evaluate_ost(handle, event, ost_code, NULL);
317 317
318out: 318out:
319 acpi_scan_lock_release(); 319 acpi_scan_lock_release();
diff --git a/drivers/xen/xen-acpi-memhotplug.c b/drivers/xen/xen-acpi-memhotplug.c
index f8d18626969a..34e40b733f9a 100644
--- a/drivers/xen/xen-acpi-memhotplug.c
+++ b/drivers/xen/xen-acpi-memhotplug.c
@@ -285,7 +285,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
285 return; 285 return;
286 } 286 }
287 287
288 (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); 288 (void) acpi_evaluate_ost(handle, event, ost_code, NULL);
289 return; 289 return;
290} 290}
291 291
diff --git a/drivers/xen/xen-acpi-pad.c b/drivers/xen/xen-acpi-pad.c
index 40c4bc06b5fa..f83b754505f8 100644
--- a/drivers/xen/xen-acpi-pad.c
+++ b/drivers/xen/xen-acpi-pad.c
@@ -77,27 +77,14 @@ static int acpi_pad_pur(acpi_handle handle)
77 return num; 77 return num;
78} 78}
79 79
80/* Notify firmware how many CPUs are idle */
81static void acpi_pad_ost(acpi_handle handle, int stat,
82 uint32_t idle_nums)
83{
84 union acpi_object params[3] = {
85 {.type = ACPI_TYPE_INTEGER,},
86 {.type = ACPI_TYPE_INTEGER,},
87 {.type = ACPI_TYPE_BUFFER,},
88 };
89 struct acpi_object_list arg_list = {3, params};
90
91 params[0].integer.value = ACPI_PROCESSOR_AGGREGATOR_NOTIFY;
92 params[1].integer.value = stat;
93 params[2].buffer.length = 4;
94 params[2].buffer.pointer = (void *)&idle_nums;
95 acpi_evaluate_object(handle, "_OST", &arg_list, NULL);
96}
97
98static void acpi_pad_handle_notify(acpi_handle handle) 80static void acpi_pad_handle_notify(acpi_handle handle)
99{ 81{
100 int idle_nums; 82 int idle_nums;
83 struct acpi_buffer param = {
84 .length = 4,
85 .pointer = (void *)&idle_nums,
86 };
87
101 88
102 mutex_lock(&xen_cpu_lock); 89 mutex_lock(&xen_cpu_lock);
103 idle_nums = acpi_pad_pur(handle); 90 idle_nums = acpi_pad_pur(handle);
@@ -109,7 +96,8 @@ static void acpi_pad_handle_notify(acpi_handle handle)
109 idle_nums = xen_acpi_pad_idle_cpus(idle_nums) 96 idle_nums = xen_acpi_pad_idle_cpus(idle_nums)
110 ?: xen_acpi_pad_idle_cpus_num(); 97 ?: xen_acpi_pad_idle_cpus_num();
111 if (idle_nums >= 0) 98 if (idle_nums >= 0)
112 acpi_pad_ost(handle, 0, idle_nums); 99 acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY,
100 0, &param);
113 mutex_unlock(&xen_cpu_lock); 101 mutex_unlock(&xen_cpu_lock);
114} 102}
115 103