aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2007-02-02 11:48:18 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:21 -0500
commitf3d2e7865c816258c699ff965768e46b50d536d3 (patch)
tree83d21269e506109275b77d3ed161883bba8a39cf /drivers/acpi/utilities
parent2e42005bcdb4f63bed1cea7f537a5534d4bd7a57 (diff)
ACPICA: Implement simplified Table Manager
The Table Manager component has been completely redesigned and reimplemented. The new design is much simpler, and reduces the overall code and data size of the kernel-resident ACPICA by approximately 5%. Also, it is now possible to obtain the ACPI tables very early during kernel initialization, even before dynamic memory management is initialized. Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utglobal.c67
-rw-r--r--drivers/acpi/utilities/utinit.c72
-rw-r--r--drivers/acpi/utilities/utmisc.c8
-rw-r--r--drivers/acpi/utilities/utxface.c12
4 files changed, 49 insertions, 110 deletions
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 103845213e22..8809306ba94c 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -46,8 +46,9 @@
46#include <acpi/acpi.h> 46#include <acpi/acpi.h>
47#include <acpi/acnamesp.h> 47#include <acpi/acnamesp.h>
48 48
49ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
49#define _COMPONENT ACPI_UTILITIES 50#define _COMPONENT ACPI_UTILITIES
50ACPI_MODULE_NAME("utglobal") 51 ACPI_MODULE_NAME("utglobal")
51 52
52/******************************************************************************* 53/*******************************************************************************
53 * 54 *
@@ -280,53 +281,6 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
280 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); 281 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
281} 282}
282 283
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
296struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
297
298struct 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/****************************************************************************** 284/******************************************************************************
331 * 285 *
332 * Event and Hardware globals 286 * Event and Hardware globals
@@ -751,13 +705,6 @@ void acpi_ut_init_globals(void)
751 return; 705 return;
752 } 706 }
753 707
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 */ 708 /* Mutex locked flags */
762 709
763 for (i = 0; i < ACPI_NUM_MUTEX; i++) { 710 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
@@ -784,14 +731,6 @@ void acpi_ut_init_globals(void)
784 acpi_gbl_exception_handler = NULL; 731 acpi_gbl_exception_handler = NULL;
785 acpi_gbl_init_handler = NULL; 732 acpi_gbl_init_handler = NULL;
786 733
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 */ 734 /* Global Lock support */
796 735
797 acpi_gbl_global_lock_semaphore = NULL; 736 acpi_gbl_global_lock_semaphore = NULL;
@@ -801,8 +740,6 @@ void acpi_ut_init_globals(void)
801 740
802 /* Miscellaneous variables */ 741 /* Miscellaneous variables */
803 742
804 acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER;
805 acpi_gbl_rsdp_original_location = 0;
806 acpi_gbl_cm_single_step = FALSE; 743 acpi_gbl_cm_single_step = FALSE;
807 acpi_gbl_db_terminate_threads = FALSE; 744 acpi_gbl_db_terminate_threads = FALSE;
808 acpi_gbl_shutdown = FALSE; 745 acpi_gbl_shutdown = FALSE;
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index ff76055eb7d6..2d2c4a3aeaae 100644
--- a/drivers/acpi/utilities/utinit.c
+++ b/drivers/acpi/utilities/utinit.c
@@ -44,6 +44,7 @@
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include <acpi/acnamesp.h> 45#include <acpi/acnamesp.h>
46#include <acpi/acevents.h> 46#include <acpi/acevents.h>
47#include <acpi/actables.h>
47 48
48#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utinit") 50ACPI_MODULE_NAME("utinit")
@@ -73,8 +74,8 @@ acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset)
73{ 74{
74 75
75 ACPI_WARNING((AE_INFO, 76 ACPI_WARNING((AE_INFO,
76 "Invalid FADT value %s=%X at offset %X FADT=%p", 77 "Invalid FADT value %s=%X at offset %X in FADT=%p",
77 register_name, value, offset, acpi_gbl_FADT)); 78 register_name, value, offset, &acpi_gbl_FADT));
78} 79}
79 80
80/****************************************************************************** 81/******************************************************************************
@@ -96,62 +97,70 @@ acpi_status acpi_ut_validate_fadt(void)
96 * Verify Fixed ACPI Description Table fields, 97 * Verify Fixed ACPI Description Table fields,
97 * but don't abort on any problems, just display error 98 * but don't abort on any problems, just display error
98 */ 99 */
99 if (acpi_gbl_FADT->pm1_evt_len < 4) { 100 if (acpi_gbl_FADT.pm1_event_length < 4) {
100 acpi_ut_fadt_register_error("PM1_EVT_LEN", 101 acpi_ut_fadt_register_error("PM1_EVT_LEN",
101 (u32) acpi_gbl_FADT->pm1_evt_len, 102 (u32) acpi_gbl_FADT.
102 ACPI_FADT_OFFSET(pm1_evt_len)); 103 pm1_event_length,
104 ACPI_FADT_OFFSET(pm1_event_length));
103 } 105 }
104 106
105 if (!acpi_gbl_FADT->pm1_cnt_len) { 107 if (!acpi_gbl_FADT.pm1_control_length) {
106 acpi_ut_fadt_register_error("PM1_CNT_LEN", 0, 108 acpi_ut_fadt_register_error("PM1_CNT_LEN", 0,
107 ACPI_FADT_OFFSET(pm1_cnt_len)); 109 ACPI_FADT_OFFSET
110 (pm1_control_length));
108 } 111 }
109 112
110 if (!acpi_gbl_FADT->xpm1a_evt_blk.address) { 113 if (!acpi_gbl_FADT.xpm1a_event_block.address) {
111 acpi_ut_fadt_register_error("X_PM1a_EVT_BLK", 0, 114 acpi_ut_fadt_register_error("X_PM1a_EVT_BLK", 0,
112 ACPI_FADT_OFFSET(xpm1a_evt_blk. 115 ACPI_FADT_OFFSET(xpm1a_event_block.
113 address)); 116 address));
114 } 117 }
115 118
116 if (!acpi_gbl_FADT->xpm1a_cnt_blk.address) { 119 if (!acpi_gbl_FADT.xpm1a_control_block.address) {
117 acpi_ut_fadt_register_error("X_PM1a_CNT_BLK", 0, 120 acpi_ut_fadt_register_error("X_PM1a_CNT_BLK", 0,
118 ACPI_FADT_OFFSET(xpm1a_cnt_blk. 121 ACPI_FADT_OFFSET
119 address)); 122 (xpm1a_control_block.address));
120 } 123 }
121 124
122 if (!acpi_gbl_FADT->xpm_tmr_blk.address) { 125 if (!acpi_gbl_FADT.xpm_timer_block.address) {
123 acpi_ut_fadt_register_error("X_PM_TMR_BLK", 0, 126 acpi_ut_fadt_register_error("X_PM_TMR_BLK", 0,
124 ACPI_FADT_OFFSET(xpm_tmr_blk. 127 ACPI_FADT_OFFSET(xpm_timer_block.
125 address)); 128 address));
126 } 129 }
127 130
128 if ((acpi_gbl_FADT->xpm2_cnt_blk.address && 131 if ((acpi_gbl_FADT.xpm2_control_block.address &&
129 !acpi_gbl_FADT->pm2_cnt_len)) { 132 !acpi_gbl_FADT.pm2_control_length)) {
130 acpi_ut_fadt_register_error("PM2_CNT_LEN", 133 acpi_ut_fadt_register_error("PM2_CNT_LEN",
131 (u32) acpi_gbl_FADT->pm2_cnt_len, 134 (u32) acpi_gbl_FADT.
132 ACPI_FADT_OFFSET(pm2_cnt_len)); 135 pm2_control_length,
136 ACPI_FADT_OFFSET
137 (pm2_control_length));
133 } 138 }
134 139
135 if (acpi_gbl_FADT->pm_tm_len < 4) { 140 if (acpi_gbl_FADT.pm_timer_length < 4) {
136 acpi_ut_fadt_register_error("PM_TM_LEN", 141 acpi_ut_fadt_register_error("PM_TM_LEN",
137 (u32) acpi_gbl_FADT->pm_tm_len, 142 (u32) acpi_gbl_FADT.pm_timer_length,
138 ACPI_FADT_OFFSET(pm_tm_len)); 143 ACPI_FADT_OFFSET(pm_timer_length));
139 } 144 }
140 145
141 /* Length of GPE blocks must be a multiple of 2 */ 146 /* Length of GPE blocks must be a multiple of 2 */
142 147
143 if (acpi_gbl_FADT->xgpe0_blk.address && 148 if (acpi_gbl_FADT.xgpe0_block.address &&
144 (acpi_gbl_FADT->gpe0_blk_len & 1)) { 149 (acpi_gbl_FADT.gpe0_block_length & 1)) {
145 acpi_ut_fadt_register_error("(x)GPE0_BLK_LEN", 150 acpi_ut_fadt_register_error("(x)GPE0_BLK_LEN",
146 (u32) acpi_gbl_FADT->gpe0_blk_len, 151 (u32) acpi_gbl_FADT.
147 ACPI_FADT_OFFSET(gpe0_blk_len)); 152 gpe0_block_length,
153 ACPI_FADT_OFFSET
154 (gpe0_block_length));
148 } 155 }
149 156
150 if (acpi_gbl_FADT->xgpe1_blk.address && 157 if (acpi_gbl_FADT.xgpe1_block.address &&
151 (acpi_gbl_FADT->gpe1_blk_len & 1)) { 158 (acpi_gbl_FADT.gpe1_block_length & 1)) {
152 acpi_ut_fadt_register_error("(x)GPE1_BLK_LEN", 159 acpi_ut_fadt_register_error("(x)GPE1_BLK_LEN",
153 (u32) acpi_gbl_FADT->gpe1_blk_len, 160 (u32) acpi_gbl_FADT.
154 ACPI_FADT_OFFSET(gpe1_blk_len)); 161 gpe1_block_length,
162 ACPI_FADT_OFFSET
163 (gpe1_block_length));
155 } 164 }
156 165
157 return (AE_OK); 166 return (AE_OK);
@@ -178,7 +187,6 @@ static void acpi_ut_terminate(void)
178 187
179 ACPI_FUNCTION_TRACE(ut_terminate); 188 ACPI_FUNCTION_TRACE(ut_terminate);
180 189
181 /* Free global tables, etc. */
182 /* Free global GPE blocks and related info structures */ 190 /* Free global GPE blocks and related info structures */
183 191
184 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; 192 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
@@ -239,6 +247,10 @@ void acpi_ut_subsystem_shutdown(void)
239 247
240 acpi_ns_terminate(); 248 acpi_ns_terminate();
241 249
250 /* Delete the ACPI tables */
251
252 acpi_tb_terminate();
253
242 /* Close the globals */ 254 /* Close the globals */
243 255
244 acpi_ut_terminate(); 256 acpi_ut_terminate();
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 6d8a8211be90..47dcf82a3b5e 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -67,9 +67,9 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
67 67
68 /* These are the only tables that contain executable AML */ 68 /* These are the only tables that contain executable AML */
69 69
70 if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || 70 if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
71 ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || 71 ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
72 ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) { 72 ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
73 return (TRUE); 73 return (TRUE);
74 } 74 }
75 75
@@ -418,7 +418,7 @@ u32 acpi_ut_dword_byte_swap(u32 value)
418void acpi_ut_set_integer_width(u8 revision) 418void acpi_ut_set_integer_width(u8 revision)
419{ 419{
420 420
421 if (revision <= 1) { 421 if (revision < 2) {
422 422
423 /* 32-bit case */ 423 /* 32-bit case */
424 424
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index 3538f69c82a1..7ea2981d4382 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -398,7 +398,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
398{ 398{
399 struct acpi_system_info *info_ptr; 399 struct acpi_system_info *info_ptr;
400 acpi_status status; 400 acpi_status status;
401 u32 i;
402 401
403 ACPI_FUNCTION_TRACE(acpi_get_system_info); 402 ACPI_FUNCTION_TRACE(acpi_get_system_info);
404 403
@@ -431,9 +430,7 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
431 430
432 /* Timer resolution - 24 or 32 bits */ 431 /* Timer resolution - 24 or 32 bits */
433 432
434 if (!acpi_gbl_FADT) { 433 if (acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) {
435 info_ptr->timer_resolution = 0;
436 } else if (acpi_gbl_FADT->tmr_val_ext == 0) {
437 info_ptr->timer_resolution = 24; 434 info_ptr->timer_resolution = 24;
438 } else { 435 } else {
439 info_ptr->timer_resolution = 32; 436 info_ptr->timer_resolution = 32;
@@ -449,13 +446,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
449 info_ptr->debug_layer = acpi_dbg_layer; 446 info_ptr->debug_layer = acpi_dbg_layer;
450 info_ptr->debug_level = acpi_dbg_level; 447 info_ptr->debug_level = acpi_dbg_level;
451 448
452 /* Current status of the ACPI tables, per table type */
453
454 info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1;
455 for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
456 info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count;
457 }
458
459 return_ACPI_STATUS(AE_OK); 449 return_ACPI_STATUS(AE_OK);
460} 450}
461 451