acoutput.h revision 1.20 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Name: acoutput.h -- debug output
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.19 christos /******************************************************************************
8 1.19 christos *
9 1.19 christos * 1. Copyright Notice
10 1.19 christos *
11 1.20 christos * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
12 1.1 jruoho * All rights reserved.
13 1.1 jruoho *
14 1.19 christos * 2. License
15 1.19 christos *
16 1.19 christos * 2.1. This is your license from Intel Corp. under its intellectual property
17 1.19 christos * rights. You may have additional license terms from the party that provided
18 1.19 christos * you this software, covering your right to use that party's intellectual
19 1.19 christos * property rights.
20 1.19 christos *
21 1.19 christos * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 1.19 christos * copy of the source code appearing in this file ("Covered Code") an
23 1.19 christos * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 1.19 christos * base code distributed originally by Intel ("Original Intel Code") to copy,
25 1.19 christos * make derivatives, distribute, use and display any portion of the Covered
26 1.19 christos * Code in any form, with the right to sublicense such rights; and
27 1.19 christos *
28 1.19 christos * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 1.19 christos * license (with the right to sublicense), under only those claims of Intel
30 1.19 christos * patents that are infringed by the Original Intel Code, to make, use, sell,
31 1.19 christos * offer to sell, and import the Covered Code and derivative works thereof
32 1.19 christos * solely to the minimum extent necessary to exercise the above copyright
33 1.19 christos * license, and in no event shall the patent license extend to any additions
34 1.19 christos * to or modifications of the Original Intel Code. No other license or right
35 1.19 christos * is granted directly or by implication, estoppel or otherwise;
36 1.19 christos *
37 1.19 christos * The above copyright and patent license is granted only if the following
38 1.19 christos * conditions are met:
39 1.19 christos *
40 1.19 christos * 3. Conditions
41 1.19 christos *
42 1.19 christos * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 1.19 christos * Redistribution of source code of any substantial portion of the Covered
44 1.19 christos * Code or modification with rights to further distribute source must include
45 1.19 christos * the above Copyright Notice, the above License, this list of Conditions,
46 1.19 christos * and the following Disclaimer and Export Compliance provision. In addition,
47 1.19 christos * Licensee must cause all Covered Code to which Licensee contributes to
48 1.19 christos * contain a file documenting the changes Licensee made to create that Covered
49 1.19 christos * Code and the date of any change. Licensee must include in that file the
50 1.19 christos * documentation of any changes made by any predecessor Licensee. Licensee
51 1.19 christos * must include a prominent statement that the modification is derived,
52 1.19 christos * directly or indirectly, from Original Intel Code.
53 1.19 christos *
54 1.19 christos * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 1.19 christos * Redistribution of source code of any substantial portion of the Covered
56 1.19 christos * Code or modification without rights to further distribute source must
57 1.19 christos * include the following Disclaimer and Export Compliance provision in the
58 1.19 christos * documentation and/or other materials provided with distribution. In
59 1.19 christos * addition, Licensee may not authorize further sublicense of source of any
60 1.19 christos * portion of the Covered Code, and must include terms to the effect that the
61 1.19 christos * license from Licensee to its licensee is limited to the intellectual
62 1.19 christos * property embodied in the software Licensee provides to its licensee, and
63 1.19 christos * not to intellectual property embodied in modifications its licensee may
64 1.19 christos * make.
65 1.19 christos *
66 1.19 christos * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 1.19 christos * substantial portion of the Covered Code or modification must reproduce the
68 1.19 christos * above Copyright Notice, and the following Disclaimer and Export Compliance
69 1.19 christos * provision in the documentation and/or other materials provided with the
70 1.19 christos * distribution.
71 1.19 christos *
72 1.19 christos * 3.4. Intel retains all right, title, and interest in and to the Original
73 1.19 christos * Intel Code.
74 1.19 christos *
75 1.19 christos * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 1.19 christos * Intel shall be used in advertising or otherwise to promote the sale, use or
77 1.19 christos * other dealings in products derived from or relating to the Covered Code
78 1.19 christos * without prior written authorization from Intel.
79 1.19 christos *
80 1.19 christos * 4. Disclaimer and Export Compliance
81 1.19 christos *
82 1.19 christos * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 1.19 christos * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 1.19 christos * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 1.19 christos * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 1.19 christos * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 1.19 christos * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 1.19 christos * PARTICULAR PURPOSE.
89 1.19 christos *
90 1.19 christos * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 1.19 christos * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 1.19 christos * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 1.19 christos * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 1.19 christos * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 1.19 christos * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 1.19 christos * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 1.19 christos * LIMITED REMEDY.
98 1.19 christos *
99 1.19 christos * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 1.19 christos * software or system incorporating such software without first obtaining any
101 1.19 christos * required license or other approval from the U. S. Department of Commerce or
102 1.19 christos * any other agency or department of the United States Government. In the
103 1.19 christos * event Licensee exports any such software from the United States or
104 1.19 christos * re-exports any such software from a foreign destination, Licensee shall
105 1.19 christos * ensure that the distribution and export/re-export of the software is in
106 1.19 christos * compliance with all laws, regulations, orders, or other restrictions of the
107 1.19 christos * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 1.19 christos * any of its subsidiaries will export/re-export any technical data, process,
109 1.19 christos * software, or service, directly or indirectly, to any country for which the
110 1.19 christos * United States government or any agency thereof requires an export license,
111 1.19 christos * other governmental approval, or letter of assurance, without first obtaining
112 1.19 christos * such license, approval or letter.
113 1.19 christos *
114 1.19 christos *****************************************************************************
115 1.19 christos *
116 1.19 christos * Alternatively, you may choose to be licensed under the terms of the
117 1.19 christos * following license:
118 1.19 christos *
119 1.2 christos * Redistribution and use in source and binary forms, with or without
120 1.2 christos * modification, are permitted provided that the following conditions
121 1.2 christos * are met:
122 1.2 christos * 1. Redistributions of source code must retain the above copyright
123 1.2 christos * notice, this list of conditions, and the following disclaimer,
124 1.2 christos * without modification.
125 1.2 christos * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 1.2 christos * substantially similar to the "NO WARRANTY" disclaimer below
127 1.2 christos * ("Disclaimer") and any redistribution must be conditioned upon
128 1.2 christos * including a substantially similar Disclaimer requirement for further
129 1.2 christos * binary redistribution.
130 1.2 christos * 3. Neither the names of the above-listed copyright holders nor the names
131 1.2 christos * of any contributors may be used to endorse or promote products derived
132 1.2 christos * from this software without specific prior written permission.
133 1.2 christos *
134 1.2 christos * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 1.2 christos * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 1.13 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 1.2 christos * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 1.19 christos * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 1.19 christos * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 1.19 christos * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 1.19 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 1.19 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 1.19 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 1.19 christos * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 1.19 christos *
146 1.19 christos * Alternatively, you may choose to be licensed under the terms of the
147 1.19 christos * GNU General Public License ("GPL") version 2 as published by the Free
148 1.19 christos * Software Foundation.
149 1.19 christos *
150 1.19 christos *****************************************************************************/
151 1.1 jruoho
152 1.1 jruoho #ifndef __ACOUTPUT_H__
153 1.1 jruoho #define __ACOUTPUT_H__
154 1.1 jruoho
155 1.1 jruoho /*
156 1.1 jruoho * Debug levels and component IDs. These are used to control the
157 1.1 jruoho * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a
158 1.1 jruoho * per-component basis and a per-exception-type basis.
159 1.1 jruoho */
160 1.1 jruoho
161 1.1 jruoho /* Component IDs are used in the global "DebugLayer" */
162 1.1 jruoho
163 1.1 jruoho #define ACPI_UTILITIES 0x00000001
164 1.1 jruoho #define ACPI_HARDWARE 0x00000002
165 1.1 jruoho #define ACPI_EVENTS 0x00000004
166 1.1 jruoho #define ACPI_TABLES 0x00000008
167 1.1 jruoho #define ACPI_NAMESPACE 0x00000010
168 1.1 jruoho #define ACPI_PARSER 0x00000020
169 1.1 jruoho #define ACPI_DISPATCHER 0x00000040
170 1.1 jruoho #define ACPI_EXECUTER 0x00000080
171 1.1 jruoho #define ACPI_RESOURCES 0x00000100
172 1.1 jruoho #define ACPI_CA_DEBUGGER 0x00000200
173 1.1 jruoho #define ACPI_OS_SERVICES 0x00000400
174 1.1 jruoho #define ACPI_CA_DISASSEMBLER 0x00000800
175 1.1 jruoho
176 1.1 jruoho /* Component IDs for ACPI tools and utilities */
177 1.1 jruoho
178 1.1 jruoho #define ACPI_COMPILER 0x00001000
179 1.1 jruoho #define ACPI_TOOLS 0x00002000
180 1.1 jruoho #define ACPI_EXAMPLE 0x00004000
181 1.1 jruoho #define ACPI_DRIVER 0x00008000
182 1.2 christos #define DT_COMPILER 0x00010000
183 1.2 christos #define ASL_PREPROCESSOR 0x00020000
184 1.1 jruoho
185 1.2 christos #define ACPI_ALL_COMPONENTS 0x0001FFFF
186 1.1 jruoho #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
187 1.1 jruoho
188 1.1 jruoho /* Component IDs reserved for ACPI drivers */
189 1.1 jruoho
190 1.1 jruoho #define ACPI_ALL_DRIVERS 0xFFFF0000
191 1.1 jruoho
192 1.1 jruoho
193 1.1 jruoho /*
194 1.1 jruoho * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros
195 1.1 jruoho */
196 1.1 jruoho #define ACPI_LV_INIT 0x00000001
197 1.1 jruoho #define ACPI_LV_DEBUG_OBJECT 0x00000002
198 1.1 jruoho #define ACPI_LV_INFO 0x00000004
199 1.1 jruoho #define ACPI_LV_REPAIR 0x00000008
200 1.2 christos #define ACPI_LV_TRACE_POINT 0x00000010
201 1.2 christos #define ACPI_LV_ALL_EXCEPTIONS 0x0000001F
202 1.1 jruoho
203 1.1 jruoho /* Trace verbosity level 1 [Standard Trace Level] */
204 1.1 jruoho
205 1.1 jruoho #define ACPI_LV_INIT_NAMES 0x00000020
206 1.1 jruoho #define ACPI_LV_PARSE 0x00000040
207 1.1 jruoho #define ACPI_LV_LOAD 0x00000080
208 1.1 jruoho #define ACPI_LV_DISPATCH 0x00000100
209 1.1 jruoho #define ACPI_LV_EXEC 0x00000200
210 1.1 jruoho #define ACPI_LV_NAMES 0x00000400
211 1.1 jruoho #define ACPI_LV_OPREGION 0x00000800
212 1.1 jruoho #define ACPI_LV_BFIELD 0x00001000
213 1.1 jruoho #define ACPI_LV_TABLES 0x00002000
214 1.1 jruoho #define ACPI_LV_VALUES 0x00004000
215 1.1 jruoho #define ACPI_LV_OBJECTS 0x00008000
216 1.1 jruoho #define ACPI_LV_RESOURCES 0x00010000
217 1.1 jruoho #define ACPI_LV_USER_REQUESTS 0x00020000
218 1.1 jruoho #define ACPI_LV_PACKAGE 0x00040000
219 1.10 christos #define ACPI_LV_EVALUATION 0x00080000
220 1.10 christos #define ACPI_LV_VERBOSITY1 0x000FFF40 | ACPI_LV_ALL_EXCEPTIONS
221 1.1 jruoho
222 1.1 jruoho /* Trace verbosity level 2 [Function tracing and memory allocation] */
223 1.1 jruoho
224 1.1 jruoho #define ACPI_LV_ALLOCATIONS 0x00100000
225 1.1 jruoho #define ACPI_LV_FUNCTIONS 0x00200000
226 1.1 jruoho #define ACPI_LV_OPTIMIZATIONS 0x00400000
227 1.9 christos #define ACPI_LV_PARSE_TREES 0x00800000
228 1.9 christos #define ACPI_LV_VERBOSITY2 0x00F00000 | ACPI_LV_VERBOSITY1
229 1.1 jruoho #define ACPI_LV_ALL ACPI_LV_VERBOSITY2
230 1.1 jruoho
231 1.1 jruoho /* Trace verbosity level 3 [Threading, I/O, and Interrupts] */
232 1.1 jruoho
233 1.1 jruoho #define ACPI_LV_MUTEX 0x01000000
234 1.1 jruoho #define ACPI_LV_THREADS 0x02000000
235 1.1 jruoho #define ACPI_LV_IO 0x04000000
236 1.1 jruoho #define ACPI_LV_INTERRUPTS 0x08000000
237 1.1 jruoho #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2
238 1.1 jruoho
239 1.1 jruoho /* Exceptionally verbose output -- also used in the global "DebugLevel" */
240 1.1 jruoho
241 1.1 jruoho #define ACPI_LV_AML_DISASSEMBLE 0x10000000
242 1.1 jruoho #define ACPI_LV_VERBOSE_INFO 0x20000000
243 1.1 jruoho #define ACPI_LV_FULL_TABLES 0x40000000
244 1.1 jruoho #define ACPI_LV_EVENTS 0x80000000
245 1.1 jruoho #define ACPI_LV_VERBOSE 0xF0000000
246 1.1 jruoho
247 1.1 jruoho
248 1.1 jruoho /*
249 1.1 jruoho * Debug level macros that are used in the DEBUG_PRINT macros
250 1.1 jruoho */
251 1.1 jruoho #define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS
252 1.1 jruoho
253 1.1 jruoho /*
254 1.1 jruoho * Exception level -- used in the global "DebugLevel"
255 1.1 jruoho *
256 1.1 jruoho * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces.
257 1.1 jruoho * For warnings, use ACPI_WARNING.
258 1.1 jruoho */
259 1.1 jruoho #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
260 1.1 jruoho #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
261 1.1 jruoho #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
262 1.1 jruoho #define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR)
263 1.2 christos #define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT)
264 1.1 jruoho #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
265 1.1 jruoho
266 1.1 jruoho /* Trace level -- also used in the global "DebugLevel" */
267 1.1 jruoho
268 1.1 jruoho #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
269 1.1 jruoho #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
270 1.1 jruoho #define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE)
271 1.1 jruoho #define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH)
272 1.1 jruoho #define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD)
273 1.1 jruoho #define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC)
274 1.1 jruoho #define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES)
275 1.1 jruoho #define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION)
276 1.1 jruoho #define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD)
277 1.1 jruoho #define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES)
278 1.1 jruoho #define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS)
279 1.1 jruoho #define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS)
280 1.9 christos #define ACPI_DB_PARSE_TREES ACPI_DEBUG_LEVEL (ACPI_LV_PARSE_TREES)
281 1.1 jruoho #define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES)
282 1.1 jruoho #define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS)
283 1.1 jruoho #define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)
284 1.1 jruoho #define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES)
285 1.1 jruoho #define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO)
286 1.1 jruoho #define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS)
287 1.1 jruoho #define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
288 1.1 jruoho #define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
289 1.10 christos #define ACPI_DB_EVALUATION ACPI_DEBUG_LEVEL (ACPI_LV_EVALUATION)
290 1.1 jruoho #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
291 1.1 jruoho #define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS)
292 1.1 jruoho
293 1.1 jruoho #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
294 1.1 jruoho
295 1.1 jruoho /* Defaults for DebugLevel, debug and normal */
296 1.1 jruoho
297 1.10 christos #define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_EVALUATION | ACPI_LV_REPAIR)
298 1.15 christos #define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_REPAIR)
299 1.1 jruoho #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
300 1.1 jruoho
301 1.1 jruoho
302 1.2 christos /*
303 1.2 christos * Global trace flags
304 1.2 christos */
305 1.2 christos #define ACPI_TRACE_ENABLED ((UINT32) 4)
306 1.2 christos #define ACPI_TRACE_ONESHOT ((UINT32) 2)
307 1.2 christos #define ACPI_TRACE_OPCODE ((UINT32) 1)
308 1.2 christos
309 1.2 christos /* Defaults for trace debugging level/layer */
310 1.2 christos
311 1.2 christos #define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL
312 1.2 christos #define ACPI_TRACE_LAYER_ALL 0x000001FF
313 1.2 christos #define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT
314 1.2 christos #define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER
315 1.2 christos
316 1.2 christos
317 1.1 jruoho #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
318 1.1 jruoho /*
319 1.2 christos * The module name is used primarily for error and debug messages.
320 1.2 christos * The __FILE__ macro is not very useful for this, because it
321 1.2 christos * usually includes the entire pathname to the module making the
322 1.2 christos * debug output difficult to read.
323 1.1 jruoho */
324 1.1 jruoho #define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name;
325 1.1 jruoho #else
326 1.2 christos /*
327 1.2 christos * For the no-debug and no-error-msg cases, we must at least define
328 1.2 christos * a null module name.
329 1.2 christos */
330 1.1 jruoho #define ACPI_MODULE_NAME(Name)
331 1.2 christos #define _AcpiModuleName ""
332 1.1 jruoho #endif
333 1.1 jruoho
334 1.1 jruoho /*
335 1.1 jruoho * Ascii error messages can be configured out
336 1.1 jruoho */
337 1.1 jruoho #ifndef ACPI_NO_ERROR_MESSAGES
338 1.1 jruoho #define AE_INFO _AcpiModuleName, __LINE__
339 1.18 christos #define ACPI_ONCE(_fn, _plist) { static char _done; if (!_done) { _done = 1; _fn _plist; } }
340 1.1 jruoho
341 1.1 jruoho /*
342 1.1 jruoho * Error reporting. Callers module and line number are inserted by AE_INFO,
343 1.1 jruoho * the plist contains a set of parens to allow variable-length lists.
344 1.1 jruoho * These macros are used for both the debug and non-debug versions of the code.
345 1.1 jruoho */
346 1.1 jruoho #define ACPI_INFO(plist) AcpiInfo plist
347 1.1 jruoho #define ACPI_WARNING(plist) AcpiWarning plist
348 1.18 christos #define ACPI_WARNING_ONCE(plist) ACPI_ONCE(AcpiWarning, plist)
349 1.1 jruoho #define ACPI_EXCEPTION(plist) AcpiException plist
350 1.1 jruoho #define ACPI_ERROR(plist) AcpiError plist
351 1.18 christos #define ACPI_ERROR_ONCE(plist) ACPI_ONCE(AcpiError, plist)
352 1.2 christos #define ACPI_BIOS_WARNING(plist) AcpiBiosWarning plist
353 1.11 christos #define ACPI_BIOS_EXCEPTION(plist) AcpiBiosException plist
354 1.2 christos #define ACPI_BIOS_ERROR(plist) AcpiBiosError plist
355 1.1 jruoho #define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i)
356 1.1 jruoho
357 1.1 jruoho #else
358 1.1 jruoho
359 1.1 jruoho /* No error messages */
360 1.1 jruoho
361 1.1 jruoho #define ACPI_INFO(plist)
362 1.1 jruoho #define ACPI_WARNING(plist)
363 1.18 christos #define ACPI_WARNING_ONCE(plist)
364 1.1 jruoho #define ACPI_EXCEPTION(plist)
365 1.1 jruoho #define ACPI_ERROR(plist)
366 1.18 christos #define ACPI_ERROR_ONCE(plist)
367 1.2 christos #define ACPI_BIOS_WARNING(plist)
368 1.11 christos #define ACPI_BIOS_EXCEPTION(plist)
369 1.2 christos #define ACPI_BIOS_ERROR(plist)
370 1.1 jruoho #define ACPI_DEBUG_OBJECT(obj,l,i)
371 1.1 jruoho
372 1.1 jruoho #endif /* ACPI_NO_ERROR_MESSAGES */
373 1.1 jruoho
374 1.1 jruoho
375 1.1 jruoho /*
376 1.1 jruoho * Debug macros that are conditionally compiled
377 1.1 jruoho */
378 1.1 jruoho #ifdef ACPI_DEBUG_OUTPUT
379 1.1 jruoho
380 1.1 jruoho /*
381 1.1 jruoho * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
382 1.1 jruoho * define it now. This is the case where there the compiler does not support
383 1.1 jruoho * a __FUNCTION__ macro or equivalent.
384 1.1 jruoho */
385 1.1 jruoho #ifndef ACPI_GET_FUNCTION_NAME
386 1.1 jruoho #define ACPI_GET_FUNCTION_NAME _AcpiFunctionName
387 1.1 jruoho
388 1.1 jruoho /*
389 1.2 christos * The Name parameter should be the procedure name as a non-quoted string.
390 1.1 jruoho * The function name is also used by the function exit macros below.
391 1.1 jruoho * Note: (const char) is used to be compatible with the debug interfaces
392 1.1 jruoho * and macros such as __FUNCTION__.
393 1.1 jruoho */
394 1.1 jruoho #define ACPI_FUNCTION_NAME(Name) static const char _AcpiFunctionName[] = #Name;
395 1.1 jruoho
396 1.1 jruoho #else
397 1.1 jruoho /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
398 1.1 jruoho
399 1.1 jruoho #define ACPI_FUNCTION_NAME(Name)
400 1.1 jruoho #endif /* ACPI_GET_FUNCTION_NAME */
401 1.1 jruoho
402 1.1 jruoho /*
403 1.1 jruoho * Common parameters used for debug output functions:
404 1.1 jruoho * line number, function name, module(file) name, component ID
405 1.1 jruoho */
406 1.2 christos #define ACPI_DEBUG_PARAMETERS \
407 1.2 christos __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT
408 1.2 christos
409 1.2 christos /* Check if debug output is currently dynamically enabled */
410 1.2 christos
411 1.2 christos #define ACPI_IS_DEBUG_ENABLED(Level, Component) \
412 1.2 christos ((Level & AcpiDbgLevel) && (Component & AcpiDbgLayer))
413 1.1 jruoho
414 1.1 jruoho /*
415 1.1 jruoho * Master debug print macros
416 1.1 jruoho * Print message if and only if:
417 1.1 jruoho * 1) Debug print for the current component is enabled
418 1.1 jruoho * 2) Debug error level or trace level for the print statement is enabled
419 1.2 christos *
420 1.2 christos * November 2012: Moved the runtime check for whether to actually emit the
421 1.2 christos * debug message outside of the print function itself. This improves overall
422 1.2 christos * performance at a relatively small code cost. Implementation involves the
423 1.2 christos * use of variadic macros supported by C99.
424 1.2 christos *
425 1.2 christos * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from
426 1.2 christos * complaining about these constructs. On other compilers the do...while
427 1.2 christos * adds some extra code, so this feature is optional.
428 1.1 jruoho */
429 1.2 christos #ifdef ACPI_USE_DO_WHILE_0
430 1.2 christos #define ACPI_DO_WHILE0(a) do a while(0)
431 1.2 christos #else
432 1.2 christos #define ACPI_DO_WHILE0(a) a
433 1.2 christos #endif
434 1.2 christos
435 1.2 christos /* DEBUG_PRINT functions */
436 1.2 christos
437 1.2 christos #ifndef COMPILER_VA_MACRO
438 1.2 christos
439 1.1 jruoho #define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist
440 1.1 jruoho #define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist
441 1.1 jruoho
442 1.1 jruoho #else
443 1.2 christos
444 1.2 christos /* Helper macros for DEBUG_PRINT */
445 1.2 christos
446 1.2 christos #define ACPI_DO_DEBUG_PRINT(Function, Level, Line, Filename, Modulename, Component, ...) \
447 1.2 christos ACPI_DO_WHILE0 ({ \
448 1.2 christos if (ACPI_IS_DEBUG_ENABLED (Level, Component)) \
449 1.2 christos { \
450 1.2 christos Function (Level, Line, Filename, Modulename, Component, __VA_ARGS__); \
451 1.2 christos } \
452 1.2 christos })
453 1.2 christos
454 1.2 christos #define ACPI_ACTUAL_DEBUG(Level, Line, Filename, Modulename, Component, ...) \
455 1.2 christos ACPI_DO_DEBUG_PRINT (AcpiDebugPrint, Level, Line, \
456 1.2 christos Filename, Modulename, Component, __VA_ARGS__)
457 1.2 christos
458 1.2 christos #define ACPI_ACTUAL_DEBUG_RAW(Level, Line, Filename, Modulename, Component, ...) \
459 1.2 christos ACPI_DO_DEBUG_PRINT (AcpiDebugPrintRaw, Level, Line, \
460 1.2 christos Filename, Modulename, Component, __VA_ARGS__)
461 1.2 christos
462 1.2 christos #define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist
463 1.2 christos #define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist
464 1.2 christos
465 1.2 christos #endif
466 1.2 christos
467 1.2 christos
468 1.2 christos /*
469 1.2 christos * Function entry tracing
470 1.2 christos *
471 1.2 christos * The name of the function is emitted as a local variable that is
472 1.2 christos * intended to be used by both the entry trace and the exit trace.
473 1.2 christos */
474 1.2 christos
475 1.2 christos /* Helper macro */
476 1.2 christos
477 1.2 christos #define ACPI_TRACE_ENTRY(Name, Function, Type, Param) \
478 1.2 christos ACPI_FUNCTION_NAME (Name) \
479 1.4 jakllsch Function (ACPI_DEBUG_PARAMETERS, (Type) (Param))
480 1.2 christos
481 1.2 christos /* The actual entry trace macros */
482 1.2 christos
483 1.2 christos #define ACPI_FUNCTION_TRACE(Name) \
484 1.2 christos ACPI_FUNCTION_NAME(Name) \
485 1.2 christos AcpiUtTrace (ACPI_DEBUG_PARAMETERS)
486 1.2 christos
487 1.2 christos #define ACPI_FUNCTION_TRACE_PTR(Name, Pointer) \
488 1.4 jakllsch ACPI_TRACE_ENTRY (Name, AcpiUtTracePtr, const void *, Pointer)
489 1.2 christos
490 1.2 christos #define ACPI_FUNCTION_TRACE_U32(Name, Value) \
491 1.4 jakllsch ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, const UINT32, Value)
492 1.2 christos
493 1.2 christos #define ACPI_FUNCTION_TRACE_STR(Name, String) \
494 1.6 christos ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, const char *, String)
495 1.2 christos
496 1.2 christos #define ACPI_FUNCTION_ENTRY() \
497 1.2 christos AcpiUtTrackStackPtr()
498 1.2 christos
499 1.2 christos
500 1.2 christos /*
501 1.2 christos * Function exit tracing
502 1.2 christos *
503 1.2 christos * These macros include a return statement. This is usually considered
504 1.2 christos * bad form, but having a separate exit macro before the actual return
505 1.2 christos * is very ugly and difficult to maintain.
506 1.2 christos *
507 1.2 christos * One of the FUNCTION_TRACE macros above must be used in conjunction
508 1.2 christos * with these macros so that "_AcpiFunctionName" is defined.
509 1.2 christos *
510 1.2 christos * There are two versions of most of the return macros. The default version is
511 1.2 christos * safer, since it avoids side-effects by guaranteeing that the argument will
512 1.2 christos * not be evaluated twice.
513 1.2 christos *
514 1.2 christos * A less-safe version of the macros is provided for optional use if the
515 1.2 christos * compiler uses excessive CPU stack (for example, this may happen in the
516 1.13 christos * debug case if code optimization is disabled.)
517 1.2 christos */
518 1.2 christos
519 1.2 christos /* Exit trace helper macro */
520 1.2 christos
521 1.2 christos #ifndef ACPI_SIMPLE_RETURN_MACROS
522 1.2 christos
523 1.2 christos #define ACPI_TRACE_EXIT(Function, Type, Param) \
524 1.2 christos ACPI_DO_WHILE0 ({ \
525 1.2 christos register Type _Param = (Type) (Param); \
526 1.2 christos Function (ACPI_DEBUG_PARAMETERS, _Param); \
527 1.2 christos return (_Param); \
528 1.2 christos })
529 1.2 christos
530 1.2 christos #else /* Use original less-safe macros */
531 1.2 christos
532 1.2 christos #define ACPI_TRACE_EXIT(Function, Type, Param) \
533 1.2 christos ACPI_DO_WHILE0 ({ \
534 1.2 christos Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)); \
535 1.2 christos return (Param); \
536 1.2 christos })
537 1.2 christos
538 1.2 christos #endif /* ACPI_SIMPLE_RETURN_MACROS */
539 1.2 christos
540 1.2 christos /* The actual exit macros */
541 1.2 christos
542 1.2 christos #define return_VOID \
543 1.2 christos ACPI_DO_WHILE0 ({ \
544 1.2 christos AcpiUtExit (ACPI_DEBUG_PARAMETERS); \
545 1.2 christos return; \
546 1.2 christos })
547 1.2 christos
548 1.2 christos #define return_ACPI_STATUS(Status) \
549 1.2 christos ACPI_TRACE_EXIT (AcpiUtStatusExit, ACPI_STATUS, Status)
550 1.2 christos
551 1.2 christos #define return_PTR(Pointer) \
552 1.2 christos ACPI_TRACE_EXIT (AcpiUtPtrExit, void *, Pointer)
553 1.2 christos
554 1.3 christos #define return_STR(String) \
555 1.3 christos ACPI_TRACE_EXIT (AcpiUtStrExit, const char *, String)
556 1.3 christos
557 1.2 christos #define return_VALUE(Value) \
558 1.2 christos ACPI_TRACE_EXIT (AcpiUtValueExit, UINT64, Value)
559 1.2 christos
560 1.2 christos #define return_UINT32(Value) \
561 1.2 christos ACPI_TRACE_EXIT (AcpiUtValueExit, UINT32, Value)
562 1.2 christos
563 1.2 christos #define return_UINT8(Value) \
564 1.2 christos ACPI_TRACE_EXIT (AcpiUtValueExit, UINT8, Value)
565 1.2 christos
566 1.2 christos /* Conditional execution */
567 1.2 christos
568 1.2 christos #define ACPI_DEBUG_EXEC(a) a
569 1.14 christos #define ACPI_DEBUG_ONLY_MEMBERS(a) a
570 1.2 christos #define _VERBOSE_STRUCTURES
571 1.2 christos
572 1.2 christos
573 1.2 christos /* Various object display routines for debug */
574 1.2 christos
575 1.2 christos #define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a), 0)
576 1.2 christos #define ACPI_DUMP_OPERANDS(a, b ,c) AcpiExDumpOperands(a, b, c)
577 1.2 christos #define ACPI_DUMP_ENTRY(a, b) AcpiNsDumpEntry (a, b)
578 1.2 christos #define ACPI_DUMP_PATHNAME(a, b, c, d) AcpiNsDumpPathname(a, b, c, d)
579 1.2 christos #define ACPI_DUMP_BUFFER(a, b) AcpiUtDebugDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
580 1.2 christos
581 1.2 christos #define ACPI_TRACE_POINT(a, b, c, d) AcpiTracePoint (a, b, c, d)
582 1.2 christos
583 1.2 christos #else /* ACPI_DEBUG_OUTPUT */
584 1.1 jruoho /*
585 1.1 jruoho * This is the non-debug case -- make everything go away,
586 1.1 jruoho * leaving no executable debug code!
587 1.1 jruoho */
588 1.1 jruoho #define ACPI_DEBUG_PRINT(pl)
589 1.1 jruoho #define ACPI_DEBUG_PRINT_RAW(pl)
590 1.2 christos #define ACPI_DEBUG_EXEC(a)
591 1.2 christos #define ACPI_DEBUG_ONLY_MEMBERS(a)
592 1.2 christos #define ACPI_FUNCTION_NAME(a)
593 1.2 christos #define ACPI_FUNCTION_TRACE(a)
594 1.2 christos #define ACPI_FUNCTION_TRACE_PTR(a, b)
595 1.2 christos #define ACPI_FUNCTION_TRACE_U32(a, b)
596 1.2 christos #define ACPI_FUNCTION_TRACE_STR(a, b)
597 1.2 christos #define ACPI_FUNCTION_ENTRY()
598 1.2 christos #define ACPI_DUMP_STACK_ENTRY(a)
599 1.2 christos #define ACPI_DUMP_OPERANDS(a, b, c)
600 1.2 christos #define ACPI_DUMP_ENTRY(a, b)
601 1.2 christos #define ACPI_DUMP_PATHNAME(a, b, c, d)
602 1.2 christos #define ACPI_DUMP_BUFFER(a, b)
603 1.2 christos #define ACPI_IS_DEBUG_ENABLED(Level, Component) 0
604 1.2 christos #define ACPI_TRACE_POINT(a, b, c, d)
605 1.2 christos
606 1.2 christos /* Return macros must have a return statement at the minimum */
607 1.2 christos
608 1.2 christos #define return_VOID return
609 1.2 christos #define return_ACPI_STATUS(s) return(s)
610 1.2 christos #define return_PTR(s) return(s)
611 1.3 christos #define return_STR(s) return(s)
612 1.2 christos #define return_VALUE(s) return(s)
613 1.2 christos #define return_UINT8(s) return(s)
614 1.2 christos #define return_UINT32(s) return(s)
615 1.1 jruoho
616 1.1 jruoho #endif /* ACPI_DEBUG_OUTPUT */
617 1.1 jruoho
618 1.1 jruoho
619 1.1 jruoho #endif /* __ACOUTPUT_H__ */
620