acoutput.h revision 193267
167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Name: acoutput.h -- debug output 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 767754Smsmith/****************************************************************************** 867754Smsmith * 967754Smsmith * 1. Copyright Notice 1067754Smsmith * 11193267Sjkim * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. 1270243Smsmith * All rights reserved. 1367754Smsmith * 1467754Smsmith * 2. License 1567754Smsmith * 1667754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property 1767754Smsmith * rights. You may have additional license terms from the party that provided 1867754Smsmith * you this software, covering your right to use that party's intellectual 1967754Smsmith * property rights. 2067754Smsmith * 2167754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 2267754Smsmith * copy of the source code appearing in this file ("Covered Code") an 2367754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the 2467754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy, 2567754Smsmith * make derivatives, distribute, use and display any portion of the Covered 2667754Smsmith * Code in any form, with the right to sublicense such rights; and 2767754Smsmith * 2867754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 2967754Smsmith * license (with the right to sublicense), under only those claims of Intel 3067754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell, 3167754Smsmith * offer to sell, and import the Covered Code and derivative works thereof 3267754Smsmith * solely to the minimum extent necessary to exercise the above copyright 3367754Smsmith * license, and in no event shall the patent license extend to any additions 3467754Smsmith * to or modifications of the Original Intel Code. No other license or right 3567754Smsmith * is granted directly or by implication, estoppel or otherwise; 3667754Smsmith * 3767754Smsmith * The above copyright and patent license is granted only if the following 3867754Smsmith * conditions are met: 3967754Smsmith * 4067754Smsmith * 3. Conditions 4167754Smsmith * 4267754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4367754Smsmith * Redistribution of source code of any substantial portion of the Covered 4467754Smsmith * Code or modification with rights to further distribute source must include 4567754Smsmith * the above Copyright Notice, the above License, this list of Conditions, 4667754Smsmith * and the following Disclaimer and Export Compliance provision. In addition, 4767754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to 4867754Smsmith * contain a file documenting the changes Licensee made to create that Covered 4967754Smsmith * Code and the date of any change. Licensee must include in that file the 5067754Smsmith * documentation of any changes made by any predecessor Licensee. Licensee 5167754Smsmith * must include a prominent statement that the modification is derived, 5267754Smsmith * directly or indirectly, from Original Intel Code. 5367754Smsmith * 5467754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 5567754Smsmith * Redistribution of source code of any substantial portion of the Covered 5667754Smsmith * Code or modification without rights to further distribute source must 5767754Smsmith * include the following Disclaimer and Export Compliance provision in the 5867754Smsmith * documentation and/or other materials provided with distribution. In 5967754Smsmith * addition, Licensee may not authorize further sublicense of source of any 6067754Smsmith * portion of the Covered Code, and must include terms to the effect that the 6167754Smsmith * license from Licensee to its licensee is limited to the intellectual 6267754Smsmith * property embodied in the software Licensee provides to its licensee, and 6367754Smsmith * not to intellectual property embodied in modifications its licensee may 6467754Smsmith * make. 6567754Smsmith * 6667754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any 6767754Smsmith * substantial portion of the Covered Code or modification must reproduce the 6867754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance 6967754Smsmith * provision in the documentation and/or other materials provided with the 7067754Smsmith * distribution. 7167754Smsmith * 7267754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original 7367754Smsmith * Intel Code. 7467754Smsmith * 7567754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by 7667754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or 7767754Smsmith * other dealings in products derived from or relating to the Covered Code 7867754Smsmith * without prior written authorization from Intel. 7967754Smsmith * 8067754Smsmith * 4. Disclaimer and Export Compliance 8167754Smsmith * 8267754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 8367754Smsmith * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 8467754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 8567754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 8667754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 8767754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 8867754Smsmith * PARTICULAR PURPOSE. 8967754Smsmith * 9067754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 9167754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 9267754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 9367754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 9467754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 9567754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 9667754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 9767754Smsmith * LIMITED REMEDY. 9867754Smsmith * 9967754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this 10067754Smsmith * software or system incorporating such software without first obtaining any 10167754Smsmith * required license or other approval from the U. S. Department of Commerce or 10267754Smsmith * any other agency or department of the United States Government. In the 10367754Smsmith * event Licensee exports any such software from the United States or 10467754Smsmith * re-exports any such software from a foreign destination, Licensee shall 10567754Smsmith * ensure that the distribution and export/re-export of the software is in 10667754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the 10767754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor 10867754Smsmith * any of its subsidiaries will export/re-export any technical data, process, 10967754Smsmith * software, or service, directly or indirectly, to any country for which the 11067754Smsmith * United States government or any agency thereof requires an export license, 11167754Smsmith * other governmental approval, or letter of assurance, without first obtaining 11267754Smsmith * such license, approval or letter. 11367754Smsmith * 11467754Smsmith *****************************************************************************/ 11567754Smsmith 11667754Smsmith#ifndef __ACOUTPUT_H__ 11767754Smsmith#define __ACOUTPUT_H__ 11867754Smsmith 11967754Smsmith/* 120193267Sjkim * Debug levels and component IDs. These are used to control the 121193267Sjkim * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a 122193267Sjkim * per-component basis and a per-exception-type basis. 12367754Smsmith */ 12467754Smsmith 12582367Smsmith/* Component IDs are used in the global "DebugLayer" */ 12667754Smsmith 12777424Smsmith#define ACPI_UTILITIES 0x00000001 12877424Smsmith#define ACPI_HARDWARE 0x00000002 12977424Smsmith#define ACPI_EVENTS 0x00000004 13077424Smsmith#define ACPI_TABLES 0x00000008 13177424Smsmith#define ACPI_NAMESPACE 0x00000010 13277424Smsmith#define ACPI_PARSER 0x00000020 13377424Smsmith#define ACPI_DISPATCHER 0x00000040 13477424Smsmith#define ACPI_EXECUTER 0x00000080 13577424Smsmith#define ACPI_RESOURCES 0x00000100 136102550Siwasaki#define ACPI_CA_DEBUGGER 0x00000200 13778986Smsmith#define ACPI_OS_SERVICES 0x00000400 138102550Siwasaki#define ACPI_CA_DISASSEMBLER 0x00000800 13967754Smsmith 14091116Smsmith/* Component IDs for ACPI tools and utilities */ 14167754Smsmith 14291116Smsmith#define ACPI_COMPILER 0x00001000 14391116Smsmith#define ACPI_TOOLS 0x00002000 144193267Sjkim#define ACPI_EXAMPLE 0x00004000 145193267Sjkim#define ACPI_DRIVER 0x00008000 14667754Smsmith 147193267Sjkim#define ACPI_ALL_COMPONENTS 0x0000FFFF 148102550Siwasaki#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 149102550Siwasaki 15091116Smsmith/* Component IDs reserved for ACPI drivers */ 15177424Smsmith 15291116Smsmith#define ACPI_ALL_DRIVERS 0xFFFF0000 15391116Smsmith 154114237Snjl 15582367Smsmith/* 156193267Sjkim * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros 15782367Smsmith */ 158193267Sjkim#define ACPI_LV_INIT 0x00000001 159193267Sjkim#define ACPI_LV_DEBUG_OBJECT 0x00000002 160193267Sjkim#define ACPI_LV_INFO 0x00000004 161193267Sjkim#define ACPI_LV_ALL_EXCEPTIONS 0x00000007 16282367Smsmith 16383174Smsmith/* Trace verbosity level 1 [Standard Trace Level] */ 16482367Smsmith 165114237Snjl#define ACPI_LV_INIT_NAMES 0x00000020 16683174Smsmith#define ACPI_LV_PARSE 0x00000040 16783174Smsmith#define ACPI_LV_LOAD 0x00000080 16883174Smsmith#define ACPI_LV_DISPATCH 0x00000100 16983174Smsmith#define ACPI_LV_EXEC 0x00000200 17083174Smsmith#define ACPI_LV_NAMES 0x00000400 17183174Smsmith#define ACPI_LV_OPREGION 0x00000800 17283174Smsmith#define ACPI_LV_BFIELD 0x00001000 17383174Smsmith#define ACPI_LV_TABLES 0x00002000 17483174Smsmith#define ACPI_LV_VALUES 0x00004000 17583174Smsmith#define ACPI_LV_OBJECTS 0x00008000 17683174Smsmith#define ACPI_LV_RESOURCES 0x00010000 17783174Smsmith#define ACPI_LV_USER_REQUESTS 0x00020000 17883174Smsmith#define ACPI_LV_PACKAGE 0x00040000 179114237Snjl#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS 18083174Smsmith 18183174Smsmith/* Trace verbosity level 2 [Function tracing and memory allocation] */ 18283174Smsmith 18382367Smsmith#define ACPI_LV_ALLOCATIONS 0x00100000 18483174Smsmith#define ACPI_LV_FUNCTIONS 0x00200000 185102550Siwasaki#define ACPI_LV_OPTIMIZATIONS 0x00400000 186102550Siwasaki#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1 18783174Smsmith#define ACPI_LV_ALL ACPI_LV_VERBOSITY2 18882367Smsmith 18983174Smsmith/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ 19082367Smsmith 19183174Smsmith#define ACPI_LV_MUTEX 0x01000000 19283174Smsmith#define ACPI_LV_THREADS 0x02000000 19383174Smsmith#define ACPI_LV_IO 0x04000000 19483174Smsmith#define ACPI_LV_INTERRUPTS 0x08000000 19583174Smsmith#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 19683174Smsmith 19799679Siwasaki/* Exceptionally verbose output -- also used in the global "DebugLevel" */ 19899679Siwasaki 19999679Siwasaki#define ACPI_LV_AML_DISASSEMBLE 0x10000000 20099679Siwasaki#define ACPI_LV_VERBOSE_INFO 0x20000000 20199679Siwasaki#define ACPI_LV_FULL_TABLES 0x40000000 20299679Siwasaki#define ACPI_LV_EVENTS 0x80000000 20399679Siwasaki#define ACPI_LV_VERBOSE 0xF0000000 20499679Siwasaki 20599679Siwasaki 20682367Smsmith/* 20782367Smsmith * Debug level macros that are used in the DEBUG_PRINT macros 20882367Smsmith */ 209151937Sjkim#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS 21082367Smsmith 211193267Sjkim/* 212193267Sjkim * Exception level -- used in the global "DebugLevel" 213193267Sjkim * 214193267Sjkim * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. 215193267Sjkim * For warnings, use ACPI_WARNING. 216193267Sjkim */ 217114237Snjl#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) 21882367Smsmith#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) 219114237Snjl#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) 22082367Smsmith#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) 22167754Smsmith 22267754Smsmith/* Trace level -- also used in the global "DebugLevel" */ 22367754Smsmith 224114237Snjl#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 22582367Smsmith#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) 22682367Smsmith#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) 22782367Smsmith#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) 22882367Smsmith#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) 22982367Smsmith#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) 23082367Smsmith#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) 23182367Smsmith#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) 23282367Smsmith#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) 23382367Smsmith#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) 23482367Smsmith#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) 235102550Siwasaki#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) 23682367Smsmith#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) 23782367Smsmith#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) 23882367Smsmith#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) 23982367Smsmith#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) 24082367Smsmith#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) 24182367Smsmith#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) 24282367Smsmith#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) 24382367Smsmith#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) 24482367Smsmith#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) 245193267Sjkim#define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) 24667754Smsmith 24799679Siwasaki#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) 24867754Smsmith 24967754Smsmith/* Defaults for DebugLevel, debug and normal */ 25067754Smsmith 251193267Sjkim#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) 252193267Sjkim#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) 253114237Snjl#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 25467754Smsmith 25567754Smsmith 256193267Sjkim#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) 257193267Sjkim/* 258193267Sjkim * Module name is included in both debug and non-debug versions primarily for 259193267Sjkim * error messages. The __FILE__ macro is not very useful for this, because it 260193267Sjkim * often includes the entire pathname to the module 261193267Sjkim */ 262193267Sjkim#define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name; 263193267Sjkim#else 264193267Sjkim#define ACPI_MODULE_NAME(Name) 265193267Sjkim#endif 266193267Sjkim 267193267Sjkim/* 268193267Sjkim * Ascii error messages can be configured out 269193267Sjkim */ 270193267Sjkim#ifndef ACPI_NO_ERROR_MESSAGES 271193267Sjkim#define AE_INFO _AcpiModuleName, __LINE__ 272193267Sjkim 273193267Sjkim/* 274193267Sjkim * Error reporting. Callers module and line number are inserted by AE_INFO, 275193267Sjkim * the plist contains a set of parens to allow variable-length lists. 276193267Sjkim * These macros are used for both the debug and non-debug versions of the code. 277193267Sjkim */ 278193267Sjkim#define ACPI_INFO(plist) AcpiInfo plist 279193267Sjkim#define ACPI_WARNING(plist) AcpiWarning plist 280193267Sjkim#define ACPI_EXCEPTION(plist) AcpiException plist 281193267Sjkim#define ACPI_ERROR(plist) AcpiError plist 282193267Sjkim 283193267Sjkim#else 284193267Sjkim 285193267Sjkim/* No error messages */ 286193267Sjkim 287193267Sjkim#define ACPI_INFO(plist) 288193267Sjkim#define ACPI_WARNING(plist) 289193267Sjkim#define ACPI_EXCEPTION(plist) 290193267Sjkim#define ACPI_ERROR(plist) 291193267Sjkim 292193267Sjkim#endif /* ACPI_NO_ERROR_MESSAGES */ 293193267Sjkim 294193267Sjkim 295193267Sjkim/* 296193267Sjkim * Debug macros that are conditionally compiled 297193267Sjkim */ 298193267Sjkim#ifdef ACPI_DEBUG_OUTPUT 299193267Sjkim 300193267Sjkim/* 301193267Sjkim * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, 302193267Sjkim * define it now. This is the case where there the compiler does not support 303193267Sjkim * a __FUNCTION__ macro or equivalent. 304193267Sjkim */ 305193267Sjkim#ifndef ACPI_GET_FUNCTION_NAME 306193267Sjkim#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName 307193267Sjkim 308193267Sjkim/* 309193267Sjkim * The Name parameter should be the procedure name as a quoted string. 310193267Sjkim * The function name is also used by the function exit macros below. 311193267Sjkim * Note: (const char) is used to be compatible with the debug interfaces 312193267Sjkim * and macros such as __FUNCTION__. 313193267Sjkim */ 314193267Sjkim#define ACPI_FUNCTION_NAME(Name) static const char _AcpiFunctionName[] = #Name; 315193267Sjkim 316193267Sjkim#else 317193267Sjkim/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 318193267Sjkim 319193267Sjkim#define ACPI_FUNCTION_NAME(Name) 320193267Sjkim#endif /* ACPI_GET_FUNCTION_NAME */ 321193267Sjkim 322193267Sjkim/* 323193267Sjkim * Common parameters used for debug output functions: 324193267Sjkim * line number, function name, module(file) name, component ID 325193267Sjkim */ 326193267Sjkim#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT 327193267Sjkim 328193267Sjkim/* 329193267Sjkim * Master debug print macros 330193267Sjkim * Print message if and only if: 331193267Sjkim * 1) Debug print for the current component is enabled 332193267Sjkim * 2) Debug error level or trace level for the print statement is enabled 333193267Sjkim */ 334193267Sjkim#define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist 335193267Sjkim#define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist 336193267Sjkim 337193267Sjkim#else 338193267Sjkim/* 339193267Sjkim * This is the non-debug case -- make everything go away, 340193267Sjkim * leaving no executable debug code! 341193267Sjkim */ 342193267Sjkim#define ACPI_FUNCTION_NAME(a) 343193267Sjkim#define ACPI_DEBUG_PRINT(pl) 344193267Sjkim#define ACPI_DEBUG_PRINT_RAW(pl) 345193267Sjkim 346193267Sjkim#endif /* ACPI_DEBUG_OUTPUT */ 347193267Sjkim 348193267Sjkim 34967754Smsmith#endif /* __ACOUTPUT_H__ */ 350