aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/dispatcher/dsinit.c6
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c35
-rw-r--r--drivers/acpi/executer/exconfig.c2
-rw-r--r--drivers/acpi/executer/exdump.c2
-rw-r--r--drivers/acpi/executer/exoparg1.c15
-rw-r--r--drivers/acpi/executer/exresop.c16
-rw-r--r--drivers/acpi/namespace/nsaccess.c2
-rw-r--r--drivers/acpi/namespace/nsalloc.c5
-rw-r--r--drivers/acpi/namespace/nsdump.c8
-rw-r--r--drivers/acpi/namespace/nsparse.c2
-rw-r--r--drivers/acpi/parser/psloop.c9
-rw-r--r--drivers/acpi/parser/psxface.c7
-rw-r--r--drivers/acpi/tables/tbinstal.c12
-rw-r--r--drivers/acpi/tables/tbrsdt.c25
-rw-r--r--drivers/acpi/tables/tbxface.c3
-rw-r--r--drivers/acpi/tables/tbxfroot.c106
-rw-r--r--drivers/acpi/utilities/utcache.c12
-rw-r--r--drivers/acpi/utilities/utdebug.c169
-rw-r--r--drivers/acpi/utilities/utdelete.c98
-rw-r--r--drivers/acpi/utilities/utglobal.c72
-rw-r--r--drivers/acpi/utilities/utmisc.c94
-rw-r--r--drivers/acpi/utilities/utmutex.c10
22 files changed, 377 insertions, 333 deletions
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c
index d7790db50178..ebc07aab710c 100644
--- a/drivers/acpi/dispatcher/dsinit.c
+++ b/drivers/acpi/dispatcher/dsinit.c
@@ -99,7 +99,7 @@ acpi_ds_init_one_object (
99 * was just loaded 99 * was just loaded
100 */ 100 */
101 if (((struct acpi_namespace_node *) obj_handle)->owner_id != 101 if (((struct acpi_namespace_node *) obj_handle)->owner_id !=
102 info->table_desc->table_id) { 102 info->table_desc->owner_id) {
103 return (AE_OK); 103 return (AE_OK);
104 } 104 }
105 105
@@ -168,7 +168,7 @@ acpi_ds_init_one_object (
168 */ 168 */
169 acpi_ns_delete_namespace_subtree (obj_handle); 169 acpi_ns_delete_namespace_subtree (obj_handle);
170 acpi_ns_delete_namespace_by_owner ( 170 acpi_ns_delete_namespace_by_owner (
171 ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); 171 ((struct acpi_namespace_node *) obj_handle)->object->method.owner_id);
172 break; 172 break;
173 173
174 174
@@ -237,7 +237,7 @@ acpi_ds_initialize_objects (
237 237
238 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 238 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
239 "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", 239 "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
240 table_desc->pointer->signature, table_desc->table_id, info.object_count, 240 table_desc->pointer->signature, table_desc->owner_id, info.object_count,
241 info.device_count, info.method_count, info.op_region_count)); 241 info.device_count, info.method_count, info.op_region_count));
242 242
243 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 243 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index c9d9a6c45ae3..1b90813cbde1 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -77,7 +77,6 @@ acpi_ds_parse_method (
77 union acpi_operand_object *obj_desc; 77 union acpi_operand_object *obj_desc;
78 union acpi_parse_object *op; 78 union acpi_parse_object *op;
79 struct acpi_namespace_node *node; 79 struct acpi_namespace_node *node;
80 acpi_owner_id owner_id;
81 struct acpi_walk_state *walk_state; 80 struct acpi_walk_state *walk_state;
82 81
83 82
@@ -132,15 +131,18 @@ acpi_ds_parse_method (
132 * objects (such as Operation Regions) can be created during the 131 * objects (such as Operation Regions) can be created during the
133 * first pass parse. 132 * first pass parse.
134 */ 133 */
135 owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); 134 status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
136 obj_desc->method.owning_id = owner_id; 135 if (ACPI_FAILURE (status)) {
136 goto cleanup;
137 }
137 138
138 /* Create and initialize a new walk state */ 139 /* Create and initialize a new walk state */
139 140
140 walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL); 141 walk_state = acpi_ds_create_walk_state (
142 obj_desc->method.owner_id, NULL, NULL, NULL);
141 if (!walk_state) { 143 if (!walk_state) {
142 status = AE_NO_MEMORY; 144 status = AE_NO_MEMORY;
143 goto cleanup; 145 goto cleanup2;
144 } 146 }
145 147
146 status = acpi_ds_init_aml_walk (walk_state, op, node, 148 status = acpi_ds_init_aml_walk (walk_state, op, node,
@@ -148,7 +150,7 @@ acpi_ds_parse_method (
148 obj_desc->method.aml_length, NULL, 1); 150 obj_desc->method.aml_length, NULL, 1);
149 if (ACPI_FAILURE (status)) { 151 if (ACPI_FAILURE (status)) {
150 acpi_ds_delete_walk_state (walk_state); 152 acpi_ds_delete_walk_state (walk_state);
151 goto cleanup; 153 goto cleanup2;
152 } 154 }
153 155
154 /* 156 /*
@@ -162,13 +164,16 @@ acpi_ds_parse_method (
162 */ 164 */
163 status = acpi_ps_parse_aml (walk_state); 165 status = acpi_ps_parse_aml (walk_state);
164 if (ACPI_FAILURE (status)) { 166 if (ACPI_FAILURE (status)) {
165 goto cleanup; 167 goto cleanup2;
166 } 168 }
167 169
168 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 170 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
169 "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", 171 "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
170 acpi_ut_get_node_name (obj_handle), obj_handle, op)); 172 acpi_ut_get_node_name (obj_handle), obj_handle, op));
171 173
174cleanup2:
175 (void) acpi_ut_release_owner_id (obj_desc->method.owner_id);
176
172cleanup: 177cleanup:
173 acpi_ps_delete_parse_tree (op); 178 acpi_ps_delete_parse_tree (op);
174 return_ACPI_STATUS (status); 179 return_ACPI_STATUS (status);
@@ -265,7 +270,7 @@ acpi_ds_call_control_method (
265{ 270{
266 acpi_status status; 271 acpi_status status;
267 struct acpi_namespace_node *method_node; 272 struct acpi_namespace_node *method_node;
268 struct acpi_walk_state *next_walk_state; 273 struct acpi_walk_state *next_walk_state = NULL;
269 union acpi_operand_object *obj_desc; 274 union acpi_operand_object *obj_desc;
270 struct acpi_parameter_info info; 275 struct acpi_parameter_info info;
271 u32 i; 276 u32 i;
@@ -289,20 +294,23 @@ acpi_ds_call_control_method (
289 return_ACPI_STATUS (AE_NULL_OBJECT); 294 return_ACPI_STATUS (AE_NULL_OBJECT);
290 } 295 }
291 296
292 obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); 297 status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
298 if (ACPI_FAILURE (status)) {
299 return_ACPI_STATUS (status);
300 }
293 301
294 /* Init for new method, wait on concurrency semaphore */ 302 /* Init for new method, wait on concurrency semaphore */
295 303
296 status = acpi_ds_begin_method_execution (method_node, obj_desc, 304 status = acpi_ds_begin_method_execution (method_node, obj_desc,
297 this_walk_state->method_node); 305 this_walk_state->method_node);
298 if (ACPI_FAILURE (status)) { 306 if (ACPI_FAILURE (status)) {
299 return_ACPI_STATUS (status); 307 goto cleanup;
300 } 308 }
301 309
302 if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { 310 if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
303 /* 1) Parse: Create a new walk state for the preempting walk */ 311 /* 1) Parse: Create a new walk state for the preempting walk */
304 312
305 next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, 313 next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
306 op, obj_desc, NULL); 314 op, obj_desc, NULL);
307 if (!next_walk_state) { 315 if (!next_walk_state) {
308 return_ACPI_STATUS (AE_NO_MEMORY); 316 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -332,7 +340,7 @@ acpi_ds_call_control_method (
332 340
333 /* 2) Execute: Create a new state for the preempting walk */ 341 /* 2) Execute: Create a new state for the preempting walk */
334 342
335 next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, 343 next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
336 NULL, obj_desc, thread); 344 NULL, obj_desc, thread);
337 if (!next_walk_state) { 345 if (!next_walk_state) {
338 status = AE_NO_MEMORY; 346 status = AE_NO_MEMORY;
@@ -383,6 +391,7 @@ acpi_ds_call_control_method (
383 /* On error, we must delete the new walk state */ 391 /* On error, we must delete the new walk state */
384 392
385cleanup: 393cleanup:
394 (void) acpi_ut_release_owner_id (obj_desc->method.owner_id);
386 if (next_walk_state && (next_walk_state->method_desc)) { 395 if (next_walk_state && (next_walk_state->method_desc)) {
387 /* Decrement the thread count on the method parse tree */ 396 /* Decrement the thread count on the method parse tree */
388 397
@@ -584,7 +593,7 @@ acpi_ds_terminate_control_method (
584 * Delete any namespace entries created anywhere else within 593 * Delete any namespace entries created anywhere else within
585 * the namespace 594 * the namespace
586 */ 595 */
587 acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id); 596 acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
588 status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 597 status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
589 if (ACPI_FAILURE (status)) { 598 if (ACPI_FAILURE (status)) {
590 return_ACPI_STATUS (status); 599 return_ACPI_STATUS (status);
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index 8bfa6effaa0c..76c6ebd0231f 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -487,7 +487,7 @@ acpi_ex_unload_table (
487 * Delete the entire namespace under this table Node 487 * Delete the entire namespace under this table Node
488 * (Offset contains the table_id) 488 * (Offset contains the table_id)
489 */ 489 */
490 acpi_ns_delete_namespace_by_owner (table_info->table_id); 490 acpi_ns_delete_namespace_by_owner (table_info->owner_id);
491 491
492 /* Delete the table itself */ 492 /* Delete the table itself */
493 493
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
index 7007abb6051e..6158f5193f4a 100644
--- a/drivers/acpi/executer/exdump.c
+++ b/drivers/acpi/executer/exdump.c
@@ -819,7 +819,7 @@ acpi_ex_dump_object_descriptor (
819 acpi_ex_out_integer ("param_count", obj_desc->method.param_count); 819 acpi_ex_out_integer ("param_count", obj_desc->method.param_count);
820 acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency); 820 acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency);
821 acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore); 821 acpi_ex_out_pointer ("Semaphore", obj_desc->method.semaphore);
822 acpi_ex_out_integer ("owning_id", obj_desc->method.owning_id); 822 acpi_ex_out_integer ("owner_id", obj_desc->method.owner_id);
823 acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length); 823 acpi_ex_out_integer ("aml_length", obj_desc->method.aml_length);
824 acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start); 824 acpi_ex_out_pointer ("aml_start", obj_desc->method.aml_start);
825 break; 825 break;
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index 131f49acb1df..c1ba8b48228e 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -904,6 +904,7 @@ acpi_ex_opcode_1A_0T_1R (
904 */ 904 */
905 return_desc = acpi_ns_get_attached_object ( 905 return_desc = acpi_ns_get_attached_object (
906 (struct acpi_namespace_node *) operand[0]); 906 (struct acpi_namespace_node *) operand[0]);
907 acpi_ut_add_reference (return_desc);
907 } 908 }
908 else { 909 else {
909 /* 910 /*
@@ -953,20 +954,10 @@ acpi_ex_opcode_1A_0T_1R (
953 * add another reference to the referenced object, however. 954 * add another reference to the referenced object, however.
954 */ 955 */
955 return_desc = *(operand[0]->reference.where); 956 return_desc = *(operand[0]->reference.where);
956 if (!return_desc) { 957 if (return_desc) {
957 /* 958 acpi_ut_add_reference (return_desc);
958 * We can't return a NULL dereferenced value. This is
959 * an uninitialized package element and is thus a
960 * severe error.
961 */
962 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
963 "NULL package element obj %p\n",
964 operand[0]));
965 status = AE_AML_UNINITIALIZED_ELEMENT;
966 goto cleanup;
967 } 959 }
968 960
969 acpi_ut_add_reference (return_desc);
970 break; 961 break;
971 962
972 963
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
index d8b470eefe7a..aaba7abcb52d 100644
--- a/drivers/acpi/executer/exresop.c
+++ b/drivers/acpi/executer/exresop.c
@@ -426,6 +426,10 @@ acpi_ex_resolve_operands (
426 426
427 return_ACPI_STATUS (status); 427 return_ACPI_STATUS (status);
428 } 428 }
429
430 if (obj_desc != *stack_ptr) {
431 acpi_ut_remove_reference (obj_desc);
432 }
429 goto next_operand; 433 goto next_operand;
430 434
431 435
@@ -448,6 +452,10 @@ acpi_ex_resolve_operands (
448 452
449 return_ACPI_STATUS (status); 453 return_ACPI_STATUS (status);
450 } 454 }
455
456 if (obj_desc != *stack_ptr) {
457 acpi_ut_remove_reference (obj_desc);
458 }
451 goto next_operand; 459 goto next_operand;
452 460
453 461
@@ -471,6 +479,10 @@ acpi_ex_resolve_operands (
471 479
472 return_ACPI_STATUS (status); 480 return_ACPI_STATUS (status);
473 } 481 }
482
483 if (obj_desc != *stack_ptr) {
484 acpi_ut_remove_reference (obj_desc);
485 }
474 goto next_operand; 486 goto next_operand;
475 487
476 488
@@ -515,6 +527,10 @@ acpi_ex_resolve_operands (
515 if (ACPI_FAILURE (status)) { 527 if (ACPI_FAILURE (status)) {
516 return_ACPI_STATUS (status); 528 return_ACPI_STATUS (status);
517 } 529 }
530
531 if (obj_desc != *stack_ptr) {
532 acpi_ut_remove_reference (obj_desc);
533 }
518 break; 534 break;
519 535
520 default: 536 default:
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index 9df0a64ba9e9..0bda88d18685 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -163,7 +163,7 @@ acpi_ns_root_initialize (
163 163
164 /* 164 /*
165 * i_aSL Compiler cheats by putting parameter count 165 * i_aSL Compiler cheats by putting parameter count
166 * in the owner_iD 166 * in the owner_iD (param_count max is 7)
167 */ 167 */
168 new_node->owner_id = obj_desc->method.param_count; 168 new_node->owner_id = obj_desc->method.param_count;
169#else 169#else
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c
index 3f94b0806ecf..edbf1db36b68 100644
--- a/drivers/acpi/namespace/nsalloc.c
+++ b/drivers/acpi/namespace/nsalloc.c
@@ -190,7 +190,7 @@ acpi_ns_install_node (
190 struct acpi_namespace_node *node, /* New Child*/ 190 struct acpi_namespace_node *node, /* New Child*/
191 acpi_object_type type) 191 acpi_object_type type)
192{ 192{
193 u16 owner_id = 0; 193 acpi_owner_id owner_id = 0;
194 struct acpi_namespace_node *child_node; 194 struct acpi_namespace_node *child_node;
195#ifdef ACPI_ALPHABETIC_NAMESPACE 195#ifdef ACPI_ALPHABETIC_NAMESPACE
196 196
@@ -559,7 +559,7 @@ acpi_ns_remove_reference (
559 559
560void 560void
561acpi_ns_delete_namespace_by_owner ( 561acpi_ns_delete_namespace_by_owner (
562 u16 owner_id) 562 acpi_owner_id owner_id)
563{ 563{
564 struct acpi_namespace_node *child_node; 564 struct acpi_namespace_node *child_node;
565 struct acpi_namespace_node *deletion_node; 565 struct acpi_namespace_node *deletion_node;
@@ -635,6 +635,7 @@ acpi_ns_delete_namespace_by_owner (
635 } 635 }
636 } 636 }
637 637
638 (void) acpi_ut_release_owner_id (owner_id);
638 return_VOID; 639 return_VOID;
639} 640}
640 641
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
index c9f35dd7a431..d86ccbc8a134 100644
--- a/drivers/acpi/namespace/nsdump.c
+++ b/drivers/acpi/namespace/nsdump.c
@@ -203,7 +203,7 @@ acpi_ns_dump_one_object (
203 203
204 /* Check if the owner matches */ 204 /* Check if the owner matches */
205 205
206 if ((info->owner_id != ACPI_UINT32_MAX) && 206 if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
207 (info->owner_id != this_node->owner_id)) { 207 (info->owner_id != this_node->owner_id)) {
208 return (AE_OK); 208 return (AE_OK);
209 } 209 }
@@ -598,7 +598,7 @@ acpi_ns_dump_objects (
598 acpi_object_type type, 598 acpi_object_type type,
599 u8 display_type, 599 u8 display_type,
600 u32 max_depth, 600 u32 max_depth,
601 u32 owner_id, 601 acpi_owner_id owner_id,
602 acpi_handle start_handle) 602 acpi_handle start_handle)
603{ 603{
604 struct acpi_walk_info info; 604 struct acpi_walk_info info;
@@ -643,7 +643,7 @@ acpi_ns_dump_entry (
643 643
644 644
645 info.debug_level = debug_level; 645 info.debug_level = debug_level;
646 info.owner_id = ACPI_UINT32_MAX; 646 info.owner_id = ACPI_OWNER_ID_MAX;
647 info.display_type = ACPI_DISPLAY_SUMMARY; 647 info.display_type = ACPI_DISPLAY_SUMMARY;
648 648
649 (void) acpi_ns_dump_one_object (handle, 1, &info, NULL); 649 (void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
@@ -694,7 +694,7 @@ acpi_ns_dump_tables (
694 } 694 }
695 695
696 acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth, 696 acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
697 ACPI_UINT32_MAX, search_handle); 697 ACPI_OWNER_ID_MAX, search_handle);
698 return_VOID; 698 return_VOID;
699} 699}
700#endif /* _ACPI_ASL_COMPILER */ 700#endif /* _ACPI_ASL_COMPILER */
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c
index f81b836e77f1..64e0b2b9f55c 100644
--- a/drivers/acpi/namespace/nsparse.c
+++ b/drivers/acpi/namespace/nsparse.c
@@ -87,7 +87,7 @@ acpi_ns_one_complete_parse (
87 87
88 /* Create and initialize a new walk state */ 88 /* Create and initialize a new walk state */
89 89
90 walk_state = acpi_ds_create_walk_state (table_desc->table_id, 90 walk_state = acpi_ds_create_walk_state (table_desc->owner_id,
91 NULL, NULL, NULL); 91 NULL, NULL, NULL);
92 if (!walk_state) { 92 if (!walk_state) {
93 acpi_ps_free_op (parse_root); 93 acpi_ps_free_op (parse_root);
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
index decb2e9a049d..095672a1a722 100644
--- a/drivers/acpi/parser/psloop.c
+++ b/drivers/acpi/parser/psloop.c
@@ -407,9 +407,14 @@ acpi_ps_parse_loop (
407 INCREMENT_ARG_LIST (walk_state->arg_types); 407 INCREMENT_ARG_LIST (walk_state->arg_types);
408 } 408 }
409 409
410
410 /* Special processing for certain opcodes */ 411 /* Special processing for certain opcodes */
411 412
412 if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && 413 /* TBD (remove): Temporary mechanism to disable this code if needed */
414
415#ifndef ACPI_NO_MODULE_LEVEL_CODE
416
417 if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
413 ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { 418 ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
414 /* 419 /*
415 * We want to skip If/Else/While constructs during Pass1 420 * We want to skip If/Else/While constructs during Pass1
@@ -434,7 +439,7 @@ acpi_ps_parse_loop (
434 break; 439 break;
435 } 440 }
436 } 441 }
437 442#endif
438 switch (op->common.aml_opcode) { 443 switch (op->common.aml_opcode) {
439 case AML_METHOD_OP: 444 case AML_METHOD_OP:
440 445
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index dba893648e84..5279b51e7787 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -138,11 +138,14 @@ acpi_psx_execute (
138 * objects (such as Operation Regions) can be created during the 138 * objects (such as Operation Regions) can be created during the
139 * first pass parse. 139 * first pass parse.
140 */ 140 */
141 obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); 141 status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
142 if (ACPI_FAILURE (status)) {
143 goto cleanup2;
144 }
142 145
143 /* Create and initialize a new walk state */ 146 /* Create and initialize a new walk state */
144 147
145 walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, 148 walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
146 NULL, NULL, NULL); 149 NULL, NULL, NULL);
147 if (!walk_state) { 150 if (!walk_state) {
148 status = AE_NO_MEMORY; 151 status = AE_NO_MEMORY;
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 629b64c8193d..2ad72f204551 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -251,6 +251,7 @@ acpi_tb_init_table_descriptor (
251{ 251{
252 struct acpi_table_list *list_head; 252 struct acpi_table_list *list_head;
253 struct acpi_table_desc *table_desc; 253 struct acpi_table_desc *table_desc;
254 acpi_status status;
254 255
255 256
256 ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type); 257 ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type);
@@ -263,6 +264,13 @@ acpi_tb_init_table_descriptor (
263 return_ACPI_STATUS (AE_NO_MEMORY); 264 return_ACPI_STATUS (AE_NO_MEMORY);
264 } 265 }
265 266
267 /* Get a new owner ID for the table */
268
269 status = acpi_ut_allocate_owner_id (&table_desc->owner_id);
270 if (ACPI_FAILURE (status)) {
271 return_ACPI_STATUS (status);
272 }
273
266 /* Install the table into the global data structure */ 274 /* Install the table into the global data structure */
267 275
268 list_head = &acpi_gbl_table_lists[table_type]; 276 list_head = &acpi_gbl_table_lists[table_type];
@@ -325,8 +333,6 @@ acpi_tb_init_table_descriptor (
325 table_desc->aml_start = (u8 *) (table_desc->pointer + 1), 333 table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
326 table_desc->aml_length = (u32) (table_desc->length - 334 table_desc->aml_length = (u32) (table_desc->length -
327 (u32) sizeof (struct acpi_table_header)); 335 (u32) sizeof (struct acpi_table_header));
328 table_desc->table_id = acpi_ut_allocate_owner_id (
329 ACPI_OWNER_TYPE_TABLE);
330 table_desc->loaded_into_namespace = FALSE; 336 table_desc->loaded_into_namespace = FALSE;
331 337
332 /* 338 /*
@@ -339,7 +345,7 @@ acpi_tb_init_table_descriptor (
339 345
340 /* Return Data */ 346 /* Return Data */
341 347
342 table_info->table_id = table_desc->table_id; 348 table_info->owner_id = table_desc->owner_id;
343 table_info->installed_desc = table_desc; 349 table_info->installed_desc = table_desc;
344 350
345 return_ACPI_STATUS (AE_OK); 351 return_ACPI_STATUS (AE_OK);
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
index 13c6ddb2f546..069d498465d0 100644
--- a/drivers/acpi/tables/tbrsdt.c
+++ b/drivers/acpi/tables/tbrsdt.c
@@ -96,32 +96,13 @@ acpi_tb_verify_rsdp (
96 return_ACPI_STATUS (AE_BAD_PARAMETER); 96 return_ACPI_STATUS (AE_BAD_PARAMETER);
97 } 97 }
98 98
99 /* 99 /* Verify RSDP signature and checksum */
100 * The signature and checksum must both be correct
101 */
102 if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
103 /* Nope, BAD Signature */
104
105 status = AE_BAD_SIGNATURE;
106 goto cleanup;
107 }
108
109 /* Check the standard checksum */
110 100
111 if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { 101 status = acpi_tb_validate_rsdp (rsdp);
112 status = AE_BAD_CHECKSUM; 102 if (ACPI_FAILURE (status)) {
113 goto cleanup; 103 goto cleanup;
114 } 104 }
115 105
116 /* Check extended checksum if table version >= 2 */
117
118 if (rsdp->revision >= 2) {
119 if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
120 status = AE_BAD_CHECKSUM;
121 goto cleanup;
122 }
123 }
124
125 /* The RSDP supplied is OK */ 106 /* The RSDP supplied is OK */
126 107
127 table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp); 108 table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp);
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 0c0b9085dbeb..ca2dbdd23ed3 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -260,8 +260,7 @@ acpi_unload_table (
260 * "Scope" operator. Thus, we need to track ownership by an ID, not 260 * "Scope" operator. Thus, we need to track ownership by an ID, not
261 * simply a position within the hierarchy 261 * simply a position within the hierarchy
262 */ 262 */
263 acpi_ns_delete_namespace_by_owner (table_desc->table_id); 263 acpi_ns_delete_namespace_by_owner (table_desc->owner_id);
264
265 table_desc = table_desc->next; 264 table_desc = table_desc->next;
266 } 265 }
267 266
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
index fe9c8317df46..abb4c9346560 100644
--- a/drivers/acpi/tables/tbxfroot.c
+++ b/drivers/acpi/tables/tbxfroot.c
@@ -65,6 +65,51 @@ acpi_tb_scan_memory_for_rsdp (
65 65
66/******************************************************************************* 66/*******************************************************************************
67 * 67 *
68 * FUNCTION: acpi_tb_validate_rsdp
69 *
70 * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
71 *
72 * RETURN: Status
73 *
74 * DESCRIPTION: Validate the RSDP (ptr)
75 *
76 ******************************************************************************/
77
78acpi_status
79acpi_tb_validate_rsdp (
80 struct rsdp_descriptor *rsdp)
81{
82 ACPI_FUNCTION_ENTRY ();
83
84
85 /*
86 * The signature and checksum must both be correct
87 */
88 if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
89 /* Nope, BAD Signature */
90
91 return (AE_BAD_SIGNATURE);
92 }
93
94 /* Check the standard checksum */
95
96 if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
97 return (AE_BAD_CHECKSUM);
98 }
99
100 /* Check extended checksum if table version >= 2 */
101
102 if ((rsdp->revision >= 2) &&
103 (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
104 return (AE_BAD_CHECKSUM);
105 }
106
107 return (AE_OK);
108}
109
110
111/*******************************************************************************
112 *
68 * FUNCTION: acpi_tb_find_table 113 * FUNCTION: acpi_tb_find_table
69 * 114 *
70 * PARAMETERS: Signature - String with ACPI table signature 115 * PARAMETERS: Signature - String with ACPI table signature
@@ -218,19 +263,11 @@ acpi_get_firmware_table (
218 acpi_gbl_RSDP = address.pointer.logical; 263 acpi_gbl_RSDP = address.pointer.logical;
219 } 264 }
220 265
221 /* The signature and checksum must both be correct */ 266 /* The RDSP signature and checksum must both be correct */
222
223 if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
224 sizeof (RSDP_SIG)-1) != 0) {
225 /* Nope, BAD Signature */
226 267
227 return_ACPI_STATUS (AE_BAD_SIGNATURE); 268 status = acpi_tb_validate_rsdp (acpi_gbl_RSDP);
228 } 269 if (ACPI_FAILURE (status)) {
229 270 return_ACPI_STATUS (status);
230 if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
231 /* Nope, BAD Checksum */
232
233 return_ACPI_STATUS (AE_BAD_CHECKSUM);
234 } 271 }
235 } 272 }
236 273
@@ -414,9 +451,9 @@ acpi_tb_scan_memory_for_rsdp (
414 u8 *start_address, 451 u8 *start_address,
415 u32 length) 452 u32 length)
416{ 453{
454 acpi_status status;
417 u8 *mem_rover; 455 u8 *mem_rover;
418 u8 *end_address; 456 u8 *end_address;
419 u8 checksum;
420 457
421 458
422 ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp"); 459 ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp");
@@ -428,45 +465,25 @@ acpi_tb_scan_memory_for_rsdp (
428 465
429 for (mem_rover = start_address; mem_rover < end_address; 466 for (mem_rover = start_address; mem_rover < end_address;
430 mem_rover += ACPI_RSDP_SCAN_STEP) { 467 mem_rover += ACPI_RSDP_SCAN_STEP) {
431 /* The signature and checksum must both be correct */ 468 /* The RSDP signature and checksum must both be correct */
432 469
433 if (ACPI_STRNCMP ((char *) mem_rover, 470 status = acpi_tb_validate_rsdp (ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover));
434 RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) { 471 if (ACPI_SUCCESS (status)) {
435 /* No signature match, keep looking */ 472 /* Sig and checksum valid, we have found a real RSDP */
436
437 continue;
438 }
439
440 /* Signature matches, check the appropriate checksum */
441
442 if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) {
443 /* ACPI version 1.0 */
444
445 checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH);
446 }
447 else {
448 /* Post ACPI 1.0, use extended_checksum */
449
450 checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH);
451 }
452
453 if (checksum == 0) {
454 /* Checksum valid, we have found a valid RSDP */
455 473
456 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 474 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
457 "RSDP located at physical address %p\n", mem_rover)); 475 "RSDP located at physical address %p\n", mem_rover));
458 return_PTR (mem_rover); 476 return_PTR (mem_rover);
459 } 477 }
460 478
461 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 479 /* No sig match or bad checksum, keep searching */
462 "Found an RSDP at physical address %p, but it has a bad checksum\n",
463 mem_rover));
464 } 480 }
465 481
466 /* Searched entire block, no RSDP was found */ 482 /* Searched entire block, no RSDP was found */
467 483
468 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 484 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
469 "Searched entire block, no valid RSDP was found.\n")); 485 "Searched entire block from %p, valid RSDP was not found\n",
486 start_address));
470 return_PTR (NULL); 487 return_PTR (NULL);
471} 488}
472 489
@@ -554,7 +571,7 @@ acpi_tb_find_rsdp (
554 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); 571 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
555 572
556 if (mem_rover) { 573 if (mem_rover) {
557 /* Found it, return the physical address */ 574 /* Return the physical address */
558 575
559 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); 576 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
560 577
@@ -583,7 +600,7 @@ acpi_tb_find_rsdp (
583 acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); 600 acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
584 601
585 if (mem_rover) { 602 if (mem_rover) {
586 /* Found it, return the physical address */ 603 /* Return the physical address */
587 604
588 physical_address = 605 physical_address =
589 ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); 606 ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
@@ -614,7 +631,7 @@ acpi_tb_find_rsdp (
614 ACPI_PHYSADDR_TO_PTR (physical_address), 631 ACPI_PHYSADDR_TO_PTR (physical_address),
615 ACPI_EBDA_WINDOW_SIZE); 632 ACPI_EBDA_WINDOW_SIZE);
616 if (mem_rover) { 633 if (mem_rover) {
617 /* Found it, return the physical address */ 634 /* Return the physical address */
618 635
619 table_info->physical_address = ACPI_TO_INTEGER (mem_rover); 636 table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
620 return_ACPI_STATUS (AE_OK); 637 return_ACPI_STATUS (AE_OK);
@@ -634,8 +651,9 @@ acpi_tb_find_rsdp (
634 } 651 }
635 } 652 }
636 653
637 /* RSDP signature was not found */ 654 /* A valid RSDP was not found */
638 655
656 ACPI_REPORT_ERROR (("No valid RSDP was found\n"));
639 return_ACPI_STATUS (AE_NOT_FOUND); 657 return_ACPI_STATUS (AE_NOT_FOUND);
640} 658}
641 659
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
index 07588812e72d..c0df0585c683 100644
--- a/drivers/acpi/utilities/utcache.c
+++ b/drivers/acpi/utilities/utcache.c
@@ -74,6 +74,9 @@ acpi_os_create_cache (
74 struct acpi_memory_list *cache; 74 struct acpi_memory_list *cache;
75 75
76 76
77 ACPI_FUNCTION_ENTRY ();
78
79
77 if (!cache_name || !return_cache || (object_size < 16)) { 80 if (!cache_name || !return_cache || (object_size < 16)) {
78 return (AE_BAD_PARAMETER); 81 return (AE_BAD_PARAMETER);
79 } 82 }
@@ -161,7 +164,10 @@ acpi_os_delete_cache (
161 acpi_status status; 164 acpi_status status;
162 165
163 166
164 /* Purge all objects in the cache */ 167 ACPI_FUNCTION_ENTRY ();
168
169
170 /* Purge all objects in the cache */
165 171
166 status = acpi_os_purge_cache (cache); 172 status = acpi_os_purge_cache (cache);
167 if (ACPI_FAILURE (status)) { 173 if (ACPI_FAILURE (status)) {
@@ -259,7 +265,7 @@ acpi_os_acquire_object (
259 void *object; 265 void *object;
260 266
261 267
262 ACPI_FUNCTION_NAME ("ut_acquire_from_cache"); 268 ACPI_FUNCTION_NAME ("os_acquire_object");
263 269
264 270
265 if (!cache) { 271 if (!cache) {
@@ -286,7 +292,7 @@ acpi_os_acquire_object (
286 292
287 ACPI_MEM_TRACKING (cache->hits++); 293 ACPI_MEM_TRACKING (cache->hits++);
288 ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 294 ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
289 "Object %p from %s\n", object, cache->list_name))); 295 "Object %p from %s cache\n", object, cache->list_name)));
290 296
291 status = acpi_ut_release_mutex (ACPI_MTX_CACHES); 297 status = acpi_ut_release_mutex (ACPI_MTX_CACHES);
292 if (ACPI_FAILURE (status)) { 298 if (ACPI_FAILURE (status)) {
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 08362f686ec1..3d5fbc810b0b 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -116,10 +116,9 @@ acpi_ut_track_stack_ptr (
116 * 116 *
117 * PARAMETERS: requested_debug_level - Requested debug print level 117 * PARAMETERS: requested_debug_level - Requested debug print level
118 * line_number - Caller's line number (for error output) 118 * line_number - Caller's line number (for error output)
119 * dbg_info - Contains: 119 * function_name - Caller's procedure name
120 * proc_name - Caller's procedure name 120 * module_name - Caller's module name
121 * module_name - Caller's module name 121 * component_id - Caller's component ID
122 * component_id - Caller's component ID
123 * Format - Printf format field 122 * Format - Printf format field
124 * ... - Optional printf arguments 123 * ... - Optional printf arguments
125 * 124 *
@@ -134,7 +133,9 @@ void ACPI_INTERNAL_VAR_XFACE
134acpi_ut_debug_print ( 133acpi_ut_debug_print (
135 u32 requested_debug_level, 134 u32 requested_debug_level,
136 u32 line_number, 135 u32 line_number,
137 struct acpi_debug_print_info *dbg_info, 136 char *function_name,
137 char *module_name,
138 u32 component_id,
138 char *format, 139 char *format,
139 ...) 140 ...)
140{ 141{
@@ -146,7 +147,7 @@ acpi_ut_debug_print (
146 * Stay silent if the debug level or component ID is disabled 147 * Stay silent if the debug level or component ID is disabled
147 */ 148 */
148 if (!(requested_debug_level & acpi_dbg_level) || 149 if (!(requested_debug_level & acpi_dbg_level) ||
149 !(dbg_info->component_id & acpi_dbg_layer)) { 150 !(component_id & acpi_dbg_layer)) {
150 return; 151 return;
151 } 152 }
152 153
@@ -169,14 +170,14 @@ acpi_ut_debug_print (
169 * Display the module name, current line number, thread ID (if requested), 170 * Display the module name, current line number, thread ID (if requested),
170 * current procedure nesting level, and the current procedure name 171 * current procedure nesting level, and the current procedure name
171 */ 172 */
172 acpi_os_printf ("%8s-%04ld ", dbg_info->module_name, line_number); 173 acpi_os_printf ("%8s-%04ld ", module_name, line_number);
173 174
174 if (ACPI_LV_THREADS & acpi_dbg_level) { 175 if (ACPI_LV_THREADS & acpi_dbg_level) {
175 acpi_os_printf ("[%04lX] ", thread_id); 176 acpi_os_printf ("[%04lX] ", thread_id);
176 } 177 }
177 178
178 acpi_os_printf ("[%02ld] %-22.22s: ", 179 acpi_os_printf ("[%02ld] %-22.22s: ",
179 acpi_gbl_nesting_level, dbg_info->proc_name); 180 acpi_gbl_nesting_level, function_name);
180 181
181 va_start (args, format); 182 va_start (args, format);
182 acpi_os_vprintf (format, args); 183 acpi_os_vprintf (format, args);
@@ -190,10 +191,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
190 * 191 *
191 * PARAMETERS: requested_debug_level - Requested debug print level 192 * PARAMETERS: requested_debug_level - Requested debug print level
192 * line_number - Caller's line number 193 * line_number - Caller's line number
193 * dbg_info - Contains: 194 * function_name - Caller's procedure name
194 * proc_name - Caller's procedure name 195 * module_name - Caller's module name
195 * module_name - Caller's module name 196 * component_id - Caller's component ID
196 * component_id - Caller's component ID
197 * Format - Printf format field 197 * Format - Printf format field
198 * ... - Optional printf arguments 198 * ... - Optional printf arguments
199 * 199 *
@@ -208,7 +208,9 @@ void ACPI_INTERNAL_VAR_XFACE
208acpi_ut_debug_print_raw ( 208acpi_ut_debug_print_raw (
209 u32 requested_debug_level, 209 u32 requested_debug_level,
210 u32 line_number, 210 u32 line_number,
211 struct acpi_debug_print_info *dbg_info, 211 char *function_name,
212 char *module_name,
213 u32 component_id,
212 char *format, 214 char *format,
213 ...) 215 ...)
214{ 216{
@@ -216,7 +218,7 @@ acpi_ut_debug_print_raw (
216 218
217 219
218 if (!(requested_debug_level & acpi_dbg_level) || 220 if (!(requested_debug_level & acpi_dbg_level) ||
219 !(dbg_info->component_id & acpi_dbg_layer)) { 221 !(component_id & acpi_dbg_layer)) {
220 return; 222 return;
221 } 223 }
222 224
@@ -231,10 +233,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
231 * FUNCTION: acpi_ut_trace 233 * FUNCTION: acpi_ut_trace
232 * 234 *
233 * PARAMETERS: line_number - Caller's line number 235 * PARAMETERS: line_number - Caller's line number
234 * dbg_info - Contains: 236 * function_name - Caller's procedure name
235 * proc_name - Caller's procedure name 237 * module_name - Caller's module name
236 * module_name - Caller's module name 238 * component_id - Caller's component ID
237 * component_id - Caller's component ID
238 * 239 *
239 * RETURN: None 240 * RETURN: None
240 * 241 *
@@ -246,14 +247,17 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
246void 247void
247acpi_ut_trace ( 248acpi_ut_trace (
248 u32 line_number, 249 u32 line_number,
249 struct acpi_debug_print_info *dbg_info) 250 char *function_name,
251 char *module_name,
252 u32 component_id)
250{ 253{
251 254
252 acpi_gbl_nesting_level++; 255 acpi_gbl_nesting_level++;
253 acpi_ut_track_stack_ptr (); 256 acpi_ut_track_stack_ptr ();
254 257
255 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 258 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
256 "%s\n", acpi_gbl_fn_entry_str); 259 line_number, function_name, module_name, component_id,
260 "%s\n", acpi_gbl_fn_entry_str);
257} 261}
258EXPORT_SYMBOL(acpi_ut_trace); 262EXPORT_SYMBOL(acpi_ut_trace);
259 263
@@ -263,10 +267,9 @@ EXPORT_SYMBOL(acpi_ut_trace);
263 * FUNCTION: acpi_ut_trace_ptr 267 * FUNCTION: acpi_ut_trace_ptr
264 * 268 *
265 * PARAMETERS: line_number - Caller's line number 269 * PARAMETERS: line_number - Caller's line number
266 * dbg_info - Contains: 270 * function_name - Caller's procedure name
267 * proc_name - Caller's procedure name 271 * module_name - Caller's module name
268 * module_name - Caller's module name 272 * component_id - Caller's component ID
269 * component_id - Caller's component ID
270 * Pointer - Pointer to display 273 * Pointer - Pointer to display
271 * 274 *
272 * RETURN: None 275 * RETURN: None
@@ -279,14 +282,17 @@ EXPORT_SYMBOL(acpi_ut_trace);
279void 282void
280acpi_ut_trace_ptr ( 283acpi_ut_trace_ptr (
281 u32 line_number, 284 u32 line_number,
282 struct acpi_debug_print_info *dbg_info, 285 char *function_name,
286 char *module_name,
287 u32 component_id,
283 void *pointer) 288 void *pointer)
284{ 289{
285 acpi_gbl_nesting_level++; 290 acpi_gbl_nesting_level++;
286 acpi_ut_track_stack_ptr (); 291 acpi_ut_track_stack_ptr ();
287 292
288 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 293 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
289 "%s %p\n", acpi_gbl_fn_entry_str, pointer); 294 line_number, function_name, module_name, component_id,
295 "%s %p\n", acpi_gbl_fn_entry_str, pointer);
290} 296}
291 297
292 298
@@ -295,10 +301,9 @@ acpi_ut_trace_ptr (
295 * FUNCTION: acpi_ut_trace_str 301 * FUNCTION: acpi_ut_trace_str
296 * 302 *
297 * PARAMETERS: line_number - Caller's line number 303 * PARAMETERS: line_number - Caller's line number
298 * dbg_info - Contains: 304 * function_name - Caller's procedure name
299 * proc_name - Caller's procedure name 305 * module_name - Caller's module name
300 * module_name - Caller's module name 306 * component_id - Caller's component ID
301 * component_id - Caller's component ID
302 * String - Additional string to display 307 * String - Additional string to display
303 * 308 *
304 * RETURN: None 309 * RETURN: None
@@ -311,15 +316,18 @@ acpi_ut_trace_ptr (
311void 316void
312acpi_ut_trace_str ( 317acpi_ut_trace_str (
313 u32 line_number, 318 u32 line_number,
314 struct acpi_debug_print_info *dbg_info, 319 char *function_name,
320 char *module_name,
321 u32 component_id,
315 char *string) 322 char *string)
316{ 323{
317 324
318 acpi_gbl_nesting_level++; 325 acpi_gbl_nesting_level++;
319 acpi_ut_track_stack_ptr (); 326 acpi_ut_track_stack_ptr ();
320 327
321 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 328 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
322 "%s %s\n", acpi_gbl_fn_entry_str, string); 329 line_number, function_name, module_name, component_id,
330 "%s %s\n", acpi_gbl_fn_entry_str, string);
323} 331}
324 332
325 333
@@ -328,10 +336,9 @@ acpi_ut_trace_str (
328 * FUNCTION: acpi_ut_trace_u32 336 * FUNCTION: acpi_ut_trace_u32
329 * 337 *
330 * PARAMETERS: line_number - Caller's line number 338 * PARAMETERS: line_number - Caller's line number
331 * dbg_info - Contains: 339 * function_name - Caller's procedure name
332 * proc_name - Caller's procedure name 340 * module_name - Caller's module name
333 * module_name - Caller's module name 341 * component_id - Caller's component ID
334 * component_id - Caller's component ID
335 * Integer - Integer to display 342 * Integer - Integer to display
336 * 343 *
337 * RETURN: None 344 * RETURN: None
@@ -344,15 +351,18 @@ acpi_ut_trace_str (
344void 351void
345acpi_ut_trace_u32 ( 352acpi_ut_trace_u32 (
346 u32 line_number, 353 u32 line_number,
347 struct acpi_debug_print_info *dbg_info, 354 char *function_name,
355 char *module_name,
356 u32 component_id,
348 u32 integer) 357 u32 integer)
349{ 358{
350 359
351 acpi_gbl_nesting_level++; 360 acpi_gbl_nesting_level++;
352 acpi_ut_track_stack_ptr (); 361 acpi_ut_track_stack_ptr ();
353 362
354 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 363 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
355 "%s %08X\n", acpi_gbl_fn_entry_str, integer); 364 line_number, function_name, module_name, component_id,
365 "%s %08X\n", acpi_gbl_fn_entry_str, integer);
356} 366}
357 367
358 368
@@ -361,10 +371,9 @@ acpi_ut_trace_u32 (
361 * FUNCTION: acpi_ut_exit 371 * FUNCTION: acpi_ut_exit
362 * 372 *
363 * PARAMETERS: line_number - Caller's line number 373 * PARAMETERS: line_number - Caller's line number
364 * dbg_info - Contains: 374 * function_name - Caller's procedure name
365 * proc_name - Caller's procedure name 375 * module_name - Caller's module name
366 * module_name - Caller's module name 376 * component_id - Caller's component ID
367 * component_id - Caller's component ID
368 * 377 *
369 * RETURN: None 378 * RETURN: None
370 * 379 *
@@ -376,11 +385,14 @@ acpi_ut_trace_u32 (
376void 385void
377acpi_ut_exit ( 386acpi_ut_exit (
378 u32 line_number, 387 u32 line_number,
379 struct acpi_debug_print_info *dbg_info) 388 char *function_name,
389 char *module_name,
390 u32 component_id)
380{ 391{
381 392
382 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 393 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
383 "%s\n", acpi_gbl_fn_exit_str); 394 line_number, function_name, module_name, component_id,
395 "%s\n", acpi_gbl_fn_exit_str);
384 396
385 acpi_gbl_nesting_level--; 397 acpi_gbl_nesting_level--;
386} 398}
@@ -392,10 +404,9 @@ EXPORT_SYMBOL(acpi_ut_exit);
392 * FUNCTION: acpi_ut_status_exit 404 * FUNCTION: acpi_ut_status_exit
393 * 405 *
394 * PARAMETERS: line_number - Caller's line number 406 * PARAMETERS: line_number - Caller's line number
395 * dbg_info - Contains: 407 * function_name - Caller's procedure name
396 * proc_name - Caller's procedure name 408 * module_name - Caller's module name
397 * module_name - Caller's module name 409 * component_id - Caller's component ID
398 * component_id - Caller's component ID
399 * Status - Exit status code 410 * Status - Exit status code
400 * 411 *
401 * RETURN: None 412 * RETURN: None
@@ -408,19 +419,23 @@ EXPORT_SYMBOL(acpi_ut_exit);
408void 419void
409acpi_ut_status_exit ( 420acpi_ut_status_exit (
410 u32 line_number, 421 u32 line_number,
411 struct acpi_debug_print_info *dbg_info, 422 char *function_name,
423 char *module_name,
424 u32 component_id,
412 acpi_status status) 425 acpi_status status)
413{ 426{
414 427
415 if (ACPI_SUCCESS (status)) { 428 if (ACPI_SUCCESS (status)) {
416 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 429 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
417 "%s %s\n", acpi_gbl_fn_exit_str, 430 line_number, function_name, module_name, component_id,
418 acpi_format_exception (status)); 431 "%s %s\n", acpi_gbl_fn_exit_str,
432 acpi_format_exception (status));
419 } 433 }
420 else { 434 else {
421 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 435 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
422 "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str, 436 line_number, function_name, module_name, component_id,
423 acpi_format_exception (status)); 437 "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str,
438 acpi_format_exception (status));
424 } 439 }
425 440
426 acpi_gbl_nesting_level--; 441 acpi_gbl_nesting_level--;
@@ -433,10 +448,9 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
433 * FUNCTION: acpi_ut_value_exit 448 * FUNCTION: acpi_ut_value_exit
434 * 449 *
435 * PARAMETERS: line_number - Caller's line number 450 * PARAMETERS: line_number - Caller's line number
436 * dbg_info - Contains: 451 * function_name - Caller's procedure name
437 * proc_name - Caller's procedure name 452 * module_name - Caller's module name
438 * module_name - Caller's module name 453 * component_id - Caller's component ID
439 * component_id - Caller's component ID
440 * Value - Value to be printed with exit msg 454 * Value - Value to be printed with exit msg
441 * 455 *
442 * RETURN: None 456 * RETURN: None
@@ -449,13 +463,16 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
449void 463void
450acpi_ut_value_exit ( 464acpi_ut_value_exit (
451 u32 line_number, 465 u32 line_number,
452 struct acpi_debug_print_info *dbg_info, 466 char *function_name,
467 char *module_name,
468 u32 component_id,
453 acpi_integer value) 469 acpi_integer value)
454{ 470{
455 471
456 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 472 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
457 "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, 473 line_number, function_name, module_name, component_id,
458 ACPI_FORMAT_UINT64 (value)); 474 "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
475 ACPI_FORMAT_UINT64 (value));
459 476
460 acpi_gbl_nesting_level--; 477 acpi_gbl_nesting_level--;
461} 478}
@@ -467,10 +484,9 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
467 * FUNCTION: acpi_ut_ptr_exit 484 * FUNCTION: acpi_ut_ptr_exit
468 * 485 *
469 * PARAMETERS: line_number - Caller's line number 486 * PARAMETERS: line_number - Caller's line number
470 * dbg_info - Contains: 487 * function_name - Caller's procedure name
471 * proc_name - Caller's procedure name 488 * module_name - Caller's module name
472 * module_name - Caller's module name 489 * component_id - Caller's component ID
473 * component_id - Caller's component ID
474 * Ptr - Pointer to display 490 * Ptr - Pointer to display
475 * 491 *
476 * RETURN: None 492 * RETURN: None
@@ -483,12 +499,15 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
483void 499void
484acpi_ut_ptr_exit ( 500acpi_ut_ptr_exit (
485 u32 line_number, 501 u32 line_number,
486 struct acpi_debug_print_info *dbg_info, 502 char *function_name,
503 char *module_name,
504 u32 component_id,
487 u8 *ptr) 505 u8 *ptr)
488{ 506{
489 507
490 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 508 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
491 "%s %p\n", acpi_gbl_fn_exit_str, ptr); 509 line_number, function_name, module_name, component_id,
510 "%s %p\n", acpi_gbl_fn_exit_str, ptr);
492 511
493 acpi_gbl_nesting_level--; 512 acpi_gbl_nesting_level--;
494} 513}
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index be97ada23c3d..eeafb324c504 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -435,35 +435,24 @@ acpi_ut_update_object_reference (
435 union acpi_operand_object *object, 435 union acpi_operand_object *object,
436 u16 action) 436 u16 action)
437{ 437{
438 acpi_status status; 438 acpi_status status = AE_OK;
439 u32 i; 439 union acpi_generic_state *state_list = NULL;
440 union acpi_generic_state *state_list = NULL; 440 union acpi_operand_object *next_object = NULL;
441 union acpi_generic_state *state; 441 union acpi_generic_state *state;
442 acpi_native_uint i;
442 443
443 444
444 ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object); 445 ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object);
445 446
446 447
447 /* Ignore a null object ptr */ 448 while (object) {
449 /* Make sure that this isn't a namespace handle */
448 450
449 if (!object) { 451 if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
450 return_ACPI_STATUS (AE_OK); 452 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
451 } 453 "Object %p is NS handle\n", object));
452 454 return_ACPI_STATUS (AE_OK);
453 /* Make sure that this isn't a namespace handle */ 455 }
454
455 if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
456 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
457 "Object %p is NS handle\n", object));
458 return_ACPI_STATUS (AE_OK);
459 }
460
461 state = acpi_ut_create_update_state (object, action);
462
463 while (state) {
464 object = state->update.object;
465 action = state->update.value;
466 acpi_ut_delete_generic_state (state);
467 456
468 /* 457 /*
469 * All sub-objects must have their reference count incremented also. 458 * All sub-objects must have their reference count incremented also.
@@ -476,12 +465,10 @@ acpi_ut_update_object_reference (
476 acpi_ut_update_ref_count (object->device.device_notify, action); 465 acpi_ut_update_ref_count (object->device.device_notify, action);
477 break; 466 break;
478 467
479
480 case ACPI_TYPE_PACKAGE: 468 case ACPI_TYPE_PACKAGE:
481
482 /* 469 /*
483 * We must update all the sub-objects of the package 470 * We must update all the sub-objects of the package,
484 * (Each of whom may have their own sub-objects, etc. 471 * each of whom may have their own sub-objects.
485 */ 472 */
486 for (i = 0; i < object->package.count; i++) { 473 for (i = 0; i < object->package.count; i++) {
487 /* 474 /*
@@ -497,35 +484,19 @@ acpi_ut_update_object_reference (
497 } 484 }
498 break; 485 break;
499 486
500
501 case ACPI_TYPE_BUFFER_FIELD: 487 case ACPI_TYPE_BUFFER_FIELD:
502 488
503 status = acpi_ut_create_update_state_and_push ( 489 next_object = object->buffer_field.buffer_obj;
504 object->buffer_field.buffer_obj, action, &state_list);
505 if (ACPI_FAILURE (status)) {
506 goto error_exit;
507 }
508 break; 490 break;
509 491
510
511 case ACPI_TYPE_LOCAL_REGION_FIELD: 492 case ACPI_TYPE_LOCAL_REGION_FIELD:
512 493
513 status = acpi_ut_create_update_state_and_push ( 494 next_object = object->field.region_obj;
514 object->field.region_obj, action, &state_list); 495 break;
515 if (ACPI_FAILURE (status)) {
516 goto error_exit;
517 }
518 break;
519
520 496
521 case ACPI_TYPE_LOCAL_BANK_FIELD: 497 case ACPI_TYPE_LOCAL_BANK_FIELD:
522 498
523 status = acpi_ut_create_update_state_and_push ( 499 next_object = object->bank_field.bank_obj;
524 object->bank_field.bank_obj, action, &state_list);
525 if (ACPI_FAILURE (status)) {
526 goto error_exit;
527 }
528
529 status = acpi_ut_create_update_state_and_push ( 500 status = acpi_ut_create_update_state_and_push (
530 object->bank_field.region_obj, action, &state_list); 501 object->bank_field.region_obj, action, &state_list);
531 if (ACPI_FAILURE (status)) { 502 if (ACPI_FAILURE (status)) {
@@ -533,15 +504,9 @@ acpi_ut_update_object_reference (
533 } 504 }
534 break; 505 break;
535 506
536
537 case ACPI_TYPE_LOCAL_INDEX_FIELD: 507 case ACPI_TYPE_LOCAL_INDEX_FIELD:
538 508
539 status = acpi_ut_create_update_state_and_push ( 509 next_object = object->index_field.index_obj;
540 object->index_field.index_obj, action, &state_list);
541 if (ACPI_FAILURE (status)) {
542 goto error_exit;
543 }
544
545 status = acpi_ut_create_update_state_and_push ( 510 status = acpi_ut_create_update_state_and_push (
546 object->index_field.data_obj, action, &state_list); 511 object->index_field.data_obj, action, &state_list);
547 if (ACPI_FAILURE (status)) { 512 if (ACPI_FAILURE (status)) {
@@ -549,28 +514,19 @@ acpi_ut_update_object_reference (
549 } 514 }
550 break; 515 break;
551 516
552
553 case ACPI_TYPE_LOCAL_REFERENCE: 517 case ACPI_TYPE_LOCAL_REFERENCE:
554
555 /* 518 /*
556 * The target of an Index (a package, string, or buffer) must track 519 * The target of an Index (a package, string, or buffer) must track
557 * changes to the ref count of the index. 520 * changes to the ref count of the index.
558 */ 521 */
559 if (object->reference.opcode == AML_INDEX_OP) { 522 if (object->reference.opcode == AML_INDEX_OP) {
560 status = acpi_ut_create_update_state_and_push ( 523 next_object = object->reference.object;
561 object->reference.object, action, &state_list);
562 if (ACPI_FAILURE (status)) {
563 goto error_exit;
564 }
565 } 524 }
566 break; 525 break;
567 526
568
569 case ACPI_TYPE_REGION: 527 case ACPI_TYPE_REGION:
570 default: 528 default:
571 529 break;/* No subobjects */
572 /* No subobjects */
573 break;
574 } 530 }
575 531
576 /* 532 /*
@@ -579,15 +535,23 @@ acpi_ut_update_object_reference (
579 * main object to be deleted. 535 * main object to be deleted.
580 */ 536 */
581 acpi_ut_update_ref_count (object, action); 537 acpi_ut_update_ref_count (object, action);
538 object = NULL;
582 539
583 /* Move on to the next object to be updated */ 540 /* Move on to the next object to be updated */
584 541
585 state = acpi_ut_pop_generic_state (&state_list); 542 if (next_object) {
543 object = next_object;
544 next_object = NULL;
545 }
546 else if (state_list) {
547 state = acpi_ut_pop_generic_state (&state_list);
548 object = state->update.object;
549 acpi_ut_delete_generic_state (state);
550 }
586 } 551 }
587 552
588 return_ACPI_STATUS (AE_OK); 553 return_ACPI_STATUS (AE_OK);
589 554
590
591error_exit: 555error_exit:
592 556
593 ACPI_REPORT_ERROR (("Could not update object reference count, %s\n", 557 ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 8653dda4f813..0e4161c81076 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -738,73 +738,6 @@ acpi_ut_valid_object_type (
738 738
739/******************************************************************************* 739/*******************************************************************************
740 * 740 *
741 * FUNCTION: acpi_ut_allocate_owner_id
742 *
743 * PARAMETERS: id_type - Type of ID (method or table)
744 *
745 * DESCRIPTION: Allocate a table or method owner id
746 *
747 * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and
748 * should be revisited (TBD)
749 *
750 ******************************************************************************/
751
752acpi_owner_id
753acpi_ut_allocate_owner_id (
754 u32 id_type)
755{
756 acpi_owner_id owner_id = 0xFFFF;
757
758
759 ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
760
761
762 if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES)))
763 {
764 return (0);
765 }
766
767 switch (id_type)
768 {
769 case ACPI_OWNER_TYPE_TABLE:
770
771 owner_id = acpi_gbl_next_table_owner_id;
772 acpi_gbl_next_table_owner_id++;
773
774 /* Check for wraparound */
775
776 if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID)
777 {
778 acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID;
779 ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
780 }
781 break;
782
783
784 case ACPI_OWNER_TYPE_METHOD:
785
786 owner_id = acpi_gbl_next_method_owner_id;
787 acpi_gbl_next_method_owner_id++;
788
789 if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID)
790 {
791 /* Check for wraparound */
792
793 acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
794 }
795 break;
796
797 default:
798 break;
799 }
800
801 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
802 return_VALUE (owner_id);
803}
804
805
806/*******************************************************************************
807 *
808 * FUNCTION: acpi_ut_init_globals 741 * FUNCTION: acpi_ut_init_globals
809 * 742 *
810 * PARAMETERS: None 743 * PARAMETERS: None
@@ -848,7 +781,7 @@ acpi_ut_init_globals (
848 for (i = 0; i < NUM_MUTEX; i++) 781 for (i = 0; i < NUM_MUTEX; i++)
849 { 782 {
850 acpi_gbl_mutex_info[i].mutex = NULL; 783 acpi_gbl_mutex_info[i].mutex = NULL;
851 acpi_gbl_mutex_info[i].owner_id = ACPI_MUTEX_NOT_ACQUIRED; 784 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
852 acpi_gbl_mutex_info[i].use_count = 0; 785 acpi_gbl_mutex_info[i].use_count = 0;
853 } 786 }
854 787
@@ -889,8 +822,7 @@ acpi_ut_init_globals (
889 acpi_gbl_ns_lookup_count = 0; 822 acpi_gbl_ns_lookup_count = 0;
890 acpi_gbl_ps_find_count = 0; 823 acpi_gbl_ps_find_count = 0;
891 acpi_gbl_acpi_hardware_present = TRUE; 824 acpi_gbl_acpi_hardware_present = TRUE;
892 acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID; 825 acpi_gbl_owner_id_mask = 0;
893 acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
894 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 826 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
895 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; 827 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
896 828
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 207c836aec64..df715cd89105 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -52,6 +52,100 @@
52 52
53/******************************************************************************* 53/*******************************************************************************
54 * 54 *
55 * FUNCTION: acpi_ut_allocate_owner_id
56 *
57 * PARAMETERS: owner_id - Where the new owner ID is returned
58 *
59 * DESCRIPTION: Allocate a table or method owner id
60 *
61 ******************************************************************************/
62
63acpi_status
64acpi_ut_allocate_owner_id (
65 acpi_owner_id *owner_id)
66{
67 acpi_native_uint i;
68 acpi_status status;
69
70
71 ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
72
73
74 status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
75 if (ACPI_FAILURE (status)) {
76 return_ACPI_STATUS (status);
77 }
78
79 /* Find a free owner ID */
80
81 for (i = 0; i < 32; i++) {
82 if (!(acpi_gbl_owner_id_mask & (1 << i))) {
83 acpi_gbl_owner_id_mask |= (1 << i);
84 *owner_id = (acpi_owner_id) i;
85 goto exit;
86 }
87 }
88
89 /*
90 * If we are here, all owner_ids have been allocated. This probably should
91 * not happen since the IDs are reused after deallocation. The IDs are
92 * allocated upon table load (one per table) and method execution, and
93 * they are released when a table is unloaded or a method completes
94 * execution.
95 */
96 status = AE_OWNER_ID_LIMIT;
97 ACPI_REPORT_ERROR ((
98 "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n"));
99
100exit:
101 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
102 return_ACPI_STATUS (status);
103}
104
105
106/*******************************************************************************
107 *
108 * FUNCTION: acpi_ut_release_owner_id
109 *
110 * PARAMETERS: owner_id - A previously allocated owner ID
111 *
112 * DESCRIPTION: Release a table or method owner id
113 *
114 ******************************************************************************/
115
116acpi_status
117acpi_ut_release_owner_id (
118 acpi_owner_id owner_id)
119{
120 acpi_status status;
121
122
123 ACPI_FUNCTION_TRACE ("ut_release_owner_id");
124
125
126 status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
127 if (ACPI_FAILURE (status)) {
128 return_ACPI_STATUS (status);
129 }
130
131 /* Free the owner ID */
132
133 if (acpi_gbl_owner_id_mask & (1 << owner_id)) {
134 acpi_gbl_owner_id_mask ^= (1 << owner_id);
135 }
136 else {
137 /* This owner_id has not been allocated */
138
139 status = AE_NOT_EXIST;
140 }
141
142 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
143 return_ACPI_STATUS (status);
144}
145
146
147/*******************************************************************************
148 *
55 * FUNCTION: acpi_ut_strupr (strupr) 149 * FUNCTION: acpi_ut_strupr (strupr)
56 * 150 *
57 * PARAMETERS: src_string - The source string to convert 151 * PARAMETERS: src_string - The source string to convert
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index a80b97cb2e56..0699b6be62b6 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -159,7 +159,7 @@ acpi_ut_create_mutex (
159 if (!acpi_gbl_mutex_info[mutex_id].mutex) { 159 if (!acpi_gbl_mutex_info[mutex_id].mutex) {
160 status = acpi_os_create_semaphore (1, 1, 160 status = acpi_os_create_semaphore (1, 1,
161 &acpi_gbl_mutex_info[mutex_id].mutex); 161 &acpi_gbl_mutex_info[mutex_id].mutex);
162 acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; 162 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
163 acpi_gbl_mutex_info[mutex_id].use_count = 0; 163 acpi_gbl_mutex_info[mutex_id].use_count = 0;
164 } 164 }
165 165
@@ -196,7 +196,7 @@ acpi_ut_delete_mutex (
196 status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex); 196 status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex);
197 197
198 acpi_gbl_mutex_info[mutex_id].mutex = NULL; 198 acpi_gbl_mutex_info[mutex_id].mutex = NULL;
199 acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; 199 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
200 200
201 return_ACPI_STATUS (status); 201 return_ACPI_STATUS (status);
202} 202}
@@ -274,7 +274,7 @@ acpi_ut_acquire_mutex (
274 this_thread_id, acpi_ut_get_mutex_name (mutex_id))); 274 this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
275 275
276 acpi_gbl_mutex_info[mutex_id].use_count++; 276 acpi_gbl_mutex_info[mutex_id].use_count++;
277 acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; 277 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
278 } 278 }
279 else { 279 else {
280 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 280 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@@ -322,7 +322,7 @@ acpi_ut_release_mutex (
322 /* 322 /*
323 * Mutex must be acquired in order to release it! 323 * Mutex must be acquired in order to release it!
324 */ 324 */
325 if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { 325 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
326 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 326 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
327 "Mutex [%s] is not acquired, cannot release\n", 327 "Mutex [%s] is not acquired, cannot release\n",
328 acpi_ut_get_mutex_name (mutex_id))); 328 acpi_ut_get_mutex_name (mutex_id)));
@@ -359,7 +359,7 @@ acpi_ut_release_mutex (
359 359
360 /* Mark unlocked FIRST */ 360 /* Mark unlocked FIRST */
361 361
362 acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; 362 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
363 363
364 status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); 364 status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1);
365 365