1*7c478bd9Sstevel@tonic-gate /****************************************************************************** 2*7c478bd9Sstevel@tonic-gate * 3*7c478bd9Sstevel@tonic-gate * Name: acmacros.h - C macros for the entire subsystem. 4*7c478bd9Sstevel@tonic-gate * $Revision: 158 $ 5*7c478bd9Sstevel@tonic-gate * 6*7c478bd9Sstevel@tonic-gate *****************************************************************************/ 7*7c478bd9Sstevel@tonic-gate 8*7c478bd9Sstevel@tonic-gate /****************************************************************************** 9*7c478bd9Sstevel@tonic-gate * 10*7c478bd9Sstevel@tonic-gate * 1. Copyright Notice 11*7c478bd9Sstevel@tonic-gate * 12*7c478bd9Sstevel@tonic-gate * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. 13*7c478bd9Sstevel@tonic-gate * All rights reserved. 14*7c478bd9Sstevel@tonic-gate * 15*7c478bd9Sstevel@tonic-gate * 2. License 16*7c478bd9Sstevel@tonic-gate * 17*7c478bd9Sstevel@tonic-gate * 2.1. This is your license from Intel Corp. under its intellectual property 18*7c478bd9Sstevel@tonic-gate * rights. You may have additional license terms from the party that provided 19*7c478bd9Sstevel@tonic-gate * you this software, covering your right to use that party's intellectual 20*7c478bd9Sstevel@tonic-gate * property rights. 21*7c478bd9Sstevel@tonic-gate * 22*7c478bd9Sstevel@tonic-gate * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23*7c478bd9Sstevel@tonic-gate * copy of the source code appearing in this file ("Covered Code") an 24*7c478bd9Sstevel@tonic-gate * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25*7c478bd9Sstevel@tonic-gate * base code distributed originally by Intel ("Original Intel Code") to copy, 26*7c478bd9Sstevel@tonic-gate * make derivatives, distribute, use and display any portion of the Covered 27*7c478bd9Sstevel@tonic-gate * Code in any form, with the right to sublicense such rights; and 28*7c478bd9Sstevel@tonic-gate * 29*7c478bd9Sstevel@tonic-gate * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30*7c478bd9Sstevel@tonic-gate * license (with the right to sublicense), under only those claims of Intel 31*7c478bd9Sstevel@tonic-gate * patents that are infringed by the Original Intel Code, to make, use, sell, 32*7c478bd9Sstevel@tonic-gate * offer to sell, and import the Covered Code and derivative works thereof 33*7c478bd9Sstevel@tonic-gate * solely to the minimum extent necessary to exercise the above copyright 34*7c478bd9Sstevel@tonic-gate * license, and in no event shall the patent license extend to any additions 35*7c478bd9Sstevel@tonic-gate * to or modifications of the Original Intel Code. No other license or right 36*7c478bd9Sstevel@tonic-gate * is granted directly or by implication, estoppel or otherwise; 37*7c478bd9Sstevel@tonic-gate * 38*7c478bd9Sstevel@tonic-gate * The above copyright and patent license is granted only if the following 39*7c478bd9Sstevel@tonic-gate * conditions are met: 40*7c478bd9Sstevel@tonic-gate * 41*7c478bd9Sstevel@tonic-gate * 3. Conditions 42*7c478bd9Sstevel@tonic-gate * 43*7c478bd9Sstevel@tonic-gate * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44*7c478bd9Sstevel@tonic-gate * Redistribution of source code of any substantial portion of the Covered 45*7c478bd9Sstevel@tonic-gate * Code or modification with rights to further distribute source must include 46*7c478bd9Sstevel@tonic-gate * the above Copyright Notice, the above License, this list of Conditions, 47*7c478bd9Sstevel@tonic-gate * and the following Disclaimer and Export Compliance provision. In addition, 48*7c478bd9Sstevel@tonic-gate * Licensee must cause all Covered Code to which Licensee contributes to 49*7c478bd9Sstevel@tonic-gate * contain a file documenting the changes Licensee made to create that Covered 50*7c478bd9Sstevel@tonic-gate * Code and the date of any change. Licensee must include in that file the 51*7c478bd9Sstevel@tonic-gate * documentation of any changes made by any predecessor Licensee. Licensee 52*7c478bd9Sstevel@tonic-gate * must include a prominent statement that the modification is derived, 53*7c478bd9Sstevel@tonic-gate * directly or indirectly, from Original Intel Code. 54*7c478bd9Sstevel@tonic-gate * 55*7c478bd9Sstevel@tonic-gate * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56*7c478bd9Sstevel@tonic-gate * Redistribution of source code of any substantial portion of the Covered 57*7c478bd9Sstevel@tonic-gate * Code or modification without rights to further distribute source must 58*7c478bd9Sstevel@tonic-gate * include the following Disclaimer and Export Compliance provision in the 59*7c478bd9Sstevel@tonic-gate * documentation and/or other materials provided with distribution. In 60*7c478bd9Sstevel@tonic-gate * addition, Licensee may not authorize further sublicense of source of any 61*7c478bd9Sstevel@tonic-gate * portion of the Covered Code, and must include terms to the effect that the 62*7c478bd9Sstevel@tonic-gate * license from Licensee to its licensee is limited to the intellectual 63*7c478bd9Sstevel@tonic-gate * property embodied in the software Licensee provides to its licensee, and 64*7c478bd9Sstevel@tonic-gate * not to intellectual property embodied in modifications its licensee may 65*7c478bd9Sstevel@tonic-gate * make. 66*7c478bd9Sstevel@tonic-gate * 67*7c478bd9Sstevel@tonic-gate * 3.3. Redistribution of Executable. Redistribution in executable form of any 68*7c478bd9Sstevel@tonic-gate * substantial portion of the Covered Code or modification must reproduce the 69*7c478bd9Sstevel@tonic-gate * above Copyright Notice, and the following Disclaimer and Export Compliance 70*7c478bd9Sstevel@tonic-gate * provision in the documentation and/or other materials provided with the 71*7c478bd9Sstevel@tonic-gate * distribution. 72*7c478bd9Sstevel@tonic-gate * 73*7c478bd9Sstevel@tonic-gate * 3.4. Intel retains all right, title, and interest in and to the Original 74*7c478bd9Sstevel@tonic-gate * Intel Code. 75*7c478bd9Sstevel@tonic-gate * 76*7c478bd9Sstevel@tonic-gate * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77*7c478bd9Sstevel@tonic-gate * Intel shall be used in advertising or otherwise to promote the sale, use or 78*7c478bd9Sstevel@tonic-gate * other dealings in products derived from or relating to the Covered Code 79*7c478bd9Sstevel@tonic-gate * without prior written authorization from Intel. 80*7c478bd9Sstevel@tonic-gate * 81*7c478bd9Sstevel@tonic-gate * 4. Disclaimer and Export Compliance 82*7c478bd9Sstevel@tonic-gate * 83*7c478bd9Sstevel@tonic-gate * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84*7c478bd9Sstevel@tonic-gate * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85*7c478bd9Sstevel@tonic-gate * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86*7c478bd9Sstevel@tonic-gate * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87*7c478bd9Sstevel@tonic-gate * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88*7c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89*7c478bd9Sstevel@tonic-gate * PARTICULAR PURPOSE. 90*7c478bd9Sstevel@tonic-gate * 91*7c478bd9Sstevel@tonic-gate * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92*7c478bd9Sstevel@tonic-gate * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93*7c478bd9Sstevel@tonic-gate * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94*7c478bd9Sstevel@tonic-gate * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95*7c478bd9Sstevel@tonic-gate * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96*7c478bd9Sstevel@tonic-gate * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97*7c478bd9Sstevel@tonic-gate * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98*7c478bd9Sstevel@tonic-gate * LIMITED REMEDY. 99*7c478bd9Sstevel@tonic-gate * 100*7c478bd9Sstevel@tonic-gate * 4.3. Licensee shall not export, either directly or indirectly, any of this 101*7c478bd9Sstevel@tonic-gate * software or system incorporating such software without first obtaining any 102*7c478bd9Sstevel@tonic-gate * required license or other approval from the U. S. Department of Commerce or 103*7c478bd9Sstevel@tonic-gate * any other agency or department of the United States Government. In the 104*7c478bd9Sstevel@tonic-gate * event Licensee exports any such software from the United States or 105*7c478bd9Sstevel@tonic-gate * re-exports any such software from a foreign destination, Licensee shall 106*7c478bd9Sstevel@tonic-gate * ensure that the distribution and export/re-export of the software is in 107*7c478bd9Sstevel@tonic-gate * compliance with all laws, regulations, orders, or other restrictions of the 108*7c478bd9Sstevel@tonic-gate * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109*7c478bd9Sstevel@tonic-gate * any of its subsidiaries will export/re-export any technical data, process, 110*7c478bd9Sstevel@tonic-gate * software, or service, directly or indirectly, to any country for which the 111*7c478bd9Sstevel@tonic-gate * United States government or any agency thereof requires an export license, 112*7c478bd9Sstevel@tonic-gate * other governmental approval, or letter of assurance, without first obtaining 113*7c478bd9Sstevel@tonic-gate * such license, approval or letter. 114*7c478bd9Sstevel@tonic-gate * 115*7c478bd9Sstevel@tonic-gate *****************************************************************************/ 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate #ifndef __ACMACROS_H__ 118*7c478bd9Sstevel@tonic-gate #define __ACMACROS_H__ 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate /* 122*7c478bd9Sstevel@tonic-gate * Data manipulation macros 123*7c478bd9Sstevel@tonic-gate */ 124*7c478bd9Sstevel@tonic-gate #define ACPI_LOWORD(l) ((UINT16)(UINT32)(l)) 125*7c478bd9Sstevel@tonic-gate #define ACPI_HIWORD(l) ((UINT16)((((UINT32)(l)) >> 16) & 0xFFFF)) 126*7c478bd9Sstevel@tonic-gate #define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l)) 127*7c478bd9Sstevel@tonic-gate #define ACPI_HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF)) 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate #define ACPI_SET_BIT(target,bit) ((target) |= (bit)) 130*7c478bd9Sstevel@tonic-gate #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 131*7c478bd9Sstevel@tonic-gate #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate #if ACPI_MACHINE_WIDTH == 16 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate /* 137*7c478bd9Sstevel@tonic-gate * For 16-bit addresses, we have to assume that the upper 32 bits 138*7c478bd9Sstevel@tonic-gate * are zero. 139*7c478bd9Sstevel@tonic-gate */ 140*7c478bd9Sstevel@tonic-gate #define ACPI_LODWORD(l) ((UINT32)(l)) 141*7c478bd9Sstevel@tonic-gate #define ACPI_HIDWORD(l) ((UINT32)(0)) 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate #define ACPI_GET_ADDRESS(a) ((a).Lo) 144*7c478bd9Sstevel@tonic-gate #define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(UINT32)(b);} 145*7c478bd9Sstevel@tonic-gate #define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo) 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate #else 148*7c478bd9Sstevel@tonic-gate #ifdef ACPI_NO_INTEGER64_SUPPORT 149*7c478bd9Sstevel@tonic-gate /* 150*7c478bd9Sstevel@tonic-gate * ACPI_INTEGER is 32-bits, no 64-bit support on this platform 151*7c478bd9Sstevel@tonic-gate */ 152*7c478bd9Sstevel@tonic-gate #define ACPI_LODWORD(l) ((UINT32)(l)) 153*7c478bd9Sstevel@tonic-gate #define ACPI_HIDWORD(l) ((UINT32)(0)) 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate #define ACPI_GET_ADDRESS(a) (a) 156*7c478bd9Sstevel@tonic-gate #define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) 157*7c478bd9Sstevel@tonic-gate #define ACPI_VALID_ADDRESS(a) (a) 158*7c478bd9Sstevel@tonic-gate 159*7c478bd9Sstevel@tonic-gate #else 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate /* 162*7c478bd9Sstevel@tonic-gate * Full 64-bit address/integer on both 32-bit and 64-bit platforms 163*7c478bd9Sstevel@tonic-gate */ 164*7c478bd9Sstevel@tonic-gate #define ACPI_LODWORD(l) ((UINT32)(UINT64)(l)) 165*7c478bd9Sstevel@tonic-gate #define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(void *)(&l))).Hi)) 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate #define ACPI_GET_ADDRESS(a) (a) 168*7c478bd9Sstevel@tonic-gate #define ACPI_STORE_ADDRESS(a,b) ((a)=(ACPI_PHYSICAL_ADDRESS)(b)) 169*7c478bd9Sstevel@tonic-gate #define ACPI_VALID_ADDRESS(a) (a) 170*7c478bd9Sstevel@tonic-gate #endif 171*7c478bd9Sstevel@tonic-gate #endif 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate /* 174*7c478bd9Sstevel@tonic-gate * printf() format helpers 175*7c478bd9Sstevel@tonic-gate */ 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ 178*7c478bd9Sstevel@tonic-gate 179*7c478bd9Sstevel@tonic-gate #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate /* 182*7c478bd9Sstevel@tonic-gate * Extract a byte of data using a pointer. Any more than a byte and we 183*7c478bd9Sstevel@tonic-gate * get into potential aligment issues -- see the STORE macros below 184*7c478bd9Sstevel@tonic-gate */ 185*7c478bd9Sstevel@tonic-gate #define ACPI_GET8(addr) (*(UINT8*)(addr)) 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate /* Pointer arithmetic */ 188*7c478bd9Sstevel@tonic-gate 189*7c478bd9Sstevel@tonic-gate #define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (ACPI_NATIVE_UINT)(b)) 190*7c478bd9Sstevel@tonic-gate #define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) ((char *)(a) - (char *)(b)) 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate /* Pointer/Integer type conversions */ 193*7c478bd9Sstevel@tonic-gate 194*7c478bd9Sstevel@tonic-gate #define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(ACPI_NATIVE_UINT)i) 195*7c478bd9Sstevel@tonic-gate #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) 196*7c478bd9Sstevel@tonic-gate #define ACPI_OFFSET(d,f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) 197*7c478bd9Sstevel@tonic-gate #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate #define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) 200*7c478bd9Sstevel@tonic-gate #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) 201*7c478bd9Sstevel@tonic-gate 202*7c478bd9Sstevel@tonic-gate #if ACPI_MACHINE_WIDTH == 16 203*7c478bd9Sstevel@tonic-gate #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) 204*7c478bd9Sstevel@tonic-gate #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) 205*7c478bd9Sstevel@tonic-gate #define ACPI_PTR_TO_PHYSADDR(i) (UINT32) (char *)(i) 206*7c478bd9Sstevel@tonic-gate #else 207*7c478bd9Sstevel@tonic-gate #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) 208*7c478bd9Sstevel@tonic-gate #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 209*7c478bd9Sstevel@tonic-gate #endif 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate /* 212*7c478bd9Sstevel@tonic-gate * Macros for moving data around to/from buffers that are possibly unaligned. 213*7c478bd9Sstevel@tonic-gate * If the hardware supports the transfer of unaligned data, just do the store. 214*7c478bd9Sstevel@tonic-gate * Otherwise, we have to move one byte at a time. 215*7c478bd9Sstevel@tonic-gate */ 216*7c478bd9Sstevel@tonic-gate #ifdef ACPI_BIG_ENDIAN 217*7c478bd9Sstevel@tonic-gate /* 218*7c478bd9Sstevel@tonic-gate * Macros for big-endian machines 219*7c478bd9Sstevel@tonic-gate */ 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate /* This macro sets a buffer index, starting from the end of the buffer */ 222*7c478bd9Sstevel@tonic-gate 223*7c478bd9Sstevel@tonic-gate #define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) ((BufLen) - (((BufOffset)+1) * (ByteGran))) 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gate /* These macros reverse the bytes during the move, converting little-endian to big endian */ 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gate /* Big Endian <== Little Endian */ 228*7c478bd9Sstevel@tonic-gate /* Hi...Lo Lo...Hi */ 229*7c478bd9Sstevel@tonic-gate /* 16-bit source, 16/32/64 destination */ 230*7c478bd9Sstevel@tonic-gate 231*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\ 232*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];} 233*7c478bd9Sstevel@tonic-gate 234*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d))=0;\ 235*7c478bd9Sstevel@tonic-gate ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ 236*7c478bd9Sstevel@tonic-gate ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} 237*7c478bd9Sstevel@tonic-gate 238*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\ 239*7c478bd9Sstevel@tonic-gate ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ 240*7c478bd9Sstevel@tonic-gate ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} 241*7c478bd9Sstevel@tonic-gate 242*7c478bd9Sstevel@tonic-gate /* 32-bit source, 16/32/64 destination */ 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 245*7c478bd9Sstevel@tonic-gate 246*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\ 247*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\ 248*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ 249*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} 250*7c478bd9Sstevel@tonic-gate 251*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\ 252*7c478bd9Sstevel@tonic-gate ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ 253*7c478bd9Sstevel@tonic-gate ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ 254*7c478bd9Sstevel@tonic-gate ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ 255*7c478bd9Sstevel@tonic-gate ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} 256*7c478bd9Sstevel@tonic-gate 257*7c478bd9Sstevel@tonic-gate /* 64-bit source, 16/32/64 destination */ 258*7c478bd9Sstevel@tonic-gate 259*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 262*7c478bd9Sstevel@tonic-gate 263*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ 264*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\ 265*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\ 266*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\ 267*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ 268*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ 269*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ 270*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} 271*7c478bd9Sstevel@tonic-gate #else 272*7c478bd9Sstevel@tonic-gate /* 273*7c478bd9Sstevel@tonic-gate * Macros for little-endian machines 274*7c478bd9Sstevel@tonic-gate */ 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate /* This macro sets a buffer index, starting from the beginning of the buffer */ 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate #define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) (BufOffset) 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate #ifdef ACPI_MISALIGNED_TRANSFERS 281*7c478bd9Sstevel@tonic-gate 282*7c478bd9Sstevel@tonic-gate /* The hardware supports unaligned transfers, just do the little-endian move */ 283*7c478bd9Sstevel@tonic-gate 284*7c478bd9Sstevel@tonic-gate #if ACPI_MACHINE_WIDTH == 16 285*7c478bd9Sstevel@tonic-gate 286*7c478bd9Sstevel@tonic-gate /* No 64-bit integers */ 287*7c478bd9Sstevel@tonic-gate /* 16-bit source, 16/32/64 destination */ 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) 290*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) 291*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s) 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate /* 32-bit source, 16/32/64 destination */ 294*7c478bd9Sstevel@tonic-gate 295*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 296*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) 297*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate /* 64-bit source, 16/32/64 destination */ 300*7c478bd9Sstevel@tonic-gate 301*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 302*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 303*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s) 304*7c478bd9Sstevel@tonic-gate 305*7c478bd9Sstevel@tonic-gate #else 306*7c478bd9Sstevel@tonic-gate /* 16-bit source, 16/32/64 destination */ 307*7c478bd9Sstevel@tonic-gate 308*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) 309*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) 310*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s) 311*7c478bd9Sstevel@tonic-gate 312*7c478bd9Sstevel@tonic-gate /* 32-bit source, 16/32/64 destination */ 313*7c478bd9Sstevel@tonic-gate 314*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 315*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) 316*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s) 317*7c478bd9Sstevel@tonic-gate 318*7c478bd9Sstevel@tonic-gate /* 64-bit source, 16/32/64 destination */ 319*7c478bd9Sstevel@tonic-gate 320*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 321*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 322*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) 323*7c478bd9Sstevel@tonic-gate #endif 324*7c478bd9Sstevel@tonic-gate 325*7c478bd9Sstevel@tonic-gate #else 326*7c478bd9Sstevel@tonic-gate /* 327*7c478bd9Sstevel@tonic-gate * The hardware does not support unaligned transfers. We must move the 328*7c478bd9Sstevel@tonic-gate * data one byte at a time. These macros work whether the source or 329*7c478bd9Sstevel@tonic-gate * the destination (or both) is/are unaligned. (Little-endian move) 330*7c478bd9Sstevel@tonic-gate */ 331*7c478bd9Sstevel@tonic-gate 332*7c478bd9Sstevel@tonic-gate /* 16-bit source, 16/32/64 destination */ 333*7c478bd9Sstevel@tonic-gate 334*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ 335*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} 336*7c478bd9Sstevel@tonic-gate 337*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} 338*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} 339*7c478bd9Sstevel@tonic-gate 340*7c478bd9Sstevel@tonic-gate /* 32-bit source, 16/32/64 destination */ 341*7c478bd9Sstevel@tonic-gate 342*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 343*7c478bd9Sstevel@tonic-gate 344*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ 345*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ 346*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ 347*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];} 348*7c478bd9Sstevel@tonic-gate 349*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);} 350*7c478bd9Sstevel@tonic-gate 351*7c478bd9Sstevel@tonic-gate /* 64-bit source, 16/32/64 destination */ 352*7c478bd9Sstevel@tonic-gate 353*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 354*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 355*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ 356*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ 357*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ 358*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\ 359*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\ 360*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\ 361*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\ 362*7c478bd9Sstevel@tonic-gate (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];} 363*7c478bd9Sstevel@tonic-gate #endif 364*7c478bd9Sstevel@tonic-gate #endif 365*7c478bd9Sstevel@tonic-gate 366*7c478bd9Sstevel@tonic-gate /* Macros based on machine integer width */ 367*7c478bd9Sstevel@tonic-gate 368*7c478bd9Sstevel@tonic-gate #if ACPI_MACHINE_WIDTH == 16 369*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) 370*7c478bd9Sstevel@tonic-gate 371*7c478bd9Sstevel@tonic-gate #elif ACPI_MACHINE_WIDTH == 32 372*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) 373*7c478bd9Sstevel@tonic-gate 374*7c478bd9Sstevel@tonic-gate #elif ACPI_MACHINE_WIDTH == 64 375*7c478bd9Sstevel@tonic-gate #define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s) 376*7c478bd9Sstevel@tonic-gate 377*7c478bd9Sstevel@tonic-gate #else 378*7c478bd9Sstevel@tonic-gate #error unknown ACPI_MACHINE_WIDTH 379*7c478bd9Sstevel@tonic-gate #endif 380*7c478bd9Sstevel@tonic-gate 381*7c478bd9Sstevel@tonic-gate 382*7c478bd9Sstevel@tonic-gate /* 383*7c478bd9Sstevel@tonic-gate * Fast power-of-two math macros for non-optimized compilers 384*7c478bd9Sstevel@tonic-gate */ 385*7c478bd9Sstevel@tonic-gate #define _ACPI_DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2))) 386*7c478bd9Sstevel@tonic-gate #define _ACPI_MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2))) 387*7c478bd9Sstevel@tonic-gate #define _ACPI_MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1))) 388*7c478bd9Sstevel@tonic-gate 389*7c478bd9Sstevel@tonic-gate #define ACPI_DIV_2(a) _ACPI_DIV(a,1) 390*7c478bd9Sstevel@tonic-gate #define ACPI_MUL_2(a) _ACPI_MUL(a,1) 391*7c478bd9Sstevel@tonic-gate #define ACPI_MOD_2(a) _ACPI_MOD(a,2) 392*7c478bd9Sstevel@tonic-gate 393*7c478bd9Sstevel@tonic-gate #define ACPI_DIV_4(a) _ACPI_DIV(a,2) 394*7c478bd9Sstevel@tonic-gate #define ACPI_MUL_4(a) _ACPI_MUL(a,2) 395*7c478bd9Sstevel@tonic-gate #define ACPI_MOD_4(a) _ACPI_MOD(a,4) 396*7c478bd9Sstevel@tonic-gate 397*7c478bd9Sstevel@tonic-gate #define ACPI_DIV_8(a) _ACPI_DIV(a,3) 398*7c478bd9Sstevel@tonic-gate #define ACPI_MUL_8(a) _ACPI_MUL(a,3) 399*7c478bd9Sstevel@tonic-gate #define ACPI_MOD_8(a) _ACPI_MOD(a,8) 400*7c478bd9Sstevel@tonic-gate 401*7c478bd9Sstevel@tonic-gate #define ACPI_DIV_16(a) _ACPI_DIV(a,4) 402*7c478bd9Sstevel@tonic-gate #define ACPI_MUL_16(a) _ACPI_MUL(a,4) 403*7c478bd9Sstevel@tonic-gate #define ACPI_MOD_16(a) _ACPI_MOD(a,16) 404*7c478bd9Sstevel@tonic-gate 405*7c478bd9Sstevel@tonic-gate 406*7c478bd9Sstevel@tonic-gate /* 407*7c478bd9Sstevel@tonic-gate * Rounding macros (Power of two boundaries only) 408*7c478bd9Sstevel@tonic-gate */ 409*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_DOWN(value,boundary) (((ACPI_NATIVE_UINT)(value)) & (~(((ACPI_NATIVE_UINT) boundary)-1))) 410*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_UP(value,boundary) ((((ACPI_NATIVE_UINT)(value)) + (((ACPI_NATIVE_UINT) boundary)-1)) & (~(((ACPI_NATIVE_UINT) boundary)-1))) 411*7c478bd9Sstevel@tonic-gate 412*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) 413*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) 414*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) 415*7c478bd9Sstevel@tonic-gate 416*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_UP_TO_32BITS(a) ACPI_ROUND_UP(a,4) 417*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_UP_TO_64BITS(a) ACPI_ROUND_UP(a,8) 418*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) 419*7c478bd9Sstevel@tonic-gate 420*7c478bd9Sstevel@tonic-gate 421*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) 422*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) 423*7c478bd9Sstevel@tonic-gate 424*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) 425*7c478bd9Sstevel@tonic-gate 426*7c478bd9Sstevel@tonic-gate /* Generic (non-power-of-two) rounding */ 427*7c478bd9Sstevel@tonic-gate 428*7c478bd9Sstevel@tonic-gate #define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) 429*7c478bd9Sstevel@tonic-gate 430*7c478bd9Sstevel@tonic-gate /* 431*7c478bd9Sstevel@tonic-gate * Bitmask creation 432*7c478bd9Sstevel@tonic-gate * Bit positions start at zero. 433*7c478bd9Sstevel@tonic-gate * MASK_BITS_ABOVE creates a mask starting AT the position and above 434*7c478bd9Sstevel@tonic-gate * MASK_BITS_BELOW creates a mask starting one bit BELOW the position 435*7c478bd9Sstevel@tonic-gate */ 436*7c478bd9Sstevel@tonic-gate #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position)))) 437*7c478bd9Sstevel@tonic-gate #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position))) 438*7c478bd9Sstevel@tonic-gate 439*7c478bd9Sstevel@tonic-gate #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) 440*7c478bd9Sstevel@tonic-gate 441*7c478bd9Sstevel@tonic-gate 442*7c478bd9Sstevel@tonic-gate /* Bitfields within ACPI registers */ 443*7c478bd9Sstevel@tonic-gate 444*7c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask) 445*7c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) 446*7c478bd9Sstevel@tonic-gate 447*7c478bd9Sstevel@tonic-gate /* 448*7c478bd9Sstevel@tonic-gate * An ACPI_NAMESPACE_NODE * can appear in some contexts, 449*7c478bd9Sstevel@tonic-gate * where a pointer to an ACPI_OPERAND_OBJECT can also 450*7c478bd9Sstevel@tonic-gate * appear. This macro is used to distinguish them. 451*7c478bd9Sstevel@tonic-gate * 452*7c478bd9Sstevel@tonic-gate * The "Descriptor" field is the first field in both structures. 453*7c478bd9Sstevel@tonic-gate */ 454*7c478bd9Sstevel@tonic-gate #define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId) 455*7c478bd9Sstevel@tonic-gate #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId = t) 456*7c478bd9Sstevel@tonic-gate 457*7c478bd9Sstevel@tonic-gate 458*7c478bd9Sstevel@tonic-gate /* Macro to test the object type */ 459*7c478bd9Sstevel@tonic-gate 460*7c478bd9Sstevel@tonic-gate #define ACPI_GET_OBJECT_TYPE(d) (((ACPI_OPERAND_OBJECT *)(void *)(d))->Common.Type) 461*7c478bd9Sstevel@tonic-gate 462*7c478bd9Sstevel@tonic-gate /* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ 463*7c478bd9Sstevel@tonic-gate 464*7c478bd9Sstevel@tonic-gate #define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) 465*7c478bd9Sstevel@tonic-gate 466*7c478bd9Sstevel@tonic-gate /* 467*7c478bd9Sstevel@tonic-gate * Macros for the master AML opcode table 468*7c478bd9Sstevel@tonic-gate */ 469*7c478bd9Sstevel@tonic-gate #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) 470*7c478bd9Sstevel@tonic-gate #define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {Name,(UINT32)(PArgs),(UINT32)(IArgs),(UINT32)(Flags),ObjType,Class,Type} 471*7c478bd9Sstevel@tonic-gate #else 472*7c478bd9Sstevel@tonic-gate #define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {(UINT32)(PArgs),(UINT32)(IArgs),(UINT32)(Flags),ObjType,Class,Type} 473*7c478bd9Sstevel@tonic-gate #endif 474*7c478bd9Sstevel@tonic-gate 475*7c478bd9Sstevel@tonic-gate #ifdef ACPI_DISASSEMBLER 476*7c478bd9Sstevel@tonic-gate #define ACPI_DISASM_ONLY_MEMBERS(a) a; 477*7c478bd9Sstevel@tonic-gate #else 478*7c478bd9Sstevel@tonic-gate #define ACPI_DISASM_ONLY_MEMBERS(a) 479*7c478bd9Sstevel@tonic-gate #endif 480*7c478bd9Sstevel@tonic-gate 481*7c478bd9Sstevel@tonic-gate #define ARG_TYPE_WIDTH 5 482*7c478bd9Sstevel@tonic-gate #define ARG_1(x) ((UINT32)(x)) 483*7c478bd9Sstevel@tonic-gate #define ARG_2(x) ((UINT32)(x) << (1 * ARG_TYPE_WIDTH)) 484*7c478bd9Sstevel@tonic-gate #define ARG_3(x) ((UINT32)(x) << (2 * ARG_TYPE_WIDTH)) 485*7c478bd9Sstevel@tonic-gate #define ARG_4(x) ((UINT32)(x) << (3 * ARG_TYPE_WIDTH)) 486*7c478bd9Sstevel@tonic-gate #define ARG_5(x) ((UINT32)(x) << (4 * ARG_TYPE_WIDTH)) 487*7c478bd9Sstevel@tonic-gate #define ARG_6(x) ((UINT32)(x) << (5 * ARG_TYPE_WIDTH)) 488*7c478bd9Sstevel@tonic-gate 489*7c478bd9Sstevel@tonic-gate #define ARGI_LIST1(a) (ARG_1(a)) 490*7c478bd9Sstevel@tonic-gate #define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) 491*7c478bd9Sstevel@tonic-gate #define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) 492*7c478bd9Sstevel@tonic-gate #define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) 493*7c478bd9Sstevel@tonic-gate #define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) 494*7c478bd9Sstevel@tonic-gate #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)) 495*7c478bd9Sstevel@tonic-gate 496*7c478bd9Sstevel@tonic-gate #define ARGP_LIST1(a) (ARG_1(a)) 497*7c478bd9Sstevel@tonic-gate #define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) 498*7c478bd9Sstevel@tonic-gate #define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) 499*7c478bd9Sstevel@tonic-gate #define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) 500*7c478bd9Sstevel@tonic-gate #define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) 501*7c478bd9Sstevel@tonic-gate #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)) 502*7c478bd9Sstevel@tonic-gate 503*7c478bd9Sstevel@tonic-gate #define GET_CURRENT_ARG_TYPE(List) (List & ((UINT32) 0x1F)) 504*7c478bd9Sstevel@tonic-gate #define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH)) 505*7c478bd9Sstevel@tonic-gate 506*7c478bd9Sstevel@tonic-gate 507*7c478bd9Sstevel@tonic-gate /* 508*7c478bd9Sstevel@tonic-gate * Reporting macros that are never compiled out 509*7c478bd9Sstevel@tonic-gate */ 510*7c478bd9Sstevel@tonic-gate #define ACPI_PARAM_LIST(pl) pl 511*7c478bd9Sstevel@tonic-gate 512*7c478bd9Sstevel@tonic-gate /* 513*7c478bd9Sstevel@tonic-gate * Error reporting. These versions add callers module and line#. Since 514*7c478bd9Sstevel@tonic-gate * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only 515*7c478bd9Sstevel@tonic-gate * use it in debug mode. 516*7c478bd9Sstevel@tonic-gate */ 517*7c478bd9Sstevel@tonic-gate #ifdef ACPI_DEBUG_OUTPUT 518*7c478bd9Sstevel@tonic-gate 519*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \ 520*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 521*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_ERROR(fp) {AcpiUtReportError(_THIS_MODULE,__LINE__,_COMPONENT); \ 522*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 523*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \ 524*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 525*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError(_THIS_MODULE,__LINE__,_COMPONENT, s, e); 526*7c478bd9Sstevel@tonic-gate 527*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e); 528*7c478bd9Sstevel@tonic-gate 529*7c478bd9Sstevel@tonic-gate #else 530*7c478bd9Sstevel@tonic-gate 531*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo("ACPI",__LINE__,_COMPONENT); \ 532*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 533*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_ERROR(fp) {AcpiUtReportError("ACPI",__LINE__,_COMPONENT); \ 534*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 535*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning("ACPI",__LINE__,_COMPONENT); \ 536*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 537*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError("ACPI",__LINE__,_COMPONENT, s, e); 538*7c478bd9Sstevel@tonic-gate 539*7c478bd9Sstevel@tonic-gate #define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError("ACPI",__LINE__,_COMPONENT, s, n, p, e); 540*7c478bd9Sstevel@tonic-gate 541*7c478bd9Sstevel@tonic-gate #endif 542*7c478bd9Sstevel@tonic-gate 543*7c478bd9Sstevel@tonic-gate /* Error reporting. These versions pass thru the module and line# */ 544*7c478bd9Sstevel@tonic-gate 545*7c478bd9Sstevel@tonic-gate #define _ACPI_REPORT_INFO(a,b,c,fp) {AcpiUtReportInfo(a,b,c); \ 546*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 547*7c478bd9Sstevel@tonic-gate #define _ACPI_REPORT_ERROR(a,b,c,fp) {AcpiUtReportError(a,b,c); \ 548*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 549*7c478bd9Sstevel@tonic-gate #define _ACPI_REPORT_WARNING(a,b,c,fp) {AcpiUtReportWarning(a,b,c); \ 550*7c478bd9Sstevel@tonic-gate AcpiOsPrintf ACPI_PARAM_LIST(fp);} 551*7c478bd9Sstevel@tonic-gate 552*7c478bd9Sstevel@tonic-gate /* 553*7c478bd9Sstevel@tonic-gate * Debug macros that are conditionally compiled 554*7c478bd9Sstevel@tonic-gate */ 555*7c478bd9Sstevel@tonic-gate #ifdef ACPI_DEBUG_OUTPUT 556*7c478bd9Sstevel@tonic-gate 557*7c478bd9Sstevel@tonic-gate #define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; 558*7c478bd9Sstevel@tonic-gate 559*7c478bd9Sstevel@tonic-gate /* 560*7c478bd9Sstevel@tonic-gate * Function entry tracing. 561*7c478bd9Sstevel@tonic-gate * The first parameter should be the procedure name as a quoted string. This is declared 562*7c478bd9Sstevel@tonic-gate * as a local string ("_ProcName) so that it can be also used by the function exit macros below. 563*7c478bd9Sstevel@tonic-gate */ 564*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _DebugInfo; \ 565*7c478bd9Sstevel@tonic-gate _DebugInfo.ComponentId = _COMPONENT; \ 566*7c478bd9Sstevel@tonic-gate _DebugInfo.ProcName = a; \ 567*7c478bd9Sstevel@tonic-gate _DebugInfo.ModuleName = _THIS_MODULE; 568*7c478bd9Sstevel@tonic-gate 569*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 570*7c478bd9Sstevel@tonic-gate AcpiUtTrace(__LINE__,&_DebugInfo) 571*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ 572*7c478bd9Sstevel@tonic-gate AcpiUtTracePtr(__LINE__,&_DebugInfo,(void *)b) 573*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ 574*7c478bd9Sstevel@tonic-gate AcpiUtTraceU32(__LINE__,&_DebugInfo,(UINT32)b) 575*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ 576*7c478bd9Sstevel@tonic-gate AcpiUtTraceStr(__LINE__,&_DebugInfo,(char *)b) 577*7c478bd9Sstevel@tonic-gate 578*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr() 579*7c478bd9Sstevel@tonic-gate 580*7c478bd9Sstevel@tonic-gate /* 581*7c478bd9Sstevel@tonic-gate * Function exit tracing. 582*7c478bd9Sstevel@tonic-gate * WARNING: These macros include a return statement. This is usually considered 583*7c478bd9Sstevel@tonic-gate * bad form, but having a separate exit macro is very ugly and difficult to maintain. 584*7c478bd9Sstevel@tonic-gate * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 585*7c478bd9Sstevel@tonic-gate * so that "_ProcName" is defined. 586*7c478bd9Sstevel@tonic-gate */ 587*7c478bd9Sstevel@tonic-gate #ifdef ACPI_USE_DO_WHILE_0 588*7c478bd9Sstevel@tonic-gate #define ACPI_DO_WHILE0(a) do a while(0) 589*7c478bd9Sstevel@tonic-gate #else 590*7c478bd9Sstevel@tonic-gate #define ACPI_DO_WHILE0(a) a 591*7c478bd9Sstevel@tonic-gate #endif 592*7c478bd9Sstevel@tonic-gate 593*7c478bd9Sstevel@tonic-gate #define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(__LINE__,&_DebugInfo);return;}) 594*7c478bd9Sstevel@tonic-gate #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(__LINE__,&_DebugInfo,(s));return((s));}) 595*7c478bd9Sstevel@tonic-gate #define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(__LINE__,&_DebugInfo,(ACPI_INTEGER)(s));return((s));}) 596*7c478bd9Sstevel@tonic-gate #define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(__LINE__,&_DebugInfo,(UINT8 *)(s));return((s));}) 597*7c478bd9Sstevel@tonic-gate 598*7c478bd9Sstevel@tonic-gate /* Conditional execution */ 599*7c478bd9Sstevel@tonic-gate 600*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_EXEC(a) a 601*7c478bd9Sstevel@tonic-gate #define ACPI_NORMAL_EXEC(a) 602*7c478bd9Sstevel@tonic-gate 603*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_DEFINE(a) a; 604*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_ONLY_MEMBERS(a) a; 605*7c478bd9Sstevel@tonic-gate #define _VERBOSE_STRUCTURES 606*7c478bd9Sstevel@tonic-gate 607*7c478bd9Sstevel@tonic-gate 608*7c478bd9Sstevel@tonic-gate /* Stack and buffer dumping */ 609*7c478bd9Sstevel@tonic-gate 610*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a),0) 611*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__) 612*7c478bd9Sstevel@tonic-gate 613*7c478bd9Sstevel@tonic-gate 614*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b) 615*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d) 616*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a) 617*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) 618*7c478bd9Sstevel@tonic-gate #define ACPI_BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a)) 619*7c478bd9Sstevel@tonic-gate 620*7c478bd9Sstevel@tonic-gate 621*7c478bd9Sstevel@tonic-gate /* 622*7c478bd9Sstevel@tonic-gate * Generate INT3 on ACPI_ERROR (Debug only!) 623*7c478bd9Sstevel@tonic-gate */ 624*7c478bd9Sstevel@tonic-gate #define ACPI_ERROR_BREAK 625*7c478bd9Sstevel@tonic-gate #ifdef ACPI_ERROR_BREAK 626*7c478bd9Sstevel@tonic-gate #define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \ 627*7c478bd9Sstevel@tonic-gate AcpiOsSignal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n") 628*7c478bd9Sstevel@tonic-gate #else 629*7c478bd9Sstevel@tonic-gate #define ACPI_BREAK_ON_ERROR(lvl) 630*7c478bd9Sstevel@tonic-gate #endif 631*7c478bd9Sstevel@tonic-gate 632*7c478bd9Sstevel@tonic-gate /* 633*7c478bd9Sstevel@tonic-gate * Master debug print macros 634*7c478bd9Sstevel@tonic-gate * Print iff: 635*7c478bd9Sstevel@tonic-gate * 1) Debug print for the current component is enabled 636*7c478bd9Sstevel@tonic-gate * 2) Debug error level or trace level for the print statement is enabled 637*7c478bd9Sstevel@tonic-gate */ 638*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_PRINT(pl) AcpiUtDebugPrint ACPI_PARAM_LIST(pl) 639*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw ACPI_PARAM_LIST(pl) 640*7c478bd9Sstevel@tonic-gate 641*7c478bd9Sstevel@tonic-gate 642*7c478bd9Sstevel@tonic-gate #else 643*7c478bd9Sstevel@tonic-gate /* 644*7c478bd9Sstevel@tonic-gate * This is the non-debug case -- make everything go away, 645*7c478bd9Sstevel@tonic-gate * leaving no executable debug code! 646*7c478bd9Sstevel@tonic-gate */ 647*7c478bd9Sstevel@tonic-gate #define ACPI_MODULE_NAME(name) 648*7c478bd9Sstevel@tonic-gate #define _THIS_MODULE "" 649*7c478bd9Sstevel@tonic-gate 650*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_EXEC(a) 651*7c478bd9Sstevel@tonic-gate #define ACPI_NORMAL_EXEC(a) a; 652*7c478bd9Sstevel@tonic-gate 653*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_DEFINE(a) 654*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_ONLY_MEMBERS(a) 655*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_NAME(a) 656*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_TRACE(a) 657*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_TRACE_PTR(a,b) 658*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_TRACE_U32(a,b) 659*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_TRACE_STR(a,b) 660*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_EXIT 661*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_STATUS_EXIT(s) 662*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_VALUE_EXIT(s) 663*7c478bd9Sstevel@tonic-gate #define ACPI_FUNCTION_ENTRY() 664*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_STACK_ENTRY(a) 665*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_OPERANDS(a,b,c,d,e) 666*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_ENTRY(a,b) 667*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_TABLES(a,b) 668*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_PATHNAME(a,b,c,d) 669*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_RESOURCE_LIST(a) 670*7c478bd9Sstevel@tonic-gate #define ACPI_DUMP_BUFFER(a,b) 671*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_PRINT(pl) 672*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_PRINT_RAW(pl) 673*7c478bd9Sstevel@tonic-gate #define ACPI_BREAK_MSG(a) 674*7c478bd9Sstevel@tonic-gate 675*7c478bd9Sstevel@tonic-gate #define return_VOID return 676*7c478bd9Sstevel@tonic-gate #define return_ACPI_STATUS(s) return(s) 677*7c478bd9Sstevel@tonic-gate #define return_VALUE(s) return(s) 678*7c478bd9Sstevel@tonic-gate #define return_PTR(s) return(s) 679*7c478bd9Sstevel@tonic-gate 680*7c478bd9Sstevel@tonic-gate #endif 681*7c478bd9Sstevel@tonic-gate 682*7c478bd9Sstevel@tonic-gate /* 683*7c478bd9Sstevel@tonic-gate * Some code only gets executed when the debugger is built in. 684*7c478bd9Sstevel@tonic-gate * Note that this is entirely independent of whether the 685*7c478bd9Sstevel@tonic-gate * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. 686*7c478bd9Sstevel@tonic-gate */ 687*7c478bd9Sstevel@tonic-gate #ifdef ACPI_DEBUGGER 688*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUGGER_EXEC(a) a 689*7c478bd9Sstevel@tonic-gate #else 690*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUGGER_EXEC(a) 691*7c478bd9Sstevel@tonic-gate #endif 692*7c478bd9Sstevel@tonic-gate 693*7c478bd9Sstevel@tonic-gate 694*7c478bd9Sstevel@tonic-gate /* 695*7c478bd9Sstevel@tonic-gate * For 16-bit code, we want to shrink some things even though 696*7c478bd9Sstevel@tonic-gate * we are using ACPI_DEBUG_OUTPUT to get the debug output 697*7c478bd9Sstevel@tonic-gate */ 698*7c478bd9Sstevel@tonic-gate #if ACPI_MACHINE_WIDTH == 16 699*7c478bd9Sstevel@tonic-gate #undef ACPI_DEBUG_ONLY_MEMBERS 700*7c478bd9Sstevel@tonic-gate #undef _VERBOSE_STRUCTURES 701*7c478bd9Sstevel@tonic-gate #define ACPI_DEBUG_ONLY_MEMBERS(a) 702*7c478bd9Sstevel@tonic-gate #endif 703*7c478bd9Sstevel@tonic-gate 704*7c478bd9Sstevel@tonic-gate 705*7c478bd9Sstevel@tonic-gate #ifdef ACPI_DEBUG_OUTPUT 706*7c478bd9Sstevel@tonic-gate /* 707*7c478bd9Sstevel@tonic-gate * 1) Set name to blanks 708*7c478bd9Sstevel@tonic-gate * 2) Copy the object name 709*7c478bd9Sstevel@tonic-gate */ 710*7c478bd9Sstevel@tonic-gate #define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\ 711*7c478bd9Sstevel@tonic-gate ACPI_STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name)) 712*7c478bd9Sstevel@tonic-gate #else 713*7c478bd9Sstevel@tonic-gate 714*7c478bd9Sstevel@tonic-gate #define ACPI_ADD_OBJECT_NAME(a,b) 715*7c478bd9Sstevel@tonic-gate #endif 716*7c478bd9Sstevel@tonic-gate 717*7c478bd9Sstevel@tonic-gate 718*7c478bd9Sstevel@tonic-gate /* 719*7c478bd9Sstevel@tonic-gate * Memory allocation tracking (DEBUG ONLY) 720*7c478bd9Sstevel@tonic-gate */ 721*7c478bd9Sstevel@tonic-gate #ifndef ACPI_DBG_TRACK_ALLOCATIONS 722*7c478bd9Sstevel@tonic-gate 723*7c478bd9Sstevel@tonic-gate /* Memory allocation */ 724*7c478bd9Sstevel@tonic-gate 725*7c478bd9Sstevel@tonic-gate #define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__) 726*7c478bd9Sstevel@tonic-gate #define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__) 727*7c478bd9Sstevel@tonic-gate #define ACPI_MEM_FREE(a) AcpiOsFree(a) 728*7c478bd9Sstevel@tonic-gate #define ACPI_MEM_TRACKING(a) 729*7c478bd9Sstevel@tonic-gate 730*7c478bd9Sstevel@tonic-gate 731*7c478bd9Sstevel@tonic-gate #else 732*7c478bd9Sstevel@tonic-gate 733*7c478bd9Sstevel@tonic-gate /* Memory allocation */ 734*7c478bd9Sstevel@tonic-gate 735*7c478bd9Sstevel@tonic-gate #define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__) 736*7c478bd9Sstevel@tonic-gate #define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__) 737*7c478bd9Sstevel@tonic-gate #define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__) 738*7c478bd9Sstevel@tonic-gate #define ACPI_MEM_TRACKING(a) a 739*7c478bd9Sstevel@tonic-gate 740*7c478bd9Sstevel@tonic-gate #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 741*7c478bd9Sstevel@tonic-gate 742*7c478bd9Sstevel@tonic-gate #endif /* ACMACROS_H */ 743