aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-07-29 18:15:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-30 00:51:39 -0400
commit0c9938cc75057c0fca1af55a55dcfc2842436695 (patch)
treed18e809bf9e3811f20c609b6515d4d1b8520cfbc /drivers/acpi/utilities
parentdd8f39bbf5154cdbfd698fc70c66faba33eafa44 (diff)
[ACPI] ACPICA 20050729 from Bob Moore
Implemented support to ignore an attempt to install/load a particular ACPI table more than once. Apparently there exists BIOS code that repeatedly attempts to load the same SSDT upon certain events. Thanks to Venkatesh Pallipadi. Restructured the main interface to the AML parser in order to correctly handle all exceptional conditions. This will prevent leakage of the OwnerId resource and should eliminate the AE_OWNER_ID_LIMIT exceptions seen on some machines. Thanks to Alexey Starikovskiy. Support for "module level code" has been disabled in this version due to a number of issues that have appeared on various machines. The support can be enabled by defining ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem compilation. When the issues are fully resolved, the code will be enabled by default again. Modified the internal functions for debug print support to define the FunctionName parameter as a (const char *) for compatibility with compiler built-in macros such as __FUNCTION__, etc. Linted the entire ACPICA source tree for both 32-bit and 64-bit. Signed-off-by: Robert Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utalloc.c4
-rw-r--r--drivers/acpi/utilities/utdebug.c77
-rw-r--r--drivers/acpi/utilities/utmisc.c58
3 files changed, 101 insertions, 38 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 5061c6f0ee66..78270f50e625 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -76,7 +76,7 @@ static acpi_status
76acpi_ut_create_list ( 76acpi_ut_create_list (
77 char *list_name, 77 char *list_name,
78 u16 object_size, 78 u16 object_size,
79 acpi_handle *return_cache); 79 struct acpi_memory_list **return_cache);
80#endif 80#endif
81 81
82 82
@@ -428,7 +428,7 @@ static acpi_status
428acpi_ut_create_list ( 428acpi_ut_create_list (
429 char *list_name, 429 char *list_name,
430 u16 object_size, 430 u16 object_size,
431 acpi_handle *return_cache) 431 struct acpi_memory_list **return_cache)
432{ 432{
433 struct acpi_memory_list *cache; 433 struct acpi_memory_list *cache;
434 434
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 3d5fbc810b0b..c27cbb7f5c54 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -55,6 +55,12 @@ static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF;
55static char *acpi_gbl_fn_entry_str = "----Entry"; 55static char *acpi_gbl_fn_entry_str = "----Entry";
56static char *acpi_gbl_fn_exit_str = "----Exit-"; 56static char *acpi_gbl_fn_exit_str = "----Exit-";
57 57
58/* Local prototypes */
59
60static const char *
61acpi_ut_trim_function_name (
62 const char *function_name);
63
58 64
59/******************************************************************************* 65/*******************************************************************************
60 * 66 *
@@ -72,7 +78,7 @@ void
72acpi_ut_init_stack_ptr_trace ( 78acpi_ut_init_stack_ptr_trace (
73 void) 79 void)
74{ 80{
75 u32 current_sp; 81 u32 current_sp;
76 82
77 83
78 acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (&current_sp, NULL); 84 acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (&current_sp, NULL);
@@ -95,7 +101,7 @@ void
95acpi_ut_track_stack_ptr ( 101acpi_ut_track_stack_ptr (
96 void) 102 void)
97{ 103{
98 acpi_size current_sp; 104 acpi_size current_sp;
99 105
100 106
101 current_sp = ACPI_PTR_DIFF (&current_sp, NULL); 107 current_sp = ACPI_PTR_DIFF (&current_sp, NULL);
@@ -112,6 +118,43 @@ acpi_ut_track_stack_ptr (
112 118
113/******************************************************************************* 119/*******************************************************************************
114 * 120 *
121 * FUNCTION: acpi_ut_trim_function_name
122 *
123 * PARAMETERS: function_name - Ascii string containing a procedure name
124 *
125 * RETURN: Updated pointer to the function name
126 *
127 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
128 * This allows compiler macros such as __FUNCTION__ to be used
129 * with no change to the debug output.
130 *
131 ******************************************************************************/
132
133static const char *
134acpi_ut_trim_function_name (
135 const char *function_name)
136{
137
138 /* All Function names are longer than 4 chars, check is safe */
139
140 if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX1) {
141 /* This is the case where the original source has not been modified */
142
143 return (function_name + 4);
144 }
145
146 if (*(ACPI_CAST_PTR (u32, function_name)) == ACPI_FUNCTION_PREFIX2) {
147 /* This is the case where the source has been 'linuxized' */
148
149 return (function_name + 5);
150 }
151
152 return (function_name);
153}
154
155
156/*******************************************************************************
157 *
115 * FUNCTION: acpi_ut_debug_print 158 * FUNCTION: acpi_ut_debug_print
116 * 159 *
117 * PARAMETERS: requested_debug_level - Requested debug print level 160 * PARAMETERS: requested_debug_level - Requested debug print level
@@ -133,7 +176,7 @@ void ACPI_INTERNAL_VAR_XFACE
133acpi_ut_debug_print ( 176acpi_ut_debug_print (
134 u32 requested_debug_level, 177 u32 requested_debug_level,
135 u32 line_number, 178 u32 line_number,
136 char *function_name, 179 const char *function_name,
137 char *module_name, 180 char *module_name,
138 u32 component_id, 181 u32 component_id,
139 char *format, 182 char *format,
@@ -177,7 +220,7 @@ acpi_ut_debug_print (
177 } 220 }
178 221
179 acpi_os_printf ("[%02ld] %-22.22s: ", 222 acpi_os_printf ("[%02ld] %-22.22s: ",
180 acpi_gbl_nesting_level, function_name); 223 acpi_gbl_nesting_level, acpi_ut_trim_function_name (function_name));
181 224
182 va_start (args, format); 225 va_start (args, format);
183 acpi_os_vprintf (format, args); 226 acpi_os_vprintf (format, args);
@@ -208,7 +251,7 @@ void ACPI_INTERNAL_VAR_XFACE
208acpi_ut_debug_print_raw ( 251acpi_ut_debug_print_raw (
209 u32 requested_debug_level, 252 u32 requested_debug_level,
210 u32 line_number, 253 u32 line_number,
211 char *function_name, 254 const char *function_name,
212 char *module_name, 255 char *module_name,
213 u32 component_id, 256 u32 component_id,
214 char *format, 257 char *format,
@@ -247,7 +290,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
247void 290void
248acpi_ut_trace ( 291acpi_ut_trace (
249 u32 line_number, 292 u32 line_number,
250 char *function_name, 293 const char *function_name,
251 char *module_name, 294 char *module_name,
252 u32 component_id) 295 u32 component_id)
253{ 296{
@@ -282,7 +325,7 @@ EXPORT_SYMBOL(acpi_ut_trace);
282void 325void
283acpi_ut_trace_ptr ( 326acpi_ut_trace_ptr (
284 u32 line_number, 327 u32 line_number,
285 char *function_name, 328 const char *function_name,
286 char *module_name, 329 char *module_name,
287 u32 component_id, 330 u32 component_id,
288 void *pointer) 331 void *pointer)
@@ -316,7 +359,7 @@ acpi_ut_trace_ptr (
316void 359void
317acpi_ut_trace_str ( 360acpi_ut_trace_str (
318 u32 line_number, 361 u32 line_number,
319 char *function_name, 362 const char *function_name,
320 char *module_name, 363 char *module_name,
321 u32 component_id, 364 u32 component_id,
322 char *string) 365 char *string)
@@ -351,7 +394,7 @@ acpi_ut_trace_str (
351void 394void
352acpi_ut_trace_u32 ( 395acpi_ut_trace_u32 (
353 u32 line_number, 396 u32 line_number,
354 char *function_name, 397 const char *function_name,
355 char *module_name, 398 char *module_name,
356 u32 component_id, 399 u32 component_id,
357 u32 integer) 400 u32 integer)
@@ -385,7 +428,7 @@ acpi_ut_trace_u32 (
385void 428void
386acpi_ut_exit ( 429acpi_ut_exit (
387 u32 line_number, 430 u32 line_number,
388 char *function_name, 431 const char *function_name,
389 char *module_name, 432 char *module_name,
390 u32 component_id) 433 u32 component_id)
391{ 434{
@@ -419,7 +462,7 @@ EXPORT_SYMBOL(acpi_ut_exit);
419void 462void
420acpi_ut_status_exit ( 463acpi_ut_status_exit (
421 u32 line_number, 464 u32 line_number,
422 char *function_name, 465 const char *function_name,
423 char *module_name, 466 char *module_name,
424 u32 component_id, 467 u32 component_id,
425 acpi_status status) 468 acpi_status status)
@@ -463,7 +506,7 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
463void 506void
464acpi_ut_value_exit ( 507acpi_ut_value_exit (
465 u32 line_number, 508 u32 line_number,
466 char *function_name, 509 const char *function_name,
467 char *module_name, 510 char *module_name,
468 u32 component_id, 511 u32 component_id,
469 acpi_integer value) 512 acpi_integer value)
@@ -499,7 +542,7 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
499void 542void
500acpi_ut_ptr_exit ( 543acpi_ut_ptr_exit (
501 u32 line_number, 544 u32 line_number,
502 char *function_name, 545 const char *function_name,
503 char *module_name, 546 char *module_name,
504 u32 component_id, 547 u32 component_id,
505 u8 *ptr) 548 u8 *ptr)
@@ -607,8 +650,8 @@ acpi_ut_dump_buffer (
607 } 650 }
608 651
609 /* 652 /*
610 * Print the ASCII equivalent characters 653 * Print the ASCII equivalent characters but watch out for the bad
611 * But watch out for the bad unprintable ones... 654 * unprintable ones (printable chars are 0x20 through 0x7E)
612 */ 655 */
613 acpi_os_printf (" "); 656 acpi_os_printf (" ");
614 for (j = 0; j < 16; j++) { 657 for (j = 0; j < 16; j++) {
@@ -618,9 +661,7 @@ acpi_ut_dump_buffer (
618 } 661 }
619 662
620 buf_char = buffer[i + j]; 663 buf_char = buffer[i + j];
621 if ((buf_char > 0x1F && buf_char < 0x2E) || 664 if (ACPI_IS_PRINT (buf_char)) {
622 (buf_char > 0x2F && buf_char < 0x61) ||
623 (buf_char > 0x60 && buf_char < 0x7F)) {
624 acpi_os_printf ("%c", buf_char); 665 acpi_os_printf ("%c", buf_char);
625 } 666 }
626 else { 667 else {
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index df715cd89105..1d350b302a34 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -56,7 +56,11 @@
56 * 56 *
57 * PARAMETERS: owner_id - Where the new owner ID is returned 57 * PARAMETERS: owner_id - Where the new owner ID is returned
58 * 58 *
59 * DESCRIPTION: Allocate a table or method owner id 59 * RETURN: Status
60 *
61 * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
62 * track objects created by the table or method, to be deleted
63 * when the method exits or the table is unloaded.
60 * 64 *
61 ******************************************************************************/ 65 ******************************************************************************/
62 66
@@ -71,6 +75,8 @@ acpi_ut_allocate_owner_id (
71 ACPI_FUNCTION_TRACE ("ut_allocate_owner_id"); 75 ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
72 76
73 77
78 /* Mutex for the global ID mask */
79
74 status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); 80 status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
75 if (ACPI_FAILURE (status)) { 81 if (ACPI_FAILURE (status)) {
76 return_ACPI_STATUS (status); 82 return_ACPI_STATUS (status);
@@ -81,7 +87,7 @@ acpi_ut_allocate_owner_id (
81 for (i = 0; i < 32; i++) { 87 for (i = 0; i < 32; i++) {
82 if (!(acpi_gbl_owner_id_mask & (1 << i))) { 88 if (!(acpi_gbl_owner_id_mask & (1 << i))) {
83 acpi_gbl_owner_id_mask |= (1 << i); 89 acpi_gbl_owner_id_mask |= (1 << i);
84 *owner_id = (acpi_owner_id) i; 90 *owner_id = (acpi_owner_id) (i + 1);
85 goto exit; 91 goto exit;
86 } 92 }
87 } 93 }
@@ -93,6 +99,7 @@ acpi_ut_allocate_owner_id (
93 * they are released when a table is unloaded or a method completes 99 * they are released when a table is unloaded or a method completes
94 * execution. 100 * execution.
95 */ 101 */
102 *owner_id = 0;
96 status = AE_OWNER_ID_LIMIT; 103 status = AE_OWNER_ID_LIMIT;
97 ACPI_REPORT_ERROR (( 104 ACPI_REPORT_ERROR ((
98 "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); 105 "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n"));
@@ -107,40 +114,55 @@ exit:
107 * 114 *
108 * FUNCTION: acpi_ut_release_owner_id 115 * FUNCTION: acpi_ut_release_owner_id
109 * 116 *
110 * PARAMETERS: owner_id - A previously allocated owner ID 117 * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD
111 * 118 *
112 * DESCRIPTION: Release a table or method owner id 119 * RETURN: None. No error is returned because we are either exiting a
120 * control method or unloading a table. Either way, we would
121 * ignore any error anyway.
122 *
123 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 32
113 * 124 *
114 ******************************************************************************/ 125 ******************************************************************************/
115 126
116acpi_status 127void
117acpi_ut_release_owner_id ( 128acpi_ut_release_owner_id (
118 acpi_owner_id owner_id) 129 acpi_owner_id *owner_id_ptr)
119{ 130{
131 acpi_owner_id owner_id = *owner_id_ptr;
120 acpi_status status; 132 acpi_status status;
121 133
122 134
123 ACPI_FUNCTION_TRACE ("ut_release_owner_id"); 135 ACPI_FUNCTION_TRACE ("ut_release_owner_id");
124 136
125 137
138 /* Always clear the input owner_id (zero is an invalid ID) */
139
140 *owner_id_ptr = 0;
141
142 /* Zero is not a valid owner_iD */
143
144 if ((owner_id == 0) || (owner_id > 32)) {
145 ACPI_REPORT_ERROR (("Invalid owner_id: %2.2X\n", owner_id));
146 return_VOID;
147 }
148
149 /* Mutex for the global ID mask */
150
126 status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES); 151 status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
127 if (ACPI_FAILURE (status)) { 152 if (ACPI_FAILURE (status)) {
128 return_ACPI_STATUS (status); 153 return_VOID;
129 } 154 }
130 155
131 /* Free the owner ID */ 156 owner_id--; /* Normalize to zero */
157
158 /* Free the owner ID only if it is valid */
132 159
133 if (acpi_gbl_owner_id_mask & (1 << owner_id)) { 160 if (acpi_gbl_owner_id_mask & (1 << owner_id)) {
134 acpi_gbl_owner_id_mask ^= (1 << owner_id); 161 acpi_gbl_owner_id_mask ^= (1 << owner_id);
135 } 162 }
136 else {
137 /* This owner_id has not been allocated */
138
139 status = AE_NOT_EXIST;
140 }
141 163
142 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); 164 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
143 return_ACPI_STATUS (status); 165 return_VOID;
144} 166}
145 167
146 168
@@ -150,7 +172,7 @@ acpi_ut_release_owner_id (
150 * 172 *
151 * PARAMETERS: src_string - The source string to convert 173 * PARAMETERS: src_string - The source string to convert
152 * 174 *
153 * RETURN: Converted src_string (same as input pointer) 175 * RETURN: None
154 * 176 *
155 * DESCRIPTION: Convert string to uppercase 177 * DESCRIPTION: Convert string to uppercase
156 * 178 *
@@ -158,7 +180,7 @@ acpi_ut_release_owner_id (
158 * 180 *
159 ******************************************************************************/ 181 ******************************************************************************/
160 182
161char * 183void
162acpi_ut_strupr ( 184acpi_ut_strupr (
163 char *src_string) 185 char *src_string)
164{ 186{
@@ -169,7 +191,7 @@ acpi_ut_strupr (
169 191
170 192
171 if (!src_string) { 193 if (!src_string) {
172 return (NULL); 194 return;
173 } 195 }
174 196
175 /* Walk entire string, uppercasing the letters */ 197 /* Walk entire string, uppercasing the letters */
@@ -178,7 +200,7 @@ acpi_ut_strupr (
178 *string = (char) ACPI_TOUPPER (*string); 200 *string = (char) ACPI_TOUPPER (*string);
179 } 201 }
180 202
181 return (src_string); 203 return;
182} 204}
183 205
184 206