Home | History | Annotate | Line # | Download | only in include
actbl1.h revision 1.12
      1   1.1    jruoho /******************************************************************************
      2   1.1    jruoho  *
      3   1.1    jruoho  * Name: actbl1.h - Additional ACPI table definitions
      4   1.1    jruoho  *
      5   1.1    jruoho  *****************************************************************************/
      6   1.1    jruoho 
      7   1.3    jruoho /*
      8  1.10  christos  * Copyright (C) 2000 - 2017, Intel Corp.
      9   1.1    jruoho  * All rights reserved.
     10   1.1    jruoho  *
     11   1.3    jruoho  * Redistribution and use in source and binary forms, with or without
     12   1.3    jruoho  * modification, are permitted provided that the following conditions
     13   1.3    jruoho  * are met:
     14   1.3    jruoho  * 1. Redistributions of source code must retain the above copyright
     15   1.3    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16   1.3    jruoho  *    without modification.
     17   1.3    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18   1.3    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19   1.3    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20   1.3    jruoho  *    including a substantially similar Disclaimer requirement for further
     21   1.3    jruoho  *    binary redistribution.
     22   1.3    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23   1.3    jruoho  *    of any contributors may be used to endorse or promote products derived
     24   1.3    jruoho  *    from this software without specific prior written permission.
     25   1.3    jruoho  *
     26   1.3    jruoho  * Alternatively, this software may be distributed under the terms of the
     27   1.3    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28   1.3    jruoho  * Software Foundation.
     29   1.3    jruoho  *
     30   1.3    jruoho  * NO WARRANTY
     31   1.3    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32   1.3    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33   1.3    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34   1.3    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35   1.3    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36   1.3    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37   1.3    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38   1.3    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39   1.3    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40   1.3    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41   1.3    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42   1.3    jruoho  */
     43   1.1    jruoho 
     44   1.1    jruoho #ifndef __ACTBL1_H__
     45   1.1    jruoho #define __ACTBL1_H__
     46   1.1    jruoho 
     47   1.1    jruoho 
     48   1.1    jruoho /*******************************************************************************
     49   1.1    jruoho  *
     50   1.1    jruoho  * Additional ACPI Tables (1)
     51   1.1    jruoho  *
     52   1.1    jruoho  * These tables are not consumed directly by the ACPICA subsystem, but are
     53   1.1    jruoho  * included here to support device drivers and the AML disassembler.
     54   1.1    jruoho  *
     55   1.1    jruoho  * The tables in this file are fully defined within the ACPI specification.
     56   1.1    jruoho  *
     57   1.1    jruoho  ******************************************************************************/
     58   1.1    jruoho 
     59   1.1    jruoho 
     60   1.1    jruoho /*
     61   1.1    jruoho  * Values for description table header signatures for tables defined in this
     62   1.1    jruoho  * file. Useful because they make it more difficult to inadvertently type in
     63   1.1    jruoho  * the wrong signature.
     64   1.1    jruoho  */
     65   1.1    jruoho #define ACPI_SIG_BERT           "BERT"      /* Boot Error Record Table */
     66   1.1    jruoho #define ACPI_SIG_CPEP           "CPEP"      /* Corrected Platform Error Polling table */
     67   1.1    jruoho #define ACPI_SIG_ECDT           "ECDT"      /* Embedded Controller Boot Resources Table */
     68   1.1    jruoho #define ACPI_SIG_EINJ           "EINJ"      /* Error Injection table */
     69   1.1    jruoho #define ACPI_SIG_ERST           "ERST"      /* Error Record Serialization Table */
     70  1.11  christos #define ACPI_SIG_HMAT           "HMAT"      /* Heterogeneous Memory Attributes Table */
     71   1.1    jruoho #define ACPI_SIG_HEST           "HEST"      /* Hardware Error Source Table */
     72   1.1    jruoho #define ACPI_SIG_MADT           "APIC"      /* Multiple APIC Description Table */
     73   1.1    jruoho #define ACPI_SIG_MSCT           "MSCT"      /* Maximum System Characteristics Table */
     74  1.12  christos #define ACPI_SIG_PDTT           "PDTT"      /* Platform Debug Trigger Table */
     75  1.11  christos #define ACPI_SIG_PPTT           "PPTT"      /* Processor Properties Topology Table */
     76   1.1    jruoho #define ACPI_SIG_SBST           "SBST"      /* Smart Battery Specification Table */
     77  1.12  christos #define ACPI_SIG_SDEV           "SDEV"      /* Secure Devices table */
     78   1.1    jruoho #define ACPI_SIG_SLIT           "SLIT"      /* System Locality Distance Information Table */
     79   1.1    jruoho #define ACPI_SIG_SRAT           "SRAT"      /* System Resource Affinity Table */
     80   1.7  christos #define ACPI_SIG_NFIT           "NFIT"      /* NVDIMM Firmware Interface Table */
     81   1.1    jruoho 
     82   1.1    jruoho 
     83   1.1    jruoho /*
     84   1.1    jruoho  * All tables must be byte-packed to match the ACPI specification, since
     85   1.1    jruoho  * the tables are provided by the system BIOS.
     86   1.1    jruoho  */
     87   1.1    jruoho #pragma pack(1)
     88   1.1    jruoho 
     89   1.1    jruoho /*
     90   1.4  christos  * Note: C bitfields are not used for this reason:
     91   1.4  christos  *
     92   1.4  christos  * "Bitfields are great and easy to read, but unfortunately the C language
     93   1.4  christos  * does not specify the layout of bitfields in memory, which means they are
     94   1.4  christos  * essentially useless for dealing with packed data in on-disk formats or
     95   1.4  christos  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
     96   1.4  christos  * this decision was a design error in C. Ritchie could have picked an order
     97   1.4  christos  * and stuck with it." Norman Ramsey.
     98   1.4  christos  * See http://stackoverflow.com/a/1053662/41661
     99   1.1    jruoho  */
    100   1.1    jruoho 
    101   1.1    jruoho 
    102   1.1    jruoho /*******************************************************************************
    103   1.1    jruoho  *
    104   1.1    jruoho  * Common subtable headers
    105   1.1    jruoho  *
    106   1.1    jruoho  ******************************************************************************/
    107   1.1    jruoho 
    108   1.1    jruoho /* Generic subtable header (used in MADT, SRAT, etc.) */
    109   1.1    jruoho 
    110   1.1    jruoho typedef struct acpi_subtable_header
    111   1.1    jruoho {
    112   1.1    jruoho     UINT8                   Type;
    113   1.1    jruoho     UINT8                   Length;
    114   1.1    jruoho 
    115   1.1    jruoho } ACPI_SUBTABLE_HEADER;
    116   1.1    jruoho 
    117   1.1    jruoho 
    118   1.1    jruoho /* Subtable header for WHEA tables (EINJ, ERST, WDAT) */
    119   1.1    jruoho 
    120   1.1    jruoho typedef struct acpi_whea_header
    121   1.1    jruoho {
    122   1.1    jruoho     UINT8                   Action;
    123   1.1    jruoho     UINT8                   Instruction;
    124   1.1    jruoho     UINT8                   Flags;
    125   1.1    jruoho     UINT8                   Reserved;
    126   1.1    jruoho     ACPI_GENERIC_ADDRESS    RegisterRegion;
    127   1.1    jruoho     UINT64                  Value;              /* Value used with Read/Write register */
    128   1.1    jruoho     UINT64                  Mask;               /* Bitmask required for this register instruction */
    129   1.1    jruoho 
    130   1.1    jruoho } ACPI_WHEA_HEADER;
    131   1.1    jruoho 
    132   1.1    jruoho 
    133   1.1    jruoho /*******************************************************************************
    134   1.1    jruoho  *
    135   1.1    jruoho  * BERT - Boot Error Record Table (ACPI 4.0)
    136   1.1    jruoho  *        Version 1
    137   1.1    jruoho  *
    138   1.1    jruoho  ******************************************************************************/
    139   1.1    jruoho 
    140   1.1    jruoho typedef struct acpi_table_bert
    141   1.1    jruoho {
    142   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
    143   1.1    jruoho     UINT32                  RegionLength;       /* Length of the boot error region */
    144   1.4  christos     UINT64                  Address;            /* Physical address of the error region */
    145   1.1    jruoho 
    146   1.1    jruoho } ACPI_TABLE_BERT;
    147   1.1    jruoho 
    148   1.1    jruoho 
    149   1.1    jruoho /* Boot Error Region (not a subtable, pointed to by Address field above) */
    150   1.1    jruoho 
    151   1.1    jruoho typedef struct acpi_bert_region
    152   1.1    jruoho {
    153   1.1    jruoho     UINT32                  BlockStatus;        /* Type of error information */
    154   1.1    jruoho     UINT32                  RawDataOffset;      /* Offset to raw error data */
    155   1.1    jruoho     UINT32                  RawDataLength;      /* Length of raw error data */
    156   1.1    jruoho     UINT32                  DataLength;         /* Length of generic error data */
    157   1.1    jruoho     UINT32                  ErrorSeverity;      /* Severity code */
    158   1.1    jruoho 
    159   1.1    jruoho } ACPI_BERT_REGION;
    160   1.1    jruoho 
    161   1.1    jruoho /* Values for BlockStatus flags above */
    162   1.1    jruoho 
    163   1.1    jruoho #define ACPI_BERT_UNCORRECTABLE             (1)
    164   1.1    jruoho #define ACPI_BERT_CORRECTABLE               (1<<1)
    165   1.1    jruoho #define ACPI_BERT_MULTIPLE_UNCORRECTABLE    (1<<2)
    166   1.1    jruoho #define ACPI_BERT_MULTIPLE_CORRECTABLE      (1<<3)
    167   1.1    jruoho #define ACPI_BERT_ERROR_ENTRY_COUNT         (0xFF<<4) /* 8 bits, error count */
    168   1.1    jruoho 
    169   1.1    jruoho /* Values for ErrorSeverity above */
    170   1.1    jruoho 
    171   1.1    jruoho enum AcpiBertErrorSeverity
    172   1.1    jruoho {
    173   1.1    jruoho     ACPI_BERT_ERROR_CORRECTABLE     = 0,
    174   1.1    jruoho     ACPI_BERT_ERROR_FATAL           = 1,
    175   1.1    jruoho     ACPI_BERT_ERROR_CORRECTED       = 2,
    176   1.1    jruoho     ACPI_BERT_ERROR_NONE            = 3,
    177   1.1    jruoho     ACPI_BERT_ERROR_RESERVED        = 4     /* 4 and greater are reserved */
    178   1.1    jruoho };
    179   1.1    jruoho 
    180   1.1    jruoho /*
    181   1.1    jruoho  * Note: The generic error data that follows the ErrorSeverity field above
    182   1.1    jruoho  * uses the ACPI_HEST_GENERIC_DATA defined under the HEST table below
    183   1.1    jruoho  */
    184   1.1    jruoho 
    185   1.1    jruoho 
    186   1.1    jruoho /*******************************************************************************
    187   1.1    jruoho  *
    188   1.1    jruoho  * CPEP - Corrected Platform Error Polling table (ACPI 4.0)
    189   1.1    jruoho  *        Version 1
    190   1.1    jruoho  *
    191   1.1    jruoho  ******************************************************************************/
    192   1.1    jruoho 
    193   1.1    jruoho typedef struct acpi_table_cpep
    194   1.1    jruoho {
    195   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
    196   1.1    jruoho     UINT64                  Reserved;
    197   1.1    jruoho 
    198   1.1    jruoho } ACPI_TABLE_CPEP;
    199   1.1    jruoho 
    200   1.1    jruoho 
    201   1.1    jruoho /* Subtable */
    202   1.1    jruoho 
    203   1.1    jruoho typedef struct acpi_cpep_polling
    204   1.1    jruoho {
    205   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
    206   1.1    jruoho     UINT8                   Id;                 /* Processor ID */
    207   1.1    jruoho     UINT8                   Eid;                /* Processor EID */
    208   1.1    jruoho     UINT32                  Interval;           /* Polling interval (msec) */
    209   1.1    jruoho 
    210   1.1    jruoho } ACPI_CPEP_POLLING;
    211   1.1    jruoho 
    212   1.1    jruoho 
    213   1.1    jruoho /*******************************************************************************
    214   1.1    jruoho  *
    215   1.1    jruoho  * ECDT - Embedded Controller Boot Resources Table
    216   1.1    jruoho  *        Version 1
    217   1.1    jruoho  *
    218   1.1    jruoho  ******************************************************************************/
    219   1.1    jruoho 
    220   1.1    jruoho typedef struct acpi_table_ecdt
    221   1.1    jruoho {
    222   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
    223   1.1    jruoho     ACPI_GENERIC_ADDRESS    Control;            /* Address of EC command/status register */
    224   1.1    jruoho     ACPI_GENERIC_ADDRESS    Data;               /* Address of EC data register */
    225   1.1    jruoho     UINT32                  Uid;                /* Unique ID - must be same as the EC _UID method */
    226   1.1    jruoho     UINT8                   Gpe;                /* The GPE for the EC */
    227   1.1    jruoho     UINT8                   Id[1];              /* Full namepath of the EC in the ACPI namespace */
    228   1.1    jruoho 
    229   1.1    jruoho } ACPI_TABLE_ECDT;
    230   1.1    jruoho 
    231   1.1    jruoho 
    232   1.1    jruoho /*******************************************************************************
    233   1.1    jruoho  *
    234   1.1    jruoho  * EINJ - Error Injection Table (ACPI 4.0)
    235   1.1    jruoho  *        Version 1
    236   1.1    jruoho  *
    237   1.1    jruoho  ******************************************************************************/
    238   1.1    jruoho 
    239   1.1    jruoho typedef struct acpi_table_einj
    240   1.1    jruoho {
    241   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
    242   1.1    jruoho     UINT32                  HeaderLength;
    243   1.1    jruoho     UINT8                   Flags;
    244   1.1    jruoho     UINT8                   Reserved[3];
    245   1.1    jruoho     UINT32                  Entries;
    246   1.1    jruoho 
    247   1.1    jruoho } ACPI_TABLE_EINJ;
    248   1.1    jruoho 
    249   1.1    jruoho 
    250   1.1    jruoho /* EINJ Injection Instruction Entries (actions) */
    251   1.1    jruoho 
    252   1.1    jruoho typedef struct acpi_einj_entry
    253   1.1    jruoho {
    254   1.1    jruoho     ACPI_WHEA_HEADER        WheaHeader;         /* Common header for WHEA tables */
    255   1.1    jruoho 
    256   1.1    jruoho } ACPI_EINJ_ENTRY;
    257   1.1    jruoho 
    258   1.1    jruoho /* Masks for Flags field above */
    259   1.1    jruoho 
    260   1.1    jruoho #define ACPI_EINJ_PRESERVE          (1)
    261   1.1    jruoho 
    262   1.1    jruoho /* Values for Action field above */
    263   1.1    jruoho 
    264   1.1    jruoho enum AcpiEinjActions
    265   1.1    jruoho {
    266   1.4  christos     ACPI_EINJ_BEGIN_OPERATION               = 0,
    267   1.4  christos     ACPI_EINJ_GET_TRIGGER_TABLE             = 1,
    268   1.4  christos     ACPI_EINJ_SET_ERROR_TYPE                = 2,
    269   1.4  christos     ACPI_EINJ_GET_ERROR_TYPE                = 3,
    270   1.4  christos     ACPI_EINJ_END_OPERATION                 = 4,
    271   1.4  christos     ACPI_EINJ_EXECUTE_OPERATION             = 5,
    272   1.4  christos     ACPI_EINJ_CHECK_BUSY_STATUS             = 6,
    273   1.4  christos     ACPI_EINJ_GET_COMMAND_STATUS            = 7,
    274   1.4  christos     ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS   = 8,
    275   1.9  christos     ACPI_EINJ_GET_EXECUTE_TIMINGS           = 9,
    276   1.9  christos     ACPI_EINJ_ACTION_RESERVED               = 10,    /* 10 and greater are reserved */
    277   1.4  christos     ACPI_EINJ_TRIGGER_ERROR                 = 0xFF   /* Except for this value */
    278   1.1    jruoho };
    279   1.1    jruoho 
    280   1.1    jruoho /* Values for Instruction field above */
    281   1.1    jruoho 
    282   1.1    jruoho enum AcpiEinjInstructions
    283   1.1    jruoho {
    284   1.1    jruoho     ACPI_EINJ_READ_REGISTER         = 0,
    285   1.1    jruoho     ACPI_EINJ_READ_REGISTER_VALUE   = 1,
    286   1.1    jruoho     ACPI_EINJ_WRITE_REGISTER        = 2,
    287   1.1    jruoho     ACPI_EINJ_WRITE_REGISTER_VALUE  = 3,
    288   1.1    jruoho     ACPI_EINJ_NOOP                  = 4,
    289   1.4  christos     ACPI_EINJ_FLUSH_CACHELINE       = 5,
    290   1.4  christos     ACPI_EINJ_INSTRUCTION_RESERVED  = 6     /* 6 and greater are reserved */
    291   1.1    jruoho };
    292   1.1    jruoho 
    293   1.4  christos typedef struct acpi_einj_error_type_with_addr
    294   1.4  christos {
    295   1.4  christos     UINT32                  ErrorType;
    296   1.4  christos     UINT32                  VendorStructOffset;
    297   1.4  christos     UINT32                  Flags;
    298   1.4  christos     UINT32                  ApicId;
    299   1.4  christos     UINT64                  Address;
    300   1.4  christos     UINT64                  Range;
    301   1.4  christos     UINT32                  PcieId;
    302   1.4  christos 
    303   1.4  christos } ACPI_EINJ_ERROR_TYPE_WITH_ADDR;
    304   1.4  christos 
    305   1.4  christos typedef struct acpi_einj_vendor
    306   1.4  christos {
    307   1.4  christos     UINT32                  Length;
    308   1.4  christos     UINT32                  PcieId;
    309   1.4  christos     UINT16                  VendorId;
    310   1.4  christos     UINT16                  DeviceId;
    311   1.4  christos     UINT8                   RevisionId;
    312   1.4  christos     UINT8                   Reserved[3];
    313   1.4  christos 
    314   1.4  christos } ACPI_EINJ_VENDOR;
    315   1.4  christos 
    316   1.1    jruoho 
    317   1.1    jruoho /* EINJ Trigger Error Action Table */
    318   1.1    jruoho 
    319   1.1    jruoho typedef struct acpi_einj_trigger
    320   1.1    jruoho {
    321   1.1    jruoho     UINT32                  HeaderSize;
    322   1.1    jruoho     UINT32                  Revision;
    323   1.1    jruoho     UINT32                  TableSize;
    324   1.1    jruoho     UINT32                  EntryCount;
    325   1.1    jruoho 
    326   1.1    jruoho } ACPI_EINJ_TRIGGER;
    327   1.1    jruoho 
    328   1.1    jruoho /* Command status return values */
    329   1.1    jruoho 
    330   1.1    jruoho enum AcpiEinjCommandStatus
    331   1.1    jruoho {
    332   1.1    jruoho     ACPI_EINJ_SUCCESS               = 0,
    333   1.1    jruoho     ACPI_EINJ_FAILURE               = 1,
    334   1.1    jruoho     ACPI_EINJ_INVALID_ACCESS        = 2,
    335   1.1    jruoho     ACPI_EINJ_STATUS_RESERVED       = 3     /* 3 and greater are reserved */
    336   1.1    jruoho };
    337   1.1    jruoho 
    338   1.1    jruoho 
    339   1.1    jruoho /* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */
    340   1.1    jruoho 
    341   1.1    jruoho #define ACPI_EINJ_PROCESSOR_CORRECTABLE     (1)
    342   1.1    jruoho #define ACPI_EINJ_PROCESSOR_UNCORRECTABLE   (1<<1)
    343   1.1    jruoho #define ACPI_EINJ_PROCESSOR_FATAL           (1<<2)
    344   1.1    jruoho #define ACPI_EINJ_MEMORY_CORRECTABLE        (1<<3)
    345   1.1    jruoho #define ACPI_EINJ_MEMORY_UNCORRECTABLE      (1<<4)
    346   1.1    jruoho #define ACPI_EINJ_MEMORY_FATAL              (1<<5)
    347   1.1    jruoho #define ACPI_EINJ_PCIX_CORRECTABLE          (1<<6)
    348   1.1    jruoho #define ACPI_EINJ_PCIX_UNCORRECTABLE        (1<<7)
    349   1.1    jruoho #define ACPI_EINJ_PCIX_FATAL                (1<<8)
    350   1.1    jruoho #define ACPI_EINJ_PLATFORM_CORRECTABLE      (1<<9)
    351   1.1    jruoho #define ACPI_EINJ_PLATFORM_UNCORRECTABLE    (1<<10)
    352   1.1    jruoho #define ACPI_EINJ_PLATFORM_FATAL            (1<<11)
    353   1.4  christos #define ACPI_EINJ_VENDOR_DEFINED            (1<<31)
    354   1.1    jruoho 
    355   1.1    jruoho 
    356   1.1    jruoho /*******************************************************************************
    357   1.1    jruoho  *
    358   1.1    jruoho  * ERST - Error Record Serialization Table (ACPI 4.0)
    359   1.1    jruoho  *        Version 1
    360   1.1    jruoho  *
    361   1.1    jruoho  ******************************************************************************/
    362   1.1    jruoho 
    363   1.1    jruoho typedef struct acpi_table_erst
    364   1.1    jruoho {
    365   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
    366   1.1    jruoho     UINT32                  HeaderLength;
    367   1.1    jruoho     UINT32                  Reserved;
    368   1.1    jruoho     UINT32                  Entries;
    369   1.1    jruoho 
    370   1.1    jruoho } ACPI_TABLE_ERST;
    371   1.1    jruoho 
    372   1.1    jruoho 
    373   1.1    jruoho /* ERST Serialization Entries (actions) */
    374   1.1    jruoho 
    375   1.1    jruoho typedef struct acpi_erst_entry
    376   1.1    jruoho {
    377   1.1    jruoho     ACPI_WHEA_HEADER        WheaHeader;         /* Common header for WHEA tables */
    378   1.1    jruoho 
    379   1.1    jruoho } ACPI_ERST_ENTRY;
    380   1.1    jruoho 
    381   1.1    jruoho /* Masks for Flags field above */
    382   1.1    jruoho 
    383   1.1    jruoho #define ACPI_ERST_PRESERVE          (1)
    384   1.1    jruoho 
    385   1.1    jruoho /* Values for Action field above */
    386   1.1    jruoho 
    387   1.1    jruoho enum AcpiErstActions
    388   1.1    jruoho {
    389   1.1    jruoho     ACPI_ERST_BEGIN_WRITE           = 0,
    390   1.1    jruoho     ACPI_ERST_BEGIN_READ            = 1,
    391   1.1    jruoho     ACPI_ERST_BEGIN_CLEAR           = 2,
    392   1.1    jruoho     ACPI_ERST_END                   = 3,
    393   1.1    jruoho     ACPI_ERST_SET_RECORD_OFFSET     = 4,
    394   1.1    jruoho     ACPI_ERST_EXECUTE_OPERATION     = 5,
    395   1.1    jruoho     ACPI_ERST_CHECK_BUSY_STATUS     = 6,
    396   1.1    jruoho     ACPI_ERST_GET_COMMAND_STATUS    = 7,
    397   1.1    jruoho     ACPI_ERST_GET_RECORD_ID         = 8,
    398   1.1    jruoho     ACPI_ERST_SET_RECORD_ID         = 9,
    399   1.1    jruoho     ACPI_ERST_GET_RECORD_COUNT      = 10,
    400   1.1    jruoho     ACPI_ERST_BEGIN_DUMMY_WRIITE    = 11,
    401   1.1    jruoho     ACPI_ERST_NOT_USED              = 12,
    402   1.1    jruoho     ACPI_ERST_GET_ERROR_RANGE       = 13,
    403   1.1    jruoho     ACPI_ERST_GET_ERROR_LENGTH      = 14,
    404   1.1    jruoho     ACPI_ERST_GET_ERROR_ATTRIBUTES  = 15,
    405   1.9  christos     ACPI_ERST_EXECUTE_TIMINGS       = 16,
    406   1.9  christos     ACPI_ERST_ACTION_RESERVED       = 17    /* 17 and greater are reserved */
    407   1.1    jruoho };
    408   1.1    jruoho 
    409   1.1    jruoho /* Values for Instruction field above */
    410   1.1    jruoho 
    411   1.1    jruoho enum AcpiErstInstructions
    412   1.1    jruoho {
    413   1.1    jruoho     ACPI_ERST_READ_REGISTER         = 0,
    414   1.1    jruoho     ACPI_ERST_READ_REGISTER_VALUE   = 1,
    415   1.1    jruoho     ACPI_ERST_WRITE_REGISTER        = 2,
    416   1.1    jruoho     ACPI_ERST_WRITE_REGISTER_VALUE  = 3,
    417   1.1    jruoho     ACPI_ERST_NOOP                  = 4,
    418   1.1    jruoho     ACPI_ERST_LOAD_VAR1             = 5,
    419   1.1    jruoho     ACPI_ERST_LOAD_VAR2             = 6,
    420   1.1    jruoho     ACPI_ERST_STORE_VAR1            = 7,
    421   1.1    jruoho     ACPI_ERST_ADD                   = 8,
    422   1.1    jruoho     ACPI_ERST_SUBTRACT              = 9,
    423   1.1    jruoho     ACPI_ERST_ADD_VALUE             = 10,
    424   1.1    jruoho     ACPI_ERST_SUBTRACT_VALUE        = 11,
    425   1.1    jruoho     ACPI_ERST_STALL                 = 12,
    426   1.1    jruoho     ACPI_ERST_STALL_WHILE_TRUE      = 13,
    427   1.1    jruoho     ACPI_ERST_SKIP_NEXT_IF_TRUE     = 14,
    428   1.1    jruoho     ACPI_ERST_GOTO                  = 15,
    429   1.1    jruoho     ACPI_ERST_SET_SRC_ADDRESS_BASE  = 16,
    430   1.1    jruoho     ACPI_ERST_SET_DST_ADDRESS_BASE  = 17,
    431   1.1    jruoho     ACPI_ERST_MOVE_DATA             = 18,
    432   1.1    jruoho     ACPI_ERST_INSTRUCTION_RESERVED  = 19    /* 19 and greater are reserved */
    433   1.1    jruoho };
    434   1.1    jruoho 
    435   1.1    jruoho /* Command status return values */
    436   1.1    jruoho 
    437   1.1    jruoho enum AcpiErstCommandStatus
    438   1.1    jruoho {
    439   1.1    jruoho     ACPI_ERST_SUCESS                = 0,
    440   1.1    jruoho     ACPI_ERST_NO_SPACE              = 1,
    441   1.1    jruoho     ACPI_ERST_NOT_AVAILABLE         = 2,
    442   1.1    jruoho     ACPI_ERST_FAILURE               = 3,
    443   1.1    jruoho     ACPI_ERST_RECORD_EMPTY          = 4,
    444   1.1    jruoho     ACPI_ERST_NOT_FOUND             = 5,
    445   1.1    jruoho     ACPI_ERST_STATUS_RESERVED       = 6     /* 6 and greater are reserved */
    446   1.1    jruoho };
    447   1.1    jruoho 
    448   1.1    jruoho 
    449   1.1    jruoho /* Error Record Serialization Information */
    450   1.1    jruoho 
    451   1.1    jruoho typedef struct acpi_erst_info
    452   1.1    jruoho {
    453   1.1    jruoho     UINT16                  Signature;          /* Should be "ER" */
    454   1.1    jruoho     UINT8                   Data[48];
    455   1.1    jruoho 
    456   1.1    jruoho } ACPI_ERST_INFO;
    457   1.1    jruoho 
    458   1.1    jruoho 
    459   1.1    jruoho /*******************************************************************************
    460   1.1    jruoho  *
    461   1.1    jruoho  * HEST - Hardware Error Source Table (ACPI 4.0)
    462   1.1    jruoho  *        Version 1
    463   1.1    jruoho  *
    464   1.1    jruoho  ******************************************************************************/
    465   1.1    jruoho 
    466   1.1    jruoho typedef struct acpi_table_hest
    467   1.1    jruoho {
    468   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
    469   1.1    jruoho     UINT32                  ErrorSourceCount;
    470   1.1    jruoho 
    471   1.1    jruoho } ACPI_TABLE_HEST;
    472   1.1    jruoho 
    473   1.1    jruoho 
    474   1.1    jruoho /* HEST subtable header */
    475   1.1    jruoho 
    476   1.1    jruoho typedef struct acpi_hest_header
    477   1.1    jruoho {
    478   1.1    jruoho     UINT16                  Type;
    479   1.1    jruoho     UINT16                  SourceId;
    480   1.1    jruoho 
    481   1.1    jruoho } ACPI_HEST_HEADER;
    482   1.1    jruoho 
    483   1.1    jruoho 
    484   1.1    jruoho /* Values for Type field above for subtables */
    485   1.1    jruoho 
    486   1.1    jruoho enum AcpiHestTypes
    487   1.1    jruoho {
    488   1.1    jruoho     ACPI_HEST_TYPE_IA32_CHECK           = 0,
    489   1.1    jruoho     ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1,
    490   1.1    jruoho     ACPI_HEST_TYPE_IA32_NMI             = 2,
    491   1.1    jruoho     ACPI_HEST_TYPE_NOT_USED3            = 3,
    492   1.1    jruoho     ACPI_HEST_TYPE_NOT_USED4            = 4,
    493   1.1    jruoho     ACPI_HEST_TYPE_NOT_USED5            = 5,
    494   1.1    jruoho     ACPI_HEST_TYPE_AER_ROOT_PORT        = 6,
    495   1.1    jruoho     ACPI_HEST_TYPE_AER_ENDPOINT         = 7,
    496   1.1    jruoho     ACPI_HEST_TYPE_AER_BRIDGE           = 8,
    497   1.1    jruoho     ACPI_HEST_TYPE_GENERIC_ERROR        = 9,
    498   1.9  christos     ACPI_HEST_TYPE_GENERIC_ERROR_V2     = 10,
    499  1.11  christos     ACPI_HEST_TYPE_IA32_DEFERRED_CHECK  = 11,
    500  1.11  christos     ACPI_HEST_TYPE_RESERVED             = 12    /* 12 and greater are reserved */
    501   1.1    jruoho };
    502   1.1    jruoho 
    503   1.1    jruoho 
    504   1.1    jruoho /*
    505   1.1    jruoho  * HEST substructures contained in subtables
    506   1.1    jruoho  */
    507   1.1    jruoho 
    508   1.1    jruoho /*
    509   1.1    jruoho  * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and
    510   1.1    jruoho  * ACPI_HEST_IA_CORRECTED structures.
    511   1.1    jruoho  */
    512   1.1    jruoho typedef struct acpi_hest_ia_error_bank
    513   1.1    jruoho {
    514   1.1    jruoho     UINT8                   BankNumber;
    515   1.1    jruoho     UINT8                   ClearStatusOnInit;
    516   1.1    jruoho     UINT8                   StatusFormat;
    517   1.1    jruoho     UINT8                   Reserved;
    518   1.1    jruoho     UINT32                  ControlRegister;
    519   1.1    jruoho     UINT64                  ControlData;
    520   1.1    jruoho     UINT32                  StatusRegister;
    521   1.1    jruoho     UINT32                  AddressRegister;
    522   1.1    jruoho     UINT32                  MiscRegister;
    523   1.1    jruoho 
    524   1.1    jruoho } ACPI_HEST_IA_ERROR_BANK;
    525   1.1    jruoho 
    526   1.1    jruoho 
    527   1.1    jruoho /* Common HEST sub-structure for PCI/AER structures below (6,7,8) */
    528   1.1    jruoho 
    529   1.1    jruoho typedef struct acpi_hest_aer_common
    530   1.1    jruoho {
    531   1.1    jruoho     UINT16                  Reserved1;
    532   1.1    jruoho     UINT8                   Flags;
    533   1.1    jruoho     UINT8                   Enabled;
    534   1.1    jruoho     UINT32                  RecordsToPreallocate;
    535   1.1    jruoho     UINT32                  MaxSectionsPerRecord;
    536   1.4  christos     UINT32                  Bus;                    /* Bus and Segment numbers */
    537   1.1    jruoho     UINT16                  Device;
    538   1.1    jruoho     UINT16                  Function;
    539   1.1    jruoho     UINT16                  DeviceControl;
    540   1.1    jruoho     UINT16                  Reserved2;
    541   1.1    jruoho     UINT32                  UncorrectableMask;
    542   1.1    jruoho     UINT32                  UncorrectableSeverity;
    543   1.1    jruoho     UINT32                  CorrectableMask;
    544   1.1    jruoho     UINT32                  AdvancedCapabilities;
    545   1.1    jruoho 
    546   1.1    jruoho } ACPI_HEST_AER_COMMON;
    547   1.1    jruoho 
    548   1.1    jruoho /* Masks for HEST Flags fields */
    549   1.1    jruoho 
    550   1.1    jruoho #define ACPI_HEST_FIRMWARE_FIRST        (1)
    551   1.1    jruoho #define ACPI_HEST_GLOBAL                (1<<1)
    552  1.11  christos #define ACPI_HEST_GHES_ASSIST           (1<<2)
    553   1.1    jruoho 
    554   1.4  christos /*
    555   1.4  christos  * Macros to access the bus/segment numbers in Bus field above:
    556   1.4  christos  *  Bus number is encoded in bits 7:0
    557   1.4  christos  *  Segment number is encoded in bits 23:8
    558   1.4  christos  */
    559   1.4  christos #define ACPI_HEST_BUS(Bus)              ((Bus) & 0xFF)
    560   1.4  christos #define ACPI_HEST_SEGMENT(Bus)          (((Bus) >> 8) & 0xFFFF)
    561   1.4  christos 
    562   1.1    jruoho 
    563   1.1    jruoho /* Hardware Error Notification */
    564   1.1    jruoho 
    565   1.1    jruoho typedef struct acpi_hest_notify
    566   1.1    jruoho {
    567   1.1    jruoho     UINT8                   Type;
    568   1.1    jruoho     UINT8                   Length;
    569   1.1    jruoho     UINT16                  ConfigWriteEnable;
    570   1.1    jruoho     UINT32                  PollInterval;
    571   1.1    jruoho     UINT32                  Vector;
    572   1.1    jruoho     UINT32                  PollingThresholdValue;
    573   1.1    jruoho     UINT32                  PollingThresholdWindow;
    574   1.1    jruoho     UINT32                  ErrorThresholdValue;
    575   1.1    jruoho     UINT32                  ErrorThresholdWindow;
    576   1.1    jruoho 
    577   1.1    jruoho } ACPI_HEST_NOTIFY;
    578   1.1    jruoho 
    579   1.1    jruoho /* Values for Notify Type field above */
    580   1.1    jruoho 
    581   1.1    jruoho enum AcpiHestNotifyTypes
    582   1.1    jruoho {
    583  1.11  christos     ACPI_HEST_NOTIFY_POLLED             = 0,
    584  1.11  christos     ACPI_HEST_NOTIFY_EXTERNAL           = 1,
    585  1.11  christos     ACPI_HEST_NOTIFY_LOCAL              = 2,
    586  1.11  christos     ACPI_HEST_NOTIFY_SCI                = 3,
    587  1.11  christos     ACPI_HEST_NOTIFY_NMI                = 4,
    588  1.11  christos     ACPI_HEST_NOTIFY_CMCI               = 5,    /* ACPI 5.0 */
    589  1.11  christos     ACPI_HEST_NOTIFY_MCE                = 6,    /* ACPI 5.0 */
    590  1.11  christos     ACPI_HEST_NOTIFY_GPIO               = 7,    /* ACPI 6.0 */
    591  1.11  christos     ACPI_HEST_NOTIFY_SEA                = 8,    /* ACPI 6.1 */
    592  1.11  christos     ACPI_HEST_NOTIFY_SEI                = 9,    /* ACPI 6.1 */
    593  1.11  christos     ACPI_HEST_NOTIFY_GSIV               = 10,   /* ACPI 6.1 */
    594  1.11  christos     ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED = 11,   /* ACPI 6.2 */
    595  1.11  christos     ACPI_HEST_NOTIFY_RESERVED           = 12    /* 12 and greater are reserved */
    596   1.1    jruoho };
    597   1.1    jruoho 
    598   1.1    jruoho /* Values for ConfigWriteEnable bitfield above */
    599   1.1    jruoho 
    600   1.1    jruoho #define ACPI_HEST_TYPE                  (1)
    601   1.1    jruoho #define ACPI_HEST_POLL_INTERVAL         (1<<1)
    602   1.1    jruoho #define ACPI_HEST_POLL_THRESHOLD_VALUE  (1<<2)
    603   1.1    jruoho #define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3)
    604   1.1    jruoho #define ACPI_HEST_ERR_THRESHOLD_VALUE   (1<<4)
    605   1.1    jruoho #define ACPI_HEST_ERR_THRESHOLD_WINDOW  (1<<5)
    606   1.1    jruoho 
    607   1.1    jruoho 
    608   1.1    jruoho /*
    609   1.1    jruoho  * HEST subtables
    610   1.1    jruoho  */
    611   1.1    jruoho 
    612   1.1    jruoho /* 0: IA32 Machine Check Exception */
    613   1.1    jruoho 
    614   1.1    jruoho typedef struct acpi_hest_ia_machine_check
    615   1.1    jruoho {
    616   1.1    jruoho     ACPI_HEST_HEADER        Header;
    617   1.1    jruoho     UINT16                  Reserved1;
    618  1.11  christos     UINT8                   Flags;              /* See flags ACPI_HEST_GLOBAL, etc. above */
    619   1.1    jruoho     UINT8                   Enabled;
    620   1.1    jruoho     UINT32                  RecordsToPreallocate;
    621   1.1    jruoho     UINT32                  MaxSectionsPerRecord;
    622   1.1    jruoho     UINT64                  GlobalCapabilityData;
    623   1.1    jruoho     UINT64                  GlobalControlData;
    624   1.1    jruoho     UINT8                   NumHardwareBanks;
    625   1.1    jruoho     UINT8                   Reserved3[7];
    626   1.1    jruoho 
    627   1.1    jruoho } ACPI_HEST_IA_MACHINE_CHECK;
    628   1.1    jruoho 
    629   1.1    jruoho 
    630   1.1    jruoho /* 1: IA32 Corrected Machine Check */
    631   1.1    jruoho 
    632   1.1    jruoho typedef struct acpi_hest_ia_corrected
    633   1.1    jruoho {
    634   1.1    jruoho     ACPI_HEST_HEADER        Header;
    635   1.1    jruoho     UINT16                  Reserved1;
    636  1.11  christos     UINT8                   Flags;              /* See flags ACPI_HEST_GLOBAL, etc. above */
    637   1.1    jruoho     UINT8                   Enabled;
    638   1.1    jruoho     UINT32                  RecordsToPreallocate;
    639   1.1    jruoho     UINT32                  MaxSectionsPerRecord;
    640   1.1    jruoho     ACPI_HEST_NOTIFY        Notify;
    641   1.1    jruoho     UINT8                   NumHardwareBanks;
    642   1.1    jruoho     UINT8                   Reserved2[3];
    643   1.1    jruoho 
    644   1.1    jruoho } ACPI_HEST_IA_CORRECTED;
    645   1.1    jruoho 
    646   1.1    jruoho 
    647   1.1    jruoho /* 2: IA32 Non-Maskable Interrupt */
    648   1.1    jruoho 
    649   1.1    jruoho typedef struct acpi_hest_ia_nmi
    650   1.1    jruoho {
    651   1.1    jruoho     ACPI_HEST_HEADER        Header;
    652   1.1    jruoho     UINT32                  Reserved;
    653   1.1    jruoho     UINT32                  RecordsToPreallocate;
    654   1.1    jruoho     UINT32                  MaxSectionsPerRecord;
    655   1.1    jruoho     UINT32                  MaxRawDataLength;
    656   1.1    jruoho 
    657   1.1    jruoho } ACPI_HEST_IA_NMI;
    658   1.1    jruoho 
    659   1.1    jruoho 
    660   1.1    jruoho /* 3,4,5: Not used */
    661   1.1    jruoho 
    662   1.1    jruoho /* 6: PCI Express Root Port AER */
    663   1.1    jruoho 
    664   1.1    jruoho typedef struct acpi_hest_aer_root
    665   1.1    jruoho {
    666   1.1    jruoho     ACPI_HEST_HEADER        Header;
    667   1.1    jruoho     ACPI_HEST_AER_COMMON    Aer;
    668   1.1    jruoho     UINT32                  RootErrorCommand;
    669   1.1    jruoho 
    670   1.1    jruoho } ACPI_HEST_AER_ROOT;
    671   1.1    jruoho 
    672   1.1    jruoho 
    673   1.1    jruoho /* 7: PCI Express AER (AER Endpoint) */
    674   1.1    jruoho 
    675   1.1    jruoho typedef struct acpi_hest_aer
    676   1.1    jruoho {
    677   1.1    jruoho     ACPI_HEST_HEADER        Header;
    678   1.1    jruoho     ACPI_HEST_AER_COMMON    Aer;
    679   1.1    jruoho 
    680   1.1    jruoho } ACPI_HEST_AER;
    681   1.1    jruoho 
    682   1.1    jruoho 
    683   1.1    jruoho /* 8: PCI Express/PCI-X Bridge AER */
    684   1.1    jruoho 
    685   1.1    jruoho typedef struct acpi_hest_aer_bridge
    686   1.1    jruoho {
    687   1.1    jruoho     ACPI_HEST_HEADER        Header;
    688   1.1    jruoho     ACPI_HEST_AER_COMMON    Aer;
    689   1.1    jruoho     UINT32                  UncorrectableMask2;
    690   1.1    jruoho     UINT32                  UncorrectableSeverity2;
    691   1.1    jruoho     UINT32                  AdvancedCapabilities2;
    692   1.1    jruoho 
    693   1.1    jruoho } ACPI_HEST_AER_BRIDGE;
    694   1.1    jruoho 
    695   1.1    jruoho 
    696   1.1    jruoho /* 9: Generic Hardware Error Source */
    697   1.1    jruoho 
    698   1.1    jruoho typedef struct acpi_hest_generic
    699   1.1    jruoho {
    700   1.1    jruoho     ACPI_HEST_HEADER        Header;
    701   1.1    jruoho     UINT16                  RelatedSourceId;
    702   1.1    jruoho     UINT8                   Reserved;
    703   1.1    jruoho     UINT8                   Enabled;
    704   1.1    jruoho     UINT32                  RecordsToPreallocate;
    705   1.1    jruoho     UINT32                  MaxSectionsPerRecord;
    706   1.1    jruoho     UINT32                  MaxRawDataLength;
    707   1.1    jruoho     ACPI_GENERIC_ADDRESS    ErrorStatusAddress;
    708   1.1    jruoho     ACPI_HEST_NOTIFY        Notify;
    709   1.1    jruoho     UINT32                  ErrorBlockLength;
    710   1.1    jruoho 
    711   1.1    jruoho } ACPI_HEST_GENERIC;
    712   1.1    jruoho 
    713   1.1    jruoho 
    714   1.9  christos /* 10: Generic Hardware Error Source, version 2 */
    715   1.9  christos 
    716   1.9  christos typedef struct acpi_hest_generic_v2
    717   1.9  christos {
    718   1.9  christos     ACPI_HEST_HEADER        Header;
    719   1.9  christos     UINT16                  RelatedSourceId;
    720   1.9  christos     UINT8                   Reserved;
    721   1.9  christos     UINT8                   Enabled;
    722   1.9  christos     UINT32                  RecordsToPreallocate;
    723   1.9  christos     UINT32                  MaxSectionsPerRecord;
    724   1.9  christos     UINT32                  MaxRawDataLength;
    725   1.9  christos     ACPI_GENERIC_ADDRESS    ErrorStatusAddress;
    726   1.9  christos     ACPI_HEST_NOTIFY        Notify;
    727   1.9  christos     UINT32                  ErrorBlockLength;
    728   1.9  christos     ACPI_GENERIC_ADDRESS    ReadAckRegister;
    729   1.9  christos     UINT64                  ReadAckPreserve;
    730   1.9  christos     UINT64                  ReadAckWrite;
    731   1.9  christos 
    732   1.9  christos } ACPI_HEST_GENERIC_V2;
    733   1.9  christos 
    734   1.9  christos 
    735   1.1    jruoho /* Generic Error Status block */
    736   1.1    jruoho 
    737   1.1    jruoho typedef struct acpi_hest_generic_status
    738   1.1    jruoho {
    739   1.1    jruoho     UINT32                  BlockStatus;
    740   1.1    jruoho     UINT32                  RawDataOffset;
    741   1.1    jruoho     UINT32                  RawDataLength;
    742   1.1    jruoho     UINT32                  DataLength;
    743   1.1    jruoho     UINT32                  ErrorSeverity;
    744   1.1    jruoho 
    745   1.1    jruoho } ACPI_HEST_GENERIC_STATUS;
    746   1.1    jruoho 
    747   1.1    jruoho /* Values for BlockStatus flags above */
    748   1.1    jruoho 
    749   1.1    jruoho #define ACPI_HEST_UNCORRECTABLE             (1)
    750   1.1    jruoho #define ACPI_HEST_CORRECTABLE               (1<<1)
    751   1.1    jruoho #define ACPI_HEST_MULTIPLE_UNCORRECTABLE    (1<<2)
    752   1.1    jruoho #define ACPI_HEST_MULTIPLE_CORRECTABLE      (1<<3)
    753   1.1    jruoho #define ACPI_HEST_ERROR_ENTRY_COUNT         (0xFF<<4) /* 8 bits, error count */
    754   1.1    jruoho 
    755   1.1    jruoho 
    756   1.1    jruoho /* Generic Error Data entry */
    757   1.1    jruoho 
    758   1.1    jruoho typedef struct acpi_hest_generic_data
    759   1.1    jruoho {
    760   1.1    jruoho     UINT8                   SectionType[16];
    761   1.1    jruoho     UINT32                  ErrorSeverity;
    762   1.1    jruoho     UINT16                  Revision;
    763   1.1    jruoho     UINT8                   ValidationBits;
    764   1.1    jruoho     UINT8                   Flags;
    765   1.1    jruoho     UINT32                  ErrorDataLength;
    766   1.1    jruoho     UINT8                   FruId[16];
    767   1.1    jruoho     UINT8                   FruText[20];
    768   1.1    jruoho 
    769   1.1    jruoho } ACPI_HEST_GENERIC_DATA;
    770   1.1    jruoho 
    771   1.9  christos /* Extension for revision 0x0300 */
    772   1.9  christos 
    773   1.9  christos typedef struct acpi_hest_generic_data_v300
    774   1.9  christos {
    775   1.9  christos     UINT8                   SectionType[16];
    776   1.9  christos     UINT32                  ErrorSeverity;
    777   1.9  christos     UINT16                  Revision;
    778   1.9  christos     UINT8                   ValidationBits;
    779   1.9  christos     UINT8                   Flags;
    780   1.9  christos     UINT32                  ErrorDataLength;
    781   1.9  christos     UINT8                   FruId[16];
    782   1.9  christos     UINT8                   FruText[20];
    783   1.9  christos     UINT64                  TimeStamp;
    784   1.9  christos 
    785   1.9  christos } ACPI_HEST_GENERIC_DATA_V300;
    786   1.9  christos 
    787   1.9  christos /* Values for ErrorSeverity above */
    788   1.9  christos 
    789   1.9  christos #define ACPI_HEST_GEN_ERROR_RECOVERABLE     0
    790   1.9  christos #define ACPI_HEST_GEN_ERROR_FATAL           1
    791   1.9  christos #define ACPI_HEST_GEN_ERROR_CORRECTED       2
    792   1.9  christos #define ACPI_HEST_GEN_ERROR_NONE            3
    793   1.9  christos 
    794   1.9  christos /* Flags for ValidationBits above */
    795   1.9  christos 
    796   1.9  christos #define ACPI_HEST_GEN_VALID_FRU_ID          (1)
    797   1.9  christos #define ACPI_HEST_GEN_VALID_FRU_STRING      (1<<1)
    798   1.9  christos #define ACPI_HEST_GEN_VALID_TIMESTAMP       (1<<2)
    799   1.9  christos 
    800   1.1    jruoho 
    801  1.11  christos /* 11: IA32 Deferred Machine Check Exception (ACPI 6.2) */
    802  1.11  christos 
    803  1.11  christos typedef struct acpi_hest_ia_deferred_check
    804  1.11  christos {
    805  1.11  christos     ACPI_HEST_HEADER        Header;
    806  1.11  christos     UINT16                  Reserved1;
    807  1.11  christos     UINT8                   Flags;              /* See flags ACPI_HEST_GLOBAL, etc. above */
    808  1.11  christos     UINT8                   Enabled;
    809  1.11  christos     UINT32                  RecordsToPreallocate;
    810  1.11  christos     UINT32                  MaxSectionsPerRecord;
    811  1.11  christos     ACPI_HEST_NOTIFY        Notify;
    812  1.11  christos     UINT8                   NumHardwareBanks;
    813  1.11  christos     UINT8                   Reserved2[3];
    814  1.11  christos 
    815  1.11  christos } ACPI_HEST_IA_DEFERRED_CHECK;
    816  1.11  christos 
    817  1.11  christos 
    818  1.11  christos /*******************************************************************************
    819  1.11  christos  *
    820  1.11  christos  * HMAT - Heterogeneous Memory Attributes Table (ACPI 6.2)
    821  1.11  christos  *        Version 1
    822  1.11  christos  *
    823  1.11  christos  ******************************************************************************/
    824  1.11  christos 
    825  1.11  christos typedef struct acpi_table_hmat
    826  1.11  christos {
    827  1.11  christos     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
    828  1.11  christos     UINT32                  Reserved;
    829  1.11  christos 
    830  1.11  christos } ACPI_TABLE_HMAT;
    831  1.11  christos 
    832  1.11  christos 
    833  1.11  christos /* Values for HMAT structure types */
    834  1.11  christos 
    835  1.11  christos enum AcpiHmatType
    836  1.11  christos {
    837  1.11  christos     ACPI_HMAT_TYPE_ADDRESS_RANGE        = 0,   /* Memory subystem address range */
    838  1.11  christos     ACPI_HMAT_TYPE_LOCALITY             = 1,   /* System locality latency and bandwidth information */
    839  1.11  christos     ACPI_HMAT_TYPE_CACHE                = 2,   /* Memory side cache information */
    840  1.11  christos     ACPI_HMAT_TYPE_RESERVED             = 3    /* 3 and greater are reserved */
    841  1.11  christos };
    842  1.11  christos 
    843  1.11  christos typedef struct acpi_hmat_structure
    844  1.11  christos {
    845  1.11  christos     UINT16                  Type;
    846  1.11  christos     UINT16                  Reserved;
    847  1.11  christos     UINT32                  Length;
    848  1.11  christos 
    849  1.11  christos } ACPI_HMAT_STRUCTURE;
    850  1.11  christos 
    851  1.11  christos 
    852  1.11  christos /*
    853  1.11  christos  * HMAT Structures, correspond to Type in ACPI_HMAT_STRUCTURE
    854  1.11  christos  */
    855  1.11  christos 
    856  1.11  christos /* 0: Memory subystem address range */
    857  1.11  christos 
    858  1.11  christos typedef struct acpi_hmat_address_range
    859  1.11  christos {
    860  1.11  christos     ACPI_HMAT_STRUCTURE     Header;
    861  1.11  christos     UINT16                  Flags;
    862  1.11  christos     UINT16                  Reserved1;
    863  1.11  christos     UINT32                  ProcessorPD;            /* Processor proximity domain */
    864  1.11  christos     UINT32                  MemoryPD;               /* Memory proximity domain */
    865  1.11  christos     UINT32                  Reserved2;
    866  1.11  christos     UINT64                  PhysicalAddressBase;    /* Physical address range base */
    867  1.11  christos     UINT64                  PhysicalAddressLength;  /* Physical address range length */
    868  1.11  christos 
    869  1.11  christos } ACPI_HMAT_ADDRESS_RANGE;
    870  1.11  christos 
    871  1.11  christos /* Masks for Flags field above */
    872  1.11  christos 
    873  1.11  christos #define ACPI_HMAT_PROCESSOR_PD_VALID    (1)     /* 1: ProcessorPD field is valid */
    874  1.11  christos #define ACPI_HMAT_MEMORY_PD_VALID       (1<<1)  /* 1: MemoryPD field is valid */
    875  1.11  christos #define ACPI_HMAT_RESERVATION_HINT      (1<<2)  /* 1: Reservation hint */
    876  1.11  christos 
    877  1.11  christos 
    878  1.11  christos /* 1: System locality latency and bandwidth information */
    879  1.11  christos 
    880  1.11  christos typedef struct acpi_hmat_locality
    881  1.11  christos {
    882  1.11  christos     ACPI_HMAT_STRUCTURE     Header;
    883  1.11  christos     UINT8                   Flags;
    884  1.11  christos     UINT8                   DataType;
    885  1.11  christos     UINT16                  Reserved1;
    886  1.11  christos     UINT32                  NumberOfInitiatorPDs;
    887  1.11  christos     UINT32                  NumberOfTargetPDs;
    888  1.11  christos     UINT32                  Reserved2;
    889  1.11  christos     UINT64                  EntryBaseUnit;
    890  1.11  christos 
    891  1.11  christos } ACPI_HMAT_LOCALITY;
    892  1.11  christos 
    893  1.11  christos /* Masks for Flags field above */
    894  1.11  christos 
    895  1.11  christos #define ACPI_HMAT_MEMORY_HIERARCHY  (0x0F)
    896  1.11  christos 
    897  1.11  christos /* Values for Memory Hierarchy flag */
    898  1.11  christos 
    899  1.11  christos #define ACPI_HMAT_MEMORY            0
    900  1.11  christos #define ACPI_HMAT_LAST_LEVEL_CACHE  1
    901  1.11  christos #define ACPI_HMAT_1ST_LEVEL_CACHE   2
    902  1.11  christos #define ACPI_HMAT_2ND_LEVEL_CACHE   3
    903  1.11  christos #define ACPI_HMAT_3RD_LEVEL_CACHE   4
    904  1.11  christos 
    905  1.11  christos /* Values for DataType field above */
    906  1.11  christos 
    907  1.11  christos #define ACPI_HMAT_ACCESS_LATENCY    0
    908  1.11  christos #define ACPI_HMAT_READ_LATENCY      1
    909  1.11  christos #define ACPI_HMAT_WRITE_LATENCY     2
    910  1.11  christos #define ACPI_HMAT_ACCESS_BANDWIDTH  3
    911  1.11  christos #define ACPI_HMAT_READ_BANDWIDTH    4
    912  1.11  christos #define ACPI_HMAT_WRITE_BANDWIDTH   5
    913  1.11  christos 
    914  1.11  christos 
    915  1.11  christos /* 2: Memory side cache information */
    916  1.11  christos 
    917  1.11  christos typedef struct acpi_hmat_cache
    918  1.11  christos {
    919  1.11  christos     ACPI_HMAT_STRUCTURE     Header;
    920  1.11  christos     UINT32                  MemoryPD;
    921  1.11  christos     UINT32                  Reserved1;
    922  1.11  christos     UINT64                  CacheSize;
    923  1.11  christos     UINT32                  CacheAttributes;
    924  1.11  christos     UINT16                  Reserved2;
    925  1.11  christos     UINT16                  NumberOfSMBIOSHandles;
    926  1.11  christos 
    927  1.11  christos } ACPI_HMAT_CACHE;
    928  1.11  christos 
    929  1.11  christos /* Masks for CacheAttributes field above */
    930  1.11  christos 
    931  1.11  christos #define ACPI_HMAT_TOTAL_CACHE_LEVEL     (0x0000000F)
    932  1.11  christos #define ACPI_HMAT_CACHE_LEVEL           (0x000000F0)
    933  1.11  christos #define ACPI_HMAT_CACHE_ASSOCIATIVITY   (0x00000F00)
    934  1.11  christos #define ACPI_HMAT_WRITE_POLICY          (0x0000F000)
    935  1.11  christos #define ACPI_HMAT_CACHE_LINE_SIZE       (0xFFFF0000)
    936  1.11  christos 
    937  1.11  christos /* Values for cache associativity flag */
    938  1.11  christos 
    939  1.11  christos #define ACPI_HMAT_CA_NONE                     (0)
    940  1.11  christos #define ACPI_HMAT_CA_DIRECT_MAPPED            (1)
    941  1.11  christos #define ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING   (2)
    942  1.11  christos 
    943  1.11  christos /* Values for write policy flag */
    944  1.11  christos 
    945  1.11  christos #define ACPI_HMAT_CP_NONE   (0)
    946  1.11  christos #define ACPI_HMAT_CP_WB     (1)
    947  1.11  christos #define ACPI_HMAT_CP_WT     (2)
    948  1.11  christos 
    949  1.11  christos 
    950   1.1    jruoho /*******************************************************************************
    951   1.1    jruoho  *
    952   1.1    jruoho  * MADT - Multiple APIC Description Table
    953   1.1    jruoho  *        Version 3
    954   1.1    jruoho  *
    955   1.1    jruoho  ******************************************************************************/
    956   1.1    jruoho 
    957   1.1    jruoho typedef struct acpi_table_madt
    958   1.1    jruoho {
    959   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
    960   1.1    jruoho     UINT32                  Address;            /* Physical address of local APIC */
    961   1.1    jruoho     UINT32                  Flags;
    962   1.1    jruoho 
    963   1.1    jruoho } ACPI_TABLE_MADT;
    964   1.1    jruoho 
    965   1.1    jruoho /* Masks for Flags field above */
    966   1.1    jruoho 
    967   1.1    jruoho #define ACPI_MADT_PCAT_COMPAT       (1)         /* 00: System also has dual 8259s */
    968   1.1    jruoho 
    969   1.1    jruoho /* Values for PCATCompat flag */
    970   1.1    jruoho 
    971  1.11  christos #define ACPI_MADT_DUAL_PIC          1
    972  1.11  christos #define ACPI_MADT_MULTIPLE_APIC     0
    973   1.1    jruoho 
    974   1.1    jruoho 
    975   1.1    jruoho /* Values for MADT subtable type in ACPI_SUBTABLE_HEADER */
    976   1.1    jruoho 
    977   1.1    jruoho enum AcpiMadtType
    978   1.1    jruoho {
    979   1.5  christos     ACPI_MADT_TYPE_LOCAL_APIC               = 0,
    980   1.5  christos     ACPI_MADT_TYPE_IO_APIC                  = 1,
    981   1.5  christos     ACPI_MADT_TYPE_INTERRUPT_OVERRIDE       = 2,
    982   1.5  christos     ACPI_MADT_TYPE_NMI_SOURCE               = 3,
    983   1.5  christos     ACPI_MADT_TYPE_LOCAL_APIC_NMI           = 4,
    984   1.5  christos     ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE      = 5,
    985   1.5  christos     ACPI_MADT_TYPE_IO_SAPIC                 = 6,
    986   1.5  christos     ACPI_MADT_TYPE_LOCAL_SAPIC              = 7,
    987   1.5  christos     ACPI_MADT_TYPE_INTERRUPT_SOURCE         = 8,
    988   1.5  christos     ACPI_MADT_TYPE_LOCAL_X2APIC             = 9,
    989   1.5  christos     ACPI_MADT_TYPE_LOCAL_X2APIC_NMI         = 10,
    990   1.5  christos     ACPI_MADT_TYPE_GENERIC_INTERRUPT        = 11,
    991   1.5  christos     ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR      = 12,
    992   1.5  christos     ACPI_MADT_TYPE_GENERIC_MSI_FRAME        = 13,
    993   1.5  christos     ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR    = 14,
    994   1.7  christos     ACPI_MADT_TYPE_GENERIC_TRANSLATOR       = 15,
    995   1.7  christos     ACPI_MADT_TYPE_RESERVED                 = 16    /* 16 and greater are reserved */
    996   1.1    jruoho };
    997   1.1    jruoho 
    998   1.1    jruoho 
    999   1.1    jruoho /*
   1000   1.5  christos  * MADT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER
   1001   1.1    jruoho  */
   1002   1.1    jruoho 
   1003   1.1    jruoho /* 0: Processor Local APIC */
   1004   1.1    jruoho 
   1005   1.1    jruoho typedef struct acpi_madt_local_apic
   1006   1.1    jruoho {
   1007   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1008   1.1    jruoho     UINT8                   ProcessorId;        /* ACPI processor id */
   1009   1.1    jruoho     UINT8                   Id;                 /* Processor's local APIC id */
   1010   1.1    jruoho     UINT32                  LapicFlags;
   1011   1.1    jruoho 
   1012   1.1    jruoho } ACPI_MADT_LOCAL_APIC;
   1013   1.1    jruoho 
   1014   1.1    jruoho 
   1015   1.1    jruoho /* 1: IO APIC */
   1016   1.1    jruoho 
   1017   1.1    jruoho typedef struct acpi_madt_io_apic
   1018   1.1    jruoho {
   1019   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1020   1.1    jruoho     UINT8                   Id;                 /* I/O APIC ID */
   1021   1.1    jruoho     UINT8                   Reserved;           /* Reserved - must be zero */
   1022   1.1    jruoho     UINT32                  Address;            /* APIC physical address */
   1023   1.1    jruoho     UINT32                  GlobalIrqBase;      /* Global system interrupt where INTI lines start */
   1024   1.1    jruoho 
   1025   1.1    jruoho } ACPI_MADT_IO_APIC;
   1026   1.1    jruoho 
   1027   1.1    jruoho 
   1028   1.1    jruoho /* 2: Interrupt Override */
   1029   1.1    jruoho 
   1030   1.1    jruoho typedef struct acpi_madt_interrupt_override
   1031   1.1    jruoho {
   1032   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1033   1.1    jruoho     UINT8                   Bus;                /* 0 - ISA */
   1034   1.1    jruoho     UINT8                   SourceIrq;          /* Interrupt source (IRQ) */
   1035   1.1    jruoho     UINT32                  GlobalIrq;          /* Global system interrupt */
   1036   1.1    jruoho     UINT16                  IntiFlags;
   1037   1.1    jruoho 
   1038   1.1    jruoho } ACPI_MADT_INTERRUPT_OVERRIDE;
   1039   1.1    jruoho 
   1040   1.1    jruoho 
   1041   1.1    jruoho /* 3: NMI Source */
   1042   1.1    jruoho 
   1043   1.1    jruoho typedef struct acpi_madt_nmi_source
   1044   1.1    jruoho {
   1045   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1046   1.1    jruoho     UINT16                  IntiFlags;
   1047   1.1    jruoho     UINT32                  GlobalIrq;          /* Global system interrupt */
   1048   1.1    jruoho 
   1049   1.1    jruoho } ACPI_MADT_NMI_SOURCE;
   1050   1.1    jruoho 
   1051   1.1    jruoho 
   1052   1.1    jruoho /* 4: Local APIC NMI */
   1053   1.1    jruoho 
   1054   1.1    jruoho typedef struct acpi_madt_local_apic_nmi
   1055   1.1    jruoho {
   1056   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1057   1.1    jruoho     UINT8                   ProcessorId;        /* ACPI processor id */
   1058   1.1    jruoho     UINT16                  IntiFlags;
   1059   1.1    jruoho     UINT8                   Lint;               /* LINTn to which NMI is connected */
   1060   1.1    jruoho 
   1061   1.1    jruoho } ACPI_MADT_LOCAL_APIC_NMI;
   1062   1.1    jruoho 
   1063   1.1    jruoho 
   1064   1.1    jruoho /* 5: Address Override */
   1065   1.1    jruoho 
   1066   1.1    jruoho typedef struct acpi_madt_local_apic_override
   1067   1.1    jruoho {
   1068   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1069   1.1    jruoho     UINT16                  Reserved;           /* Reserved, must be zero */
   1070   1.1    jruoho     UINT64                  Address;            /* APIC physical address */
   1071   1.1    jruoho 
   1072   1.1    jruoho } ACPI_MADT_LOCAL_APIC_OVERRIDE;
   1073   1.1    jruoho 
   1074   1.1    jruoho 
   1075   1.1    jruoho /* 6: I/O Sapic */
   1076   1.1    jruoho 
   1077   1.1    jruoho typedef struct acpi_madt_io_sapic
   1078   1.1    jruoho {
   1079   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1080   1.1    jruoho     UINT8                   Id;                 /* I/O SAPIC ID */
   1081   1.1    jruoho     UINT8                   Reserved;           /* Reserved, must be zero */
   1082   1.1    jruoho     UINT32                  GlobalIrqBase;      /* Global interrupt for SAPIC start */
   1083   1.1    jruoho     UINT64                  Address;            /* SAPIC physical address */
   1084   1.1    jruoho 
   1085   1.1    jruoho } ACPI_MADT_IO_SAPIC;
   1086   1.1    jruoho 
   1087   1.1    jruoho 
   1088   1.1    jruoho /* 7: Local Sapic */
   1089   1.1    jruoho 
   1090   1.1    jruoho typedef struct acpi_madt_local_sapic
   1091   1.1    jruoho {
   1092   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1093   1.1    jruoho     UINT8                   ProcessorId;        /* ACPI processor id */
   1094   1.1    jruoho     UINT8                   Id;                 /* SAPIC ID */
   1095   1.1    jruoho     UINT8                   Eid;                /* SAPIC EID */
   1096   1.1    jruoho     UINT8                   Reserved[3];        /* Reserved, must be zero */
   1097   1.1    jruoho     UINT32                  LapicFlags;
   1098   1.1    jruoho     UINT32                  Uid;                /* Numeric UID - ACPI 3.0 */
   1099   1.1    jruoho     char                    UidString[1];       /* String UID  - ACPI 3.0 */
   1100   1.1    jruoho 
   1101   1.1    jruoho } ACPI_MADT_LOCAL_SAPIC;
   1102   1.1    jruoho 
   1103   1.1    jruoho 
   1104   1.1    jruoho /* 8: Platform Interrupt Source */
   1105   1.1    jruoho 
   1106   1.1    jruoho typedef struct acpi_madt_interrupt_source
   1107   1.1    jruoho {
   1108   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1109   1.1    jruoho     UINT16                  IntiFlags;
   1110   1.1    jruoho     UINT8                   Type;               /* 1=PMI, 2=INIT, 3=corrected */
   1111   1.1    jruoho     UINT8                   Id;                 /* Processor ID */
   1112   1.1    jruoho     UINT8                   Eid;                /* Processor EID */
   1113   1.1    jruoho     UINT8                   IoSapicVector;      /* Vector value for PMI interrupts */
   1114   1.1    jruoho     UINT32                  GlobalIrq;          /* Global system interrupt */
   1115   1.1    jruoho     UINT32                  Flags;              /* Interrupt Source Flags */
   1116   1.1    jruoho 
   1117   1.1    jruoho } ACPI_MADT_INTERRUPT_SOURCE;
   1118   1.1    jruoho 
   1119   1.1    jruoho /* Masks for Flags field above */
   1120   1.1    jruoho 
   1121   1.1    jruoho #define ACPI_MADT_CPEI_OVERRIDE     (1)
   1122   1.1    jruoho 
   1123   1.1    jruoho 
   1124   1.1    jruoho /* 9: Processor Local X2APIC (ACPI 4.0) */
   1125   1.1    jruoho 
   1126   1.1    jruoho typedef struct acpi_madt_local_x2apic
   1127   1.1    jruoho {
   1128   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1129   1.1    jruoho     UINT16                  Reserved;           /* Reserved - must be zero */
   1130   1.1    jruoho     UINT32                  LocalApicId;        /* Processor x2APIC ID  */
   1131   1.1    jruoho     UINT32                  LapicFlags;
   1132   1.1    jruoho     UINT32                  Uid;                /* ACPI processor UID */
   1133   1.1    jruoho 
   1134   1.1    jruoho } ACPI_MADT_LOCAL_X2APIC;
   1135   1.1    jruoho 
   1136   1.1    jruoho 
   1137   1.1    jruoho /* 10: Local X2APIC NMI (ACPI 4.0) */
   1138   1.1    jruoho 
   1139   1.1    jruoho typedef struct acpi_madt_local_x2apic_nmi
   1140   1.1    jruoho {
   1141   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1142   1.1    jruoho     UINT16                  IntiFlags;
   1143   1.1    jruoho     UINT32                  Uid;                /* ACPI processor UID */
   1144   1.1    jruoho     UINT8                   Lint;               /* LINTn to which NMI is connected */
   1145   1.1    jruoho     UINT8                   Reserved[3];        /* Reserved - must be zero */
   1146   1.1    jruoho 
   1147   1.1    jruoho } ACPI_MADT_LOCAL_X2APIC_NMI;
   1148   1.1    jruoho 
   1149   1.1    jruoho 
   1150   1.7  christos /* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */
   1151   1.4  christos 
   1152   1.4  christos typedef struct acpi_madt_generic_interrupt
   1153   1.4  christos {
   1154   1.4  christos     ACPI_SUBTABLE_HEADER    Header;
   1155   1.4  christos     UINT16                  Reserved;           /* Reserved - must be zero */
   1156   1.5  christos     UINT32                  CpuInterfaceNumber;
   1157   1.4  christos     UINT32                  Uid;
   1158   1.4  christos     UINT32                  Flags;
   1159   1.4  christos     UINT32                  ParkingVersion;
   1160   1.4  christos     UINT32                  PerformanceInterrupt;
   1161   1.4  christos     UINT64                  ParkedAddress;
   1162   1.4  christos     UINT64                  BaseAddress;
   1163   1.5  christos     UINT64                  GicvBaseAddress;
   1164   1.5  christos     UINT64                  GichBaseAddress;
   1165   1.5  christos     UINT32                  VgicInterrupt;
   1166   1.5  christos     UINT64                  GicrBaseAddress;
   1167   1.5  christos     UINT64                  ArmMpidr;
   1168   1.7  christos     UINT8                   EfficiencyClass;
   1169   1.7  christos     UINT8                   Reserved2[3];
   1170   1.4  christos 
   1171   1.4  christos } ACPI_MADT_GENERIC_INTERRUPT;
   1172   1.4  christos 
   1173   1.5  christos /* Masks for Flags field above */
   1174   1.5  christos 
   1175   1.5  christos /* ACPI_MADT_ENABLED                    (1)      Processor is usable if set */
   1176   1.5  christos #define ACPI_MADT_PERFORMANCE_IRQ_MODE  (1<<1)  /* 01: Performance Interrupt Mode */
   1177   1.5  christos #define ACPI_MADT_VGIC_IRQ_MODE         (1<<2)  /* 02: VGIC Maintenance Interrupt mode */
   1178   1.5  christos 
   1179   1.4  christos 
   1180   1.7  christos /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
   1181   1.4  christos 
   1182   1.4  christos typedef struct acpi_madt_generic_distributor
   1183   1.4  christos {
   1184   1.4  christos     ACPI_SUBTABLE_HEADER    Header;
   1185   1.4  christos     UINT16                  Reserved;           /* Reserved - must be zero */
   1186   1.4  christos     UINT32                  GicId;
   1187   1.4  christos     UINT64                  BaseAddress;
   1188   1.4  christos     UINT32                  GlobalIrqBase;
   1189   1.7  christos     UINT8                   Version;
   1190   1.7  christos     UINT8                   Reserved2[3];       /* Reserved - must be zero */
   1191   1.4  christos 
   1192   1.4  christos } ACPI_MADT_GENERIC_DISTRIBUTOR;
   1193   1.4  christos 
   1194   1.7  christos /* Values for Version field above */
   1195   1.7  christos 
   1196   1.7  christos enum AcpiMadtGicVersion
   1197   1.7  christos {
   1198   1.7  christos     ACPI_MADT_GIC_VERSION_NONE          = 0,
   1199   1.7  christos     ACPI_MADT_GIC_VERSION_V1            = 1,
   1200   1.7  christos     ACPI_MADT_GIC_VERSION_V2            = 2,
   1201   1.7  christos     ACPI_MADT_GIC_VERSION_V3            = 3,
   1202   1.7  christos     ACPI_MADT_GIC_VERSION_V4            = 4,
   1203   1.7  christos     ACPI_MADT_GIC_VERSION_RESERVED      = 5     /* 5 and greater are reserved */
   1204   1.7  christos };
   1205   1.7  christos 
   1206   1.4  christos 
   1207   1.5  christos /* 13: Generic MSI Frame (ACPI 5.1) */
   1208   1.5  christos 
   1209   1.5  christos typedef struct acpi_madt_generic_msi_frame
   1210   1.5  christos {
   1211   1.5  christos     ACPI_SUBTABLE_HEADER    Header;
   1212   1.5  christos     UINT16                  Reserved;           /* Reserved - must be zero */
   1213   1.5  christos     UINT32                  MsiFrameId;
   1214   1.5  christos     UINT64                  BaseAddress;
   1215   1.5  christos     UINT32                  Flags;
   1216   1.5  christos     UINT16                  SpiCount;
   1217   1.5  christos     UINT16                  SpiBase;
   1218   1.5  christos 
   1219   1.5  christos } ACPI_MADT_GENERIC_MSI_FRAME;
   1220   1.5  christos 
   1221   1.5  christos /* Masks for Flags field above */
   1222   1.5  christos 
   1223   1.5  christos #define ACPI_MADT_OVERRIDE_SPI_VALUES   (1)
   1224   1.5  christos 
   1225   1.5  christos 
   1226   1.5  christos /* 14: Generic Redistributor (ACPI 5.1) */
   1227   1.5  christos 
   1228   1.5  christos typedef struct acpi_madt_generic_redistributor
   1229   1.5  christos {
   1230   1.5  christos     ACPI_SUBTABLE_HEADER    Header;
   1231   1.5  christos     UINT16                  Reserved;           /* reserved - must be zero */
   1232   1.5  christos     UINT64                  BaseAddress;
   1233   1.5  christos     UINT32                  Length;
   1234   1.5  christos 
   1235   1.5  christos } ACPI_MADT_GENERIC_REDISTRIBUTOR;
   1236   1.5  christos 
   1237   1.5  christos 
   1238   1.7  christos /* 15: Generic Translator (ACPI 6.0) */
   1239   1.7  christos 
   1240   1.7  christos typedef struct acpi_madt_generic_translator
   1241   1.7  christos {
   1242   1.7  christos     ACPI_SUBTABLE_HEADER    Header;
   1243   1.7  christos     UINT16                  Reserved;           /* reserved - must be zero */
   1244   1.7  christos     UINT32                  TranslationId;
   1245   1.7  christos     UINT64                  BaseAddress;
   1246   1.7  christos     UINT32                  Reserved2;
   1247   1.7  christos 
   1248   1.7  christos } ACPI_MADT_GENERIC_TRANSLATOR;
   1249   1.7  christos 
   1250   1.7  christos 
   1251   1.1    jruoho /*
   1252   1.1    jruoho  * Common flags fields for MADT subtables
   1253   1.1    jruoho  */
   1254   1.1    jruoho 
   1255   1.5  christos /* MADT Local APIC flags */
   1256   1.1    jruoho 
   1257   1.1    jruoho #define ACPI_MADT_ENABLED           (1)         /* 00: Processor is usable if set */
   1258   1.1    jruoho 
   1259   1.1    jruoho /* MADT MPS INTI flags (IntiFlags) */
   1260   1.1    jruoho 
   1261   1.1    jruoho #define ACPI_MADT_POLARITY_MASK     (3)         /* 00-01: Polarity of APIC I/O input signals */
   1262   1.1    jruoho #define ACPI_MADT_TRIGGER_MASK      (3<<2)      /* 02-03: Trigger mode of APIC input signals */
   1263   1.1    jruoho 
   1264   1.1    jruoho /* Values for MPS INTI flags */
   1265   1.1    jruoho 
   1266   1.1    jruoho #define ACPI_MADT_POLARITY_CONFORMS       0
   1267   1.1    jruoho #define ACPI_MADT_POLARITY_ACTIVE_HIGH    1
   1268   1.1    jruoho #define ACPI_MADT_POLARITY_RESERVED       2
   1269   1.1    jruoho #define ACPI_MADT_POLARITY_ACTIVE_LOW     3
   1270   1.1    jruoho 
   1271   1.1    jruoho #define ACPI_MADT_TRIGGER_CONFORMS        (0)
   1272   1.1    jruoho #define ACPI_MADT_TRIGGER_EDGE            (1<<2)
   1273   1.1    jruoho #define ACPI_MADT_TRIGGER_RESERVED        (2<<2)
   1274   1.1    jruoho #define ACPI_MADT_TRIGGER_LEVEL           (3<<2)
   1275   1.1    jruoho 
   1276   1.1    jruoho 
   1277   1.1    jruoho /*******************************************************************************
   1278   1.1    jruoho  *
   1279   1.1    jruoho  * MSCT - Maximum System Characteristics Table (ACPI 4.0)
   1280   1.1    jruoho  *        Version 1
   1281   1.1    jruoho  *
   1282   1.1    jruoho  ******************************************************************************/
   1283   1.1    jruoho 
   1284   1.1    jruoho typedef struct acpi_table_msct
   1285   1.1    jruoho {
   1286   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
   1287   1.1    jruoho     UINT32                  ProximityOffset;    /* Location of proximity info struct(s) */
   1288   1.1    jruoho     UINT32                  MaxProximityDomains;/* Max number of proximity domains */
   1289   1.1    jruoho     UINT32                  MaxClockDomains;    /* Max number of clock domains */
   1290   1.1    jruoho     UINT64                  MaxAddress;         /* Max physical address in system */
   1291   1.1    jruoho 
   1292   1.1    jruoho } ACPI_TABLE_MSCT;
   1293   1.1    jruoho 
   1294   1.1    jruoho 
   1295   1.1    jruoho /* Subtable - Maximum Proximity Domain Information. Version 1 */
   1296   1.1    jruoho 
   1297   1.1    jruoho typedef struct acpi_msct_proximity
   1298   1.1    jruoho {
   1299   1.1    jruoho     UINT8                   Revision;
   1300   1.1    jruoho     UINT8                   Length;
   1301   1.1    jruoho     UINT32                  RangeStart;         /* Start of domain range */
   1302   1.1    jruoho     UINT32                  RangeEnd;           /* End of domain range */
   1303   1.1    jruoho     UINT32                  ProcessorCapacity;
   1304   1.1    jruoho     UINT64                  MemoryCapacity;     /* In bytes */
   1305   1.1    jruoho 
   1306   1.1    jruoho } ACPI_MSCT_PROXIMITY;
   1307   1.1    jruoho 
   1308   1.1    jruoho 
   1309   1.1    jruoho /*******************************************************************************
   1310   1.1    jruoho  *
   1311   1.9  christos  * NFIT - NVDIMM Interface Table (ACPI 6.0+)
   1312   1.7  christos  *        Version 1
   1313   1.7  christos  *
   1314   1.7  christos  ******************************************************************************/
   1315   1.7  christos 
   1316   1.7  christos typedef struct acpi_table_nfit
   1317   1.7  christos {
   1318   1.7  christos     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
   1319   1.7  christos     UINT32                  Reserved;           /* Reserved, must be zero */
   1320   1.7  christos 
   1321   1.7  christos } ACPI_TABLE_NFIT;
   1322   1.7  christos 
   1323   1.7  christos /* Subtable header for NFIT */
   1324   1.7  christos 
   1325   1.7  christos typedef struct acpi_nfit_header
   1326   1.7  christos {
   1327   1.7  christos     UINT16                   Type;
   1328   1.7  christos     UINT16                   Length;
   1329   1.7  christos 
   1330   1.7  christos } ACPI_NFIT_HEADER;
   1331   1.7  christos 
   1332   1.7  christos 
   1333   1.7  christos /* Values for subtable type in ACPI_NFIT_HEADER */
   1334   1.7  christos 
   1335   1.7  christos enum AcpiNfitType
   1336   1.7  christos {
   1337   1.7  christos     ACPI_NFIT_TYPE_SYSTEM_ADDRESS       = 0,
   1338   1.7  christos     ACPI_NFIT_TYPE_MEMORY_MAP           = 1,
   1339   1.7  christos     ACPI_NFIT_TYPE_INTERLEAVE           = 2,
   1340   1.7  christos     ACPI_NFIT_TYPE_SMBIOS               = 3,
   1341   1.7  christos     ACPI_NFIT_TYPE_CONTROL_REGION       = 4,
   1342   1.7  christos     ACPI_NFIT_TYPE_DATA_REGION          = 5,
   1343   1.7  christos     ACPI_NFIT_TYPE_FLUSH_ADDRESS        = 6,
   1344  1.12  christos     ACPI_NFIT_TYPE_CAPABILITIES         = 7,
   1345  1.12  christos     ACPI_NFIT_TYPE_RESERVED             = 8     /* 8 and greater are reserved */
   1346   1.7  christos };
   1347   1.7  christos 
   1348   1.7  christos /*
   1349   1.7  christos  * NFIT Subtables
   1350   1.7  christos  */
   1351   1.7  christos 
   1352   1.7  christos /* 0: System Physical Address Range Structure */
   1353   1.7  christos 
   1354   1.7  christos typedef struct acpi_nfit_system_address
   1355   1.7  christos {
   1356   1.7  christos     ACPI_NFIT_HEADER        Header;
   1357   1.7  christos     UINT16                  RangeIndex;
   1358   1.7  christos     UINT16                  Flags;
   1359  1.12  christos     UINT32                  Reserved;           /* Reserved, must be zero */
   1360   1.7  christos     UINT32                  ProximityDomain;
   1361   1.7  christos     UINT8                   RangeGuid[16];
   1362   1.7  christos     UINT64                  Address;
   1363   1.7  christos     UINT64                  Length;
   1364   1.7  christos     UINT64                  MemoryMapping;
   1365   1.7  christos 
   1366   1.7  christos } ACPI_NFIT_SYSTEM_ADDRESS;
   1367   1.7  christos 
   1368   1.7  christos /* Flags */
   1369   1.7  christos 
   1370   1.7  christos #define ACPI_NFIT_ADD_ONLINE_ONLY       (1)     /* 00: Add/Online Operation Only */
   1371   1.7  christos #define ACPI_NFIT_PROXIMITY_VALID       (1<<1)  /* 01: Proximity Domain Valid */
   1372   1.7  christos 
   1373   1.7  christos /* Range Type GUIDs appear in the include/acuuid.h file */
   1374   1.7  christos 
   1375   1.7  christos 
   1376   1.7  christos /* 1: Memory Device to System Address Range Map Structure */
   1377   1.7  christos 
   1378   1.7  christos typedef struct acpi_nfit_memory_map
   1379   1.7  christos {
   1380   1.7  christos     ACPI_NFIT_HEADER        Header;
   1381   1.7  christos     UINT32                  DeviceHandle;
   1382   1.7  christos     UINT16                  PhysicalId;
   1383   1.7  christos     UINT16                  RegionId;
   1384   1.7  christos     UINT16                  RangeIndex;
   1385   1.7  christos     UINT16                  RegionIndex;
   1386   1.7  christos     UINT64                  RegionSize;
   1387   1.7  christos     UINT64                  RegionOffset;
   1388   1.7  christos     UINT64                  Address;
   1389   1.7  christos     UINT16                  InterleaveIndex;
   1390   1.7  christos     UINT16                  InterleaveWays;
   1391   1.7  christos     UINT16                  Flags;
   1392   1.7  christos     UINT16                  Reserved;           /* Reserved, must be zero */
   1393   1.7  christos 
   1394   1.7  christos } ACPI_NFIT_MEMORY_MAP;
   1395   1.7  christos 
   1396   1.7  christos /* Flags */
   1397   1.7  christos 
   1398   1.7  christos #define ACPI_NFIT_MEM_SAVE_FAILED       (1)     /* 00: Last SAVE to Memory Device failed */
   1399   1.7  christos #define ACPI_NFIT_MEM_RESTORE_FAILED    (1<<1)  /* 01: Last RESTORE from Memory Device failed */
   1400   1.7  christos #define ACPI_NFIT_MEM_FLUSH_FAILED      (1<<2)  /* 02: Platform flush failed */
   1401   1.8  christos #define ACPI_NFIT_MEM_NOT_ARMED         (1<<3)  /* 03: Memory Device is not armed */
   1402   1.7  christos #define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4)  /* 04: Memory Device observed SMART/health events */
   1403   1.7  christos #define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5)  /* 05: SMART/health events enabled */
   1404   1.9  christos #define ACPI_NFIT_MEM_MAP_FAILED        (1<<6)  /* 06: Mapping to SPA failed */
   1405   1.7  christos 
   1406   1.7  christos 
   1407   1.7  christos /* 2: Interleave Structure */
   1408   1.7  christos 
   1409   1.7  christos typedef struct acpi_nfit_interleave
   1410   1.7  christos {
   1411   1.7  christos     ACPI_NFIT_HEADER        Header;
   1412   1.7  christos     UINT16                  InterleaveIndex;
   1413   1.7  christos     UINT16                  Reserved;           /* Reserved, must be zero */
   1414   1.7  christos     UINT32                  LineCount;
   1415   1.7  christos     UINT32                  LineSize;
   1416   1.7  christos     UINT32                  LineOffset[1];      /* Variable length */
   1417   1.7  christos 
   1418   1.7  christos } ACPI_NFIT_INTERLEAVE;
   1419   1.7  christos 
   1420   1.7  christos 
   1421   1.7  christos /* 3: SMBIOS Management Information Structure */
   1422   1.7  christos 
   1423   1.7  christos typedef struct acpi_nfit_smbios
   1424   1.7  christos {
   1425   1.7  christos     ACPI_NFIT_HEADER        Header;
   1426   1.7  christos     UINT32                  Reserved;           /* Reserved, must be zero */
   1427   1.7  christos     UINT8                   Data[1];            /* Variable length */
   1428   1.7  christos 
   1429   1.7  christos } ACPI_NFIT_SMBIOS;
   1430   1.7  christos 
   1431   1.7  christos 
   1432   1.7  christos /* 4: NVDIMM Control Region Structure */
   1433   1.7  christos 
   1434   1.7  christos typedef struct acpi_nfit_control_region
   1435   1.7  christos {
   1436   1.7  christos     ACPI_NFIT_HEADER        Header;
   1437   1.7  christos     UINT16                  RegionIndex;
   1438   1.7  christos     UINT16                  VendorId;
   1439   1.7  christos     UINT16                  DeviceId;
   1440   1.7  christos     UINT16                  RevisionId;
   1441   1.7  christos     UINT16                  SubsystemVendorId;
   1442   1.7  christos     UINT16                  SubsystemDeviceId;
   1443   1.7  christos     UINT16                  SubsystemRevisionId;
   1444   1.9  christos     UINT8                   ValidFields;
   1445   1.9  christos     UINT8                   ManufacturingLocation;
   1446   1.9  christos     UINT16                  ManufacturingDate;
   1447   1.9  christos     UINT8                   Reserved[2];        /* Reserved, must be zero */
   1448   1.7  christos     UINT32                  SerialNumber;
   1449   1.7  christos     UINT16                  Code;
   1450   1.7  christos     UINT16                  Windows;
   1451   1.7  christos     UINT64                  WindowSize;
   1452   1.7  christos     UINT64                  CommandOffset;
   1453   1.7  christos     UINT64                  CommandSize;
   1454   1.7  christos     UINT64                  StatusOffset;
   1455   1.7  christos     UINT64                  StatusSize;
   1456   1.7  christos     UINT16                  Flags;
   1457   1.7  christos     UINT8                   Reserved1[6];       /* Reserved, must be zero */
   1458   1.7  christos 
   1459   1.7  christos } ACPI_NFIT_CONTROL_REGION;
   1460   1.7  christos 
   1461   1.7  christos /* Flags */
   1462   1.7  christos 
   1463   1.9  christos #define ACPI_NFIT_CONTROL_BUFFERED          (1)     /* Block Data Windows implementation is buffered */
   1464   1.9  christos 
   1465   1.9  christos /* ValidFields bits */
   1466   1.9  christos 
   1467   1.9  christos #define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)     /* Manufacturing fields are valid */
   1468   1.7  christos 
   1469   1.7  christos 
   1470   1.7  christos /* 5: NVDIMM Block Data Window Region Structure */
   1471   1.7  christos 
   1472   1.7  christos typedef struct acpi_nfit_data_region
   1473   1.7  christos {
   1474   1.7  christos     ACPI_NFIT_HEADER        Header;
   1475   1.7  christos     UINT16                  RegionIndex;
   1476   1.7  christos     UINT16                  Windows;
   1477   1.7  christos     UINT64                  Offset;
   1478   1.7  christos     UINT64                  Size;
   1479   1.7  christos     UINT64                  Capacity;
   1480   1.7  christos     UINT64                  StartAddress;
   1481   1.7  christos 
   1482   1.7  christos } ACPI_NFIT_DATA_REGION;
   1483   1.7  christos 
   1484   1.7  christos 
   1485   1.7  christos /* 6: Flush Hint Address Structure */
   1486   1.7  christos 
   1487   1.7  christos typedef struct acpi_nfit_flush_address
   1488   1.7  christos {
   1489   1.7  christos     ACPI_NFIT_HEADER        Header;
   1490   1.7  christos     UINT32                  DeviceHandle;
   1491   1.7  christos     UINT16                  HintCount;
   1492   1.7  christos     UINT8                   Reserved[6];        /* Reserved, must be zero */
   1493   1.7  christos     UINT64                  HintAddress[1];     /* Variable length */
   1494   1.7  christos 
   1495   1.7  christos } ACPI_NFIT_FLUSH_ADDRESS;
   1496   1.7  christos 
   1497   1.7  christos 
   1498  1.12  christos /* 7: Platform Capabilities Structure */
   1499  1.12  christos 
   1500  1.12  christos typedef struct acpi_nfit_capabilities
   1501  1.12  christos {
   1502  1.12  christos     ACPI_NFIT_HEADER        Header;
   1503  1.12  christos     UINT8                   HighestCapability;
   1504  1.12  christos     UINT8                   Reserved[3];       /* Reserved, must be zero */
   1505  1.12  christos     UINT32                  Capabilities;
   1506  1.12  christos     UINT32                  Reserved2;
   1507  1.12  christos 
   1508  1.12  christos } ACPI_NFIT_CAPABILITIES;
   1509  1.12  christos 
   1510  1.12  christos /* Capabilities Flags */
   1511  1.12  christos 
   1512  1.12  christos #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH       (1)     /* 00: Cache Flush to NVDIMM capable */
   1513  1.12  christos #define ACPI_NFIT_CAPABILITY_MEM_FLUSH         (1<<1)  /* 01: Memory Flush to NVDIMM capable */
   1514  1.12  christos #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING     (1<<2)  /* 02: Memory Mirroring capable */
   1515  1.12  christos 
   1516  1.12  christos 
   1517  1.12  christos /*
   1518  1.12  christos  * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
   1519  1.12  christos  */
   1520  1.12  christos typedef struct nfit_device_handle
   1521  1.12  christos {
   1522  1.12  christos     UINT32                  Handle;
   1523  1.12  christos 
   1524  1.12  christos } NFIT_DEVICE_HANDLE;
   1525  1.12  christos 
   1526  1.12  christos /* Device handle construction and extraction macros */
   1527  1.12  christos 
   1528  1.12  christos #define ACPI_NFIT_DIMM_NUMBER_MASK              0x0000000F
   1529  1.12  christos #define ACPI_NFIT_CHANNEL_NUMBER_MASK           0x000000F0
   1530  1.12  christos #define ACPI_NFIT_MEMORY_ID_MASK                0x00000F00
   1531  1.12  christos #define ACPI_NFIT_SOCKET_ID_MASK                0x0000F000
   1532  1.12  christos #define ACPI_NFIT_NODE_ID_MASK                  0x0FFF0000
   1533  1.12  christos 
   1534  1.12  christos #define ACPI_NFIT_DIMM_NUMBER_OFFSET            0
   1535  1.12  christos #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET         4
   1536  1.12  christos #define ACPI_NFIT_MEMORY_ID_OFFSET              8
   1537  1.12  christos #define ACPI_NFIT_SOCKET_ID_OFFSET              12
   1538  1.12  christos #define ACPI_NFIT_NODE_ID_OFFSET                16
   1539  1.12  christos 
   1540  1.12  christos /* Macro to construct a NFIT/NVDIMM device handle */
   1541  1.12  christos 
   1542  1.12  christos #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
   1543  1.12  christos     ((dimm)                                         | \
   1544  1.12  christos     ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET)  | \
   1545  1.12  christos     ((memory)  << ACPI_NFIT_MEMORY_ID_OFFSET)       | \
   1546  1.12  christos     ((socket)  << ACPI_NFIT_SOCKET_ID_OFFSET)       | \
   1547  1.12  christos     ((node)    << ACPI_NFIT_NODE_ID_OFFSET))
   1548  1.12  christos 
   1549  1.12  christos /* Macros to extract individual fields from a NFIT/NVDIMM device handle */
   1550  1.12  christos 
   1551  1.12  christos #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
   1552  1.12  christos     ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
   1553  1.12  christos 
   1554  1.12  christos #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
   1555  1.12  christos     (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
   1556  1.12  christos 
   1557  1.12  christos #define ACPI_NFIT_GET_MEMORY_ID(handle) \
   1558  1.12  christos     (((handle) & ACPI_NFIT_MEMORY_ID_MASK)      >> ACPI_NFIT_MEMORY_ID_OFFSET)
   1559  1.12  christos 
   1560  1.12  christos #define ACPI_NFIT_GET_SOCKET_ID(handle) \
   1561  1.12  christos     (((handle) & ACPI_NFIT_SOCKET_ID_MASK)      >> ACPI_NFIT_SOCKET_ID_OFFSET)
   1562  1.12  christos 
   1563  1.12  christos #define ACPI_NFIT_GET_NODE_ID(handle) \
   1564  1.12  christos     (((handle) & ACPI_NFIT_NODE_ID_MASK)        >> ACPI_NFIT_NODE_ID_OFFSET)
   1565  1.12  christos 
   1566  1.12  christos 
   1567   1.7  christos /*******************************************************************************
   1568   1.7  christos  *
   1569  1.12  christos  * PDTT - Platform Debug Trigger Table (ACPI 6.2)
   1570  1.11  christos  *        Version 0
   1571  1.11  christos  *
   1572  1.11  christos  ******************************************************************************/
   1573  1.11  christos 
   1574  1.11  christos typedef struct acpi_table_pdtt
   1575  1.11  christos {
   1576  1.11  christos     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
   1577  1.11  christos     UINT8                   TriggerCount;
   1578  1.11  christos     UINT8                   Reserved[3];
   1579  1.11  christos     UINT32                  ArrayOffset;
   1580  1.11  christos 
   1581  1.11  christos } ACPI_TABLE_PDTT;
   1582  1.11  christos 
   1583  1.11  christos 
   1584  1.11  christos /*
   1585  1.11  christos  * PDTT Communication Channel Identifier Structure.
   1586  1.11  christos  * The number of these structures is defined by TriggerCount above,
   1587  1.11  christos  * starting at ArrayOffset.
   1588  1.11  christos  */
   1589  1.11  christos typedef struct acpi_pdtt_channel
   1590  1.11  christos {
   1591  1.12  christos     UINT8                   SubchannelId;
   1592  1.12  christos     UINT8                   Flags;
   1593  1.11  christos 
   1594  1.11  christos } ACPI_PDTT_CHANNEL;
   1595  1.11  christos 
   1596  1.12  christos /* Flags for above */
   1597  1.11  christos 
   1598  1.12  christos #define ACPI_PDTT_RUNTIME_TRIGGER           (1)
   1599  1.12  christos #define ACPI_PDTT_WAIT_COMPLETION           (1<<1)
   1600  1.11  christos 
   1601  1.11  christos 
   1602  1.11  christos /*******************************************************************************
   1603  1.11  christos  *
   1604  1.11  christos  * PPTT - Processor Properties Topology Table (ACPI 6.2)
   1605  1.11  christos  *        Version 1
   1606  1.11  christos  *
   1607  1.11  christos  ******************************************************************************/
   1608  1.11  christos 
   1609  1.11  christos typedef struct acpi_table_pptt
   1610  1.11  christos {
   1611  1.11  christos     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
   1612  1.11  christos 
   1613  1.11  christos } ACPI_TABLE_PPTT;
   1614  1.11  christos 
   1615  1.11  christos /* Values for Type field above */
   1616  1.11  christos 
   1617  1.11  christos enum AcpiPpttType
   1618  1.11  christos {
   1619  1.11  christos     ACPI_PPTT_TYPE_PROCESSOR            = 0,
   1620  1.11  christos     ACPI_PPTT_TYPE_CACHE                = 1,
   1621  1.11  christos     ACPI_PPTT_TYPE_ID                   = 2,
   1622  1.11  christos     ACPI_PPTT_TYPE_RESERVED             = 3
   1623  1.11  christos };
   1624  1.11  christos 
   1625  1.11  christos 
   1626  1.11  christos /* 0: Processor Hierarchy Node Structure */
   1627  1.11  christos 
   1628  1.11  christos typedef struct acpi_pptt_processor
   1629  1.11  christos {
   1630  1.11  christos     ACPI_SUBTABLE_HEADER    Header;
   1631  1.11  christos     UINT16                  Reserved;
   1632  1.11  christos     UINT32                  Flags;
   1633  1.11  christos     UINT32                  Parent;
   1634  1.11  christos     UINT32                  AcpiProcessorId;
   1635  1.11  christos     UINT32                  NumberOfPrivResources;
   1636  1.11  christos 
   1637  1.11  christos } ACPI_PPTT_PROCESSOR;
   1638  1.11  christos 
   1639  1.11  christos /* Flags */
   1640  1.11  christos 
   1641  1.11  christos #define ACPI_PPTT_PHYSICAL_PACKAGE          (1)     /* Physical package */
   1642  1.11  christos #define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID   (2)     /* ACPI Processor ID valid */
   1643  1.11  christos 
   1644  1.11  christos 
   1645  1.11  christos /* 1: Cache Type Structure */
   1646  1.11  christos 
   1647  1.11  christos typedef struct acpi_pptt_cache
   1648  1.11  christos {
   1649  1.11  christos     ACPI_SUBTABLE_HEADER    Header;
   1650  1.11  christos     UINT16                  Reserved;
   1651  1.11  christos     UINT32                  Flags;
   1652  1.11  christos     UINT32                  NextLevelOfCache;
   1653  1.11  christos     UINT32                  Size;
   1654  1.11  christos     UINT32                  NumberOfSets;
   1655  1.11  christos     UINT8                   Associativity;
   1656  1.11  christos     UINT8                   Attributes;
   1657  1.11  christos     UINT16                  LineSize;
   1658  1.11  christos 
   1659  1.11  christos } ACPI_PPTT_CACHE;
   1660  1.11  christos 
   1661  1.11  christos /* Flags */
   1662  1.11  christos 
   1663  1.11  christos #define ACPI_PPTT_SIZE_PROPERTY_VALID       (1)     /* Physical property valid */
   1664  1.11  christos #define ACPI_PPTT_NUMBER_OF_SETS_VALID      (1<<1)  /* Number of sets valid */
   1665  1.11  christos #define ACPI_PPTT_ASSOCIATIVITY_VALID       (1<<2)  /* Associativity valid */
   1666  1.11  christos #define ACPI_PPTT_ALLOCATION_TYPE_VALID     (1<<3)  /* Allocation type valid */
   1667  1.11  christos #define ACPI_PPTT_CACHE_TYPE_VALID          (1<<4)  /* Cache type valid */
   1668  1.11  christos #define ACPI_PPTT_WRITE_POLICY_VALID        (1<<5)  /* Write policy valid */
   1669  1.11  christos #define ACPI_PPTT_LINE_SIZE_VALID           (1<<6)  /* Line size valid */
   1670  1.11  christos 
   1671  1.11  christos /* Masks for Attributes */
   1672  1.11  christos 
   1673  1.11  christos #define ACPI_PPTT_MASK_ALLOCATION_TYPE      (0x03)  /* Allocation type */
   1674  1.11  christos #define ACPI_PPTT_MASK_CACHE_TYPE           (0x0C)  /* Cache type */
   1675  1.11  christos #define ACPI_PPTT_MASK_WRITE_POLICY         (0x10)  /* Write policy */
   1676  1.11  christos 
   1677  1.12  christos /* Attributes describing cache */
   1678  1.12  christos #define ACPI_PPTT_CACHE_READ_ALLOCATE       (0x0)   /* Cache line is allocated on read */
   1679  1.12  christos #define ACPI_PPTT_CACHE_WRITE_ALLOCATE      (0x01)  /* Cache line is allocated on write */
   1680  1.12  christos #define ACPI_PPTT_CACHE_RW_ALLOCATE         (0x02)  /* Cache line is allocated on read and write */
   1681  1.12  christos #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT     (0x03)  /* Alternate representation of above */
   1682  1.12  christos 
   1683  1.12  christos #define ACPI_PPTT_CACHE_TYPE_DATA           (0x0)   /* Data cache */
   1684  1.12  christos #define ACPI_PPTT_CACHE_TYPE_INSTR          (1<<2)  /* Instruction cache */
   1685  1.12  christos #define ACPI_PPTT_CACHE_TYPE_UNIFIED        (2<<2)  /* Unified I & D cache */
   1686  1.12  christos #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT    (3<<2)  /* Alternate representation of above */
   1687  1.12  christos 
   1688  1.12  christos #define ACPI_PPTT_CACHE_POLICY_WB           (0x0)   /* Cache is write back */
   1689  1.12  christos #define ACPI_PPTT_CACHE_POLICY_WT           (1<<4)  /* Cache is write through */
   1690  1.11  christos 
   1691  1.11  christos /* 2: ID Structure */
   1692  1.11  christos 
   1693  1.11  christos typedef struct acpi_pptt_id
   1694  1.11  christos {
   1695  1.11  christos     ACPI_SUBTABLE_HEADER    Header;
   1696  1.11  christos     UINT16                  Reserved;
   1697  1.11  christos     UINT32                  VendorId;
   1698  1.11  christos     UINT64                  Level1Id;
   1699  1.11  christos     UINT64                  Level2Id;
   1700  1.11  christos     UINT16                  MajorRev;
   1701  1.11  christos     UINT16                  MinorRev;
   1702  1.11  christos     UINT16                  SpinRev;
   1703  1.11  christos 
   1704  1.11  christos } ACPI_PPTT_ID;
   1705  1.11  christos 
   1706  1.11  christos 
   1707  1.11  christos /*******************************************************************************
   1708  1.11  christos  *
   1709   1.1    jruoho  * SBST - Smart Battery Specification Table
   1710   1.1    jruoho  *        Version 1
   1711   1.1    jruoho  *
   1712   1.1    jruoho  ******************************************************************************/
   1713   1.1    jruoho 
   1714   1.1    jruoho typedef struct acpi_table_sbst
   1715   1.1    jruoho {
   1716   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
   1717   1.1    jruoho     UINT32                  WarningLevel;
   1718   1.1    jruoho     UINT32                  LowLevel;
   1719   1.1    jruoho     UINT32                  CriticalLevel;
   1720   1.1    jruoho 
   1721   1.1    jruoho } ACPI_TABLE_SBST;
   1722   1.1    jruoho 
   1723   1.1    jruoho 
   1724   1.1    jruoho /*******************************************************************************
   1725   1.1    jruoho  *
   1726  1.12  christos  * SDEV - Secure Devices Table (ACPI 6.2)
   1727  1.12  christos  *        Version 1
   1728  1.12  christos  *
   1729  1.12  christos  ******************************************************************************/
   1730  1.12  christos 
   1731  1.12  christos typedef struct acpi_table_sdev
   1732  1.12  christos {
   1733  1.12  christos     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
   1734  1.12  christos 
   1735  1.12  christos } ACPI_TABLE_SDEV;
   1736  1.12  christos 
   1737  1.12  christos 
   1738  1.12  christos typedef struct acpi_sdev_header
   1739  1.12  christos {
   1740  1.12  christos     UINT8                   Type;
   1741  1.12  christos     UINT8                   Flags;
   1742  1.12  christos     UINT16                  Length;
   1743  1.12  christos 
   1744  1.12  christos } ACPI_SDEV_HEADER;
   1745  1.12  christos 
   1746  1.12  christos 
   1747  1.12  christos /* Values for subtable type above */
   1748  1.12  christos 
   1749  1.12  christos enum AcpiSdevType
   1750  1.12  christos {
   1751  1.12  christos     ACPI_SDEV_TYPE_NAMESPACE_DEVICE     = 0,
   1752  1.12  christos     ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
   1753  1.12  christos     ACPI_SDEV_TYPE_RESERVED             = 2     /* 2 and greater are reserved */
   1754  1.12  christos };
   1755  1.12  christos 
   1756  1.12  christos /* Values for flags above */
   1757  1.12  christos 
   1758  1.12  christos #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS    (1)
   1759  1.12  christos 
   1760  1.12  christos /*
   1761  1.12  christos  * SDEV subtables
   1762  1.12  christos  */
   1763  1.12  christos 
   1764  1.12  christos /* 0: Namespace Device Based Secure Device Structure */
   1765  1.12  christos 
   1766  1.12  christos typedef struct acpi_sdev_namespace
   1767  1.12  christos {
   1768  1.12  christos     ACPI_SDEV_HEADER        Header;
   1769  1.12  christos     UINT16                  DeviceIdOffset;
   1770  1.12  christos     UINT16                  DeviceIdLength;
   1771  1.12  christos     UINT16                  VendorDataOffset;
   1772  1.12  christos     UINT16                  VendorDataLength;
   1773  1.12  christos 
   1774  1.12  christos } ACPI_SDEV_NAMESPACE;
   1775  1.12  christos 
   1776  1.12  christos /* 1: PCIe Endpoint Device Based Device Structure */
   1777  1.12  christos 
   1778  1.12  christos typedef struct acpi_sdev_pcie
   1779  1.12  christos {
   1780  1.12  christos     ACPI_SDEV_HEADER        Header;
   1781  1.12  christos     UINT16                  Segment;
   1782  1.12  christos     UINT16                  StartBus;
   1783  1.12  christos     UINT16                  PathOffset;
   1784  1.12  christos     UINT16                  PathLength;
   1785  1.12  christos     UINT16                  VendorDataOffset;
   1786  1.12  christos     UINT16                  VendorDataLength;
   1787  1.12  christos 
   1788  1.12  christos } ACPI_SDEV_PCIE;
   1789  1.12  christos 
   1790  1.12  christos /* 1a: PCIe Endpoint path entry */
   1791  1.12  christos 
   1792  1.12  christos typedef struct acpi_sdev_pcie_path
   1793  1.12  christos {
   1794  1.12  christos     UINT8                   Device;
   1795  1.12  christos     UINT8                   Function;
   1796  1.12  christos 
   1797  1.12  christos } ACPI_SDEV_PCIE_PATH;
   1798  1.12  christos 
   1799  1.12  christos 
   1800  1.12  christos /*******************************************************************************
   1801  1.12  christos  *
   1802   1.1    jruoho  * SLIT - System Locality Distance Information Table
   1803   1.1    jruoho  *        Version 1
   1804   1.1    jruoho  *
   1805   1.1    jruoho  ******************************************************************************/
   1806   1.1    jruoho 
   1807   1.1    jruoho typedef struct acpi_table_slit
   1808   1.1    jruoho {
   1809   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
   1810   1.1    jruoho     UINT64                  LocalityCount;
   1811   1.1    jruoho     UINT8                   Entry[1];           /* Real size = localities^2 */
   1812   1.1    jruoho 
   1813   1.1    jruoho } ACPI_TABLE_SLIT;
   1814   1.1    jruoho 
   1815   1.1    jruoho 
   1816   1.1    jruoho /*******************************************************************************
   1817   1.1    jruoho  *
   1818   1.1    jruoho  * SRAT - System Resource Affinity Table
   1819   1.1    jruoho  *        Version 3
   1820   1.1    jruoho  *
   1821   1.1    jruoho  ******************************************************************************/
   1822   1.1    jruoho 
   1823   1.1    jruoho typedef struct acpi_table_srat
   1824   1.1    jruoho {
   1825   1.1    jruoho     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
   1826   1.1    jruoho     UINT32                  TableRevision;      /* Must be value '1' */
   1827   1.1    jruoho     UINT64                  Reserved;           /* Reserved, must be zero */
   1828   1.1    jruoho 
   1829   1.1    jruoho } ACPI_TABLE_SRAT;
   1830   1.1    jruoho 
   1831   1.1    jruoho /* Values for subtable type in ACPI_SUBTABLE_HEADER */
   1832   1.1    jruoho 
   1833   1.1    jruoho enum AcpiSratType
   1834   1.1    jruoho {
   1835   1.1    jruoho     ACPI_SRAT_TYPE_CPU_AFFINITY         = 0,
   1836   1.1    jruoho     ACPI_SRAT_TYPE_MEMORY_AFFINITY      = 1,
   1837   1.1    jruoho     ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY  = 2,
   1838   1.5  christos     ACPI_SRAT_TYPE_GICC_AFFINITY        = 3,
   1839  1.11  christos     ACPI_SRAT_TYPE_GIC_ITS_AFFINITY     = 4,    /* ACPI 6.2 */
   1840  1.11  christos     ACPI_SRAT_TYPE_RESERVED             = 5     /* 5 and greater are reserved */
   1841   1.1    jruoho };
   1842   1.1    jruoho 
   1843   1.1    jruoho /*
   1844   1.5  christos  * SRAT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER
   1845   1.1    jruoho  */
   1846   1.1    jruoho 
   1847   1.1    jruoho /* 0: Processor Local APIC/SAPIC Affinity */
   1848   1.1    jruoho 
   1849   1.1    jruoho typedef struct acpi_srat_cpu_affinity
   1850   1.1    jruoho {
   1851   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1852   1.1    jruoho     UINT8                   ProximityDomainLo;
   1853   1.1    jruoho     UINT8                   ApicId;
   1854   1.1    jruoho     UINT32                  Flags;
   1855   1.1    jruoho     UINT8                   LocalSapicEid;
   1856   1.1    jruoho     UINT8                   ProximityDomainHi[3];
   1857   1.2    jruoho     UINT32                  ClockDomain;
   1858   1.1    jruoho 
   1859   1.1    jruoho } ACPI_SRAT_CPU_AFFINITY;
   1860   1.1    jruoho 
   1861   1.1    jruoho /* Flags */
   1862   1.1    jruoho 
   1863   1.1    jruoho #define ACPI_SRAT_CPU_USE_AFFINITY  (1)         /* 00: Use affinity structure */
   1864   1.1    jruoho 
   1865   1.1    jruoho 
   1866   1.1    jruoho /* 1: Memory Affinity */
   1867   1.1    jruoho 
   1868   1.1    jruoho typedef struct acpi_srat_mem_affinity
   1869   1.1    jruoho {
   1870   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1871   1.1    jruoho     UINT32                  ProximityDomain;
   1872   1.1    jruoho     UINT16                  Reserved;           /* Reserved, must be zero */
   1873   1.1    jruoho     UINT64                  BaseAddress;
   1874   1.1    jruoho     UINT64                  Length;
   1875   1.1    jruoho     UINT32                  Reserved1;
   1876   1.1    jruoho     UINT32                  Flags;
   1877   1.1    jruoho     UINT64                  Reserved2;          /* Reserved, must be zero */
   1878   1.1    jruoho 
   1879   1.1    jruoho } ACPI_SRAT_MEM_AFFINITY;
   1880   1.1    jruoho 
   1881   1.1    jruoho /* Flags */
   1882   1.1    jruoho 
   1883   1.1    jruoho #define ACPI_SRAT_MEM_ENABLED       (1)         /* 00: Use affinity structure */
   1884   1.1    jruoho #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1)      /* 01: Memory region is hot pluggable */
   1885   1.1    jruoho #define ACPI_SRAT_MEM_NON_VOLATILE  (1<<2)      /* 02: Memory region is non-volatile */
   1886   1.1    jruoho 
   1887   1.1    jruoho 
   1888   1.1    jruoho /* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */
   1889   1.1    jruoho 
   1890   1.1    jruoho typedef struct acpi_srat_x2apic_cpu_affinity
   1891   1.1    jruoho {
   1892   1.1    jruoho     ACPI_SUBTABLE_HEADER    Header;
   1893   1.1    jruoho     UINT16                  Reserved;           /* Reserved, must be zero */
   1894   1.1    jruoho     UINT32                  ProximityDomain;
   1895   1.1    jruoho     UINT32                  ApicId;
   1896   1.1    jruoho     UINT32                  Flags;
   1897   1.1    jruoho     UINT32                  ClockDomain;
   1898   1.1    jruoho     UINT32                  Reserved2;
   1899   1.1    jruoho 
   1900   1.1    jruoho } ACPI_SRAT_X2APIC_CPU_AFFINITY;
   1901   1.1    jruoho 
   1902   1.1    jruoho /* Flags for ACPI_SRAT_CPU_AFFINITY and ACPI_SRAT_X2APIC_CPU_AFFINITY */
   1903   1.1    jruoho 
   1904   1.1    jruoho #define ACPI_SRAT_CPU_ENABLED       (1)         /* 00: Use affinity structure */
   1905   1.1    jruoho 
   1906   1.1    jruoho 
   1907   1.5  christos /* 3: GICC Affinity (ACPI 5.1) */
   1908   1.5  christos 
   1909   1.5  christos typedef struct acpi_srat_gicc_affinity
   1910   1.5  christos {
   1911   1.5  christos     ACPI_SUBTABLE_HEADER    Header;
   1912   1.5  christos     UINT32                  ProximityDomain;
   1913   1.5  christos     UINT32                  AcpiProcessorUid;
   1914   1.5  christos     UINT32                  Flags;
   1915   1.5  christos     UINT32                  ClockDomain;
   1916   1.5  christos 
   1917   1.5  christos } ACPI_SRAT_GICC_AFFINITY;
   1918   1.5  christos 
   1919   1.5  christos /* Flags for ACPI_SRAT_GICC_AFFINITY */
   1920   1.5  christos 
   1921   1.5  christos #define ACPI_SRAT_GICC_ENABLED     (1)         /* 00: Use affinity structure */
   1922   1.5  christos 
   1923   1.7  christos 
   1924  1.11  christos /* 4: GCC ITS Affinity (ACPI 6.2) */
   1925  1.11  christos 
   1926  1.11  christos typedef struct acpi_srat_gic_its_affinity
   1927  1.11  christos {
   1928  1.11  christos     ACPI_SUBTABLE_HEADER    Header;
   1929  1.11  christos     UINT32                  ProximityDomain;
   1930  1.11  christos     UINT16                  Reserved;
   1931  1.11  christos     UINT32                  ItsId;
   1932  1.11  christos 
   1933  1.11  christos } ACPI_SRAT_GIC_ITS_AFFINITY;
   1934  1.11  christos 
   1935  1.11  christos 
   1936   1.1    jruoho /* Reset to default packing */
   1937   1.1    jruoho 
   1938   1.1    jruoho #pragma pack()
   1939   1.1    jruoho 
   1940   1.1    jruoho #endif /* __ACTBL1_H__ */
   1941