167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Name: acoutput.h -- debug output 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 7316303Sjkim/****************************************************************************** 8316303Sjkim * 9316303Sjkim * 1. Copyright Notice 10316303Sjkim * 11316303Sjkim * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. 1270243Smsmith * All rights reserved. 1367754Smsmith * 14316303Sjkim * 2. License 15316303Sjkim * 16316303Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property 17316303Sjkim * rights. You may have additional license terms from the party that provided 18316303Sjkim * you this software, covering your right to use that party's intellectual 19316303Sjkim * property rights. 20316303Sjkim * 21316303Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22316303Sjkim * copy of the source code appearing in this file ("Covered Code") an 23316303Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24316303Sjkim * base code distributed originally by Intel ("Original Intel Code") to copy, 25316303Sjkim * make derivatives, distribute, use and display any portion of the Covered 26316303Sjkim * Code in any form, with the right to sublicense such rights; and 27316303Sjkim * 28316303Sjkim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29316303Sjkim * license (with the right to sublicense), under only those claims of Intel 30316303Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell, 31316303Sjkim * offer to sell, and import the Covered Code and derivative works thereof 32316303Sjkim * solely to the minimum extent necessary to exercise the above copyright 33316303Sjkim * license, and in no event shall the patent license extend to any additions 34316303Sjkim * to or modifications of the Original Intel Code. No other license or right 35316303Sjkim * is granted directly or by implication, estoppel or otherwise; 36316303Sjkim * 37316303Sjkim * The above copyright and patent license is granted only if the following 38316303Sjkim * conditions are met: 39316303Sjkim * 40316303Sjkim * 3. Conditions 41316303Sjkim * 42316303Sjkim * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43316303Sjkim * Redistribution of source code of any substantial portion of the Covered 44316303Sjkim * Code or modification with rights to further distribute source must include 45316303Sjkim * the above Copyright Notice, the above License, this list of Conditions, 46316303Sjkim * and the following Disclaimer and Export Compliance provision. In addition, 47316303Sjkim * Licensee must cause all Covered Code to which Licensee contributes to 48316303Sjkim * contain a file documenting the changes Licensee made to create that Covered 49316303Sjkim * Code and the date of any change. Licensee must include in that file the 50316303Sjkim * documentation of any changes made by any predecessor Licensee. Licensee 51316303Sjkim * must include a prominent statement that the modification is derived, 52316303Sjkim * directly or indirectly, from Original Intel Code. 53316303Sjkim * 54316303Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55316303Sjkim * Redistribution of source code of any substantial portion of the Covered 56316303Sjkim * Code or modification without rights to further distribute source must 57316303Sjkim * include the following Disclaimer and Export Compliance provision in the 58316303Sjkim * documentation and/or other materials provided with distribution. In 59316303Sjkim * addition, Licensee may not authorize further sublicense of source of any 60316303Sjkim * portion of the Covered Code, and must include terms to the effect that the 61316303Sjkim * license from Licensee to its licensee is limited to the intellectual 62316303Sjkim * property embodied in the software Licensee provides to its licensee, and 63316303Sjkim * not to intellectual property embodied in modifications its licensee may 64316303Sjkim * make. 65316303Sjkim * 66316303Sjkim * 3.3. Redistribution of Executable. Redistribution in executable form of any 67316303Sjkim * substantial portion of the Covered Code or modification must reproduce the 68316303Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance 69316303Sjkim * provision in the documentation and/or other materials provided with the 70316303Sjkim * distribution. 71316303Sjkim * 72316303Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original 73316303Sjkim * Intel Code. 74316303Sjkim * 75316303Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76316303Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or 77316303Sjkim * other dealings in products derived from or relating to the Covered Code 78316303Sjkim * without prior written authorization from Intel. 79316303Sjkim * 80316303Sjkim * 4. Disclaimer and Export Compliance 81316303Sjkim * 82316303Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83316303Sjkim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84316303Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85316303Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86316303Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87316303Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88316303Sjkim * PARTICULAR PURPOSE. 89316303Sjkim * 90316303Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91316303Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92316303Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93316303Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94316303Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95316303Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96316303Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97316303Sjkim * LIMITED REMEDY. 98316303Sjkim * 99316303Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this 100316303Sjkim * software or system incorporating such software without first obtaining any 101316303Sjkim * required license or other approval from the U. S. Department of Commerce or 102316303Sjkim * any other agency or department of the United States Government. In the 103316303Sjkim * event Licensee exports any such software from the United States or 104316303Sjkim * re-exports any such software from a foreign destination, Licensee shall 105316303Sjkim * ensure that the distribution and export/re-export of the software is in 106316303Sjkim * compliance with all laws, regulations, orders, or other restrictions of the 107316303Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108316303Sjkim * any of its subsidiaries will export/re-export any technical data, process, 109316303Sjkim * software, or service, directly or indirectly, to any country for which the 110316303Sjkim * United States government or any agency thereof requires an export license, 111316303Sjkim * other governmental approval, or letter of assurance, without first obtaining 112316303Sjkim * such license, approval or letter. 113316303Sjkim * 114316303Sjkim ***************************************************************************** 115316303Sjkim * 116316303Sjkim * Alternatively, you may choose to be licensed under the terms of the 117316303Sjkim * following license: 118316303Sjkim * 119217365Sjkim * Redistribution and use in source and binary forms, with or without 120217365Sjkim * modification, are permitted provided that the following conditions 121217365Sjkim * are met: 122217365Sjkim * 1. Redistributions of source code must retain the above copyright 123217365Sjkim * notice, this list of conditions, and the following disclaimer, 124217365Sjkim * without modification. 125217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 127217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 128217365Sjkim * including a substantially similar Disclaimer requirement for further 129217365Sjkim * binary redistribution. 130217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 131217365Sjkim * of any contributors may be used to endorse or promote products derived 132217365Sjkim * from this software without specific prior written permission. 13367754Smsmith * 134316303Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135316303Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136316303Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137316303Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138316303Sjkim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139316303Sjkim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140316303Sjkim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141316303Sjkim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142316303Sjkim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143316303Sjkim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144316303Sjkim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145316303Sjkim * 146316303Sjkim * Alternatively, you may choose to be licensed under the terms of the 147217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 148217365Sjkim * Software Foundation. 14967754Smsmith * 150316303Sjkim *****************************************************************************/ 15167754Smsmith 15267754Smsmith#ifndef __ACOUTPUT_H__ 15367754Smsmith#define __ACOUTPUT_H__ 15467754Smsmith 15567754Smsmith/* 156193267Sjkim * Debug levels and component IDs. These are used to control the 157193267Sjkim * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a 158193267Sjkim * per-component basis and a per-exception-type basis. 15967754Smsmith */ 16067754Smsmith 16182367Smsmith/* Component IDs are used in the global "DebugLayer" */ 16267754Smsmith 16377424Smsmith#define ACPI_UTILITIES 0x00000001 16477424Smsmith#define ACPI_HARDWARE 0x00000002 16577424Smsmith#define ACPI_EVENTS 0x00000004 16677424Smsmith#define ACPI_TABLES 0x00000008 16777424Smsmith#define ACPI_NAMESPACE 0x00000010 16877424Smsmith#define ACPI_PARSER 0x00000020 16977424Smsmith#define ACPI_DISPATCHER 0x00000040 17077424Smsmith#define ACPI_EXECUTER 0x00000080 17177424Smsmith#define ACPI_RESOURCES 0x00000100 172102550Siwasaki#define ACPI_CA_DEBUGGER 0x00000200 17378986Smsmith#define ACPI_OS_SERVICES 0x00000400 174102550Siwasaki#define ACPI_CA_DISASSEMBLER 0x00000800 17567754Smsmith 17691116Smsmith/* Component IDs for ACPI tools and utilities */ 17767754Smsmith 17891116Smsmith#define ACPI_COMPILER 0x00001000 17991116Smsmith#define ACPI_TOOLS 0x00002000 180193267Sjkim#define ACPI_EXAMPLE 0x00004000 181193267Sjkim#define ACPI_DRIVER 0x00008000 182209746Sjkim#define DT_COMPILER 0x00010000 183233250Sjkim#define ASL_PREPROCESSOR 0x00020000 18467754Smsmith 185209746Sjkim#define ACPI_ALL_COMPONENTS 0x0001FFFF 186102550Siwasaki#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 187102550Siwasaki 18891116Smsmith/* Component IDs reserved for ACPI drivers */ 18977424Smsmith 19091116Smsmith#define ACPI_ALL_DRIVERS 0xFFFF0000 19191116Smsmith 192114237Snjl 19382367Smsmith/* 194193267Sjkim * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros 19582367Smsmith */ 196193267Sjkim#define ACPI_LV_INIT 0x00000001 197193267Sjkim#define ACPI_LV_DEBUG_OBJECT 0x00000002 198193267Sjkim#define ACPI_LV_INFO 0x00000004 199200553Sjkim#define ACPI_LV_REPAIR 0x00000008 200285797Sjkim#define ACPI_LV_TRACE_POINT 0x00000010 201285797Sjkim#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F 20282367Smsmith 20383174Smsmith/* Trace verbosity level 1 [Standard Trace Level] */ 20482367Smsmith 205114237Snjl#define ACPI_LV_INIT_NAMES 0x00000020 20683174Smsmith#define ACPI_LV_PARSE 0x00000040 20783174Smsmith#define ACPI_LV_LOAD 0x00000080 20883174Smsmith#define ACPI_LV_DISPATCH 0x00000100 20983174Smsmith#define ACPI_LV_EXEC 0x00000200 21083174Smsmith#define ACPI_LV_NAMES 0x00000400 21183174Smsmith#define ACPI_LV_OPREGION 0x00000800 21283174Smsmith#define ACPI_LV_BFIELD 0x00001000 21383174Smsmith#define ACPI_LV_TABLES 0x00002000 21483174Smsmith#define ACPI_LV_VALUES 0x00004000 21583174Smsmith#define ACPI_LV_OBJECTS 0x00008000 21683174Smsmith#define ACPI_LV_RESOURCES 0x00010000 21783174Smsmith#define ACPI_LV_USER_REQUESTS 0x00020000 21883174Smsmith#define ACPI_LV_PACKAGE 0x00040000 219114237Snjl#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS 22083174Smsmith 22183174Smsmith/* Trace verbosity level 2 [Function tracing and memory allocation] */ 22283174Smsmith 22382367Smsmith#define ACPI_LV_ALLOCATIONS 0x00100000 22483174Smsmith#define ACPI_LV_FUNCTIONS 0x00200000 225102550Siwasaki#define ACPI_LV_OPTIMIZATIONS 0x00400000 226102550Siwasaki#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1 22783174Smsmith#define ACPI_LV_ALL ACPI_LV_VERBOSITY2 22882367Smsmith 22983174Smsmith/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ 23082367Smsmith 23183174Smsmith#define ACPI_LV_MUTEX 0x01000000 23283174Smsmith#define ACPI_LV_THREADS 0x02000000 23383174Smsmith#define ACPI_LV_IO 0x04000000 23483174Smsmith#define ACPI_LV_INTERRUPTS 0x08000000 23583174Smsmith#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 23683174Smsmith 23799679Siwasaki/* Exceptionally verbose output -- also used in the global "DebugLevel" */ 23899679Siwasaki 23999679Siwasaki#define ACPI_LV_AML_DISASSEMBLE 0x10000000 24099679Siwasaki#define ACPI_LV_VERBOSE_INFO 0x20000000 24199679Siwasaki#define ACPI_LV_FULL_TABLES 0x40000000 24299679Siwasaki#define ACPI_LV_EVENTS 0x80000000 24399679Siwasaki#define ACPI_LV_VERBOSE 0xF0000000 24499679Siwasaki 24599679Siwasaki 24682367Smsmith/* 24782367Smsmith * Debug level macros that are used in the DEBUG_PRINT macros 24882367Smsmith */ 249151937Sjkim#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS 25082367Smsmith 251193267Sjkim/* 252193267Sjkim * Exception level -- used in the global "DebugLevel" 253193267Sjkim * 254193267Sjkim * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. 255193267Sjkim * For warnings, use ACPI_WARNING. 256193267Sjkim */ 257114237Snjl#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) 25882367Smsmith#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) 259114237Snjl#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) 260200553Sjkim#define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) 261285797Sjkim#define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT) 26282367Smsmith#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) 26367754Smsmith 26467754Smsmith/* Trace level -- also used in the global "DebugLevel" */ 26567754Smsmith 266114237Snjl#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 26782367Smsmith#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) 26882367Smsmith#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) 26982367Smsmith#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) 27082367Smsmith#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) 27182367Smsmith#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) 27282367Smsmith#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) 27382367Smsmith#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) 27482367Smsmith#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) 27582367Smsmith#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) 27682367Smsmith#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) 277102550Siwasaki#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) 27882367Smsmith#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) 27982367Smsmith#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) 28082367Smsmith#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) 28182367Smsmith#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) 28282367Smsmith#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) 28382367Smsmith#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) 28482367Smsmith#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) 28582367Smsmith#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) 28682367Smsmith#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) 287193267Sjkim#define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) 28867754Smsmith 28999679Siwasaki#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) 29067754Smsmith 29167754Smsmith/* Defaults for DebugLevel, debug and normal */ 29267754Smsmith 293200553Sjkim#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) 294200553Sjkim#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) 295114237Snjl#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 29667754Smsmith 29767754Smsmith 298285797Sjkim/* 299285797Sjkim * Global trace flags 300285797Sjkim */ 301285797Sjkim#define ACPI_TRACE_ENABLED ((UINT32) 4) 302285797Sjkim#define ACPI_TRACE_ONESHOT ((UINT32) 2) 303285797Sjkim#define ACPI_TRACE_OPCODE ((UINT32) 1) 304285797Sjkim 305285797Sjkim/* Defaults for trace debugging level/layer */ 306285797Sjkim 307285797Sjkim#define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL 308285797Sjkim#define ACPI_TRACE_LAYER_ALL 0x000001FF 309285797Sjkim#define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT 310285797Sjkim#define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER 311285797Sjkim 312285797Sjkim 313193267Sjkim#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) 314193267Sjkim/* 315218590Sjkim * The module name is used primarily for error and debug messages. 316218590Sjkim * The __FILE__ macro is not very useful for this, because it 317218590Sjkim * usually includes the entire pathname to the module making the 318218590Sjkim * debug output difficult to read. 319193267Sjkim */ 320193267Sjkim#define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name; 321193267Sjkim#else 322218590Sjkim/* 323218590Sjkim * For the no-debug and no-error-msg cases, we must at least define 324218590Sjkim * a null module name. 325218590Sjkim */ 326193267Sjkim#define ACPI_MODULE_NAME(Name) 327218590Sjkim#define _AcpiModuleName "" 328193267Sjkim#endif 329193267Sjkim 330193267Sjkim/* 331193267Sjkim * Ascii error messages can be configured out 332193267Sjkim */ 333193267Sjkim#ifndef ACPI_NO_ERROR_MESSAGES 334193267Sjkim#define AE_INFO _AcpiModuleName, __LINE__ 335193267Sjkim 336193267Sjkim/* 337193267Sjkim * Error reporting. Callers module and line number are inserted by AE_INFO, 338193267Sjkim * the plist contains a set of parens to allow variable-length lists. 339193267Sjkim * These macros are used for both the debug and non-debug versions of the code. 340193267Sjkim */ 341193267Sjkim#define ACPI_INFO(plist) AcpiInfo plist 342193267Sjkim#define ACPI_WARNING(plist) AcpiWarning plist 343193267Sjkim#define ACPI_EXCEPTION(plist) AcpiException plist 344193267Sjkim#define ACPI_ERROR(plist) AcpiError plist 345238381Sjkim#define ACPI_BIOS_WARNING(plist) AcpiBiosWarning plist 346238381Sjkim#define ACPI_BIOS_ERROR(plist) AcpiBiosError plist 347204773Sjkim#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i) 348193267Sjkim 349193267Sjkim#else 350193267Sjkim 351193267Sjkim/* No error messages */ 352193267Sjkim 353193267Sjkim#define ACPI_INFO(plist) 354193267Sjkim#define ACPI_WARNING(plist) 355193267Sjkim#define ACPI_EXCEPTION(plist) 356193267Sjkim#define ACPI_ERROR(plist) 357238381Sjkim#define ACPI_BIOS_WARNING(plist) 358238381Sjkim#define ACPI_BIOS_ERROR(plist) 359204773Sjkim#define ACPI_DEBUG_OBJECT(obj,l,i) 360193267Sjkim 361193267Sjkim#endif /* ACPI_NO_ERROR_MESSAGES */ 362193267Sjkim 363193267Sjkim 364193267Sjkim/* 365193267Sjkim * Debug macros that are conditionally compiled 366193267Sjkim */ 367193267Sjkim#ifdef ACPI_DEBUG_OUTPUT 368193267Sjkim 369193267Sjkim/* 370193267Sjkim * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, 371193267Sjkim * define it now. This is the case where there the compiler does not support 372193267Sjkim * a __FUNCTION__ macro or equivalent. 373193267Sjkim */ 374193267Sjkim#ifndef ACPI_GET_FUNCTION_NAME 375193267Sjkim#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName 376193267Sjkim 377193267Sjkim/* 378298714Sjkim * The Name parameter should be the procedure name as a non-quoted string. 379193267Sjkim * The function name is also used by the function exit macros below. 380193267Sjkim * Note: (const char) is used to be compatible with the debug interfaces 381193267Sjkim * and macros such as __FUNCTION__. 382193267Sjkim */ 383193267Sjkim#define ACPI_FUNCTION_NAME(Name) static const char _AcpiFunctionName[] = #Name; 384193267Sjkim 385193267Sjkim#else 386193267Sjkim/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 387193267Sjkim 388193267Sjkim#define ACPI_FUNCTION_NAME(Name) 389193267Sjkim#endif /* ACPI_GET_FUNCTION_NAME */ 390193267Sjkim 391193267Sjkim/* 392193267Sjkim * Common parameters used for debug output functions: 393193267Sjkim * line number, function name, module(file) name, component ID 394193267Sjkim */ 395245582Sjkim#define ACPI_DEBUG_PARAMETERS \ 396245582Sjkim __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT 397193267Sjkim 398245582Sjkim/* Check if debug output is currently dynamically enabled */ 399245582Sjkim 400245582Sjkim#define ACPI_IS_DEBUG_ENABLED(Level, Component) \ 401245582Sjkim ((Level & AcpiDbgLevel) && (Component & AcpiDbgLayer)) 402245582Sjkim 403193267Sjkim/* 404193267Sjkim * Master debug print macros 405193267Sjkim * Print message if and only if: 406193267Sjkim * 1) Debug print for the current component is enabled 407193267Sjkim * 2) Debug error level or trace level for the print statement is enabled 408245582Sjkim * 409245582Sjkim * November 2012: Moved the runtime check for whether to actually emit the 410245582Sjkim * debug message outside of the print function itself. This improves overall 411245582Sjkim * performance at a relatively small code cost. Implementation involves the 412245582Sjkim * use of variadic macros supported by C99. 413245582Sjkim * 414245582Sjkim * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from 415245582Sjkim * complaining about these constructs. On other compilers the do...while 416245582Sjkim * adds some extra code, so this feature is optional. 417193267Sjkim */ 418245582Sjkim#ifdef ACPI_USE_DO_WHILE_0 419245582Sjkim#define ACPI_DO_WHILE0(a) do a while(0) 420245582Sjkim#else 421245582Sjkim#define ACPI_DO_WHILE0(a) a 422245582Sjkim#endif 423193267Sjkim 424245582Sjkim/* DEBUG_PRINT functions */ 425245582Sjkim 426284583Sjkim#ifndef COMPILER_VA_MACRO 427245582Sjkim 428284583Sjkim#define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist 429284583Sjkim#define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist 430284583Sjkim 431284583Sjkim#else 432284583Sjkim 433245582Sjkim/* Helper macros for DEBUG_PRINT */ 434245582Sjkim 435245582Sjkim#define ACPI_DO_DEBUG_PRINT(Function, Level, Line, Filename, Modulename, Component, ...) \ 436245582Sjkim ACPI_DO_WHILE0 ({ \ 437245582Sjkim if (ACPI_IS_DEBUG_ENABLED (Level, Component)) \ 438245582Sjkim { \ 439245582Sjkim Function (Level, Line, Filename, Modulename, Component, __VA_ARGS__); \ 440245582Sjkim } \ 441245582Sjkim }) 442245582Sjkim 443245582Sjkim#define ACPI_ACTUAL_DEBUG(Level, Line, Filename, Modulename, Component, ...) \ 444245582Sjkim ACPI_DO_DEBUG_PRINT (AcpiDebugPrint, Level, Line, \ 445245582Sjkim Filename, Modulename, Component, __VA_ARGS__) 446245582Sjkim 447245582Sjkim#define ACPI_ACTUAL_DEBUG_RAW(Level, Line, Filename, Modulename, Component, ...) \ 448245582Sjkim ACPI_DO_DEBUG_PRINT (AcpiDebugPrintRaw, Level, Line, \ 449245582Sjkim Filename, Modulename, Component, __VA_ARGS__) 450245582Sjkim 451284583Sjkim#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist 452284583Sjkim#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist 453245582Sjkim 454284583Sjkim#endif 455284583Sjkim 456284583Sjkim 457193267Sjkim/* 458245582Sjkim * Function entry tracing 459245582Sjkim * 460245582Sjkim * The name of the function is emitted as a local variable that is 461245582Sjkim * intended to be used by both the entry trace and the exit trace. 462245582Sjkim */ 463245582Sjkim 464245582Sjkim/* Helper macro */ 465245582Sjkim 466246040Sjkim#define ACPI_TRACE_ENTRY(Name, Function, Type, Param) \ 467245582Sjkim ACPI_FUNCTION_NAME (Name) \ 468246040Sjkim Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)) 469245582Sjkim 470245582Sjkim/* The actual entry trace macros */ 471245582Sjkim 472245582Sjkim#define ACPI_FUNCTION_TRACE(Name) \ 473245582Sjkim ACPI_FUNCTION_NAME(Name) \ 474245582Sjkim AcpiUtTrace (ACPI_DEBUG_PARAMETERS) 475245582Sjkim 476245582Sjkim#define ACPI_FUNCTION_TRACE_PTR(Name, Pointer) \ 477246040Sjkim ACPI_TRACE_ENTRY (Name, AcpiUtTracePtr, void *, Pointer) 478245582Sjkim 479245582Sjkim#define ACPI_FUNCTION_TRACE_U32(Name, Value) \ 480246040Sjkim ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, UINT32, Value) 481245582Sjkim 482245582Sjkim#define ACPI_FUNCTION_TRACE_STR(Name, String) \ 483298714Sjkim ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, const char *, String) 484245582Sjkim 485245582Sjkim#define ACPI_FUNCTION_ENTRY() \ 486245582Sjkim AcpiUtTrackStackPtr() 487245582Sjkim 488245582Sjkim 489245582Sjkim/* 490245582Sjkim * Function exit tracing 491245582Sjkim * 492245582Sjkim * These macros include a return statement. This is usually considered 493245582Sjkim * bad form, but having a separate exit macro before the actual return 494245582Sjkim * is very ugly and difficult to maintain. 495245582Sjkim * 496245582Sjkim * One of the FUNCTION_TRACE macros above must be used in conjunction 497245582Sjkim * with these macros so that "_AcpiFunctionName" is defined. 498246040Sjkim * 499246040Sjkim * There are two versions of most of the return macros. The default version is 500246040Sjkim * safer, since it avoids side-effects by guaranteeing that the argument will 501246040Sjkim * not be evaluated twice. 502246040Sjkim * 503246040Sjkim * A less-safe version of the macros is provided for optional use if the 504246040Sjkim * compiler uses excessive CPU stack (for example, this may happen in the 505246040Sjkim * debug case if code optimzation is disabled.) 506245582Sjkim */ 507245582Sjkim 508245582Sjkim/* Exit trace helper macro */ 509245582Sjkim 510246040Sjkim#ifndef ACPI_SIMPLE_RETURN_MACROS 511246040Sjkim 512246040Sjkim#define ACPI_TRACE_EXIT(Function, Type, Param) \ 513245582Sjkim ACPI_DO_WHILE0 ({ \ 514246040Sjkim register Type _Param = (Type) (Param); \ 515246040Sjkim Function (ACPI_DEBUG_PARAMETERS, _Param); \ 516246040Sjkim return (_Param); \ 517245582Sjkim }) 518245582Sjkim 519246040Sjkim#else /* Use original less-safe macros */ 520246040Sjkim 521246040Sjkim#define ACPI_TRACE_EXIT(Function, Type, Param) \ 522246040Sjkim ACPI_DO_WHILE0 ({ \ 523246040Sjkim Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)); \ 524246040Sjkim return (Param); \ 525246040Sjkim }) 526246040Sjkim 527246040Sjkim#endif /* ACPI_SIMPLE_RETURN_MACROS */ 528246040Sjkim 529245582Sjkim/* The actual exit macros */ 530245582Sjkim 531245582Sjkim#define return_VOID \ 532245582Sjkim ACPI_DO_WHILE0 ({ \ 533245582Sjkim AcpiUtExit (ACPI_DEBUG_PARAMETERS); \ 534245582Sjkim return; \ 535245582Sjkim }) 536245582Sjkim 537245582Sjkim#define return_ACPI_STATUS(Status) \ 538246040Sjkim ACPI_TRACE_EXIT (AcpiUtStatusExit, ACPI_STATUS, Status) 539245582Sjkim 540245582Sjkim#define return_PTR(Pointer) \ 541246040Sjkim ACPI_TRACE_EXIT (AcpiUtPtrExit, void *, Pointer) 542245582Sjkim 543298714Sjkim#define return_STR(String) \ 544298714Sjkim ACPI_TRACE_EXIT (AcpiUtStrExit, const char *, String) 545298714Sjkim 546245582Sjkim#define return_VALUE(Value) \ 547246040Sjkim ACPI_TRACE_EXIT (AcpiUtValueExit, UINT64, Value) 548245582Sjkim 549246849Sjkim#define return_UINT32(Value) \ 550246849Sjkim ACPI_TRACE_EXIT (AcpiUtValueExit, UINT32, Value) 551245582Sjkim 552246849Sjkim#define return_UINT8(Value) \ 553246849Sjkim ACPI_TRACE_EXIT (AcpiUtValueExit, UINT8, Value) 554246849Sjkim 555245582Sjkim/* Conditional execution */ 556245582Sjkim 557245582Sjkim#define ACPI_DEBUG_EXEC(a) a 558245582Sjkim#define ACPI_DEBUG_ONLY_MEMBERS(a) a; 559245582Sjkim#define _VERBOSE_STRUCTURES 560245582Sjkim 561245582Sjkim 562245582Sjkim/* Various object display routines for debug */ 563245582Sjkim 564245582Sjkim#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a), 0) 565245582Sjkim#define ACPI_DUMP_OPERANDS(a, b ,c) AcpiExDumpOperands(a, b, c) 566245582Sjkim#define ACPI_DUMP_ENTRY(a, b) AcpiNsDumpEntry (a, b) 567245582Sjkim#define ACPI_DUMP_PATHNAME(a, b, c, d) AcpiNsDumpPathname(a, b, c, d) 568245582Sjkim#define ACPI_DUMP_BUFFER(a, b) AcpiUtDebugDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) 569245582Sjkim 570285797Sjkim#define ACPI_TRACE_POINT(a, b, c, d) AcpiTracePoint (a, b, c, d) 571285797Sjkim 572245582Sjkim#else /* ACPI_DEBUG_OUTPUT */ 573245582Sjkim/* 574193267Sjkim * This is the non-debug case -- make everything go away, 575193267Sjkim * leaving no executable debug code! 576193267Sjkim */ 577193267Sjkim#define ACPI_DEBUG_PRINT(pl) 578193267Sjkim#define ACPI_DEBUG_PRINT_RAW(pl) 579245582Sjkim#define ACPI_DEBUG_EXEC(a) 580245582Sjkim#define ACPI_DEBUG_ONLY_MEMBERS(a) 581249663Sjkim#define ACPI_FUNCTION_NAME(a) 582245582Sjkim#define ACPI_FUNCTION_TRACE(a) 583245582Sjkim#define ACPI_FUNCTION_TRACE_PTR(a, b) 584245582Sjkim#define ACPI_FUNCTION_TRACE_U32(a, b) 585245582Sjkim#define ACPI_FUNCTION_TRACE_STR(a, b) 586245582Sjkim#define ACPI_FUNCTION_ENTRY() 587245582Sjkim#define ACPI_DUMP_STACK_ENTRY(a) 588245582Sjkim#define ACPI_DUMP_OPERANDS(a, b, c) 589245582Sjkim#define ACPI_DUMP_ENTRY(a, b) 590245582Sjkim#define ACPI_DUMP_PATHNAME(a, b, c, d) 591245582Sjkim#define ACPI_DUMP_BUFFER(a, b) 592245582Sjkim#define ACPI_IS_DEBUG_ENABLED(Level, Component) 0 593285797Sjkim#define ACPI_TRACE_POINT(a, b, c, d) 594193267Sjkim 595245582Sjkim/* Return macros must have a return statement at the minimum */ 596245582Sjkim 597245582Sjkim#define return_VOID return 598245582Sjkim#define return_ACPI_STATUS(s) return(s) 599246849Sjkim#define return_PTR(s) return(s) 600298720Sjkim#define return_STR(s) return(s) 601245582Sjkim#define return_VALUE(s) return(s) 602246849Sjkim#define return_UINT8(s) return(s) 603246849Sjkim#define return_UINT32(s) return(s) 604245582Sjkim 605193267Sjkim#endif /* ACPI_DEBUG_OUTPUT */ 606193267Sjkim 607193267Sjkim 60867754Smsmith#endif /* __ACOUTPUT_H__ */ 609