diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2012-08-16 17:26:22 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2012-08-16 17:26:22 +0000 | 
| commit | fc8e34d9a95f87b780f9ee3d400dd995aba2ce27 (patch) | |
| tree | a28a9676fa0b9e969cfd83d7a508660c754c8b3e /source/include | |
| parent | 8724452f676e45bfd39cfb47234f7def5551f067 (diff) | |
Notes
Diffstat (limited to 'source/include')
| -rw-r--r-- | source/include/acbuffer.h | 246 | ||||
| -rw-r--r-- | source/include/acdisasm.h | 19 | ||||
| -rw-r--r-- | source/include/achware.h | 21 | ||||
| -rw-r--r-- | source/include/aclocal.h | 23 | ||||
| -rw-r--r-- | source/include/acmacros.h | 29 | ||||
| -rw-r--r-- | source/include/acnames.h | 3 | ||||
| -rw-r--r-- | source/include/acpixf.h | 14 | ||||
| -rw-r--r-- | source/include/actbl.h | 62 | ||||
| -rw-r--r-- | source/include/actbl1.h | 12 | ||||
| -rw-r--r-- | source/include/actbl2.h | 136 | ||||
| -rw-r--r-- | source/include/actbl3.h | 13 | ||||
| -rw-r--r-- | source/include/actypes.h | 10 | ||||
| -rw-r--r-- | source/include/platform/acenv.h | 3 | ||||
| -rw-r--r-- | source/include/platform/achaiku.h | 105 | 
14 files changed, 616 insertions, 80 deletions
diff --git a/source/include/acbuffer.h b/source/include/acbuffer.h new file mode 100644 index 0000000000000..4b34ccdace1a9 --- /dev/null +++ b/source/include/acbuffer.h @@ -0,0 +1,246 @@ +/****************************************************************************** + * + * Name: acbuffer.h - Support for buffers returned by ACPI predefined names + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions, and the following disclaimer, + *    without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *    substantially similar to the "NO WARRANTY" disclaimer below + *    ("Disclaimer") and any redistribution must be conditioned upon + *    including a substantially similar Disclaimer requirement for further + *    binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + *    of any contributors may be used to endorse or promote products derived + *    from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef __ACBUFFER_H__ +#define __ACBUFFER_H__ + +/* + * Contains buffer structures for these predefined names: + * _FDE, _GRT, _GTM, _PLD, _SRT + */ + +/* + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661 + */ + + +/* _FDE return value */ + +typedef struct acpi_fde_info +{ +    UINT32              Floppy0; +    UINT32              Floppy1; +    UINT32              Floppy2; +    UINT32              Floppy3; +    UINT32              Tape; + +} ACPI_FDE_INFO; + +/* + * _GRT return value + * _SRT input value + */ +typedef struct acpi_grt_info +{ +    UINT16              Year; +    UINT8               Month; +    UINT8               Day; +    UINT8               Hour; +    UINT8               Minute; +    UINT8               Second; +    UINT8               Valid; +    UINT16              Milliseconds; +    UINT16              Timezone; +    UINT8               Daylight; +    UINT8               Reserved[3]; + +} ACPI_GRT_INFO; + +/* _GTM return value */ + +typedef struct acpi_gtm_info +{ +    UINT32              PioSpeed0; +    UINT32              DmaSpeed0; +    UINT32              PioSpeed1; +    UINT32              DmaSpeed1; +    UINT32              Flags; + +} ACPI_GTM_INFO; + +/* + * Formatted _PLD return value. The minimum size is a package containing + * one buffer. + * Revision 1: Buffer is 16 bytes (128 bits) + * Revision 2: Buffer is 20 bytes (160 bits) + * + * Note: This structure is returned from the AcpiDecodePldBuffer + * interface. + */ +typedef struct acpi_pld_info +{ +    UINT8               Revision; +    UINT8               IgnoreColor; +    UINT32              Color; +    UINT16              Width; +    UINT16              Height; +    UINT8               UserVisible; +    UINT8               Dock; +    UINT8               Lid; +    UINT8               Panel; +    UINT8               VerticalPosition; +    UINT8               HorizontalPosition; +    UINT8               Shape; +    UINT8               GroupOrientation; +    UINT8               GroupToken; +    UINT8               GroupPosition; +    UINT8               Bay; +    UINT8               Ejectable; +    UINT8               OspmEjectRequired; +    UINT8               CabinetNumber; +    UINT8               CardCageNumber; +    UINT8               Reference; +    UINT8               Rotation; +    UINT8               Order; +    UINT8               Reserved; +    UINT16              VerticalOffset; +    UINT16              HorizontalOffset; + +} ACPI_PLD_INFO; + + +/* + * Macros to: + *     1) Convert a _PLD buffer to internal ACPI_PLD_INFO format - ACPI_PLD_GET* + *        (Used by AcpiDecodePldBuffer) + *     2) Construct a _PLD buffer - ACPI_PLD_SET* + *        (Intended for BIOS use only) + */ +#define ACPI_PLD_REV1_BUFFER_SIZE               16 /* For Revision 1 of the buffer (From ACPI spec) */ +#define ACPI_PLD_BUFFER_SIZE                    20 /* For Revision 2 of the buffer (From ACPI spec) */ + +/* First 32-bit dword, bits 0:32 */ + +#define ACPI_PLD_GET_REVISION(dword)            ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK) +#define ACPI_PLD_SET_REVISION(dword,value)      ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value)     /* Offset 0, Len 7 */ + +#define ACPI_PLD_GET_IGNORE_COLOR(dword)        ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_IGNORE_COLOR(dword,value)  ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value)     /* Offset 7, Len 1 */ + +#define ACPI_PLD_GET_COLOR(dword)               ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) +#define ACPI_PLD_SET_COLOR(dword,value)         ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value)    /* Offset 8, Len 24 */ + +/* Second 32-bit dword, bits 33:63 */ + +#define ACPI_PLD_GET_WIDTH(dword)               ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) +#define ACPI_PLD_SET_WIDTH(dword,value)         ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value)    /* Offset 32+0=32, Len 16 */ + +#define ACPI_PLD_GET_HEIGHT(dword)              ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) +#define ACPI_PLD_SET_HEIGHT(dword,value)        ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value)   /* Offset 32+16=48, Len 16 */ + +/* Third 32-bit dword, bits 64:95 */ + +#define ACPI_PLD_GET_USER_VISIBLE(dword)        ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_USER_VISIBLE(dword,value)  ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value)     /* Offset 64+0=64, Len 1 */ + +#define ACPI_PLD_GET_DOCK(dword)                ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_DOCK(dword,value)          ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value)     /* Offset 64+1=65, Len 1 */ + +#define ACPI_PLD_GET_LID(dword)                 ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_LID(dword,value)           ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value)     /* Offset 64+2=66, Len 1 */ + +#define ACPI_PLD_GET_PANEL(dword)               ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK) +#define ACPI_PLD_SET_PANEL(dword,value)         ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value)     /* Offset 64+3=67, Len 3 */ + +#define ACPI_PLD_GET_VERTICAL(dword)            ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK) +#define ACPI_PLD_SET_VERTICAL(dword,value)      ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value)     /* Offset 64+6=70, Len 2 */ + +#define ACPI_PLD_GET_HORIZONTAL(dword)          ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK) +#define ACPI_PLD_SET_HORIZONTAL(dword,value)    ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value)     /* Offset 64+8=72, Len 2 */ + +#define ACPI_PLD_GET_SHAPE(dword)               ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK) +#define ACPI_PLD_SET_SHAPE(dword,value)         ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value)    /* Offset 64+10=74, Len 4 */ + +#define ACPI_PLD_GET_ORIENTATION(dword)         ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_ORIENTATION(dword,value)   ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value)    /* Offset 64+14=78, Len 1 */ + +#define ACPI_PLD_GET_TOKEN(dword)               ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_TOKEN(dword,value)         ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value)    /* Offset 64+15=79, Len 8 */ + +#define ACPI_PLD_GET_POSITION(dword)            ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_POSITION(dword,value)      ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value)    /* Offset 64+23=87, Len 8 */ + +#define ACPI_PLD_GET_BAY(dword)                 ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_BAY(dword,value)           ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value)    /* Offset 64+31=95, Len 1 */ + +/* Fourth 32-bit dword, bits 96:127 */ + +#define ACPI_PLD_GET_EJECTABLE(dword)           ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_EJECTABLE(dword,value)     ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value)     /* Offset 96+0=96, Len 1 */ + +#define ACPI_PLD_GET_OSPM_EJECT(dword)          ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_OSPM_EJECT(dword,value)    ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value)     /* Offset 96+1=97, Len 1 */ + +#define ACPI_PLD_GET_CABINET(dword)             ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_CABINET(dword,value)       ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value)     /* Offset 96+2=98, Len 8 */ + +#define ACPI_PLD_GET_CARD_CAGE(dword)           ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_CARD_CAGE(dword,value)     ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value)    /* Offset 96+10=106, Len 8 */ + +#define ACPI_PLD_GET_REFERENCE(dword)           ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK) +#define ACPI_PLD_SET_REFERENCE(dword,value)     ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value)    /* Offset 96+18=114, Len 1 */ + +#define ACPI_PLD_GET_ROTATION(dword)            ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK) +#define ACPI_PLD_SET_ROTATION(dword,value)      ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value)    /* Offset 96+19=115, Len 4 */ + +#define ACPI_PLD_GET_ORDER(dword)               ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK) +#define ACPI_PLD_SET_ORDER(dword,value)         ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value)    /* Offset 96+23=119, Len 5 */ + +/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */ + +#define ACPI_PLD_GET_VERT_OFFSET(dword)         ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) +#define ACPI_PLD_SET_VERT_OFFSET(dword,value)   ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value)    /* Offset 128+0=128, Len 16 */ + +#define ACPI_PLD_GET_HORIZ_OFFSET(dword)        ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) +#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value)  ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value)   /* Offset 128+16=144, Len 16 */ + + +#endif /* ACBUFFER_H */ diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index e5c5c11f0cbc7..bb66fbbf2a21d 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -235,6 +235,13 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoBert[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoBgrt[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep0[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCsrt0[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCsrt1[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbg2[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbg2Device[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbg2Addr[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbg2Size[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbg2Name[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbgp[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDmar[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDmarHdr[]; @@ -396,6 +403,14 @@ AcpiDmDumpCpep (      ACPI_TABLE_HEADER       *Table);  void +AcpiDmDumpCsrt ( +    ACPI_TABLE_HEADER       *Table); + +void +AcpiDmDumpDbg2 ( +    ACPI_TABLE_HEADER       *Table); + +void  AcpiDmDumpDmar (      ACPI_TABLE_HEADER       *Table); @@ -613,6 +628,10 @@ BOOLEAN  AcpiDmIsStringBuffer (      ACPI_PARSE_OBJECT       *Op); +BOOLEAN +AcpiDmIsPldBuffer ( +    ACPI_PARSE_OBJECT       *Op); +  /*   * dmextern diff --git a/source/include/achware.h b/source/include/achware.h index f607d1702ac39..6dc11913eaf8a 100644 --- a/source/include/achware.h +++ b/source/include/achware.h @@ -114,18 +114,15 @@ AcpiHwClearAcpiStatus (   */  ACPI_STATUS  AcpiHwLegacySleep ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  ACPI_STATUS  AcpiHwLegacyWakePrep ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  ACPI_STATUS  AcpiHwLegacyWake ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  /* @@ -138,18 +135,15 @@ AcpiHwExecuteSleepMethod (  ACPI_STATUS  AcpiHwExtendedSleep ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  ACPI_STATUS  AcpiHwExtendedWakePrep ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  ACPI_STATUS  AcpiHwExtendedWake ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  /* @@ -173,8 +167,7 @@ AcpiHwWritePort (   */  UINT32  AcpiHwGetGpeRegisterBit ( -    ACPI_GPE_EVENT_INFO     *GpeEventInfo, -    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo); +    ACPI_GPE_EVENT_INFO     *GpeEventInfo);  ACPI_STATUS  AcpiHwLowSetGpe ( diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 0f79fa2a00b2c..8a3514772f9c7 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -857,15 +857,18 @@ typedef union acpi_parse_value      char                            AmlOpName[16])  /* Op name (debug only) */ -#define ACPI_DASM_BUFFER                0x00 -#define ACPI_DASM_RESOURCE              0x01 -#define ACPI_DASM_STRING                0x02 -#define ACPI_DASM_UNICODE               0x03 -#define ACPI_DASM_EISAID                0x04 -#define ACPI_DASM_MATCHOP               0x05 -#define ACPI_DASM_LNOT_PREFIX           0x06 -#define ACPI_DASM_LNOT_SUFFIX           0x07 -#define ACPI_DASM_IGNORE                0x08 +/* Flags for DisasmFlags field  above */ + +#define ACPI_DASM_BUFFER                0x00        /* Buffer is a simple data buffer */ +#define ACPI_DASM_RESOURCE              0x01        /* Buffer is a Resource Descriptor */ +#define ACPI_DASM_STRING                0x02        /* Buffer is a ASCII string */ +#define ACPI_DASM_UNICODE               0x03        /* Buffer is a Unicode string */ +#define ACPI_DASM_PLD_METHOD            0x04        /* Buffer is a _PLD method bit-packed buffer */ +#define ACPI_DASM_EISAID                0x05        /* Integer is an EISAID */ +#define ACPI_DASM_MATCHOP               0x06        /* Parent opcode is a Match() operator */ +#define ACPI_DASM_LNOT_PREFIX           0x07        /* Start of a LNotEqual (etc.) pair of opcodes */ +#define ACPI_DASM_LNOT_SUFFIX           0x08        /* End  of a LNotEqual (etc.) pair of opcodes */ +#define ACPI_DASM_IGNORE                0x09        /* Not used at this time */  /*   * Generic operation (for example:  If, While, Store) @@ -1105,6 +1108,7 @@ typedef struct acpi_bit_register_info  #define ACPI_OSI_WIN_VISTA_SP1          0x09  #define ACPI_OSI_WIN_VISTA_SP2          0x0A  #define ACPI_OSI_WIN_7                  0x0B +#define ACPI_OSI_WIN_8                  0x0C  #define ACPI_ALWAYS_ILLEGAL             0x00 @@ -1237,6 +1241,7 @@ typedef struct acpi_external_file  typedef struct acpi_db_method_info  { +    ACPI_HANDLE                     Method;      ACPI_HANDLE                     MainThreadGate;      ACPI_HANDLE                     ThreadCompleteGate;      ACPI_HANDLE                     InfoGate; diff --git a/source/include/acmacros.h b/source/include/acmacros.h index 591bb6bf1a58b..92cd7a25e800a 100644 --- a/source/include/acmacros.h +++ b/source/include/acmacros.h @@ -268,10 +268,33 @@  /* Bitfields within ACPI registers */ -#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)      ((Val << Pos) & Mask) -#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val)  Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) +#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) \ +    ((Val << Pos) & Mask) -#define ACPI_INSERT_BITS(Target, Mask, Source)          Target = ((Target & (~(Mask))) | (Source & Mask)) +#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) \ +    Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) + +#define ACPI_INSERT_BITS(Target, Mask, Source) \ +    Target = ((Target & (~(Mask))) | (Source & Mask)) + +/* Generic bitfield macros and masks */ + +#define ACPI_GET_BITS(SourcePtr, Position, Mask) \ +    ((*SourcePtr >> Position) & Mask) + +#define ACPI_SET_BITS(TargetPtr, Position, Mask, Value) \ +    (*TargetPtr |= ((Value & Mask) << Position)) + +#define ACPI_1BIT_MASK      0x00000001 +#define ACPI_2BIT_MASK      0x00000003 +#define ACPI_3BIT_MASK      0x00000007 +#define ACPI_4BIT_MASK      0x0000000F +#define ACPI_5BIT_MASK      0x0000001F +#define ACPI_6BIT_MASK      0x0000003F +#define ACPI_7BIT_MASK      0x0000007F +#define ACPI_8BIT_MASK      0x000000FF +#define ACPI_16BIT_MASK     0x0000FFFF +#define ACPI_24BIT_MASK     0x00FFFFFF  /*   * An object of type ACPI_NAMESPACE_NODE can appear in some contexts diff --git a/source/include/acnames.h b/source/include/acnames.h index 4c5fab696f15e..e56f3cdf93d9f 100644 --- a/source/include/acnames.h +++ b/source/include/acnames.h @@ -62,11 +62,10 @@  #define METHOD_NAME__AEI        "_AEI"  #define METHOD_NAME__PRW        "_PRW"  #define METHOD_NAME__SRS        "_SRS" +#define METHOD_NAME__PLD        "_PLD"  /* Method names - these methods must appear at the namespace root */ -#define METHOD_PATHNAME__BFS    "\\_BFS" -#define METHOD_PATHNAME__GTS    "\\_GTS"  #define METHOD_PATHNAME__PTS    "\\_PTS"  #define METHOD_PATHNAME__SST    "\\_SI._SST"  #define METHOD_PATHNAME__WAK    "\\_WAK" diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 9c5aa4f6dd5b1..cdec63a337bda 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -48,11 +48,12 @@  /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION                 0x20120711 +#define ACPI_CA_VERSION                 0x20120816  #include "acconfig.h"  #include "actypes.h"  #include "actbl.h" +#include "acbuffer.h"  /*   * Globals that are publically available @@ -183,6 +184,11 @@ AcpiCheckAddressRange (      ACPI_SIZE               Length,      BOOLEAN                 Warn); +ACPI_STATUS +AcpiDecodePldBuffer ( +    UINT8                   *InBuffer, +    ACPI_SIZE               Length, +    ACPI_PLD_INFO           **ReturnBuffer);  /*   * ACPI Memory management @@ -686,8 +692,7 @@ AcpiEnterSleepStatePrep (  ACPI_STATUS  AcpiEnterSleepState ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  ACPI_HW_DEPENDENT_RETURN_STATUS (  ACPI_STATUS @@ -696,8 +701,7 @@ AcpiEnterSleepStateS4bios (  ACPI_STATUS  AcpiLeaveSleepStatePrep ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  ACPI_STATUS  AcpiLeaveSleepState ( diff --git a/source/include/actbl.h b/source/include/actbl.h index 7da7378d140ca..4389d307afde2 100644 --- a/source/include/actbl.h +++ b/source/include/actbl.h @@ -82,9 +82,15 @@  #pragma pack(1)  /* - * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661   */ @@ -99,7 +105,7 @@ typedef struct acpi_table_header  {      char                    Signature[ACPI_NAME_SIZE];          /* ASCII table signature */      UINT32                  Length;                             /* Length of table in bytes, including this header */ -    UINT8                   Revision;                           /* ACPI Specification minor version # */ +    UINT8                   Revision;                           /* ACPI Specification minor version number */      UINT8                   Checksum;                           /* To make sum of entire table == 0 */      char                    OemId[ACPI_OEM_ID_SIZE];            /* ASCII OEM identification */      char                    OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ @@ -115,7 +121,7 @@ typedef struct acpi_table_header   * GAS - Generic Address Structure (ACPI 2.0+)   *   * Note: Since this structure is used in the ACPI tables, it is byte aligned. - * If misaliged access is not supported by the hardware, accesses to the + * If misaligned access is not supported by the hardware, accesses to the   * 64-bit Address field must be performed with care.   *   ******************************************************************************/ @@ -253,18 +259,18 @@ typedef struct acpi_table_fadt      UINT8                   PreferredProfile;   /* Conveys preferred power management profile to OSPM. */      UINT16                  SciInterrupt;       /* System vector of SCI interrupt */      UINT32                  SmiCommand;         /* 32-bit Port address of SMI command port */ -    UINT8                   AcpiEnable;         /* Value to write to smi_cmd to enable ACPI */ -    UINT8                   AcpiDisable;        /* Value to write to smi_cmd to disable ACPI */ -    UINT8                   S4BiosRequest;      /* Value to write to SMI CMD to enter S4BIOS state */ +    UINT8                   AcpiEnable;         /* Value to write to SMI_CMD to enable ACPI */ +    UINT8                   AcpiDisable;        /* Value to write to SMI_CMD to disable ACPI */ +    UINT8                   S4BiosRequest;      /* Value to write to SMI_CMD to enter S4BIOS state */      UINT8                   PstateControl;      /* Processor performance state control*/ -    UINT32                  Pm1aEventBlock;     /* 32-bit Port address of Power Mgt 1a Event Reg Blk */ -    UINT32                  Pm1bEventBlock;     /* 32-bit Port address of Power Mgt 1b Event Reg Blk */ -    UINT32                  Pm1aControlBlock;   /* 32-bit Port address of Power Mgt 1a Control Reg Blk */ -    UINT32                  Pm1bControlBlock;   /* 32-bit Port address of Power Mgt 1b Control Reg Blk */ -    UINT32                  Pm2ControlBlock;    /* 32-bit Port address of Power Mgt 2 Control Reg Blk */ -    UINT32                  PmTimerBlock;       /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */ -    UINT32                  Gpe0Block;          /* 32-bit Port address of General Purpose Event 0 Reg Blk */ -    UINT32                  Gpe1Block;          /* 32-bit Port address of General Purpose Event 1 Reg Blk */ +    UINT32                  Pm1aEventBlock;     /* 32-bit port address of Power Mgt 1a Event Reg Blk */ +    UINT32                  Pm1bEventBlock;     /* 32-bit port address of Power Mgt 1b Event Reg Blk */ +    UINT32                  Pm1aControlBlock;   /* 32-bit port address of Power Mgt 1a Control Reg Blk */ +    UINT32                  Pm1bControlBlock;   /* 32-bit port address of Power Mgt 1b Control Reg Blk */ +    UINT32                  Pm2ControlBlock;    /* 32-bit port address of Power Mgt 2 Control Reg Blk */ +    UINT32                  PmTimerBlock;       /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ +    UINT32                  Gpe0Block;          /* 32-bit port address of General Purpose Event 0 Reg Blk */ +    UINT32                  Gpe1Block;          /* 32-bit port address of General Purpose Event 1 Reg Blk */      UINT8                   Pm1EventLength;     /* Byte Length of ports at Pm1xEventBlock */      UINT8                   Pm1ControlLength;   /* Byte Length of ports at Pm1xControlBlock */      UINT8                   Pm2ControlLength;   /* Byte Length of ports at Pm2ControlBlock */ @@ -272,12 +278,12 @@ typedef struct acpi_table_fadt      UINT8                   Gpe0BlockLength;    /* Byte Length of ports at Gpe0Block */      UINT8                   Gpe1BlockLength;    /* Byte Length of ports at Gpe1Block */      UINT8                   Gpe1Base;           /* Offset in GPE number space where GPE1 events start */ -    UINT8                   CstControl;         /* Support for the _CST object and C States change notification */ +    UINT8                   CstControl;         /* Support for the _CST object and C-States change notification */      UINT16                  C2Latency;          /* Worst case HW latency to enter/exit C2 state */      UINT16                  C3Latency;          /* Worst case HW latency to enter/exit C3 state */ -    UINT16                  FlushSize;          /* Processor's memory cache line width, in bytes */ +    UINT16                  FlushSize;          /* Processor memory cache line width, in bytes */      UINT16                  FlushStride;        /* Number of flush strides that need to be read */ -    UINT8                   DutyOffset;         /* Processor duty cycle index in processor's P_CNT reg */ +    UINT8                   DutyOffset;         /* Processor duty cycle index in processor P_CNT reg */      UINT8                   DutyWidth;          /* Processor duty cycle value bit width in P_CNT register */      UINT8                   DayAlarm;           /* Index to day-of-month alarm in RTC CMOS RAM */      UINT8                   MonthAlarm;         /* Index to month-of-year alarm in RTC CMOS RAM */ @@ -298,13 +304,13 @@ typedef struct acpi_table_fadt      ACPI_GENERIC_ADDRESS    XPmTimerBlock;      /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */      ACPI_GENERIC_ADDRESS    XGpe0Block;         /* 64-bit Extended General Purpose Event 0 Reg Blk address */      ACPI_GENERIC_ADDRESS    XGpe1Block;         /* 64-bit Extended General Purpose Event 1 Reg Blk address */ -    ACPI_GENERIC_ADDRESS    SleepControl;       /* 64-bit Sleep Control register */ -    ACPI_GENERIC_ADDRESS    SleepStatus;        /* 64-bit Sleep Status register */ +    ACPI_GENERIC_ADDRESS    SleepControl;       /* 64-bit Sleep Control register (ACPI 5.0) */ +    ACPI_GENERIC_ADDRESS    SleepStatus;        /* 64-bit Sleep Status register (ACPI 5.0) */  } ACPI_TABLE_FADT; -/* Masks for FADT Boot Architecture Flags (BootFlags) */ +/* Masks for FADT Boot Architecture Flags (BootFlags) [Vx]=Introduced in this FADT revision */  #define ACPI_FADT_LEGACY_DEVICES    (1)         /* 00: [V2] System has LPC or ISA bus devices */  #define ACPI_FADT_8042              (1<<1)      /* 01: [V3] System has an 8042 controller on port 60/64 */ @@ -315,13 +321,13 @@ typedef struct acpi_table_fadt  /* Masks for FADT flags */ -#define ACPI_FADT_WBINVD            (1)         /* 00: [V1] The wbinvd instruction works properly */ -#define ACPI_FADT_WBINVD_FLUSH      (1<<1)      /* 01: [V1] wbinvd flushes but does not invalidate caches */ +#define ACPI_FADT_WBINVD            (1)         /* 00: [V1] The WBINVD instruction works properly */ +#define ACPI_FADT_WBINVD_FLUSH      (1<<1)      /* 01: [V1] WBINVD flushes but does not invalidate caches */  #define ACPI_FADT_C1_SUPPORTED      (1<<2)      /* 02: [V1] All processors support C1 state */  #define ACPI_FADT_C2_MP_SUPPORTED   (1<<3)      /* 03: [V1] C2 state works on MP system */  #define ACPI_FADT_POWER_BUTTON      (1<<4)      /* 04: [V1] Power button is handled as a control method device */  #define ACPI_FADT_SLEEP_BUTTON      (1<<5)      /* 05: [V1] Sleep button is handled as a control method device */ -#define ACPI_FADT_FIXED_RTC         (1<<6)      /* 06: [V1] RTC wakeup status not in fixed register space */ +#define ACPI_FADT_FIXED_RTC         (1<<6)      /* 06: [V1] RTC wakeup status is not in fixed register space */  #define ACPI_FADT_S4_RTC_WAKE       (1<<7)      /* 07: [V1] RTC alarm can wake system from S4 */  #define ACPI_FADT_32BIT_TIMER       (1<<8)      /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */  #define ACPI_FADT_DOCKING_SUPPORTED (1<<9)      /* 09: [V1] Docking supported */ @@ -339,9 +345,9 @@ typedef struct acpi_table_fadt  #define ACPI_FADT_LOW_POWER_S0      (1<<21)     /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */ -/* Values for PreferredProfile (Prefered Power Management Profiles) */ +/* Values for PreferredProfile (Preferred Power Management Profiles) */ -enum AcpiPreferedPmProfiles +enum AcpiPreferredPmProfiles  {      PM_UNSPECIFIED          = 0,      PM_DESKTOP              = 1, @@ -384,7 +390,7 @@ typedef struct acpi_table_desc  {      ACPI_PHYSICAL_ADDRESS           Address;      ACPI_TABLE_HEADER               *Pointer; -    UINT32                          Length;     /* Length fixed at 32 bits */ +    UINT32                          Length;     /* Length fixed at 32 bits (fixed in table header) */      ACPI_NAME_UNION                 Signature;      ACPI_OWNER_ID                   OwnerId;      UINT8                           Flags; diff --git a/source/include/actbl1.h b/source/include/actbl1.h index c24178f9c4093..c95d0c944e3dc 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -82,9 +82,15 @@  #pragma pack(1)  /* - * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661   */ diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 70c6a09a3c3f5..44f7de321b584 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -65,6 +65,8 @@   */  #define ACPI_SIG_ASF            "ASF!"      /* Alert Standard Format table */  #define ACPI_SIG_BOOT           "BOOT"      /* Simple Boot Flag Table */ +#define ACPI_SIG_CSRT           "CSRT"      /* Core System Resource Table */ +#define ACPI_SIG_DBG2           "DBG2"      /* Debug Port table type 2 */  #define ACPI_SIG_DBGP           "DBGP"      /* Debug Port table */  #define ACPI_SIG_DMAR           "DMAR"      /* DMA Remapping table */  #define ACPI_SIG_HPET           "HPET"      /* High Precision Event Timer table */ @@ -98,9 +100,15 @@  #pragma pack(1)  /* - * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661   */ @@ -264,6 +272,128 @@ typedef struct acpi_table_boot  /*******************************************************************************   * + * CSRT - Core System Resource Table + *        Version 0 + * + * Conforms to the "Core System Resource Table (CSRT)", November 14, 2011 + * + ******************************************************************************/ + +typedef struct acpi_table_csrt +{ +    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */ + +} ACPI_TABLE_CSRT; + +/* Resource Group subtable */ + +typedef struct acpi_csrt_group +{ +    UINT32                  Length; +    UINT32                  VendorId; +    UINT32                  SubvendorId; +    UINT16                  DeviceId; +    UINT16                  SubdeviceId; +    UINT16                  Revision; +    UINT16                  Reserved; +    UINT32                  InfoLength; + +    /* Shared data (length = InfoLength) immediately follows */ + +} ACPI_CSRT_GROUP; + +/* Resource Descriptor subtable */ + +typedef struct acpi_csrt_descriptor +{ +    UINT32                  Length; +    UINT16                  Type; +    UINT16                  Subtype; +    UINT32                  Uid; + +    /* Resource-specific information immediately follows */ + +} ACPI_CSRT_DESCRIPTOR; + + +/* Resource Types */ + +#define ACPI_CSRT_TYPE_INTERRUPT    0x0001 +#define ACPI_CSRT_TYPE_TIMER        0x0002 +#define ACPI_CSRT_TYPE_DMA          0x0003 + +/* Resource Subtypes */ + +#define ACPI_CSRT_XRUPT_LINE        0x0000 +#define ACPI_CSRT_XRUPT_CONTROLLER  0x0001 +#define ACPI_CSRT_TIMER             0x0000 +#define ACPI_CSRT_DMA_CHANNEL       0x0000 +#define ACPI_CSRT_DMA_CONTROLLER    0x0001 + + +/******************************************************************************* + * + * DBG2 - Debug Port Table 2 + *        Version 0 (Both main table and subtables) + * + * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012. + * + ******************************************************************************/ + +typedef struct acpi_table_dbg2 +{ +    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */ +    UINT32                  InfoOffset; +    UINT32                  InfoCount; + +} ACPI_TABLE_DBG2; + + +/* Debug Device Information Subtable */ + +typedef struct acpi_dbg2_device +{ +    UINT8                   Revision; +    UINT16                  Length; +    UINT8                   RegisterCount;      /* Number of BaseAddress registers */ +    UINT16                  NamepathLength; +    UINT16                  NamepathOffset; +    UINT16                  OemDataLength; +    UINT16                  OemDataOffset; +    UINT16                  PortType; +    UINT16                  PortSubtype; +    UINT16                  Reserved; +    UINT16                  BaseAddressOffset; +    UINT16                  AddressSizeOffset; +    /* +     * Data that follows: +     *    BaseAddress (required) - Each in 12-byte Generic Address Structure format. +     *    AddressSize (required) - Array of UINT32 sizes corresponding to each BaseAddress register. +     *    Namepath    (required) - Null terminated string. Single dot if not supported. +     *    OemData     (optional) - Length is OemDataLength. +     */ +} ACPI_DBG2_DEVICE; + +/* Types for PortType field above */ + +#define ACPI_DBG2_SERIAL_PORT       0x8000 +#define ACPI_DBG2_1394_PORT         0x8001 +#define ACPI_DBG2_USB_PORT          0x8002 +#define ACPI_DBG2_NET_PORT          0x8003 + +/* Subtypes for PortSubtype field above */ + +#define ACPI_DBG2_16550_COMPATIBLE  0x0000 +#define ACPI_DBG2_16550_SUBSET      0x0001 + +#define ACPI_DBG2_1394_STANDARD     0x0000 + +#define ACPI_DBG2_USB_XHCI          0x0000 +#define ACPI_DBG2_USB_EHCI          0x0001 + + +/******************************************************************************* + *   * DBGP - Debug Port table   *        Version 1   * diff --git a/source/include/actbl3.h b/source/include/actbl3.h index c5dd4184dd516..ce0b1581bfe47 100644 --- a/source/include/actbl3.h +++ b/source/include/actbl3.h @@ -77,7 +77,6 @@  /* Reserved table signatures */  #define ACPI_SIG_CSRT           "CSRT"      /* Core System Resources Table */ -#define ACPI_SIG_DBG2           "DBG2"      /* Debug Port table 2 */  #define ACPI_SIG_MATR           "MATR"      /* Memory Address Translation Table */  #define ACPI_SIG_MSDM           "MSDM"      /* Microsoft Data Management Table */  #define ACPI_SIG_WPBT           "WPBT"      /* Windows Platform Binary Table */ @@ -89,9 +88,15 @@  #pragma pack(1)  /* - * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. - * This is the only type that is even remotely portable. Anything else is not - * portable, so do not use any other bitfield types. + * Note: C bitfields are not used for this reason: + * + * "Bitfields are great and easy to read, but unfortunately the C language + * does not specify the layout of bitfields in memory, which means they are + * essentially useless for dealing with packed data in on-disk formats or + * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, + * this decision was a design error in C. Ritchie could have picked an order + * and stuck with it." Norman Ramsey. + * See http://stackoverflow.com/a/1053662/41661   */ diff --git a/source/include/actypes.h b/source/include/actypes.h index 53ebc91b08636..eef510acd4843 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -520,13 +520,6 @@ typedef UINT64                          ACPI_INTEGER;  #define ACPI_SLEEP_TYPE_INVALID         0xFF  /* - * Sleep/Wake flags - */ -#define ACPI_NO_OPTIONAL_METHODS        0x00 /* Do not execute any optional methods */ -#define ACPI_EXECUTE_GTS                0x01 /* For enter sleep interface */ -#define ACPI_EXECUTE_BFS                0x02 /* For leave sleep prep interface */ - -/*   * Standard notify values   */  #define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0x00 @@ -809,8 +802,7 @@ typedef UINT8                           ACPI_ADR_SPACE_TYPE;  /* Sleep function dispatch */  typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) ( -    UINT8                   SleepState, -    UINT8                   Flags); +    UINT8                   SleepState);  typedef struct acpi_sleep_functions  { diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index db270626c7f2f..8dfc143f8976d 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -180,6 +180,9 @@  #elif defined(_AED_EFI)  #include "acefi.h" +#elif defined(__HAIKU__) +#include "achaiku.h" +  #else  /* Unknown environment */ diff --git a/source/include/platform/achaiku.h b/source/include/platform/achaiku.h new file mode 100644 index 0000000000000..754723d7836d5 --- /dev/null +++ b/source/include/platform/achaiku.h @@ -0,0 +1,105 @@ +/****************************************************************************** + * + * Name: achaiku.h - OS specific defines, etc. for Haiku (www.haiku-os.org) + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions, and the following disclaimer, + *    without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *    substantially similar to the "NO WARRANTY" disclaimer below + *    ("Disclaimer") and any redistribution must be conditioned upon + *    including a substantially similar Disclaimer requirement for further + *    binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + *    of any contributors may be used to endorse or promote products derived + *    from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef __ACHAIKU_H__ +#define __ACHAIKU_H__ + +#include "acgcc.h" +#include <KernelExport.h> + +struct mutex; + + +/* Host-dependent types and defines for user- and kernel-space ACPICA */ + +#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_STANDARD_HEADERS + +#define ACPI_MUTEX_TYPE             ACPI_OSL_MUTEX +#define ACPI_MUTEX                  struct mutex * + +#define ACPI_USE_NATIVE_DIVIDE + +// #define ACPI_THREAD_ID               thread_id +#define ACPI_SEMAPHORE              sem_id +#define ACPI_SPINLOCK               spinlock * +#define ACPI_CPU_FLAGS              cpu_status + +#define COMPILER_DEPENDENT_INT64    int64 +#define COMPILER_DEPENDENT_UINT64   uint64 + + +#ifdef B_HAIKU_64_BIT +#define ACPI_MACHINE_WIDTH          64 +#else +#define ACPI_MACHINE_WIDTH          32 +#endif + + +#ifdef _KERNEL_MODE +/* Host-dependent types and defines for in-kernel ACPICA */ + +/* ACPICA cache implementation is adequate. */ +#define ACPI_USE_LOCAL_CACHE + +#define ACPI_FLUSH_CPU_CACHE() __asm __volatile("wbinvd"); + +/* Based on FreeBSD's due to lack of documentation */ +extern int AcpiOsAcquireGlobalLock(uint32 *lock); +extern int AcpiOsReleaseGlobalLock(uint32 *lock); + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)    do {                \ +        (Acq) = AcpiOsAcquireGlobalLock(&((GLptr)->GlobalLock));    \ +} while (0) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)    do {                \ +        (Acq) = AcpiOsReleaseGlobalLock(&((GLptr)->GlobalLock));    \ +} while (0) + +#else /* _KERNEL_MODE */ +/* Host-dependent types and defines for user-space ACPICA */ + +#error "We only support kernel mode ACPI atm." + +#endif /* _KERNEL_MODE */ +#endif /* __ACHAIKU_H__ */  | 
