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