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