📄 acmacros.h
字号:
* These macros are used for both the debug and non-debug versions of the code. */#define ACPI_INFO(plist) AcpiUtInfo plist#define ACPI_WARNING(plist) AcpiUtWarning plist#define ACPI_EXCEPTION(plist) AcpiUtException plist#define ACPI_ERROR(plist) AcpiUtError plist#define ACPI_ERROR_NAMESPACE(s,e) AcpiNsReportError (AE_INFO, s, e);#define ACPI_ERROR_METHOD(s,n,p,e) AcpiNsReportMethodError (AE_INFO, s, n, p, e);#else/* No error messages */#define ACPI_INFO(plist)#define ACPI_WARNING(plist)#define ACPI_EXCEPTION(plist)#define ACPI_ERROR(plist)#define ACPI_ERROR_NAMESPACE(s,e)#define ACPI_ERROR_METHOD(s,n,p,e)#endif/* * Debug macros that are conditionally compiled */#ifdef ACPI_DEBUG_OUTPUT/* * Common parameters used for debug output functions: * line number, function name, module(file) name, component ID */#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT/* * Function entry tracing *//* * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, * define it now. This is the case where there the compiler does not support * a __FUNCTION__ macro or equivalent. We save the function name on the * local stack. */#ifndef ACPI_GET_FUNCTION_NAME#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName/* * The Name parameter should be the procedure name as a quoted string. * This is declared as a local string ("MyFunctionName") so that it can * be also used by the function exit macros below. * Note: (const char) is used to be compatible with the debug interfaces * and macros such as __FUNCTION__. */#define ACPI_FUNCTION_NAME(Name) const char *_AcpiFunctionName = #Name;#else/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */#define ACPI_FUNCTION_NAME(Name)#endif#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ AcpiUtTrace(ACPI_DEBUG_PARAMETERS)#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ AcpiUtTracePtr(ACPI_DEBUG_PARAMETERS,(void *)b)#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ AcpiUtTraceU32(ACPI_DEBUG_PARAMETERS,(UINT32)b)#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ AcpiUtTraceStr(ACPI_DEBUG_PARAMETERS,(char *)b)#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()/* * Function exit tracing. * WARNING: These macros include a return statement. This is usually considered * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros * so that "_AcpiFunctionName" is defined. * * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining * about these constructs. */#ifdef ACPI_USE_DO_WHILE_0#define ACPI_DO_WHILE0(a) do a while(0)#else#define ACPI_DO_WHILE0(a) a#endif#define return_VOID ACPI_DO_WHILE0 ({ \ AcpiUtExit (ACPI_DEBUG_PARAMETERS); \ return;})/* * There are two versions of most of the return macros. The default version is * safer, since it avoids side-effects by guaranteeing that the argument will * not be evaluated twice. * * A less-safe version of the macros is provided for optional use if the * compiler uses excessive CPU stack (for example, this may happen in the * debug case if code optimzation is disabled.) */#ifndef ACPI_SIMPLE_RETURN_MACROS#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ register ACPI_STATUS _s = (s); \ AcpiUtStatusExit (ACPI_DEBUG_PARAMETERS, _s); \ return (_s); })#define return_PTR(s) ACPI_DO_WHILE0 ({ \ register void *_s = (void *) (s); \ AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) _s); \ return (_s); })#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ register ACPI_INTEGER _s = (s); \ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \ return (_s); })#define return_UINT8(s) ACPI_DO_WHILE0 ({ \ register UINT8 _s = (UINT8) (s); \ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) _s); \ return (_s); })#define return_UINT32(s) ACPI_DO_WHILE0 ({ \ register UINT32 _s = (UINT32) (s); \ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) _s); \ return (_s); })#else /* Use original less-safe macros */#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ AcpiUtStatusExit (ACPI_DEBUG_PARAMETERS, (s)); \ return((s)); })#define return_PTR(s) ACPI_DO_WHILE0 ({ \ AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) (s)); \ return((s)); })#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) (s)); \ return((s)); })#define return_UINT8(s) return_VALUE(s)#define return_UINT32(s) return_VALUE(s)#endif /* ACPI_SIMPLE_RETURN_MACROS *//* Conditional execution */#define ACPI_DEBUG_EXEC(a) a#define ACPI_NORMAL_EXEC(a)#define ACPI_DEBUG_DEFINE(a) a;#define ACPI_DEBUG_ONLY_MEMBERS(a) a;#define _VERBOSE_STRUCTURES/* Stack and buffer dumping */#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a),0)#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_AcpiModuleName,__LINE__)#define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b)#define ACPI_DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d)#define ACPI_DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a)#define ACPI_DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)/* * Master debug print macros * Print iff: * 1) Debug print for the current component is enabled * 2) Debug error level or trace level for the print statement is enabled */#define ACPI_DEBUG_PRINT(plist) AcpiUtDebugPrint plist#define ACPI_DEBUG_PRINT_RAW(plist) AcpiUtDebugPrintRaw plist#else/* * This is the non-debug case -- make everything go away, * leaving no executable debug code! */#define ACPI_DEBUG_EXEC(a)#define ACPI_NORMAL_EXEC(a) a;#define ACPI_DEBUG_DEFINE(a)#define ACPI_DEBUG_ONLY_MEMBERS(a)#define ACPI_FUNCTION_NAME(a)#define ACPI_FUNCTION_TRACE(a)#define ACPI_FUNCTION_TRACE_PTR(a,b)#define ACPI_FUNCTION_TRACE_U32(a,b)#define ACPI_FUNCTION_TRACE_STR(a,b)#define ACPI_FUNCTION_EXIT#define ACPI_FUNCTION_STATUS_EXIT(s)#define ACPI_FUNCTION_VALUE_EXIT(s)#define ACPI_FUNCTION_ENTRY()#define ACPI_DUMP_STACK_ENTRY(a)#define ACPI_DUMP_OPERANDS(a,b,c,d,e)#define ACPI_DUMP_ENTRY(a,b)#define ACPI_DUMP_TABLES(a,b)#define ACPI_DUMP_PATHNAME(a,b,c,d)#define ACPI_DUMP_RESOURCE_LIST(a)#define ACPI_DUMP_BUFFER(a,b)#define ACPI_DEBUG_PRINT(pl)#define ACPI_DEBUG_PRINT_RAW(pl)#define return_VOID return#define return_ACPI_STATUS(s) return(s)#define return_VALUE(s) return(s)#define return_UINT8(s) return(s)#define return_UINT32(s) return(s)#define return_PTR(s) return(s)#endif/* * Some code only gets executed when the debugger is built in. * Note that this is entirely independent of whether the * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. */#ifdef ACPI_DEBUGGER#define ACPI_DEBUGGER_EXEC(a) a#else#define ACPI_DEBUGGER_EXEC(a)#endif#ifdef ACPI_DEBUG_OUTPUT/* * 1) Set name to blanks * 2) Copy the object name */#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\ ACPI_STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name))#else#define ACPI_ADD_OBJECT_NAME(a,b)#endif/* * Memory allocation tracking (DEBUG ONLY) */#ifndef ACPI_DBG_TRACK_ALLOCATIONS/* Memory allocation */#define ACPI_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__)#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroed((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__)#define ACPI_FREE(a) AcpiOsFree(a)#define ACPI_MEM_TRACKING(a)#else/* Memory allocation */#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__)#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__)#define ACPI_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_AcpiModuleName,__LINE__)#define ACPI_MEM_TRACKING(a) a#endif /* ACPI_DBG_TRACK_ALLOCATIONS */#endif /* ACMACROS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -