aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utglobal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utglobal.c')
-rw-r--r--drivers/acpi/utilities/utglobal.c133
1 files changed, 71 insertions, 62 deletions
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 25b0f8ae1bc6..4146019b543f 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -44,7 +44,6 @@
44#define DEFINE_ACPI_GLOBALS 44#define DEFINE_ACPI_GLOBALS
45 45
46#include <linux/module.h> 46#include <linux/module.h>
47
48#include <acpi/acpi.h> 47#include <acpi/acpi.h>
49#include <acpi/acnamesp.h> 48#include <acpi/acnamesp.h>
50 49
@@ -52,13 +51,14 @@
52 ACPI_MODULE_NAME ("utglobal") 51 ACPI_MODULE_NAME ("utglobal")
53 52
54 53
55/****************************************************************************** 54/*******************************************************************************
56 * 55 *
57 * FUNCTION: acpi_format_exception 56 * FUNCTION: acpi_format_exception
58 * 57 *
59 * PARAMETERS: Status - The acpi_status code to be formatted 58 * PARAMETERS: Status - The acpi_status code to be formatted
60 * 59 *
61 * RETURN: A string containing the exception text 60 * RETURN: A string containing the exception text. A valid pointer is
61 * always returned.
62 * 62 *
63 * DESCRIPTION: This function translates an ACPI exception into an ASCII string. 63 * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
64 * 64 *
@@ -68,8 +68,8 @@ const char *
68acpi_format_exception ( 68acpi_format_exception (
69 acpi_status status) 69 acpi_status status)
70{ 70{
71 const char *exception = "UNKNOWN_STATUS_CODE";
72 acpi_status sub_status; 71 acpi_status sub_status;
72 const char *exception = NULL;
73 73
74 74
75 ACPI_FUNCTION_NAME ("format_exception"); 75 ACPI_FUNCTION_NAME ("format_exception");
@@ -82,57 +82,55 @@ acpi_format_exception (
82 82
83 if (sub_status <= AE_CODE_ENV_MAX) { 83 if (sub_status <= AE_CODE_ENV_MAX) {
84 exception = acpi_gbl_exception_names_env [sub_status]; 84 exception = acpi_gbl_exception_names_env [sub_status];
85 break;
86 } 85 }
87 goto unknown; 86 break;
88 87
89 case AE_CODE_PROGRAMMER: 88 case AE_CODE_PROGRAMMER:
90 89
91 if (sub_status <= AE_CODE_PGM_MAX) { 90 if (sub_status <= AE_CODE_PGM_MAX) {
92 exception = acpi_gbl_exception_names_pgm [sub_status -1]; 91 exception = acpi_gbl_exception_names_pgm [sub_status -1];
93 break;
94 } 92 }
95 goto unknown; 93 break;
96 94
97 case AE_CODE_ACPI_TABLES: 95 case AE_CODE_ACPI_TABLES:
98 96
99 if (sub_status <= AE_CODE_TBL_MAX) { 97 if (sub_status <= AE_CODE_TBL_MAX) {
100 exception = acpi_gbl_exception_names_tbl [sub_status -1]; 98 exception = acpi_gbl_exception_names_tbl [sub_status -1];
101 break;
102 } 99 }
103 goto unknown; 100 break;
104 101
105 case AE_CODE_AML: 102 case AE_CODE_AML:
106 103
107 if (sub_status <= AE_CODE_AML_MAX) { 104 if (sub_status <= AE_CODE_AML_MAX) {
108 exception = acpi_gbl_exception_names_aml [sub_status -1]; 105 exception = acpi_gbl_exception_names_aml [sub_status -1];
109 break;
110 } 106 }
111 goto unknown; 107 break;
112 108
113 case AE_CODE_CONTROL: 109 case AE_CODE_CONTROL:
114 110
115 if (sub_status <= AE_CODE_CTRL_MAX) { 111 if (sub_status <= AE_CODE_CTRL_MAX) {
116 exception = acpi_gbl_exception_names_ctrl [sub_status -1]; 112 exception = acpi_gbl_exception_names_ctrl [sub_status -1];
117 break;
118 } 113 }
119 goto unknown; 114 break;
120 115
121 default: 116 default:
122 goto unknown; 117 break;
123 } 118 }
124 119
120 if (!exception) {
121 /* Exception code was not recognized */
125 122
126 return ((const char *) exception); 123 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
124 "Unknown exception code: 0x%8.8X\n", status));
127 125
128unknown: 126 return ((const char *) "UNKNOWN_STATUS_CODE");
127 }
129 128
130 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", status));
131 return ((const char *) exception); 129 return ((const char *) exception);
132} 130}
133 131
134 132
135/****************************************************************************** 133/*******************************************************************************
136 * 134 *
137 * Static global variable initialization. 135 * Static global variable initialization.
138 * 136 *
@@ -212,13 +210,12 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STR
212}; 210};
213 211
214 212
215/****************************************************************************** 213/*******************************************************************************
216 * 214 *
217 * Namespace globals 215 * Namespace globals
218 * 216 *
219 ******************************************************************************/ 217 ******************************************************************************/
220 218
221
222/* 219/*
223 * Predefined ACPI Names (Built-in to the Interpreter) 220 * Predefined ACPI Names (Built-in to the Interpreter)
224 * 221 *
@@ -241,9 +238,11 @@ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] =
241#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 238#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
242 {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, 239 {"_OSI", ACPI_TYPE_METHOD, (char *) 1},
243#endif 240#endif
244 {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */
245};
246 241
242 /* Table terminator */
243
244 {NULL, ACPI_TYPE_ANY, NULL}
245};
247 246
248/* 247/*
249 * Properties of the ACPI Object Types, both internal and external. 248 * Properties of the ACPI Object Types, both internal and external.
@@ -288,22 +287,25 @@ const u8 acpi_gbl_ns_properties[] =
288/* Hex to ASCII conversion table */ 287/* Hex to ASCII conversion table */
289 288
290static const char acpi_gbl_hex_to_ascii[] = 289static const char acpi_gbl_hex_to_ascii[] =
291 {'0','1','2','3','4','5','6','7', 290{
292 '8','9','A','B','C','D','E','F'}; 291 '0','1','2','3','4','5','6','7',
292 '8','9','A','B','C','D','E','F'
293};
294
293 295
294/***************************************************************************** 296/*******************************************************************************
295 * 297 *
296 * FUNCTION: acpi_ut_hex_to_ascii_char 298 * FUNCTION: acpi_ut_hex_to_ascii_char
297 * 299 *
298 * PARAMETERS: Integer - Contains the hex digit 300 * PARAMETERS: Integer - Contains the hex digit
299 * Position - bit position of the digit within the 301 * Position - bit position of the digit within the
300 * integer 302 * integer (multiple of 4)
301 * 303 *
302 * RETURN: Ascii character 304 * RETURN: The converted Ascii character
303 * 305 *
304 * DESCRIPTION: Convert a hex digit to an ascii character 306 * DESCRIPTION: Convert a hex digit to an Ascii character
305 * 307 *
306 ****************************************************************************/ 308 ******************************************************************************/
307 309
308char 310char
309acpi_ut_hex_to_ascii_char ( 311acpi_ut_hex_to_ascii_char (
@@ -315,7 +317,7 @@ acpi_ut_hex_to_ascii_char (
315} 317}
316 318
317 319
318/****************************************************************************** 320/*******************************************************************************
319 * 321 *
320 * Table name globals 322 * Table name globals
321 * 323 *
@@ -324,7 +326,7 @@ acpi_ut_hex_to_ascii_char (
324 * that are not used by the subsystem are simply ignored. 326 * that are not used by the subsystem are simply ignored.
325 * 327 *
326 * Do NOT add any table to this list that is not consumed directly by this 328 * Do NOT add any table to this list that is not consumed directly by this
327 * subsystem. 329 * subsystem (No MADT, ECDT, SBST, etc.)
328 * 330 *
329 ******************************************************************************/ 331 ******************************************************************************/
330 332
@@ -391,7 +393,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE
391 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, 393 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE},
392}; 394};
393 395
394/***************************************************************************** 396/*******************************************************************************
395 * 397 *
396 * FUNCTION: acpi_ut_get_region_name 398 * FUNCTION: acpi_ut_get_region_name
397 * 399 *
@@ -401,7 +403,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE
401 * 403 *
402 * DESCRIPTION: Translate a Space ID into a name string (Debug only) 404 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
403 * 405 *
404 ****************************************************************************/ 406 ******************************************************************************/
405 407
406/* Region type decoding */ 408/* Region type decoding */
407 409
@@ -429,7 +431,6 @@ acpi_ut_get_region_name (
429 { 431 {
430 return ("user_defined_region"); 432 return ("user_defined_region");
431 } 433 }
432
433 else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) 434 else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS)
434 { 435 {
435 return ("invalid_space_id"); 436 return ("invalid_space_id");
@@ -439,7 +440,7 @@ acpi_ut_get_region_name (
439} 440}
440 441
441 442
442/***************************************************************************** 443/*******************************************************************************
443 * 444 *
444 * FUNCTION: acpi_ut_get_event_name 445 * FUNCTION: acpi_ut_get_event_name
445 * 446 *
@@ -449,7 +450,7 @@ acpi_ut_get_region_name (
449 * 450 *
450 * DESCRIPTION: Translate a Event ID into a name string (Debug only) 451 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
451 * 452 *
452 ****************************************************************************/ 453 ******************************************************************************/
453 454
454/* Event type decoding */ 455/* Event type decoding */
455 456
@@ -477,7 +478,7 @@ acpi_ut_get_event_name (
477} 478}
478 479
479 480
480/***************************************************************************** 481/*******************************************************************************
481 * 482 *
482 * FUNCTION: acpi_ut_get_type_name 483 * FUNCTION: acpi_ut_get_type_name
483 * 484 *
@@ -487,20 +488,21 @@ acpi_ut_get_event_name (
487 * 488 *
488 * DESCRIPTION: Translate a Type ID into a name string (Debug only) 489 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
489 * 490 *
490 ****************************************************************************/ 491 ******************************************************************************/
491 492
492/* 493/*
493 * Elements of acpi_gbl_ns_type_names below must match 494 * Elements of acpi_gbl_ns_type_names below must match
494 * one-to-one with values of acpi_object_type 495 * one-to-one with values of acpi_object_type
495 * 496 *
496 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when 497 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
497 * stored in a table it really means that we have thus far seen no evidence to 498 * when stored in a table it really means that we have thus far seen no
498 * indicate what type is actually going to be stored for this entry. 499 * evidence to indicate what type is actually going to be stored for this entry.
499 */ 500 */
500static const char acpi_gbl_bad_type[] = "UNDEFINED"; 501static const char acpi_gbl_bad_type[] = "UNDEFINED";
501#define TYPE_NAME_LENGTH 12 /* Maximum length of each string */
502 502
503static const char *acpi_gbl_ns_type_names[] = /* printable names of ACPI types */ 503/* Printable names of the ACPI object types */
504
505static const char *acpi_gbl_ns_type_names[] =
504{ 506{
505 /* 00 */ "Untyped", 507 /* 00 */ "Untyped",
506 /* 01 */ "Integer", 508 /* 01 */ "Integer",
@@ -564,7 +566,7 @@ acpi_ut_get_object_type_name (
564} 566}
565 567
566 568
567/***************************************************************************** 569/*******************************************************************************
568 * 570 *
569 * FUNCTION: acpi_ut_get_node_name 571 * FUNCTION: acpi_ut_get_node_name
570 * 572 *
@@ -574,7 +576,7 @@ acpi_ut_get_object_type_name (
574 * 576 *
575 * DESCRIPTION: Validate the node and return the node's ACPI name. 577 * DESCRIPTION: Validate the node and return the node's ACPI name.
576 * 578 *
577 ****************************************************************************/ 579 ******************************************************************************/
578 580
579char * 581char *
580acpi_ut_get_node_name ( 582acpi_ut_get_node_name (
@@ -618,7 +620,7 @@ acpi_ut_get_node_name (
618} 620}
619 621
620 622
621/***************************************************************************** 623/*******************************************************************************
622 * 624 *
623 * FUNCTION: acpi_ut_get_descriptor_name 625 * FUNCTION: acpi_ut_get_descriptor_name
624 * 626 *
@@ -628,9 +630,11 @@ acpi_ut_get_node_name (
628 * 630 *
629 * DESCRIPTION: Validate object and return the descriptor type 631 * DESCRIPTION: Validate object and return the descriptor type
630 * 632 *
631 ****************************************************************************/ 633 ******************************************************************************/
634
635/* Printable names of object descriptor types */
632 636
633static const char *acpi_gbl_desc_type_names[] = /* printable names of descriptor types */ 637static const char *acpi_gbl_desc_type_names[] =
634{ 638{
635 /* 00 */ "Invalid", 639 /* 00 */ "Invalid",
636 /* 01 */ "Cached", 640 /* 01 */ "Cached",
@@ -676,17 +680,18 @@ acpi_ut_get_descriptor_name (
676 * Strings and procedures used for debug only 680 * Strings and procedures used for debug only
677 */ 681 */
678 682
679/***************************************************************************** 683/*******************************************************************************
680 * 684 *
681 * FUNCTION: acpi_ut_get_mutex_name 685 * FUNCTION: acpi_ut_get_mutex_name
682 * 686 *
683 * PARAMETERS: None. 687 * PARAMETERS: mutex_id - The predefined ID for this mutex.
684 * 688 *
685 * RETURN: Status 689 * RETURN: String containing the name of the mutex. Always returns a valid
690 * pointer.
686 * 691 *
687 * DESCRIPTION: Translate a mutex ID into a name string (Debug only) 692 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
688 * 693 *
689 ****************************************************************************/ 694 ******************************************************************************/
690 695
691char * 696char *
692acpi_ut_get_mutex_name ( 697acpi_ut_get_mutex_name (
@@ -700,21 +705,20 @@ acpi_ut_get_mutex_name (
700 705
701 return (acpi_gbl_mutex_names[mutex_id]); 706 return (acpi_gbl_mutex_names[mutex_id]);
702} 707}
703
704#endif 708#endif
705 709
706 710
707/***************************************************************************** 711/*******************************************************************************
708 * 712 *
709 * FUNCTION: acpi_ut_valid_object_type 713 * FUNCTION: acpi_ut_valid_object_type
710 * 714 *
711 * PARAMETERS: Type - Object type to be validated 715 * PARAMETERS: Type - Object type to be validated
712 * 716 *
713 * RETURN: TRUE if valid object type 717 * RETURN: TRUE if valid object type, FALSE otherwise
714 * 718 *
715 * DESCRIPTION: Validate an object type 719 * DESCRIPTION: Validate an object type
716 * 720 *
717 ****************************************************************************/ 721 ******************************************************************************/
718 722
719u8 723u8
720acpi_ut_valid_object_type ( 724acpi_ut_valid_object_type (
@@ -732,7 +736,7 @@ acpi_ut_valid_object_type (
732} 736}
733 737
734 738
735/**************************************************************************** 739/*******************************************************************************
736 * 740 *
737 * FUNCTION: acpi_ut_allocate_owner_id 741 * FUNCTION: acpi_ut_allocate_owner_id
738 * 742 *
@@ -740,7 +744,10 @@ acpi_ut_valid_object_type (
740 * 744 *
741 * DESCRIPTION: Allocate a table or method owner id 745 * DESCRIPTION: Allocate a table or method owner id
742 * 746 *
743 ***************************************************************************/ 747 * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and
748 * should be revisited (TBD)
749 *
750 ******************************************************************************/
744 751
745acpi_owner_id 752acpi_owner_id
746acpi_ut_allocate_owner_id ( 753acpi_ut_allocate_owner_id (
@@ -796,16 +803,18 @@ acpi_ut_allocate_owner_id (
796} 803}
797 804
798 805
799/**************************************************************************** 806/*******************************************************************************
800 * 807 *
801 * FUNCTION: acpi_ut_init_globals 808 * FUNCTION: acpi_ut_init_globals
802 * 809 *
803 * PARAMETERS: none 810 * PARAMETERS: None
811 *
812 * RETURN: None
804 * 813 *
805 * DESCRIPTION: Init library globals. All globals that require specific 814 * DESCRIPTION: Init library globals. All globals that require specific
806 * initialization should be initialized here! 815 * initialization should be initialized here!
807 * 816 *
808 ***************************************************************************/ 817 ******************************************************************************/
809 818
810void 819void
811acpi_ut_init_globals ( 820acpi_ut_init_globals (