aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/Makefile5
-rw-r--r--drivers/acpi/utilities/utalloc.c61
-rw-r--r--drivers/acpi/utilities/utcache.c2
-rw-r--r--drivers/acpi/utilities/utcopy.c27
-rw-r--r--drivers/acpi/utilities/utdebug.c2
-rw-r--r--drivers/acpi/utilities/utdelete.c15
-rw-r--r--drivers/acpi/utilities/uteval.c46
-rw-r--r--drivers/acpi/utilities/utglobal.c108
-rw-r--r--drivers/acpi/utilities/utinit.c13
-rw-r--r--drivers/acpi/utilities/utmath.c10
-rw-r--r--drivers/acpi/utilities/utmisc.c209
-rw-r--r--drivers/acpi/utilities/utmutex.c58
-rw-r--r--drivers/acpi/utilities/utobject.c33
-rw-r--r--drivers/acpi/utilities/utresrc.c554
-rw-r--r--drivers/acpi/utilities/utstate.c4
-rw-r--r--drivers/acpi/utilities/utxface.c69
16 files changed, 918 insertions, 298 deletions
diff --git a/drivers/acpi/utilities/Makefile b/drivers/acpi/utilities/Makefile
index e87108b7338a..88eff14c4894 100644
--- a/drivers/acpi/utilities/Makefile
+++ b/drivers/acpi/utilities/Makefile
@@ -2,7 +2,8 @@
2# Makefile for all Linux ACPI interpreter subdirectories 2# Makefile for all Linux ACPI interpreter subdirectories
3# 3#
4 4
5obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ 5obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
6 utcopy.o utdelete.o utglobal.o utmath.o utobject.o utstate.o utmutex.o utobject.o utcache.o 6 utcopy.o utdelete.o utglobal.o utmath.o utobject.o \
7 utstate.o utmutex.o utobject.o utcache.o utresrc.o
7 8
8EXTRA_CFLAGS += $(ACPI_CFLAGS) 9EXTRA_CFLAGS += $(ACPI_CFLAGS)
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 068450b36475..03b0044974c2 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
47ACPI_MODULE_NAME("utalloc") 47ACPI_MODULE_NAME("utalloc")
48 48
49/* Local prototypes */ 49/* Local prototypes */
50#ifdef ACPI_DBG_TRACK_ALLOCATIONS 50#ifdef ACPI_DBG_TRACK_ALLOCATIONS
51static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); 51static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
52 52
53static acpi_status 53static acpi_status
@@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
58static acpi_status 58static acpi_status
59acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, 59acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
60 u32 component, char *module, u32 line); 60 u32 component, char *module, u32 line);
61#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
62 61
63#ifdef ACPI_DBG_TRACK_ALLOCATIONS
64static acpi_status 62static acpi_status
65acpi_ut_create_list(char *list_name, 63acpi_ut_create_list(char *list_name,
66 u16 object_size, struct acpi_memory_list **return_cache); 64 u16 object_size, struct acpi_memory_list **return_cache);
@@ -303,8 +301,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
303 /* Check for an inadvertent size of zero bytes */ 301 /* Check for an inadvertent size of zero bytes */
304 302
305 if (!size) { 303 if (!size) {
306 _ACPI_REPORT_ERROR(module, line, component, 304 ACPI_ERROR((module, line,
307 ("ut_allocate: Attempt to allocate zero bytes\n")); 305 "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte"));
308 size = 1; 306 size = 1;
309 } 307 }
310 308
@@ -312,9 +310,9 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
312 if (!allocation) { 310 if (!allocation) {
313 /* Report allocation error */ 311 /* Report allocation error */
314 312
315 _ACPI_REPORT_ERROR(module, line, component, 313 ACPI_ERROR((module, line,
316 ("ut_allocate: Could not allocate size %X\n", 314 "ut_allocate: Could not allocate size %X",
317 (u32) size)); 315 (u32) size));
318 316
319 return_PTR(NULL); 317 return_PTR(NULL);
320 } 318 }
@@ -346,18 +344,17 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
346 /* Check for an inadvertent size of zero bytes */ 344 /* Check for an inadvertent size of zero bytes */
347 345
348 if (!size) { 346 if (!size) {
349 _ACPI_REPORT_ERROR(module, line, component, 347 ACPI_ERROR((module, line,
350 ("ut_callocate: Attempt to allocate zero bytes\n")); 348 "Attempt to allocate zero bytes, allocating 1 byte"));
351 return_PTR(NULL); 349 size = 1;
352 } 350 }
353 351
354 allocation = acpi_os_allocate(size); 352 allocation = acpi_os_allocate(size);
355 if (!allocation) { 353 if (!allocation) {
356 /* Report allocation error */ 354 /* Report allocation error */
357 355
358 _ACPI_REPORT_ERROR(module, line, component, 356 ACPI_ERROR((module, line,
359 ("ut_callocate: Could not allocate size %X\n", 357 "Could not allocate size %X", (u32) size));
360 (u32) size));
361 return_PTR(NULL); 358 return_PTR(NULL);
362 } 359 }
363 360
@@ -482,9 +479,8 @@ void *acpi_ut_callocate_and_track(acpi_size size,
482 if (!allocation) { 479 if (!allocation) {
483 /* Report allocation error */ 480 /* Report allocation error */
484 481
485 _ACPI_REPORT_ERROR(module, line, component, 482 ACPI_ERROR((module, line,
486 ("ut_callocate: Could not allocate size %X\n", 483 "Could not allocate size %X", (u32) size));
487 (u32) size));
488 return (NULL); 484 return (NULL);
489 } 485 }
490 486
@@ -526,8 +522,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
526 ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); 522 ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
527 523
528 if (NULL == allocation) { 524 if (NULL == allocation) {
529 _ACPI_REPORT_ERROR(module, line, component, 525 ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
530 ("acpi_ut_free: Attempt to delete a NULL address\n"));
531 526
532 return_VOID; 527 return_VOID;
533 } 528 }
@@ -542,14 +537,11 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
542 status = acpi_ut_remove_allocation(debug_block, 537 status = acpi_ut_remove_allocation(debug_block,
543 component, module, line); 538 component, module, line);
544 if (ACPI_FAILURE(status)) { 539 if (ACPI_FAILURE(status)) {
545 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n", 540 ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
546 acpi_format_exception(status)));
547 } 541 }
548 542
549 acpi_os_free(debug_block); 543 acpi_os_free(debug_block);
550
551 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); 544 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
552
553 return_VOID; 545 return_VOID;
554} 546}
555 547
@@ -626,10 +618,12 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
626 */ 618 */
627 element = acpi_ut_find_allocation(allocation); 619 element = acpi_ut_find_allocation(allocation);
628 if (element) { 620 if (element) {
629 ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation)); 621 ACPI_ERROR((AE_INFO,
622 "ut_track_allocation: Allocation already present in list! (%p)",
623 allocation));
630 624
631 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n", 625 ACPI_ERROR((AE_INFO, "Element %p Address %p",
632 element, allocation)); 626 element, allocation));
633 627
634 goto unlock_and_exit; 628 goto unlock_and_exit;
635 } 629 }
@@ -689,8 +683,8 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
689 if (NULL == mem_list->list_head) { 683 if (NULL == mem_list->list_head) {
690 /* No allocations! */ 684 /* No allocations! */
691 685
692 _ACPI_REPORT_ERROR(module, line, component, 686 ACPI_ERROR((module, line,
693 ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); 687 "Empty allocation list, nothing to free!"));
694 688
695 return_ACPI_STATUS(AE_OK); 689 return_ACPI_STATUS(AE_OK);
696 } 690 }
@@ -865,12 +859,11 @@ void acpi_ut_dump_allocations(u32 component, char *module)
865 /* Print summary */ 859 /* Print summary */
866 860
867 if (!num_outstanding) { 861 if (!num_outstanding) {
868 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 862 ACPI_INFO((AE_INFO, "No outstanding allocations"));
869 "No outstanding allocations.\n"));
870 } else { 863 } else {
871 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 864 ACPI_ERROR((AE_INFO,
872 "%d(%X) Outstanding allocations\n", 865 "%d(%X) Outstanding allocations",
873 num_outstanding, num_outstanding)); 866 num_outstanding, num_outstanding));
874 } 867 }
875 868
876 return_VOID; 869 return_VOID;
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
index 93d48681d276..2177cb1ef2c4 100644
--- a/drivers/acpi/utilities/utcache.c
+++ b/drivers/acpi/utilities/utcache.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 5442b32de611..df2d32096b72 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -398,14 +398,17 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
398 * Build a simple object (no nested objects) 398 * Build a simple object (no nested objects)
399 */ 399 */
400 status = acpi_ut_copy_isimple_to_esimple(internal_object, 400 status = acpi_ut_copy_isimple_to_esimple(internal_object,
401 (union acpi_object *) 401 ACPI_CAST_PTR(union
402 ret_buffer->pointer, 402 acpi_object,
403 ((u8 *) ret_buffer-> 403 ret_buffer->
404 pointer + 404 pointer),
405 ACPI_ROUND_UP_TO_NATIVE_WORD 405 ACPI_ADD_PTR(u8,
406 (sizeof 406 ret_buffer->
407 (union 407 pointer,
408 acpi_object))), 408 ACPI_ROUND_UP_TO_NATIVE_WORD
409 (sizeof
410 (union
411 acpi_object))),
409 &ret_buffer->length); 412 &ret_buffer->length);
410 /* 413 /*
411 * build simple does not include the object size in the length 414 * build simple does not include the object size in the length
@@ -603,8 +606,8 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
603 /* 606 /*
604 * Packages as external input to control methods are not supported, 607 * Packages as external input to control methods are not supported,
605 */ 608 */
606 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 609 ACPI_ERROR((AE_INFO,
607 "Packages as parameters not implemented!\n")); 610 "Packages as parameters not implemented!"));
608 611
609 return_ACPI_STATUS(AE_NOT_IMPLEMENTED); 612 return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
610 } 613 }
@@ -867,7 +870,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
867 count + 870 count +
868 1) * sizeof(void *)); 871 1) * sizeof(void *));
869 if (!dest_obj->package.elements) { 872 if (!dest_obj->package.elements) {
870 ACPI_REPORT_ERROR(("aml_build_copy_internal_package_object: Package allocation failure\n")); 873 ACPI_ERROR((AE_INFO, "Package allocation failure"));
871 return_ACPI_STATUS(AE_NO_MEMORY); 874 return_ACPI_STATUS(AE_NO_MEMORY);
872 } 875 }
873 876
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index d80e92639932..35f3d581e034 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 2bc878f7a127..1db9695b0029 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -363,8 +363,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
363 363
364 default: 364 default:
365 365
366 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown action (%X)\n", 366 ACPI_ERROR((AE_INFO, "Unknown action (%X)", action));
367 action));
368 break; 367 break;
369 } 368 }
370 369
@@ -374,9 +373,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
374 */ 373 */
375 if (count > ACPI_MAX_REFERENCE_COUNT) { 374 if (count > ACPI_MAX_REFERENCE_COUNT) {
376 375
377 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 376 ACPI_WARNING((AE_INFO,
378 "**** Warning **** Large Reference Count (%X) in object %p\n\n", 377 "Large Reference Count (%X) in object %p",
379 count, object)); 378 count, object));
380 } 379 }
381 380
382 return; 381 return;
@@ -535,8 +534,8 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
535 534
536 error_exit: 535 error_exit:
537 536
538 ACPI_REPORT_ERROR(("Could not update object reference count, %s\n", 537 ACPI_EXCEPTION((AE_INFO, status,
539 acpi_format_exception(status))); 538 "Could not update object reference count"));
540 539
541 return_ACPI_STATUS(status); 540 return_ACPI_STATUS(status);
542} 541}
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index 7b81d5ef3c32..106cc97cb4af 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -95,7 +95,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
95 95
96 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { 96 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) {
97 if (!ACPI_STRCMP(string_desc->string.pointer, 97 if (!ACPI_STRCMP(string_desc->string.pointer,
98 (char *)acpi_gbl_valid_osi_strings[i])) { 98 ACPI_CAST_PTR(char,
99 acpi_gbl_valid_osi_strings[i])))
100 {
99 /* This string is supported */ 101 /* This string is supported */
100 102
101 return_desc->integer.value = 0xFFFFFFFF; 103 return_desc->integer.value = 0xFFFFFFFF;
@@ -152,8 +154,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
152 acpi_ut_get_node_name(prefix_node), 154 acpi_ut_get_node_name(prefix_node),
153 path)); 155 path));
154 } else { 156 } else {
155 ACPI_REPORT_METHOD_ERROR("Method execution failed", 157 ACPI_ERROR_METHOD("Method execution failed",
156 prefix_node, path, status); 158 prefix_node, path, status);
157 } 159 }
158 160
159 return_ACPI_STATUS(status); 161 return_ACPI_STATUS(status);
@@ -163,9 +165,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
163 165
164 if (!info.return_object) { 166 if (!info.return_object) {
165 if (expected_return_btypes) { 167 if (expected_return_btypes) {
166 ACPI_REPORT_METHOD_ERROR("No object was returned from", 168 ACPI_ERROR_METHOD("No object was returned from",
167 prefix_node, path, 169 prefix_node, path, AE_NOT_EXIST);
168 AE_NOT_EXIST);
169 170
170 return_ACPI_STATUS(AE_NOT_EXIST); 171 return_ACPI_STATUS(AE_NOT_EXIST);
171 } 172 }
@@ -210,15 +211,14 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
210 /* Is the return object one of the expected types? */ 211 /* Is the return object one of the expected types? */
211 212
212 if (!(expected_return_btypes & return_btype)) { 213 if (!(expected_return_btypes & return_btype)) {
213 ACPI_REPORT_METHOD_ERROR("Return object type is incorrect", 214 ACPI_ERROR_METHOD("Return object type is incorrect",
214 prefix_node, path, AE_TYPE); 215 prefix_node, path, AE_TYPE);
215 216
216 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 217 ACPI_ERROR((AE_INFO,
217 "Type returned from %s was incorrect: %s, expected Btypes: %X\n", 218 "Type returned from %s was incorrect: %s, expected Btypes: %X",
218 path, 219 path,
219 acpi_ut_get_object_type_name(info. 220 acpi_ut_get_object_type_name(info.return_object),
220 return_object), 221 expected_return_btypes));
221 expected_return_btypes));
222 222
223 /* On error exit, we must delete the return object */ 223 /* On error exit, we must delete the return object */
224 224
@@ -592,7 +592,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
592 "_STA on %4.4s was not found, assuming device is present\n", 592 "_STA on %4.4s was not found, assuming device is present\n",
593 acpi_ut_get_node_name(device_node))); 593 acpi_ut_get_node_name(device_node)));
594 594
595 *flags = 0x0F; 595 *flags = ACPI_UINT32_MAX;
596 status = AE_OK; 596 status = AE_OK;
597 } 597 }
598 598
@@ -637,17 +637,17 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
637 for (i = 0; i < 4; i++) { 637 for (i = 0; i < 4; i++) {
638 highest[i] = 0xFF; 638 highest[i] = 0xFF;
639 status = acpi_ut_evaluate_object(device_node, 639 status = acpi_ut_evaluate_object(device_node,
640 (char *) 640 ACPI_CAST_PTR(char,
641 acpi_gbl_highest_dstate_names 641 acpi_gbl_highest_dstate_names
642 [i], ACPI_BTYPE_INTEGER, 642 [i]),
643 &obj_desc); 643 ACPI_BTYPE_INTEGER, &obj_desc);
644 if (ACPI_FAILURE(status)) { 644 if (ACPI_FAILURE(status)) {
645 if (status != AE_NOT_FOUND) { 645 if (status != AE_NOT_FOUND) {
646 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 646 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
647 "%s on Device %4.4s, %s\n", 647 "%s on Device %4.4s, %s\n",
648 (char *) 648 ACPI_CAST_PTR(char,
649 acpi_gbl_highest_dstate_names 649 acpi_gbl_highest_dstate_names
650 [i], 650 [i]),
651 acpi_ut_get_node_name 651 acpi_ut_get_node_name
652 (device_node), 652 (device_node),
653 acpi_format_exception 653 acpi_format_exception
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 399e64b51886..ffd13383a325 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -67,8 +67,11 @@ const char *acpi_format_exception(acpi_status status)
67 acpi_status sub_status; 67 acpi_status sub_status;
68 const char *exception = NULL; 68 const char *exception = NULL;
69 69
70 ACPI_FUNCTION_NAME("format_exception"); 70 ACPI_FUNCTION_ENTRY();
71 71
72 /*
73 * Status is composed of two parts, a "type" and an actual code
74 */
72 sub_status = (status & ~AE_CODE_MASK); 75 sub_status = (status & ~AE_CODE_MASK);
73 76
74 switch (status & AE_CODE_MASK) { 77 switch (status & AE_CODE_MASK) {
@@ -118,13 +121,13 @@ const char *acpi_format_exception(acpi_status status)
118 if (!exception) { 121 if (!exception) {
119 /* Exception code was not recognized */ 122 /* Exception code was not recognized */
120 123
121 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 124 ACPI_ERROR((AE_INFO,
122 "Unknown exception code: 0x%8.8X\n", status)); 125 "Unknown exception code: 0x%8.8X", status));
123 126
124 return ((const char *)"UNKNOWN_STATUS_CODE"); 127 exception = "UNKNOWN_STATUS_CODE";
125 } 128 }
126 129
127 return ((const char *)exception); 130 return (ACPI_CAST_PTR(const char, exception));
128} 131}
129 132
130/******************************************************************************* 133/*******************************************************************************
@@ -217,23 +220,23 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
217 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to 220 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
218 * perform a Notify() operation on it. 221 * perform a Notify() operation on it.
219 */ 222 */
220const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = 223const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
221 { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, 224 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
222{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 225 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
223{"_SB_", ACPI_TYPE_DEVICE, NULL}, 226 {"_SB_", ACPI_TYPE_DEVICE, NULL},
224{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 227 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
225{"_TZ_", ACPI_TYPE_THERMAL, NULL}, 228 {"_TZ_", ACPI_TYPE_THERMAL, NULL},
226{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, 229 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
227{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 230 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
228{"_GL_", ACPI_TYPE_MUTEX, (char *)1}, 231 {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
229 232
230#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 233#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
231{"_OSI", ACPI_TYPE_METHOD, (char *)1}, 234 {"_OSI", ACPI_TYPE_METHOD, (char *)1},
232#endif 235#endif
233 236
234 /* Table terminator */ 237 /* Table terminator */
235 238
236{NULL, ACPI_TYPE_ANY, NULL} 239 {NULL, ACPI_TYPE_ANY, NULL}
237}; 240};
238 241
239/* 242/*
@@ -485,7 +488,7 @@ char *acpi_ut_get_region_name(u8 space_id)
485 return ("invalid_space_id"); 488 return ("invalid_space_id");
486 } 489 }
487 490
488 return ((char *)acpi_gbl_region_types[space_id]); 491 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
489} 492}
490 493
491/******************************************************************************* 494/*******************************************************************************
@@ -503,11 +506,13 @@ char *acpi_ut_get_region_name(u8 space_id)
503/* Event type decoding */ 506/* Event type decoding */
504 507
505static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { 508static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
509/*! [Begin] no source code translation (keep these strings as-is) */
506 "PM_Timer", 510 "PM_Timer",
507 "global_lock", 511 "GlobalLock",
508 "power_button", 512 "PowerButton",
509 "sleep_button", 513 "SleepButton",
510 "real_time_clock", 514 "RealTimeClock",
515/*! [End] no source code translation !*/
511}; 516};
512 517
513char *acpi_ut_get_event_name(u32 event_id) 518char *acpi_ut_get_event_name(u32 event_id)
@@ -517,7 +522,7 @@ char *acpi_ut_get_event_name(u32 event_id)
517 return ("invalid_event_iD"); 522 return ("invalid_event_iD");
518 } 523 }
519 524
520 return ((char *)acpi_gbl_event_types[event_id]); 525 return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
521} 526}
522 527
523/******************************************************************************* 528/*******************************************************************************
@@ -545,12 +550,13 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED";
545/* Printable names of the ACPI object types */ 550/* Printable names of the ACPI object types */
546 551
547static const char *acpi_gbl_ns_type_names[] = { 552static const char *acpi_gbl_ns_type_names[] = {
553/*! [Begin] no source code translation (keep these strings as-is) */
548 /* 00 */ "Untyped", 554 /* 00 */ "Untyped",
549 /* 01 */ "Integer", 555 /* 01 */ "Integer",
550 /* 02 */ "String", 556 /* 02 */ "String",
551 /* 03 */ "Buffer", 557 /* 03 */ "Buffer",
552 /* 04 */ "Package", 558 /* 04 */ "Package",
553 /* 05 */ "field_unit", 559 /* 05 */ "FieldUnit",
554 /* 06 */ "Device", 560 /* 06 */ "Device",
555 /* 07 */ "Event", 561 /* 07 */ "Event",
556 /* 08 */ "Method", 562 /* 08 */ "Method",
@@ -559,33 +565,34 @@ static const char *acpi_gbl_ns_type_names[] = {
559 /* 11 */ "Power", 565 /* 11 */ "Power",
560 /* 12 */ "Processor", 566 /* 12 */ "Processor",
561 /* 13 */ "Thermal", 567 /* 13 */ "Thermal",
562 /* 14 */ "buffer_field", 568 /* 14 */ "BufferField",
563 /* 15 */ "ddb_handle", 569 /* 15 */ "DdbHandle",
564 /* 16 */ "debug_object", 570 /* 16 */ "DebugObject",
565 /* 17 */ "region_field", 571 /* 17 */ "RegionField",
566 /* 18 */ "bank_field", 572 /* 18 */ "BankField",
567 /* 19 */ "index_field", 573 /* 19 */ "IndexField",
568 /* 20 */ "Reference", 574 /* 20 */ "Reference",
569 /* 21 */ "Alias", 575 /* 21 */ "Alias",
570 /* 22 */ "method_alias", 576 /* 22 */ "MethodAlias",
571 /* 23 */ "Notify", 577 /* 23 */ "Notify",
572 /* 24 */ "addr_handler", 578 /* 24 */ "AddrHandler",
573 /* 25 */ "resource_desc", 579 /* 25 */ "ResourceDesc",
574 /* 26 */ "resource_fld", 580 /* 26 */ "ResourceFld",
575 /* 27 */ "Scope", 581 /* 27 */ "Scope",
576 /* 28 */ "Extra", 582 /* 28 */ "Extra",
577 /* 29 */ "Data", 583 /* 29 */ "Data",
578 /* 30 */ "Invalid" 584 /* 30 */ "Invalid"
585/*! [End] no source code translation !*/
579}; 586};
580 587
581char *acpi_ut_get_type_name(acpi_object_type type) 588char *acpi_ut_get_type_name(acpi_object_type type)
582{ 589{
583 590
584 if (type > ACPI_TYPE_INVALID) { 591 if (type > ACPI_TYPE_INVALID) {
585 return ((char *)acpi_gbl_bad_type); 592 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
586 } 593 }
587 594
588 return ((char *)acpi_gbl_ns_type_names[type]); 595 return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type]));
589} 596}
590 597
591char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) 598char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
@@ -634,7 +641,7 @@ char *acpi_ut_get_node_name(void *object)
634 641
635 /* Name must be a valid ACPI name */ 642 /* Name must be a valid ACPI name */
636 643
637 if (!acpi_ut_valid_acpi_name(*(u32 *) node->name.ascii)) { 644 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
638 return ("????"); 645 return ("????");
639 } 646 }
640 647
@@ -658,15 +665,16 @@ char *acpi_ut_get_node_name(void *object)
658/* Printable names of object descriptor types */ 665/* Printable names of object descriptor types */
659 666
660static const char *acpi_gbl_desc_type_names[] = { 667static const char *acpi_gbl_desc_type_names[] = {
668/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
661 /* 00 */ "Invalid", 669 /* 00 */ "Invalid",
662 /* 01 */ "Cached", 670 /* 01 */ "Cached",
663 /* 02 */ "State-Generic", 671 /* 02 */ "State-Generic",
664 /* 03 */ "State-Update", 672 /* 03 */ "State-Update",
665 /* 04 */ "State-Package", 673 /* 04 */ "State-Package",
666 /* 05 */ "State-Control", 674 /* 05 */ "State-Control",
667 /* 06 */ "State-root_parse_scope", 675 /* 06 */ "State-RootParseScope",
668 /* 07 */ "State-parse_scope", 676 /* 07 */ "State-ParseScope",
669 /* 08 */ "State-walk_scope", 677 /* 08 */ "State-WalkScope",
670 /* 09 */ "State-Result", 678 /* 09 */ "State-Result",
671 /* 10 */ "State-Notify", 679 /* 10 */ "State-Notify",
672 /* 11 */ "State-Thread", 680 /* 11 */ "State-Thread",
@@ -674,6 +682,7 @@ static const char *acpi_gbl_desc_type_names[] = {
674 /* 13 */ "Parser", 682 /* 13 */ "Parser",
675 /* 14 */ "Operand", 683 /* 14 */ "Operand",
676 /* 15 */ "Node" 684 /* 15 */ "Node"
685/*! [End] no source code translation !*/
677}; 686};
678 687
679char *acpi_ut_get_descriptor_name(void *object) 688char *acpi_ut_get_descriptor_name(void *object)
@@ -684,11 +693,12 @@ char *acpi_ut_get_descriptor_name(void *object)
684 } 693 }
685 694
686 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { 695 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
687 return ((char *)acpi_gbl_bad_type); 696 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
688 } 697 }
689 698
690 return ((char *) 699 return (ACPI_CAST_PTR(char,
691 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); 700 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
701 (object)]));
692 702
693} 703}
694 704
@@ -787,6 +797,11 @@ void acpi_ut_init_globals(void)
787 acpi_gbl_mutex_info[i].use_count = 0; 797 acpi_gbl_mutex_info[i].use_count = 0;
788 } 798 }
789 799
800 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
801 acpi_gbl_owner_id_mask[i] = 0;
802 }
803 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
804
790 /* GPE support */ 805 /* GPE support */
791 806
792 acpi_gbl_gpe_xrupt_list_head = NULL; 807 acpi_gbl_gpe_xrupt_list_head = NULL;
@@ -824,7 +839,11 @@ void acpi_ut_init_globals(void)
824 acpi_gbl_ns_lookup_count = 0; 839 acpi_gbl_ns_lookup_count = 0;
825 acpi_gbl_ps_find_count = 0; 840 acpi_gbl_ps_find_count = 0;
826 acpi_gbl_acpi_hardware_present = TRUE; 841 acpi_gbl_acpi_hardware_present = TRUE;
827 acpi_gbl_owner_id_mask = 0; 842 acpi_gbl_last_owner_id_index = 0;
843 acpi_gbl_next_owner_id_offset = 0;
844 acpi_gbl_trace_method_name = 0;
845 acpi_gbl_trace_dbg_level = 0;
846 acpi_gbl_trace_dbg_layer = 0;
828 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 847 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
829 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; 848 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
830 849
@@ -836,7 +855,6 @@ void acpi_ut_init_globals(void)
836 /* Namespace */ 855 /* Namespace */
837 856
838 acpi_gbl_root_node = NULL; 857 acpi_gbl_root_node = NULL;
839
840 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; 858 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
841 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; 859 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
842 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; 860 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index 9dde82b0beaf..ba771b4f39bc 100644
--- a/drivers/acpi/utilities/utinit.c
+++ b/drivers/acpi/utilities/utinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -72,9 +72,9 @@ static void
72acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) 72acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset)
73{ 73{
74 74
75 ACPI_REPORT_WARNING(("Invalid FADT value %s=%X at offset %X FADT=%p\n", 75 ACPI_WARNING((AE_INFO,
76 register_name, value, (u32) offset, 76 "Invalid FADT value %s=%X at offset %X FADT=%p",
77 acpi_gbl_FADT)); 77 register_name, value, (u32) offset, acpi_gbl_FADT));
78} 78}
79 79
80/****************************************************************************** 80/******************************************************************************
@@ -221,15 +221,14 @@ void acpi_ut_subsystem_shutdown(void)
221 /* Just exit if subsystem is already shutdown */ 221 /* Just exit if subsystem is already shutdown */
222 222
223 if (acpi_gbl_shutdown) { 223 if (acpi_gbl_shutdown) {
224 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 224 ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
225 "ACPI Subsystem is already terminated\n"));
226 return_VOID; 225 return_VOID;
227 } 226 }
228 227
229 /* Subsystem appears active, go ahead and shut it down */ 228 /* Subsystem appears active, go ahead and shut it down */
230 229
231 acpi_gbl_shutdown = TRUE; 230 acpi_gbl_shutdown = TRUE;
232 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); 231 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
233 232
234 /* Close the acpi_event Handling */ 233 /* Close the acpi_event Handling */
235 234
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c
index 68a0a6f94129..4a3360484e72 100644
--- a/drivers/acpi/utilities/utmath.c
+++ b/drivers/acpi/utilities/utmath.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -82,7 +82,7 @@ acpi_ut_short_divide(acpi_integer dividend,
82 /* Always check for a zero divisor */ 82 /* Always check for a zero divisor */
83 83
84 if (divisor == 0) { 84 if (divisor == 0) {
85 ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); 85 ACPI_ERROR((AE_INFO, "Divide by zero"));
86 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); 86 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
87 } 87 }
88 88
@@ -144,7 +144,7 @@ acpi_ut_divide(acpi_integer in_dividend,
144 /* Always check for a zero divisor */ 144 /* Always check for a zero divisor */
145 145
146 if (in_divisor == 0) { 146 if (in_divisor == 0) {
147 ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); 147 ACPI_ERROR((AE_INFO, "Divide by zero"));
148 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); 148 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
149 } 149 }
150 150
@@ -266,7 +266,7 @@ acpi_ut_short_divide(acpi_integer in_dividend,
266 /* Always check for a zero divisor */ 266 /* Always check for a zero divisor */
267 267
268 if (divisor == 0) { 268 if (divisor == 0) {
269 ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n")); 269 ACPI_ERROR((AE_INFO, "Divide by zero"));
270 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); 270 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
271 } 271 }
272 272
@@ -292,7 +292,7 @@ acpi_ut_divide(acpi_integer in_dividend,
292 /* Always check for a zero divisor */ 292 /* Always check for a zero divisor */
293 293
294 if (in_divisor == 0) { 294 if (in_divisor == 0) {
295 ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n")); 295 ACPI_ERROR((AE_INFO, "Divide by zero"));
296 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); 296 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
297 } 297 }
298 298
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 2ce872d75890..7364f5f8c9cd 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -63,6 +63,8 @@ ACPI_MODULE_NAME("utmisc")
63acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) 63acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
64{ 64{
65 acpi_native_uint i; 65 acpi_native_uint i;
66 acpi_native_uint j;
67 acpi_native_uint k;
66 acpi_status status; 68 acpi_status status;
67 69
68 ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); 70 ACPI_FUNCTION_TRACE("ut_allocate_owner_id");
@@ -70,8 +72,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
70 /* Guard against multiple allocations of ID to the same location */ 72 /* Guard against multiple allocations of ID to the same location */
71 73
72 if (*owner_id) { 74 if (*owner_id) {
73 ACPI_REPORT_ERROR(("Owner ID [%2.2X] already exists\n", 75 ACPI_ERROR((AE_INFO, "Owner ID [%2.2X] already exists",
74 *owner_id)); 76 *owner_id));
75 return_ACPI_STATUS(AE_ALREADY_EXISTS); 77 return_ACPI_STATUS(AE_ALREADY_EXISTS);
76 } 78 }
77 79
@@ -82,31 +84,67 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
82 return_ACPI_STATUS(status); 84 return_ACPI_STATUS(status);
83 } 85 }
84 86
85 /* Find a free owner ID */ 87 /*
88 * Find a free owner ID, cycle through all possible IDs on repeated
89 * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
90 * to be scanned twice.
91 */
92 for (i = 0, j = acpi_gbl_last_owner_id_index;
93 i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) {
94 if (j >= ACPI_NUM_OWNERID_MASKS) {
95 j = 0; /* Wraparound to start of mask array */
96 }
97
98 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
99 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
100 /* There are no free IDs in this mask */
86 101
87 for (i = 0; i < 64; i++) { 102 break;
88 if (!(acpi_gbl_owner_id_mask & (1ULL << i))) { 103 }
89 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
90 "Current owner_id mask: %16.16LX New ID: %2.2X\n",
91 acpi_gbl_owner_id_mask,
92 (unsigned int)(i + 1)));
93 104
94 acpi_gbl_owner_id_mask |= (1ULL << i); 105 if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) {
95 *owner_id = (acpi_owner_id) (i + 1); 106 /*
96 goto exit; 107 * Found a free ID. The actual ID is the bit index plus one,
108 * making zero an invalid Owner ID. Save this as the last ID
109 * allocated and update the global ID mask.
110 */
111 acpi_gbl_owner_id_mask[j] |= (1 << k);
112
113 acpi_gbl_last_owner_id_index = (u8) j;
114 acpi_gbl_next_owner_id_offset = (u8) (k + 1);
115
116 /*
117 * Construct encoded ID from the index and bit position
118 *
119 * Note: Last [j].k (bit 255) is never used and is marked
120 * permanently allocated (prevents +1 overflow)
121 */
122 *owner_id =
123 (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j));
124
125 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
126 "Allocated owner_id: %2.2X\n",
127 (unsigned int)*owner_id));
128 goto exit;
129 }
97 } 130 }
131
132 acpi_gbl_next_owner_id_offset = 0;
98 } 133 }
99 134
100 /* 135 /*
101 * If we are here, all owner_ids have been allocated. This probably should 136 * All owner_ids have been allocated. This typically should
102 * not happen since the IDs are reused after deallocation. The IDs are 137 * not happen since the IDs are reused after deallocation. The IDs are
103 * allocated upon table load (one per table) and method execution, and 138 * allocated upon table load (one per table) and method execution, and
104 * they are released when a table is unloaded or a method completes 139 * they are released when a table is unloaded or a method completes
105 * execution. 140 * execution.
141 *
142 * If this error happens, there may be very deep nesting of invoked control
143 * methods, or there may be a bug where the IDs are not released.
106 */ 144 */
107 *owner_id = 0;
108 status = AE_OWNER_ID_LIMIT; 145 status = AE_OWNER_ID_LIMIT;
109 ACPI_REPORT_ERROR(("Could not allocate new owner_id (64 max), AE_OWNER_ID_LIMIT\n")); 146 ACPI_ERROR((AE_INFO,
147 "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT"));
110 148
111 exit: 149 exit:
112 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); 150 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -123,7 +161,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
123 * control method or unloading a table. Either way, we would 161 * control method or unloading a table. Either way, we would
124 * ignore any error anyway. 162 * ignore any error anyway.
125 * 163 *
126 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 64 164 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
127 * 165 *
128 ******************************************************************************/ 166 ******************************************************************************/
129 167
@@ -131,6 +169,8 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
131{ 169{
132 acpi_owner_id owner_id = *owner_id_ptr; 170 acpi_owner_id owner_id = *owner_id_ptr;
133 acpi_status status; 171 acpi_status status;
172 acpi_native_uint index;
173 u32 bit;
134 174
135 ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); 175 ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id);
136 176
@@ -140,8 +180,8 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
140 180
141 /* Zero is not a valid owner_iD */ 181 /* Zero is not a valid owner_iD */
142 182
143 if ((owner_id == 0) || (owner_id > 64)) { 183 if (owner_id == 0) {
144 ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); 184 ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id));
145 return_VOID; 185 return_VOID;
146 } 186 }
147 187
@@ -156,10 +196,19 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
156 196
157 owner_id--; 197 owner_id--;
158 198
199 /* Decode ID to index/offset pair */
200
201 index = ACPI_DIV_32(owner_id);
202 bit = 1 << ACPI_MOD_32(owner_id);
203
159 /* Free the owner ID only if it is valid */ 204 /* Free the owner ID only if it is valid */
160 205
161 if (acpi_gbl_owner_id_mask & (1ULL << owner_id)) { 206 if (acpi_gbl_owner_id_mask[index] & bit) {
162 acpi_gbl_owner_id_mask ^= (1ULL << owner_id); 207 acpi_gbl_owner_id_mask[index] ^= bit;
208 } else {
209 ACPI_ERROR((AE_INFO,
210 "Release of non-allocated owner_id: %2.2X",
211 owner_id + 1));
163 } 212 }
164 213
165 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); 214 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -790,109 +839,97 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
790 839
791/******************************************************************************* 840/*******************************************************************************
792 * 841 *
793 * FUNCTION: acpi_ut_get_resource_end_tag 842 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info
794 * 843 *
795 * PARAMETERS: obj_desc - The resource template buffer object 844 * PARAMETERS: module_name - Caller's module name (for error output)
845 * line_number - Caller's line number (for error output)
846 * Format - Printf format string + additional args
796 * 847 *
797 * RETURN: Pointer to the end tag 848 * RETURN: None
798 * 849 *
799 * DESCRIPTION: Find the END_TAG resource descriptor in a resource template 850 * DESCRIPTION: Print message with module/line/version info
800 * 851 *
801 ******************************************************************************/ 852 ******************************************************************************/
802 853
803u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) 854void ACPI_INTERNAL_VAR_XFACE
855acpi_ut_error(char *module_name, u32 line_number, char *format, ...)
804{ 856{
805 u8 buffer_byte; 857 va_list args;
806 u8 *buffer;
807 u8 *end_buffer;
808 858
809 buffer = obj_desc->buffer.pointer; 859 acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
810 end_buffer = buffer + obj_desc->buffer.length;
811 860
812 while (buffer < end_buffer) { 861 va_start(args, format);
813 buffer_byte = *buffer; 862 acpi_os_vprintf(format, args);
814 if (buffer_byte & ACPI_RDESC_TYPE_MASK) { 863 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
815 /* Large Descriptor - Length is next 2 bytes */ 864}
816 865
817 buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); 866void ACPI_INTERNAL_VAR_XFACE
818 } else { 867acpi_ut_exception(char *module_name,
819 /* Small Descriptor. End Tag will be found here */ 868 u32 line_number, acpi_status status, char *format, ...)
869{
870 va_list args;
820 871
821 if ((buffer_byte & ACPI_RDESC_SMALL_MASK) == 872 acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name,
822 ACPI_RDESC_TYPE_END_TAG) { 873 line_number, acpi_format_exception(status));
823 /* Found the end tag descriptor, all done. */
824 874
825 return (buffer); 875 va_start(args, format);
826 } 876 acpi_os_vprintf(format, args);
877 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
878}
827 879
828 /* Length is in the header */ 880void ACPI_INTERNAL_VAR_XFACE
881acpi_ut_warning(char *module_name, u32 line_number, char *format, ...)
882{
883 va_list args;
829 884
830 buffer += ((buffer_byte & 0x07) + 1); 885 acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
831 } 886
832 } 887 va_start(args, format);
888 acpi_os_vprintf(format, args);
889 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
890}
891
892void ACPI_INTERNAL_VAR_XFACE
893acpi_ut_info(char *module_name, u32 line_number, char *format, ...)
894{
895 va_list args;
833 896
834 /* End tag not found */ 897 acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number);
835 898
836 return (NULL); 899 va_start(args, format);
900 acpi_os_vprintf(format, args);
901 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
837} 902}
838 903
839/******************************************************************************* 904/*******************************************************************************
840 * 905 *
841 * FUNCTION: acpi_ut_report_error 906 * FUNCTION: acpi_ut_report_error, Warning, Info
842 * 907 *
843 * PARAMETERS: module_name - Caller's module name (for error output) 908 * PARAMETERS: module_name - Caller's module name (for error output)
844 * line_number - Caller's line number (for error output) 909 * line_number - Caller's line number (for error output)
845 * component_id - Caller's component ID (for error output)
846 * 910 *
847 * RETURN: None 911 * RETURN: None
848 * 912 *
849 * DESCRIPTION: Print error message 913 * DESCRIPTION: Print error message
850 * 914 *
915 * Note: Legacy only, should be removed when no longer used by drivers.
916 *
851 ******************************************************************************/ 917 ******************************************************************************/
852 918
853void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id) 919void acpi_ut_report_error(char *module_name, u32 line_number)
854{ 920{
855 921
856 acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); 922 acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
857} 923}
858 924
859/******************************************************************************* 925void acpi_ut_report_warning(char *module_name, u32 line_number)
860 *
861 * FUNCTION: acpi_ut_report_warning
862 *
863 * PARAMETERS: module_name - Caller's module name (for error output)
864 * line_number - Caller's line number (for error output)
865 * component_id - Caller's component ID (for error output)
866 *
867 * RETURN: None
868 *
869 * DESCRIPTION: Print warning message
870 *
871 ******************************************************************************/
872
873void
874acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id)
875{ 926{
876 927
877 acpi_os_printf("%8s-%04d: *** Warning: ", module_name, line_number); 928 acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
878} 929}
879 930
880/******************************************************************************* 931void acpi_ut_report_info(char *module_name, u32 line_number)
881 *
882 * FUNCTION: acpi_ut_report_info
883 *
884 * PARAMETERS: module_name - Caller's module name (for error output)
885 * line_number - Caller's line number (for error output)
886 * component_id - Caller's component ID (for error output)
887 *
888 * RETURN: None
889 *
890 * DESCRIPTION: Print information message
891 *
892 ******************************************************************************/
893
894void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id)
895{ 932{
896 933
897 acpi_os_printf("%8s-%04d: *** Info: ", module_name, line_number); 934 acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number);
898} 935}
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index 90134c56ece9..45a7244df924 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -214,23 +214,22 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
214 * the ACPI subsystem code. 214 * the ACPI subsystem code.
215 */ 215 */
216 for (i = mutex_id; i < MAX_MUTEX; i++) { 216 for (i = mutex_id; i < MAX_MUTEX; i++) {
217 if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { 217 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
218 if (i == mutex_id) { 218 if (i == mutex_id) {
219 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 219 ACPI_ERROR((AE_INFO,
220 "Mutex [%s] already acquired by this thread [%X]\n", 220 "Mutex [%s] already acquired by this thread [%X]",
221 acpi_ut_get_mutex_name 221 acpi_ut_get_mutex_name
222 (mutex_id), 222 (mutex_id),
223 this_thread_id)); 223 this_thread_id));
224 224
225 return (AE_ALREADY_ACQUIRED); 225 return (AE_ALREADY_ACQUIRED);
226 } 226 }
227 227
228 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 228 ACPI_ERROR((AE_INFO,
229 "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", 229 "Invalid acquire order: Thread %X owns [%s], wants [%s]",
230 this_thread_id, 230 this_thread_id,
231 acpi_ut_get_mutex_name(i), 231 acpi_ut_get_mutex_name(i),
232 acpi_ut_get_mutex_name 232 acpi_ut_get_mutex_name(mutex_id)));
233 (mutex_id)));
234 233
235 return (AE_ACQUIRE_DEADLOCK); 234 return (AE_ACQUIRE_DEADLOCK);
236 } 235 }
@@ -253,11 +252,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
253 acpi_gbl_mutex_info[mutex_id].use_count++; 252 acpi_gbl_mutex_info[mutex_id].use_count++;
254 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; 253 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
255 } else { 254 } else {
256 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 255 ACPI_EXCEPTION((AE_INFO, status,
257 "Thread %X could not acquire Mutex [%s] %s\n", 256 "Thread %X could not acquire Mutex [%X]",
258 this_thread_id, 257 this_thread_id, mutex_id));
259 acpi_ut_get_mutex_name(mutex_id),
260 acpi_format_exception(status)));
261 } 258 }
262 259
263 return (status); 260 return (status);
@@ -295,9 +292,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
295 * Mutex must be acquired in order to release it! 292 * Mutex must be acquired in order to release it!
296 */ 293 */
297 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { 294 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
298 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 295 ACPI_ERROR((AE_INFO,
299 "Mutex [%s] is not acquired, cannot release\n", 296 "Mutex [%X] is not acquired, cannot release",
300 acpi_ut_get_mutex_name(mutex_id))); 297 mutex_id));
301 298
302 return (AE_NOT_ACQUIRED); 299 return (AE_NOT_ACQUIRED);
303 } 300 }
@@ -313,16 +310,15 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
313 * the ACPI subsystem code. 310 * the ACPI subsystem code.
314 */ 311 */
315 for (i = mutex_id; i < MAX_MUTEX; i++) { 312 for (i = mutex_id; i < MAX_MUTEX; i++) {
316 if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { 313 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
317 if (i == mutex_id) { 314 if (i == mutex_id) {
318 continue; 315 continue;
319 } 316 }
320 317
321 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 318 ACPI_ERROR((AE_INFO,
322 "Invalid release order: owns [%s], releasing [%s]\n", 319 "Invalid release order: owns [%s], releasing [%s]",
323 acpi_ut_get_mutex_name(i), 320 acpi_ut_get_mutex_name(i),
324 acpi_ut_get_mutex_name 321 acpi_ut_get_mutex_name(mutex_id)));
325 (mutex_id)));
326 322
327 return (AE_RELEASE_DEADLOCK); 323 return (AE_RELEASE_DEADLOCK);
328 } 324 }
@@ -338,11 +334,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
338 acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); 334 acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1);
339 335
340 if (ACPI_FAILURE(status)) { 336 if (ACPI_FAILURE(status)) {
341 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 337 ACPI_EXCEPTION((AE_INFO, status,
342 "Thread %X could not release Mutex [%s] %s\n", 338 "Thread %X could not release Mutex [%X]",
343 this_thread_id, 339 this_thread_id, mutex_id));
344 acpi_ut_get_mutex_name(mutex_id),
345 acpi_format_exception(status)));
346 } else { 340 } else {
347 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, 341 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
348 "Thread %X released Mutex [%s]\n", 342 "Thread %X released Mutex [%s]\n",
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 3015e1540053..7ee2d1d98071 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -177,7 +177,8 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
177 177
178 buffer = ACPI_MEM_CALLOCATE(buffer_size); 178 buffer = ACPI_MEM_CALLOCATE(buffer_size);
179 if (!buffer) { 179 if (!buffer) {
180 ACPI_REPORT_ERROR(("create_buffer: could not allocate size %X\n", (u32) buffer_size)); 180 ACPI_ERROR((AE_INFO, "Could not allocate size %X",
181 (u32) buffer_size));
181 acpi_ut_remove_reference(buffer_desc); 182 acpi_ut_remove_reference(buffer_desc);
182 return_PTR(NULL); 183 return_PTR(NULL);
183 } 184 }
@@ -228,7 +229,8 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
228 */ 229 */
229 string = ACPI_MEM_CALLOCATE(string_size + 1); 230 string = ACPI_MEM_CALLOCATE(string_size + 1);
230 if (!string) { 231 if (!string) {
231 ACPI_REPORT_ERROR(("create_string: could not allocate size %X\n", (u32) string_size)); 232 ACPI_ERROR((AE_INFO, "Could not allocate size %X",
233 (u32) string_size));
232 acpi_ut_remove_reference(string_desc); 234 acpi_ut_remove_reference(string_desc);
233 return_PTR(NULL); 235 return_PTR(NULL);
234 } 236 }
@@ -310,8 +312,8 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
310 312
311 object = acpi_os_acquire_object(acpi_gbl_operand_cache); 313 object = acpi_os_acquire_object(acpi_gbl_operand_cache);
312 if (!object) { 314 if (!object) {
313 _ACPI_REPORT_ERROR(module_name, line_number, component_id, 315 ACPI_ERROR((module_name, line_number,
314 ("Could not allocate an object descriptor\n")); 316 "Could not allocate an object descriptor"));
315 317
316 return_PTR(NULL); 318 return_PTR(NULL);
317 } 319 }
@@ -345,9 +347,9 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
345 /* Object must be an union acpi_operand_object */ 347 /* Object must be an union acpi_operand_object */
346 348
347 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { 349 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
348 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 350 ACPI_ERROR((AE_INFO,
349 "%p is not an ACPI Operand object [%s]\n", 351 "%p is not an ACPI Operand object [%s]", object,
350 object, acpi_ut_get_descriptor_name(object))); 352 acpi_ut_get_descriptor_name(object)));
351 return_VOID; 353 return_VOID;
352 } 354 }
353 355
@@ -449,10 +451,10 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
449 * Notably, Locals and Args are not supported, but this may be 451 * Notably, Locals and Args are not supported, but this may be
450 * required eventually. 452 * required eventually.
451 */ 453 */
452 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 454 ACPI_ERROR((AE_INFO,
453 "Unsupported Reference opcode=%X in object %p\n", 455 "Unsupported Reference opcode=%X in object %p",
454 internal_object->reference.opcode, 456 internal_object->reference.opcode,
455 internal_object)); 457 internal_object));
456 status = AE_TYPE; 458 status = AE_TYPE;
457 break; 459 break;
458 } 460 }
@@ -460,10 +462,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
460 462
461 default: 463 default:
462 464
463 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 465 ACPI_ERROR((AE_INFO, "Unsupported type=%X in object %p",
464 "Unsupported type=%X in object %p\n", 466 ACPI_GET_OBJECT_TYPE(internal_object),
465 ACPI_GET_OBJECT_TYPE(internal_object), 467 internal_object));
466 internal_object));
467 status = AE_TYPE; 468 status = AE_TYPE;
468 break; 469 break;
469 } 470 }
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
new file mode 100644
index 000000000000..16461317113f
--- /dev/null
+++ b/drivers/acpi/utilities/utresrc.c
@@ -0,0 +1,554 @@
1/*******************************************************************************
2 *
3 * Module Name: utresrc - Resource managment utilities
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include <acpi/amlresrc.h>
46
47#define _COMPONENT ACPI_UTILITIES
48ACPI_MODULE_NAME("utmisc")
49
50#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
51/*
52 * Strings used to decode resource descriptors.
53 * Used by both the disasssembler and the debugger resource dump routines
54 */
55const char *acpi_gbl_BMdecode[2] = {
56 "not_bus_master",
57 "bus_master"
58};
59
60const char *acpi_gbl_config_decode[4] = {
61 "0 - Good Configuration",
62 "1 - Acceptable Configuration",
63 "2 - Suboptimal Configuration",
64 "3 - ***Invalid Configuration***",
65};
66
67const char *acpi_gbl_consume_decode[2] = {
68 "resource_producer",
69 "resource_consumer"
70};
71
72const char *acpi_gbl_DECdecode[2] = {
73 "pos_decode",
74 "sub_decode"
75};
76
77const char *acpi_gbl_HEdecode[2] = {
78 "Level",
79 "Edge"
80};
81
82const char *acpi_gbl_io_decode[2] = {
83 "Decode10",
84 "Decode16"
85};
86
87const char *acpi_gbl_LLdecode[2] = {
88 "active_high",
89 "active_low"
90};
91
92const char *acpi_gbl_max_decode[2] = {
93 "max_not_fixed",
94 "max_fixed"
95};
96
97const char *acpi_gbl_MEMdecode[4] = {
98 "non_cacheable",
99 "Cacheable",
100 "write_combining",
101 "Prefetchable"
102};
103
104const char *acpi_gbl_min_decode[2] = {
105 "min_not_fixed",
106 "min_fixed"
107};
108
109const char *acpi_gbl_MTPdecode[4] = {
110 "address_range_memory",
111 "address_range_reserved",
112 "address_range_aCPI",
113 "address_range_nVS"
114};
115
116const char *acpi_gbl_RNGdecode[4] = {
117 "invalid_ranges",
118 "non_iSAonly_ranges",
119 "ISAonly_ranges",
120 "entire_range"
121};
122
123const char *acpi_gbl_RWdecode[2] = {
124 "read_only",
125 "read_write"
126};
127
128const char *acpi_gbl_SHRdecode[2] = {
129 "Exclusive",
130 "Shared"
131};
132
133const char *acpi_gbl_SIZdecode[4] = {
134 "Transfer8",
135 "Transfer8_16",
136 "Transfer16",
137 "invalid_size"
138};
139
140const char *acpi_gbl_TRSdecode[2] = {
141 "dense_translation",
142 "sparse_translation"
143};
144
145const char *acpi_gbl_TTPdecode[2] = {
146 "type_static",
147 "type_translation"
148};
149
150const char *acpi_gbl_TYPdecode[4] = {
151 "Compatibility",
152 "type_a",
153 "type_b",
154 "type_f"
155};
156
157#endif
158
159/*
160 * Base sizes of the raw AML resource descriptors, indexed by resource type.
161 * Zero indicates a reserved (and therefore invalid) resource type.
162 */
163const u8 acpi_gbl_resource_aml_sizes[] = {
164 /* Small descriptors */
165
166 0,
167 0,
168 0,
169 0,
170 ACPI_AML_SIZE_SMALL(struct aml_resource_irq),
171 ACPI_AML_SIZE_SMALL(struct aml_resource_dma),
172 ACPI_AML_SIZE_SMALL(struct aml_resource_start_dependent),
173 ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent),
174 ACPI_AML_SIZE_SMALL(struct aml_resource_io),
175 ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io),
176 0,
177 0,
178 0,
179 0,
180 ACPI_AML_SIZE_SMALL(struct aml_resource_vendor_small),
181 ACPI_AML_SIZE_SMALL(struct aml_resource_end_tag),
182
183 /* Large descriptors */
184
185 0,
186 ACPI_AML_SIZE_LARGE(struct aml_resource_memory24),
187 ACPI_AML_SIZE_LARGE(struct aml_resource_generic_register),
188 0,
189 ACPI_AML_SIZE_LARGE(struct aml_resource_vendor_large),
190 ACPI_AML_SIZE_LARGE(struct aml_resource_memory32),
191 ACPI_AML_SIZE_LARGE(struct aml_resource_fixed_memory32),
192 ACPI_AML_SIZE_LARGE(struct aml_resource_address32),
193 ACPI_AML_SIZE_LARGE(struct aml_resource_address16),
194 ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq),
195 ACPI_AML_SIZE_LARGE(struct aml_resource_address64),
196 ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64)
197};
198
199/*
200 * Resource types, used to validate the resource length field.
201 * The length of fixed-length types must match exactly, variable
202 * lengths must meet the minimum required length, etc.
203 * Zero indicates a reserved (and therefore invalid) resource type.
204 */
205static const u8 acpi_gbl_resource_types[] = {
206 /* Small descriptors */
207
208 0,
209 0,
210 0,
211 0,
212 ACPI_SMALL_VARIABLE_LENGTH,
213 ACPI_FIXED_LENGTH,
214 ACPI_SMALL_VARIABLE_LENGTH,
215 ACPI_FIXED_LENGTH,
216 ACPI_FIXED_LENGTH,
217 ACPI_FIXED_LENGTH,
218 0,
219 0,
220 0,
221 0,
222 ACPI_VARIABLE_LENGTH,
223 ACPI_FIXED_LENGTH,
224
225 /* Large descriptors */
226
227 0,
228 ACPI_FIXED_LENGTH,
229 ACPI_FIXED_LENGTH,
230 0,
231 ACPI_VARIABLE_LENGTH,
232 ACPI_FIXED_LENGTH,
233 ACPI_FIXED_LENGTH,
234 ACPI_VARIABLE_LENGTH,
235 ACPI_VARIABLE_LENGTH,
236 ACPI_VARIABLE_LENGTH,
237 ACPI_VARIABLE_LENGTH,
238 ACPI_FIXED_LENGTH
239};
240
241/*******************************************************************************
242 *
243 * FUNCTION: acpi_ut_validate_resource
244 *
245 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
246 * return_index - Where the resource index is returned. NULL
247 * if the index is not required.
248 *
249 * RETURN: Status, and optionally the Index into the global resource tables
250 *
251 * DESCRIPTION: Validate an AML resource descriptor by checking the Resource
252 * Type and Resource Length. Returns an index into the global
253 * resource information/dispatch tables for later use.
254 *
255 ******************************************************************************/
256
257acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
258{
259 u8 resource_type;
260 u8 resource_index;
261 acpi_rs_length resource_length;
262 acpi_rs_length minimum_resource_length;
263
264 ACPI_FUNCTION_ENTRY();
265
266 /*
267 * 1) Validate the resource_type field (Byte 0)
268 */
269 resource_type = ACPI_GET8(aml);
270
271 /*
272 * Byte 0 contains the descriptor name (Resource Type)
273 * Examine the large/small bit in the resource header
274 */
275 if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
276 /* Verify the large resource type (name) against the max */
277
278 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
279 return (AE_AML_INVALID_RESOURCE_TYPE);
280 }
281
282 /*
283 * Large Resource Type -- bits 6:0 contain the name
284 * Translate range 0x80-0x8B to index range 0x10-0x1B
285 */
286 resource_index = (u8) (resource_type - 0x70);
287 } else {
288 /*
289 * Small Resource Type -- bits 6:3 contain the name
290 * Shift range to index range 0x00-0x0F
291 */
292 resource_index = (u8)
293 ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3);
294 }
295
296 /* Check validity of the resource type, zero indicates name is invalid */
297
298 if (!acpi_gbl_resource_types[resource_index]) {
299 return (AE_AML_INVALID_RESOURCE_TYPE);
300 }
301
302 /*
303 * 2) Validate the resource_length field. This ensures that the length
304 * is at least reasonable, and guarantees that it is non-zero.
305 */
306 resource_length = acpi_ut_get_resource_length(aml);
307 minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index];
308
309 /* Validate based upon the type of resource - fixed length or variable */
310
311 switch (acpi_gbl_resource_types[resource_index]) {
312 case ACPI_FIXED_LENGTH:
313
314 /* Fixed length resource, length must match exactly */
315
316 if (resource_length != minimum_resource_length) {
317 return (AE_AML_BAD_RESOURCE_LENGTH);
318 }
319 break;
320
321 case ACPI_VARIABLE_LENGTH:
322
323 /* Variable length resource, length must be at least the minimum */
324
325 if (resource_length < minimum_resource_length) {
326 return (AE_AML_BAD_RESOURCE_LENGTH);
327 }
328 break;
329
330 case ACPI_SMALL_VARIABLE_LENGTH:
331
332 /* Small variable length resource, length can be (Min) or (Min-1) */
333
334 if ((resource_length > minimum_resource_length) ||
335 (resource_length < (minimum_resource_length - 1))) {
336 return (AE_AML_BAD_RESOURCE_LENGTH);
337 }
338 break;
339
340 default:
341
342 /* Shouldn't happen (because of validation earlier), but be sure */
343
344 return (AE_AML_INVALID_RESOURCE_TYPE);
345 }
346
347 /* Optionally return the resource table index */
348
349 if (return_index) {
350 *return_index = resource_index;
351 }
352
353 return (AE_OK);
354}
355
356/*******************************************************************************
357 *
358 * FUNCTION: acpi_ut_get_resource_type
359 *
360 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
361 *
362 * RETURN: The Resource Type with no extraneous bits (except the
363 * Large/Small descriptor bit -- this is left alone)
364 *
365 * DESCRIPTION: Extract the Resource Type/Name from the first byte of
366 * a resource descriptor.
367 *
368 ******************************************************************************/
369
370u8 acpi_ut_get_resource_type(void *aml)
371{
372 ACPI_FUNCTION_ENTRY();
373
374 /*
375 * Byte 0 contains the descriptor name (Resource Type)
376 * Examine the large/small bit in the resource header
377 */
378 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
379 /* Large Resource Type -- bits 6:0 contain the name */
380
381 return (ACPI_GET8(aml));
382 } else {
383 /* Small Resource Type -- bits 6:3 contain the name */
384
385 return ((u8) (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
386 }
387}
388
389/*******************************************************************************
390 *
391 * FUNCTION: acpi_ut_get_resource_length
392 *
393 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
394 *
395 * RETURN: Byte Length
396 *
397 * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
398 * definition, this does not include the size of the descriptor
399 * header or the length field itself.
400 *
401 ******************************************************************************/
402
403u16 acpi_ut_get_resource_length(void *aml)
404{
405 acpi_rs_length resource_length;
406
407 ACPI_FUNCTION_ENTRY();
408
409 /*
410 * Byte 0 contains the descriptor name (Resource Type)
411 * Examine the large/small bit in the resource header
412 */
413 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
414 /* Large Resource type -- bytes 1-2 contain the 16-bit length */
415
416 ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1));
417
418 } else {
419 /* Small Resource type -- bits 2:0 of byte 0 contain the length */
420
421 resource_length = (u16) (ACPI_GET8(aml) &
422 ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
423 }
424
425 return (resource_length);
426}
427
428/*******************************************************************************
429 *
430 * FUNCTION: acpi_ut_get_resource_header_length
431 *
432 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
433 *
434 * RETURN: Length of the AML header (depends on large/small descriptor)
435 *
436 * DESCRIPTION: Get the length of the header for this resource.
437 *
438 ******************************************************************************/
439
440u8 acpi_ut_get_resource_header_length(void *aml)
441{
442 ACPI_FUNCTION_ENTRY();
443
444 /* Examine the large/small bit in the resource header */
445
446 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
447 return (sizeof(struct aml_resource_large_header));
448 } else {
449 return (sizeof(struct aml_resource_small_header));
450 }
451}
452
453/*******************************************************************************
454 *
455 * FUNCTION: acpi_ut_get_descriptor_length
456 *
457 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
458 *
459 * RETURN: Byte length
460 *
461 * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
462 * length of the descriptor header and the length field itself.
463 * Used to walk descriptor lists.
464 *
465 ******************************************************************************/
466
467u32 acpi_ut_get_descriptor_length(void *aml)
468{
469 ACPI_FUNCTION_ENTRY();
470
471 /*
472 * Get the Resource Length (does not include header length) and add
473 * the header length (depends on if this is a small or large resource)
474 */
475 return (acpi_ut_get_resource_length(aml) +
476 acpi_ut_get_resource_header_length(aml));
477}
478
479/*******************************************************************************
480 *
481 * FUNCTION: acpi_ut_get_resource_end_tag
482 *
483 * PARAMETERS: obj_desc - The resource template buffer object
484 * end_tag - Where the pointer to the end_tag is returned
485 *
486 * RETURN: Status, pointer to the end tag
487 *
488 * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template
489 * Note: allows a buffer length of zero.
490 *
491 ******************************************************************************/
492
493acpi_status
494acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
495 u8 ** end_tag)
496{
497 acpi_status status;
498 u8 *aml;
499 u8 *end_aml;
500
501 ACPI_FUNCTION_TRACE("ut_get_resource_end_tag");
502
503 /* Get start and end pointers */
504
505 aml = obj_desc->buffer.pointer;
506 end_aml = aml + obj_desc->buffer.length;
507
508 /* Allow a buffer length of zero */
509
510 if (!obj_desc->buffer.length) {
511 *end_tag = aml;
512 return_ACPI_STATUS(AE_OK);
513 }
514
515 /* Walk the resource template, one descriptor per iteration */
516
517 while (aml < end_aml) {
518 /* Validate the Resource Type and Resource Length */
519
520 status = acpi_ut_validate_resource(aml, NULL);
521 if (ACPI_FAILURE(status)) {
522 return_ACPI_STATUS(status);
523 }
524
525 /* end_tag resource indicates the end of the resource template */
526
527 if (acpi_ut_get_resource_type(aml) ==
528 ACPI_RESOURCE_NAME_END_TAG) {
529 /*
530 * There must be at least one more byte in the buffer for
531 * the 2nd byte of the end_tag
532 */
533 if ((aml + 1) >= end_aml) {
534 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
535 }
536
537 /* Return the pointer to the end_tag */
538
539 *end_tag = aml;
540 return_ACPI_STATUS(AE_OK);
541 }
542
543 /*
544 * Point to the next resource descriptor in the AML buffer. The
545 * descriptor length is guaranteed to be non-zero by resource
546 * validation above.
547 */
548 aml += acpi_ut_get_descriptor_length(aml);
549 }
550
551 /* Did not find an end_tag resource descriptor */
552
553 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
554}
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
index c1cb27583be8..4b134a722907 100644
--- a/drivers/acpi/utilities/utstate.c
+++ b/drivers/acpi/utilities/utstate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -63,7 +63,7 @@ acpi_status
63acpi_ut_create_pkg_state_and_push(void *internal_object, 63acpi_ut_create_pkg_state_and_push(void *internal_object,
64 void *external_object, 64 void *external_object,
65 u16 index, 65 u16 index,
66 union acpi_generic_state ** state_list) 66 union acpi_generic_state **state_list)
67{ 67{
68 union acpi_generic_state *state; 68 union acpi_generic_state *state;
69 69
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index f06bd5e5e9d1..308a960871be 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -75,8 +75,7 @@ acpi_status acpi_initialize_subsystem(void)
75 75
76 status = acpi_os_initialize(); 76 status = acpi_os_initialize();
77 if (ACPI_FAILURE(status)) { 77 if (ACPI_FAILURE(status)) {
78 ACPI_REPORT_ERROR(("OSD failed to initialize, %s\n", 78 ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization"));
79 acpi_format_exception(status)));
80 return_ACPI_STATUS(status); 79 return_ACPI_STATUS(status);
81 } 80 }
82 81
@@ -88,8 +87,8 @@ acpi_status acpi_initialize_subsystem(void)
88 87
89 status = acpi_ut_mutex_initialize(); 88 status = acpi_ut_mutex_initialize();
90 if (ACPI_FAILURE(status)) { 89 if (ACPI_FAILURE(status)) {
91 ACPI_REPORT_ERROR(("Global mutex creation failure, %s\n", 90 ACPI_EXCEPTION((AE_INFO, status,
92 acpi_format_exception(status))); 91 "During Global Mutex creation"));
93 return_ACPI_STATUS(status); 92 return_ACPI_STATUS(status);
94 } 93 }
95 94
@@ -99,15 +98,14 @@ acpi_status acpi_initialize_subsystem(void)
99 */ 98 */
100 status = acpi_ns_root_initialize(); 99 status = acpi_ns_root_initialize();
101 if (ACPI_FAILURE(status)) { 100 if (ACPI_FAILURE(status)) {
102 ACPI_REPORT_ERROR(("Namespace initialization failure, %s\n", 101 ACPI_EXCEPTION((AE_INFO, status,
103 acpi_format_exception(status))); 102 "During Namespace initialization"));
104 return_ACPI_STATUS(status); 103 return_ACPI_STATUS(status);
105 } 104 }
106 105
107 /* If configured, initialize the AML debugger */ 106 /* If configured, initialize the AML debugger */
108 107
109 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); 108 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
110
111 return_ACPI_STATUS(status); 109 return_ACPI_STATUS(status);
112} 110}
113 111
@@ -154,8 +152,7 @@ acpi_status acpi_enable_subsystem(u32 flags)
154 152
155 status = acpi_enable(); 153 status = acpi_enable();
156 if (ACPI_FAILURE(status)) { 154 if (ACPI_FAILURE(status)) {
157 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 155 ACPI_WARNING((AE_INFO, "acpi_enable failed"));
158 "acpi_enable failed.\n"));
159 return_ACPI_STATUS(status); 156 return_ACPI_STATUS(status);
160 } 157 }
161 } 158 }
@@ -178,10 +175,14 @@ acpi_status acpi_enable_subsystem(u32 flags)
178 /* 175 /*
179 * Initialize ACPI Event handling (Fixed and General Purpose) 176 * Initialize ACPI Event handling (Fixed and General Purpose)
180 * 177 *
181 * NOTE: We must have the hardware AND events initialized before we can 178 * Note1: We must have the hardware and events initialized before we can
182 * execute ANY control methods SAFELY. Any control method can require 179 * execute any control methods safely. Any control method can require
183 * ACPI hardware support, so the hardware MUST be initialized before 180 * ACPI hardware support, so the hardware must be fully initialized before
184 * execution! 181 * any method execution!
182 *
183 * Note2: Fixed events are initialized and enabled here. GPEs are
184 * initialized, but cannot be enabled until after the hardware is
185 * completely initialized (SCI and global_lock activated)
185 */ 186 */
186 if (!(flags & ACPI_NO_EVENT_INIT)) { 187 if (!(flags & ACPI_NO_EVENT_INIT)) {
187 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 188 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -193,8 +194,10 @@ acpi_status acpi_enable_subsystem(u32 flags)
193 } 194 }
194 } 195 }
195 196
196 /* Install the SCI handler and Global Lock handler */ 197 /*
197 198 * Install the SCI handler and Global Lock handler. This completes the
199 * hardware initialization.
200 */
198 if (!(flags & ACPI_NO_HANDLER_INIT)) { 201 if (!(flags & ACPI_NO_HANDLER_INIT)) {
199 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 202 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
200 "[Init] Installing SCI/GL handlers\n")); 203 "[Init] Installing SCI/GL handlers\n"));
@@ -205,6 +208,24 @@ acpi_status acpi_enable_subsystem(u32 flags)
205 } 208 }
206 } 209 }
207 210
211 /*
212 * Complete the GPE initialization for the GPE blocks defined in the FADT
213 * (GPE block 0 and 1).
214 *
215 * Note1: This is where the _PRW methods are executed for the GPEs. These
216 * methods can only be executed after the SCI and Global Lock handlers are
217 * installed and initialized.
218 *
219 * Note2: Currently, there seems to be no need to run the _REG methods
220 * before execution of the _PRW methods and enabling of the GPEs.
221 */
222 if (!(flags & ACPI_NO_EVENT_INIT)) {
223 status = acpi_ev_install_fadt_gpes();
224 if (ACPI_FAILURE(status)) {
225 return (status);
226 }
227 }
228
208 return_ACPI_STATUS(status); 229 return_ACPI_STATUS(status);
209} 230}
210 231
@@ -230,9 +251,9 @@ acpi_status acpi_initialize_objects(u32 flags)
230 /* 251 /*
231 * Run all _REG methods 252 * Run all _REG methods
232 * 253 *
233 * NOTE: Any objects accessed 254 * Note: Any objects accessed by the _REG methods will be automatically
234 * by the _REG methods will be automatically initialized, even if they 255 * initialized, even if they contain executable AML (see the call to
235 * contain executable AML (see call to acpi_ns_initialize_objects below). 256 * acpi_ns_initialize_objects below).
236 */ 257 */
237 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { 258 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
238 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 259 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -245,9 +266,9 @@ acpi_status acpi_initialize_objects(u32 flags)
245 } 266 }
246 267
247 /* 268 /*
248 * Initialize the objects that remain uninitialized. This 269 * Initialize the objects that remain uninitialized. This runs the
249 * runs the executable AML that may be part of the declaration of these 270 * executable AML that may be part of the declaration of these objects:
250 * objects: operation_regions, buffer_fields, Buffers, and Packages. 271 * operation_regions, buffer_fields, Buffers, and Packages.
251 */ 272 */
252 if (!(flags & ACPI_NO_OBJECT_INIT)) { 273 if (!(flags & ACPI_NO_OBJECT_INIT)) {
253 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 274 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -260,8 +281,8 @@ acpi_status acpi_initialize_objects(u32 flags)
260 } 281 }
261 282
262 /* 283 /*
263 * Initialize all device objects in the namespace 284 * Initialize all device objects in the namespace. This runs the device
264 * This runs the _STA and _INI methods. 285 * _STA and _INI methods.
265 */ 286 */
266 if (!(flags & ACPI_NO_DEVICE_INIT)) { 287 if (!(flags & ACPI_NO_DEVICE_INIT)) {
267 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 288 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,