aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi_memhotplug.c
diff options
context:
space:
mode:
authorToshi Kani <toshi.kani@hp.com>2012-05-23 22:25:22 -0400
committerLen Brown <len.brown@intel.com>2012-06-04 01:09:21 -0400
commitb1f00de66f8809b451a33ce47e461ef0e33c09e8 (patch)
treef2508b4fde810a21e191db23ed5fe6aa1ceb361c /drivers/acpi/acpi_memhotplug.c
parent51af3b9202ccffe0476899d5c29f0ae7e6bfdcea (diff)
ACPI: Add _OST support for ACPI memory hotplug
Changed acpi_memory_device_notify() to call ACPI _OST method when ACPI memory hotplug operation has completed. Signed-off-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_memhotplug.c')
-rw-r--r--drivers/acpi/acpi_memhotplug.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index d98571385656..24c807f96636 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -341,7 +341,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
341{ 341{
342 struct acpi_memory_device *mem_device; 342 struct acpi_memory_device *mem_device;
343 struct acpi_device *device; 343 struct acpi_device *device;
344 344 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
345 345
346 switch (event) { 346 switch (event) {
347 case ACPI_NOTIFY_BUS_CHECK: 347 case ACPI_NOTIFY_BUS_CHECK:
@@ -354,15 +354,20 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
354 "\nReceived DEVICE CHECK notification for device\n")); 354 "\nReceived DEVICE CHECK notification for device\n"));
355 if (acpi_memory_get_device(handle, &mem_device)) { 355 if (acpi_memory_get_device(handle, &mem_device)) {
356 printk(KERN_ERR PREFIX "Cannot find driver data\n"); 356 printk(KERN_ERR PREFIX "Cannot find driver data\n");
357 return; 357 break;
358 } 358 }
359 359
360 if (!acpi_memory_check_device(mem_device)) { 360 if (acpi_memory_check_device(mem_device))
361 if (acpi_memory_enable_device(mem_device)) 361 break;
362 printk(KERN_ERR PREFIX 362
363 "Cannot enable memory device\n"); 363 if (acpi_memory_enable_device(mem_device)) {
364 printk(KERN_ERR PREFIX "Cannot enable memory device\n");
365 break;
364 } 366 }
367
368 ost_code = ACPI_OST_SC_SUCCESS;
365 break; 369 break;
370
366 case ACPI_NOTIFY_EJECT_REQUEST: 371 case ACPI_NOTIFY_EJECT_REQUEST:
367 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 372 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
368 "\nReceived EJECT REQUEST notification for device\n")); 373 "\nReceived EJECT REQUEST notification for device\n"));
@@ -383,19 +388,35 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
383 * TBD: Can also be disabled by Callback registration 388 * TBD: Can also be disabled by Callback registration
384 * with generic sysfs driver 389 * with generic sysfs driver
385 */ 390 */
386 if (acpi_memory_disable_device(mem_device)) 391 if (acpi_memory_disable_device(mem_device)) {
387 printk(KERN_ERR PREFIX 392 printk(KERN_ERR PREFIX "Disable memory device\n");
388 "Disable memory device\n"); 393 /*
394 * If _EJ0 was called but failed, _OST is not
395 * necessary.
396 */
397 if (mem_device->state == MEMORY_INVALID_STATE)
398 return;
399
400 break;
401 }
402
389 /* 403 /*
390 * TBD: Invoke acpi_bus_remove to cleanup data structures 404 * TBD: Invoke acpi_bus_remove to cleanup data structures
391 */ 405 */
392 break; 406
407 /* _EJ0 succeeded; _OST is not necessary */
408 return;
409
393 default: 410 default:
394 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 411 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
395 "Unsupported event [0x%x]\n", event)); 412 "Unsupported event [0x%x]\n", event));
396 break; 413
414 /* non-hotplug event; possibly handled by other handler */
415 return;
397 } 416 }
398 417
418 /* Inform firmware that the hotplug operation has completed */
419 (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
399 return; 420 return;
400} 421}
401 422