diff options
Diffstat (limited to 'drivers/acpi/utilities/utglobal.c')
-rw-r--r-- | drivers/acpi/utilities/utglobal.c | 199 |
1 files changed, 47 insertions, 152 deletions
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 014030af8b50..af33358a964b 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 - 2006, R. Byron Moore | 8 | * Copyright (C) 2000 - 2007, 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 |
@@ -46,89 +46,9 @@ | |||
46 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
48 | 48 | ||
49 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | ||
49 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME("utglobal") | 51 | ACPI_MODULE_NAME("utglobal") |
51 | |||
52 | /******************************************************************************* | ||
53 | * | ||
54 | * FUNCTION: acpi_format_exception | ||
55 | * | ||
56 | * PARAMETERS: Status - The acpi_status code to be formatted | ||
57 | * | ||
58 | * RETURN: A string containing the exception text. A valid pointer is | ||
59 | * always returned. | ||
60 | * | ||
61 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string. | ||
62 | * | ||
63 | ******************************************************************************/ | ||
64 | const char *acpi_format_exception(acpi_status status) | ||
65 | { | ||
66 | acpi_status sub_status; | ||
67 | const char *exception = NULL; | ||
68 | |||
69 | ACPI_FUNCTION_ENTRY(); | ||
70 | |||
71 | /* | ||
72 | * Status is composed of two parts, a "type" and an actual code | ||
73 | */ | ||
74 | sub_status = (status & ~AE_CODE_MASK); | ||
75 | |||
76 | switch (status & AE_CODE_MASK) { | ||
77 | case AE_CODE_ENVIRONMENTAL: | ||
78 | |||
79 | if (sub_status <= AE_CODE_ENV_MAX) { | ||
80 | exception = acpi_gbl_exception_names_env[sub_status]; | ||
81 | } | ||
82 | break; | ||
83 | |||
84 | case AE_CODE_PROGRAMMER: | ||
85 | |||
86 | if (sub_status <= AE_CODE_PGM_MAX) { | ||
87 | exception = | ||
88 | acpi_gbl_exception_names_pgm[sub_status - 1]; | ||
89 | } | ||
90 | break; | ||
91 | |||
92 | case AE_CODE_ACPI_TABLES: | ||
93 | |||
94 | if (sub_status <= AE_CODE_TBL_MAX) { | ||
95 | exception = | ||
96 | acpi_gbl_exception_names_tbl[sub_status - 1]; | ||
97 | } | ||
98 | break; | ||
99 | |||
100 | case AE_CODE_AML: | ||
101 | |||
102 | if (sub_status <= AE_CODE_AML_MAX) { | ||
103 | exception = | ||
104 | acpi_gbl_exception_names_aml[sub_status - 1]; | ||
105 | } | ||
106 | break; | ||
107 | |||
108 | case AE_CODE_CONTROL: | ||
109 | |||
110 | if (sub_status <= AE_CODE_CTRL_MAX) { | ||
111 | exception = | ||
112 | acpi_gbl_exception_names_ctrl[sub_status - 1]; | ||
113 | } | ||
114 | break; | ||
115 | |||
116 | default: | ||
117 | break; | ||
118 | } | ||
119 | |||
120 | if (!exception) { | ||
121 | |||
122 | /* Exception code was not recognized */ | ||
123 | |||
124 | ACPI_ERROR((AE_INFO, | ||
125 | "Unknown exception code: 0x%8.8X", status)); | ||
126 | |||
127 | exception = "UNKNOWN_STATUS_CODE"; | ||
128 | } | ||
129 | |||
130 | return (ACPI_CAST_PTR(const char, exception)); | ||
131 | } | ||
132 | 52 | ||
133 | /******************************************************************************* | 53 | /******************************************************************************* |
134 | * | 54 | * |
@@ -163,8 +83,6 @@ u32 acpi_gbl_startup_flags = 0; | |||
163 | 83 | ||
164 | u8 acpi_gbl_shutdown = TRUE; | 84 | u8 acpi_gbl_shutdown = TRUE; |
165 | 85 | ||
166 | const u8 acpi_gbl_decode_to8bit[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; | ||
167 | |||
168 | const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { | 86 | const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { |
169 | "\\_S0_", | 87 | "\\_S0_", |
170 | "\\_S1_", | 88 | "\\_S1_", |
@@ -183,10 +101,45 @@ const char *acpi_gbl_highest_dstate_names[4] = { | |||
183 | 101 | ||
184 | /******************************************************************************* | 102 | /******************************************************************************* |
185 | * | 103 | * |
186 | * Namespace globals | 104 | * FUNCTION: acpi_format_exception |
105 | * | ||
106 | * PARAMETERS: Status - The acpi_status code to be formatted | ||
107 | * | ||
108 | * RETURN: A string containing the exception text. A valid pointer is | ||
109 | * always returned. | ||
110 | * | ||
111 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string | ||
112 | * It is here instead of utxface.c so it is always present. | ||
187 | * | 113 | * |
188 | ******************************************************************************/ | 114 | ******************************************************************************/ |
189 | 115 | ||
116 | const char *acpi_format_exception(acpi_status status) | ||
117 | { | ||
118 | const char *exception = NULL; | ||
119 | |||
120 | ACPI_FUNCTION_ENTRY(); | ||
121 | |||
122 | exception = acpi_ut_validate_exception(status); | ||
123 | if (!exception) { | ||
124 | |||
125 | /* Exception code was not recognized */ | ||
126 | |||
127 | ACPI_ERROR((AE_INFO, | ||
128 | "Unknown exception code: 0x%8.8X", status)); | ||
129 | |||
130 | exception = "UNKNOWN_STATUS_CODE"; | ||
131 | } | ||
132 | |||
133 | return (ACPI_CAST_PTR(const char, exception)); | ||
134 | } | ||
135 | |||
136 | ACPI_EXPORT_SYMBOL(acpi_format_exception) | ||
137 | |||
138 | /******************************************************************************* | ||
139 | * | ||
140 | * Namespace globals | ||
141 | * | ||
142 | ******************************************************************************/ | ||
190 | /* | 143 | /* |
191 | * Predefined ACPI Names (Built-in to the Interpreter) | 144 | * Predefined ACPI Names (Built-in to the Interpreter) |
192 | * | 145 | * |
@@ -280,53 +233,6 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) | |||
280 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); | 233 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); |
281 | } | 234 | } |
282 | 235 | ||
283 | /******************************************************************************* | ||
284 | * | ||
285 | * Table name globals | ||
286 | * | ||
287 | * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes. | ||
288 | * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables | ||
289 | * that are not used by the subsystem are simply ignored. | ||
290 | * | ||
291 | * Do NOT add any table to this list that is not consumed directly by this | ||
292 | * subsystem (No MADT, ECDT, SBST, etc.) | ||
293 | * | ||
294 | ******************************************************************************/ | ||
295 | |||
296 | struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; | ||
297 | |||
298 | struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = { | ||
299 | /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ | ||
300 | |||
301 | /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, | ||
302 | ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE} | ||
303 | , | ||
304 | /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *)&acpi_gbl_DSDT, | ||
305 | sizeof(DSDT_SIG) - 1, | ||
306 | ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE | | ||
307 | ACPI_TABLE_EXECUTABLE} | ||
308 | , | ||
309 | /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *)&acpi_gbl_FADT, | ||
310 | sizeof(FADT_SIG) - 1, | ||
311 | ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE} | ||
312 | , | ||
313 | /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *)&acpi_gbl_FACS, | ||
314 | sizeof(FACS_SIG) - 1, | ||
315 | ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE} | ||
316 | , | ||
317 | /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof(PSDT_SIG) - 1, | ||
318 | ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | | ||
319 | ACPI_TABLE_EXECUTABLE} | ||
320 | , | ||
321 | /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof(SSDT_SIG) - 1, | ||
322 | ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | | ||
323 | ACPI_TABLE_EXECUTABLE} | ||
324 | , | ||
325 | /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof(RSDT_SIG) - 1, | ||
326 | ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE} | ||
327 | , | ||
328 | }; | ||
329 | |||
330 | /****************************************************************************** | 236 | /****************************************************************************** |
331 | * | 237 | * |
332 | * Event and Hardware globals | 238 | * Event and Hardware globals |
@@ -612,7 +518,7 @@ char *acpi_ut_get_node_name(void *object) | |||
612 | /* Name must be a valid ACPI name */ | 518 | /* Name must be a valid ACPI name */ |
613 | 519 | ||
614 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { | 520 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { |
615 | node->name.integer = acpi_ut_repair_name(node->name.integer); | 521 | node->name.integer = acpi_ut_repair_name(node->name.ascii); |
616 | } | 522 | } |
617 | 523 | ||
618 | /* Return the name */ | 524 | /* Return the name */ |
@@ -751,13 +657,6 @@ void acpi_ut_init_globals(void) | |||
751 | return; | 657 | return; |
752 | } | 658 | } |
753 | 659 | ||
754 | /* ACPI table structure */ | ||
755 | |||
756 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { | ||
757 | acpi_gbl_table_lists[i].next = NULL; | ||
758 | acpi_gbl_table_lists[i].count = 0; | ||
759 | } | ||
760 | |||
761 | /* Mutex locked flags */ | 660 | /* Mutex locked flags */ |
762 | 661 | ||
763 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { | 662 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
@@ -773,6 +672,7 @@ void acpi_ut_init_globals(void) | |||
773 | 672 | ||
774 | /* GPE support */ | 673 | /* GPE support */ |
775 | 674 | ||
675 | acpi_gpe_count = 0; | ||
776 | acpi_gbl_gpe_xrupt_list_head = NULL; | 676 | acpi_gbl_gpe_xrupt_list_head = NULL; |
777 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | 677 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
778 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | 678 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
@@ -784,25 +684,15 @@ void acpi_ut_init_globals(void) | |||
784 | acpi_gbl_exception_handler = NULL; | 684 | acpi_gbl_exception_handler = NULL; |
785 | acpi_gbl_init_handler = NULL; | 685 | acpi_gbl_init_handler = NULL; |
786 | 686 | ||
787 | /* Global "typed" ACPI table pointers */ | ||
788 | |||
789 | acpi_gbl_RSDP = NULL; | ||
790 | acpi_gbl_XSDT = NULL; | ||
791 | acpi_gbl_FACS = NULL; | ||
792 | acpi_gbl_FADT = NULL; | ||
793 | acpi_gbl_DSDT = NULL; | ||
794 | |||
795 | /* Global Lock support */ | 687 | /* Global Lock support */ |
796 | 688 | ||
797 | acpi_gbl_global_lock_semaphore = NULL; | 689 | acpi_gbl_global_lock_semaphore = NULL; |
690 | acpi_gbl_global_lock_mutex = NULL; | ||
798 | acpi_gbl_global_lock_acquired = FALSE; | 691 | acpi_gbl_global_lock_acquired = FALSE; |
799 | acpi_gbl_global_lock_thread_count = 0; | ||
800 | acpi_gbl_global_lock_handle = 0; | 692 | acpi_gbl_global_lock_handle = 0; |
801 | 693 | ||
802 | /* Miscellaneous variables */ | 694 | /* Miscellaneous variables */ |
803 | 695 | ||
804 | acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER; | ||
805 | acpi_gbl_rsdp_original_location = 0; | ||
806 | acpi_gbl_cm_single_step = FALSE; | 696 | acpi_gbl_cm_single_step = FALSE; |
807 | acpi_gbl_db_terminate_threads = FALSE; | 697 | acpi_gbl_db_terminate_threads = FALSE; |
808 | acpi_gbl_shutdown = FALSE; | 698 | acpi_gbl_shutdown = FALSE; |
@@ -837,8 +727,13 @@ void acpi_ut_init_globals(void) | |||
837 | acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX; | 727 | acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX; |
838 | #endif | 728 | #endif |
839 | 729 | ||
730 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
731 | acpi_gbl_display_final_mem_stats = FALSE; | ||
732 | #endif | ||
733 | |||
840 | return_VOID; | 734 | return_VOID; |
841 | } | 735 | } |
842 | 736 | ||
843 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | 737 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
844 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | 738 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
739 | ACPI_EXPORT_SYMBOL(acpi_gpe_count) | ||