diff options
Diffstat (limited to 'drivers/acpi/utilities/utdebug.c')
| -rw-r--r-- | drivers/acpi/utilities/utdebug.c | 77 |
1 files changed, 59 insertions, 18 deletions
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; | |||
| 55 | static char *acpi_gbl_fn_entry_str = "----Entry"; | 55 | static char *acpi_gbl_fn_entry_str = "----Entry"; |
| 56 | static char *acpi_gbl_fn_exit_str = "----Exit-"; | 56 | static char *acpi_gbl_fn_exit_str = "----Exit-"; |
| 57 | 57 | ||
| 58 | /* Local prototypes */ | ||
| 59 | |||
| 60 | static const char * | ||
| 61 | acpi_ut_trim_function_name ( | ||
| 62 | const char *function_name); | ||
| 63 | |||
| 58 | 64 | ||
| 59 | /******************************************************************************* | 65 | /******************************************************************************* |
| 60 | * | 66 | * |
| @@ -72,7 +78,7 @@ void | |||
| 72 | acpi_ut_init_stack_ptr_trace ( | 78 | acpi_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 (¤t_sp, NULL); | 84 | acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (¤t_sp, NULL); |
| @@ -95,7 +101,7 @@ void | |||
| 95 | acpi_ut_track_stack_ptr ( | 101 | acpi_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 (¤t_sp, NULL); | 107 | current_sp = ACPI_PTR_DIFF (¤t_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 | |||
| 133 | static const char * | ||
| 134 | acpi_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 | |||
| 133 | acpi_ut_debug_print ( | 176 | acpi_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 | |||
| 208 | acpi_ut_debug_print_raw ( | 251 | acpi_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); | |||
| 247 | void | 290 | void |
| 248 | acpi_ut_trace ( | 291 | acpi_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); | |||
| 282 | void | 325 | void |
| 283 | acpi_ut_trace_ptr ( | 326 | acpi_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 ( | |||
| 316 | void | 359 | void |
| 317 | acpi_ut_trace_str ( | 360 | acpi_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 ( | |||
| 351 | void | 394 | void |
| 352 | acpi_ut_trace_u32 ( | 395 | acpi_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 ( | |||
| 385 | void | 428 | void |
| 386 | acpi_ut_exit ( | 429 | acpi_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); | |||
| 419 | void | 462 | void |
| 420 | acpi_ut_status_exit ( | 463 | acpi_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); | |||
| 463 | void | 506 | void |
| 464 | acpi_ut_value_exit ( | 507 | acpi_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); | |||
| 499 | void | 542 | void |
| 500 | acpi_ut_ptr_exit ( | 543 | acpi_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 { |
