167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Name: acoutput.h -- debug output 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 7217365Sjkim/* 8306536Sjkim * Copyright (C) 2000 - 2016, 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 75233250Sjkim#define ASL_PREPROCESSOR 0x00020000 7667754Smsmith 77209746Sjkim#define ACPI_ALL_COMPONENTS 0x0001FFFF 78102550Siwasaki#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) 79102550Siwasaki 8091116Smsmith/* Component IDs reserved for ACPI drivers */ 8177424Smsmith 8291116Smsmith#define ACPI_ALL_DRIVERS 0xFFFF0000 8391116Smsmith 84114237Snjl 8582367Smsmith/* 86193267Sjkim * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros 8782367Smsmith */ 88193267Sjkim#define ACPI_LV_INIT 0x00000001 89193267Sjkim#define ACPI_LV_DEBUG_OBJECT 0x00000002 90193267Sjkim#define ACPI_LV_INFO 0x00000004 91200553Sjkim#define ACPI_LV_REPAIR 0x00000008 92306536Sjkim#define ACPI_LV_TRACE_POINT 0x00000010 93306536Sjkim#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F 9482367Smsmith 9583174Smsmith/* Trace verbosity level 1 [Standard Trace Level] */ 9682367Smsmith 97114237Snjl#define ACPI_LV_INIT_NAMES 0x00000020 9883174Smsmith#define ACPI_LV_PARSE 0x00000040 9983174Smsmith#define ACPI_LV_LOAD 0x00000080 10083174Smsmith#define ACPI_LV_DISPATCH 0x00000100 10183174Smsmith#define ACPI_LV_EXEC 0x00000200 10283174Smsmith#define ACPI_LV_NAMES 0x00000400 10383174Smsmith#define ACPI_LV_OPREGION 0x00000800 10483174Smsmith#define ACPI_LV_BFIELD 0x00001000 10583174Smsmith#define ACPI_LV_TABLES 0x00002000 10683174Smsmith#define ACPI_LV_VALUES 0x00004000 10783174Smsmith#define ACPI_LV_OBJECTS 0x00008000 10883174Smsmith#define ACPI_LV_RESOURCES 0x00010000 10983174Smsmith#define ACPI_LV_USER_REQUESTS 0x00020000 11083174Smsmith#define ACPI_LV_PACKAGE 0x00040000 111114237Snjl#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS 11283174Smsmith 11383174Smsmith/* Trace verbosity level 2 [Function tracing and memory allocation] */ 11483174Smsmith 11582367Smsmith#define ACPI_LV_ALLOCATIONS 0x00100000 11683174Smsmith#define ACPI_LV_FUNCTIONS 0x00200000 117102550Siwasaki#define ACPI_LV_OPTIMIZATIONS 0x00400000 118102550Siwasaki#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1 11983174Smsmith#define ACPI_LV_ALL ACPI_LV_VERBOSITY2 12082367Smsmith 12183174Smsmith/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ 12282367Smsmith 12383174Smsmith#define ACPI_LV_MUTEX 0x01000000 12483174Smsmith#define ACPI_LV_THREADS 0x02000000 12583174Smsmith#define ACPI_LV_IO 0x04000000 12683174Smsmith#define ACPI_LV_INTERRUPTS 0x08000000 12783174Smsmith#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 12883174Smsmith 12999679Siwasaki/* Exceptionally verbose output -- also used in the global "DebugLevel" */ 13099679Siwasaki 13199679Siwasaki#define ACPI_LV_AML_DISASSEMBLE 0x10000000 13299679Siwasaki#define ACPI_LV_VERBOSE_INFO 0x20000000 13399679Siwasaki#define ACPI_LV_FULL_TABLES 0x40000000 13499679Siwasaki#define ACPI_LV_EVENTS 0x80000000 13599679Siwasaki#define ACPI_LV_VERBOSE 0xF0000000 13699679Siwasaki 13799679Siwasaki 13882367Smsmith/* 13982367Smsmith * Debug level macros that are used in the DEBUG_PRINT macros 14082367Smsmith */ 141151937Sjkim#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS 14282367Smsmith 143193267Sjkim/* 144193267Sjkim * Exception level -- used in the global "DebugLevel" 145193267Sjkim * 146193267Sjkim * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. 147193267Sjkim * For warnings, use ACPI_WARNING. 148193267Sjkim */ 149114237Snjl#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) 15082367Smsmith#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) 151114237Snjl#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) 152200553Sjkim#define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) 153306536Sjkim#define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT) 15482367Smsmith#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) 15567754Smsmith 15667754Smsmith/* Trace level -- also used in the global "DebugLevel" */ 15767754Smsmith 158114237Snjl#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 15982367Smsmith#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) 16082367Smsmith#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) 16182367Smsmith#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) 16282367Smsmith#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) 16382367Smsmith#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) 16482367Smsmith#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) 16582367Smsmith#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) 16682367Smsmith#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) 16782367Smsmith#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) 16882367Smsmith#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) 169102550Siwasaki#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) 17082367Smsmith#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) 17182367Smsmith#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) 17282367Smsmith#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) 17382367Smsmith#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) 17482367Smsmith#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) 17582367Smsmith#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) 17682367Smsmith#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) 17782367Smsmith#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) 17882367Smsmith#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) 179193267Sjkim#define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) 18067754Smsmith 18199679Siwasaki#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) 18267754Smsmith 18367754Smsmith/* Defaults for DebugLevel, debug and normal */ 18467754Smsmith 185200553Sjkim#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) 186200553Sjkim#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) 187114237Snjl#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 18867754Smsmith 18967754Smsmith 190306536Sjkim/* 191306536Sjkim * Global trace flags 192306536Sjkim */ 193306536Sjkim#define ACPI_TRACE_ENABLED ((UINT32) 4) 194306536Sjkim#define ACPI_TRACE_ONESHOT ((UINT32) 2) 195306536Sjkim#define ACPI_TRACE_OPCODE ((UINT32) 1) 196306536Sjkim 197306536Sjkim/* Defaults for trace debugging level/layer */ 198306536Sjkim 199306536Sjkim#define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL 200306536Sjkim#define ACPI_TRACE_LAYER_ALL 0x000001FF 201306536Sjkim#define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT 202306536Sjkim#define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER 203306536Sjkim 204306536Sjkim 205193267Sjkim#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) 206193267Sjkim/* 207218590Sjkim * The module name is used primarily for error and debug messages. 208218590Sjkim * The __FILE__ macro is not very useful for this, because it 209218590Sjkim * usually includes the entire pathname to the module making the 210218590Sjkim * debug output difficult to read. 211193267Sjkim */ 212193267Sjkim#define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name; 213193267Sjkim#else 214218590Sjkim/* 215218590Sjkim * For the no-debug and no-error-msg cases, we must at least define 216218590Sjkim * a null module name. 217218590Sjkim */ 218193267Sjkim#define ACPI_MODULE_NAME(Name) 219218590Sjkim#define _AcpiModuleName "" 220193267Sjkim#endif 221193267Sjkim 222193267Sjkim/* 223193267Sjkim * Ascii error messages can be configured out 224193267Sjkim */ 225193267Sjkim#ifndef ACPI_NO_ERROR_MESSAGES 226193267Sjkim#define AE_INFO _AcpiModuleName, __LINE__ 227193267Sjkim 228193267Sjkim/* 229193267Sjkim * Error reporting. Callers module and line number are inserted by AE_INFO, 230193267Sjkim * the plist contains a set of parens to allow variable-length lists. 231193267Sjkim * These macros are used for both the debug and non-debug versions of the code. 232193267Sjkim */ 233193267Sjkim#define ACPI_INFO(plist) AcpiInfo plist 234193267Sjkim#define ACPI_WARNING(plist) AcpiWarning plist 235193267Sjkim#define ACPI_EXCEPTION(plist) AcpiException plist 236193267Sjkim#define ACPI_ERROR(plist) AcpiError plist 237238381Sjkim#define ACPI_BIOS_WARNING(plist) AcpiBiosWarning plist 238238381Sjkim#define ACPI_BIOS_ERROR(plist) AcpiBiosError plist 239204773Sjkim#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i) 240193267Sjkim 241193267Sjkim#else 242193267Sjkim 243193267Sjkim/* No error messages */ 244193267Sjkim 245193267Sjkim#define ACPI_INFO(plist) 246193267Sjkim#define ACPI_WARNING(plist) 247193267Sjkim#define ACPI_EXCEPTION(plist) 248193267Sjkim#define ACPI_ERROR(plist) 249238381Sjkim#define ACPI_BIOS_WARNING(plist) 250238381Sjkim#define ACPI_BIOS_ERROR(plist) 251204773Sjkim#define ACPI_DEBUG_OBJECT(obj,l,i) 252193267Sjkim 253193267Sjkim#endif /* ACPI_NO_ERROR_MESSAGES */ 254193267Sjkim 255193267Sjkim 256193267Sjkim/* 257193267Sjkim * Debug macros that are conditionally compiled 258193267Sjkim */ 259193267Sjkim#ifdef ACPI_DEBUG_OUTPUT 260193267Sjkim 261193267Sjkim/* 262193267Sjkim * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, 263193267Sjkim * define it now. This is the case where there the compiler does not support 264193267Sjkim * a __FUNCTION__ macro or equivalent. 265193267Sjkim */ 266193267Sjkim#ifndef ACPI_GET_FUNCTION_NAME 267193267Sjkim#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName 268193267Sjkim 269193267Sjkim/* 270306536Sjkim * The Name parameter should be the procedure name as a non-quoted string. 271193267Sjkim * The function name is also used by the function exit macros below. 272193267Sjkim * Note: (const char) is used to be compatible with the debug interfaces 273193267Sjkim * and macros such as __FUNCTION__. 274193267Sjkim */ 275193267Sjkim#define ACPI_FUNCTION_NAME(Name) static const char _AcpiFunctionName[] = #Name; 276193267Sjkim 277193267Sjkim#else 278193267Sjkim/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 279193267Sjkim 280193267Sjkim#define ACPI_FUNCTION_NAME(Name) 281193267Sjkim#endif /* ACPI_GET_FUNCTION_NAME */ 282193267Sjkim 283193267Sjkim/* 284193267Sjkim * Common parameters used for debug output functions: 285193267Sjkim * line number, function name, module(file) name, component ID 286193267Sjkim */ 287245582Sjkim#define ACPI_DEBUG_PARAMETERS \ 288245582Sjkim __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT 289193267Sjkim 290245582Sjkim/* Check if debug output is currently dynamically enabled */ 291245582Sjkim 292245582Sjkim#define ACPI_IS_DEBUG_ENABLED(Level, Component) \ 293245582Sjkim ((Level & AcpiDbgLevel) && (Component & AcpiDbgLayer)) 294245582Sjkim 295193267Sjkim/* 296193267Sjkim * Master debug print macros 297193267Sjkim * Print message if and only if: 298193267Sjkim * 1) Debug print for the current component is enabled 299193267Sjkim * 2) Debug error level or trace level for the print statement is enabled 300245582Sjkim * 301245582Sjkim * November 2012: Moved the runtime check for whether to actually emit the 302245582Sjkim * debug message outside of the print function itself. This improves overall 303245582Sjkim * performance at a relatively small code cost. Implementation involves the 304245582Sjkim * use of variadic macros supported by C99. 305245582Sjkim * 306245582Sjkim * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from 307245582Sjkim * complaining about these constructs. On other compilers the do...while 308245582Sjkim * adds some extra code, so this feature is optional. 309193267Sjkim */ 310245582Sjkim#ifdef ACPI_USE_DO_WHILE_0 311245582Sjkim#define ACPI_DO_WHILE0(a) do a while(0) 312245582Sjkim#else 313245582Sjkim#define ACPI_DO_WHILE0(a) a 314245582Sjkim#endif 315193267Sjkim 316245582Sjkim/* DEBUG_PRINT functions */ 317245582Sjkim 318306536Sjkim#ifndef COMPILER_VA_MACRO 319245582Sjkim 320306536Sjkim#define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist 321306536Sjkim#define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist 322306536Sjkim 323306536Sjkim#else 324306536Sjkim 325245582Sjkim/* Helper macros for DEBUG_PRINT */ 326245582Sjkim 327245582Sjkim#define ACPI_DO_DEBUG_PRINT(Function, Level, Line, Filename, Modulename, Component, ...) \ 328245582Sjkim ACPI_DO_WHILE0 ({ \ 329245582Sjkim if (ACPI_IS_DEBUG_ENABLED (Level, Component)) \ 330245582Sjkim { \ 331245582Sjkim Function (Level, Line, Filename, Modulename, Component, __VA_ARGS__); \ 332245582Sjkim } \ 333245582Sjkim }) 334245582Sjkim 335245582Sjkim#define ACPI_ACTUAL_DEBUG(Level, Line, Filename, Modulename, Component, ...) \ 336245582Sjkim ACPI_DO_DEBUG_PRINT (AcpiDebugPrint, Level, Line, \ 337245582Sjkim Filename, Modulename, Component, __VA_ARGS__) 338245582Sjkim 339245582Sjkim#define ACPI_ACTUAL_DEBUG_RAW(Level, Line, Filename, Modulename, Component, ...) \ 340245582Sjkim ACPI_DO_DEBUG_PRINT (AcpiDebugPrintRaw, Level, Line, \ 341245582Sjkim Filename, Modulename, Component, __VA_ARGS__) 342245582Sjkim 343306536Sjkim#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist 344306536Sjkim#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist 345245582Sjkim 346306536Sjkim#endif 347306536Sjkim 348306536Sjkim 349193267Sjkim/* 350245582Sjkim * Function entry tracing 351245582Sjkim * 352245582Sjkim * The name of the function is emitted as a local variable that is 353245582Sjkim * intended to be used by both the entry trace and the exit trace. 354245582Sjkim */ 355245582Sjkim 356245582Sjkim/* Helper macro */ 357245582Sjkim 358246040Sjkim#define ACPI_TRACE_ENTRY(Name, Function, Type, Param) \ 359245582Sjkim ACPI_FUNCTION_NAME (Name) \ 360246040Sjkim Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)) 361245582Sjkim 362245582Sjkim/* The actual entry trace macros */ 363245582Sjkim 364245582Sjkim#define ACPI_FUNCTION_TRACE(Name) \ 365245582Sjkim ACPI_FUNCTION_NAME(Name) \ 366245582Sjkim AcpiUtTrace (ACPI_DEBUG_PARAMETERS) 367245582Sjkim 368245582Sjkim#define ACPI_FUNCTION_TRACE_PTR(Name, Pointer) \ 369246040Sjkim ACPI_TRACE_ENTRY (Name, AcpiUtTracePtr, void *, Pointer) 370245582Sjkim 371245582Sjkim#define ACPI_FUNCTION_TRACE_U32(Name, Value) \ 372246040Sjkim ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, UINT32, Value) 373245582Sjkim 374245582Sjkim#define ACPI_FUNCTION_TRACE_STR(Name, String) \ 375306536Sjkim ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, const char *, String) 376245582Sjkim 377245582Sjkim#define ACPI_FUNCTION_ENTRY() \ 378245582Sjkim AcpiUtTrackStackPtr() 379245582Sjkim 380245582Sjkim 381245582Sjkim/* 382245582Sjkim * Function exit tracing 383245582Sjkim * 384245582Sjkim * These macros include a return statement. This is usually considered 385245582Sjkim * bad form, but having a separate exit macro before the actual return 386245582Sjkim * is very ugly and difficult to maintain. 387245582Sjkim * 388245582Sjkim * One of the FUNCTION_TRACE macros above must be used in conjunction 389245582Sjkim * with these macros so that "_AcpiFunctionName" is defined. 390246040Sjkim * 391246040Sjkim * There are two versions of most of the return macros. The default version is 392246040Sjkim * safer, since it avoids side-effects by guaranteeing that the argument will 393246040Sjkim * not be evaluated twice. 394246040Sjkim * 395246040Sjkim * A less-safe version of the macros is provided for optional use if the 396246040Sjkim * compiler uses excessive CPU stack (for example, this may happen in the 397246040Sjkim * debug case if code optimzation is disabled.) 398245582Sjkim */ 399245582Sjkim 400245582Sjkim/* Exit trace helper macro */ 401245582Sjkim 402246040Sjkim#ifndef ACPI_SIMPLE_RETURN_MACROS 403246040Sjkim 404246040Sjkim#define ACPI_TRACE_EXIT(Function, Type, Param) \ 405245582Sjkim ACPI_DO_WHILE0 ({ \ 406246040Sjkim register Type _Param = (Type) (Param); \ 407246040Sjkim Function (ACPI_DEBUG_PARAMETERS, _Param); \ 408246040Sjkim return (_Param); \ 409245582Sjkim }) 410245582Sjkim 411246040Sjkim#else /* Use original less-safe macros */ 412246040Sjkim 413246040Sjkim#define ACPI_TRACE_EXIT(Function, Type, Param) \ 414246040Sjkim ACPI_DO_WHILE0 ({ \ 415246040Sjkim Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)); \ 416246040Sjkim return (Param); \ 417246040Sjkim }) 418246040Sjkim 419246040Sjkim#endif /* ACPI_SIMPLE_RETURN_MACROS */ 420246040Sjkim 421245582Sjkim/* The actual exit macros */ 422245582Sjkim 423245582Sjkim#define return_VOID \ 424245582Sjkim ACPI_DO_WHILE0 ({ \ 425245582Sjkim AcpiUtExit (ACPI_DEBUG_PARAMETERS); \ 426245582Sjkim return; \ 427245582Sjkim }) 428245582Sjkim 429245582Sjkim#define return_ACPI_STATUS(Status) \ 430246040Sjkim ACPI_TRACE_EXIT (AcpiUtStatusExit, ACPI_STATUS, Status) 431245582Sjkim 432245582Sjkim#define return_PTR(Pointer) \ 433246040Sjkim ACPI_TRACE_EXIT (AcpiUtPtrExit, void *, Pointer) 434245582Sjkim 435306536Sjkim#define return_STR(String) \ 436306536Sjkim ACPI_TRACE_EXIT (AcpiUtStrExit, const char *, String) 437306536Sjkim 438245582Sjkim#define return_VALUE(Value) \ 439246040Sjkim ACPI_TRACE_EXIT (AcpiUtValueExit, UINT64, Value) 440245582Sjkim 441246849Sjkim#define return_UINT32(Value) \ 442246849Sjkim ACPI_TRACE_EXIT (AcpiUtValueExit, UINT32, Value) 443245582Sjkim 444246849Sjkim#define return_UINT8(Value) \ 445246849Sjkim ACPI_TRACE_EXIT (AcpiUtValueExit, UINT8, Value) 446246849Sjkim 447245582Sjkim/* Conditional execution */ 448245582Sjkim 449245582Sjkim#define ACPI_DEBUG_EXEC(a) a 450245582Sjkim#define ACPI_DEBUG_ONLY_MEMBERS(a) a; 451245582Sjkim#define _VERBOSE_STRUCTURES 452245582Sjkim 453245582Sjkim 454245582Sjkim/* Various object display routines for debug */ 455245582Sjkim 456245582Sjkim#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a), 0) 457245582Sjkim#define ACPI_DUMP_OPERANDS(a, b ,c) AcpiExDumpOperands(a, b, c) 458245582Sjkim#define ACPI_DUMP_ENTRY(a, b) AcpiNsDumpEntry (a, b) 459245582Sjkim#define ACPI_DUMP_PATHNAME(a, b, c, d) AcpiNsDumpPathname(a, b, c, d) 460245582Sjkim#define ACPI_DUMP_BUFFER(a, b) AcpiUtDebugDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) 461245582Sjkim 462306536Sjkim#define ACPI_TRACE_POINT(a, b, c, d) AcpiTracePoint (a, b, c, d) 463306536Sjkim 464245582Sjkim#else /* ACPI_DEBUG_OUTPUT */ 465245582Sjkim/* 466193267Sjkim * This is the non-debug case -- make everything go away, 467193267Sjkim * leaving no executable debug code! 468193267Sjkim */ 469193267Sjkim#define ACPI_DEBUG_PRINT(pl) 470193267Sjkim#define ACPI_DEBUG_PRINT_RAW(pl) 471245582Sjkim#define ACPI_DEBUG_EXEC(a) 472245582Sjkim#define ACPI_DEBUG_ONLY_MEMBERS(a) 473249663Sjkim#define ACPI_FUNCTION_NAME(a) 474245582Sjkim#define ACPI_FUNCTION_TRACE(a) 475245582Sjkim#define ACPI_FUNCTION_TRACE_PTR(a, b) 476245582Sjkim#define ACPI_FUNCTION_TRACE_U32(a, b) 477245582Sjkim#define ACPI_FUNCTION_TRACE_STR(a, b) 478245582Sjkim#define ACPI_FUNCTION_ENTRY() 479245582Sjkim#define ACPI_DUMP_STACK_ENTRY(a) 480245582Sjkim#define ACPI_DUMP_OPERANDS(a, b, c) 481245582Sjkim#define ACPI_DUMP_ENTRY(a, b) 482245582Sjkim#define ACPI_DUMP_PATHNAME(a, b, c, d) 483245582Sjkim#define ACPI_DUMP_BUFFER(a, b) 484245582Sjkim#define ACPI_IS_DEBUG_ENABLED(Level, Component) 0 485306536Sjkim#define ACPI_TRACE_POINT(a, b, c, d) 486193267Sjkim 487245582Sjkim/* Return macros must have a return statement at the minimum */ 488245582Sjkim 489245582Sjkim#define return_VOID return 490245582Sjkim#define return_ACPI_STATUS(s) return(s) 491246849Sjkim#define return_PTR(s) return(s) 492306536Sjkim#define return_STR(s) return(s) 493245582Sjkim#define return_VALUE(s) return(s) 494246849Sjkim#define return_UINT8(s) return(s) 495246849Sjkim#define return_UINT32(s) return(s) 496245582Sjkim 497193267Sjkim#endif /* ACPI_DEBUG_OUTPUT */ 498193267Sjkim 499193267Sjkim 50067754Smsmith#endif /* __ACOUTPUT_H__ */ 501