diff options
Diffstat (limited to 'drivers/acpi')
23 files changed, 426 insertions, 362 deletions
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index ebc07aab710c..bcd1d472b90f 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -86,20 +86,20 @@ acpi_ds_init_one_object ( | |||
86 | void *context, | 86 | void *context, |
87 | void **return_value) | 87 | void **return_value) |
88 | { | 88 | { |
89 | struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; | ||
90 | struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle; | ||
89 | acpi_object_type type; | 91 | acpi_object_type type; |
90 | acpi_status status; | 92 | acpi_status status; |
91 | struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; | ||
92 | 93 | ||
93 | 94 | ||
94 | ACPI_FUNCTION_NAME ("ds_init_one_object"); | 95 | ACPI_FUNCTION_NAME ("ds_init_one_object"); |
95 | 96 | ||
96 | 97 | ||
97 | /* | 98 | /* |
98 | * We are only interested in objects owned by the table that | 99 | * We are only interested in NS nodes owned by the table that |
99 | * was just loaded | 100 | * was just loaded |
100 | */ | 101 | */ |
101 | if (((struct acpi_namespace_node *) obj_handle)->owner_id != | 102 | if (node->owner_id != info->table_desc->owner_id) { |
102 | info->table_desc->owner_id) { | ||
103 | return (AE_OK); | 103 | return (AE_OK); |
104 | } | 104 | } |
105 | 105 | ||
@@ -126,8 +126,6 @@ acpi_ds_init_one_object ( | |||
126 | 126 | ||
127 | case ACPI_TYPE_METHOD: | 127 | case ACPI_TYPE_METHOD: |
128 | 128 | ||
129 | info->method_count++; | ||
130 | |||
131 | /* | 129 | /* |
132 | * Print a dot for each method unless we are going to print | 130 | * Print a dot for each method unless we are going to print |
133 | * the entire pathname | 131 | * the entire pathname |
@@ -143,7 +141,7 @@ acpi_ds_init_one_object ( | |||
143 | * on a per-table basis. Currently, we just use a global for the width. | 141 | * on a per-table basis. Currently, we just use a global for the width. |
144 | */ | 142 | */ |
145 | if (info->table_desc->pointer->revision == 1) { | 143 | if (info->table_desc->pointer->revision == 1) { |
146 | ((struct acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32; | 144 | node->flags |= ANOBJ_DATA_WIDTH_32; |
147 | } | 145 | } |
148 | 146 | ||
149 | /* | 147 | /* |
@@ -153,22 +151,14 @@ acpi_ds_init_one_object ( | |||
153 | status = acpi_ds_parse_method (obj_handle); | 151 | status = acpi_ds_parse_method (obj_handle); |
154 | if (ACPI_FAILURE (status)) { | 152 | if (ACPI_FAILURE (status)) { |
155 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 153 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
156 | "Method %p [%4.4s] - parse failure, %s\n", | 154 | "\n+Method %p [%4.4s] - parse failure, %s\n", |
157 | obj_handle, acpi_ut_get_node_name (obj_handle), | 155 | obj_handle, acpi_ut_get_node_name (obj_handle), |
158 | acpi_format_exception (status))); | 156 | acpi_format_exception (status))); |
159 | 157 | ||
160 | /* This parse failed, but we will continue parsing more methods */ | 158 | /* This parse failed, but we will continue parsing more methods */ |
161 | |||
162 | break; | ||
163 | } | 159 | } |
164 | 160 | ||
165 | /* | 161 | info->method_count++; |
166 | * Delete the parse tree. We simply re-parse the method | ||
167 | * for every execution since there isn't much overhead | ||
168 | */ | ||
169 | acpi_ns_delete_namespace_subtree (obj_handle); | ||
170 | acpi_ns_delete_namespace_by_owner ( | ||
171 | ((struct acpi_namespace_node *) obj_handle)->object->method.owner_id); | ||
172 | break; | 162 | break; |
173 | 163 | ||
174 | 164 | ||
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 1b90813cbde1..e344c06ed33f 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -58,12 +58,11 @@ | |||
58 | * | 58 | * |
59 | * FUNCTION: acpi_ds_parse_method | 59 | * FUNCTION: acpi_ds_parse_method |
60 | * | 60 | * |
61 | * PARAMETERS: obj_handle - Method node | 61 | * PARAMETERS: Node - Method node |
62 | * | 62 | * |
63 | * RETURN: Status | 63 | * RETURN: Status |
64 | * | 64 | * |
65 | * DESCRIPTION: Call the parser and parse the AML that is associated with the | 65 | * DESCRIPTION: Parse the AML that is associated with the method. |
66 | * method. | ||
67 | * | 66 | * |
68 | * MUTEX: Assumes parser is locked | 67 | * MUTEX: Assumes parser is locked |
69 | * | 68 | * |
@@ -71,30 +70,28 @@ | |||
71 | 70 | ||
72 | acpi_status | 71 | acpi_status |
73 | acpi_ds_parse_method ( | 72 | acpi_ds_parse_method ( |
74 | acpi_handle obj_handle) | 73 | struct acpi_namespace_node *node) |
75 | { | 74 | { |
76 | acpi_status status; | 75 | acpi_status status; |
77 | union acpi_operand_object *obj_desc; | 76 | union acpi_operand_object *obj_desc; |
78 | union acpi_parse_object *op; | 77 | union acpi_parse_object *op; |
79 | struct acpi_namespace_node *node; | ||
80 | struct acpi_walk_state *walk_state; | 78 | struct acpi_walk_state *walk_state; |
81 | 79 | ||
82 | 80 | ||
83 | ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle); | 81 | ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node); |
84 | 82 | ||
85 | 83 | ||
86 | /* Parameter Validation */ | 84 | /* Parameter Validation */ |
87 | 85 | ||
88 | if (!obj_handle) { | 86 | if (!node) { |
89 | return_ACPI_STATUS (AE_NULL_ENTRY); | 87 | return_ACPI_STATUS (AE_NULL_ENTRY); |
90 | } | 88 | } |
91 | 89 | ||
92 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n", | 90 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n", |
93 | acpi_ut_get_node_name (obj_handle), obj_handle)); | 91 | acpi_ut_get_node_name (node), node)); |
94 | 92 | ||
95 | /* Extract the method object from the method Node */ | 93 | /* Extract the method object from the method Node */ |
96 | 94 | ||
97 | node = (struct acpi_namespace_node *) obj_handle; | ||
98 | obj_desc = acpi_ns_get_attached_object (node); | 95 | obj_desc = acpi_ns_get_attached_object (node); |
99 | if (!obj_desc) { | 96 | if (!obj_desc) { |
100 | return_ACPI_STATUS (AE_NULL_OBJECT); | 97 | return_ACPI_STATUS (AE_NULL_OBJECT); |
@@ -169,10 +166,18 @@ acpi_ds_parse_method ( | |||
169 | 166 | ||
170 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 167 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
171 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 168 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", |
172 | acpi_ut_get_node_name (obj_handle), obj_handle, op)); | 169 | acpi_ut_get_node_name (node), node, op)); |
170 | |||
171 | /* | ||
172 | * Delete the parse tree. We simply re-parse the method for every | ||
173 | * execution since there isn't much overhead (compared to keeping lots | ||
174 | * of parse trees around) | ||
175 | */ | ||
176 | acpi_ns_delete_namespace_subtree (node); | ||
177 | acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id); | ||
173 | 178 | ||
174 | cleanup2: | 179 | cleanup2: |
175 | (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); | 180 | acpi_ut_release_owner_id (&obj_desc->method.owner_id); |
176 | 181 | ||
177 | cleanup: | 182 | cleanup: |
178 | acpi_ps_delete_parse_tree (op); | 183 | acpi_ps_delete_parse_tree (op); |
@@ -391,7 +396,7 @@ acpi_ds_call_control_method ( | |||
391 | /* On error, we must delete the new walk state */ | 396 | /* On error, we must delete the new walk state */ |
392 | 397 | ||
393 | cleanup: | 398 | cleanup: |
394 | (void) acpi_ut_release_owner_id (obj_desc->method.owner_id); | 399 | acpi_ut_release_owner_id (&obj_desc->method.owner_id); |
395 | if (next_walk_state && (next_walk_state->method_desc)) { | 400 | if (next_walk_state && (next_walk_state->method_desc)) { |
396 | /* Decrement the thread count on the method parse tree */ | 401 | /* Decrement the thread count on the method parse tree */ |
397 | 402 | ||
@@ -563,8 +568,7 @@ acpi_ds_terminate_control_method ( | |||
563 | */ | 568 | */ |
564 | if ((walk_state->method_desc->method.concurrency == 1) && | 569 | if ((walk_state->method_desc->method.concurrency == 1) && |
565 | (!walk_state->method_desc->method.semaphore)) { | 570 | (!walk_state->method_desc->method.semaphore)) { |
566 | status = acpi_os_create_semaphore (1, | 571 | status = acpi_os_create_semaphore (1, 1, |
567 | 1, | ||
568 | &walk_state->method_desc->method.semaphore); | 572 | &walk_state->method_desc->method.semaphore); |
569 | } | 573 | } |
570 | 574 | ||
@@ -595,6 +599,8 @@ acpi_ds_terminate_control_method ( | |||
595 | */ | 599 | */ |
596 | acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); | 600 | acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); |
597 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 601 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
602 | acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id); | ||
603 | |||
598 | if (ACPI_FAILURE (status)) { | 604 | if (ACPI_FAILURE (status)) { |
599 | return_ACPI_STATUS (status); | 605 | return_ACPI_STATUS (status); |
600 | } | 606 | } |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index d360d8e89544..5621665991b5 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -744,7 +744,7 @@ acpi_ds_init_aml_walk ( | |||
744 | u8 *aml_start, | 744 | u8 *aml_start, |
745 | u32 aml_length, | 745 | u32 aml_length, |
746 | struct acpi_parameter_info *info, | 746 | struct acpi_parameter_info *info, |
747 | u32 pass_number) | 747 | u8 pass_number) |
748 | { | 748 | { |
749 | acpi_status status; | 749 | acpi_status status; |
750 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 750 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
@@ -762,7 +762,7 @@ acpi_ds_init_aml_walk ( | |||
762 | /* The next_op of the next_walk will be the beginning of the method */ | 762 | /* The next_op of the next_walk will be the beginning of the method */ |
763 | 763 | ||
764 | walk_state->next_op = NULL; | 764 | walk_state->next_op = NULL; |
765 | walk_state->pass_number = (u8) pass_number; | 765 | walk_state->pass_number = pass_number; |
766 | 766 | ||
767 | if (info) { | 767 | if (info) { |
768 | if (info->parameter_type == ACPI_PARAM_GPE) { | 768 | if (info->parameter_type == ACPI_PARAM_GPE) { |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 38d7ab8aef3a..3df3ada4b9e7 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -411,6 +411,9 @@ acpi_ev_init_global_lock_handler ( | |||
411 | * with an error. | 411 | * with an error. |
412 | */ | 412 | */ |
413 | if (status == AE_NO_HARDWARE_RESPONSE) { | 413 | if (status == AE_NO_HARDWARE_RESPONSE) { |
414 | ACPI_REPORT_ERROR (( | ||
415 | "No response from Global Lock hardware, disabling lock\n")); | ||
416 | |||
414 | acpi_gbl_global_lock_present = FALSE; | 417 | acpi_gbl_global_lock_present = FALSE; |
415 | status = AE_OK; | 418 | status = AE_OK; |
416 | } | 419 | } |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 76c6ebd0231f..d11e9ec827f1 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -99,6 +99,11 @@ acpi_ex_add_table ( | |||
99 | return_ACPI_STATUS (AE_NO_MEMORY); | 99 | return_ACPI_STATUS (AE_NO_MEMORY); |
100 | } | 100 | } |
101 | 101 | ||
102 | /* Init the table handle */ | ||
103 | |||
104 | obj_desc->reference.opcode = AML_LOAD_OP; | ||
105 | *ddb_handle = obj_desc; | ||
106 | |||
102 | /* Install the new table into the local data structures */ | 107 | /* Install the new table into the local data structures */ |
103 | 108 | ||
104 | ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); | 109 | ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); |
@@ -109,7 +114,14 @@ acpi_ex_add_table ( | |||
109 | table_info.allocation = ACPI_MEM_ALLOCATED; | 114 | table_info.allocation = ACPI_MEM_ALLOCATED; |
110 | 115 | ||
111 | status = acpi_tb_install_table (&table_info); | 116 | status = acpi_tb_install_table (&table_info); |
117 | obj_desc->reference.object = table_info.installed_desc; | ||
118 | |||
112 | if (ACPI_FAILURE (status)) { | 119 | if (ACPI_FAILURE (status)) { |
120 | if (status == AE_ALREADY_EXISTS) { | ||
121 | /* Table already exists, just return the handle */ | ||
122 | |||
123 | return_ACPI_STATUS (AE_OK); | ||
124 | } | ||
113 | goto cleanup; | 125 | goto cleanup; |
114 | } | 126 | } |
115 | 127 | ||
@@ -123,16 +135,12 @@ acpi_ex_add_table ( | |||
123 | goto cleanup; | 135 | goto cleanup; |
124 | } | 136 | } |
125 | 137 | ||
126 | /* Init the table handle */ | ||
127 | |||
128 | obj_desc->reference.opcode = AML_LOAD_OP; | ||
129 | obj_desc->reference.object = table_info.installed_desc; | ||
130 | *ddb_handle = obj_desc; | ||
131 | return_ACPI_STATUS (AE_OK); | 138 | return_ACPI_STATUS (AE_OK); |
132 | 139 | ||
133 | 140 | ||
134 | cleanup: | 141 | cleanup: |
135 | acpi_ut_remove_reference (obj_desc); | 142 | acpi_ut_remove_reference (obj_desc); |
143 | *ddb_handle = NULL; | ||
136 | return_ACPI_STATUS (status); | 144 | return_ACPI_STATUS (status); |
137 | } | 145 | } |
138 | 146 | ||
@@ -488,6 +496,7 @@ acpi_ex_unload_table ( | |||
488 | * (Offset contains the table_id) | 496 | * (Offset contains the table_id) |
489 | */ | 497 | */ |
490 | acpi_ns_delete_namespace_by_owner (table_info->owner_id); | 498 | acpi_ns_delete_namespace_by_owner (table_info->owner_id); |
499 | acpi_ut_release_owner_id (&table_info->owner_id); | ||
491 | 500 | ||
492 | /* Delete the table itself */ | 501 | /* Delete the table itself */ |
493 | 502 | ||
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index fd13cc3db018..4f98dceed39a 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -598,7 +598,7 @@ acpi_ex_dump_reference ( | |||
598 | acpi_os_printf ("Could not convert name to pathname\n"); | 598 | acpi_os_printf ("Could not convert name to pathname\n"); |
599 | } | 599 | } |
600 | else { | 600 | else { |
601 | acpi_os_printf ("%s\n", ret_buf.pointer); | 601 | acpi_os_printf ("%s\n", (char *) ret_buf.pointer); |
602 | ACPI_MEM_FREE (ret_buf.pointer); | 602 | ACPI_MEM_FREE (ret_buf.pointer); |
603 | } | 603 | } |
604 | } | 604 | } |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index c1ba8b48228e..48c30f800083 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -955,7 +955,7 @@ acpi_ex_opcode_1A_0T_1R ( | |||
955 | */ | 955 | */ |
956 | return_desc = *(operand[0]->reference.where); | 956 | return_desc = *(operand[0]->reference.where); |
957 | if (return_desc) { | 957 | if (return_desc) { |
958 | acpi_ut_add_reference (return_desc); | 958 | acpi_ut_add_reference (return_desc); |
959 | } | 959 | } |
960 | 960 | ||
961 | break; | 961 | break; |
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 0bda88d18685..7589e1fdf25a 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -159,19 +159,20 @@ acpi_ns_root_initialize ( | |||
159 | obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val); | 159 | obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val); |
160 | obj_desc->common.flags |= AOPOBJ_DATA_VALID; | 160 | obj_desc->common.flags |= AOPOBJ_DATA_VALID; |
161 | 161 | ||
162 | #if defined (ACPI_ASL_COMPILER) || defined (ACPI_DUMP_App) | 162 | #if defined (ACPI_ASL_COMPILER) |
163 | 163 | ||
164 | /* | 164 | /* save the parameter count for the i_aSL compiler */ |
165 | * i_aSL Compiler cheats by putting parameter count | 165 | |
166 | * in the owner_iD (param_count max is 7) | 166 | new_node->value = obj_desc->method.param_count; |
167 | */ | ||
168 | new_node->owner_id = obj_desc->method.param_count; | ||
169 | #else | 167 | #else |
170 | /* Mark this as a very SPECIAL method */ | 168 | /* Mark this as a very SPECIAL method */ |
171 | 169 | ||
172 | obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY; | 170 | obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY; |
171 | |||
172 | #ifndef ACPI_DUMP_APP | ||
173 | obj_desc->method.implementation = acpi_ut_osi_implementation; | 173 | obj_desc->method.implementation = acpi_ut_osi_implementation; |
174 | #endif | 174 | #endif |
175 | #endif | ||
175 | break; | 176 | break; |
176 | 177 | ||
177 | case ACPI_TYPE_INTEGER: | 178 | case ACPI_TYPE_INTEGER: |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index edbf1db36b68..21d560decbf9 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -176,10 +176,9 @@ acpi_ns_delete_node ( | |||
176 | * DESCRIPTION: Initialize a new namespace node and install it amongst | 176 | * DESCRIPTION: Initialize a new namespace node and install it amongst |
177 | * its peers. | 177 | * its peers. |
178 | * | 178 | * |
179 | * Note: Current namespace lookup is linear search. However, the | 179 | * Note: Current namespace lookup is linear search. This appears |
180 | * nodes are linked in alphabetical order to 1) put all reserved | 180 | * to be sufficient as namespace searches consume only a small |
181 | * names (start with underscore) first, and to 2) make a readable | 181 | * fraction of the execution time of the ACPI subsystem. |
182 | * namespace dump. | ||
183 | * | 182 | * |
184 | ******************************************************************************/ | 183 | ******************************************************************************/ |
185 | 184 | ||
@@ -192,10 +191,6 @@ acpi_ns_install_node ( | |||
192 | { | 191 | { |
193 | acpi_owner_id owner_id = 0; | 192 | acpi_owner_id owner_id = 0; |
194 | struct acpi_namespace_node *child_node; | 193 | struct acpi_namespace_node *child_node; |
195 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
196 | |||
197 | struct acpi_namespace_node *previous_child_node; | ||
198 | #endif | ||
199 | 194 | ||
200 | 195 | ||
201 | ACPI_FUNCTION_TRACE ("ns_install_node"); | 196 | ACPI_FUNCTION_TRACE ("ns_install_node"); |
@@ -219,57 +214,6 @@ acpi_ns_install_node ( | |||
219 | node->peer = parent_node; | 214 | node->peer = parent_node; |
220 | } | 215 | } |
221 | else { | 216 | else { |
222 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
223 | /* | ||
224 | * Walk the list whilst searching for the correct | ||
225 | * alphabetic placement. | ||
226 | */ | ||
227 | previous_child_node = NULL; | ||
228 | while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), | ||
229 | acpi_ut_get_node_name (node)) < 0) { | ||
230 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { | ||
231 | /* Last peer; Clear end-of-list flag */ | ||
232 | |||
233 | child_node->flags &= ~ANOBJ_END_OF_PEER_LIST; | ||
234 | |||
235 | /* This node is the new peer to the child node */ | ||
236 | |||
237 | child_node->peer = node; | ||
238 | |||
239 | /* This node is the new end-of-list */ | ||
240 | |||
241 | node->flags |= ANOBJ_END_OF_PEER_LIST; | ||
242 | node->peer = parent_node; | ||
243 | break; | ||
244 | } | ||
245 | |||
246 | /* Get next peer */ | ||
247 | |||
248 | previous_child_node = child_node; | ||
249 | child_node = child_node->peer; | ||
250 | } | ||
251 | |||
252 | /* Did the node get inserted at the end-of-list? */ | ||
253 | |||
254 | if (!(node->flags & ANOBJ_END_OF_PEER_LIST)) { | ||
255 | /* | ||
256 | * Loop above terminated without reaching the end-of-list. | ||
257 | * Insert the new node at the current location | ||
258 | */ | ||
259 | if (previous_child_node) { | ||
260 | /* Insert node alphabetically */ | ||
261 | |||
262 | node->peer = child_node; | ||
263 | previous_child_node->peer = node; | ||
264 | } | ||
265 | else { | ||
266 | /* Insert node alphabetically at start of list */ | ||
267 | |||
268 | node->peer = child_node; | ||
269 | parent_node->child = node; | ||
270 | } | ||
271 | } | ||
272 | #else | ||
273 | while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { | 217 | while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { |
274 | child_node = child_node->peer; | 218 | child_node = child_node->peer; |
275 | } | 219 | } |
@@ -279,9 +223,8 @@ acpi_ns_install_node ( | |||
279 | /* Clear end-of-list flag */ | 223 | /* Clear end-of-list flag */ |
280 | 224 | ||
281 | child_node->flags &= ~ANOBJ_END_OF_PEER_LIST; | 225 | child_node->flags &= ~ANOBJ_END_OF_PEER_LIST; |
282 | node->flags |= ANOBJ_END_OF_PEER_LIST; | 226 | node->flags |= ANOBJ_END_OF_PEER_LIST; |
283 | node->peer = parent_node; | 227 | node->peer = parent_node; |
284 | #endif | ||
285 | } | 228 | } |
286 | 229 | ||
287 | /* Init the new entry */ | 230 | /* Init the new entry */ |
@@ -570,6 +513,10 @@ acpi_ns_delete_namespace_by_owner ( | |||
570 | ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id); | 513 | ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id); |
571 | 514 | ||
572 | 515 | ||
516 | if (owner_id == 0) { | ||
517 | return_VOID; | ||
518 | } | ||
519 | |||
573 | parent_node = acpi_gbl_root_node; | 520 | parent_node = acpi_gbl_root_node; |
574 | child_node = NULL; | 521 | child_node = NULL; |
575 | deletion_node = NULL; | 522 | deletion_node = NULL; |
@@ -635,59 +582,7 @@ acpi_ns_delete_namespace_by_owner ( | |||
635 | } | 582 | } |
636 | } | 583 | } |
637 | 584 | ||
638 | (void) acpi_ut_release_owner_id (owner_id); | ||
639 | return_VOID; | 585 | return_VOID; |
640 | } | 586 | } |
641 | 587 | ||
642 | 588 | ||
643 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
644 | /******************************************************************************* | ||
645 | * | ||
646 | * FUNCTION: acpi_ns_compare_names | ||
647 | * | ||
648 | * PARAMETERS: Name1 - First name to compare | ||
649 | * Name2 - Second name to compare | ||
650 | * | ||
651 | * RETURN: value from strncmp | ||
652 | * | ||
653 | * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an | ||
654 | * underscore are forced to be alphabetically first. | ||
655 | * | ||
656 | ******************************************************************************/ | ||
657 | |||
658 | int | ||
659 | acpi_ns_compare_names ( | ||
660 | char *name1, | ||
661 | char *name2) | ||
662 | { | ||
663 | char reversed_name1[ACPI_NAME_SIZE]; | ||
664 | char reversed_name2[ACPI_NAME_SIZE]; | ||
665 | u32 i; | ||
666 | u32 j; | ||
667 | |||
668 | |||
669 | /* | ||
670 | * Replace all instances of "underscore" with a value that is smaller so | ||
671 | * that all names that are prefixed with underscore(s) are alphabetically | ||
672 | * first. | ||
673 | * | ||
674 | * Reverse the name bytewise so we can just do a 32-bit compare instead | ||
675 | * of a strncmp. | ||
676 | */ | ||
677 | for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) { | ||
678 | reversed_name1[j] = name1[i]; | ||
679 | if (name1[i] == '_') { | ||
680 | reversed_name1[j] = '*'; | ||
681 | } | ||
682 | |||
683 | reversed_name2[j] = name2[i]; | ||
684 | if (name2[i] == '_') { | ||
685 | reversed_name2[j] = '*'; | ||
686 | } | ||
687 | } | ||
688 | |||
689 | return (*(int *) reversed_name1 - *(int *) reversed_name2); | ||
690 | } | ||
691 | #endif | ||
692 | |||
693 | |||
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index d86ccbc8a134..5d25add6b031 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -85,6 +85,9 @@ acpi_ns_print_pathname ( | |||
85 | u32 num_segments, | 85 | u32 num_segments, |
86 | char *pathname) | 86 | char *pathname) |
87 | { | 87 | { |
88 | acpi_native_uint i; | ||
89 | |||
90 | |||
88 | ACPI_FUNCTION_NAME ("ns_print_pathname"); | 91 | ACPI_FUNCTION_NAME ("ns_print_pathname"); |
89 | 92 | ||
90 | 93 | ||
@@ -97,9 +100,13 @@ acpi_ns_print_pathname ( | |||
97 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); | 100 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); |
98 | 101 | ||
99 | while (num_segments) { | 102 | while (num_segments) { |
100 | acpi_os_printf ("%4.4s", pathname); | 103 | for (i = 0; i < 4; i++) { |
101 | pathname += ACPI_NAME_SIZE; | 104 | ACPI_IS_PRINT (pathname[i]) ? |
105 | acpi_os_printf ("%c", pathname[i]) : | ||
106 | acpi_os_printf ("?"); | ||
107 | } | ||
102 | 108 | ||
109 | pathname += ACPI_NAME_SIZE; | ||
103 | num_segments--; | 110 | num_segments--; |
104 | if (num_segments) { | 111 | if (num_segments) { |
105 | acpi_os_printf ("."); | 112 | acpi_os_printf ("."); |
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 1ae89a1c8826..908cffd5e720 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -365,6 +365,7 @@ acpi_ns_evaluate_by_handle ( | |||
365 | * | 365 | * |
366 | * PARAMETERS: Info - Method info block, contains: | 366 | * PARAMETERS: Info - Method info block, contains: |
367 | * Node - Method Node to execute | 367 | * Node - Method Node to execute |
368 | * obj_desc - Method object | ||
368 | * Parameters - List of parameters to pass to the method, | 369 | * Parameters - List of parameters to pass to the method, |
369 | * terminated by NULL. Params itself may be | 370 | * terminated by NULL. Params itself may be |
370 | * NULL if no parameters are being passed. | 371 | * NULL if no parameters are being passed. |
@@ -387,7 +388,6 @@ acpi_ns_execute_control_method ( | |||
387 | struct acpi_parameter_info *info) | 388 | struct acpi_parameter_info *info) |
388 | { | 389 | { |
389 | acpi_status status; | 390 | acpi_status status; |
390 | union acpi_operand_object *obj_desc; | ||
391 | 391 | ||
392 | 392 | ||
393 | ACPI_FUNCTION_TRACE ("ns_execute_control_method"); | 393 | ACPI_FUNCTION_TRACE ("ns_execute_control_method"); |
@@ -395,8 +395,8 @@ acpi_ns_execute_control_method ( | |||
395 | 395 | ||
396 | /* Verify that there is a method associated with this object */ | 396 | /* Verify that there is a method associated with this object */ |
397 | 397 | ||
398 | obj_desc = acpi_ns_get_attached_object (info->node); | 398 | info->obj_desc = acpi_ns_get_attached_object (info->node); |
399 | if (!obj_desc) { | 399 | if (!info->obj_desc) { |
400 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n")); | 400 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n")); |
401 | 401 | ||
402 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 402 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
@@ -407,7 +407,7 @@ acpi_ns_execute_control_method ( | |||
407 | ACPI_LV_INFO, _COMPONENT); | 407 | ACPI_LV_INFO, _COMPONENT); |
408 | 408 | ||
409 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", | 409 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", |
410 | obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1)); | 410 | info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1)); |
411 | 411 | ||
412 | /* | 412 | /* |
413 | * Unlock the namespace before execution. This allows namespace access | 413 | * Unlock the namespace before execution. This allows namespace access |
@@ -430,7 +430,7 @@ acpi_ns_execute_control_method ( | |||
430 | return_ACPI_STATUS (status); | 430 | return_ACPI_STATUS (status); |
431 | } | 431 | } |
432 | 432 | ||
433 | status = acpi_psx_execute (info); | 433 | status = acpi_ps_execute_method (info); |
434 | acpi_ex_exit_interpreter (); | 434 | acpi_ex_exit_interpreter (); |
435 | 435 | ||
436 | return_ACPI_STATUS (status); | 436 | return_ACPI_STATUS (status); |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 34e497016601..1428a84a31e6 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -198,7 +198,7 @@ acpi_ns_load_table_by_type ( | |||
198 | switch (table_type) { | 198 | switch (table_type) { |
199 | case ACPI_TABLE_DSDT: | 199 | case ACPI_TABLE_DSDT: |
200 | 200 | ||
201 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n")); | 201 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n")); |
202 | 202 | ||
203 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; | 203 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; |
204 | 204 | ||
@@ -218,17 +218,18 @@ acpi_ns_load_table_by_type ( | |||
218 | 218 | ||
219 | 219 | ||
220 | case ACPI_TABLE_SSDT: | 220 | case ACPI_TABLE_SSDT: |
221 | case ACPI_TABLE_PSDT: | ||
221 | 222 | ||
222 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n", | 223 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n", |
223 | acpi_gbl_table_lists[ACPI_TABLE_SSDT].count)); | 224 | acpi_gbl_table_lists[table_type].count)); |
224 | 225 | ||
225 | /* | 226 | /* |
226 | * Traverse list of SSDT tables | 227 | * Traverse list of SSDT or PSDT tables |
227 | */ | 228 | */ |
228 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_SSDT].next; | 229 | table_desc = acpi_gbl_table_lists[table_type].next; |
229 | for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_SSDT].count; i++) { | 230 | for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) { |
230 | /* | 231 | /* |
231 | * Only attempt to load table if it is not | 232 | * Only attempt to load table into namespace if it is not |
232 | * already loaded! | 233 | * already loaded! |
233 | */ | 234 | */ |
234 | if (!table_desc->loaded_into_namespace) { | 235 | if (!table_desc->loaded_into_namespace) { |
@@ -245,33 +246,6 @@ acpi_ns_load_table_by_type ( | |||
245 | break; | 246 | break; |
246 | 247 | ||
247 | 248 | ||
248 | case ACPI_TABLE_PSDT: | ||
249 | |||
250 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n", | ||
251 | acpi_gbl_table_lists[ACPI_TABLE_PSDT].count)); | ||
252 | |||
253 | /* | ||
254 | * Traverse list of PSDT tables | ||
255 | */ | ||
256 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_PSDT].next; | ||
257 | |||
258 | for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_PSDT].count; i++) { | ||
259 | /* Only attempt to load table if it is not already loaded! */ | ||
260 | |||
261 | if (!table_desc->loaded_into_namespace) { | ||
262 | status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); | ||
263 | if (ACPI_FAILURE (status)) { | ||
264 | break; | ||
265 | } | ||
266 | |||
267 | table_desc->loaded_into_namespace = TRUE; | ||
268 | } | ||
269 | |||
270 | table_desc = table_desc->next; | ||
271 | } | ||
272 | break; | ||
273 | |||
274 | |||
275 | default: | 249 | default: |
276 | status = AE_SUPPORT; | 250 | status = AE_SUPPORT; |
277 | break; | 251 | break; |
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 64e0b2b9f55c..24bed931d39d 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -67,7 +67,7 @@ | |||
67 | 67 | ||
68 | acpi_status | 68 | acpi_status |
69 | acpi_ns_one_complete_parse ( | 69 | acpi_ns_one_complete_parse ( |
70 | u32 pass_number, | 70 | u8 pass_number, |
71 | struct acpi_table_desc *table_desc) | 71 | struct acpi_table_desc *table_desc) |
72 | { | 72 | { |
73 | union acpi_parse_object *parse_root; | 73 | union acpi_parse_object *parse_root; |
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index edf8aa5f86ca..551d54bdbec3 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -55,8 +55,6 @@ | |||
55 | #include <acpi/acparser.h> | 55 | #include <acpi/acparser.h> |
56 | #include <acpi/acdispat.h> | 56 | #include <acpi/acdispat.h> |
57 | #include <acpi/amlcode.h> | 57 | #include <acpi/amlcode.h> |
58 | #include <acpi/acnamesp.h> | ||
59 | #include <acpi/acinterp.h> | ||
60 | 58 | ||
61 | #define _COMPONENT ACPI_PARSER | 59 | #define _COMPONENT ACPI_PARSER |
62 | ACPI_MODULE_NAME ("psloop") | 60 | ACPI_MODULE_NAME ("psloop") |
@@ -410,11 +408,9 @@ acpi_ps_parse_loop ( | |||
410 | 408 | ||
411 | /* Special processing for certain opcodes */ | 409 | /* Special processing for certain opcodes */ |
412 | 410 | ||
413 | #define ACPI_NO_MODULE_LEVEL_CODE | ||
414 | |||
415 | /* TBD (remove): Temporary mechanism to disable this code if needed */ | 411 | /* TBD (remove): Temporary mechanism to disable this code if needed */ |
416 | 412 | ||
417 | #ifndef ACPI_NO_MODULE_LEVEL_CODE | 413 | #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE |
418 | 414 | ||
419 | if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && | 415 | if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && |
420 | ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { | 416 | ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { |
@@ -431,6 +427,9 @@ acpi_ps_parse_loop ( | |||
431 | case AML_ELSE_OP: | 427 | case AML_ELSE_OP: |
432 | case AML_WHILE_OP: | 428 | case AML_WHILE_OP: |
433 | 429 | ||
430 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | ||
431 | "Pass1: Skipping an If/Else/While body\n")); | ||
432 | |||
434 | /* Skip body of if/else/while in pass 1 */ | 433 | /* Skip body of if/else/while in pass 1 */ |
435 | 434 | ||
436 | parser_state->aml = parser_state->pkg_end; | 435 | parser_state->aml = parser_state->pkg_end; |
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 19a27020eeef..4221b41ae1a6 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c | |||
@@ -200,10 +200,10 @@ acpi_ps_free_op ( | |||
200 | } | 200 | } |
201 | 201 | ||
202 | if (op->common.flags & ACPI_PARSEOP_GENERIC) { | 202 | if (op->common.flags & ACPI_PARSEOP_GENERIC) { |
203 | acpi_os_release_object (acpi_gbl_ps_node_cache, op); | 203 | (void) acpi_os_release_object (acpi_gbl_ps_node_cache, op); |
204 | } | 204 | } |
205 | else { | 205 | else { |
206 | acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op); | 206 | (void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 5279b51e7787..d1541fabaf0a 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -46,19 +46,30 @@ | |||
46 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
47 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
49 | #include <acpi/acnamesp.h> | ||
50 | 49 | ||
51 | 50 | ||
52 | #define _COMPONENT ACPI_PARSER | 51 | #define _COMPONENT ACPI_PARSER |
53 | ACPI_MODULE_NAME ("psxface") | 52 | ACPI_MODULE_NAME ("psxface") |
54 | 53 | ||
54 | /* Local Prototypes */ | ||
55 | |||
56 | static acpi_status | ||
57 | acpi_ps_execute_pass ( | ||
58 | struct acpi_parameter_info *info); | ||
59 | |||
60 | static void | ||
61 | acpi_ps_update_parameter_list ( | ||
62 | struct acpi_parameter_info *info, | ||
63 | u16 action); | ||
64 | |||
55 | 65 | ||
56 | /******************************************************************************* | 66 | /******************************************************************************* |
57 | * | 67 | * |
58 | * FUNCTION: acpi_psx_execute | 68 | * FUNCTION: acpi_ps_execute_method |
59 | * | 69 | * |
60 | * PARAMETERS: Info - Method info block, contains: | 70 | * PARAMETERS: Info - Method info block, contains: |
61 | * Node - Method Node to execute | 71 | * Node - Method Node to execute |
72 | * obj_desc - Method object | ||
62 | * Parameters - List of parameters to pass to the method, | 73 | * Parameters - List of parameters to pass to the method, |
63 | * terminated by NULL. Params itself may be | 74 | * terminated by NULL. Params itself may be |
64 | * NULL if no parameters are being passed. | 75 | * NULL if no parameters are being passed. |
@@ -67,6 +78,7 @@ | |||
67 | * parameter_type - Type of Parameter list | 78 | * parameter_type - Type of Parameter list |
68 | * return_object - Where to put method's return value (if | 79 | * return_object - Where to put method's return value (if |
69 | * any). If NULL, no value is returned. | 80 | * any). If NULL, no value is returned. |
81 | * pass_number - Parse or execute pass | ||
70 | * | 82 | * |
71 | * RETURN: Status | 83 | * RETURN: Status |
72 | * | 84 | * |
@@ -75,174 +87,194 @@ | |||
75 | ******************************************************************************/ | 87 | ******************************************************************************/ |
76 | 88 | ||
77 | acpi_status | 89 | acpi_status |
78 | acpi_psx_execute ( | 90 | acpi_ps_execute_method ( |
79 | struct acpi_parameter_info *info) | 91 | struct acpi_parameter_info *info) |
80 | { | 92 | { |
81 | acpi_status status; | 93 | acpi_status status; |
82 | union acpi_operand_object *obj_desc; | ||
83 | u32 i; | ||
84 | union acpi_parse_object *op; | ||
85 | struct acpi_walk_state *walk_state; | ||
86 | 94 | ||
87 | 95 | ||
88 | ACPI_FUNCTION_TRACE ("psx_execute"); | 96 | ACPI_FUNCTION_TRACE ("ps_execute_method"); |
89 | 97 | ||
90 | 98 | ||
91 | /* Validate the Node and get the attached object */ | 99 | /* Validate the Info and method Node */ |
92 | 100 | ||
93 | if (!info || !info->node) { | 101 | if (!info || !info->node) { |
94 | return_ACPI_STATUS (AE_NULL_ENTRY); | 102 | return_ACPI_STATUS (AE_NULL_ENTRY); |
95 | } | 103 | } |
96 | 104 | ||
97 | obj_desc = acpi_ns_get_attached_object (info->node); | ||
98 | if (!obj_desc) { | ||
99 | return_ACPI_STATUS (AE_NULL_OBJECT); | ||
100 | } | ||
101 | |||
102 | /* Init for new method, wait on concurrency semaphore */ | 105 | /* Init for new method, wait on concurrency semaphore */ |
103 | 106 | ||
104 | status = acpi_ds_begin_method_execution (info->node, obj_desc, NULL); | 107 | status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL); |
105 | if (ACPI_FAILURE (status)) { | 108 | if (ACPI_FAILURE (status)) { |
106 | return_ACPI_STATUS (status); | 109 | return_ACPI_STATUS (status); |
107 | } | 110 | } |
108 | 111 | ||
109 | if ((info->parameter_type == ACPI_PARAM_ARGS) && | ||
110 | (info->parameters)) { | ||
111 | /* | ||
112 | * The caller "owns" the parameters, so give each one an extra | ||
113 | * reference | ||
114 | */ | ||
115 | for (i = 0; info->parameters[i]; i++) { | ||
116 | acpi_ut_add_reference (info->parameters[i]); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | * 1) Perform the first pass parse of the method to enter any | ||
122 | * named objects that it creates into the namespace | ||
123 | */ | ||
124 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | ||
125 | "**** Begin Method Parse **** Entry=%p obj=%p\n", | ||
126 | info->node, obj_desc)); | ||
127 | |||
128 | /* Create and init a Root Node */ | ||
129 | |||
130 | op = acpi_ps_create_scope_op (); | ||
131 | if (!op) { | ||
132 | status = AE_NO_MEMORY; | ||
133 | goto cleanup1; | ||
134 | } | ||
135 | |||
136 | /* | 112 | /* |
137 | * Get a new owner_id for objects created by this method. Namespace | 113 | * Get a new owner_id for objects created by this method. Namespace |
138 | * objects (such as Operation Regions) can be created during the | 114 | * objects (such as Operation Regions) can be created during the |
139 | * first pass parse. | 115 | * first pass parse. |
140 | */ | 116 | */ |
141 | status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); | 117 | status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id); |
142 | if (ACPI_FAILURE (status)) { | 118 | if (ACPI_FAILURE (status)) { |
143 | goto cleanup2; | 119 | return_ACPI_STATUS (status); |
144 | } | ||
145 | |||
146 | /* Create and initialize a new walk state */ | ||
147 | |||
148 | walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, | ||
149 | NULL, NULL, NULL); | ||
150 | if (!walk_state) { | ||
151 | status = AE_NO_MEMORY; | ||
152 | goto cleanup2; | ||
153 | } | 120 | } |
154 | 121 | ||
155 | status = acpi_ds_init_aml_walk (walk_state, op, info->node, | 122 | /* |
156 | obj_desc->method.aml_start, | 123 | * The caller "owns" the parameters, so give each one an extra |
157 | obj_desc->method.aml_length, NULL, 1); | 124 | * reference |
158 | if (ACPI_FAILURE (status)) { | 125 | */ |
159 | goto cleanup3; | 126 | acpi_ps_update_parameter_list (info, REF_INCREMENT); |
160 | } | ||
161 | 127 | ||
162 | /* Parse the AML */ | 128 | /* |
129 | * 1) Perform the first pass parse of the method to enter any | ||
130 | * named objects that it creates into the namespace | ||
131 | */ | ||
132 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | ||
133 | "**** Begin Method Parse **** Entry=%p obj=%p\n", | ||
134 | info->node, info->obj_desc)); | ||
163 | 135 | ||
164 | status = acpi_ps_parse_aml (walk_state); | 136 | info->pass_number = 1; |
165 | acpi_ps_delete_parse_tree (op); | 137 | status = acpi_ps_execute_pass (info); |
166 | if (ACPI_FAILURE (status)) { | 138 | if (ACPI_FAILURE (status)) { |
167 | goto cleanup1; /* Walk state is already deleted */ | 139 | goto cleanup; |
168 | } | 140 | } |
169 | 141 | ||
170 | /* | 142 | /* |
171 | * 2) Execute the method. Performs second pass parse simultaneously | 143 | * 2) Execute the method. Performs second pass parse simultaneously |
172 | */ | 144 | */ |
173 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 145 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
174 | "**** Begin Method Execution **** Entry=%p obj=%p\n", | 146 | "**** Begin Method Execution **** Entry=%p obj=%p\n", |
175 | info->node, obj_desc)); | 147 | info->node, info->obj_desc)); |
176 | 148 | ||
177 | /* Create and init a Root Node */ | 149 | info->pass_number = 3; |
150 | status = acpi_ps_execute_pass (info); | ||
178 | 151 | ||
179 | op = acpi_ps_create_scope_op (); | 152 | |
180 | if (!op) { | 153 | cleanup: |
181 | status = AE_NO_MEMORY; | 154 | if (info->obj_desc->method.owner_id) { |
182 | goto cleanup1; | 155 | acpi_ut_release_owner_id (&info->obj_desc->method.owner_id); |
183 | } | 156 | } |
184 | 157 | ||
185 | /* Init new op with the method name and pointer back to the NS node */ | 158 | /* Take away the extra reference that we gave the parameters above */ |
186 | 159 | ||
187 | acpi_ps_set_name (op, info->node->name.integer); | 160 | acpi_ps_update_parameter_list (info, REF_DECREMENT); |
188 | op->common.node = info->node; | ||
189 | 161 | ||
190 | /* Create and initialize a new walk state */ | 162 | /* Exit now if error above */ |
191 | 163 | ||
192 | walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); | 164 | if (ACPI_FAILURE (status)) { |
193 | if (!walk_state) { | 165 | return_ACPI_STATUS (status); |
194 | status = AE_NO_MEMORY; | ||
195 | goto cleanup2; | ||
196 | } | 166 | } |
197 | 167 | ||
198 | status = acpi_ds_init_aml_walk (walk_state, op, info->node, | 168 | /* |
199 | obj_desc->method.aml_start, | 169 | * If the method has returned an object, signal this to the caller with |
200 | obj_desc->method.aml_length, info, 3); | 170 | * a control exception code |
201 | if (ACPI_FAILURE (status)) { | 171 | */ |
202 | goto cleanup3; | 172 | if (info->return_object) { |
173 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n", | ||
174 | info->return_object)); | ||
175 | ACPI_DUMP_STACK_ENTRY (info->return_object); | ||
176 | |||
177 | status = AE_CTRL_RETURN_VALUE; | ||
203 | } | 178 | } |
204 | 179 | ||
205 | /* The walk of the parse tree is where we actually execute the method */ | 180 | return_ACPI_STATUS (status); |
181 | } | ||
206 | 182 | ||
207 | status = acpi_ps_parse_aml (walk_state); | ||
208 | goto cleanup2; /* Walk state already deleted */ | ||
209 | 183 | ||
184 | /******************************************************************************* | ||
185 | * | ||
186 | * FUNCTION: acpi_ps_update_parameter_list | ||
187 | * | ||
188 | * PARAMETERS: Info - See struct acpi_parameter_info | ||
189 | * (Used: parameter_type and Parameters) | ||
190 | * Action - Add or Remove reference | ||
191 | * | ||
192 | * RETURN: Status | ||
193 | * | ||
194 | * DESCRIPTION: Update reference count on all method parameter objects | ||
195 | * | ||
196 | ******************************************************************************/ | ||
210 | 197 | ||
211 | cleanup3: | 198 | static void |
212 | acpi_ds_delete_walk_state (walk_state); | 199 | acpi_ps_update_parameter_list ( |
200 | struct acpi_parameter_info *info, | ||
201 | u16 action) | ||
202 | { | ||
203 | acpi_native_uint i; | ||
213 | 204 | ||
214 | cleanup2: | ||
215 | acpi_ps_delete_parse_tree (op); | ||
216 | 205 | ||
217 | cleanup1: | ||
218 | if ((info->parameter_type == ACPI_PARAM_ARGS) && | 206 | if ((info->parameter_type == ACPI_PARAM_ARGS) && |
219 | (info->parameters)) { | 207 | (info->parameters)) { |
220 | /* Take away the extra reference that we gave the parameters above */ | 208 | /* Update reference count for each parameter */ |
221 | 209 | ||
222 | for (i = 0; info->parameters[i]; i++) { | 210 | for (i = 0; info->parameters[i]; i++) { |
223 | /* Ignore errors, just do them all */ | 211 | /* Ignore errors, just do them all */ |
224 | 212 | ||
225 | (void) acpi_ut_update_object_reference ( | 213 | (void) acpi_ut_update_object_reference (info->parameters[i], action); |
226 | info->parameters[i], REF_DECREMENT); | ||
227 | } | 214 | } |
228 | } | 215 | } |
216 | } | ||
229 | 217 | ||
230 | if (ACPI_FAILURE (status)) { | 218 | |
231 | return_ACPI_STATUS (status); | 219 | /******************************************************************************* |
220 | * | ||
221 | * FUNCTION: acpi_ps_execute_pass | ||
222 | * | ||
223 | * PARAMETERS: Info - See struct acpi_parameter_info | ||
224 | * (Used: pass_number, Node, and obj_desc) | ||
225 | * | ||
226 | * RETURN: Status | ||
227 | * | ||
228 | * DESCRIPTION: Single AML pass: Parse or Execute a control method | ||
229 | * | ||
230 | ******************************************************************************/ | ||
231 | |||
232 | static acpi_status | ||
233 | acpi_ps_execute_pass ( | ||
234 | struct acpi_parameter_info *info) | ||
235 | { | ||
236 | acpi_status status; | ||
237 | union acpi_parse_object *op; | ||
238 | struct acpi_walk_state *walk_state; | ||
239 | |||
240 | |||
241 | ACPI_FUNCTION_TRACE ("ps_execute_pass"); | ||
242 | |||
243 | |||
244 | /* Create and init a Root Node */ | ||
245 | |||
246 | op = acpi_ps_create_scope_op (); | ||
247 | if (!op) { | ||
248 | return_ACPI_STATUS (AE_NO_MEMORY); | ||
232 | } | 249 | } |
233 | 250 | ||
234 | /* | 251 | /* Create and initialize a new walk state */ |
235 | * If the method has returned an object, signal this to the caller with | ||
236 | * a control exception code | ||
237 | */ | ||
238 | if (info->return_object) { | ||
239 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n", | ||
240 | info->return_object)); | ||
241 | ACPI_DUMP_STACK_ENTRY (info->return_object); | ||
242 | 252 | ||
243 | status = AE_CTRL_RETURN_VALUE; | 253 | walk_state = acpi_ds_create_walk_state ( |
254 | info->obj_desc->method.owner_id, NULL, NULL, NULL); | ||
255 | if (!walk_state) { | ||
256 | status = AE_NO_MEMORY; | ||
257 | goto cleanup; | ||
258 | } | ||
259 | |||
260 | status = acpi_ds_init_aml_walk (walk_state, op, info->node, | ||
261 | info->obj_desc->method.aml_start, | ||
262 | info->obj_desc->method.aml_length, | ||
263 | info->pass_number == 1 ? NULL : info, | ||
264 | info->pass_number); | ||
265 | if (ACPI_FAILURE (status)) { | ||
266 | acpi_ds_delete_walk_state (walk_state); | ||
267 | goto cleanup; | ||
244 | } | 268 | } |
245 | 269 | ||
270 | /* Parse the AML */ | ||
271 | |||
272 | status = acpi_ps_parse_aml (walk_state); | ||
273 | |||
274 | /* Walk state was deleted by parse_aml */ | ||
275 | |||
276 | cleanup: | ||
277 | acpi_ps_delete_parse_tree (op); | ||
246 | return_ACPI_STATUS (status); | 278 | return_ACPI_STATUS (status); |
247 | } | 279 | } |
248 | 280 | ||
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 2ad72f204551..698799901f55 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -124,9 +124,7 @@ acpi_tb_match_signature ( | |||
124 | * | 124 | * |
125 | * RETURN: Status | 125 | * RETURN: Status |
126 | * | 126 | * |
127 | * DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must | 127 | * DESCRIPTION: Install the table into the global data structures. |
128 | * already be loaded and validated. | ||
129 | * Install the table into the global data structs. | ||
130 | * | 128 | * |
131 | ******************************************************************************/ | 129 | ******************************************************************************/ |
132 | 130 | ||
@@ -136,6 +134,7 @@ acpi_tb_install_table ( | |||
136 | { | 134 | { |
137 | acpi_status status; | 135 | acpi_status status; |
138 | 136 | ||
137 | |||
139 | ACPI_FUNCTION_TRACE ("tb_install_table"); | 138 | ACPI_FUNCTION_TRACE ("tb_install_table"); |
140 | 139 | ||
141 | 140 | ||
@@ -143,22 +142,33 @@ acpi_tb_install_table ( | |||
143 | 142 | ||
144 | status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); | 143 | status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); |
145 | if (ACPI_FAILURE (status)) { | 144 | if (ACPI_FAILURE (status)) { |
146 | ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n", | 145 | ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n", |
147 | table_info->pointer->signature, acpi_format_exception (status))); | 146 | acpi_format_exception (status))); |
148 | return_ACPI_STATUS (status); | 147 | return_ACPI_STATUS (status); |
149 | } | 148 | } |
150 | 149 | ||
150 | /* | ||
151 | * Ignore a table that is already installed. For example, some BIOS | ||
152 | * ASL code will repeatedly attempt to load the same SSDT. | ||
153 | */ | ||
154 | status = acpi_tb_is_table_installed (table_info); | ||
155 | if (ACPI_FAILURE (status)) { | ||
156 | goto unlock_and_exit; | ||
157 | } | ||
158 | |||
151 | /* Install the table into the global data structure */ | 159 | /* Install the table into the global data structure */ |
152 | 160 | ||
153 | status = acpi_tb_init_table_descriptor (table_info->type, table_info); | 161 | status = acpi_tb_init_table_descriptor (table_info->type, table_info); |
154 | if (ACPI_FAILURE (status)) { | 162 | if (ACPI_FAILURE (status)) { |
155 | ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n", | 163 | ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n", |
156 | table_info->pointer->signature, acpi_format_exception (status))); | 164 | table_info->pointer->signature, acpi_format_exception (status))); |
157 | } | 165 | } |
158 | 166 | ||
159 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", | 167 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", |
160 | acpi_gbl_table_data[table_info->type].name, table_info->pointer)); | 168 | acpi_gbl_table_data[table_info->type].name, table_info->pointer)); |
161 | 169 | ||
170 | |||
171 | unlock_and_exit: | ||
162 | (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); | 172 | (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); |
163 | return_ACPI_STATUS (status); | 173 | return_ACPI_STATUS (status); |
164 | } | 174 | } |
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index e69d01d443d2..6fc1e36e6042 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -61,6 +61,67 @@ acpi_tb_handle_to_object ( | |||
61 | 61 | ||
62 | /******************************************************************************* | 62 | /******************************************************************************* |
63 | * | 63 | * |
64 | * FUNCTION: acpi_tb_is_table_installed | ||
65 | * | ||
66 | * PARAMETERS: new_table_desc - Descriptor for new table being installed | ||
67 | * | ||
68 | * RETURN: Status - AE_ALREADY_EXISTS if the table is already installed | ||
69 | * | ||
70 | * DESCRIPTION: Determine if an ACPI table is already installed | ||
71 | * | ||
72 | * MUTEX: Table data structures should be locked | ||
73 | * | ||
74 | ******************************************************************************/ | ||
75 | |||
76 | acpi_status | ||
77 | acpi_tb_is_table_installed ( | ||
78 | struct acpi_table_desc *new_table_desc) | ||
79 | { | ||
80 | struct acpi_table_desc *table_desc; | ||
81 | |||
82 | |||
83 | ACPI_FUNCTION_TRACE ("tb_is_table_installed"); | ||
84 | |||
85 | |||
86 | /* Get the list descriptor and first table descriptor */ | ||
87 | |||
88 | table_desc = acpi_gbl_table_lists[new_table_desc->type].next; | ||
89 | |||
90 | /* Examine all installed tables of this type */ | ||
91 | |||
92 | while (table_desc) { | ||
93 | /* Compare Revision and oem_table_id */ | ||
94 | |||
95 | if ((table_desc->loaded_into_namespace) && | ||
96 | (table_desc->pointer->revision == | ||
97 | new_table_desc->pointer->revision) && | ||
98 | (!ACPI_MEMCMP (table_desc->pointer->oem_table_id, | ||
99 | new_table_desc->pointer->oem_table_id, 8))) { | ||
100 | /* This table is already installed */ | ||
101 | |||
102 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, | ||
103 | "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", | ||
104 | new_table_desc->pointer->signature, | ||
105 | new_table_desc->pointer->revision, | ||
106 | new_table_desc->pointer->oem_table_id)); | ||
107 | |||
108 | new_table_desc->owner_id = table_desc->owner_id; | ||
109 | new_table_desc->installed_desc = table_desc; | ||
110 | |||
111 | return_ACPI_STATUS (AE_ALREADY_EXISTS); | ||
112 | } | ||
113 | |||
114 | /* Get next table on the list */ | ||
115 | |||
116 | table_desc = table_desc->next; | ||
117 | } | ||
118 | |||
119 | return_ACPI_STATUS (AE_OK); | ||
120 | } | ||
121 | |||
122 | |||
123 | /******************************************************************************* | ||
124 | * | ||
64 | * FUNCTION: acpi_tb_validate_table_header | 125 | * FUNCTION: acpi_tb_validate_table_header |
65 | * | 126 | * |
66 | * PARAMETERS: table_header - Logical pointer to the table | 127 | * PARAMETERS: table_header - Logical pointer to the table |
@@ -157,7 +218,7 @@ acpi_tb_verify_table_checksum ( | |||
157 | 218 | ||
158 | /* Compute the checksum on the table */ | 219 | /* Compute the checksum on the table */ |
159 | 220 | ||
160 | checksum = acpi_tb_checksum (table_header, table_header->length); | 221 | checksum = acpi_tb_generate_checksum (table_header, table_header->length); |
161 | 222 | ||
162 | /* Return the appropriate exception */ | 223 | /* Return the appropriate exception */ |
163 | 224 | ||
@@ -175,7 +236,7 @@ acpi_tb_verify_table_checksum ( | |||
175 | 236 | ||
176 | /******************************************************************************* | 237 | /******************************************************************************* |
177 | * | 238 | * |
178 | * FUNCTION: acpi_tb_checksum | 239 | * FUNCTION: acpi_tb_generate_checksum |
179 | * | 240 | * |
180 | * PARAMETERS: Buffer - Buffer to checksum | 241 | * PARAMETERS: Buffer - Buffer to checksum |
181 | * Length - Size of the buffer | 242 | * Length - Size of the buffer |
@@ -187,7 +248,7 @@ acpi_tb_verify_table_checksum ( | |||
187 | ******************************************************************************/ | 248 | ******************************************************************************/ |
188 | 249 | ||
189 | u8 | 250 | u8 |
190 | acpi_tb_checksum ( | 251 | acpi_tb_generate_checksum ( |
191 | void *buffer, | 252 | void *buffer, |
192 | u32 length) | 253 | u32 length) |
193 | { | 254 | { |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index ca2dbdd23ed3..e18a05d1b9b3 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -182,10 +182,23 @@ acpi_load_table ( | |||
182 | return_ACPI_STATUS (status); | 182 | return_ACPI_STATUS (status); |
183 | } | 183 | } |
184 | 184 | ||
185 | /* Check signature for a valid table type */ | ||
186 | |||
187 | status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_ALL); | ||
188 | if (ACPI_FAILURE (status)) { | ||
189 | return_ACPI_STATUS (status); | ||
190 | } | ||
191 | |||
185 | /* Install the new table into the local data structures */ | 192 | /* Install the new table into the local data structures */ |
186 | 193 | ||
187 | status = acpi_tb_install_table (&table_info); | 194 | status = acpi_tb_install_table (&table_info); |
188 | if (ACPI_FAILURE (status)) { | 195 | if (ACPI_FAILURE (status)) { |
196 | if (status == AE_ALREADY_EXISTS) { | ||
197 | /* Table already exists, no error */ | ||
198 | |||
199 | status = AE_OK; | ||
200 | } | ||
201 | |||
189 | /* Free table allocated by acpi_tb_get_table_body */ | 202 | /* Free table allocated by acpi_tb_get_table_body */ |
190 | 203 | ||
191 | acpi_tb_delete_single_table (&table_info); | 204 | acpi_tb_delete_single_table (&table_info); |
@@ -261,6 +274,7 @@ acpi_unload_table ( | |||
261 | * simply a position within the hierarchy | 274 | * simply a position within the hierarchy |
262 | */ | 275 | */ |
263 | acpi_ns_delete_namespace_by_owner (table_desc->owner_id); | 276 | acpi_ns_delete_namespace_by_owner (table_desc->owner_id); |
277 | acpi_ut_release_owner_id (&table_desc->owner_id); | ||
264 | table_desc = table_desc->next; | 278 | table_desc = table_desc->next; |
265 | } | 279 | } |
266 | 280 | ||
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index abb4c9346560..87dccdda9ae2 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -93,14 +93,14 @@ acpi_tb_validate_rsdp ( | |||
93 | 93 | ||
94 | /* Check the standard checksum */ | 94 | /* Check the standard checksum */ |
95 | 95 | ||
96 | if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { | 96 | if (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { |
97 | return (AE_BAD_CHECKSUM); | 97 | return (AE_BAD_CHECKSUM); |
98 | } | 98 | } |
99 | 99 | ||
100 | /* Check extended checksum if table version >= 2 */ | 100 | /* Check extended checksum if table version >= 2 */ |
101 | 101 | ||
102 | if ((rsdp->revision >= 2) && | 102 | if ((rsdp->revision >= 2) && |
103 | (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { | 103 | (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { |
104 | return (AE_BAD_CHECKSUM); | 104 | return (AE_BAD_CHECKSUM); |
105 | } | 105 | } |
106 | 106 | ||
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 5061c6f0ee66..78270f50e625 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -76,7 +76,7 @@ static acpi_status | |||
76 | acpi_ut_create_list ( | 76 | acpi_ut_create_list ( |
77 | char *list_name, | 77 | char *list_name, |
78 | u16 object_size, | 78 | u16 object_size, |
79 | acpi_handle *return_cache); | 79 | struct acpi_memory_list **return_cache); |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | 82 | ||
@@ -428,7 +428,7 @@ static acpi_status | |||
428 | acpi_ut_create_list ( | 428 | acpi_ut_create_list ( |
429 | char *list_name, | 429 | char *list_name, |
430 | u16 object_size, | 430 | u16 object_size, |
431 | acpi_handle *return_cache) | 431 | struct acpi_memory_list **return_cache) |
432 | { | 432 | { |
433 | struct acpi_memory_list *cache; | 433 | struct acpi_memory_list *cache; |
434 | 434 | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 3d5fbc810b0b..c27cbb7f5c54 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -55,6 +55,12 @@ static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF; | |||
55 | static char *acpi_gbl_fn_entry_str = "----Entry"; | 55 | static char *acpi_gbl_fn_entry_str = "----Entry"; |
56 | static char *acpi_gbl_fn_exit_str = "----Exit-"; | 56 | static char *acpi_gbl_fn_exit_str = "----Exit-"; |
57 | 57 | ||
58 | /* Local prototypes */ | ||
59 | |||
60 | static const char * | ||
61 | acpi_ut_trim_function_name ( | ||
62 | const char *function_name); | ||
63 | |||
58 | 64 | ||
59 | /******************************************************************************* | 65 | /******************************************************************************* |
60 | * | 66 | * |
@@ -72,7 +78,7 @@ void | |||
72 | acpi_ut_init_stack_ptr_trace ( | 78 | acpi_ut_init_stack_ptr_trace ( |
73 | void) | 79 | void) |
74 | { | 80 | { |
75 | u32 current_sp; | 81 | u32 current_sp; |
76 | 82 | ||
77 | 83 | ||
78 | acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (¤t_sp, NULL); | 84 | acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (¤t_sp, NULL); |
@@ -95,7 +101,7 @@ void | |||
95 | acpi_ut_track_stack_ptr ( | 101 | acpi_ut_track_stack_ptr ( |
96 | void) | 102 | void) |
97 | { | 103 | { |
98 | acpi_size current_sp; | 104 | acpi_size current_sp; |
99 | 105 | ||
100 | 106 | ||
101 | current_sp = ACPI_PTR_DIFF (¤t_sp, NULL); | 107 | current_sp = ACPI_PTR_DIFF (¤t_sp, NULL); |
@@ -112,6 +118,43 @@ acpi_ut_track_stack_ptr ( | |||
112 | 118 | ||
113 | /******************************************************************************* | 119 | /******************************************************************************* |
114 | * | 120 | * |
121 | * FUNCTION: acpi_ut_trim_function_name | ||
122 | * | ||
123 | * PARAMETERS: function_name - Ascii string containing a procedure name | ||
124 | * | ||
125 | * RETURN: Updated pointer to the function name | ||
126 | * | ||
127 | * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. | ||
128 | * This allows compiler macros such as __FUNCTION__ to be used | ||
129 | * with no change to the debug output. | ||
130 | * | ||
131 | ******************************************************************************/ | ||
132 | |||
133 | static const char * | ||
134 | acpi_ut_trim_function_name ( | ||
135 | const char *function_name) | ||
136 | { | ||
137 | |||
138 | /* All Function names are longer than 4 chars, check is safe */ | ||
139 | |||
140 | if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX1) { | ||
141 | /* This is the case where the original source has not been modified */ | ||
142 | |||
143 | return (function_name + 4); | ||
144 | } | ||
145 | |||
146 | if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX2) { | ||
147 | /* This is the case where the source has been 'linuxized' */ | ||
148 | |||
149 | return (function_name + 5); | ||
150 | } | ||
151 | |||
152 | return (function_name); | ||
153 | } | ||
154 | |||
155 | |||
156 | /******************************************************************************* | ||
157 | * | ||
115 | * FUNCTION: acpi_ut_debug_print | 158 | * FUNCTION: acpi_ut_debug_print |
116 | * | 159 | * |
117 | * PARAMETERS: requested_debug_level - Requested debug print level | 160 | * PARAMETERS: requested_debug_level - Requested debug print level |
@@ -133,7 +176,7 @@ void ACPI_INTERNAL_VAR_XFACE | |||
133 | acpi_ut_debug_print ( | 176 | acpi_ut_debug_print ( |
134 | u32 requested_debug_level, | 177 | u32 requested_debug_level, |
135 | u32 line_number, | 178 | u32 line_number, |
136 | char *function_name, | 179 | const char *function_name, |
137 | char *module_name, | 180 | char *module_name, |
138 | u32 component_id, | 181 | u32 component_id, |
139 | char *format, | 182 | char *format, |
@@ -177,7 +220,7 @@ acpi_ut_debug_print ( | |||
177 | } | 220 | } |
178 | 221 | ||
179 | acpi_os_printf ("[%02ld] %-22.22s: ", | 222 | acpi_os_printf ("[%02ld] %-22.22s: ", |
180 | acpi_gbl_nesting_level, function_name); | 223 | acpi_gbl_nesting_level, acpi_ut_trim_function_name (function_name)); |
181 | 224 | ||
182 | va_start (args, format); | 225 | va_start (args, format); |
183 | acpi_os_vprintf (format, args); | 226 | acpi_os_vprintf (format, args); |
@@ -208,7 +251,7 @@ void ACPI_INTERNAL_VAR_XFACE | |||
208 | acpi_ut_debug_print_raw ( | 251 | acpi_ut_debug_print_raw ( |
209 | u32 requested_debug_level, | 252 | u32 requested_debug_level, |
210 | u32 line_number, | 253 | u32 line_number, |
211 | char *function_name, | 254 | const char *function_name, |
212 | char *module_name, | 255 | char *module_name, |
213 | u32 component_id, | 256 | u32 component_id, |
214 | char *format, | 257 | char *format, |
@@ -247,7 +290,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); | |||
247 | void | 290 | void |
248 | acpi_ut_trace ( | 291 | acpi_ut_trace ( |
249 | u32 line_number, | 292 | u32 line_number, |
250 | char *function_name, | 293 | const char *function_name, |
251 | char *module_name, | 294 | char *module_name, |
252 | u32 component_id) | 295 | u32 component_id) |
253 | { | 296 | { |
@@ -282,7 +325,7 @@ EXPORT_SYMBOL(acpi_ut_trace); | |||
282 | void | 325 | void |
283 | acpi_ut_trace_ptr ( | 326 | acpi_ut_trace_ptr ( |
284 | u32 line_number, | 327 | u32 line_number, |
285 | char *function_name, | 328 | const char *function_name, |
286 | char *module_name, | 329 | char *module_name, |
287 | u32 component_id, | 330 | u32 component_id, |
288 | void *pointer) | 331 | void *pointer) |
@@ -316,7 +359,7 @@ acpi_ut_trace_ptr ( | |||
316 | void | 359 | void |
317 | acpi_ut_trace_str ( | 360 | acpi_ut_trace_str ( |
318 | u32 line_number, | 361 | u32 line_number, |
319 | char *function_name, | 362 | const char *function_name, |
320 | char *module_name, | 363 | char *module_name, |
321 | u32 component_id, | 364 | u32 component_id, |
322 | char *string) | 365 | char *string) |
@@ -351,7 +394,7 @@ acpi_ut_trace_str ( | |||
351 | void | 394 | void |
352 | acpi_ut_trace_u32 ( | 395 | acpi_ut_trace_u32 ( |
353 | u32 line_number, | 396 | u32 line_number, |
354 | char *function_name, | 397 | const char *function_name, |
355 | char *module_name, | 398 | char *module_name, |
356 | u32 component_id, | 399 | u32 component_id, |
357 | u32 integer) | 400 | u32 integer) |
@@ -385,7 +428,7 @@ acpi_ut_trace_u32 ( | |||
385 | void | 428 | void |
386 | acpi_ut_exit ( | 429 | acpi_ut_exit ( |
387 | u32 line_number, | 430 | u32 line_number, |
388 | char *function_name, | 431 | const char *function_name, |
389 | char *module_name, | 432 | char *module_name, |
390 | u32 component_id) | 433 | u32 component_id) |
391 | { | 434 | { |
@@ -419,7 +462,7 @@ EXPORT_SYMBOL(acpi_ut_exit); | |||
419 | void | 462 | void |
420 | acpi_ut_status_exit ( | 463 | acpi_ut_status_exit ( |
421 | u32 line_number, | 464 | u32 line_number, |
422 | char *function_name, | 465 | const char *function_name, |
423 | char *module_name, | 466 | char *module_name, |
424 | u32 component_id, | 467 | u32 component_id, |
425 | acpi_status status) | 468 | acpi_status status) |
@@ -463,7 +506,7 @@ EXPORT_SYMBOL(acpi_ut_status_exit); | |||
463 | void | 506 | void |
464 | acpi_ut_value_exit ( | 507 | acpi_ut_value_exit ( |
465 | u32 line_number, | 508 | u32 line_number, |
466 | char *function_name, | 509 | const char *function_name, |
467 | char *module_name, | 510 | char *module_name, |
468 | u32 component_id, | 511 | u32 component_id, |
469 | acpi_integer value) | 512 | acpi_integer value) |
@@ -499,7 +542,7 @@ EXPORT_SYMBOL(acpi_ut_value_exit); | |||
499 | void | 542 | void |
500 | acpi_ut_ptr_exit ( | 543 | acpi_ut_ptr_exit ( |
501 | u32 line_number, | 544 | u32 line_number, |
502 | char *function_name, | 545 | const char *function_name, |
503 | char *module_name, | 546 | char *module_name, |
504 | u32 component_id, | 547 | u32 component_id, |
505 | u8 *ptr) | 548 | u8 *ptr) |
@@ -607,8 +650,8 @@ acpi_ut_dump_buffer ( | |||
607 | } | 650 | } |
608 | 651 | ||
609 | /* | 652 | /* |
610 | * Print the ASCII equivalent characters | 653 | * Print the ASCII equivalent characters but watch out for the bad |
611 | * But watch out for the bad unprintable ones... | 654 | * unprintable ones (printable chars are 0x20 through 0x7E) |
612 | */ | 655 | */ |
613 | acpi_os_printf (" "); | 656 | acpi_os_printf (" "); |
614 | for (j = 0; j < 16; j++) { | 657 | for (j = 0; j < 16; j++) { |
@@ -618,9 +661,7 @@ acpi_ut_dump_buffer ( | |||
618 | } | 661 | } |
619 | 662 | ||
620 | buf_char = buffer[i + j]; | 663 | buf_char = buffer[i + j]; |
621 | if ((buf_char > 0x1F && buf_char < 0x2E) || | 664 | if (ACPI_IS_PRINT (buf_char)) { |
622 | (buf_char > 0x2F && buf_char < 0x61) || | ||
623 | (buf_char > 0x60 && buf_char < 0x7F)) { | ||
624 | acpi_os_printf ("%c", buf_char); | 665 | acpi_os_printf ("%c", buf_char); |
625 | } | 666 | } |
626 | else { | 667 | else { |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index df715cd89105..1d350b302a34 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -56,7 +56,11 @@ | |||
56 | * | 56 | * |
57 | * PARAMETERS: owner_id - Where the new owner ID is returned | 57 | * PARAMETERS: owner_id - Where the new owner ID is returned |
58 | * | 58 | * |
59 | * DESCRIPTION: Allocate a table or method owner id | 59 | * RETURN: Status |
60 | * | ||
61 | * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to | ||
62 | * track objects created by the table or method, to be deleted | ||
63 | * when the method exits or the table is unloaded. | ||
60 | * | 64 | * |
61 | ******************************************************************************/ | 65 | ******************************************************************************/ |
62 | 66 | ||
@@ -71,6 +75,8 @@ acpi_ut_allocate_owner_id ( | |||
71 | ACPI_FUNCTION_TRACE ("ut_allocate_owner_id"); | 75 | ACPI_FUNCTION_TRACE ("ut_allocate_owner_id"); |
72 | 76 | ||
73 | 77 | ||
78 | /* Mutex for the global ID mask */ | ||
79 | |||
74 | status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); | 80 | status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); |
75 | if (ACPI_FAILURE (status)) { | 81 | if (ACPI_FAILURE (status)) { |
76 | return_ACPI_STATUS (status); | 82 | return_ACPI_STATUS (status); |
@@ -81,7 +87,7 @@ acpi_ut_allocate_owner_id ( | |||
81 | for (i = 0; i < 32; i++) { | 87 | for (i = 0; i < 32; i++) { |
82 | if (!(acpi_gbl_owner_id_mask & (1 << i))) { | 88 | if (!(acpi_gbl_owner_id_mask & (1 << i))) { |
83 | acpi_gbl_owner_id_mask |= (1 << i); | 89 | acpi_gbl_owner_id_mask |= (1 << i); |
84 | *owner_id = (acpi_owner_id) i; | 90 | *owner_id = (acpi_owner_id) (i + 1); |
85 | goto exit; | 91 | goto exit; |
86 | } | 92 | } |
87 | } | 93 | } |
@@ -93,6 +99,7 @@ acpi_ut_allocate_owner_id ( | |||
93 | * they are released when a table is unloaded or a method completes | 99 | * they are released when a table is unloaded or a method completes |
94 | * execution. | 100 | * execution. |
95 | */ | 101 | */ |
102 | *owner_id = 0; | ||
96 | status = AE_OWNER_ID_LIMIT; | 103 | status = AE_OWNER_ID_LIMIT; |
97 | ACPI_REPORT_ERROR (( | 104 | ACPI_REPORT_ERROR (( |
98 | "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); | 105 | "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); |
@@ -107,40 +114,55 @@ exit: | |||
107 | * | 114 | * |
108 | * FUNCTION: acpi_ut_release_owner_id | 115 | * FUNCTION: acpi_ut_release_owner_id |
109 | * | 116 | * |
110 | * PARAMETERS: owner_id - A previously allocated owner ID | 117 | * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD |
111 | * | 118 | * |
112 | * DESCRIPTION: Release a table or method owner id | 119 | * RETURN: None. No error is returned because we are either exiting a |
120 | * control method or unloading a table. Either way, we would | ||
121 | * ignore any error anyway. | ||
122 | * | ||
123 | * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 32 | ||
113 | * | 124 | * |
114 | ******************************************************************************/ | 125 | ******************************************************************************/ |
115 | 126 | ||
116 | acpi_status | 127 | void |
117 | acpi_ut_release_owner_id ( | 128 | acpi_ut_release_owner_id ( |
118 | acpi_owner_id owner_id) | 129 | acpi_owner_id *owner_id_ptr) |
119 | { | 130 | { |
131 | acpi_owner_id owner_id = *owner_id_ptr; | ||
120 | acpi_status status; | 132 | acpi_status status; |
121 | 133 | ||
122 | 134 | ||
123 | ACPI_FUNCTION_TRACE ("ut_release_owner_id"); | 135 | ACPI_FUNCTION_TRACE ("ut_release_owner_id"); |
124 | 136 | ||
125 | 137 | ||
138 | /* Always clear the input owner_id (zero is an invalid ID) */ | ||
139 | |||
140 | *owner_id_ptr = 0; | ||
141 | |||
142 | /* Zero is not a valid owner_iD */ | ||
143 | |||
144 | if ((owner_id == 0) || (owner_id > 32)) { | ||
145 | ACPI_REPORT_ERROR (("Invalid owner_id: %2.2X\n", owner_id)); | ||
146 | return_VOID; | ||
147 | } | ||
148 | |||
149 | /* Mutex for the global ID mask */ | ||
150 | |||
126 | status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); | 151 | status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); |
127 | if (ACPI_FAILURE (status)) { | 152 | if (ACPI_FAILURE (status)) { |
128 | return_ACPI_STATUS (status); | 153 | return_VOID; |
129 | } | 154 | } |
130 | 155 | ||
131 | /* Free the owner ID */ | 156 | owner_id--; /* Normalize to zero */ |
157 | |||
158 | /* Free the owner ID only if it is valid */ | ||
132 | 159 | ||
133 | if (acpi_gbl_owner_id_mask & (1 << owner_id)) { | 160 | if (acpi_gbl_owner_id_mask & (1 << owner_id)) { |
134 | acpi_gbl_owner_id_mask ^= (1 << owner_id); | 161 | acpi_gbl_owner_id_mask ^= (1 << owner_id); |
135 | } | 162 | } |
136 | else { | ||
137 | /* This owner_id has not been allocated */ | ||
138 | |||
139 | status = AE_NOT_EXIST; | ||
140 | } | ||
141 | 163 | ||
142 | (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); | 164 | (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); |
143 | return_ACPI_STATUS (status); | 165 | return_VOID; |
144 | } | 166 | } |
145 | 167 | ||
146 | 168 | ||
@@ -150,7 +172,7 @@ acpi_ut_release_owner_id ( | |||
150 | * | 172 | * |
151 | * PARAMETERS: src_string - The source string to convert | 173 | * PARAMETERS: src_string - The source string to convert |
152 | * | 174 | * |
153 | * RETURN: Converted src_string (same as input pointer) | 175 | * RETURN: None |
154 | * | 176 | * |
155 | * DESCRIPTION: Convert string to uppercase | 177 | * DESCRIPTION: Convert string to uppercase |
156 | * | 178 | * |
@@ -158,7 +180,7 @@ acpi_ut_release_owner_id ( | |||
158 | * | 180 | * |
159 | ******************************************************************************/ | 181 | ******************************************************************************/ |
160 | 182 | ||
161 | char * | 183 | void |
162 | acpi_ut_strupr ( | 184 | acpi_ut_strupr ( |
163 | char *src_string) | 185 | char *src_string) |
164 | { | 186 | { |
@@ -169,7 +191,7 @@ acpi_ut_strupr ( | |||
169 | 191 | ||
170 | 192 | ||
171 | if (!src_string) { | 193 | if (!src_string) { |
172 | return (NULL); | 194 | return; |
173 | } | 195 | } |
174 | 196 | ||
175 | /* Walk entire string, uppercasing the letters */ | 197 | /* Walk entire string, uppercasing the letters */ |
@@ -178,7 +200,7 @@ acpi_ut_strupr ( | |||
178 | *string = (char) ACPI_TOUPPER (*string); | 200 | *string = (char) ACPI_TOUPPER (*string); |
179 | } | 201 | } |
180 | 202 | ||
181 | return (src_string); | 203 | return; |
182 | } | 204 | } |
183 | 205 | ||
184 | 206 | ||