acmacros.h revision 69450
1/****************************************************************************** 2 * 3 * Name: acmacros.h - C macros for the entire subsystem. 4 * $Revision: 56 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, Intel Corp. All rights 13 * 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 LOWORD 125#define LOWORD(l) ((UINT16)(NATIVE_UINT)(l)) 126#endif 127 128#ifndef HIWORD 129#define HIWORD(l) ((UINT16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF)) 130#endif 131 132#ifndef LOBYTE 133#define LOBYTE(l) ((UINT8)(UINT16)(l)) 134#endif 135 136#ifndef HIBYTE 137#define HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF)) 138#endif 139 140#define BIT0(x) ((((x) & 0x01) > 0) ? 1 : 0) 141#define BIT1(x) ((((x) & 0x02) > 0) ? 1 : 0) 142#define BIT2(x) ((((x) & 0x04) > 0) ? 1 : 0) 143 144#define BIT3(x) ((((x) & 0x08) > 0) ? 1 : 0) 145#define BIT4(x) ((((x) & 0x10) > 0) ? 1 : 0) 146#define BIT5(x) ((((x) & 0x20) > 0) ? 1 : 0) 147#define BIT6(x) ((((x) & 0x40) > 0) ? 1 : 0) 148#define BIT7(x) ((((x) & 0x80) > 0) ? 1 : 0) 149 150#define LOW_BASE(w) ((UINT16) ((w) & 0x0000FFFF)) 151#define MID_BASE(b) ((UINT8) (((b) & 0x00FF0000) >> 16)) 152#define HI_BASE(b) ((UINT8) (((b) & 0xFF000000) >> 24)) 153#define LOW_LIMIT(w) ((UINT16) ((w) & 0x0000FFFF)) 154#define HI_LIMIT(b) ((UINT8) (((b) & 0x00FF0000) >> 16)) 155 156 157 /* 158 * Extract a byte of data using a pointer. Any more than a byte and we 159 * get into potential aligment issues -- see the STORE macros below 160 */ 161#define GET8(addr) (*(UINT8*)(addr)) 162 163 164/* 165 * Macros for moving data around to/from buffers that are possibly unaligned. 166 * If the hardware supports the transfer of unaligned data, just do the store. 167 * Otherwise, we have to move one byte at a time. 168 */ 169 170#ifdef _HW_ALIGNMENT_SUPPORT 171 172/* The hardware supports unaligned transfers, just do the move */ 173 174#define MOVE_UNALIGNED16_TO_16(d,s) *(UINT16*)(d) = *(UINT16*)(s) 175#define MOVE_UNALIGNED32_TO_32(d,s) *(UINT32*)(d) = *(UINT32*)(s) 176#define MOVE_UNALIGNED16_TO_32(d,s) *(UINT32*)(d) = *(UINT16*)(s) 177 178#else 179/* 180 * The hardware does not support unaligned transfers. We must move the 181 * data one byte at a time. These macros work whether the source or 182 * the destination (or both) is/are unaligned. 183 */ 184 185#define MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\ 186 ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];} 187 188#define MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\ 189 ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];\ 190 ((UINT8 *)(d))[2] = ((UINT8 *)(s))[2];\ 191 ((UINT8 *)(d))[3] = ((UINT8 *)(s))[3];} 192 193#define MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);} 194 195#endif 196 197 198/* 199 * Fast power-of-two math macros for non-optimized compilers 200 */ 201 202#define _DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2))) 203#define _MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2))) 204#define _MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1))) 205 206#define DIV_2(a) _DIV(a,1) 207#define MUL_2(a) _MUL(a,1) 208#define MOD_2(a) _MOD(a,2) 209 210#define DIV_4(a) _DIV(a,2) 211#define MUL_4(a) _MUL(a,2) 212#define MOD_4(a) _MOD(a,4) 213 214#define DIV_8(a) _DIV(a,3) 215#define MUL_8(a) _MUL(a,3) 216#define MOD_8(a) _MOD(a,8) 217 218#define DIV_16(a) _DIV(a,4) 219#define MUL_16(a) _MUL(a,4) 220#define MOD_16(a) _MOD(a,16) 221 222/* 223 * Divide and Modulo 224 */ 225#define ACPI_DIVIDE(n,d) ((n) / (d)) 226#define ACPI_MODULO(n,d) ((n) % (d)) 227 228/* 229 * Rounding macros (Power of two boundaries only) 230 */ 231 232#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) 233#define ROUND_UP(value,boundary) (((value) + ((boundary)-1)) & (~((boundary)-1))) 234 235#define ROUND_DOWN_TO_32_BITS(a) ROUND_DOWN(a,4) 236#define ROUND_DOWN_TO_64_BITS(a) ROUND_DOWN(a,8) 237#define ROUND_DOWN_TO_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) 238 239#define ROUND_UP_TO_32BITS(a) ROUND_UP(a,4) 240#define ROUND_UP_TO_64BITS(a) ROUND_UP(a,8) 241#define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) 242 243#define ROUND_PTR_UP_TO_4(a,b) ((b *)(((NATIVE_UINT)(a) + 3) & ~3)) 244#define ROUND_PTR_UP_TO_8(a,b) ((b *)(((NATIVE_UINT)(a) + 7) & ~7)) 245 246#define ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) 247 248#ifdef DEBUG_ASSERT 249#undef DEBUG_ASSERT 250#endif 251 252 253/* Macros for GAS addressing */ 254 255#define ACPI_PCI_DEVICE_MASK (UINT64) 0x0000FFFF00000000 256#define ACPI_PCI_FUNCTION_MASK (UINT64) 0x00000000FFFF0000 257#define ACPI_PCI_REGISTER_MASK (UINT64) 0x000000000000FFFF 258 259#define ACPI_PCI_FUNCTION(a) (UINT32) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16)) 260#define ACPI_PCI_DEVICE(a) (UINT32) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32)) 261#define ACPI_PCI_REGISTER(a) (UINT32) (((a) & ACPI_PCI_REGISTER_MASK)) 262#define ACPI_PCI_DEVFUN(a) (UINT32) ((ACPI_PCI_DEVICE(a) << 16) | ACPI_PCI_FUNCTION(a)) 263 264 265/* 266 * An ACPI_HANDLE (which is actually an ACPI_NAMESPACE_NODE *) can appear in some contexts, 267 * such as on apObjStack, where a pointer to an ACPI_OPERAND_OBJECT can also 268 * appear. This macro is used to distinguish them. 269 * 270 * The DataType field is the first field in both structures. 271 */ 272 273#define VALID_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMESPACE_NODE *)d)->DataType == t) 274 275 276/* Macro to test the object type */ 277 278#define IS_THIS_OBJECT_TYPE(d,t) (((ACPI_OPERAND_OBJECT *)d)->Common.Type == (UINT8)t) 279 280/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ 281 282#define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) 283 284/* 285 * Macro to check if a pointer is within an ACPI table. 286 * Parameter (a) is the pointer to check. Parameter (b) must be defined 287 * as a pointer to an ACPI_TABLE_HEADER. (b+1) then points past the header, 288 * and ((UINT8 *)b+b->Length) points one byte past the end of the table. 289 */ 290 291#ifndef _IA16 292#define IS_IN_ACPI_TABLE(a,b) (((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\ 293 ((UINT8 *)(a) < ((UINT8 *)b + b->Length))) 294 295#else 296#define IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\ 297 (((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\ 298 ((UINT8 *)(a) < ((UINT8 *)b + b->Length))) 299#endif 300 301/* 302 * Macros for the master AML opcode table 303 */ 304 305#ifdef ACPI_DEBUG 306#define OP_INFO_ENTRY(Flags,Name,PArgs,IArgs) {Flags,PArgs,IArgs,Name} 307#else 308#define OP_INFO_ENTRY(Flags,Name,PArgs,IArgs) {Flags,PArgs,IArgs} 309#endif 310 311#define ARG_TYPE_WIDTH 5 312#define ARG_1(x) ((UINT32)(x)) 313#define ARG_2(x) ((UINT32)(x) << (1 * ARG_TYPE_WIDTH)) 314#define ARG_3(x) ((UINT32)(x) << (2 * ARG_TYPE_WIDTH)) 315#define ARG_4(x) ((UINT32)(x) << (3 * ARG_TYPE_WIDTH)) 316#define ARG_5(x) ((UINT32)(x) << (4 * ARG_TYPE_WIDTH)) 317#define ARG_6(x) ((UINT32)(x) << (5 * ARG_TYPE_WIDTH)) 318 319#define ARGI_LIST1(a) (ARG_1(a)) 320#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) 321#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) 322#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) 323#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) 324#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)) 325 326#define ARGP_LIST1(a) (ARG_1(a)) 327#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) 328#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) 329#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) 330#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) 331#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)) 332 333#define GET_CURRENT_ARG_TYPE(List) (List & ((UINT32) 0x1F)) 334#define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH)) 335 336 337/* 338 * Reporting macros that are never compiled out 339 */ 340 341#define PARAM_LIST(pl) pl 342 343/* 344 * Error reporting. These versions add callers module and line#. Since 345 * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only 346 * use it in debug mode. 347 */ 348 349#ifdef ACPI_DEBUG 350 351#define REPORT_INFO(fp) {_ReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \ 352 DebugPrintRaw PARAM_LIST(fp);} 353#define REPORT_ERROR(fp) {_ReportError(_THIS_MODULE,__LINE__,_COMPONENT); \ 354 DebugPrintRaw PARAM_LIST(fp);} 355#define REPORT_WARNING(fp) {_ReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \ 356 DebugPrintRaw PARAM_LIST(fp);} 357 358#else 359 360#define REPORT_INFO(fp) {_ReportInfo("ACPI",__LINE__,_COMPONENT); \ 361 DebugPrintRaw PARAM_LIST(fp);} 362#define REPORT_ERROR(fp) {_ReportError("ACPI",__LINE__,_COMPONENT); \ 363 DebugPrintRaw PARAM_LIST(fp);} 364#define REPORT_WARNING(fp) {_ReportWarning("ACPI",__LINE__,_COMPONENT); \ 365 DebugPrintRaw PARAM_LIST(fp);} 366 367#endif 368 369/* Error reporting. These versions pass thru the module and line# */ 370 371#define _REPORT_INFO(a,b,c,fp) {_ReportInfo(a,b,c); \ 372 DebugPrintRaw PARAM_LIST(fp);} 373#define _REPORT_ERROR(a,b,c,fp) {_ReportError(a,b,c); \ 374 DebugPrintRaw PARAM_LIST(fp);} 375#define _REPORT_WARNING(a,b,c,fp) {_ReportWarning(a,b,c); \ 376 DebugPrintRaw PARAM_LIST(fp);} 377 378/* Buffer dump macros */ 379 380#define DUMP_BUFFER(a,b) AcpiCmDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) 381 382/* 383 * Debug macros that are conditionally compiled 384 */ 385 386#ifdef ACPI_DEBUG 387 388#define MODULE_NAME(name) static char *_THIS_MODULE = name; 389 390/* 391 * Function entry tracing. 392 * The first parameter should be the procedure name as a quoted string. This is declared 393 * as a local string ("_ProcName) so that it can be also used by the function exit macros below. 394 */ 395 396#define FUNCTION_TRACE(a) char * _ProcName = a;\ 397 FunctionTrace(_THIS_MODULE,__LINE__,_COMPONENT,a) 398#define FUNCTION_TRACE_PTR(a,b) char * _ProcName = a;\ 399 FunctionTracePtr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b) 400#define FUNCTION_TRACE_U32(a,b) char * _ProcName = a;\ 401 FunctionTraceU32(_THIS_MODULE,__LINE__,_COMPONENT,a,(UINT32)b) 402#define FUNCTION_TRACE_STR(a,b) char * _ProcName = a;\ 403 FunctionTraceStr(_THIS_MODULE,__LINE__,_COMPONENT,a,(NATIVE_CHAR *)b) 404/* 405 * Function exit tracing. 406 * WARNING: These macros include a return statement. This is usually considered 407 * bad form, but having a separate exit macro is very ugly and difficult to maintain. 408 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 409 * so that "_ProcName" is defined. 410 */ 411#define return_VOID {FunctionExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName);return;} 412#define return_ACPI_STATUS(s) {FunctionStatusExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,s);return(s);} 413#define return_VALUE(s) {FunctionValueExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(NATIVE_UINT)s);return(s);} 414#define return_PTR(s) {FunctionPtrExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(UINT8 *)s);return(s);} 415 416 417/* Conditional execution */ 418 419#define DEBUG_EXEC(a) a 420#define NORMAL_EXEC(a) 421 422#define DEBUG_DEFINE(a) a; 423#define DEBUG_ONLY_MEMBERS(a) a; 424 425 426/* Stack and buffer dumping */ 427 428#define DUMP_STACK_ENTRY(a) AcpiAmlDumpOperand(a) 429#define DUMP_OPERANDS(a,b,c,d,e) AcpiAmlDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__) 430 431 432#define DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b) 433#define DUMP_TABLES(a,b) AcpiNsDumpTables(a,b) 434#define DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d) 435#define DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a) 436#define BREAK_MSG(a) AcpiOsBreakpoint (a) 437 438/* 439 * Generate INT3 on ACPI_ERROR (Debug only!) 440 */ 441 442#define ERROR_BREAK 443#ifdef ERROR_BREAK 444#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) AcpiOsBreakpoint("Fatal error encountered\n") 445#else 446#define BREAK_ON_ERROR(lvl) 447#endif 448 449/* 450 * Master debug print macros 451 * Print iff: 452 * 1) Debug print for the current component is enabled 453 * 2) Debug error level or trace level for the print statement is enabled 454 * 455 */ 456 457#define TEST_DEBUG_SWITCH(lvl) if (((lvl) & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)) 458 459#define DEBUG_PRINT(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ 460 DebugPrintPrefix (_THIS_MODULE,__LINE__);\ 461 DebugPrintRaw PARAM_LIST(fp);\ 462 BREAK_ON_ERROR(lvl);} 463 464#define DEBUG_PRINT_RAW(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ 465 DebugPrintRaw PARAM_LIST(fp);} 466 467 468/* Assert macros */ 469 470#define ACPI_ASSERT(exp) if(!(exp)) \ 471 AcpiOsDbgAssert(#exp, __FILE__, __LINE__, "Failed Assertion") 472 473#define DEBUG_ASSERT(msg, exp) if(!(exp)) \ 474 AcpiOsDbgAssert(#exp, __FILE__, __LINE__, msg) 475 476 477#else 478/* 479 * This is the non-debug case -- make everything go away, 480 * leaving no executable debug code! 481 */ 482 483#define MODULE_NAME(name) 484#define _THIS_MODULE "" 485 486#define DEBUG_EXEC(a) 487#define NORMAL_EXEC(a) a; 488 489#define DEBUG_DEFINE(a) 490#define DEBUG_ONLY_MEMBERS(a) 491#define FUNCTION_TRACE(a) 492#define FUNCTION_TRACE_PTR(a,b) 493#define FUNCTION_TRACE_U32(a,b) 494#define FUNCTION_TRACE_STR(a,b) 495#define FUNCTION_EXIT 496#define FUNCTION_STATUS_EXIT(s) 497#define FUNCTION_VALUE_EXIT(s) 498#define DUMP_STACK_ENTRY(a) 499#define DUMP_OPERANDS(a,b,c,d,e) 500#define DUMP_ENTRY(a,b) 501#define DUMP_TABLES(a,b) 502#define DUMP_PATHNAME(a,b,c,d) 503#define DUMP_RESOURCE_LIST(a) 504#define DEBUG_PRINT(l,f) 505#define DEBUG_PRINT_RAW(l,f) 506#define BREAK_MSG(a) 507 508#define return_VOID return 509#define return_ACPI_STATUS(s) return(s) 510#define return_VALUE(s) return(s) 511#define return_PTR(s) return(s) 512 513#define ACPI_ASSERT(exp) 514#define DEBUG_ASSERT(msg, exp) 515 516#endif 517 518/* 519 * Some code only gets executed when the debugger is built in. 520 * Note that this is entirely independent of whether the 521 * DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not. 522 */ 523#ifdef ENABLE_DEBUGGER 524#define DEBUGGER_EXEC(a) a 525#else 526#define DEBUGGER_EXEC(a) 527#endif 528 529 530/* 531 * For 16-bit code, we want to shrink some things even though 532 * we are using ACPI_DEBUG to get the debug output 533 */ 534#ifdef _IA16 535#undef DEBUG_ONLY_MEMBERS 536#define DEBUG_ONLY_MEMBERS(a) 537#undef OP_INFO_ENTRY 538#define OP_INFO_ENTRY(Flags,Name,PArgs,IArgs) {Flags,PArgs,IArgs} 539#endif 540 541 542#ifdef ACPI_DEBUG 543 544/* 545 * 1) Set name to blanks 546 * 2) Copy the object name 547 */ 548 549#define ADD_OBJECT_NAME(a,b) MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\ 550 STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name)) 551 552#else 553 554#define ADD_OBJECT_NAME(a,b) 555 556#endif 557 558 559#endif /* ACMACROS_H */ 560