1 /* SPDX-License-Identifier: BSD-3-Clause OR GP << 2 /********************************************* 1 /****************************************************************************** 3 * 2 * 4 * Name: acoutput.h -- debug output 3 * Name: acoutput.h -- debug output 5 * 4 * 6 * Copyright (C) 2000 - 2023, Intel Corp. << 7 * << 8 ********************************************* 5 *****************************************************************************/ 9 6 >> 7 /* >> 8 * Copyright (C) 2000 - 2017, Intel Corp. >> 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 10 #ifndef __ACOUTPUT_H__ 44 #ifndef __ACOUTPUT_H__ 11 #define __ACOUTPUT_H__ 45 #define __ACOUTPUT_H__ 12 46 13 /* 47 /* 14 * Debug levels and component IDs. These are u 48 * Debug levels and component IDs. These are used to control the 15 * granularity of the output of the ACPI_DEBUG 49 * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a 16 * per-component basis and a per-exception-typ 50 * per-component basis and a per-exception-type basis. 17 */ 51 */ 18 52 19 /* Component IDs are used in the global "Debug 53 /* Component IDs are used in the global "DebugLayer" */ 20 54 21 #define ACPI_UTILITIES 0x00000001 55 #define ACPI_UTILITIES 0x00000001 22 #define ACPI_HARDWARE 0x00000002 56 #define ACPI_HARDWARE 0x00000002 23 #define ACPI_EVENTS 0x00000004 57 #define ACPI_EVENTS 0x00000004 24 #define ACPI_TABLES 0x00000008 58 #define ACPI_TABLES 0x00000008 25 #define ACPI_NAMESPACE 0x00000010 59 #define ACPI_NAMESPACE 0x00000010 26 #define ACPI_PARSER 0x00000020 60 #define ACPI_PARSER 0x00000020 27 #define ACPI_DISPATCHER 0x00000040 61 #define ACPI_DISPATCHER 0x00000040 28 #define ACPI_EXECUTER 0x00000080 62 #define ACPI_EXECUTER 0x00000080 29 #define ACPI_RESOURCES 0x00000100 63 #define ACPI_RESOURCES 0x00000100 30 #define ACPI_CA_DEBUGGER 0x00000200 64 #define ACPI_CA_DEBUGGER 0x00000200 31 #define ACPI_OS_SERVICES 0x00000400 65 #define ACPI_OS_SERVICES 0x00000400 32 #define ACPI_CA_DISASSEMBLER 0x00000800 66 #define ACPI_CA_DISASSEMBLER 0x00000800 33 67 34 /* Component IDs for ACPI tools and utilities 68 /* Component IDs for ACPI tools and utilities */ 35 69 36 #define ACPI_COMPILER 0x00001000 70 #define ACPI_COMPILER 0x00001000 37 #define ACPI_TOOLS 0x00002000 71 #define ACPI_TOOLS 0x00002000 38 #define ACPI_EXAMPLE 0x00004000 72 #define ACPI_EXAMPLE 0x00004000 39 #define ACPI_DRIVER 0x00008000 73 #define ACPI_DRIVER 0x00008000 40 #define DT_COMPILER 0x00010000 74 #define DT_COMPILER 0x00010000 41 #define ASL_PREPROCESSOR 0x00020000 75 #define ASL_PREPROCESSOR 0x00020000 42 76 43 #define ACPI_ALL_COMPONENTS 0x0001FFFF 77 #define ACPI_ALL_COMPONENTS 0x0001FFFF 44 #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_ 78 #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 45 79 46 /* Component IDs reserved for ACPI drivers */ 80 /* Component IDs reserved for ACPI drivers */ 47 81 48 #define ACPI_ALL_DRIVERS 0xFFFF0000 82 #define ACPI_ALL_DRIVERS 0xFFFF0000 49 83 50 /* 84 /* 51 * Raw debug output levels, do not use these i 85 * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros 52 */ 86 */ 53 #define ACPI_LV_INIT 0x00000001 87 #define ACPI_LV_INIT 0x00000001 54 #define ACPI_LV_DEBUG_OBJECT 0x00000002 88 #define ACPI_LV_DEBUG_OBJECT 0x00000002 55 #define ACPI_LV_INFO 0x00000004 89 #define ACPI_LV_INFO 0x00000004 56 #define ACPI_LV_REPAIR 0x00000008 90 #define ACPI_LV_REPAIR 0x00000008 57 #define ACPI_LV_TRACE_POINT 0x00000010 91 #define ACPI_LV_TRACE_POINT 0x00000010 58 #define ACPI_LV_ALL_EXCEPTIONS 0x0000001F 92 #define ACPI_LV_ALL_EXCEPTIONS 0x0000001F 59 93 60 /* Trace verbosity level 1 [Standard Trace Lev 94 /* Trace verbosity level 1 [Standard Trace Level] */ 61 95 62 #define ACPI_LV_INIT_NAMES 0x00000020 96 #define ACPI_LV_INIT_NAMES 0x00000020 63 #define ACPI_LV_PARSE 0x00000040 97 #define ACPI_LV_PARSE 0x00000040 64 #define ACPI_LV_LOAD 0x00000080 98 #define ACPI_LV_LOAD 0x00000080 65 #define ACPI_LV_DISPATCH 0x00000100 99 #define ACPI_LV_DISPATCH 0x00000100 66 #define ACPI_LV_EXEC 0x00000200 100 #define ACPI_LV_EXEC 0x00000200 67 #define ACPI_LV_NAMES 0x00000400 101 #define ACPI_LV_NAMES 0x00000400 68 #define ACPI_LV_OPREGION 0x00000800 102 #define ACPI_LV_OPREGION 0x00000800 69 #define ACPI_LV_BFIELD 0x00001000 103 #define ACPI_LV_BFIELD 0x00001000 70 #define ACPI_LV_TABLES 0x00002000 104 #define ACPI_LV_TABLES 0x00002000 71 #define ACPI_LV_VALUES 0x00004000 105 #define ACPI_LV_VALUES 0x00004000 72 #define ACPI_LV_OBJECTS 0x00008000 106 #define ACPI_LV_OBJECTS 0x00008000 73 #define ACPI_LV_RESOURCES 0x00010000 107 #define ACPI_LV_RESOURCES 0x00010000 74 #define ACPI_LV_USER_REQUESTS 0x00020000 108 #define ACPI_LV_USER_REQUESTS 0x00020000 75 #define ACPI_LV_PACKAGE 0x00040000 109 #define ACPI_LV_PACKAGE 0x00040000 76 #define ACPI_LV_EVALUATION 0x00080000 !! 110 #define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS 77 #define ACPI_LV_VERBOSITY1 0x000FFF40 << 78 111 79 /* Trace verbosity level 2 [Function tracing a 112 /* Trace verbosity level 2 [Function tracing and memory allocation] */ 80 113 81 #define ACPI_LV_ALLOCATIONS 0x00100000 114 #define ACPI_LV_ALLOCATIONS 0x00100000 82 #define ACPI_LV_FUNCTIONS 0x00200000 115 #define ACPI_LV_FUNCTIONS 0x00200000 83 #define ACPI_LV_OPTIMIZATIONS 0x00400000 116 #define ACPI_LV_OPTIMIZATIONS 0x00400000 84 #define ACPI_LV_PARSE_TREES 0x00800000 !! 117 #define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1 85 #define ACPI_LV_VERBOSITY2 0x00F00000 << 86 #define ACPI_LV_ALL ACPI_LV_VE 118 #define ACPI_LV_ALL ACPI_LV_VERBOSITY2 87 119 88 /* Trace verbosity level 3 [Threading, I/O, an 120 /* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ 89 121 90 #define ACPI_LV_MUTEX 0x01000000 122 #define ACPI_LV_MUTEX 0x01000000 91 #define ACPI_LV_THREADS 0x02000000 123 #define ACPI_LV_THREADS 0x02000000 92 #define ACPI_LV_IO 0x04000000 124 #define ACPI_LV_IO 0x04000000 93 #define ACPI_LV_INTERRUPTS 0x08000000 125 #define ACPI_LV_INTERRUPTS 0x08000000 94 #define ACPI_LV_VERBOSITY3 0x0F000000 126 #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 95 127 96 /* Exceptionally verbose output -- also used i 128 /* Exceptionally verbose output -- also used in the global "DebugLevel" */ 97 129 98 #define ACPI_LV_AML_DISASSEMBLE 0x10000000 130 #define ACPI_LV_AML_DISASSEMBLE 0x10000000 99 #define ACPI_LV_VERBOSE_INFO 0x20000000 131 #define ACPI_LV_VERBOSE_INFO 0x20000000 100 #define ACPI_LV_FULL_TABLES 0x40000000 132 #define ACPI_LV_FULL_TABLES 0x40000000 101 #define ACPI_LV_EVENTS 0x80000000 133 #define ACPI_LV_EVENTS 0x80000000 102 #define ACPI_LV_VERBOSE 0xF0000000 134 #define ACPI_LV_VERBOSE 0xF0000000 103 135 104 /* 136 /* 105 * Debug level macros that are used in the DEB 137 * Debug level macros that are used in the DEBUG_PRINT macros 106 */ 138 */ 107 #define ACPI_DEBUG_LEVEL(dl) (u32) dl,A 139 #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS 108 140 109 /* 141 /* 110 * Exception level -- used in the global "Debu 142 * Exception level -- used in the global "DebugLevel" 111 * 143 * 112 * Note: For errors, use the ACPI_ERROR or ACP 144 * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. 113 * For warnings, use ACPI_WARNING. 145 * For warnings, use ACPI_WARNING. 114 */ 146 */ 115 #define ACPI_DB_INIT ACPI_DEBUG 147 #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) 116 #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG 148 #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) 117 #define ACPI_DB_INFO ACPI_DEBUG 149 #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) 118 #define ACPI_DB_REPAIR ACPI_DEBUG 150 #define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) 119 #define ACPI_DB_TRACE_POINT ACPI_DEBUG 151 #define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT) 120 #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG 152 #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) 121 153 122 /* Trace level -- also used in the global "Deb 154 /* Trace level -- also used in the global "DebugLevel" */ 123 155 124 #define ACPI_DB_INIT_NAMES ACPI_DEBUG 156 #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 125 #define ACPI_DB_THREADS ACPI_DEBUG 157 #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) 126 #define ACPI_DB_PARSE ACPI_DEBUG 158 #define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) 127 #define ACPI_DB_DISPATCH ACPI_DEBUG 159 #define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) 128 #define ACPI_DB_LOAD ACPI_DEBUG 160 #define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) 129 #define ACPI_DB_EXEC ACPI_DEBUG 161 #define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) 130 #define ACPI_DB_NAMES ACPI_DEBUG 162 #define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) 131 #define ACPI_DB_OPREGION ACPI_DEBUG 163 #define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) 132 #define ACPI_DB_BFIELD ACPI_DEBUG 164 #define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) 133 #define ACPI_DB_TABLES ACPI_DEBUG 165 #define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) 134 #define ACPI_DB_FUNCTIONS ACPI_DEBUG 166 #define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) 135 #define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG 167 #define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) 136 #define ACPI_DB_PARSE_TREES ACPI_DEBUG << 137 #define ACPI_DB_VALUES ACPI_DEBUG 168 #define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) 138 #define ACPI_DB_OBJECTS ACPI_DEBUG 169 #define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) 139 #define ACPI_DB_ALLOCATIONS ACPI_DEBUG 170 #define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) 140 #define ACPI_DB_RESOURCES ACPI_DEBUG 171 #define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) 141 #define ACPI_DB_IO ACPI_DEBUG 172 #define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) 142 #define ACPI_DB_INTERRUPTS ACPI_DEBUG 173 #define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) 143 #define ACPI_DB_USER_REQUESTS ACPI_DEBUG 174 #define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) 144 #define ACPI_DB_PACKAGE ACPI_DEBUG 175 #define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) 145 #define ACPI_DB_EVALUATION ACPI_DEBUG << 146 #define ACPI_DB_MUTEX ACPI_DEBUG 176 #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) 147 #define ACPI_DB_EVENTS ACPI_DEBUG 177 #define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) 148 178 149 #define ACPI_DB_ALL ACPI_DEBUG 179 #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) 150 180 151 /* Defaults for debug_level, debug and normal 181 /* Defaults for debug_level, debug and normal */ 152 182 153 #ifndef ACPI_DEBUG_DEFAULT !! 183 #define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR) 154 #define ACPI_DEBUG_DEFAULT (ACPI_LV_I << 155 #endif << 156 << 157 #define ACPI_NORMAL_DEFAULT (ACPI_LV_I 184 #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) 158 #define ACPI_DEBUG_ALL (ACPI_LV_A 185 #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 159 186 160 /* 187 /* 161 * Global trace flags 188 * Global trace flags 162 */ 189 */ 163 #define ACPI_TRACE_ENABLED ((u32) 4) 190 #define ACPI_TRACE_ENABLED ((u32) 4) 164 #define ACPI_TRACE_ONESHOT ((u32) 2) 191 #define ACPI_TRACE_ONESHOT ((u32) 2) 165 #define ACPI_TRACE_OPCODE ((u32) 1) 192 #define ACPI_TRACE_OPCODE ((u32) 1) 166 193 167 /* Defaults for trace debugging level/layer */ 194 /* Defaults for trace debugging level/layer */ 168 195 169 #define ACPI_TRACE_LEVEL_ALL ACPI_LV_AL 196 #define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL 170 #define ACPI_TRACE_LAYER_ALL 0x000001FF 197 #define ACPI_TRACE_LAYER_ALL 0x000001FF 171 #define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TR 198 #define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT 172 #define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECU 199 #define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER 173 200 174 #if defined (ACPI_DEBUG_OUTPUT) || !defined (A 201 #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) 175 /* 202 /* 176 * The module name is used primarily for error 203 * The module name is used primarily for error and debug messages. 177 * The __FILE__ macro is not very useful for t 204 * The __FILE__ macro is not very useful for this, because it 178 * usually includes the entire pathname to the 205 * usually includes the entire pathname to the module making the 179 * debug output difficult to read. 206 * debug output difficult to read. 180 */ 207 */ 181 #define ACPI_MODULE_NAME(name) static 208 #define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name; 182 #else 209 #else 183 /* 210 /* 184 * For the no-debug and no-error-msg cases, we 211 * For the no-debug and no-error-msg cases, we must at least define 185 * a null module name. 212 * a null module name. 186 */ 213 */ 187 #define ACPI_MODULE_NAME(name) 214 #define ACPI_MODULE_NAME(name) 188 #define _acpi_module_name "" 215 #define _acpi_module_name "" 189 #endif 216 #endif 190 217 191 /* 218 /* 192 * Ascii error messages can be configured out 219 * Ascii error messages can be configured out 193 */ 220 */ 194 #ifndef ACPI_NO_ERROR_MESSAGES 221 #ifndef ACPI_NO_ERROR_MESSAGES 195 #define AE_INFO _acpi_ 222 #define AE_INFO _acpi_module_name, __LINE__ 196 #define ACPI_ONCE(_fn, _plist) << 197 223 198 /* 224 /* 199 * Error reporting. Callers module and line nu 225 * Error reporting. Callers module and line number are inserted by AE_INFO, 200 * the plist contains a set of parens to allow 226 * the plist contains a set of parens to allow variable-length lists. 201 * These macros are used for both the debug an 227 * These macros are used for both the debug and non-debug versions of the code. 202 */ 228 */ 203 #define ACPI_INFO(plist) acpi_i 229 #define ACPI_INFO(plist) acpi_info plist 204 #define ACPI_WARNING(plist) acpi_w 230 #define ACPI_WARNING(plist) acpi_warning plist 205 #define ACPI_WARNING_ONCE(plist) ACPI_O << 206 #define ACPI_EXCEPTION(plist) acpi_e 231 #define ACPI_EXCEPTION(plist) acpi_exception plist 207 #define ACPI_ERROR(plist) acpi_e 232 #define ACPI_ERROR(plist) acpi_error plist 208 #define ACPI_ERROR_ONCE(plist) ACPI_O << 209 #define ACPI_BIOS_WARNING(plist) acpi_b 233 #define ACPI_BIOS_WARNING(plist) acpi_bios_warning plist 210 #define ACPI_BIOS_EXCEPTION(plist) acpi_b << 211 #define ACPI_BIOS_ERROR(plist) acpi_b 234 #define ACPI_BIOS_ERROR(plist) acpi_bios_error plist 212 #define ACPI_DEBUG_OBJECT(obj,l,i) acpi_e 235 #define ACPI_DEBUG_OBJECT(obj,l,i) acpi_ex_do_debug_object(obj,l,i) 213 236 214 #else 237 #else 215 238 216 /* No error messages */ 239 /* No error messages */ 217 240 218 #define ACPI_INFO(plist) 241 #define ACPI_INFO(plist) 219 #define ACPI_WARNING(plist) 242 #define ACPI_WARNING(plist) 220 #define ACPI_WARNING_ONCE(plist) << 221 #define ACPI_EXCEPTION(plist) 243 #define ACPI_EXCEPTION(plist) 222 #define ACPI_ERROR(plist) 244 #define ACPI_ERROR(plist) 223 #define ACPI_ERROR_ONCE(plist) << 224 #define ACPI_BIOS_WARNING(plist) 245 #define ACPI_BIOS_WARNING(plist) 225 #define ACPI_BIOS_EXCEPTION(plist) << 226 #define ACPI_BIOS_ERROR(plist) 246 #define ACPI_BIOS_ERROR(plist) 227 #define ACPI_DEBUG_OBJECT(obj,l,i) 247 #define ACPI_DEBUG_OBJECT(obj,l,i) 228 248 229 #endif /* ACPI_NO_ERR 249 #endif /* ACPI_NO_ERROR_MESSAGES */ 230 250 231 /* 251 /* 232 * Debug macros that are conditionally compile 252 * Debug macros that are conditionally compiled 233 */ 253 */ 234 #ifdef ACPI_DEBUG_OUTPUT 254 #ifdef ACPI_DEBUG_OUTPUT 235 255 236 /* 256 /* 237 * If ACPI_GET_FUNCTION_NAME was not defined i 257 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, 238 * define it now. This is the case where there 258 * define it now. This is the case where there the compiler does not support 239 * a __func__ macro or equivalent. 259 * a __func__ macro or equivalent. 240 */ 260 */ 241 #ifndef ACPI_GET_FUNCTION_NAME 261 #ifndef ACPI_GET_FUNCTION_NAME 242 #define ACPI_GET_FUNCTION_NAME _acpi_ 262 #define ACPI_GET_FUNCTION_NAME _acpi_function_name 243 263 244 /* 264 /* 245 * The Name parameter should be the procedure 265 * The Name parameter should be the procedure name as a non-quoted string. 246 * The function name is also used by the funct 266 * The function name is also used by the function exit macros below. 247 * Note: (const char) is used to be compatible 267 * Note: (const char) is used to be compatible with the debug interfaces 248 * and macros such as __func__. 268 * and macros such as __func__. 249 */ 269 */ 250 #define ACPI_FUNCTION_NAME(name) static 270 #define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name; 251 271 252 #else 272 #else 253 /* Compiler supports __func__ (or equivalent) 273 /* Compiler supports __func__ (or equivalent) -- Ignore this macro */ 254 274 255 #define ACPI_FUNCTION_NAME(name) 275 #define ACPI_FUNCTION_NAME(name) 256 #endif /* ACPI_GET_FU 276 #endif /* ACPI_GET_FUNCTION_NAME */ 257 277 258 /* 278 /* 259 * Common parameters used for debug output fun 279 * Common parameters used for debug output functions: 260 * line number, function name, module(file) na 280 * line number, function name, module(file) name, component ID 261 */ 281 */ 262 #define ACPI_DEBUG_PARAMETERS \ 282 #define ACPI_DEBUG_PARAMETERS \ 263 __LINE__, ACPI_GET_FUNCTION_NAME, _acp 283 __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT 264 284 265 /* Check if debug output is currently dynamica 285 /* Check if debug output is currently dynamically enabled */ 266 286 267 #define ACPI_IS_DEBUG_ENABLED(level, component 287 #define ACPI_IS_DEBUG_ENABLED(level, component) \ 268 ((level & acpi_dbg_level) && (componen 288 ((level & acpi_dbg_level) && (component & acpi_dbg_layer)) 269 289 270 /* 290 /* 271 * Master debug print macros 291 * Master debug print macros 272 * Print message if and only if: 292 * Print message if and only if: 273 * 1) Debug print for the current component 293 * 1) Debug print for the current component is enabled 274 * 2) Debug error level or trace level for 294 * 2) Debug error level or trace level for the print statement is enabled 275 * 295 * 276 * November 2012: Moved the runtime check for 296 * November 2012: Moved the runtime check for whether to actually emit the 277 * debug message outside of the print function 297 * debug message outside of the print function itself. This improves overall 278 * performance at a relatively small code cost 298 * performance at a relatively small code cost. Implementation involves the 279 * use of variadic macros supported by C99. 299 * use of variadic macros supported by C99. 280 * 300 * 281 * Note: the ACPI_DO_WHILE0 macro is used to p 301 * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from 282 * complaining about these constructs. On othe 302 * complaining about these constructs. On other compilers the do...while 283 * adds some extra code, so this feature is op 303 * adds some extra code, so this feature is optional. 284 */ 304 */ 285 #ifdef ACPI_USE_DO_WHILE_0 305 #ifdef ACPI_USE_DO_WHILE_0 286 #define ACPI_DO_WHILE0(a) do a w 306 #define ACPI_DO_WHILE0(a) do a while(0) 287 #else 307 #else 288 #define ACPI_DO_WHILE0(a) a 308 #define ACPI_DO_WHILE0(a) a 289 #endif 309 #endif 290 310 291 /* DEBUG_PRINT functions */ 311 /* DEBUG_PRINT functions */ 292 312 293 #ifndef COMPILER_VA_MACRO 313 #ifndef COMPILER_VA_MACRO 294 314 295 #define ACPI_DEBUG_PRINT(plist) acpi_d 315 #define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist 296 #define ACPI_DEBUG_PRINT_RAW(plist) acpi_d 316 #define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist 297 317 298 #else 318 #else 299 319 300 /* Helper macros for DEBUG_PRINT */ 320 /* Helper macros for DEBUG_PRINT */ 301 321 302 #define ACPI_DO_DEBUG_PRINT(function, level, l 322 #define ACPI_DO_DEBUG_PRINT(function, level, line, filename, modulename, component, ...) \ 303 ACPI_DO_WHILE0 ({ \ 323 ACPI_DO_WHILE0 ({ \ 304 if (ACPI_IS_DEBUG_ENABLED (lev 324 if (ACPI_IS_DEBUG_ENABLED (level, component)) \ 305 { \ 325 { \ 306 function (level, line, 326 function (level, line, filename, modulename, component, __VA_ARGS__); \ 307 } \ 327 } \ 308 }) 328 }) 309 329 310 #define ACPI_ACTUAL_DEBUG(level, line, filenam 330 #define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \ 311 ACPI_DO_DEBUG_PRINT (acpi_debug_print, 331 ACPI_DO_DEBUG_PRINT (acpi_debug_print, level, line, \ 312 filename, modulename, componen 332 filename, modulename, component, __VA_ARGS__) 313 333 314 #define ACPI_ACTUAL_DEBUG_RAW(level, line, fil 334 #define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \ 315 ACPI_DO_DEBUG_PRINT (acpi_debug_print_ 335 ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \ 316 filename, modulename, componen 336 filename, modulename, component, __VA_ARGS__) 317 337 318 #define ACPI_DEBUG_PRINT(plist) ACPI_A 338 #define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist 319 #define ACPI_DEBUG_PRINT_RAW(plist) ACPI_A 339 #define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist 320 340 321 #endif 341 #endif 322 342 323 /* 343 /* 324 * Function entry tracing 344 * Function entry tracing 325 * 345 * 326 * The name of the function is emitted as a lo 346 * The name of the function is emitted as a local variable that is 327 * intended to be used by both the entry trace 347 * intended to be used by both the entry trace and the exit trace. 328 */ 348 */ 329 349 330 /* Helper macro */ 350 /* Helper macro */ 331 351 332 #define ACPI_TRACE_ENTRY(name, function, type, 352 #define ACPI_TRACE_ENTRY(name, function, type, param) \ 333 ACPI_FUNCTION_NAME (name) \ 353 ACPI_FUNCTION_NAME (name) \ 334 function (ACPI_DEBUG_PARAMETERS, (type 354 function (ACPI_DEBUG_PARAMETERS, (type) (param)) 335 355 336 /* The actual entry trace macros */ 356 /* The actual entry trace macros */ 337 357 338 #define ACPI_FUNCTION_TRACE(name) \ 358 #define ACPI_FUNCTION_TRACE(name) \ 339 ACPI_FUNCTION_NAME(name) \ 359 ACPI_FUNCTION_NAME(name) \ 340 acpi_ut_trace (ACPI_DEBUG_PARAMETERS) 360 acpi_ut_trace (ACPI_DEBUG_PARAMETERS) 341 361 342 #define ACPI_FUNCTION_TRACE_PTR(name, pointer) 362 #define ACPI_FUNCTION_TRACE_PTR(name, pointer) \ 343 ACPI_TRACE_ENTRY (name, acpi_ut_trace_ 363 ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, void *, pointer) 344 364 345 #define ACPI_FUNCTION_TRACE_U32(name, value) \ 365 #define ACPI_FUNCTION_TRACE_U32(name, value) \ 346 ACPI_TRACE_ENTRY (name, acpi_ut_trace_ 366 ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, u32, value) 347 367 348 #define ACPI_FUNCTION_TRACE_STR(name, string) 368 #define ACPI_FUNCTION_TRACE_STR(name, string) \ 349 ACPI_TRACE_ENTRY (name, acpi_ut_trace_ 369 ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, const char *, string) 350 370 351 #define ACPI_FUNCTION_ENTRY() \ 371 #define ACPI_FUNCTION_ENTRY() \ 352 acpi_ut_track_stack_ptr() 372 acpi_ut_track_stack_ptr() 353 373 354 /* 374 /* 355 * Function exit tracing 375 * Function exit tracing 356 * 376 * 357 * These macros include a return statement. Th 377 * These macros include a return statement. This is usually considered 358 * bad form, but having a separate exit macro 378 * bad form, but having a separate exit macro before the actual return 359 * is very ugly and difficult to maintain. 379 * is very ugly and difficult to maintain. 360 * 380 * 361 * One of the FUNCTION_TRACE macros above must 381 * One of the FUNCTION_TRACE macros above must be used in conjunction 362 * with these macros so that "_AcpiFunctionNam 382 * with these macros so that "_AcpiFunctionName" is defined. 363 * 383 * 364 * There are two versions of most of the retur 384 * There are two versions of most of the return macros. The default version is 365 * safer, since it avoids side-effects by guar 385 * safer, since it avoids side-effects by guaranteeing that the argument will 366 * not be evaluated twice. 386 * not be evaluated twice. 367 * 387 * 368 * A less-safe version of the macros is provid 388 * A less-safe version of the macros is provided for optional use if the 369 * compiler uses excessive CPU stack (for exam 389 * compiler uses excessive CPU stack (for example, this may happen in the 370 * debug case if code optimization is disabled !! 390 * debug case if code optimzation is disabled.) 371 */ 391 */ 372 392 373 /* Exit trace helper macro */ 393 /* Exit trace helper macro */ 374 394 375 #ifndef ACPI_SIMPLE_RETURN_MACROS 395 #ifndef ACPI_SIMPLE_RETURN_MACROS 376 396 377 #define ACPI_TRACE_EXIT(function, type, param) 397 #define ACPI_TRACE_EXIT(function, type, param) \ 378 ACPI_DO_WHILE0 ({ \ 398 ACPI_DO_WHILE0 ({ \ 379 register type _param = (type) 399 register type _param = (type) (param); \ 380 function (ACPI_DEBUG_PARAMETER 400 function (ACPI_DEBUG_PARAMETERS, _param); \ 381 return (_param); \ 401 return (_param); \ 382 }) 402 }) 383 403 384 #else /* Use origina 404 #else /* Use original less-safe macros */ 385 405 386 #define ACPI_TRACE_EXIT(function, type, param) 406 #define ACPI_TRACE_EXIT(function, type, param) \ 387 ACPI_DO_WHILE0 ({ \ 407 ACPI_DO_WHILE0 ({ \ 388 function (ACPI_DEBUG_PARAMETER 408 function (ACPI_DEBUG_PARAMETERS, (type) (param)); \ 389 return (param); \ 409 return (param); \ 390 }) 410 }) 391 411 392 #endif /* ACPI_SIMPLE 412 #endif /* ACPI_SIMPLE_RETURN_MACROS */ 393 413 394 /* The actual exit macros */ 414 /* The actual exit macros */ 395 415 396 #define return_VOID \ 416 #define return_VOID \ 397 ACPI_DO_WHILE0 ({ \ 417 ACPI_DO_WHILE0 ({ \ 398 acpi_ut_exit (ACPI_DEBUG_PARAM 418 acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ 399 return; \ 419 return; \ 400 }) 420 }) 401 421 402 #define return_ACPI_STATUS(status) \ 422 #define return_ACPI_STATUS(status) \ 403 ACPI_TRACE_EXIT (acpi_ut_status_exit, 423 ACPI_TRACE_EXIT (acpi_ut_status_exit, acpi_status, status) 404 424 405 #define return_PTR(pointer) \ 425 #define return_PTR(pointer) \ 406 ACPI_TRACE_EXIT (acpi_ut_ptr_exit, voi 426 ACPI_TRACE_EXIT (acpi_ut_ptr_exit, void *, pointer) 407 427 408 #define return_STR(string) \ 428 #define return_STR(string) \ 409 ACPI_TRACE_EXIT (acpi_ut_str_exit, con 429 ACPI_TRACE_EXIT (acpi_ut_str_exit, const char *, string) 410 430 411 #define return_VALUE(value) \ 431 #define return_VALUE(value) \ 412 ACPI_TRACE_EXIT (acpi_ut_value_exit, u 432 ACPI_TRACE_EXIT (acpi_ut_value_exit, u64, value) 413 433 414 #define return_UINT32(value) \ 434 #define return_UINT32(value) \ 415 ACPI_TRACE_EXIT (acpi_ut_value_exit, u 435 ACPI_TRACE_EXIT (acpi_ut_value_exit, u32, value) 416 436 417 #define return_UINT8(value) \ 437 #define return_UINT8(value) \ 418 ACPI_TRACE_EXIT (acpi_ut_value_exit, u 438 ACPI_TRACE_EXIT (acpi_ut_value_exit, u8, value) 419 439 420 /* Conditional execution */ 440 /* Conditional execution */ 421 441 422 #define ACPI_DEBUG_EXEC(a) a 442 #define ACPI_DEBUG_EXEC(a) a 423 #define ACPI_DEBUG_ONLY_MEMBERS(a) a !! 443 #define ACPI_DEBUG_ONLY_MEMBERS(a) a; 424 #define _VERBOSE_STRUCTURES 444 #define _VERBOSE_STRUCTURES 425 445 426 /* Various object display routines for debug * 446 /* Various object display routines for debug */ 427 447 428 #define ACPI_DUMP_STACK_ENTRY(a) acpi_e 448 #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0) 429 #define ACPI_DUMP_OPERANDS(a, b ,c) acpi_e 449 #define ACPI_DUMP_OPERANDS(a, b ,c) acpi_ex_dump_operands(a, b, c) 430 #define ACPI_DUMP_ENTRY(a, b) acpi_n 450 #define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b) 431 #define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_n 451 #define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d) 432 #define ACPI_DUMP_BUFFER(a, b) acpi_u 452 #define ACPI_DUMP_BUFFER(a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) 433 453 434 #define ACPI_TRACE_POINT(a, b, c, d) acpi_t 454 #define ACPI_TRACE_POINT(a, b, c, d) acpi_trace_point (a, b, c, d) 435 455 436 #else /* ACPI_DEBUG_ 456 #else /* ACPI_DEBUG_OUTPUT */ 437 /* 457 /* 438 * This is the non-debug case -- make everythi 458 * This is the non-debug case -- make everything go away, 439 * leaving no executable debug code! 459 * leaving no executable debug code! 440 */ 460 */ 441 #define ACPI_DEBUG_PRINT(pl) 461 #define ACPI_DEBUG_PRINT(pl) 442 #define ACPI_DEBUG_PRINT_RAW(pl) 462 #define ACPI_DEBUG_PRINT_RAW(pl) 443 #define ACPI_DEBUG_EXEC(a) 463 #define ACPI_DEBUG_EXEC(a) 444 #define ACPI_DEBUG_ONLY_MEMBERS(a) 464 #define ACPI_DEBUG_ONLY_MEMBERS(a) 445 #define ACPI_FUNCTION_NAME(a) 465 #define ACPI_FUNCTION_NAME(a) 446 #define ACPI_FUNCTION_TRACE(a) 466 #define ACPI_FUNCTION_TRACE(a) 447 #define ACPI_FUNCTION_TRACE_PTR(a, b) 467 #define ACPI_FUNCTION_TRACE_PTR(a, b) 448 #define ACPI_FUNCTION_TRACE_U32(a, b) 468 #define ACPI_FUNCTION_TRACE_U32(a, b) 449 #define ACPI_FUNCTION_TRACE_STR(a, b) 469 #define ACPI_FUNCTION_TRACE_STR(a, b) 450 #define ACPI_FUNCTION_ENTRY() 470 #define ACPI_FUNCTION_ENTRY() 451 #define ACPI_DUMP_STACK_ENTRY(a) 471 #define ACPI_DUMP_STACK_ENTRY(a) 452 #define ACPI_DUMP_OPERANDS(a, b, c) 472 #define ACPI_DUMP_OPERANDS(a, b, c) 453 #define ACPI_DUMP_ENTRY(a, b) 473 #define ACPI_DUMP_ENTRY(a, b) 454 #define ACPI_DUMP_PATHNAME(a, b, c, d) 474 #define ACPI_DUMP_PATHNAME(a, b, c, d) 455 #define ACPI_DUMP_BUFFER(a, b) 475 #define ACPI_DUMP_BUFFER(a, b) 456 #define ACPI_IS_DEBUG_ENABLED(level, component 476 #define ACPI_IS_DEBUG_ENABLED(level, component) 0 457 #define ACPI_TRACE_POINT(a, b, c, d) 477 #define ACPI_TRACE_POINT(a, b, c, d) 458 478 459 /* Return macros must have a return statement 479 /* Return macros must have a return statement at the minimum */ 460 480 461 #define return_VOID return 481 #define return_VOID return 462 #define return_ACPI_STATUS(s) return 482 #define return_ACPI_STATUS(s) return(s) 463 #define return_PTR(s) return 483 #define return_PTR(s) return(s) 464 #define return_STR(s) return 484 #define return_STR(s) return(s) 465 #define return_VALUE(s) return 485 #define return_VALUE(s) return(s) 466 #define return_UINT8(s) return 486 #define return_UINT8(s) return(s) 467 #define return_UINT32(s) return 487 #define return_UINT32(s) return(s) 468 488 469 #endif /* ACPI_DEBUG_ 489 #endif /* ACPI_DEBUG_OUTPUT */ 470 490 471 #endif /* __ACOUTPUT_ 491 #endif /* __ACOUTPUT_H__ */ 472 492
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.