aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utdebug.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-07-08 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-14 00:42:23 -0400
commitf9f4601f331aa1226d7a798a01950efbb388f07f (patch)
tree62e079a9275749d16a4a0da56a427be201e15d27 /drivers/acpi/utilities/utdebug.c
parent4c3ffbd79529b680b3c3ef2b6f42f0c89c694ec5 (diff)
ACPICA 20050708 from Bob Moore <robert.moore@intel.com>
The use of the CPU stack in the debug version of the subsystem has been considerably reduced. Previously, a debug structure was declared in every function that used the debug macros. This structure has been removed in favor of declaring the individual elements as parameters to the debug functions. This reduces the cumulative stack use during nested execution of ACPI function calls at the cost of a small increase in the code size of the debug version of the subsystem. With assistance from Alexey Starikovskiy and Len Brown. Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-dependent headers to define a macro that will return the current function name at runtime (such as __FUNCTION__ or _func_, etc.) The function name is used by the debug trace output. If ACPI_GET_FUNCTION_NAME is not defined in the compiler-dependent header, the function name is saved on the CPU stack (one pointer per function.) This mechanism is used because apparently there exists no standard ANSI-C defined macro that that returns the function name. Alexey Starikovskiy redesigned and reimplemented the "Owner ID" mechanism used to track namespace objects created/deleted by ACPI tables and control method execution. A bitmap is now used to allocate and free the IDs, thus solving the wraparound problem present in the previous implementation. The size of the namespace node descriptor was reduced by 2 bytes as a result. Removed the UINT32_BIT and UINT16_BIT types that were used for the bitfield flag definitions within the headers for the predefined ACPI tables. These have been replaced by UINT8_BIT in order to increase the code portability of the subsystem. If the use of UINT8 remains a problem, we may be forced to eliminate bitfields entirely because of a lack of portability. Alexey Starikovksiy enhanced the performance of acpi_ut_update_object_reference. This is a frequently used function and this improvement increases the performance of the entire subsystem. Alexey Starikovskiy fixed several possible memory leaks and the inverse - premature object deletion. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities/utdebug.c')
-rw-r--r--drivers/acpi/utilities/utdebug.c169
1 files changed, 94 insertions, 75 deletions
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 08362f686ec..3d5fbc810b0 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -116,10 +116,9 @@ acpi_ut_track_stack_ptr (
116 * 116 *
117 * PARAMETERS: requested_debug_level - Requested debug print level 117 * PARAMETERS: requested_debug_level - Requested debug print level
118 * line_number - Caller's line number (for error output) 118 * line_number - Caller's line number (for error output)
119 * dbg_info - Contains: 119 * function_name - Caller's procedure name
120 * proc_name - Caller's procedure name 120 * module_name - Caller's module name
121 * module_name - Caller's module name 121 * component_id - Caller's component ID
122 * component_id - Caller's component ID
123 * Format - Printf format field 122 * Format - Printf format field
124 * ... - Optional printf arguments 123 * ... - Optional printf arguments
125 * 124 *
@@ -134,7 +133,9 @@ void ACPI_INTERNAL_VAR_XFACE
134acpi_ut_debug_print ( 133acpi_ut_debug_print (
135 u32 requested_debug_level, 134 u32 requested_debug_level,
136 u32 line_number, 135 u32 line_number,
137 struct acpi_debug_print_info *dbg_info, 136 char *function_name,
137 char *module_name,
138 u32 component_id,
138 char *format, 139 char *format,
139 ...) 140 ...)
140{ 141{
@@ -146,7 +147,7 @@ acpi_ut_debug_print (
146 * Stay silent if the debug level or component ID is disabled 147 * Stay silent if the debug level or component ID is disabled
147 */ 148 */
148 if (!(requested_debug_level & acpi_dbg_level) || 149 if (!(requested_debug_level & acpi_dbg_level) ||
149 !(dbg_info->component_id & acpi_dbg_layer)) { 150 !(component_id & acpi_dbg_layer)) {
150 return; 151 return;
151 } 152 }
152 153
@@ -169,14 +170,14 @@ acpi_ut_debug_print (
169 * Display the module name, current line number, thread ID (if requested), 170 * Display the module name, current line number, thread ID (if requested),
170 * current procedure nesting level, and the current procedure name 171 * current procedure nesting level, and the current procedure name
171 */ 172 */
172 acpi_os_printf ("%8s-%04ld ", dbg_info->module_name, line_number); 173 acpi_os_printf ("%8s-%04ld ", module_name, line_number);
173 174
174 if (ACPI_LV_THREADS & acpi_dbg_level) { 175 if (ACPI_LV_THREADS & acpi_dbg_level) {
175 acpi_os_printf ("[%04lX] ", thread_id); 176 acpi_os_printf ("[%04lX] ", thread_id);
176 } 177 }
177 178
178 acpi_os_printf ("[%02ld] %-22.22s: ", 179 acpi_os_printf ("[%02ld] %-22.22s: ",
179 acpi_gbl_nesting_level, dbg_info->proc_name); 180 acpi_gbl_nesting_level, function_name);
180 181
181 va_start (args, format); 182 va_start (args, format);
182 acpi_os_vprintf (format, args); 183 acpi_os_vprintf (format, args);
@@ -190,10 +191,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
190 * 191 *
191 * PARAMETERS: requested_debug_level - Requested debug print level 192 * PARAMETERS: requested_debug_level - Requested debug print level
192 * line_number - Caller's line number 193 * line_number - Caller's line number
193 * dbg_info - Contains: 194 * function_name - Caller's procedure name
194 * proc_name - Caller's procedure name 195 * module_name - Caller's module name
195 * module_name - Caller's module name 196 * component_id - Caller's component ID
196 * component_id - Caller's component ID
197 * Format - Printf format field 197 * Format - Printf format field
198 * ... - Optional printf arguments 198 * ... - Optional printf arguments
199 * 199 *
@@ -208,7 +208,9 @@ void ACPI_INTERNAL_VAR_XFACE
208acpi_ut_debug_print_raw ( 208acpi_ut_debug_print_raw (
209 u32 requested_debug_level, 209 u32 requested_debug_level,
210 u32 line_number, 210 u32 line_number,
211 struct acpi_debug_print_info *dbg_info, 211 char *function_name,
212 char *module_name,
213 u32 component_id,
212 char *format, 214 char *format,
213 ...) 215 ...)
214{ 216{
@@ -216,7 +218,7 @@ acpi_ut_debug_print_raw (
216 218
217 219
218 if (!(requested_debug_level & acpi_dbg_level) || 220 if (!(requested_debug_level & acpi_dbg_level) ||
219 !(dbg_info->component_id & acpi_dbg_layer)) { 221 !(component_id & acpi_dbg_layer)) {
220 return; 222 return;
221 } 223 }
222 224
@@ -231,10 +233,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
231 * FUNCTION: acpi_ut_trace 233 * FUNCTION: acpi_ut_trace
232 * 234 *
233 * PARAMETERS: line_number - Caller's line number 235 * PARAMETERS: line_number - Caller's line number
234 * dbg_info - Contains: 236 * function_name - Caller's procedure name
235 * proc_name - Caller's procedure name 237 * module_name - Caller's module name
236 * module_name - Caller's module name 238 * component_id - Caller's component ID
237 * component_id - Caller's component ID
238 * 239 *
239 * RETURN: None 240 * RETURN: None
240 * 241 *
@@ -246,14 +247,17 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
246void 247void
247acpi_ut_trace ( 248acpi_ut_trace (
248 u32 line_number, 249 u32 line_number,
249 struct acpi_debug_print_info *dbg_info) 250 char *function_name,
251 char *module_name,
252 u32 component_id)
250{ 253{
251 254
252 acpi_gbl_nesting_level++; 255 acpi_gbl_nesting_level++;
253 acpi_ut_track_stack_ptr (); 256 acpi_ut_track_stack_ptr ();
254 257
255 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 258 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
256 "%s\n", acpi_gbl_fn_entry_str); 259 line_number, function_name, module_name, component_id,
260 "%s\n", acpi_gbl_fn_entry_str);
257} 261}
258EXPORT_SYMBOL(acpi_ut_trace); 262EXPORT_SYMBOL(acpi_ut_trace);
259 263
@@ -263,10 +267,9 @@ EXPORT_SYMBOL(acpi_ut_trace);
263 * FUNCTION: acpi_ut_trace_ptr 267 * FUNCTION: acpi_ut_trace_ptr
264 * 268 *
265 * PARAMETERS: line_number - Caller's line number 269 * PARAMETERS: line_number - Caller's line number
266 * dbg_info - Contains: 270 * function_name - Caller's procedure name
267 * proc_name - Caller's procedure name 271 * module_name - Caller's module name
268 * module_name - Caller's module name 272 * component_id - Caller's component ID
269 * component_id - Caller's component ID
270 * Pointer - Pointer to display 273 * Pointer - Pointer to display
271 * 274 *
272 * RETURN: None 275 * RETURN: None
@@ -279,14 +282,17 @@ EXPORT_SYMBOL(acpi_ut_trace);
279void 282void
280acpi_ut_trace_ptr ( 283acpi_ut_trace_ptr (
281 u32 line_number, 284 u32 line_number,
282 struct acpi_debug_print_info *dbg_info, 285 char *function_name,
286 char *module_name,
287 u32 component_id,
283 void *pointer) 288 void *pointer)
284{ 289{
285 acpi_gbl_nesting_level++; 290 acpi_gbl_nesting_level++;
286 acpi_ut_track_stack_ptr (); 291 acpi_ut_track_stack_ptr ();
287 292
288 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 293 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
289 "%s %p\n", acpi_gbl_fn_entry_str, pointer); 294 line_number, function_name, module_name, component_id,
295 "%s %p\n", acpi_gbl_fn_entry_str, pointer);
290} 296}
291 297
292 298
@@ -295,10 +301,9 @@ acpi_ut_trace_ptr (
295 * FUNCTION: acpi_ut_trace_str 301 * FUNCTION: acpi_ut_trace_str
296 * 302 *
297 * PARAMETERS: line_number - Caller's line number 303 * PARAMETERS: line_number - Caller's line number
298 * dbg_info - Contains: 304 * function_name - Caller's procedure name
299 * proc_name - Caller's procedure name 305 * module_name - Caller's module name
300 * module_name - Caller's module name 306 * component_id - Caller's component ID
301 * component_id - Caller's component ID
302 * String - Additional string to display 307 * String - Additional string to display
303 * 308 *
304 * RETURN: None 309 * RETURN: None
@@ -311,15 +316,18 @@ acpi_ut_trace_ptr (
311void 316void
312acpi_ut_trace_str ( 317acpi_ut_trace_str (
313 u32 line_number, 318 u32 line_number,
314 struct acpi_debug_print_info *dbg_info, 319 char *function_name,
320 char *module_name,
321 u32 component_id,
315 char *string) 322 char *string)
316{ 323{
317 324
318 acpi_gbl_nesting_level++; 325 acpi_gbl_nesting_level++;
319 acpi_ut_track_stack_ptr (); 326 acpi_ut_track_stack_ptr ();
320 327
321 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 328 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
322 "%s %s\n", acpi_gbl_fn_entry_str, string); 329 line_number, function_name, module_name, component_id,
330 "%s %s\n", acpi_gbl_fn_entry_str, string);
323} 331}
324 332
325 333
@@ -328,10 +336,9 @@ acpi_ut_trace_str (
328 * FUNCTION: acpi_ut_trace_u32 336 * FUNCTION: acpi_ut_trace_u32
329 * 337 *
330 * PARAMETERS: line_number - Caller's line number 338 * PARAMETERS: line_number - Caller's line number
331 * dbg_info - Contains: 339 * function_name - Caller's procedure name
332 * proc_name - Caller's procedure name 340 * module_name - Caller's module name
333 * module_name - Caller's module name 341 * component_id - Caller's component ID
334 * component_id - Caller's component ID
335 * Integer - Integer to display 342 * Integer - Integer to display
336 * 343 *
337 * RETURN: None 344 * RETURN: None
@@ -344,15 +351,18 @@ acpi_ut_trace_str (
344void 351void
345acpi_ut_trace_u32 ( 352acpi_ut_trace_u32 (
346 u32 line_number, 353 u32 line_number,
347 struct acpi_debug_print_info *dbg_info, 354 char *function_name,
355 char *module_name,
356 u32 component_id,
348 u32 integer) 357 u32 integer)
349{ 358{
350 359
351 acpi_gbl_nesting_level++; 360 acpi_gbl_nesting_level++;
352 acpi_ut_track_stack_ptr (); 361 acpi_ut_track_stack_ptr ();
353 362
354 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 363 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
355 "%s %08X\n", acpi_gbl_fn_entry_str, integer); 364 line_number, function_name, module_name, component_id,
365 "%s %08X\n", acpi_gbl_fn_entry_str, integer);
356} 366}
357 367
358 368
@@ -361,10 +371,9 @@ acpi_ut_trace_u32 (
361 * FUNCTION: acpi_ut_exit 371 * FUNCTION: acpi_ut_exit
362 * 372 *
363 * PARAMETERS: line_number - Caller's line number 373 * PARAMETERS: line_number - Caller's line number
364 * dbg_info - Contains: 374 * function_name - Caller's procedure name
365 * proc_name - Caller's procedure name 375 * module_name - Caller's module name
366 * module_name - Caller's module name 376 * component_id - Caller's component ID
367 * component_id - Caller's component ID
368 * 377 *
369 * RETURN: None 378 * RETURN: None
370 * 379 *
@@ -376,11 +385,14 @@ acpi_ut_trace_u32 (
376void 385void
377acpi_ut_exit ( 386acpi_ut_exit (
378 u32 line_number, 387 u32 line_number,
379 struct acpi_debug_print_info *dbg_info) 388 char *function_name,
389 char *module_name,
390 u32 component_id)
380{ 391{
381 392
382 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 393 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
383 "%s\n", acpi_gbl_fn_exit_str); 394 line_number, function_name, module_name, component_id,
395 "%s\n", acpi_gbl_fn_exit_str);
384 396
385 acpi_gbl_nesting_level--; 397 acpi_gbl_nesting_level--;
386} 398}
@@ -392,10 +404,9 @@ EXPORT_SYMBOL(acpi_ut_exit);
392 * FUNCTION: acpi_ut_status_exit 404 * FUNCTION: acpi_ut_status_exit
393 * 405 *
394 * PARAMETERS: line_number - Caller's line number 406 * PARAMETERS: line_number - Caller's line number
395 * dbg_info - Contains: 407 * function_name - Caller's procedure name
396 * proc_name - Caller's procedure name 408 * module_name - Caller's module name
397 * module_name - Caller's module name 409 * component_id - Caller's component ID
398 * component_id - Caller's component ID
399 * Status - Exit status code 410 * Status - Exit status code
400 * 411 *
401 * RETURN: None 412 * RETURN: None
@@ -408,19 +419,23 @@ EXPORT_SYMBOL(acpi_ut_exit);
408void 419void
409acpi_ut_status_exit ( 420acpi_ut_status_exit (
410 u32 line_number, 421 u32 line_number,
411 struct acpi_debug_print_info *dbg_info, 422 char *function_name,
423 char *module_name,
424 u32 component_id,
412 acpi_status status) 425 acpi_status status)
413{ 426{
414 427
415 if (ACPI_SUCCESS (status)) { 428 if (ACPI_SUCCESS (status)) {
416 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 429 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
417 "%s %s\n", acpi_gbl_fn_exit_str, 430 line_number, function_name, module_name, component_id,
418 acpi_format_exception (status)); 431 "%s %s\n", acpi_gbl_fn_exit_str,
432 acpi_format_exception (status));
419 } 433 }
420 else { 434 else {
421 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 435 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
422 "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str, 436 line_number, function_name, module_name, component_id,
423 acpi_format_exception (status)); 437 "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str,
438 acpi_format_exception (status));
424 } 439 }
425 440
426 acpi_gbl_nesting_level--; 441 acpi_gbl_nesting_level--;
@@ -433,10 +448,9 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
433 * FUNCTION: acpi_ut_value_exit 448 * FUNCTION: acpi_ut_value_exit
434 * 449 *
435 * PARAMETERS: line_number - Caller's line number 450 * PARAMETERS: line_number - Caller's line number
436 * dbg_info - Contains: 451 * function_name - Caller's procedure name
437 * proc_name - Caller's procedure name 452 * module_name - Caller's module name
438 * module_name - Caller's module name 453 * component_id - Caller's component ID
439 * component_id - Caller's component ID
440 * Value - Value to be printed with exit msg 454 * Value - Value to be printed with exit msg
441 * 455 *
442 * RETURN: None 456 * RETURN: None
@@ -449,13 +463,16 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
449void 463void
450acpi_ut_value_exit ( 464acpi_ut_value_exit (
451 u32 line_number, 465 u32 line_number,
452 struct acpi_debug_print_info *dbg_info, 466 char *function_name,
467 char *module_name,
468 u32 component_id,
453 acpi_integer value) 469 acpi_integer value)
454{ 470{
455 471
456 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 472 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
457 "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, 473 line_number, function_name, module_name, component_id,
458 ACPI_FORMAT_UINT64 (value)); 474 "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
475 ACPI_FORMAT_UINT64 (value));
459 476
460 acpi_gbl_nesting_level--; 477 acpi_gbl_nesting_level--;
461} 478}
@@ -467,10 +484,9 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
467 * FUNCTION: acpi_ut_ptr_exit 484 * FUNCTION: acpi_ut_ptr_exit
468 * 485 *
469 * PARAMETERS: line_number - Caller's line number 486 * PARAMETERS: line_number - Caller's line number
470 * dbg_info - Contains: 487 * function_name - Caller's procedure name
471 * proc_name - Caller's procedure name 488 * module_name - Caller's module name
472 * module_name - Caller's module name 489 * component_id - Caller's component ID
473 * component_id - Caller's component ID
474 * Ptr - Pointer to display 490 * Ptr - Pointer to display
475 * 491 *
476 * RETURN: None 492 * RETURN: None
@@ -483,12 +499,15 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
483void 499void
484acpi_ut_ptr_exit ( 500acpi_ut_ptr_exit (
485 u32 line_number, 501 u32 line_number,
486 struct acpi_debug_print_info *dbg_info, 502 char *function_name,
503 char *module_name,
504 u32 component_id,
487 u8 *ptr) 505 u8 *ptr)
488{ 506{
489 507
490 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 508 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
491 "%s %p\n", acpi_gbl_fn_exit_str, ptr); 509 line_number, function_name, module_name, component_id,
510 "%s %p\n", acpi_gbl_fn_exit_str, ptr);
492 511
493 acpi_gbl_nesting_level--; 512 acpi_gbl_nesting_level--;
494} 513}