acmacros.h revision 71867
1/****************************************************************************** 2 * 3 * Name: acmacros.h - C macros for the entire subsystem. 4 * $Revision: 62 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89 * PARTICULAR PURPOSE. 90 * 91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98 * LIMITED REMEDY. 99 * 100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 101 * software or system incorporating such software without first obtaining any 102 * required license or other approval from the U. S. Department of Commerce or 103 * any other agency or department of the United States Government. In the 104 * event Licensee exports any such software from the United States or 105 * re-exports any such software from a foreign destination, Licensee shall 106 * ensure that the distribution and export/re-export of the software is in 107 * compliance with all laws, regulations, orders, or other restrictions of the 108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109 * any of its subsidiaries will export/re-export any technical data, process, 110 * software, or service, directly or indirectly, to any country for which the 111 * United States government or any agency thereof requires an export license, 112 * other governmental approval, or letter of assurance, without first obtaining 113 * such license, approval or letter. 114 * 115 *****************************************************************************/ 116 117#ifndef __ACMACROS_H__ 118#define __ACMACROS_H__ 119 120/* 121 * Data manipulation macros 122 */ 123 124#ifndef LODWORD 125#define LODWORD(l) ((UINT32)(UINT64)(l)) 126#endif 127 128#ifndef HIDWORD 129#define HIDWORD(l) ((UINT32)((((UINT64)(l)) >> 32) & 0xFFFFFFFF)) 130#endif 131 132#ifndef LOWORD 133#define LOWORD(l) ((UINT16)(NATIVE_UINT)(l)) 134#endif 135 136#ifndef HIWORD 137#define HIWORD(l) ((UINT16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF)) 138#endif 139 140#ifndef LOBYTE 141#define LOBYTE(l) ((UINT8)(UINT16)(l)) 142#endif 143 144#ifndef HIBYTE 145#define HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF)) 146#endif 147 148#define BIT0(x) ((((x) & 0x01) > 0) ? 1 : 0) 149#define BIT1(x) ((((x) & 0x02) > 0) ? 1 : 0) 150#define BIT2(x) ((((x) & 0x04) > 0) ? 1 : 0) 151 152#define BIT3(x) ((((x) & 0x08) > 0) ? 1 : 0) 153#define BIT4(x) ((((x) & 0x10) > 0) ? 1 : 0) 154#define BIT5(x) ((((x) & 0x20) > 0) ? 1 : 0) 155#define BIT6(x) ((((x) & 0x40) > 0) ? 1 : 0) 156#define BIT7(x) ((((x) & 0x80) > 0) ? 1 : 0) 157 158#define LOW_BASE(w) ((UINT16) ((w) & 0x0000FFFF)) 159#define MID_BASE(b) ((UINT8) (((b) & 0x00FF0000) >> 16)) 160#define HI_BASE(b) ((UINT8) (((b) & 0xFF000000) >> 24)) 161#define LOW_LIMIT(w) ((UINT16) ((w) & 0x0000FFFF)) 162#define HI_LIMIT(b) ((UINT8) (((b) & 0x00FF0000) >> 16)) 163 164 165#ifdef _IA16 166/* 167 * For 16-bit addresses, we have to assume that the upper 32 bits 168 * are zero. 169 */ 170#define ACPI_GET_ADDRESS(a) ((a).Lo) 171#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(b);} 172#define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo) 173 174#else 175/* 176 * Full 64-bit address on 32-bit and 64-bit platforms 177 */ 178#define ACPI_GET_ADDRESS(a) (a) 179#define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) 180#define ACPI_VALID_ADDRESS(a) (a) 181#endif 182 /* 183 * Extract a byte of data using a pointer. Any more than a byte and we 184 * get into potential aligment issues -- see the STORE macros below 185 */ 186#define GET8(addr) (*(UINT8*)(addr)) 187 188 189/* 190 * Macros for moving data around to/from buffers that are possibly unaligned. 191 * If the hardware supports the transfer of unaligned data, just do the store. 192 * Otherwise, we have to move one byte at a time. 193 */ 194 195#ifdef _HW_ALIGNMENT_SUPPORT 196 197/* The hardware supports unaligned transfers, just do the move */ 198 199#define MOVE_UNALIGNED16_TO_16(d,s) *(UINT16*)(d) = *(UINT16*)(s) 200#define MOVE_UNALIGNED32_TO_32(d,s) *(UINT32*)(d) = *(UINT32*)(s) 201#define MOVE_UNALIGNED16_TO_32(d,s) *(UINT32*)(d) = *(UINT16*)(s) 202 203#else 204/* 205 * The hardware does not support unaligned transfers. We must move the 206 * data one byte at a time. These macros work whether the source or 207 * the destination (or both) is/are unaligned. 208 */ 209 210#define MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\ 211 ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];} 212 213#define MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\ 214 ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];\ 215 ((UINT8 *)(d))[2] = ((UINT8 *)(s))[2];\ 216 ((UINT8 *)(d))[3] = ((UINT8 *)(s))[3];} 217 218#define MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);} 219 220#endif 221 222 223/* 224 * Fast power-of-two math macros for non-optimized compilers 225 */ 226 227#define _DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2))) 228#define _MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2))) 229#define _MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1))) 230 231#define DIV_2(a) _DIV(a,1) 232#define MUL_2(a) _MUL(a,1) 233#define MOD_2(a) _MOD(a,2) 234 235#define DIV_4(a) _DIV(a,2) 236#define MUL_4(a) _MUL(a,2) 237#define MOD_4(a) _MOD(a,4) 238 239#define DIV_8(a) _DIV(a,3) 240#define MUL_8(a) _MUL(a,3) 241#define MOD_8(a) _MOD(a,8) 242 243#define DIV_16(a) _DIV(a,4) 244#define MUL_16(a) _MUL(a,4) 245#define MOD_16(a) _MOD(a,16) 246 247/* 248 * Divide and Modulo 249 */ 250#define ACPI_DIVIDE(n,d) ((n) / (d)) 251#define ACPI_MODULO(n,d) ((n) % (d)) 252 253/* 254 * Rounding macros (Power of two boundaries only) 255 */ 256 257#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) 258#define ROUND_UP(value,boundary) (((value) + ((boundary)-1)) & (~((boundary)-1))) 259 260#define ROUND_DOWN_TO_32_BITS(a) ROUND_DOWN(a,4) 261#define ROUND_DOWN_TO_64_BITS(a) ROUND_DOWN(a,8) 262#define ROUND_DOWN_TO_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) 263 264#define ROUND_UP_TO_32BITS(a) ROUND_UP(a,4) 265#define ROUND_UP_TO_64BITS(a) ROUND_UP(a,8) 266#define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) 267 268#define ROUND_PTR_UP_TO_4(a,b) ((b *)(((NATIVE_UINT)(a) + 3) & ~3)) 269#define ROUND_PTR_UP_TO_8(a,b) ((b *)(((NATIVE_UINT)(a) + 7) & ~7)) 270 271#define ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) 272 273#ifdef DEBUG_ASSERT 274#undef DEBUG_ASSERT 275#endif 276 277 278/* Macros for GAS addressing */ 279 280#define ACPI_PCI_DEVICE_MASK (UINT64) 0x0000FFFF00000000 281#define ACPI_PCI_FUNCTION_MASK (UINT64) 0x00000000FFFF0000 282#define ACPI_PCI_REGISTER_MASK (UINT64) 0x000000000000FFFF 283 284#define ACPI_PCI_FUNCTION(a) (UINT32) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16)) 285#define ACPI_PCI_DEVICE(a) (UINT32) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32)) 286 287#ifndef _IA16 288#define ACPI_PCI_REGISTER(a) (UINT32) (((a) & ACPI_PCI_REGISTER_MASK)) 289#define ACPI_PCI_DEVFUN(a) (UINT32) ((ACPI_PCI_DEVICE(a) << 16) | ACPI_PCI_FUNCTION(a)) 290 291#else 292#define ACPI_PCI_REGISTER(a) (UINT32) (((a) & 0x0000FFFF)) 293#define ACPI_PCI_DEVFUN(a) (UINT32) ((((a) & 0xFFFF0000) >> 16)) 294 295#endif 296 297/* 298 * An ACPI_HANDLE (which is actually an ACPI_NAMESPACE_NODE *) can appear in some contexts, 299 * such as on apObjStack, where a pointer to an ACPI_OPERAND_OBJECT can also 300 * appear. This macro is used to distinguish them. 301 * 302 * The DataType field is the first field in both structures. 303 */ 304 305#define VALID_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMESPACE_NODE *)d)->DataType == t) 306 307 308/* Macro to test the object type */ 309 310#define IS_THIS_OBJECT_TYPE(d,t) (((ACPI_OPERAND_OBJECT *)d)->Common.Type == (UINT8)t) 311 312/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ 313 314#define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) 315 316/* 317 * Macro to check if a pointer is within an ACPI table. 318 * Parameter (a) is the pointer to check. Parameter (b) must be defined 319 * as a pointer to an ACPI_TABLE_HEADER. (b+1) then points past the header, 320 * and ((UINT8 *)b+b->Length) points one byte past the end of the table. 321 */ 322 323#ifndef _IA16 324#define IS_IN_ACPI_TABLE(a,b) (((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\ 325 ((UINT8 *)(a) < ((UINT8 *)b + b->Length))) 326 327#else 328#define IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\ 329 (((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\ 330 ((UINT8 *)(a) < ((UINT8 *)b + b->Length))) 331#endif 332 333/* 334 * Macros for the master AML opcode table 335 */ 336 337#ifdef ACPI_DEBUG 338#define OP_INFO_ENTRY(Flags,Name,PArgs,IArgs) {Flags,PArgs,IArgs,Name} 339#else 340#define OP_INFO_ENTRY(Flags,Name,PArgs,IArgs) {Flags,PArgs,IArgs} 341#endif 342 343#define ARG_TYPE_WIDTH 5 344#define ARG_1(x) ((UINT32)(x)) 345#define ARG_2(x) ((UINT32)(x) << (1 * ARG_TYPE_WIDTH)) 346#define ARG_3(x) ((UINT32)(x) << (2 * ARG_TYPE_WIDTH)) 347#define ARG_4(x) ((UINT32)(x) << (3 * ARG_TYPE_WIDTH)) 348#define ARG_5(x) ((UINT32)(x) << (4 * ARG_TYPE_WIDTH)) 349#define ARG_6(x) ((UINT32)(x) << (5 * ARG_TYPE_WIDTH)) 350 351#define ARGI_LIST1(a) (ARG_1(a)) 352#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) 353#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) 354#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) 355#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) 356#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)) 357 358#define ARGP_LIST1(a) (ARG_1(a)) 359#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) 360#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) 361#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) 362#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) 363#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)) 364 365#define GET_CURRENT_ARG_TYPE(List) (List & ((UINT32) 0x1F)) 366#define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH)) 367 368 369/* 370 * Reporting macros that are never compiled out 371 */ 372 373#define PARAM_LIST(pl) pl 374 375/* 376 * Error reporting. These versions add callers module and line#. Since 377 * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only 378 * use it in debug mode. 379 */ 380 381#ifdef ACPI_DEBUG 382 383#define REPORT_INFO(fp) {_ReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \ 384 DebugPrintRaw PARAM_LIST(fp);} 385#define REPORT_ERROR(fp) {_ReportError(_THIS_MODULE,__LINE__,_COMPONENT); \ 386 DebugPrintRaw PARAM_LIST(fp);} 387#define REPORT_WARNING(fp) {_ReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \ 388 DebugPrintRaw PARAM_LIST(fp);} 389 390#else 391 392#define REPORT_INFO(fp) {_ReportInfo("ACPI",__LINE__,_COMPONENT); \ 393 DebugPrintRaw PARAM_LIST(fp);} 394#define REPORT_ERROR(fp) {_ReportError("ACPI",__LINE__,_COMPONENT); \ 395 DebugPrintRaw PARAM_LIST(fp);} 396#define REPORT_WARNING(fp) {_ReportWarning("ACPI",__LINE__,_COMPONENT); \ 397 DebugPrintRaw PARAM_LIST(fp);} 398 399#endif 400 401/* Error reporting. These versions pass thru the module and line# */ 402 403#define _REPORT_INFO(a,b,c,fp) {_ReportInfo(a,b,c); \ 404 DebugPrintRaw PARAM_LIST(fp);} 405#define _REPORT_ERROR(a,b,c,fp) {_ReportError(a,b,c); \ 406 DebugPrintRaw PARAM_LIST(fp);} 407#define _REPORT_WARNING(a,b,c,fp) {_ReportWarning(a,b,c); \ 408 DebugPrintRaw PARAM_LIST(fp);} 409 410/* Buffer dump macros */ 411 412#define DUMP_BUFFER(a,b) AcpiCmDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) 413 414/* 415 * Debug macros that are conditionally compiled 416 */ 417 418#ifdef ACPI_DEBUG 419 420#define MODULE_NAME(name) static char *_THIS_MODULE = name; 421 422/* 423 * Function entry tracing. 424 * The first parameter should be the procedure name as a quoted string. This is declared 425 * as a local string ("_ProcName) so that it can be also used by the function exit macros below. 426 */ 427 428#define FUNCTION_TRACE(a) char * _ProcName = a;\ 429 FunctionTrace(_THIS_MODULE,__LINE__,_COMPONENT,a) 430#define FUNCTION_TRACE_PTR(a,b) char * _ProcName = a;\ 431 FunctionTracePtr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b) 432#define FUNCTION_TRACE_U32(a,b) char * _ProcName = a;\ 433 FunctionTraceU32(_THIS_MODULE,__LINE__,_COMPONENT,a,(UINT32)b) 434#define FUNCTION_TRACE_STR(a,b) char * _ProcName = a;\ 435 FunctionTraceStr(_THIS_MODULE,__LINE__,_COMPONENT,a,(NATIVE_CHAR *)b) 436/* 437 * Function exit tracing. 438 * WARNING: These macros include a return statement. This is usually considered 439 * bad form, but having a separate exit macro is very ugly and difficult to maintain. 440 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 441 * so that "_ProcName" is defined. 442 */ 443#define return_VOID {FunctionExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName);return;} 444#define return_ACPI_STATUS(s) {FunctionStatusExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,s);return(s);} 445#define return_VALUE(s) {FunctionValueExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(ACPI_INTEGER)s);return(s);} 446#define return_PTR(s) {FunctionPtrExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(UINT8 *)s);return(s);} 447 448 449/* Conditional execution */ 450 451#define DEBUG_EXEC(a) a 452#define NORMAL_EXEC(a) 453 454#define DEBUG_DEFINE(a) a; 455#define DEBUG_ONLY_MEMBERS(a) a; 456#define _OPCODE_NAMES 457#define _VERBOSE_STRUCTURES 458 459 460/* Stack and buffer dumping */ 461 462#define DUMP_STACK_ENTRY(a) AcpiAmlDumpOperand(a) 463#define DUMP_OPERANDS(a,b,c,d,e) AcpiAmlDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__) 464 465 466#define DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b) 467#define DUMP_TABLES(a,b) AcpiNsDumpTables(a,b) 468#define DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d) 469#define DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a) 470#define BREAK_MSG(a) AcpiOsBreakpoint (a) 471 472/* 473 * Generate INT3 on ACPI_ERROR (Debug only!) 474 */ 475 476#define ERROR_BREAK 477#ifdef ERROR_BREAK 478#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) AcpiOsBreakpoint("Fatal error encountered\n") 479#else 480#define BREAK_ON_ERROR(lvl) 481#endif 482 483/* 484 * Master debug print macros 485 * Print iff: 486 * 1) Debug print for the current component is enabled 487 * 2) Debug error level or trace level for the print statement is enabled 488 * 489 */ 490 491#define TEST_DEBUG_SWITCH(lvl) if (((lvl) & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)) 492 493#define DEBUG_PRINT(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ 494 DebugPrintPrefix (_THIS_MODULE,__LINE__);\ 495 DebugPrintRaw PARAM_LIST(fp);\ 496 BREAK_ON_ERROR(lvl);} 497 498#define DEBUG_PRINT_RAW(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ 499 DebugPrintRaw PARAM_LIST(fp);} 500 501 502/* Assert macros */ 503 504#define ACPI_ASSERT(exp) if(!(exp)) \ 505 AcpiOsDbgAssert(#exp, __FILE__, __LINE__, "Failed Assertion") 506 507#define DEBUG_ASSERT(msg, exp) if(!(exp)) \ 508 AcpiOsDbgAssert(#exp, __FILE__, __LINE__, msg) 509 510 511#else 512/* 513 * This is the non-debug case -- make everything go away, 514 * leaving no executable debug code! 515 */ 516 517#define MODULE_NAME(name) 518#define _THIS_MODULE "" 519 520#define DEBUG_EXEC(a) 521#define NORMAL_EXEC(a) a; 522 523#define DEBUG_DEFINE(a) 524#define DEBUG_ONLY_MEMBERS(a) 525#define FUNCTION_TRACE(a) 526#define FUNCTION_TRACE_PTR(a,b) 527#define FUNCTION_TRACE_U32(a,b) 528#define FUNCTION_TRACE_STR(a,b) 529#define FUNCTION_EXIT 530#define FUNCTION_STATUS_EXIT(s) 531#define FUNCTION_VALUE_EXIT(s) 532#define DUMP_STACK_ENTRY(a) 533#define DUMP_OPERANDS(a,b,c,d,e) 534#define DUMP_ENTRY(a,b) 535#define DUMP_TABLES(a,b) 536#define DUMP_PATHNAME(a,b,c,d) 537#define DUMP_RESOURCE_LIST(a) 538#define DEBUG_PRINT(l,f) 539#define DEBUG_PRINT_RAW(l,f) 540#define BREAK_MSG(a) 541 542#define return_VOID return 543#define return_ACPI_STATUS(s) return(s) 544#define return_VALUE(s) return(s) 545#define return_PTR(s) return(s) 546 547#define ACPI_ASSERT(exp) 548#define DEBUG_ASSERT(msg, exp) 549 550#endif 551 552/* 553 * Some code only gets executed when the debugger is built in. 554 * Note that this is entirely independent of whether the 555 * DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not. 556 */ 557#ifdef ENABLE_DEBUGGER 558#define DEBUGGER_EXEC(a) a 559#else 560#define DEBUGGER_EXEC(a) 561#endif 562 563 564/* 565 * For 16-bit code, we want to shrink some things even though 566 * we are using ACPI_DEBUG to get the debug output 567 */ 568#ifdef _IA16 569#undef DEBUG_ONLY_MEMBERS 570#undef _VERBOSE_STRUCTURES 571#define DEBUG_ONLY_MEMBERS(a) 572#endif 573 574 575#ifdef ACPI_DEBUG 576 577/* 578 * 1) Set name to blanks 579 * 2) Copy the object name 580 */ 581 582#define ADD_OBJECT_NAME(a,b) MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\ 583 STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name)) 584 585#else 586 587#define ADD_OBJECT_NAME(a,b) 588 589#endif 590 591 592#endif /* ACMACROS_H */ 593