📄 acmacros.h
字号:
* appear. This macro is used to distinguish them. * * The "Descriptor" field is the first field in both structures. */#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)/* Macro to test the object type */#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type)/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)/* * Macros for the master AML opcode table */#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}#else#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}#endif#ifdef ACPI_DISASSEMBLER#define ACPI_DISASM_ONLY_MEMBERS(a) a;#else#define ACPI_DISASM_ONLY_MEMBERS(a)#endif#define ARG_TYPE_WIDTH 5#define ARG_1(x) ((u32)(x))#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH))#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH))#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH))#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH))#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH))#define ARGI_LIST1(a) (ARG_1(a))#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a))#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a))#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))#define ARGP_LIST1(a) (ARG_1(a))#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b))#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c))#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F))#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH))#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)/* * Module name is include in both debug and non-debug versions primarily for * error messages. The __FILE__ macro is not very useful for this, because it * often includes the entire pathname to the module */#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name;#else#define ACPI_MODULE_NAME(name)#endif/* * Ascii error messages can be configured out */#ifndef ACPI_NO_ERROR_MESSAGES#define AE_INFO _acpi_module_name, __LINE__/* * Error reporting. Callers module and line number are inserted by AE_INFO, * the plist contains a set of parens to allow variable-length lists. * These macros are used for both the debug and non-debug versions of the code. */#define ACPI_INFO(plist) acpi_ut_info plist#define ACPI_WARNING(plist) acpi_ut_warning plist#define ACPI_EXCEPTION(plist) acpi_ut_exception plist#define ACPI_ERROR(plist) acpi_ut_error plist#define ACPI_ERROR_NAMESPACE(s,e) acpi_ns_report_error (AE_INFO, s, e);#define ACPI_ERROR_METHOD(s,n,p,e) acpi_ns_report_method_error (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, _acpi_module_name, _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 _acpi_function_name/* * 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 *_acpi_function_name = #name;#else/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */#define ACPI_FUNCTION_NAME(name)#endif#ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ acpi_ut_trace(ACPI_DEBUG_PARAMETERS)#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()/* * 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 ({ \ acpi_ut_exit (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); \ acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \ return (_s); })#define return_PTR(s) ACPI_DO_WHILE0 ({ \ register void *_s = (void *) (s); \ acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ return (_s); })#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ register acpi_integer _s = (s); \ acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ return (_s); })#define return_UINT8(s) ACPI_DO_WHILE0 ({ \ register u8 _s = (u8) (s); \ acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ return (_s); })#define return_UINT32(s) ACPI_DO_WHILE0 ({ \ register u32 _s = (u32) (s); \ acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ return (_s); })#else /* Use original less-safe macros */#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \ return((s)); })#define return_PTR(s) ACPI_DO_WHILE0 ({ \ acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ return((s)); })#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ acpi_ut_value_exit (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 */#else /* !CONFIG_ACPI_DEBUG_FUNC_TRACE */#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_TRACE(a)#define ACPI_FUNCTION_ENTRY()#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 /* CONFIG_ACPI_DEBUG_FUNC_TRACE *//* 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) acpi_ex_dump_operand((a),0)#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__)#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)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) acpi_ut_debug_print plist#define ACPI_DEBUG_PRINT_RAW(plist) acpi_ut_debug_print_raw 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) do { } while(0)#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0)#define ACPI_FUNCTION_NAME(a) do { } while(0)#define ACPI_FUNCTION_TRACE(a) do { } while(0)#define ACPI_FUNCTION_TRACE_PTR(a,b) do { } while(0)#define ACPI_FUNCTION_TRACE_U32(a,b) do { } while(0)#define ACPI_FUNCTION_TRACE_STR(a,b) do { } while(0)#define ACPI_FUNCTION_EXIT do { } while(0)#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0)#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)#define ACPI_FUNCTION_ENTRY() do { } while(0)#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)#define ACPI_DUMP_OPERANDS(a,b,c,d,e) do { } while(0)#define ACPI_DUMP_ENTRY(a,b) do { } while(0)#define ACPI_DUMP_TABLES(a,b) do { } while(0)#define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0)#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)#define ACPI_DUMP_BUFFER(a,b) do { } while(0)#define ACPI_DEBUG_PRINT(pl) do { } while(0)#define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0)#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, acpi_gbl_ns_type_names[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 */#ifndef ACPI_ALLOCATE#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)#endif#ifndef ACPI_ALLOCATE_ZEROED#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)#endif#ifndef ACPI_FREE#define ACPI_FREE(a) acpio_os_free(a)#endif#define ACPI_MEM_TRACKING(a)#else/* Memory allocation */#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)#define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__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 + -