Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: utdebug - Debug print routines |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | a8357b0 | 2010-01-22 19:07:36 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions, and the following disclaimer, |
| 16 | * without modification. |
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 20 | * including a substantially similar Disclaimer requirement for further |
| 21 | * binary redistribution. |
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 23 | * of any contributors may be used to endorse or promote products derived |
| 24 | * from this software without specific prior written permission. |
| 25 | * |
| 26 | * Alternatively, this software may be distributed under the terms of the |
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 28 | * Software Foundation. |
| 29 | * |
| 30 | * NO WARRANTY |
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ |
| 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 45 | #include "accommon.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
| 47 | #define _COMPONENT ACPI_UTILITIES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 48 | ACPI_MODULE_NAME("utdebug") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #ifdef ACPI_DEBUG_OUTPUT |
Len Brown | ab8aa06 | 2006-07-07 20:11:07 -0400 | [diff] [blame] | 50 | static acpi_thread_id acpi_gbl_prev_thread_id; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 51 | static char *acpi_gbl_fn_entry_str = "----Entry"; |
| 52 | static char *acpi_gbl_fn_exit_str = "----Exit-"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 54 | /* Local prototypes */ |
| 55 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 56 | static const char *acpi_ut_trim_function_name(const char *function_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 58 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | * |
| 60 | * FUNCTION: acpi_ut_init_stack_ptr_trace |
| 61 | * |
| 62 | * PARAMETERS: None |
| 63 | * |
| 64 | * RETURN: None |
| 65 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 66 | * DESCRIPTION: Save the current CPU stack pointer at subsystem startup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 68 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 70 | void acpi_ut_init_stack_ptr_trace(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | { |
Bob Moore | 1d18c05 | 2008-04-10 19:06:40 +0400 | [diff] [blame] | 72 | acpi_size current_sp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
Bob Moore | 1d18c05 | 2008-04-10 19:06:40 +0400 | [diff] [blame] | 74 | acpi_gbl_entry_stack_pointer = ¤t_sp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | } |
| 76 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 77 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | * |
| 79 | * FUNCTION: acpi_ut_track_stack_ptr |
| 80 | * |
| 81 | * PARAMETERS: None |
| 82 | * |
| 83 | * RETURN: None |
| 84 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 85 | * DESCRIPTION: Save the current CPU stack pointer |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 87 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 89 | void acpi_ut_track_stack_ptr(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 91 | acpi_size current_sp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | |
Bob Moore | 1d18c05 | 2008-04-10 19:06:40 +0400 | [diff] [blame] | 93 | if (¤t_sp < acpi_gbl_lowest_stack_pointer) { |
| 94 | acpi_gbl_lowest_stack_pointer = ¤t_sp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) { |
| 98 | acpi_gbl_deepest_nesting = acpi_gbl_nesting_level; |
| 99 | } |
| 100 | } |
| 101 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 102 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | * |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 104 | * FUNCTION: acpi_ut_trim_function_name |
| 105 | * |
| 106 | * PARAMETERS: function_name - Ascii string containing a procedure name |
| 107 | * |
| 108 | * RETURN: Updated pointer to the function name |
| 109 | * |
| 110 | * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. |
Harvey Harrison | 96b2dd1 | 2008-03-05 18:24:51 -0800 | [diff] [blame] | 111 | * This allows compiler macros such as __func__ to be used |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 112 | * with no change to the debug output. |
| 113 | * |
| 114 | ******************************************************************************/ |
| 115 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 116 | static const char *acpi_ut_trim_function_name(const char *function_name) |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 117 | { |
| 118 | |
| 119 | /* All Function names are longer than 4 chars, check is safe */ |
| 120 | |
Bob Moore | a18ecf4 | 2005-08-15 03:42:00 -0800 | [diff] [blame] | 121 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 122 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 123 | /* This is the case where the original source has not been modified */ |
| 124 | |
| 125 | return (function_name + 4); |
| 126 | } |
| 127 | |
Bob Moore | a18ecf4 | 2005-08-15 03:42:00 -0800 | [diff] [blame] | 128 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 129 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 130 | /* This is the case where the source has been 'linuxized' */ |
| 131 | |
| 132 | return (function_name + 5); |
| 133 | } |
| 134 | |
| 135 | return (function_name); |
| 136 | } |
| 137 | |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 138 | /******************************************************************************* |
| 139 | * |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 140 | * FUNCTION: acpi_debug_print |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 142 | * PARAMETERS: requested_debug_level - Requested debug print level |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | * line_number - Caller's line number (for error output) |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 144 | * function_name - Caller's procedure name |
| 145 | * module_name - Caller's module name |
| 146 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | * Format - Printf format field |
| 148 | * ... - Optional printf arguments |
| 149 | * |
| 150 | * RETURN: None |
| 151 | * |
| 152 | * DESCRIPTION: Print error message with prefix consisting of the module name, |
| 153 | * line number, and component ID. |
| 154 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 155 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 157 | void ACPI_INTERNAL_VAR_XFACE |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 158 | acpi_debug_print(u32 requested_debug_level, |
| 159 | u32 line_number, |
| 160 | const char *function_name, |
| 161 | const char *module_name, |
| 162 | u32 component_id, const char *format, ...) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | { |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 164 | acpi_thread_id thread_id; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 165 | va_list args; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | |
| 167 | /* |
| 168 | * Stay silent if the debug level or component ID is disabled |
| 169 | */ |
| 170 | if (!(requested_debug_level & acpi_dbg_level) || |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 171 | !(component_id & acpi_dbg_layer)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | return; |
| 173 | } |
| 174 | |
| 175 | /* |
| 176 | * Thread tracking and context switch notification |
| 177 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 178 | thread_id = acpi_os_get_thread_id(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | if (thread_id != acpi_gbl_prev_thread_id) { |
| 180 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 181 | acpi_os_printf |
Lin Ming | 28eb3fc | 2010-09-15 13:55:13 +0800 | [diff] [blame^] | 182 | ("\n**** Context Switch from TID %u to TID %u ****\n\n", |
| 183 | (u32)acpi_gbl_prev_thread_id, (u32)thread_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | acpi_gbl_prev_thread_id = thread_id; |
| 187 | } |
| 188 | |
| 189 | /* |
| 190 | * Display the module name, current line number, thread ID (if requested), |
| 191 | * current procedure nesting level, and the current procedure name |
| 192 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 193 | acpi_os_printf("%8s-%04ld ", module_name, line_number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | |
| 195 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
Lin Ming | 28eb3fc | 2010-09-15 13:55:13 +0800 | [diff] [blame^] | 196 | acpi_os_printf("[%u] ", (u32)thread_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | } |
| 198 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 199 | acpi_os_printf("[%02ld] %-22.22s: ", |
| 200 | acpi_gbl_nesting_level, |
| 201 | acpi_ut_trim_function_name(function_name)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 203 | va_start(args, format); |
| 204 | acpi_os_vprintf(format, args); |
Bob Moore | 507f046 | 2008-04-10 19:06:42 +0400 | [diff] [blame] | 205 | va_end(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 207 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 208 | ACPI_EXPORT_SYMBOL(acpi_debug_print) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 210 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | * |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 212 | * FUNCTION: acpi_debug_print_raw |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | * |
| 214 | * PARAMETERS: requested_debug_level - Requested debug print level |
| 215 | * line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 216 | * function_name - Caller's procedure name |
| 217 | * module_name - Caller's module name |
| 218 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | * Format - Printf format field |
| 220 | * ... - Optional printf arguments |
| 221 | * |
| 222 | * RETURN: None |
| 223 | * |
| 224 | * DESCRIPTION: Print message with no headers. Has same interface as |
| 225 | * debug_print so that the same macros can be used. |
| 226 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 227 | ******************************************************************************/ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 228 | void ACPI_INTERNAL_VAR_XFACE |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 229 | acpi_debug_print_raw(u32 requested_debug_level, |
| 230 | u32 line_number, |
| 231 | const char *function_name, |
| 232 | const char *module_name, |
| 233 | u32 component_id, const char *format, ...) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 235 | va_list args; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
| 237 | if (!(requested_debug_level & acpi_dbg_level) || |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 238 | !(component_id & acpi_dbg_layer)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | return; |
| 240 | } |
| 241 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 242 | va_start(args, format); |
| 243 | acpi_os_vprintf(format, args); |
Bob Moore | 507f046 | 2008-04-10 19:06:42 +0400 | [diff] [blame] | 244 | va_end(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 247 | ACPI_EXPORT_SYMBOL(acpi_debug_print_raw) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 249 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | * |
| 251 | * FUNCTION: acpi_ut_trace |
| 252 | * |
| 253 | * PARAMETERS: line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 254 | * function_name - Caller's procedure name |
| 255 | * module_name - Caller's module name |
| 256 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | * |
| 258 | * RETURN: None |
| 259 | * |
| 260 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
| 261 | * set in debug_level |
| 262 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 263 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 265 | acpi_ut_trace(u32 line_number, |
Bob Moore | 4b8ed63 | 2008-06-10 13:55:53 +0800 | [diff] [blame] | 266 | const char *function_name, |
| 267 | const char *module_name, u32 component_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | { |
| 269 | |
| 270 | acpi_gbl_nesting_level++; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 271 | acpi_ut_track_stack_ptr(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 273 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 274 | line_number, function_name, module_name, component_id, |
| 275 | "%s\n", acpi_gbl_fn_entry_str); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 278 | ACPI_EXPORT_SYMBOL(acpi_ut_trace) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 280 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | * |
| 282 | * FUNCTION: acpi_ut_trace_ptr |
| 283 | * |
| 284 | * PARAMETERS: line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 285 | * function_name - Caller's procedure name |
| 286 | * module_name - Caller's module name |
| 287 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | * Pointer - Pointer to display |
| 289 | * |
| 290 | * RETURN: None |
| 291 | * |
| 292 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
| 293 | * set in debug_level |
| 294 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 295 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 297 | acpi_ut_trace_ptr(u32 line_number, |
| 298 | const char *function_name, |
Bob Moore | 4b8ed63 | 2008-06-10 13:55:53 +0800 | [diff] [blame] | 299 | const char *module_name, u32 component_id, void *pointer) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | { |
| 301 | acpi_gbl_nesting_level++; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 302 | acpi_ut_track_stack_ptr(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 304 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 305 | line_number, function_name, module_name, component_id, |
| 306 | "%s %p\n", acpi_gbl_fn_entry_str, pointer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | } |
| 308 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 309 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | * |
| 311 | * FUNCTION: acpi_ut_trace_str |
| 312 | * |
| 313 | * PARAMETERS: line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 314 | * function_name - Caller's procedure name |
| 315 | * module_name - Caller's module name |
| 316 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | * String - Additional string to display |
| 318 | * |
| 319 | * RETURN: None |
| 320 | * |
| 321 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
| 322 | * set in debug_level |
| 323 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 324 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | |
| 326 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 327 | acpi_ut_trace_str(u32 line_number, |
| 328 | const char *function_name, |
Bob Moore | 4b8ed63 | 2008-06-10 13:55:53 +0800 | [diff] [blame] | 329 | const char *module_name, u32 component_id, char *string) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | { |
| 331 | |
| 332 | acpi_gbl_nesting_level++; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 333 | acpi_ut_track_stack_ptr(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 335 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 336 | line_number, function_name, module_name, component_id, |
| 337 | "%s %s\n", acpi_gbl_fn_entry_str, string); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | } |
| 339 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 340 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | * |
| 342 | * FUNCTION: acpi_ut_trace_u32 |
| 343 | * |
| 344 | * PARAMETERS: line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 345 | * function_name - Caller's procedure name |
| 346 | * module_name - Caller's module name |
| 347 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | * Integer - Integer to display |
| 349 | * |
| 350 | * RETURN: None |
| 351 | * |
| 352 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
| 353 | * set in debug_level |
| 354 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 355 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | |
| 357 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 358 | acpi_ut_trace_u32(u32 line_number, |
| 359 | const char *function_name, |
Bob Moore | 4b8ed63 | 2008-06-10 13:55:53 +0800 | [diff] [blame] | 360 | const char *module_name, u32 component_id, u32 integer) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | { |
| 362 | |
| 363 | acpi_gbl_nesting_level++; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 364 | acpi_ut_track_stack_ptr(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 366 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 367 | line_number, function_name, module_name, component_id, |
| 368 | "%s %08X\n", acpi_gbl_fn_entry_str, integer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | } |
| 370 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 371 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | * |
| 373 | * FUNCTION: acpi_ut_exit |
| 374 | * |
| 375 | * PARAMETERS: line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 376 | * function_name - Caller's procedure name |
| 377 | * module_name - Caller's module name |
| 378 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | * |
| 380 | * RETURN: None |
| 381 | * |
| 382 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
| 383 | * set in debug_level |
| 384 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 385 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | |
| 387 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 388 | acpi_ut_exit(u32 line_number, |
Bob Moore | 4b8ed63 | 2008-06-10 13:55:53 +0800 | [diff] [blame] | 389 | const char *function_name, |
| 390 | const char *module_name, u32 component_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | { |
| 392 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 393 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 394 | line_number, function_name, module_name, component_id, |
| 395 | "%s\n", acpi_gbl_fn_exit_str); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | |
| 397 | acpi_gbl_nesting_level--; |
| 398 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 400 | ACPI_EXPORT_SYMBOL(acpi_ut_exit) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 402 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | * |
| 404 | * FUNCTION: acpi_ut_status_exit |
| 405 | * |
| 406 | * PARAMETERS: line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 407 | * function_name - Caller's procedure name |
| 408 | * module_name - Caller's module name |
| 409 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | * Status - Exit status code |
| 411 | * |
| 412 | * RETURN: None |
| 413 | * |
| 414 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
| 415 | * set in debug_level. Prints exit status also. |
| 416 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 417 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 419 | acpi_ut_status_exit(u32 line_number, |
| 420 | const char *function_name, |
Bob Moore | 4b8ed63 | 2008-06-10 13:55:53 +0800 | [diff] [blame] | 421 | const char *module_name, |
| 422 | u32 component_id, acpi_status status) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | { |
| 424 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 425 | if (ACPI_SUCCESS(status)) { |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 426 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 427 | line_number, function_name, module_name, |
| 428 | component_id, "%s %s\n", acpi_gbl_fn_exit_str, |
| 429 | acpi_format_exception(status)); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 430 | } else { |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 431 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 432 | line_number, function_name, module_name, |
| 433 | component_id, "%s ****Exception****: %s\n", |
| 434 | acpi_gbl_fn_exit_str, |
| 435 | acpi_format_exception(status)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | acpi_gbl_nesting_level--; |
| 439 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 441 | ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 443 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | * |
| 445 | * FUNCTION: acpi_ut_value_exit |
| 446 | * |
| 447 | * PARAMETERS: line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 448 | * function_name - Caller's procedure name |
| 449 | * module_name - Caller's module name |
| 450 | * component_id - Caller's component ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | * Value - Value to be printed with exit msg |
| 452 | * |
| 453 | * RETURN: None |
| 454 | * |
| 455 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
| 456 | * set in debug_level. Prints exit value also. |
| 457 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 458 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 460 | acpi_ut_value_exit(u32 line_number, |
| 461 | const char *function_name, |
Bob Moore | 5df7e6c | 2010-01-21 10:06:32 +0800 | [diff] [blame] | 462 | const char *module_name, u32 component_id, u64 value) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | { |
| 464 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 465 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 466 | line_number, function_name, module_name, component_id, |
| 467 | "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, |
| 468 | ACPI_FORMAT_UINT64(value)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | |
| 470 | acpi_gbl_nesting_level--; |
| 471 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 473 | ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 475 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | * |
| 477 | * FUNCTION: acpi_ut_ptr_exit |
| 478 | * |
| 479 | * PARAMETERS: line_number - Caller's line number |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 480 | * function_name - Caller's procedure name |
| 481 | * module_name - Caller's module name |
| 482 | * component_id - Caller's component ID |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 483 | * Ptr - Pointer to display |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | * |
| 485 | * RETURN: None |
| 486 | * |
| 487 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
| 488 | * set in debug_level. Prints exit value also. |
| 489 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 490 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | void |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 492 | acpi_ut_ptr_exit(u32 line_number, |
| 493 | const char *function_name, |
Bob Moore | 4b8ed63 | 2008-06-10 13:55:53 +0800 | [diff] [blame] | 494 | const char *module_name, u32 component_id, u8 *ptr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | { |
| 496 | |
Bob Moore | 50df4d8 | 2008-12-31 03:01:23 +0800 | [diff] [blame] | 497 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
| 498 | line_number, function_name, module_name, component_id, |
| 499 | "%s %p\n", acpi_gbl_fn_exit_str, ptr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 500 | |
| 501 | acpi_gbl_nesting_level--; |
| 502 | } |
| 503 | |
| 504 | #endif |
| 505 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 506 | /******************************************************************************* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | * |
| 508 | * FUNCTION: acpi_ut_dump_buffer |
| 509 | * |
| 510 | * PARAMETERS: Buffer - Buffer to dump |
| 511 | * Count - Amount to dump, in bytes |
| 512 | * Display - BYTE, WORD, DWORD, or QWORD display |
| 513 | * component_iD - Caller's component ID |
| 514 | * |
| 515 | * RETURN: None |
| 516 | * |
| 517 | * DESCRIPTION: Generic dump buffer in both hex and ascii. |
| 518 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 519 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 521 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | { |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 523 | u32 i = 0; |
| 524 | u32 j; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 525 | u32 temp32; |
| 526 | u8 buf_char; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | |
Bob Moore | 5eb6918 | 2008-04-10 19:06:39 +0400 | [diff] [blame] | 528 | if (!buffer) { |
| 529 | acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n"); |
| 530 | return; |
| 531 | } |
| 532 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | if ((count < 4) || (count & 0x01)) { |
| 534 | display = DB_BYTE_DISPLAY; |
| 535 | } |
| 536 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 537 | /* Nasty little dump buffer routine! */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | while (i < count) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 540 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | /* Print current offset */ |
| 542 | |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 543 | acpi_os_printf("%6.4X: ", i); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | |
| 545 | /* Print 16 hex chars */ |
| 546 | |
| 547 | for (j = 0; j < 16;) { |
| 548 | if (i + j >= count) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 549 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 550 | /* Dump fill spaces */ |
| 551 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 552 | acpi_os_printf("%*s", ((display * 2) + 1), " "); |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 553 | j += display; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 554 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | } |
| 556 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | switch (display) { |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 558 | case DB_BYTE_DISPLAY: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 559 | default: /* Default is BYTE display */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 561 | acpi_os_printf("%02X ", |
| 562 | buffer[(acpi_size) i + j]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | break; |
| 564 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 565 | case DB_WORD_DISPLAY: |
| 566 | |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 567 | ACPI_MOVE_16_TO_32(&temp32, |
| 568 | &buffer[(acpi_size) i + j]); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 569 | acpi_os_printf("%04X ", temp32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | break; |
| 571 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | case DB_DWORD_DISPLAY: |
| 573 | |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 574 | ACPI_MOVE_32_TO_32(&temp32, |
| 575 | &buffer[(acpi_size) i + j]); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 576 | acpi_os_printf("%08X ", temp32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | break; |
| 578 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 579 | case DB_QWORD_DISPLAY: |
| 580 | |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 581 | ACPI_MOVE_32_TO_32(&temp32, |
| 582 | &buffer[(acpi_size) i + j]); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 583 | acpi_os_printf("%08X", temp32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 585 | ACPI_MOVE_32_TO_32(&temp32, |
| 586 | &buffer[(acpi_size) i + j + |
| 587 | 4]); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 588 | acpi_os_printf("%08X ", temp32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 589 | break; |
| 590 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 591 | |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 592 | j += display; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | } |
| 594 | |
| 595 | /* |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 596 | * Print the ASCII equivalent characters but watch out for the bad |
| 597 | * unprintable ones (printable chars are 0x20 through 0x7E) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 598 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 599 | acpi_os_printf(" "); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 600 | for (j = 0; j < 16; j++) { |
| 601 | if (i + j >= count) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 602 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | return; |
| 604 | } |
| 605 | |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 606 | buf_char = buffer[(acpi_size) i + j]; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 607 | if (ACPI_IS_PRINT(buf_char)) { |
| 608 | acpi_os_printf("%c", buf_char); |
| 609 | } else { |
| 610 | acpi_os_printf("."); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | } |
| 612 | } |
| 613 | |
| 614 | /* Done with that line. */ |
| 615 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 616 | acpi_os_printf("\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | i += 16; |
| 618 | } |
| 619 | |
| 620 | return; |
| 621 | } |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 622 | |
| 623 | /******************************************************************************* |
| 624 | * |
| 625 | * FUNCTION: acpi_ut_dump_buffer |
| 626 | * |
| 627 | * PARAMETERS: Buffer - Buffer to dump |
| 628 | * Count - Amount to dump, in bytes |
| 629 | * Display - BYTE, WORD, DWORD, or QWORD display |
| 630 | * component_iD - Caller's component ID |
| 631 | * |
| 632 | * RETURN: None |
| 633 | * |
| 634 | * DESCRIPTION: Generic dump buffer in both hex and ascii. |
| 635 | * |
| 636 | ******************************************************************************/ |
| 637 | |
| 638 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) |
| 639 | { |
| 640 | |
| 641 | /* Only dump the buffer if tracing is enabled */ |
| 642 | |
| 643 | if (!((ACPI_LV_TABLES & acpi_dbg_level) && |
| 644 | (component_id & acpi_dbg_layer))) { |
| 645 | return; |
| 646 | } |
| 647 | |
| 648 | acpi_ut_dump_buffer2(buffer, count, display); |
| 649 | } |