Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPICA: Update for new Notify values

Implemented several changes for Notify handling: Added support
for new Notify values (ACPI 2.0+) and improved the Notify debug
output. Notify on PowerResource objects is no longer allowed,
as per the ACPI specification.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Zhang Rui and committed by
Len Brown
514d18d7 66d3ca9e

+82 -45
+23 -36
drivers/acpi/events/evmisc.c
··· 49 49 #define _COMPONENT ACPI_EVENTS 50 50 ACPI_MODULE_NAME("evmisc") 51 51 52 - /* Names for Notify() values, used for debug output */ 53 - #ifdef ACPI_DEBUG_OUTPUT 54 - static const char *acpi_notify_value_names[] = { 55 - "Bus Check", 56 - "Device Check", 57 - "Device Wake", 58 - "Eject Request", 59 - "Device Check Light", 60 - "Frequency Mismatch", 61 - "Bus Mode Mismatch", 62 - "Power Fault" 63 - }; 64 - #endif 65 - 66 52 /* Pointer to FACS needed for the Global Lock */ 67 - 68 53 static struct acpi_table_facs *facs = NULL; 69 54 70 55 /* Local prototypes */ ··· 79 94 switch (node->type) { 80 95 case ACPI_TYPE_DEVICE: 81 96 case ACPI_TYPE_PROCESSOR: 82 - case ACPI_TYPE_POWER: 83 97 case ACPI_TYPE_THERMAL: 84 98 /* 85 99 * These are the ONLY objects that can receive ACPI notifications ··· 123 139 * initiate soft-off or sleep operation? 124 140 */ 125 141 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 126 - "Dispatching Notify(%X) on node %p\n", notify_value, 127 - node)); 128 - 129 - if (notify_value <= 7) { 130 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n", 131 - acpi_notify_value_names[notify_value])); 132 - } else { 133 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 134 - "Notify value: 0x%2.2X **Device Specific**\n", 135 - notify_value)); 136 - } 142 + "Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n", 143 + acpi_ut_get_node_name(node), node, notify_value, 144 + acpi_ut_get_notify_name(notify_value))); 137 145 138 146 /* Get the notify object attached to the NS Node */ 139 147 ··· 135 159 /* We have the notify object, Get the right handler */ 136 160 137 161 switch (node->type) { 162 + 163 + /* Notify allowed only on these types */ 164 + 138 165 case ACPI_TYPE_DEVICE: 139 166 case ACPI_TYPE_THERMAL: 140 167 case ACPI_TYPE_PROCESSOR: 141 - case ACPI_TYPE_POWER: 142 168 143 169 if (notify_value <= ACPI_MAX_SYS_NOTIFY) { 144 170 handler_obj = ··· 157 179 } 158 180 } 159 181 160 - /* If there is any handler to run, schedule the dispatcher */ 161 - 182 + /* 183 + * If there is any handler to run, schedule the dispatcher. 184 + * Check for: 185 + * 1) Global system notify handler 186 + * 2) Global device notify handler 187 + * 3) Per-device notify handler 188 + */ 162 189 if ((acpi_gbl_system_notify.handler 163 190 && (notify_value <= ACPI_MAX_SYS_NOTIFY)) 164 191 || (acpi_gbl_device_notify.handler ··· 171 188 notify_info = acpi_ut_create_generic_state(); 172 189 if (!notify_info) { 173 190 return (AE_NO_MEMORY); 191 + } 192 + 193 + if (!handler_obj) { 194 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, 195 + "Executing system notify handler for Notify (%4.4s, %X) node %p\n", 196 + acpi_ut_get_node_name(node), 197 + notify_value, node)); 174 198 } 175 199 176 200 notify_info->common.descriptor_type = ··· 192 202 if (ACPI_FAILURE(status)) { 193 203 acpi_ut_delete_generic_state(notify_info); 194 204 } 195 - } 196 - 197 - if (!handler_obj) { 205 + } else { 198 206 /* 199 - * There is no per-device notify handler for this device. 200 - * This may or may not be a problem. 207 + * There is no notify handler (per-device or system) for this device. 201 208 */ 202 209 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 203 - "No notify handler for Notify(%4.4s, %X) node %p\n", 210 + "No notify handler for Notify (%4.4s, %X) node %p\n", 204 211 acpi_ut_get_node_name(node), notify_value, 205 212 node)); 206 213 }
+42
drivers/acpi/utilities/utglobal.c
··· 602 602 603 603 return (acpi_gbl_mutex_names[mutex_id]); 604 604 } 605 + 606 + /******************************************************************************* 607 + * 608 + * FUNCTION: acpi_ut_get_notify_name 609 + * 610 + * PARAMETERS: notify_value - Value from the Notify() request 611 + * 612 + * RETURN: String corresponding to the Notify Value. 613 + * 614 + * DESCRIPTION: Translate a Notify Value to a notify namestring. 615 + * 616 + ******************************************************************************/ 617 + 618 + /* Names for Notify() values, used for debug output */ 619 + 620 + static const char *acpi_gbl_notify_value_names[] = { 621 + "Bus Check", 622 + "Device Check", 623 + "Device Wake", 624 + "Eject Request", 625 + "Device Check Light", 626 + "Frequency Mismatch", 627 + "Bus Mode Mismatch", 628 + "Power Fault", 629 + "Capabilities Check", 630 + "Device PLD Check", 631 + "Reserved", 632 + "System Locality Update" 633 + }; 634 + 635 + const char *acpi_ut_get_notify_name(u32 notify_value) 636 + { 637 + 638 + if (notify_value <= ACPI_NOTIFY_MAX) { 639 + return (acpi_gbl_notify_value_names[notify_value]); 640 + } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) { 641 + return ("Reserved"); 642 + } else { /* Greater or equal to 0x80 */ 643 + 644 + return ("**Device Specific**"); 645 + } 646 + } 605 647 #endif 606 648 607 649 /*******************************************************************************
+15 -9
include/acpi/actypes.h
··· 402 402 /* 403 403 * Standard notify values 404 404 */ 405 - #define ACPI_NOTIFY_BUS_CHECK (u8) 0 406 - #define ACPI_NOTIFY_DEVICE_CHECK (u8) 1 407 - #define ACPI_NOTIFY_DEVICE_WAKE (u8) 2 408 - #define ACPI_NOTIFY_EJECT_REQUEST (u8) 3 409 - #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4 410 - #define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5 411 - #define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6 412 - #define ACPI_NOTIFY_POWER_FAULT (u8) 7 405 + #define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 406 + #define ACPI_NOTIFY_DEVICE_CHECK (u8) 0x01 407 + #define ACPI_NOTIFY_DEVICE_WAKE (u8) 0x02 408 + #define ACPI_NOTIFY_EJECT_REQUEST (u8) 0x03 409 + #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 0x04 410 + #define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 0x05 411 + #define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 0x06 412 + #define ACPI_NOTIFY_POWER_FAULT (u8) 0x07 413 + #define ACPI_NOTIFY_CAPABILITIES_CHECK (u8) 0x08 414 + #define ACPI_NOTIFY_DEVICE_PLD_CHECK (u8) 0x09 415 + #define ACPI_NOTIFY_RESERVED (u8) 0x0A 416 + #define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B 417 + 418 + #define ACPI_NOTIFY_MAX 0x0B 413 419 414 420 /* 415 421 * Types associated with ACPI names and objects. The first group of ··· 590 584 591 585 #define ACPI_SYSTEM_NOTIFY 0x1 592 586 #define ACPI_DEVICE_NOTIFY 0x2 593 - #define ACPI_ALL_NOTIFY 0x3 587 + #define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) 594 588 #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 595 589 596 590 #define ACPI_MAX_SYS_NOTIFY 0x7f
+2
include/acpi/acutils.h
··· 116 116 117 117 char *acpi_ut_get_mutex_name(u32 mutex_id); 118 118 119 + const char *acpi_ut_get_notify_name(u32 notify_value); 120 + 119 121 #endif 120 122 121 123 char *acpi_ut_get_type_name(acpi_object_type type);