aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2008-04-10 11:06:44 -0400
committerLen Brown <len.brown@intel.com>2008-04-22 23:01:36 -0400
commit514d18d79b1da052ed4553ceec1f7e1197a5bb51 (patch)
treeb474e49f1614e73a2b7ad671b56c89c5e875d89a
parent66d3ca9ea28e1b3d591083772fd797b9b46410b8 (diff)
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>
-rw-r--r--drivers/acpi/events/evmisc.c59
-rw-r--r--drivers/acpi/utilities/utglobal.c42
-rw-r--r--include/acpi/actypes.h24
-rw-r--r--include/acpi/acutils.h2
4 files changed, 82 insertions, 45 deletions
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 4e7a13afe80c..16cf2700c16f 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -49,22 +49,7 @@
49#define _COMPONENT ACPI_EVENTS 49#define _COMPONENT ACPI_EVENTS
50ACPI_MODULE_NAME("evmisc") 50ACPI_MODULE_NAME("evmisc")
51 51
52/* Names for Notify() values, used for debug output */
53#ifdef ACPI_DEBUG_OUTPUT
54static 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/* Pointer to FACS needed for the Global Lock */ 52/* Pointer to FACS needed for the Global Lock */
67
68static struct acpi_table_facs *facs = NULL; 53static struct acpi_table_facs *facs = NULL;
69 54
70/* Local prototypes */ 55/* Local prototypes */
@@ -94,7 +79,6 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
94 switch (node->type) { 79 switch (node->type) {
95 case ACPI_TYPE_DEVICE: 80 case ACPI_TYPE_DEVICE:
96 case ACPI_TYPE_PROCESSOR: 81 case ACPI_TYPE_PROCESSOR:
97 case ACPI_TYPE_POWER:
98 case ACPI_TYPE_THERMAL: 82 case ACPI_TYPE_THERMAL:
99 /* 83 /*
100 * These are the ONLY objects that can receive ACPI notifications 84 * These are the ONLY objects that can receive ACPI notifications
@@ -139,17 +123,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
139 * initiate soft-off or sleep operation? 123 * initiate soft-off or sleep operation?
140 */ 124 */
141 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 125 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
142 "Dispatching Notify(%X) on node %p\n", notify_value, 126 "Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n",
143 node)); 127 acpi_ut_get_node_name(node), node, notify_value,
144 128 acpi_ut_get_notify_name(notify_value)));
145 if (notify_value <= 7) {
146 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n",
147 acpi_notify_value_names[notify_value]));
148 } else {
149 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
150 "Notify value: 0x%2.2X **Device Specific**\n",
151 notify_value));
152 }
153 129
154 /* Get the notify object attached to the NS Node */ 130 /* Get the notify object attached to the NS Node */
155 131
@@ -159,10 +135,12 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
159 /* We have the notify object, Get the right handler */ 135 /* We have the notify object, Get the right handler */
160 136
161 switch (node->type) { 137 switch (node->type) {
138
139 /* Notify allowed only on these types */
140
162 case ACPI_TYPE_DEVICE: 141 case ACPI_TYPE_DEVICE:
163 case ACPI_TYPE_THERMAL: 142 case ACPI_TYPE_THERMAL:
164 case ACPI_TYPE_PROCESSOR: 143 case ACPI_TYPE_PROCESSOR:
165 case ACPI_TYPE_POWER:
166 144
167 if (notify_value <= ACPI_MAX_SYS_NOTIFY) { 145 if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
168 handler_obj = 146 handler_obj =
@@ -179,8 +157,13 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
179 } 157 }
180 } 158 }
181 159
182 /* If there is any handler to run, schedule the dispatcher */ 160 /*
183 161 * If there is any handler to run, schedule the dispatcher.
162 * Check for:
163 * 1) Global system notify handler
164 * 2) Global device notify handler
165 * 3) Per-device notify handler
166 */
184 if ((acpi_gbl_system_notify.handler 167 if ((acpi_gbl_system_notify.handler
185 && (notify_value <= ACPI_MAX_SYS_NOTIFY)) 168 && (notify_value <= ACPI_MAX_SYS_NOTIFY))
186 || (acpi_gbl_device_notify.handler 169 || (acpi_gbl_device_notify.handler
@@ -190,6 +173,13 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
190 return (AE_NO_MEMORY); 173 return (AE_NO_MEMORY);
191 } 174 }
192 175
176 if (!handler_obj) {
177 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
178 "Executing system notify handler for Notify (%4.4s, %X) node %p\n",
179 acpi_ut_get_node_name(node),
180 notify_value, node));
181 }
182
193 notify_info->common.descriptor_type = 183 notify_info->common.descriptor_type =
194 ACPI_DESC_TYPE_STATE_NOTIFY; 184 ACPI_DESC_TYPE_STATE_NOTIFY;
195 notify_info->notify.node = node; 185 notify_info->notify.node = node;
@@ -202,15 +192,12 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
202 if (ACPI_FAILURE(status)) { 192 if (ACPI_FAILURE(status)) {
203 acpi_ut_delete_generic_state(notify_info); 193 acpi_ut_delete_generic_state(notify_info);
204 } 194 }
205 } 195 } else {
206
207 if (!handler_obj) {
208 /* 196 /*
209 * There is no per-device notify handler for this device. 197 * There is no notify handler (per-device or system) for this device.
210 * This may or may not be a problem.
211 */ 198 */
212 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 199 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
213 "No notify handler for Notify(%4.4s, %X) node %p\n", 200 "No notify handler for Notify (%4.4s, %X) node %p\n",
214 acpi_ut_get_node_name(node), notify_value, 201 acpi_ut_get_node_name(node), notify_value,
215 node)); 202 node));
216 } 203 }
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index d2097ded262d..d0226fedb004 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -602,6 +602,48 @@ char *acpi_ut_get_mutex_name(u32 mutex_id)
602 602
603 return (acpi_gbl_mutex_names[mutex_id]); 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
620static 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
635const 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#endif 647#endif
606 648
607/******************************************************************************* 649/*******************************************************************************
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 75ec153338e7..cc24cef6ce93 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -402,14 +402,20 @@ typedef unsigned long long acpi_integer;
402/* 402/*
403 * Standard notify values 403 * Standard notify values
404 */ 404 */
405#define ACPI_NOTIFY_BUS_CHECK (u8) 0 405#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00
406#define ACPI_NOTIFY_DEVICE_CHECK (u8) 1 406#define ACPI_NOTIFY_DEVICE_CHECK (u8) 0x01
407#define ACPI_NOTIFY_DEVICE_WAKE (u8) 2 407#define ACPI_NOTIFY_DEVICE_WAKE (u8) 0x02
408#define ACPI_NOTIFY_EJECT_REQUEST (u8) 3 408#define ACPI_NOTIFY_EJECT_REQUEST (u8) 0x03
409#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4 409#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 0x04
410#define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5 410#define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 0x05
411#define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6 411#define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 0x06
412#define ACPI_NOTIFY_POWER_FAULT (u8) 7 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 * Types associated with ACPI names and objects. The first group of 421 * Types associated with ACPI names and objects. The first group of
@@ -584,7 +590,7 @@ typedef u32 acpi_event_status;
584 590
585#define ACPI_SYSTEM_NOTIFY 0x1 591#define ACPI_SYSTEM_NOTIFY 0x1
586#define ACPI_DEVICE_NOTIFY 0x2 592#define ACPI_DEVICE_NOTIFY 0x2
587#define ACPI_ALL_NOTIFY 0x3 593#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
588#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 594#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
589 595
590#define ACPI_MAX_SYS_NOTIFY 0x7f 596#define ACPI_MAX_SYS_NOTIFY 0x7f
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index a2918547c73f..26115da8c099 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -116,6 +116,8 @@ void acpi_ut_init_globals(void);
116 116
117char *acpi_ut_get_mutex_name(u32 mutex_id); 117char *acpi_ut_get_mutex_name(u32 mutex_id);
118 118
119const char *acpi_ut_get_notify_name(u32 notify_value);
120
119#endif 121#endif
120 122
121char *acpi_ut_get_type_name(acpi_object_type type); 123char *acpi_ut_get_type_name(acpi_object_type type);