Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/drivers/acpi/actypes.h need to be fixed.

0001 /******************************************************************************
0002  *
0003  * Name: actypes.h - Common data types for the entire ACPI subsystem
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights.  You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code.  No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision.  In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change.  Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee.  Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution.  In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government.  In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************/
0115 
0116 #ifndef __ACTYPES_H__
0117 #define __ACTYPES_H__
0118 
0119 /* acpisrc:StructDefs -- for acpisrc conversion */
0120 
0121 /*
0122  * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
0123  * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of
0124  * 12/2006.
0125  */
0126 #ifndef ACPI_MACHINE_WIDTH
0127 #error ACPI_MACHINE_WIDTH not defined
0128 #endif
0129 
0130 /*! [Begin] no source code translation */
0131 
0132 /*
0133  * Data type ranges
0134  * Note: These macros are designed to be compiler independent as well as
0135  * working around problems that some 32-bit compilers have with 64-bit
0136  * constants.
0137  */
0138 #define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0)) /* 0xFF               */
0139 #define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0)) /* 0xFFFF             */
0140 #define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF         */
0141 #define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
0142 #define ACPI_ASCII_MAX                  0x7F
0143 
0144 
0145 /*
0146  * Architecture-specific ACPICA Subsystem Data Types
0147  *
0148  * The goal of these types is to provide source code portability across
0149  * 16-bit, 32-bit, and 64-bit targets.
0150  *
0151  * 1) The following types are of fixed size for all targets (16/32/64):
0152  *
0153  * BOOLEAN      Logical boolean
0154  *
0155  * UINT8        8-bit  (1 byte) unsigned value
0156  * UINT16       16-bit (2 byte) unsigned value
0157  * UINT32       32-bit (4 byte) unsigned value
0158  * UINT64       64-bit (8 byte) unsigned value
0159  *
0160  * INT16        16-bit (2 byte) signed value
0161  * INT32        32-bit (4 byte) signed value
0162  * INT64        64-bit (8 byte) signed value
0163  *
0164  * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
0165  * compiler-dependent header(s) and were introduced because there is no common
0166  * 64-bit integer type across the various compilation models, as shown in
0167  * the table below.
0168  *
0169  * Datatype  LP64 ILP64 LLP64 ILP32 LP32 16bit
0170  * char      8    8     8     8     8    8
0171  * short     16   16    16    16    16   16
0172  * _int32         32
0173  * int       32   64    32    32    16   16
0174  * long      64   64    32    32    32   32
0175  * long long            64    64
0176  * pointer   64   64    64    32    32   32
0177  *
0178  * Note: ILP64 and LP32 are currently not supported.
0179  *
0180  *
0181  * 2) These types represent the native word size of the target mode of the
0182  * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are
0183  * usually used for memory allocation, efficient loop counters, and array
0184  * indexes. The types are similar to the size_t type in the C library and are
0185  * required because there is no C type that consistently represents the native
0186  * data width. ACPI_SIZE is needed because there is no guarantee that a
0187  * kernel-level C library is present.
0188  *
0189  * ACPI_SIZE        16/32/64-bit unsigned value
0190  * ACPI_NATIVE_INT  16/32/64-bit signed value
0191  *
0192  */
0193 
0194 /*******************************************************************************
0195  *
0196  * Common types for all compilers, all targets
0197  *
0198  ******************************************************************************/
0199 
0200 typedef unsigned char                   BOOLEAN;
0201 typedef unsigned char                   UINT8;
0202 typedef unsigned short                  UINT16;
0203 typedef COMPILER_DEPENDENT_UINT64       UINT64;
0204 typedef COMPILER_DEPENDENT_INT64        INT64;
0205 
0206 /*! [End] no source code translation !*/
0207 
0208 
0209 /*******************************************************************************
0210  *
0211  * Types specific to 64-bit targets
0212  *
0213  ******************************************************************************/
0214 
0215 #if ACPI_MACHINE_WIDTH == 64
0216 
0217 /*! [Begin] no source code translation (keep the typedefs as-is) */
0218 
0219 typedef unsigned int                    UINT32;
0220 typedef int                             INT32;
0221 
0222 /*! [End] no source code translation !*/
0223 
0224 
0225 typedef INT64                           ACPI_NATIVE_INT;
0226 typedef UINT64                          ACPI_SIZE;
0227 typedef UINT64                          ACPI_IO_ADDRESS;
0228 typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
0229 
0230 #define ACPI_MAX_PTR                    ACPI_UINT64_MAX
0231 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
0232 #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
0233 
0234 /*
0235  * In the case of the Itanium Processor Family (IPF), the hardware does not
0236  * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
0237  * to indicate that special precautions must be taken to avoid alignment faults.
0238  * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
0239  *
0240  * Note: EM64T and other X86-64 processors support misaligned transfers,
0241  * so there is no need to define this flag.
0242  */
0243 #if defined (__IA64__) || defined (__ia64__)
0244 #define ACPI_MISALIGNMENT_NOT_SUPPORTED
0245 #endif
0246 
0247 
0248 /*******************************************************************************
0249  *
0250  * Types specific to 32-bit targets
0251  *
0252  ******************************************************************************/
0253 
0254 #elif ACPI_MACHINE_WIDTH == 32
0255 
0256 /*! [Begin] no source code translation (keep the typedefs as-is) */
0257 
0258 typedef unsigned int                    UINT32;
0259 typedef int                             INT32;
0260 
0261 /*! [End] no source code translation !*/
0262 
0263 
0264 typedef INT32                           ACPI_NATIVE_INT;
0265 typedef UINT32                          ACPI_SIZE;
0266 typedef UINT32                          ACPI_IO_ADDRESS;
0267 typedef UINT32                          ACPI_PHYSICAL_ADDRESS;
0268 
0269 #define ACPI_MAX_PTR                    ACPI_UINT32_MAX
0270 #define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
0271 
0272 #else
0273 
0274 /* ACPI_MACHINE_WIDTH must be either 64 or 32 */
0275 
0276 #error unknown ACPI_MACHINE_WIDTH
0277 #endif
0278 
0279 
0280 /*******************************************************************************
0281  *
0282  * OS-dependent types
0283  *
0284  * If the defaults below are not appropriate for the host system, they can
0285  * be defined in the OS-specific header, and this will take precedence.
0286  *
0287  ******************************************************************************/
0288 
0289 /* Value returned by AcpiOsGetThreadId */
0290 
0291 #ifndef ACPI_THREAD_ID
0292 #define ACPI_THREAD_ID                  ACPI_SIZE
0293 #endif
0294 
0295 /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
0296 
0297 #ifndef ACPI_CPU_FLAGS
0298 #define ACPI_CPU_FLAGS                  ACPI_SIZE
0299 #endif
0300 
0301 /* Object returned from AcpiOsCreateCache */
0302 
0303 #ifndef ACPI_CACHE_T
0304 #ifdef ACPI_USE_LOCAL_CACHE
0305 #define ACPI_CACHE_T                    ACPI_MEMORY_LIST
0306 #else
0307 #define ACPI_CACHE_T                    void *
0308 #endif
0309 #endif
0310 
0311 /*
0312  * Synchronization objects - Mutexes, Semaphores, and SpinLocks
0313  */
0314 #if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE)
0315 /*
0316  * These macros are used if the host OS does not support a mutex object.
0317  * Map the OSL Mutex interfaces to binary semaphores.
0318  */
0319 #define ACPI_MUTEX                      ACPI_SEMAPHORE
0320 #define AcpiOsCreateMutex(OutHandle)    AcpiOsCreateSemaphore (1, 1, OutHandle)
0321 #define AcpiOsDeleteMutex(Handle)       (void) AcpiOsDeleteSemaphore (Handle)
0322 #define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
0323 #define AcpiOsReleaseMutex(Handle)      (void) AcpiOsSignalSemaphore (Handle, 1)
0324 #endif
0325 
0326 /* Configurable types for synchronization objects */
0327 
0328 #ifndef ACPI_SPINLOCK
0329 #define ACPI_SPINLOCK                   void *
0330 #endif
0331 
0332 #ifndef ACPI_SEMAPHORE
0333 #define ACPI_SEMAPHORE                  void *
0334 #endif
0335 
0336 #ifndef ACPI_MUTEX
0337 #define ACPI_MUTEX                      void *
0338 #endif
0339 
0340 
0341 /*******************************************************************************
0342  *
0343  * Compiler-dependent types
0344  *
0345  * If the defaults below are not appropriate for the host compiler, they can
0346  * be defined in the compiler-specific header, and this will take precedence.
0347  *
0348  ******************************************************************************/
0349 
0350 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
0351 
0352 #ifndef ACPI_UINTPTR_T
0353 #define ACPI_UINTPTR_T                  void *
0354 #endif
0355 
0356 /*
0357  * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
0358  * some compilers can catch printf format string problems
0359  */
0360 #ifndef ACPI_PRINTF_LIKE
0361 #define ACPI_PRINTF_LIKE(c)
0362 #endif
0363 
0364 /*
0365  * Some compilers complain about unused variables. Sometimes we don't want to
0366  * use all the variables (for example, _AcpiModuleName). This allows us
0367  * to to tell the compiler in a per-variable manner that a variable
0368  * is unused
0369  */
0370 #ifndef ACPI_UNUSED_VAR
0371 #define ACPI_UNUSED_VAR
0372 #endif
0373 
0374 /*
0375  * All ACPICA functions that are available to the rest of the kernel are
0376  * tagged with this macro which can be defined as appropriate for the host.
0377  */
0378 #ifndef ACPI_EXPORT_SYMBOL
0379 #define ACPI_EXPORT_SYMBOL(Symbol)
0380 #endif
0381 
0382 
0383 /******************************************************************************
0384  *
0385  * ACPI Specification constants (Do not change unless the specification changes)
0386  *
0387  *****************************************************************************/
0388 
0389 /* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
0390 
0391 #define ACPI_MAX_GPE_BLOCKS             2
0392 
0393 /* Default ACPI register widths */
0394 
0395 #define ACPI_GPE_REGISTER_WIDTH         8
0396 #define ACPI_PM1_REGISTER_WIDTH         16
0397 #define ACPI_PM2_REGISTER_WIDTH         8
0398 #define ACPI_PM_TIMER_WIDTH             32
0399 
0400 /* Names within the namespace are 4 bytes long */
0401 
0402 #define ACPI_NAME_SIZE                  4
0403 #define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
0404 #define ACPI_PATH_SEPARATOR             '.'
0405 
0406 /* Sizes for ACPI table headers */
0407 
0408 #define ACPI_OEM_ID_SIZE                6
0409 #define ACPI_OEM_TABLE_ID_SIZE          8
0410 
0411 /* ACPI/PNP hardware IDs */
0412 
0413 #define PCI_ROOT_HID_STRING             "PNP0A03"
0414 #define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
0415 
0416 /* PM Timer ticks per second (HZ) */
0417 
0418 #define PM_TIMER_FREQUENCY              3579545
0419 
0420 
0421 /*******************************************************************************
0422  *
0423  * Independent types
0424  *
0425  ******************************************************************************/
0426 
0427 /* Logical defines and NULL */
0428 
0429 #ifdef FALSE
0430 #undef FALSE
0431 #endif
0432 #define FALSE                           (1 == 0)
0433 
0434 #ifdef TRUE
0435 #undef TRUE
0436 #endif
0437 #define TRUE                            (1 == 1)
0438 
0439 #ifndef NULL
0440 #define NULL                            (void *) 0
0441 #endif
0442 
0443 
0444 /*
0445  * Miscellaneous types
0446  */
0447 typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
0448 typedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
0449 typedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
0450 typedef void *                          ACPI_HANDLE;    /* Actually a ptr to a NS Node */
0451 
0452 
0453 /* Owner IDs are used to track namespace nodes for selective deletion */
0454 
0455 typedef UINT8                           ACPI_OWNER_ID;
0456 #define ACPI_OWNER_ID_MAX               0xFF
0457 
0458 
0459 typedef struct uint64_struct
0460 {
0461     UINT32                          Lo;
0462     UINT32                          Hi;
0463 
0464 } UINT64_STRUCT;
0465 
0466 typedef union uint64_overlay
0467 {
0468     UINT64                          Full;
0469     UINT64_STRUCT                   Part;
0470 
0471 } UINT64_OVERLAY;
0472 
0473 typedef struct uint32_struct
0474 {
0475     UINT32                          Lo;
0476     UINT32                          Hi;
0477 
0478 } UINT32_STRUCT;
0479 
0480 
0481 /*
0482  * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
0483  * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
0484  * type only, not other integers used in the implementation of the ACPI CA
0485  * subsystem.
0486  */
0487 typedef UINT64                          ACPI_INTEGER;
0488 #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
0489 #define ACPI_INTEGER_BIT_SIZE           64
0490 #define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
0491 #define ACPI_MAX64_DECIMAL_DIGITS       20
0492 #define ACPI_MAX32_DECIMAL_DIGITS       10
0493 #define ACPI_MAX16_DECIMAL_DIGITS        5
0494 #define ACPI_MAX8_DECIMAL_DIGITS         3
0495 
0496 /*
0497  * Constants with special meanings
0498  */
0499 #define ACPI_ROOT_OBJECT                ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
0500 #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
0501 #define ACPI_DO_NOT_WAIT                0
0502 
0503 
0504 /*******************************************************************************
0505  *
0506  * Commonly used macros
0507  *
0508  ******************************************************************************/
0509 
0510 /* Data manipulation */
0511 
0512 #define ACPI_LOBYTE(Integer)            ((UINT8)   (UINT16)(Integer))
0513 #define ACPI_HIBYTE(Integer)            ((UINT8) (((UINT16)(Integer)) >> 8))
0514 #define ACPI_LOWORD(Integer)            ((UINT16)  (UINT32)(Integer))
0515 #define ACPI_HIWORD(Integer)            ((UINT16)(((UINT32)(Integer)) >> 16))
0516 #define ACPI_LODWORD(Integer64)         ((UINT32)  (UINT64)(Integer64))
0517 #define ACPI_HIDWORD(Integer64)         ((UINT32)(((UINT64)(Integer64)) >> 32))
0518 
0519 #define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
0520 #define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
0521 #define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
0522 #define ACPI_MAX(a,b)                   (((a)>(b))?(a):(b))
0523 
0524 /* Size calculation */
0525 
0526 #define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
0527 
0528 /* Pointer manipulation */
0529 
0530 #define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
0531 #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
0532 #define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
0533 #define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
0534 
0535 /* Pointer/Integer type conversions */
0536 
0537 #define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i)
0538 #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
0539 #define ACPI_OFFSET(d, f)               (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
0540 #define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
0541 #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
0542 
0543 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
0544 #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
0545 #else
0546 #define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
0547 #endif
0548 
0549 
0550 /*******************************************************************************
0551  *
0552  * Miscellaneous constants
0553  *
0554  ******************************************************************************/
0555 
0556 /*
0557  * Initialization sequence
0558  */
0559 #define ACPI_FULL_INITIALIZATION        0x00
0560 #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
0561 #define ACPI_NO_HARDWARE_INIT           0x02
0562 #define ACPI_NO_EVENT_INIT              0x04
0563 #define ACPI_NO_HANDLER_INIT            0x08
0564 #define ACPI_NO_ACPI_ENABLE             0x10
0565 #define ACPI_NO_DEVICE_INIT             0x20
0566 #define ACPI_NO_OBJECT_INIT             0x40
0567 
0568 /*
0569  * Initialization state
0570  */
0571 #define ACPI_SUBSYSTEM_INITIALIZE       0x01
0572 #define ACPI_INITIALIZED_OK             0x02
0573 
0574 /*
0575  * Power state values
0576  */
0577 #define ACPI_STATE_UNKNOWN              (UINT8) 0xFF
0578 
0579 #define ACPI_STATE_S0                   (UINT8) 0
0580 #define ACPI_STATE_S1                   (UINT8) 1
0581 #define ACPI_STATE_S2                   (UINT8) 2
0582 #define ACPI_STATE_S3                   (UINT8) 3
0583 #define ACPI_STATE_S4                   (UINT8) 4
0584 #define ACPI_STATE_S5                   (UINT8) 5
0585 #define ACPI_S_STATES_MAX               ACPI_STATE_S5
0586 #define ACPI_S_STATE_COUNT              6
0587 
0588 #define ACPI_STATE_D0                   (UINT8) 0
0589 #define ACPI_STATE_D1                   (UINT8) 1
0590 #define ACPI_STATE_D2                   (UINT8) 2
0591 #define ACPI_STATE_D3                   (UINT8) 3
0592 #define ACPI_D_STATES_MAX               ACPI_STATE_D3
0593 #define ACPI_D_STATE_COUNT              4
0594 
0595 #define ACPI_STATE_C0                   (UINT8) 0
0596 #define ACPI_STATE_C1                   (UINT8) 1
0597 #define ACPI_STATE_C2                   (UINT8) 2
0598 #define ACPI_STATE_C3                   (UINT8) 3
0599 #define ACPI_C_STATES_MAX               ACPI_STATE_C3
0600 #define ACPI_C_STATE_COUNT              4
0601 
0602 /*
0603  * Sleep type invalid value
0604  */
0605 #define ACPI_SLEEP_TYPE_MAX             0x7
0606 #define ACPI_SLEEP_TYPE_INVALID         0xFF
0607 
0608 /*
0609  * Standard notify values
0610  */
0611 #define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0x00
0612 #define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 0x01
0613 #define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 0x02
0614 #define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 0x03
0615 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 0x04
0616 #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 0x05
0617 #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 0x06
0618 #define ACPI_NOTIFY_POWER_FAULT         (UINT8) 0x07
0619 #define ACPI_NOTIFY_CAPABILITIES_CHECK  (UINT8) 0x08
0620 #define ACPI_NOTIFY_DEVICE_PLD_CHECK    (UINT8) 0x09
0621 #define ACPI_NOTIFY_RESERVED            (UINT8) 0x0A
0622 #define ACPI_NOTIFY_LOCALITY_UPDATE     (UINT8) 0x0B
0623 
0624 #define ACPI_NOTIFY_MAX                 0x0B
0625 
0626 /*
0627  * Types associated with ACPI names and objects. The first group of
0628  * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
0629  * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
0630  * only add to the first group if the spec changes.
0631  *
0632  * NOTE: Types must be kept in sync with the global AcpiNsProperties
0633  * and AcpiNsTypeNames arrays.
0634  */
0635 typedef UINT32                          ACPI_OBJECT_TYPE;
0636 
0637 #define ACPI_TYPE_ANY                   0x00
0638 #define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
0639 #define ACPI_TYPE_STRING                0x02
0640 #define ACPI_TYPE_BUFFER                0x03
0641 #define ACPI_TYPE_PACKAGE               0x04  /* ByteConst, multiple DataTerm/Constant/SuperName */
0642 #define ACPI_TYPE_FIELD_UNIT            0x05
0643 #define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
0644 #define ACPI_TYPE_EVENT                 0x07
0645 #define ACPI_TYPE_METHOD                0x08  /* Name, ByteConst, multiple Code */
0646 #define ACPI_TYPE_MUTEX                 0x09
0647 #define ACPI_TYPE_REGION                0x0A
0648 #define ACPI_TYPE_POWER                 0x0B  /* Name,ByteConst,WordConst,multi Node */
0649 #define ACPI_TYPE_PROCESSOR             0x0C  /* Name,ByteConst,DWordConst,ByteConst,multi NmO */
0650 #define ACPI_TYPE_THERMAL               0x0D  /* Name, multiple Node */
0651 #define ACPI_TYPE_BUFFER_FIELD          0x0E
0652 #define ACPI_TYPE_DDB_HANDLE            0x0F
0653 #define ACPI_TYPE_DEBUG_OBJECT          0x10
0654 
0655 #define ACPI_TYPE_EXTERNAL_MAX          0x10
0656 
0657 /*
0658  * These are object types that do not map directly to the ACPI
0659  * ObjectType() operator. They are used for various internal purposes only.
0660  * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
0661  * internal types must move upwards. (There is code that depends on these
0662  * values being contiguous with the external types above.)
0663  */
0664 #define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
0665 #define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
0666 #define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
0667 #define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, RefOf, Index */
0668 #define ACPI_TYPE_LOCAL_ALIAS           0x15
0669 #define ACPI_TYPE_LOCAL_METHOD_ALIAS    0x16
0670 #define ACPI_TYPE_LOCAL_NOTIFY          0x17
0671 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
0672 #define ACPI_TYPE_LOCAL_RESOURCE        0x19
0673 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x1A
0674 #define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple ObjectList Nodes */
0675 
0676 #define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
0677 
0678 /*
0679  * These are special object types that never appear in
0680  * a Namespace node, only in an ACPI_OPERAND_OBJECT
0681  */
0682 #define ACPI_TYPE_LOCAL_EXTRA           0x1C
0683 #define ACPI_TYPE_LOCAL_DATA            0x1D
0684 
0685 #define ACPI_TYPE_LOCAL_MAX             0x1D
0686 
0687 /* All types above here are invalid */
0688 
0689 #define ACPI_TYPE_INVALID               0x1E
0690 #define ACPI_TYPE_NOT_FOUND             0xFF
0691 
0692 #define ACPI_NUM_NS_TYPES               (ACPI_TYPE_INVALID + 1)
0693 
0694 
0695 /*
0696  * All I/O
0697  */
0698 #define ACPI_READ                       0
0699 #define ACPI_WRITE                      1
0700 #define ACPI_IO_MASK                    1
0701 
0702 /*
0703  * Event Types: Fixed & General Purpose
0704  */
0705 typedef UINT32                          ACPI_EVENT_TYPE;
0706 
0707 /*
0708  * Fixed events
0709  */
0710 #define ACPI_EVENT_PMTIMER              0
0711 #define ACPI_EVENT_GLOBAL               1
0712 #define ACPI_EVENT_POWER_BUTTON         2
0713 #define ACPI_EVENT_SLEEP_BUTTON         3
0714 #define ACPI_EVENT_RTC                  4
0715 #define ACPI_EVENT_MAX                  4
0716 #define ACPI_NUM_FIXED_EVENTS           ACPI_EVENT_MAX + 1
0717 
0718 /*
0719  * Event Status - Per event
0720  * -------------
0721  * The encoding of ACPI_EVENT_STATUS is illustrated below.
0722  * Note that a set bit (1) indicates the property is TRUE
0723  * (e.g. if bit 0 is set then the event is enabled).
0724  * +-------------+-+-+-+
0725  * |   Bits 31:3 |2|1|0|
0726  * +-------------+-+-+-+
0727  *          |     | | |
0728  *          |     | | +- Enabled?
0729  *          |     | +--- Enabled for wake?
0730  *          |     +----- Set?
0731  *          +----------- <Reserved>
0732  */
0733 typedef UINT32                          ACPI_EVENT_STATUS;
0734 
0735 #define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
0736 #define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
0737 #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
0738 #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
0739 
0740 /*
0741  * General Purpose Events (GPE)
0742  */
0743 #define ACPI_GPE_INVALID                0xFF
0744 #define ACPI_GPE_MAX                    0xFF
0745 #define ACPI_NUM_GPE                    256
0746 
0747 #define ACPI_GPE_ENABLE                 0
0748 #define ACPI_GPE_DISABLE                1
0749 
0750 
0751 /*
0752  * GPE info flags - Per GPE
0753  * +-+-+-+---+---+-+
0754  * |7|6|5|4:3|2:1|0|
0755  * +-+-+-+---+---+-+
0756  *  | | |  |   |  |
0757  *  | | |  |   |  +--- Interrupt type: Edge or Level Triggered
0758  *  | | |  |   +--- Type: Wake-only, Runtime-only, or wake/runtime
0759  *  | | |  +--- Type of dispatch -- to method, handler, or none
0760  *  | | +--- Enabled for runtime?
0761  *  | +--- Enabled for wake?
0762  *  +--- Unused
0763  */
0764 #define ACPI_GPE_XRUPT_TYPE_MASK        (UINT8) 0x01
0765 #define ACPI_GPE_LEVEL_TRIGGERED        (UINT8) 0x01
0766 #define ACPI_GPE_EDGE_TRIGGERED         (UINT8) 0x00
0767 
0768 #define ACPI_GPE_TYPE_MASK              (UINT8) 0x06
0769 #define ACPI_GPE_TYPE_WAKE_RUN          (UINT8) 0x06
0770 #define ACPI_GPE_TYPE_WAKE              (UINT8) 0x02
0771 #define ACPI_GPE_TYPE_RUNTIME           (UINT8) 0x04    /* Default */
0772 
0773 #define ACPI_GPE_DISPATCH_MASK          (UINT8) 0x18
0774 #define ACPI_GPE_DISPATCH_HANDLER       (UINT8) 0x08
0775 #define ACPI_GPE_DISPATCH_METHOD        (UINT8) 0x10
0776 #define ACPI_GPE_DISPATCH_NOT_USED      (UINT8) 0x00    /* Default */
0777 
0778 #define ACPI_GPE_RUN_ENABLE_MASK        (UINT8) 0x20
0779 #define ACPI_GPE_RUN_ENABLED            (UINT8) 0x20
0780 #define ACPI_GPE_RUN_DISABLED           (UINT8) 0x00    /* Default */
0781 
0782 #define ACPI_GPE_WAKE_ENABLE_MASK       (UINT8) 0x40
0783 #define ACPI_GPE_WAKE_ENABLED           (UINT8) 0x40
0784 #define ACPI_GPE_WAKE_DISABLED          (UINT8) 0x00    /* Default */
0785 
0786 #define ACPI_GPE_ENABLE_MASK            (UINT8) 0x60    /* Both run/wake */
0787 
0788 /*
0789  * Flags for GPE and Lock interfaces
0790  */
0791 #define ACPI_EVENT_WAKE_ENABLE          0x2             /* AcpiGpeEnable */
0792 #define ACPI_EVENT_WAKE_DISABLE         0x2             /* AcpiGpeDisable */
0793 
0794 #define ACPI_NOT_ISR                    0x1
0795 #define ACPI_ISR                        0x0
0796 
0797 
0798 /* Notify types */
0799 
0800 #define ACPI_SYSTEM_NOTIFY              0x1
0801 #define ACPI_DEVICE_NOTIFY              0x2
0802 #define ACPI_ALL_NOTIFY                 (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
0803 #define ACPI_MAX_NOTIFY_HANDLER_TYPE    0x3
0804 
0805 #define ACPI_MAX_SYS_NOTIFY             0x7f
0806 
0807 
0808 /* Address Space (Operation Region) Types */
0809 
0810 typedef UINT8                           ACPI_ADR_SPACE_TYPE;
0811 
0812 #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
0813 #define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
0814 #define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
0815 #define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
0816 #define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
0817 #define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
0818 #define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
0819 #define ACPI_ADR_SPACE_IPMI             (ACPI_ADR_SPACE_TYPE) 7
0820 #define ACPI_ADR_SPACE_DATA_TABLE       (ACPI_ADR_SPACE_TYPE) 8
0821 #define ACPI_ADR_SPACE_FIXED_HARDWARE   (ACPI_ADR_SPACE_TYPE) 127
0822 
0823 
0824 /*
0825  * BitRegister IDs
0826  *
0827  * These values are intended to be used by the hardware interfaces
0828  * and are mapped to individual bitfields defined within the ACPI
0829  * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c
0830  * for this mapping.
0831  */
0832 
0833 /* PM1 Status register */
0834 
0835 #define ACPI_BITREG_TIMER_STATUS                0x00
0836 #define ACPI_BITREG_BUS_MASTER_STATUS           0x01
0837 #define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
0838 #define ACPI_BITREG_POWER_BUTTON_STATUS         0x03
0839 #define ACPI_BITREG_SLEEP_BUTTON_STATUS         0x04
0840 #define ACPI_BITREG_RT_CLOCK_STATUS             0x05
0841 #define ACPI_BITREG_WAKE_STATUS                 0x06
0842 #define ACPI_BITREG_PCIEXP_WAKE_STATUS          0x07
0843 
0844 /* PM1 Enable register */
0845 
0846 #define ACPI_BITREG_TIMER_ENABLE                0x08
0847 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x09
0848 #define ACPI_BITREG_POWER_BUTTON_ENABLE         0x0A
0849 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0B
0850 #define ACPI_BITREG_RT_CLOCK_ENABLE             0x0C
0851 #define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0D
0852 
0853 /* PM1 Control register */
0854 
0855 #define ACPI_BITREG_SCI_ENABLE                  0x0E
0856 #define ACPI_BITREG_BUS_MASTER_RLD              0x0F
0857 #define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x10
0858 #define ACPI_BITREG_SLEEP_TYPE                  0x11
0859 #define ACPI_BITREG_SLEEP_ENABLE                0x12
0860 
0861 /* PM2 Control register */
0862 
0863 #define ACPI_BITREG_ARB_DISABLE                 0x13
0864 
0865 #define ACPI_BITREG_MAX                         0x13
0866 #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
0867 
0868 
0869 /* Status register values. A 1 clears a status bit. 0 = no effect */
0870 
0871 #define ACPI_CLEAR_STATUS                       1
0872 
0873 /* Enable and Control register values */
0874 
0875 #define ACPI_ENABLE_EVENT                       1
0876 #define ACPI_DISABLE_EVENT                      0
0877 
0878 
0879 /*
0880  * External ACPI object definition
0881  */
0882 
0883 /*
0884  * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element
0885  * or an unresolved named reference.
0886  */
0887 typedef union acpi_object
0888 {
0889     ACPI_OBJECT_TYPE                Type;   /* See definition of AcpiNsType for values */
0890     struct
0891     {
0892         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_INTEGER */
0893         ACPI_INTEGER                    Value;      /* The actual number */
0894     } Integer;
0895 
0896     struct
0897     {
0898         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_STRING */
0899         UINT32                          Length;     /* # of bytes in string, excluding trailing null */
0900         char                            *Pointer;   /* points to the string value */
0901     } String;
0902 
0903     struct
0904     {
0905         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_BUFFER */
0906         UINT32                          Length;     /* # of bytes in buffer */
0907         UINT8                           *Pointer;   /* points to the buffer */
0908     } Buffer;
0909 
0910     struct
0911     {
0912         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_PACKAGE */
0913         UINT32                          Count;      /* # of elements in package */
0914         union acpi_object               *Elements;  /* Pointer to an array of ACPI_OBJECTs */
0915     } Package;
0916 
0917     struct
0918     {
0919         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_LOCAL_REFERENCE */
0920         ACPI_OBJECT_TYPE                ActualType; /* Type associated with the Handle */
0921         ACPI_HANDLE                     Handle;     /* object reference */
0922     } Reference;
0923 
0924     struct
0925     {
0926         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_PROCESSOR */
0927         UINT32                          ProcId;
0928         ACPI_IO_ADDRESS                 PblkAddress;
0929         UINT32                          PblkLength;
0930     } Processor;
0931 
0932     struct
0933     {
0934         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_POWER */
0935         UINT32                          SystemLevel;
0936         UINT32                          ResourceOrder;
0937     } PowerResource;
0938 
0939 } ACPI_OBJECT;
0940 
0941 
0942 /*
0943  * List of objects, used as a parameter list for control method evaluation
0944  */
0945 typedef struct acpi_object_list
0946 {
0947     UINT32                          Count;
0948     ACPI_OBJECT                     *Pointer;
0949 
0950 } ACPI_OBJECT_LIST;
0951 
0952 
0953 /*
0954  * Miscellaneous common Data Structures used by the interfaces
0955  */
0956 #define ACPI_NO_BUFFER              0
0957 #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (-1)
0958 #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (-2)
0959 
0960 typedef struct acpi_buffer
0961 {
0962     ACPI_SIZE                       Length;         /* Length in bytes of the buffer */
0963     void                            *Pointer;       /* pointer to buffer */
0964 
0965 } ACPI_BUFFER;
0966 
0967 
0968 /*
0969  * NameType for AcpiGetName
0970  */
0971 #define ACPI_FULL_PATHNAME              0
0972 #define ACPI_SINGLE_NAME                1
0973 #define ACPI_NAME_TYPE_MAX              1
0974 
0975 
0976 /*
0977  * Predefined Namespace items
0978  */
0979 typedef struct acpi_predefined_names
0980 {
0981     char                            *Name;
0982     UINT8                           Type;
0983     char                            *Val;
0984 
0985 } ACPI_PREDEFINED_NAMES;
0986 
0987 
0988 /*
0989  * Structure and flags for AcpiGetSystemInfo
0990  */
0991 #define ACPI_SYS_MODE_UNKNOWN           0x0000
0992 #define ACPI_SYS_MODE_ACPI              0x0001
0993 #define ACPI_SYS_MODE_LEGACY            0x0002
0994 #define ACPI_SYS_MODES_MASK             0x0003
0995 
0996 
0997 /*
0998  * System info returned by AcpiGetSystemInfo()
0999  */
1000 typedef struct acpi_system_info
1001 {
1002     UINT32                          AcpiCaVersion;
1003     UINT32                          Flags;
1004     UINT32                          TimerResolution;
1005     UINT32                          Reserved1;
1006     UINT32                          Reserved2;
1007     UINT32                          DebugLevel;
1008     UINT32                          DebugLayer;
1009 
1010 } ACPI_SYSTEM_INFO;
1011 
1012 
1013 /*
1014  * System statistics returned by AcpiGetStatistics()
1015  */
1016 typedef struct acpi_statistics
1017 {
1018     UINT32                          SciCount;
1019     UINT32                          GpeCount;
1020     UINT32                          FixedEventCount[ACPI_NUM_FIXED_EVENTS];
1021     UINT32                          MethodCount;
1022 
1023 } ACPI_STATISTICS;
1024 
1025 
1026 /* Table Event Types */
1027 
1028 #define ACPI_TABLE_EVENT_LOAD           0x0
1029 #define ACPI_TABLE_EVENT_UNLOAD         0x1
1030 #define ACPI_NUM_TABLE_EVENTS           2
1031 
1032 
1033 /*
1034  * Types specific to the OS service interfaces
1035  */
1036 typedef UINT32
1037 (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
1038     void                            *Context);
1039 
1040 typedef void
1041 (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
1042     void                            *Context);
1043 
1044 /*
1045  * Various handlers and callback procedures
1046  */
1047 typedef
1048 UINT32 (*ACPI_EVENT_HANDLER) (
1049     void                            *Context);
1050 
1051 typedef
1052 void (*ACPI_NOTIFY_HANDLER) (
1053     ACPI_HANDLE                     Device,
1054     UINT32                          Value,
1055     void                            *Context);
1056 
1057 typedef
1058 void (*ACPI_OBJECT_HANDLER) (
1059     ACPI_HANDLE                     Object,
1060     void                            *Data);
1061 
1062 typedef
1063 ACPI_STATUS (*ACPI_INIT_HANDLER) (
1064     ACPI_HANDLE                     Object,
1065     UINT32                          Function);
1066 
1067 #define ACPI_INIT_DEVICE_INI        1
1068 
1069 typedef
1070 ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) (
1071     ACPI_STATUS                     AmlStatus,
1072     ACPI_NAME                       Name,
1073     UINT16                          Opcode,
1074     UINT32                          AmlOffset,
1075     void                            *Context);
1076 
1077 /* Table Event handler (Load, LoadTable, etc.) and types */
1078 
1079 typedef
1080 ACPI_STATUS (*ACPI_TABLE_HANDLER) (
1081     UINT32                          Event,
1082     void                            *Table,
1083     void                            *Context);
1084 
1085 #define ACPI_TABLE_LOAD             0x0
1086 #define ACPI_TABLE_UNLOAD           0x1
1087 #define ACPI_NUM_TABLE_EVENTS       2
1088 
1089 
1090 /* Address Spaces (For Operation Regions) */
1091 
1092 typedef
1093 ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
1094     UINT32                          Function,
1095     ACPI_PHYSICAL_ADDRESS           Address,
1096     UINT32                          BitWidth,
1097     ACPI_INTEGER                    *Value,
1098     void                            *HandlerContext,
1099     void                            *RegionContext);
1100 
1101 #define ACPI_DEFAULT_HANDLER            NULL
1102 
1103 typedef
1104 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
1105     ACPI_HANDLE                     RegionHandle,
1106     UINT32                          Function,
1107     void                            *HandlerContext,
1108     void                            **RegionContext);
1109 
1110 #define ACPI_REGION_ACTIVATE    0
1111 #define ACPI_REGION_DEACTIVATE  1
1112 
1113 typedef
1114 ACPI_STATUS (*ACPI_WALK_CALLBACK) (
1115     ACPI_HANDLE                     ObjHandle,
1116     UINT32                          NestingLevel,
1117     void                            *Context,
1118     void                            **ReturnValue);
1119 
1120 
1121 /* Interrupt handler return values */
1122 
1123 #define ACPI_INTERRUPT_NOT_HANDLED      0x00
1124 #define ACPI_INTERRUPT_HANDLED          0x01
1125 
1126 /* Length of 32-bit EISAID values when converted back to a string */
1127 
1128 #define ACPI_EISAID_STRING_SIZE         8   /* Includes null terminator */
1129 
1130 /* Length of UUID (string) values */
1131 
1132 #define ACPI_UUID_LENGTH                16
1133 
1134 
1135 /* Structures used for device/processor HID, UID, CID */
1136 
1137 typedef struct acpi_device_id
1138 {
1139     UINT32                          Length;             /* Length of string + null */
1140     char                            *String;
1141 
1142 } ACPI_DEVICE_ID;
1143 
1144 typedef struct acpi_device_id_list
1145 {
1146     UINT32                          Count;              /* Number of IDs in Ids array */
1147     UINT32                          ListSize;           /* Size of list, including ID strings */
1148     ACPI_DEVICE_ID                  Ids[1];             /* ID array */
1149 
1150 } ACPI_DEVICE_ID_LIST;
1151 
1152 /*
1153  * Structure returned from AcpiGetObjectInfo.
1154  * Optimized for both 32- and 64-bit builds
1155  */
1156 typedef struct acpi_device_info
1157 {
1158     UINT32                          InfoSize;           /* Size of info, including ID strings */
1159     UINT32                          Name;               /* ACPI object Name */
1160     ACPI_OBJECT_TYPE                Type;               /* ACPI object Type */
1161     UINT8                           ParamCount;         /* If a method, required parameter count */
1162     UINT8                           Valid;              /* Indicates which optional fields are valid */
1163     UINT8                           Flags;              /* Miscellaneous info */
1164     UINT8                           HighestDstates[4];  /* _SxD values: 0xFF indicates not valid */
1165     UINT8                           LowestDstates[5];   /* _SxW values: 0xFF indicates not valid */
1166     UINT32                          CurrentStatus;      /* _STA value */
1167     ACPI_INTEGER                    Address;            /* _ADR value */
1168     ACPI_DEVICE_ID                  HardwareId;         /* _HID value */
1169     ACPI_DEVICE_ID                  UniqueId;           /* _UID value */
1170     ACPI_DEVICE_ID_LIST             CompatibleIdList;   /* _CID list <must be last> */
1171 
1172 } ACPI_DEVICE_INFO;
1173 
1174 /* Values for Flags field above (AcpiGetObjectInfo) */
1175 
1176 #define ACPI_PCI_ROOT_BRIDGE            0x01
1177 
1178 /* Flags for Valid field above (AcpiGetObjectInfo) */
1179 
1180 #define ACPI_VALID_STA                  0x01
1181 #define ACPI_VALID_ADR                  0x02
1182 #define ACPI_VALID_HID                  0x04
1183 #define ACPI_VALID_UID                  0x08
1184 #define ACPI_VALID_CID                  0x10
1185 #define ACPI_VALID_SXDS                 0x20
1186 #define ACPI_VALID_SXWS                 0x40
1187 
1188 /* Flags for _STA method */
1189 
1190 #define ACPI_STA_DEVICE_PRESENT         0x01
1191 #define ACPI_STA_DEVICE_ENABLED         0x02
1192 #define ACPI_STA_DEVICE_UI              0x04
1193 #define ACPI_STA_DEVICE_FUNCTIONING     0x08
1194 #define ACPI_STA_DEVICE_OK              0x08 /* Synonym */
1195 #define ACPI_STA_BATTERY_PRESENT        0x10
1196 
1197 
1198 /* Context structs for address space handlers */
1199 
1200 typedef struct acpi_pci_id
1201 {
1202     UINT16                          Segment;
1203     UINT16                          Bus;
1204     UINT16                          Device;
1205     UINT16                          Function;
1206 
1207 } ACPI_PCI_ID;
1208 
1209 typedef struct acpi_mem_space_context
1210 {
1211     UINT32                          Length;
1212     ACPI_PHYSICAL_ADDRESS           Address;
1213     ACPI_PHYSICAL_ADDRESS           MappedPhysicalAddress;
1214     UINT8                           *MappedLogicalAddress;
1215     ACPI_SIZE                       MappedLength;
1216 
1217 } ACPI_MEM_SPACE_CONTEXT;
1218 
1219 
1220 /*
1221  * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled
1222  */
1223 typedef struct acpi_memory_list
1224 {
1225     char                            *ListName;
1226     void                            *ListHead;
1227     UINT16                          ObjectSize;
1228     UINT16                          MaxDepth;
1229     UINT16                          CurrentDepth;
1230     UINT16                          LinkOffset;
1231 
1232 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1233 
1234     /* Statistics for debug memory tracking only */
1235 
1236     UINT32                          TotalAllocated;
1237     UINT32                          TotalFreed;
1238     UINT32                          MaxOccupied;
1239     UINT32                          TotalSize;
1240     UINT32                          CurrentTotalSize;
1241     UINT32                          Requests;
1242     UINT32                          Hits;
1243 #endif
1244 
1245 } ACPI_MEMORY_LIST;
1246 
1247 
1248 #endif /* __ACTYPES_H__ */