aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utalloc.c11
-rw-r--r--drivers/acpi/utilities/utcache.c10
-rw-r--r--drivers/acpi/utilities/utcopy.c11
-rw-r--r--drivers/acpi/utilities/utdebug.c7
-rw-r--r--drivers/acpi/utilities/utdelete.c16
-rw-r--r--drivers/acpi/utilities/uteval.c2
-rw-r--r--drivers/acpi/utilities/utglobal.c199
-rw-r--r--drivers/acpi/utilities/utinit.c114
-rw-r--r--drivers/acpi/utilities/utmath.c2
-rw-r--r--drivers/acpi/utilities/utmisc.c102
-rw-r--r--drivers/acpi/utilities/utmutex.c2
-rw-r--r--drivers/acpi/utilities/utobject.c2
-rw-r--r--drivers/acpi/utilities/utresrc.c2
-rw-r--r--drivers/acpi/utilities/utstate.c2
-rw-r--r--drivers/acpi/utilities/utxface.c29
15 files changed, 193 insertions, 318 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index f6cbc0b1bfd0..55a764807499 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 - 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
@@ -42,6 +42,7 @@
42 */ 42 */
43 43
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include <acpi/acdebug.h>
45 46
46#define _COMPONENT ACPI_UTILITIES 47#define _COMPONENT ACPI_UTILITIES
47ACPI_MODULE_NAME("utalloc") 48ACPI_MODULE_NAME("utalloc")
@@ -142,6 +143,14 @@ acpi_status acpi_ut_create_caches(void)
142 143
143acpi_status acpi_ut_delete_caches(void) 144acpi_status acpi_ut_delete_caches(void)
144{ 145{
146#ifdef ACPI_DBG_TRACK_ALLOCATIONS
147 char buffer[7];
148
149 if (acpi_gbl_display_final_mem_stats) {
150 ACPI_STRCPY(buffer, "MEMORY");
151 acpi_db_display_statistics(buffer);
152 }
153#endif
145 154
146 (void)acpi_os_delete_cache(acpi_gbl_namespace_cache); 155 (void)acpi_os_delete_cache(acpi_gbl_namespace_cache);
147 acpi_gbl_namespace_cache = NULL; 156 acpi_gbl_namespace_cache = NULL;
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
index 1a1f8109159c..870f6edeb5f2 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 - 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
@@ -289,6 +289,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
289 289
290 ACPI_MEM_TRACKING(cache->total_allocated++); 290 ACPI_MEM_TRACKING(cache->total_allocated++);
291 291
292#ifdef ACPI_DBG_TRACK_ALLOCATIONS
293 if ((cache->total_allocated - cache->total_freed) >
294 cache->max_occupied) {
295 cache->max_occupied =
296 cache->total_allocated - cache->total_freed;
297 }
298#endif
299
292 /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ 300 /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
293 301
294 status = acpi_ut_release_mutex(ACPI_MTX_CACHES); 302 status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 5e1a80d1bc36..84d529db0a66 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 - 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
@@ -719,6 +719,15 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
719 acpi_ut_add_reference(source_desc->reference.object); 719 acpi_ut_add_reference(source_desc->reference.object);
720 break; 720 break;
721 721
722 case ACPI_TYPE_REGION:
723 /*
724 * We copied the Region Handler, so we now must add a reference
725 */
726 if (dest_desc->region.handler) {
727 acpi_ut_add_reference(dest_desc->region.handler);
728 }
729 break;
730
722 default: 731 default:
723 /* Nothing to do for other simple objects */ 732 /* Nothing to do for other simple objects */
724 break; 733 break;
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 9e9054e155c1..61ad4f2daee2 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 - 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
@@ -181,8 +181,7 @@ acpi_ut_debug_print(u32 requested_debug_level,
181 if (ACPI_LV_THREADS & acpi_dbg_level) { 181 if (ACPI_LV_THREADS & acpi_dbg_level) {
182 acpi_os_printf 182 acpi_os_printf
183 ("\n**** Context Switch from TID %lX to TID %lX ****\n\n", 183 ("\n**** Context Switch from TID %lX to TID %lX ****\n\n",
184 (unsigned long) acpi_gbl_prev_thread_id, 184 (unsigned long)acpi_gbl_prev_thread_id, (unsigned long)thread_id);
185 (unsigned long) thread_id);
186 } 185 }
187 186
188 acpi_gbl_prev_thread_id = thread_id; 187 acpi_gbl_prev_thread_id = thread_id;
@@ -195,7 +194,7 @@ acpi_ut_debug_print(u32 requested_debug_level,
195 acpi_os_printf("%8s-%04ld ", module_name, line_number); 194 acpi_os_printf("%8s-%04ld ", module_name, line_number);
196 195
197 if (ACPI_LV_THREADS & acpi_dbg_level) { 196 if (ACPI_LV_THREADS & acpi_dbg_level) {
198 acpi_os_printf("[%04lX] ", thread_id); 197 acpi_os_printf("[%04lX] ", (unsigned long)thread_id);
199 } 198 }
200 199
201 acpi_os_printf("[%02ld] %-22.22s: ", 200 acpi_os_printf("[%02ld] %-22.22s: ",
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 9d3f1149ba21..f777cebdc46d 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 - 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
@@ -158,16 +158,20 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
158 "***** Mutex %p, OS Mutex %p\n", 158 "***** Mutex %p, OS Mutex %p\n",
159 object, object->mutex.os_mutex)); 159 object, object->mutex.os_mutex));
160 160
161 if (object->mutex.os_mutex != ACPI_GLOBAL_LOCK) { 161 if (object->mutex.os_mutex == acpi_gbl_global_lock_mutex) {
162 acpi_ex_unlink_mutex(object); 162
163 acpi_os_delete_mutex(object->mutex.os_mutex); 163 /* Global Lock has extra semaphore */
164 } else {
165 /* Global Lock "mutex" is actually a counting semaphore */
166 164
167 (void) 165 (void)
168 acpi_os_delete_semaphore 166 acpi_os_delete_semaphore
169 (acpi_gbl_global_lock_semaphore); 167 (acpi_gbl_global_lock_semaphore);
170 acpi_gbl_global_lock_semaphore = NULL; 168 acpi_gbl_global_lock_semaphore = NULL;
169
170 acpi_os_delete_mutex(object->mutex.os_mutex);
171 acpi_gbl_global_lock_mutex = NULL;
172 } else {
173 acpi_ex_unlink_mutex(object);
174 acpi_os_delete_mutex(object->mutex.os_mutex);
171 } 175 }
172 break; 176 break;
173 177
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index d6d7121583c0..13d5879cd98b 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 - 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
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
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/*******************************************************************************
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 ******************************************************************************/
64const 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
164u8 acpi_gbl_shutdown = TRUE; 84u8 acpi_gbl_shutdown = TRUE;
165 85
166const u8 acpi_gbl_decode_to8bit[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
167
168const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { 86const 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
116const 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
136ACPI_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
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/****************************************************************************** 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
843ACPI_EXPORT_SYMBOL(acpi_dbg_level) 737ACPI_EXPORT_SYMBOL(acpi_dbg_level)
844ACPI_EXPORT_SYMBOL(acpi_dbg_layer) 738ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
739ACPI_EXPORT_SYMBOL(acpi_gpe_count)
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index ff76055eb7d6..ad3c0d0a5cf8 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 - 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
@@ -44,119 +44,14 @@
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")
50 51
51/* Local prototypes */ 52/* Local prototypes */
52static void
53acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset);
54
55static void acpi_ut_terminate(void); 53static void acpi_ut_terminate(void);
56 54
57/*******************************************************************************
58 *
59 * FUNCTION: acpi_ut_fadt_register_error
60 *
61 * PARAMETERS: register_name - Pointer to string identifying register
62 * Value - Actual register contents value
63 * Offset - Byte offset in the FADT
64 *
65 * RETURN: AE_BAD_VALUE
66 *
67 * DESCRIPTION: Display failure message
68 *
69 ******************************************************************************/
70
71static void
72acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset)
73{
74
75 ACPI_WARNING((AE_INFO,
76 "Invalid FADT value %s=%X at offset %X FADT=%p",
77 register_name, value, offset, acpi_gbl_FADT));
78}
79
80/******************************************************************************
81 *
82 * FUNCTION: acpi_ut_validate_fadt
83 *
84 * PARAMETERS: None
85 *
86 * RETURN: Status
87 *
88 * DESCRIPTION: Validate various ACPI registers in the FADT
89 *
90 ******************************************************************************/
91
92acpi_status acpi_ut_validate_fadt(void)
93{
94
95 /*
96 * Verify Fixed ACPI Description Table fields,
97 * but don't abort on any problems, just display error
98 */
99 if (acpi_gbl_FADT->pm1_evt_len < 4) {
100 acpi_ut_fadt_register_error("PM1_EVT_LEN",
101 (u32) acpi_gbl_FADT->pm1_evt_len,
102 ACPI_FADT_OFFSET(pm1_evt_len));
103 }
104
105 if (!acpi_gbl_FADT->pm1_cnt_len) {
106 acpi_ut_fadt_register_error("PM1_CNT_LEN", 0,
107 ACPI_FADT_OFFSET(pm1_cnt_len));
108 }
109
110 if (!acpi_gbl_FADT->xpm1a_evt_blk.address) {
111 acpi_ut_fadt_register_error("X_PM1a_EVT_BLK", 0,
112 ACPI_FADT_OFFSET(xpm1a_evt_blk.
113 address));
114 }
115
116 if (!acpi_gbl_FADT->xpm1a_cnt_blk.address) {
117 acpi_ut_fadt_register_error("X_PM1a_CNT_BLK", 0,
118 ACPI_FADT_OFFSET(xpm1a_cnt_blk.
119 address));
120 }
121
122 if (!acpi_gbl_FADT->xpm_tmr_blk.address) {
123 acpi_ut_fadt_register_error("X_PM_TMR_BLK", 0,
124 ACPI_FADT_OFFSET(xpm_tmr_blk.
125 address));
126 }
127
128 if ((acpi_gbl_FADT->xpm2_cnt_blk.address &&
129 !acpi_gbl_FADT->pm2_cnt_len)) {
130 acpi_ut_fadt_register_error("PM2_CNT_LEN",
131 (u32) acpi_gbl_FADT->pm2_cnt_len,
132 ACPI_FADT_OFFSET(pm2_cnt_len));
133 }
134
135 if (acpi_gbl_FADT->pm_tm_len < 4) {
136 acpi_ut_fadt_register_error("PM_TM_LEN",
137 (u32) acpi_gbl_FADT->pm_tm_len,
138 ACPI_FADT_OFFSET(pm_tm_len));
139 }
140
141 /* Length of GPE blocks must be a multiple of 2 */
142
143 if (acpi_gbl_FADT->xgpe0_blk.address &&
144 (acpi_gbl_FADT->gpe0_blk_len & 1)) {
145 acpi_ut_fadt_register_error("(x)GPE0_BLK_LEN",
146 (u32) acpi_gbl_FADT->gpe0_blk_len,
147 ACPI_FADT_OFFSET(gpe0_blk_len));
148 }
149
150 if (acpi_gbl_FADT->xgpe1_blk.address &&
151 (acpi_gbl_FADT->gpe1_blk_len & 1)) {
152 acpi_ut_fadt_register_error("(x)GPE1_BLK_LEN",
153 (u32) acpi_gbl_FADT->gpe1_blk_len,
154 ACPI_FADT_OFFSET(gpe1_blk_len));
155 }
156
157 return (AE_OK);
158}
159
160/****************************************************************************** 55/******************************************************************************
161 * 56 *
162 * FUNCTION: acpi_ut_terminate 57 * FUNCTION: acpi_ut_terminate
@@ -178,7 +73,6 @@ static void acpi_ut_terminate(void)
178 73
179 ACPI_FUNCTION_TRACE(ut_terminate); 74 ACPI_FUNCTION_TRACE(ut_terminate);
180 75
181 /* Free global tables, etc. */
182 /* Free global GPE blocks and related info structures */ 76 /* Free global GPE blocks and related info structures */
183 77
184 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; 78 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
@@ -239,6 +133,10 @@ void acpi_ut_subsystem_shutdown(void)
239 133
240 acpi_ns_terminate(); 134 acpi_ns_terminate();
241 135
136 /* Delete the ACPI tables */
137
138 acpi_tb_terminate();
139
242 /* Close the globals */ 140 /* Close the globals */
243 141
244 acpi_ut_terminate(); 142 acpi_ut_terminate();
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c
index 19d74bedce27..0c56a0d20b29 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 - 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
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 6d8a8211be90..50133fffe420 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 - 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
@@ -51,6 +51,78 @@ ACPI_MODULE_NAME("utmisc")
51 51
52/******************************************************************************* 52/*******************************************************************************
53 * 53 *
54 * FUNCTION: acpi_ut_validate_exception
55 *
56 * PARAMETERS: Status - The acpi_status code to be formatted
57 *
58 * RETURN: A string containing the exception text. NULL if exception is
59 * not valid.
60 *
61 * DESCRIPTION: This function validates and translates an ACPI exception into
62 * an ASCII string.
63 *
64 ******************************************************************************/
65const char *acpi_ut_validate_exception(acpi_status status)
66{
67 acpi_status sub_status;
68 const char *exception = NULL;
69
70 ACPI_FUNCTION_ENTRY();
71
72 /*
73 * Status is composed of two parts, a "type" and an actual code
74 */
75 sub_status = (status & ~AE_CODE_MASK);
76
77 switch (status & AE_CODE_MASK) {
78 case AE_CODE_ENVIRONMENTAL:
79
80 if (sub_status <= AE_CODE_ENV_MAX) {
81 exception = acpi_gbl_exception_names_env[sub_status];
82 }
83 break;
84
85 case AE_CODE_PROGRAMMER:
86
87 if (sub_status <= AE_CODE_PGM_MAX) {
88 exception =
89 acpi_gbl_exception_names_pgm[sub_status - 1];
90 }
91 break;
92
93 case AE_CODE_ACPI_TABLES:
94
95 if (sub_status <= AE_CODE_TBL_MAX) {
96 exception =
97 acpi_gbl_exception_names_tbl[sub_status - 1];
98 }
99 break;
100
101 case AE_CODE_AML:
102
103 if (sub_status <= AE_CODE_AML_MAX) {
104 exception =
105 acpi_gbl_exception_names_aml[sub_status - 1];
106 }
107 break;
108
109 case AE_CODE_CONTROL:
110
111 if (sub_status <= AE_CODE_CTRL_MAX) {
112 exception =
113 acpi_gbl_exception_names_ctrl[sub_status - 1];
114 }
115 break;
116
117 default:
118 break;
119 }
120
121 return (ACPI_CAST_PTR(const char, exception));
122}
123
124/*******************************************************************************
125 *
54 * FUNCTION: acpi_ut_is_aml_table 126 * FUNCTION: acpi_ut_is_aml_table
55 * 127 *
56 * PARAMETERS: Table - An ACPI table 128 * PARAMETERS: Table - An ACPI table
@@ -62,14 +134,15 @@ ACPI_MODULE_NAME("utmisc")
62 * data tables that do not contain AML code. 134 * data tables that do not contain AML code.
63 * 135 *
64 ******************************************************************************/ 136 ******************************************************************************/
137
65u8 acpi_ut_is_aml_table(struct acpi_table_header *table) 138u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
66{ 139{
67 140
68 /* These are the only tables that contain executable AML */ 141 /* These are the only tables that contain executable AML */
69 142
70 if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || 143 if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
71 ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || 144 ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
72 ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) { 145 ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
73 return (TRUE); 146 return (TRUE);
74 } 147 }
75 148
@@ -418,7 +491,7 @@ u32 acpi_ut_dword_byte_swap(u32 value)
418void acpi_ut_set_integer_width(u8 revision) 491void acpi_ut_set_integer_width(u8 revision)
419{ 492{
420 493
421 if (revision <= 1) { 494 if (revision < 2) {
422 495
423 /* 32-bit case */ 496 /* 32-bit case */
424 497
@@ -582,26 +655,25 @@ u8 acpi_ut_valid_acpi_name(u32 name)
582 * 655 *
583 ******************************************************************************/ 656 ******************************************************************************/
584 657
585acpi_name acpi_ut_repair_name(acpi_name name) 658acpi_name acpi_ut_repair_name(char *name)
586{ 659{
587 char *name_ptr = ACPI_CAST_PTR(char, &name);
588 char new_name[ACPI_NAME_SIZE];
589 acpi_native_uint i; 660 acpi_native_uint i;
661 char new_name[ACPI_NAME_SIZE];
590 662
591 for (i = 0; i < ACPI_NAME_SIZE; i++) { 663 for (i = 0; i < ACPI_NAME_SIZE; i++) {
592 new_name[i] = name_ptr[i]; 664 new_name[i] = name[i];
593 665
594 /* 666 /*
595 * Replace a bad character with something printable, yet technically 667 * Replace a bad character with something printable, yet technically
596 * still invalid. This prevents any collisions with existing "good" 668 * still invalid. This prevents any collisions with existing "good"
597 * names in the namespace. 669 * names in the namespace.
598 */ 670 */
599 if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) { 671 if (!acpi_ut_valid_acpi_char(name[i], i)) {
600 new_name[i] = '*'; 672 new_name[i] = '*';
601 } 673 }
602 } 674 }
603 675
604 return (*ACPI_CAST_PTR(u32, new_name)); 676 return (*(u32 *) new_name);
605} 677}
606 678
607/******************************************************************************* 679/*******************************************************************************
@@ -996,9 +1068,13 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...)
996{ 1068{
997 va_list args; 1069 va_list args;
998 1070
999 acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); 1071 /*
1072 * Removed module_name, line_number, and acpica version, not needed
1073 * for info output
1074 */
1075 acpi_os_printf("ACPI: ");
1000 1076
1001 va_start(args, format); 1077 va_start(args, format);
1002 acpi_os_vprintf(format, args); 1078 acpi_os_vprintf(format, args);
1003 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); 1079 acpi_os_printf("\n");
1004} 1080}
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index 180e73ceb6e2..cbad2ef5987d 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 - 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
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index ba7d8ac702df..4696124759e1 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 - 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
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 5a2de92831d3..e8fe1ba6cc24 100644
--- a/drivers/acpi/utilities/utresrc.c
+++ b/drivers/acpi/utilities/utresrc.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
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
index eaa13d05c859..edcaafad0a31 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 - 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
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index 3538f69c82a1..de3276f4f468 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 - 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
@@ -67,6 +67,7 @@ acpi_status acpi_initialize_subsystem(void)
67 67
68 ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); 68 ACPI_FUNCTION_TRACE(acpi_initialize_subsystem);
69 69
70 acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE;
70 ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); 71 ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
71 72
72 /* Initialize the OS-Dependent layer */ 73 /* Initialize the OS-Dependent layer */
@@ -127,20 +128,6 @@ acpi_status acpi_enable_subsystem(u32 flags)
127 128
128 ACPI_FUNCTION_TRACE(acpi_enable_subsystem); 129 ACPI_FUNCTION_TRACE(acpi_enable_subsystem);
129 130
130 /*
131 * We must initialize the hardware before we can enable ACPI.
132 * The values from the FADT are validated here.
133 */
134 if (!(flags & ACPI_NO_HARDWARE_INIT)) {
135 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
136 "[Init] Initializing ACPI hardware\n"));
137
138 status = acpi_hw_initialize();
139 if (ACPI_FAILURE(status)) {
140 return_ACPI_STATUS(status);
141 }
142 }
143
144 /* Enable ACPI mode */ 131 /* Enable ACPI mode */
145 132
146 if (!(flags & ACPI_NO_ACPI_ENABLE)) { 133 if (!(flags & ACPI_NO_ACPI_ENABLE)) {
@@ -398,7 +385,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
398{ 385{
399 struct acpi_system_info *info_ptr; 386 struct acpi_system_info *info_ptr;
400 acpi_status status; 387 acpi_status status;
401 u32 i;
402 388
403 ACPI_FUNCTION_TRACE(acpi_get_system_info); 389 ACPI_FUNCTION_TRACE(acpi_get_system_info);
404 390
@@ -431,9 +417,7 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
431 417
432 /* Timer resolution - 24 or 32 bits */ 418 /* Timer resolution - 24 or 32 bits */
433 419
434 if (!acpi_gbl_FADT) { 420 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; 421 info_ptr->timer_resolution = 24;
438 } else { 422 } else {
439 info_ptr->timer_resolution = 32; 423 info_ptr->timer_resolution = 32;
@@ -449,13 +433,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
449 info_ptr->debug_layer = acpi_dbg_layer; 433 info_ptr->debug_layer = acpi_dbg_layer;
450 info_ptr->debug_level = acpi_dbg_level; 434 info_ptr->debug_level = acpi_dbg_level;
451 435
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); 436 return_ACPI_STATUS(AE_OK);
460} 437}
461 438