acoutput.h revision 217365
167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Name: acoutput.h -- debug output 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 7217365Sjkim/* 8217365Sjkim * Copyright (C) 2000 - 2011, Intel Corp. 970243Smsmith * All rights reserved. 1067754Smsmith * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 2567754Smsmith * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 2967754Smsmith * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 4367754Smsmith 4467754Smsmith#ifndef __ACOUTPUT_H__ 4567754Smsmith#define __ACOUTPUT_H__ 4667754Smsmith 4767754Smsmith/* 48193267Sjkim * Debug levels and component IDs. These are used to control the 49193267Sjkim * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a 50193267Sjkim * per-component basis and a per-exception-type basis. 5167754Smsmith */ 5267754Smsmith 5382367Smsmith/* Component IDs are used in the global "DebugLayer" */ 5467754Smsmith 5577424Smsmith#define ACPI_UTILITIES 0x00000001 5677424Smsmith#define ACPI_HARDWARE 0x00000002 5777424Smsmith#define ACPI_EVENTS 0x00000004 5877424Smsmith#define ACPI_TABLES 0x00000008 5977424Smsmith#define ACPI_NAMESPACE 0x00000010 6077424Smsmith#define ACPI_PARSER 0x00000020 6177424Smsmith#define ACPI_DISPATCHER 0x00000040 6277424Smsmith#define ACPI_EXECUTER 0x00000080 6377424Smsmith#define ACPI_RESOURCES 0x00000100 64102550Siwasaki#define ACPI_CA_DEBUGGER 0x00000200 6578986Smsmith#define ACPI_OS_SERVICES 0x00000400 66102550Siwasaki#define ACPI_CA_DISASSEMBLER 0x00000800 6767754Smsmith 6891116Smsmith/* Component IDs for ACPI tools and utilities */ 6967754Smsmith 7091116Smsmith#define ACPI_COMPILER 0x00001000 7191116Smsmith#define ACPI_TOOLS 0x00002000 72193267Sjkim#define ACPI_EXAMPLE 0x00004000 73193267Sjkim#define ACPI_DRIVER 0x00008000 74209746Sjkim#define DT_COMPILER 0x00010000 7567754Smsmith 76209746Sjkim#define ACPI_ALL_COMPONENTS 0x0001FFFF 77102550Siwasaki#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 78102550Siwasaki 7991116Smsmith/* Component IDs reserved for ACPI drivers */ 8077424Smsmith 8191116Smsmith#define ACPI_ALL_DRIVERS 0xFFFF0000 8291116Smsmith 83114237Snjl 8482367Smsmith/* 85193267Sjkim * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros 8682367Smsmith */ 87193267Sjkim#define ACPI_LV_INIT 0x00000001 88193267Sjkim#define ACPI_LV_DEBUG_OBJECT 0x00000002 89193267Sjkim#define ACPI_LV_INFO 0x00000004 90200553Sjkim#define ACPI_LV_REPAIR 0x00000008 91200553Sjkim#define ACPI_LV_ALL_EXCEPTIONS 0x0000000F 9282367Smsmith 9383174Smsmith/* Trace verbosity level 1 [Standard Trace Level] */ 9482367Smsmith 95114237Snjl#define ACPI_LV_INIT_NAMES 0x00000020 9683174Smsmith#define ACPI_LV_PARSE 0x00000040 9783174Smsmith#define ACPI_LV_LOAD 0x00000080 9883174Smsmith#define ACPI_LV_DISPATCH 0x00000100 9983174Smsmith#define ACPI_LV_EXEC 0x00000200 10083174Smsmith#define ACPI_LV_NAMES 0x00000400 10183174Smsmith#define ACPI_LV_OPREGION 0x00000800 10283174Smsmith#define ACPI_LV_BFIELD 0x00001000 10383174Smsmith#define ACPI_LV_TABLES 0x00002000 10483174Smsmith#define ACPI_LV_VALUES 0x00004000 10583174Smsmith#define ACPI_LV_OBJECTS 0x00008000 10683174Smsmith#define ACPI_LV_RESOURCES 0x00010000 10783174Smsmith#define ACPI_LV_USER_REQUESTS 0x00020000 10883174Smsmith#define ACPI_LV_PACKAGE 0x00040000 109114237Snjl#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS 11083174Smsmith 11183174Smsmith/* Trace verbosity level 2 [Function tracing and memory allocation] */ 11283174Smsmith 11382367Smsmith#define ACPI_LV_ALLOCATIONS 0x00100000 11483174Smsmith#define ACPI_LV_FUNCTIONS 0x00200000 115102550Siwasaki#define ACPI_LV_OPTIMIZATIONS 0x00400000 116102550Siwasaki#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1 11783174Smsmith#define ACPI_LV_ALL ACPI_LV_VERBOSITY2 11882367Smsmith 11983174Smsmith/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ 12082367Smsmith 12183174Smsmith#define ACPI_LV_MUTEX 0x01000000 12283174Smsmith#define ACPI_LV_THREADS 0x02000000 12383174Smsmith#define ACPI_LV_IO 0x04000000 12483174Smsmith#define ACPI_LV_INTERRUPTS 0x08000000 12583174Smsmith#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 12683174Smsmith 12799679Siwasaki/* Exceptionally verbose output -- also used in the global "DebugLevel" */ 12899679Siwasaki 12999679Siwasaki#define ACPI_LV_AML_DISASSEMBLE 0x10000000 13099679Siwasaki#define ACPI_LV_VERBOSE_INFO 0x20000000 13199679Siwasaki#define ACPI_LV_FULL_TABLES 0x40000000 13299679Siwasaki#define ACPI_LV_EVENTS 0x80000000 13399679Siwasaki#define ACPI_LV_VERBOSE 0xF0000000 13499679Siwasaki 13599679Siwasaki 13682367Smsmith/* 13782367Smsmith * Debug level macros that are used in the DEBUG_PRINT macros 13882367Smsmith */ 139151937Sjkim#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS 14082367Smsmith 141193267Sjkim/* 142193267Sjkim * Exception level -- used in the global "DebugLevel" 143193267Sjkim * 144193267Sjkim * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. 145193267Sjkim * For warnings, use ACPI_WARNING. 146193267Sjkim */ 147114237Snjl#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) 14882367Smsmith#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) 149114237Snjl#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) 150200553Sjkim#define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) 15182367Smsmith#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) 15267754Smsmith 15367754Smsmith/* Trace level -- also used in the global "DebugLevel" */ 15467754Smsmith 155114237Snjl#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 15682367Smsmith#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) 15782367Smsmith#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) 15882367Smsmith#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) 15982367Smsmith#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) 16082367Smsmith#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) 16182367Smsmith#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) 16282367Smsmith#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) 16382367Smsmith#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) 16482367Smsmith#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) 16582367Smsmith#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) 166102550Siwasaki#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) 16782367Smsmith#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) 16882367Smsmith#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) 16982367Smsmith#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) 17082367Smsmith#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) 17182367Smsmith#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) 17282367Smsmith#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) 17382367Smsmith#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) 17482367Smsmith#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) 17582367Smsmith#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) 176193267Sjkim#define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) 17767754Smsmith 17899679Siwasaki#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) 17967754Smsmith 18067754Smsmith/* Defaults for DebugLevel, debug and normal */ 18167754Smsmith 182200553Sjkim#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) 183200553Sjkim#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) 184114237Snjl#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 18567754Smsmith 18667754Smsmith 187193267Sjkim#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) 188193267Sjkim/* 189193267Sjkim * Module name is included in both debug and non-debug versions primarily for 190193267Sjkim * error messages. The __FILE__ macro is not very useful for this, because it 191193267Sjkim * often includes the entire pathname to the module 192193267Sjkim */ 193193267Sjkim#define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name; 194193267Sjkim#else 195193267Sjkim#define ACPI_MODULE_NAME(Name) 196193267Sjkim#endif 197193267Sjkim 198193267Sjkim/* 199193267Sjkim * Ascii error messages can be configured out 200193267Sjkim */ 201193267Sjkim#ifndef ACPI_NO_ERROR_MESSAGES 202193267Sjkim#define AE_INFO _AcpiModuleName, __LINE__ 203193267Sjkim 204193267Sjkim/* 205193267Sjkim * Error reporting. Callers module and line number are inserted by AE_INFO, 206193267Sjkim * the plist contains a set of parens to allow variable-length lists. 207193267Sjkim * These macros are used for both the debug and non-debug versions of the code. 208193267Sjkim */ 209193267Sjkim#define ACPI_INFO(plist) AcpiInfo plist 210193267Sjkim#define ACPI_WARNING(plist) AcpiWarning plist 211193267Sjkim#define ACPI_EXCEPTION(plist) AcpiException plist 212193267Sjkim#define ACPI_ERROR(plist) AcpiError plist 213204773Sjkim#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i) 214193267Sjkim 215193267Sjkim#else 216193267Sjkim 217193267Sjkim/* No error messages */ 218193267Sjkim 219193267Sjkim#define ACPI_INFO(plist) 220193267Sjkim#define ACPI_WARNING(plist) 221193267Sjkim#define ACPI_EXCEPTION(plist) 222193267Sjkim#define ACPI_ERROR(plist) 223204773Sjkim#define ACPI_DEBUG_OBJECT(obj,l,i) 224193267Sjkim 225193267Sjkim#endif /* ACPI_NO_ERROR_MESSAGES */ 226193267Sjkim 227193267Sjkim 228193267Sjkim/* 229193267Sjkim * Debug macros that are conditionally compiled 230193267Sjkim */ 231193267Sjkim#ifdef ACPI_DEBUG_OUTPUT 232193267Sjkim 233193267Sjkim/* 234193267Sjkim * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, 235193267Sjkim * define it now. This is the case where there the compiler does not support 236193267Sjkim * a __FUNCTION__ macro or equivalent. 237193267Sjkim */ 238193267Sjkim#ifndef ACPI_GET_FUNCTION_NAME 239193267Sjkim#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName 240193267Sjkim 241193267Sjkim/* 242193267Sjkim * The Name parameter should be the procedure name as a quoted string. 243193267Sjkim * The function name is also used by the function exit macros below. 244193267Sjkim * Note: (const char) is used to be compatible with the debug interfaces 245193267Sjkim * and macros such as __FUNCTION__. 246193267Sjkim */ 247193267Sjkim#define ACPI_FUNCTION_NAME(Name) static const char _AcpiFunctionName[] = #Name; 248193267Sjkim 249193267Sjkim#else 250193267Sjkim/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 251193267Sjkim 252193267Sjkim#define ACPI_FUNCTION_NAME(Name) 253193267Sjkim#endif /* ACPI_GET_FUNCTION_NAME */ 254193267Sjkim 255193267Sjkim/* 256193267Sjkim * Common parameters used for debug output functions: 257193267Sjkim * line number, function name, module(file) name, component ID 258193267Sjkim */ 259193267Sjkim#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT 260193267Sjkim 261193267Sjkim/* 262193267Sjkim * Master debug print macros 263193267Sjkim * Print message if and only if: 264193267Sjkim * 1) Debug print for the current component is enabled 265193267Sjkim * 2) Debug error level or trace level for the print statement is enabled 266193267Sjkim */ 267193267Sjkim#define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist 268193267Sjkim#define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist 269193267Sjkim 270193267Sjkim#else 271193267Sjkim/* 272193267Sjkim * This is the non-debug case -- make everything go away, 273193267Sjkim * leaving no executable debug code! 274193267Sjkim */ 275193267Sjkim#define ACPI_FUNCTION_NAME(a) 276193267Sjkim#define ACPI_DEBUG_PRINT(pl) 277193267Sjkim#define ACPI_DEBUG_PRINT_RAW(pl) 278193267Sjkim 279193267Sjkim#endif /* ACPI_DEBUG_OUTPUT */ 280193267Sjkim 281193267Sjkim 28267754Smsmith#endif /* __ACOUTPUT_H__ */ 283