1/****************************************************************************** 2 * 3 * Name: acmacros.h - C macros for the entire subsystem. |
4 * 5 *****************************************************************************/ 6 7/****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * |
11 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. |
12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. --- 93 unchanged lines hidden (view full) --- 113 * 114 *****************************************************************************/ 115 116#ifndef __ACMACROS_H__ 117#define __ACMACROS_H__ 118 119 120/* |
121 * Extract data using a pointer. Any more than a byte and we 122 * get into potential aligment issues -- see the STORE macros below. 123 * Use with care. 124 */ 125#define ACPI_GET8(ptr) *ACPI_CAST_PTR (UINT8, ptr) 126#define ACPI_GET16(ptr) *ACPI_CAST_PTR (UINT16, ptr) 127#define ACPI_GET32(ptr) *ACPI_CAST_PTR (UINT32, ptr) 128#define ACPI_GET64(ptr) *ACPI_CAST_PTR (UINT64, ptr) 129#define ACPI_SET8(ptr) *ACPI_CAST_PTR (UINT8, ptr) 130#define ACPI_SET16(ptr) *ACPI_CAST_PTR (UINT16, ptr) 131#define ACPI_SET32(ptr) *ACPI_CAST_PTR (UINT32, ptr) 132#define ACPI_SET64(ptr) *ACPI_CAST_PTR (UINT64, ptr) 133 134/* |
135 * printf() format helpers 136 */ 137 138/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ 139 140#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) 141 142#if ACPI_MACHINE_WIDTH == 64 --- 85 unchanged lines hidden (view full) --- 228#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ 229#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ 230#define ACPI_MOVE_64_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) 231 232#else 233/* 234 * The hardware does not support unaligned transfers. We must move the 235 * data one byte at a time. These macros work whether the source or |
236 * the destination (or both) is/are unaligned. (Little-endian move) |
237 */ 238 239/* 16-bit source, 16/32/64 destination */ 240 241#define ACPI_MOVE_16_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ 242 (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} 243 244#define ACPI_MOVE_16_TO_32(d, s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} --- 105 unchanged lines hidden (view full) --- 350 * where a pointer to an ACPI_OPERAND_OBJECT can also 351 * appear. This macro is used to distinguish them. 352 * 353 * The "Descriptor" field is the first field in both structures. 354 */ 355#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType) 356#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = t) 357 |
358/* 359 * Macros for the master AML opcode table 360 */ 361#if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) 362#define ACPI_OP(Name, PArgs, IArgs, ObjType, Class, Type, Flags) \ 363 {Name, (UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type} 364#else 365#define ACPI_OP(Name, PArgs, IArgs, ObjType, Class, Type, Flags) \ 366 {(UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type} 367#endif 368 |
369#define ARG_TYPE_WIDTH 5 370#define ARG_1(x) ((UINT32)(x)) 371#define ARG_2(x) ((UINT32)(x) << (1 * ARG_TYPE_WIDTH)) 372#define ARG_3(x) ((UINT32)(x) << (2 * ARG_TYPE_WIDTH)) 373#define ARG_4(x) ((UINT32)(x) << (3 * ARG_TYPE_WIDTH)) 374#define ARG_5(x) ((UINT32)(x) << (4 * ARG_TYPE_WIDTH)) 375#define ARG_6(x) ((UINT32)(x) << (5 * ARG_TYPE_WIDTH)) 376 --- 9 unchanged lines hidden (view full) --- 386#define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) 387#define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) 388#define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) 389#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)) 390 391#define GET_CURRENT_ARG_TYPE(List) (List & ((UINT32) 0x1F)) 392#define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH)) 393 |
394/* |
395 * Ascii error messages can be configured out 396 */ 397#ifndef ACPI_NO_ERROR_MESSAGES |
398/* 399 * Error reporting. Callers module and line number are inserted by AE_INFO, 400 * the plist contains a set of parens to allow variable-length lists. 401 * These macros are used for both the debug and non-debug versions of the code. 402 */ |
403#define ACPI_ERROR_NAMESPACE(s, e) AcpiNsReportError (AE_INFO, s, e); 404#define ACPI_ERROR_METHOD(s, n, p, e) AcpiNsReportMethodError (AE_INFO, s, n, p, e); 405 406#else 407 408/* No error messages */ 409 |
410#define ACPI_ERROR_NAMESPACE(s, e) 411#define ACPI_ERROR_METHOD(s, n, p, e) |
412 |
413#endif /* ACPI_NO_ERROR_MESSAGES */ 414 |
415/* 416 * Debug macros that are conditionally compiled 417 */ 418#ifdef ACPI_DEBUG_OUTPUT |
419/* |
420 * Function entry tracing 421 */ |
422#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 423 AcpiUtTrace(ACPI_DEBUG_PARAMETERS) 424#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \ 425 AcpiUtTracePtr(ACPI_DEBUG_PARAMETERS, (void *)b) 426#define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \ 427 AcpiUtTraceU32(ACPI_DEBUG_PARAMETERS, (UINT32)b) 428#define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \ 429 AcpiUtTraceStr(ACPI_DEBUG_PARAMETERS, (char *)b) --- 77 unchanged lines hidden (view full) --- 507/* Various object display routines for debug */ 508 509#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a), 0) 510#define ACPI_DUMP_OPERANDS(a, b ,c) AcpiExDumpOperands(a, b, c) 511#define ACPI_DUMP_ENTRY(a, b) AcpiNsDumpEntry (a, b) 512#define ACPI_DUMP_PATHNAME(a, b, c, d) AcpiNsDumpPathname(a, b, c, d) 513#define ACPI_DUMP_BUFFER(a, b) AcpiUtDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) 514 |
515#else 516/* 517 * This is the non-debug case -- make everything go away, 518 * leaving no executable debug code! 519 */ 520#define ACPI_DEBUG_EXEC(a) 521#define ACPI_DEBUG_ONLY_MEMBERS(a) |
522#define ACPI_FUNCTION_TRACE(a) 523#define ACPI_FUNCTION_TRACE_PTR(a, b) 524#define ACPI_FUNCTION_TRACE_U32(a, b) 525#define ACPI_FUNCTION_TRACE_STR(a, b) 526#define ACPI_FUNCTION_EXIT 527#define ACPI_FUNCTION_STATUS_EXIT(s) 528#define ACPI_FUNCTION_VALUE_EXIT(s) 529#define ACPI_FUNCTION_ENTRY() --- 8 unchanged lines hidden (view full) --- 538 539#define return_VOID return 540#define return_ACPI_STATUS(s) return(s) 541#define return_VALUE(s) return(s) 542#define return_UINT8(s) return(s) 543#define return_UINT32(s) return(s) 544#define return_PTR(s) return(s) 545 |
546#endif /* ACPI_DEBUG_OUTPUT */ |
547 548/* 549 * Some code only gets executed when the debugger is built in. 550 * Note that this is entirely independent of whether the 551 * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. 552 */ 553#ifdef ACPI_DEBUGGER 554#define ACPI_DEBUGGER_EXEC(a) a --- 47 unchanged lines hidden --- |