xref: /freebsd/sys/contrib/dev/acpica/include/actbl.h (revision a371a5fd85363e96ff9aaebf7848cbdd06a33d26)
1a9f12690SJung-uk Kim /******************************************************************************
2a9f12690SJung-uk Kim  *
3a9f12690SJung-uk Kim  * Name: actbl.h - Basic ACPI Table Definitions
4a9f12690SJung-uk Kim  *
5a9f12690SJung-uk Kim  *****************************************************************************/
6a9f12690SJung-uk Kim 
7d244b227SJung-uk Kim /*
81c0e1b6dSJung-uk Kim  * Copyright (C) 2000 - 2015, Intel Corp.
9a9f12690SJung-uk Kim  * All rights reserved.
10a9f12690SJung-uk Kim  *
11d244b227SJung-uk Kim  * Redistribution and use in source and binary forms, with or without
12d244b227SJung-uk Kim  * modification, are permitted provided that the following conditions
13d244b227SJung-uk Kim  * are met:
14d244b227SJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
15d244b227SJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
16d244b227SJung-uk Kim  *    without modification.
17d244b227SJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18d244b227SJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
19d244b227SJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
20d244b227SJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
21d244b227SJung-uk Kim  *    binary redistribution.
22d244b227SJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
23d244b227SJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
24d244b227SJung-uk Kim  *    from this software without specific prior written permission.
25a9f12690SJung-uk Kim  *
26d244b227SJung-uk Kim  * Alternatively, this software may be distributed under the terms of the
27d244b227SJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
28d244b227SJung-uk Kim  * Software Foundation.
29a9f12690SJung-uk Kim  *
30d244b227SJung-uk Kim  * NO WARRANTY
31d244b227SJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32d244b227SJung-uk Kim  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33d244b227SJung-uk Kim  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34d244b227SJung-uk Kim  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35d244b227SJung-uk Kim  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36d244b227SJung-uk Kim  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37d244b227SJung-uk Kim  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38d244b227SJung-uk Kim  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39d244b227SJung-uk Kim  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40d244b227SJung-uk Kim  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41d244b227SJung-uk Kim  * POSSIBILITY OF SUCH DAMAGES.
42d244b227SJung-uk Kim  */
43a9f12690SJung-uk Kim 
44a9f12690SJung-uk Kim #ifndef __ACTBL_H__
45a9f12690SJung-uk Kim #define __ACTBL_H__
46a9f12690SJung-uk Kim 
47d6dd1baeSJung-uk Kim 
48d6dd1baeSJung-uk Kim /*******************************************************************************
49d6dd1baeSJung-uk Kim  *
50d6dd1baeSJung-uk Kim  * Fundamental ACPI tables
51d6dd1baeSJung-uk Kim  *
52d6dd1baeSJung-uk Kim  * This file contains definitions for the ACPI tables that are directly consumed
53d6dd1baeSJung-uk Kim  * by ACPICA. All other tables are consumed by the OS-dependent ACPI-related
54d6dd1baeSJung-uk Kim  * device drivers and other OS support code.
55d6dd1baeSJung-uk Kim  *
56d6dd1baeSJung-uk Kim  * The RSDP and FACS do not use the common ACPI table header. All other ACPI
57d6dd1baeSJung-uk Kim  * tables use the header.
58d6dd1baeSJung-uk Kim  *
59d6dd1baeSJung-uk Kim  ******************************************************************************/
60d6dd1baeSJung-uk Kim 
61d6dd1baeSJung-uk Kim 
62a9f12690SJung-uk Kim /*
63d6dd1baeSJung-uk Kim  * Values for description table header signatures for tables defined in this
64d6dd1baeSJung-uk Kim  * file. Useful because they make it more difficult to inadvertently type in
65d6dd1baeSJung-uk Kim  * the wrong signature.
66a9f12690SJung-uk Kim  */
67a9f12690SJung-uk Kim #define ACPI_SIG_DSDT           "DSDT"      /* Differentiated System Description Table */
68a9f12690SJung-uk Kim #define ACPI_SIG_FADT           "FACP"      /* Fixed ACPI Description Table */
69a9f12690SJung-uk Kim #define ACPI_SIG_FACS           "FACS"      /* Firmware ACPI Control Structure */
70a9f12690SJung-uk Kim #define ACPI_SIG_PSDT           "PSDT"      /* Persistent System Description Table */
71a9f12690SJung-uk Kim #define ACPI_SIG_RSDP           "RSD PTR "  /* Root System Description Pointer */
72a9f12690SJung-uk Kim #define ACPI_SIG_RSDT           "RSDT"      /* Root System Description Table */
73a9f12690SJung-uk Kim #define ACPI_SIG_XSDT           "XSDT"      /* Extended  System Description Table */
74a9f12690SJung-uk Kim #define ACPI_SIG_SSDT           "SSDT"      /* Secondary System Description Table */
75a9f12690SJung-uk Kim #define ACPI_RSDP_NAME          "RSDP"      /* Short name for RSDP, not signature */
76a9f12690SJung-uk Kim 
77a9f12690SJung-uk Kim 
78a9f12690SJung-uk Kim /*
79a9f12690SJung-uk Kim  * All tables and structures must be byte-packed to match the ACPI
80a9f12690SJung-uk Kim  * specification, since the tables are provided by the system BIOS
81a9f12690SJung-uk Kim  */
82a9f12690SJung-uk Kim #pragma pack(1)
83a9f12690SJung-uk Kim 
84a9f12690SJung-uk Kim /*
851df130f1SJung-uk Kim  * Note: C bitfields are not used for this reason:
861df130f1SJung-uk Kim  *
871df130f1SJung-uk Kim  * "Bitfields are great and easy to read, but unfortunately the C language
881df130f1SJung-uk Kim  * does not specify the layout of bitfields in memory, which means they are
891df130f1SJung-uk Kim  * essentially useless for dealing with packed data in on-disk formats or
901df130f1SJung-uk Kim  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
911df130f1SJung-uk Kim  * this decision was a design error in C. Ritchie could have picked an order
921df130f1SJung-uk Kim  * and stuck with it." Norman Ramsey.
931df130f1SJung-uk Kim  * See http://stackoverflow.com/a/1053662/41661
94a9f12690SJung-uk Kim  */
95a9f12690SJung-uk Kim 
96d6dd1baeSJung-uk Kim 
97a9f12690SJung-uk Kim /*******************************************************************************
98a9f12690SJung-uk Kim  *
99d6dd1baeSJung-uk Kim  * Master ACPI Table Header. This common header is used by all ACPI tables
100d6dd1baeSJung-uk Kim  * except the RSDP and FACS.
101a9f12690SJung-uk Kim  *
102a9f12690SJung-uk Kim  ******************************************************************************/
103a9f12690SJung-uk Kim 
104a9f12690SJung-uk Kim typedef struct acpi_table_header
105a9f12690SJung-uk Kim {
106a9f12690SJung-uk Kim     char                    Signature[ACPI_NAME_SIZE];          /* ASCII table signature */
107a9f12690SJung-uk Kim     UINT32                  Length;                             /* Length of table in bytes, including this header */
1081df130f1SJung-uk Kim     UINT8                   Revision;                           /* ACPI Specification minor version number */
109a9f12690SJung-uk Kim     UINT8                   Checksum;                           /* To make sum of entire table == 0 */
110a9f12690SJung-uk Kim     char                    OemId[ACPI_OEM_ID_SIZE];            /* ASCII OEM identification */
111a9f12690SJung-uk Kim     char                    OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
112a9f12690SJung-uk Kim     UINT32                  OemRevision;                        /* OEM revision number */
113a9f12690SJung-uk Kim     char                    AslCompilerId[ACPI_NAME_SIZE];      /* ASCII ASL compiler vendor ID */
114a9f12690SJung-uk Kim     UINT32                  AslCompilerRevision;                /* ASL compiler version */
115a9f12690SJung-uk Kim 
116a9f12690SJung-uk Kim } ACPI_TABLE_HEADER;
117a9f12690SJung-uk Kim 
118a9f12690SJung-uk Kim 
119d6dd1baeSJung-uk Kim /*******************************************************************************
120d6dd1baeSJung-uk Kim  *
121a9f12690SJung-uk Kim  * GAS - Generic Address Structure (ACPI 2.0+)
122a9f12690SJung-uk Kim  *
123a9f12690SJung-uk Kim  * Note: Since this structure is used in the ACPI tables, it is byte aligned.
1241df130f1SJung-uk Kim  * If misaligned access is not supported by the hardware, accesses to the
125d6dd1baeSJung-uk Kim  * 64-bit Address field must be performed with care.
126d6dd1baeSJung-uk Kim  *
127d6dd1baeSJung-uk Kim  ******************************************************************************/
128d6dd1baeSJung-uk Kim 
129a9f12690SJung-uk Kim typedef struct acpi_generic_address
130a9f12690SJung-uk Kim {
131a9f12690SJung-uk Kim     UINT8                   SpaceId;                /* Address space where struct or register exists */
132a9f12690SJung-uk Kim     UINT8                   BitWidth;               /* Size in bits of given register */
133a9f12690SJung-uk Kim     UINT8                   BitOffset;              /* Bit offset within the register */
134a9f12690SJung-uk Kim     UINT8                   AccessWidth;            /* Minimum Access size (ACPI 3.0) */
135a9f12690SJung-uk Kim     UINT64                  Address;                /* 64-bit address of struct or register */
136a9f12690SJung-uk Kim 
137a9f12690SJung-uk Kim } ACPI_GENERIC_ADDRESS;
138a9f12690SJung-uk Kim 
139a9f12690SJung-uk Kim 
140a9f12690SJung-uk Kim /*******************************************************************************
141a9f12690SJung-uk Kim  *
142a9f12690SJung-uk Kim  * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
143d6dd1baeSJung-uk Kim  *        Version 2
144a9f12690SJung-uk Kim  *
145a9f12690SJung-uk Kim  ******************************************************************************/
146a9f12690SJung-uk Kim 
147a9f12690SJung-uk Kim typedef struct acpi_table_rsdp
148a9f12690SJung-uk Kim {
149a9f12690SJung-uk Kim     char                    Signature[8];               /* ACPI signature, contains "RSD PTR " */
150a9f12690SJung-uk Kim     UINT8                   Checksum;                   /* ACPI 1.0 checksum */
151a9f12690SJung-uk Kim     char                    OemId[ACPI_OEM_ID_SIZE];    /* OEM identification */
152a9f12690SJung-uk Kim     UINT8                   Revision;                   /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
153a9f12690SJung-uk Kim     UINT32                  RsdtPhysicalAddress;        /* 32-bit physical address of the RSDT */
154a9f12690SJung-uk Kim     UINT32                  Length;                     /* Table length in bytes, including header (ACPI 2.0+) */
155a9f12690SJung-uk Kim     UINT64                  XsdtPhysicalAddress;        /* 64-bit physical address of the XSDT (ACPI 2.0+) */
156a9f12690SJung-uk Kim     UINT8                   ExtendedChecksum;           /* Checksum of entire table (ACPI 2.0+) */
157a9f12690SJung-uk Kim     UINT8                   Reserved[3];                /* Reserved, must be zero */
158a9f12690SJung-uk Kim 
159a9f12690SJung-uk Kim } ACPI_TABLE_RSDP;
160a9f12690SJung-uk Kim 
161a88e22b7SJung-uk Kim /* Standalone struct for the ACPI 1.0 RSDP */
162a88e22b7SJung-uk Kim 
163a88e22b7SJung-uk Kim typedef struct acpi_rsdp_common
164a88e22b7SJung-uk Kim {
165a88e22b7SJung-uk Kim     char                    Signature[8];
166a88e22b7SJung-uk Kim     UINT8                   Checksum;
167a88e22b7SJung-uk Kim     char                    OemId[ACPI_OEM_ID_SIZE];
168a88e22b7SJung-uk Kim     UINT8                   Revision;
169a88e22b7SJung-uk Kim     UINT32                  RsdtPhysicalAddress;
170a88e22b7SJung-uk Kim 
171a88e22b7SJung-uk Kim } ACPI_RSDP_COMMON;
172a88e22b7SJung-uk Kim 
173a88e22b7SJung-uk Kim /* Standalone struct for the extended part of the RSDP (ACPI 2.0+) */
174a88e22b7SJung-uk Kim 
175a88e22b7SJung-uk Kim typedef struct acpi_rsdp_extension
176a88e22b7SJung-uk Kim {
177a88e22b7SJung-uk Kim     UINT32                  Length;
178a88e22b7SJung-uk Kim     UINT64                  XsdtPhysicalAddress;
179a88e22b7SJung-uk Kim     UINT8                   ExtendedChecksum;
180a88e22b7SJung-uk Kim     UINT8                   Reserved[3];
181a88e22b7SJung-uk Kim 
182a88e22b7SJung-uk Kim } ACPI_RSDP_EXTENSION;
183a9f12690SJung-uk Kim 
184a9f12690SJung-uk Kim 
185a9f12690SJung-uk Kim /*******************************************************************************
186a9f12690SJung-uk Kim  *
187a9f12690SJung-uk Kim  * RSDT/XSDT - Root System Description Tables
188d6dd1baeSJung-uk Kim  *             Version 1 (both)
189a9f12690SJung-uk Kim  *
190a9f12690SJung-uk Kim  ******************************************************************************/
191a9f12690SJung-uk Kim 
192a9f12690SJung-uk Kim typedef struct acpi_table_rsdt
193a9f12690SJung-uk Kim {
194a9f12690SJung-uk Kim     ACPI_TABLE_HEADER       Header;                 /* Common ACPI table header */
195a9f12690SJung-uk Kim     UINT32                  TableOffsetEntry[1];    /* Array of pointers to ACPI tables */
196a9f12690SJung-uk Kim 
197a9f12690SJung-uk Kim } ACPI_TABLE_RSDT;
198a9f12690SJung-uk Kim 
199a9f12690SJung-uk Kim typedef struct acpi_table_xsdt
200a9f12690SJung-uk Kim {
201a9f12690SJung-uk Kim     ACPI_TABLE_HEADER       Header;                 /* Common ACPI table header */
202a9f12690SJung-uk Kim     UINT64                  TableOffsetEntry[1];    /* Array of pointers to ACPI tables */
203a9f12690SJung-uk Kim 
204a9f12690SJung-uk Kim } ACPI_TABLE_XSDT;
205a9f12690SJung-uk Kim 
206313a0c13SJung-uk Kim #define ACPI_RSDT_ENTRY_SIZE        (sizeof (UINT32))
207313a0c13SJung-uk Kim #define ACPI_XSDT_ENTRY_SIZE        (sizeof (UINT64))
208313a0c13SJung-uk Kim 
209a9f12690SJung-uk Kim 
210a9f12690SJung-uk Kim /*******************************************************************************
211a9f12690SJung-uk Kim  *
212a9f12690SJung-uk Kim  * FACS - Firmware ACPI Control Structure (FACS)
213a9f12690SJung-uk Kim  *
214a9f12690SJung-uk Kim  ******************************************************************************/
215a9f12690SJung-uk Kim 
216a9f12690SJung-uk Kim typedef struct acpi_table_facs
217a9f12690SJung-uk Kim {
218a9f12690SJung-uk Kim     char                    Signature[4];           /* ASCII table signature */
219a9f12690SJung-uk Kim     UINT32                  Length;                 /* Length of structure, in bytes */
220a9f12690SJung-uk Kim     UINT32                  HardwareSignature;      /* Hardware configuration signature */
221a9f12690SJung-uk Kim     UINT32                  FirmwareWakingVector;   /* 32-bit physical address of the Firmware Waking Vector */
222a9f12690SJung-uk Kim     UINT32                  GlobalLock;             /* Global Lock for shared hardware resources */
223a9f12690SJung-uk Kim     UINT32                  Flags;
224a9f12690SJung-uk Kim     UINT64                  XFirmwareWakingVector;  /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
225a9f12690SJung-uk Kim     UINT8                   Version;                /* Version of this table (ACPI 2.0+) */
226d6dd1baeSJung-uk Kim     UINT8                   Reserved[3];            /* Reserved, must be zero */
227d6dd1baeSJung-uk Kim     UINT32                  OspmFlags;              /* Flags to be set by OSPM (ACPI 4.0) */
228d6dd1baeSJung-uk Kim     UINT8                   Reserved1[24];          /* Reserved, must be zero */
229a9f12690SJung-uk Kim 
230a9f12690SJung-uk Kim } ACPI_TABLE_FACS;
231a9f12690SJung-uk Kim 
232d6dd1baeSJung-uk Kim /* Masks for GlobalLock flag field above */
233d6dd1baeSJung-uk Kim 
234d6dd1baeSJung-uk Kim #define ACPI_GLOCK_PENDING          (1)             /* 00: Pending global lock ownership */
235d6dd1baeSJung-uk Kim #define ACPI_GLOCK_OWNED            (1<<1)          /* 01: Global lock is owned */
236d6dd1baeSJung-uk Kim 
237d6dd1baeSJung-uk Kim /* Masks for Flags field above  */
238a9f12690SJung-uk Kim 
239a9f12690SJung-uk Kim #define ACPI_FACS_S4_BIOS_PRESENT   (1)             /* 00: S4BIOS support is present */
240d6dd1baeSJung-uk Kim #define ACPI_FACS_64BIT_WAKE        (1<<1)          /* 01: 64-bit wake vector supported (ACPI 4.0) */
241a9f12690SJung-uk Kim 
242d6dd1baeSJung-uk Kim /* Masks for OspmFlags field above */
243a9f12690SJung-uk Kim 
244d6dd1baeSJung-uk Kim #define ACPI_FACS_64BIT_ENVIRONMENT (1)             /* 00: 64-bit wake environment is required (ACPI 4.0) */
245a9f12690SJung-uk Kim 
246a9f12690SJung-uk Kim 
247a9f12690SJung-uk Kim /*******************************************************************************
248a9f12690SJung-uk Kim  *
249a9f12690SJung-uk Kim  * FADT - Fixed ACPI Description Table (Signature "FACP")
250d6dd1baeSJung-uk Kim  *        Version 4
251a9f12690SJung-uk Kim  *
252a9f12690SJung-uk Kim  ******************************************************************************/
253a9f12690SJung-uk Kim 
254a9f12690SJung-uk Kim /* Fields common to all versions of the FADT */
255a9f12690SJung-uk Kim 
256a9f12690SJung-uk Kim typedef struct acpi_table_fadt
257a9f12690SJung-uk Kim {
258a9f12690SJung-uk Kim     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
259a9f12690SJung-uk Kim     UINT32                  Facs;               /* 32-bit physical address of FACS */
260a9f12690SJung-uk Kim     UINT32                  Dsdt;               /* 32-bit physical address of DSDT */
261a9f12690SJung-uk Kim     UINT8                   Model;              /* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */
262a9f12690SJung-uk Kim     UINT8                   PreferredProfile;   /* Conveys preferred power management profile to OSPM. */
263a9f12690SJung-uk Kim     UINT16                  SciInterrupt;       /* System vector of SCI interrupt */
264a9f12690SJung-uk Kim     UINT32                  SmiCommand;         /* 32-bit Port address of SMI command port */
2651df130f1SJung-uk Kim     UINT8                   AcpiEnable;         /* Value to write to SMI_CMD to enable ACPI */
2661df130f1SJung-uk Kim     UINT8                   AcpiDisable;        /* Value to write to SMI_CMD to disable ACPI */
2671df130f1SJung-uk Kim     UINT8                   S4BiosRequest;      /* Value to write to SMI_CMD to enter S4BIOS state */
268a9f12690SJung-uk Kim     UINT8                   PstateControl;      /* Processor performance state control*/
2691df130f1SJung-uk Kim     UINT32                  Pm1aEventBlock;     /* 32-bit port address of Power Mgt 1a Event Reg Blk */
2701df130f1SJung-uk Kim     UINT32                  Pm1bEventBlock;     /* 32-bit port address of Power Mgt 1b Event Reg Blk */
2711df130f1SJung-uk Kim     UINT32                  Pm1aControlBlock;   /* 32-bit port address of Power Mgt 1a Control Reg Blk */
2721df130f1SJung-uk Kim     UINT32                  Pm1bControlBlock;   /* 32-bit port address of Power Mgt 1b Control Reg Blk */
2731df130f1SJung-uk Kim     UINT32                  Pm2ControlBlock;    /* 32-bit port address of Power Mgt 2 Control Reg Blk */
2741df130f1SJung-uk Kim     UINT32                  PmTimerBlock;       /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */
2751df130f1SJung-uk Kim     UINT32                  Gpe0Block;          /* 32-bit port address of General Purpose Event 0 Reg Blk */
2761df130f1SJung-uk Kim     UINT32                  Gpe1Block;          /* 32-bit port address of General Purpose Event 1 Reg Blk */
277a9f12690SJung-uk Kim     UINT8                   Pm1EventLength;     /* Byte Length of ports at Pm1xEventBlock */
278a9f12690SJung-uk Kim     UINT8                   Pm1ControlLength;   /* Byte Length of ports at Pm1xControlBlock */
279a9f12690SJung-uk Kim     UINT8                   Pm2ControlLength;   /* Byte Length of ports at Pm2ControlBlock */
280a9f12690SJung-uk Kim     UINT8                   PmTimerLength;      /* Byte Length of ports at PmTimerBlock */
281a9f12690SJung-uk Kim     UINT8                   Gpe0BlockLength;    /* Byte Length of ports at Gpe0Block */
282a9f12690SJung-uk Kim     UINT8                   Gpe1BlockLength;    /* Byte Length of ports at Gpe1Block */
283a9f12690SJung-uk Kim     UINT8                   Gpe1Base;           /* Offset in GPE number space where GPE1 events start */
2841df130f1SJung-uk Kim     UINT8                   CstControl;         /* Support for the _CST object and C-States change notification */
285a9f12690SJung-uk Kim     UINT16                  C2Latency;          /* Worst case HW latency to enter/exit C2 state */
286a9f12690SJung-uk Kim     UINT16                  C3Latency;          /* Worst case HW latency to enter/exit C3 state */
2871df130f1SJung-uk Kim     UINT16                  FlushSize;          /* Processor memory cache line width, in bytes */
288a9f12690SJung-uk Kim     UINT16                  FlushStride;        /* Number of flush strides that need to be read */
2891df130f1SJung-uk Kim     UINT8                   DutyOffset;         /* Processor duty cycle index in processor P_CNT reg */
290a9f12690SJung-uk Kim     UINT8                   DutyWidth;          /* Processor duty cycle value bit width in P_CNT register */
291a9f12690SJung-uk Kim     UINT8                   DayAlarm;           /* Index to day-of-month alarm in RTC CMOS RAM */
292a9f12690SJung-uk Kim     UINT8                   MonthAlarm;         /* Index to month-of-year alarm in RTC CMOS RAM */
293a9f12690SJung-uk Kim     UINT8                   Century;            /* Index to century in RTC CMOS RAM */
294a9f12690SJung-uk Kim     UINT16                  BootFlags;          /* IA-PC Boot Architecture Flags (see below for individual flags) */
295a9f12690SJung-uk Kim     UINT8                   Reserved;           /* Reserved, must be zero */
296a9f12690SJung-uk Kim     UINT32                  Flags;              /* Miscellaneous flag bits (see below for individual flags) */
297a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    ResetRegister;      /* 64-bit address of the Reset register */
298a9f12690SJung-uk Kim     UINT8                   ResetValue;         /* Value to write to the ResetRegister port to reset the system */
299313a0c13SJung-uk Kim     UINT16                  ArmBootFlags;       /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */
300313a0c13SJung-uk Kim     UINT8                   MinorRevision;      /* FADT Minor Revision (ACPI 5.1) */
301a9f12690SJung-uk Kim     UINT64                  XFacs;              /* 64-bit physical address of FACS */
302a9f12690SJung-uk Kim     UINT64                  XDsdt;              /* 64-bit physical address of DSDT */
303a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    XPm1aEventBlock;    /* 64-bit Extended Power Mgt 1a Event Reg Blk address */
304a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    XPm1bEventBlock;    /* 64-bit Extended Power Mgt 1b Event Reg Blk address */
305a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    XPm1aControlBlock;  /* 64-bit Extended Power Mgt 1a Control Reg Blk address */
306a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    XPm1bControlBlock;  /* 64-bit Extended Power Mgt 1b Control Reg Blk address */
307a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    XPm2ControlBlock;   /* 64-bit Extended Power Mgt 2 Control Reg Blk address */
308a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    XPmTimerBlock;      /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
309a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    XGpe0Block;         /* 64-bit Extended General Purpose Event 0 Reg Blk address */
310a9f12690SJung-uk Kim     ACPI_GENERIC_ADDRESS    XGpe1Block;         /* 64-bit Extended General Purpose Event 1 Reg Blk address */
3111df130f1SJung-uk Kim     ACPI_GENERIC_ADDRESS    SleepControl;       /* 64-bit Sleep Control register (ACPI 5.0) */
3121df130f1SJung-uk Kim     ACPI_GENERIC_ADDRESS    SleepStatus;        /* 64-bit Sleep Status register (ACPI 5.0) */
313*a371a5fdSJung-uk Kim     UINT64                  HypervisorId;       /* Hypervisor Vendor ID (ACPI 6.0) */
314a9f12690SJung-uk Kim 
315a9f12690SJung-uk Kim } ACPI_TABLE_FADT;
316a9f12690SJung-uk Kim 
317a9f12690SJung-uk Kim 
318313a0c13SJung-uk Kim /* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */
319a9f12690SJung-uk Kim 
320a9f12690SJung-uk Kim #define ACPI_FADT_LEGACY_DEVICES    (1)         /* 00: [V2] System has LPC or ISA bus devices */
321a9f12690SJung-uk Kim #define ACPI_FADT_8042              (1<<1)      /* 01: [V3] System has an 8042 controller on port 60/64 */
322a9f12690SJung-uk Kim #define ACPI_FADT_NO_VGA            (1<<2)      /* 02: [V4] It is not safe to probe for VGA hardware */
323a9f12690SJung-uk Kim #define ACPI_FADT_NO_MSI            (1<<3)      /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */
324a9f12690SJung-uk Kim #define ACPI_FADT_NO_ASPM           (1<<4)      /* 04: [V4] PCIe ASPM control must not be enabled */
3253f0275a0SJung-uk Kim #define ACPI_FADT_NO_CMOS_RTC       (1<<5)      /* 05: [V5] No CMOS real-time clock present */
326a9f12690SJung-uk Kim 
327313a0c13SJung-uk Kim /* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */
328313a0c13SJung-uk Kim 
329313a0c13SJung-uk Kim #define ACPI_FADT_PSCI_COMPLIANT    (1)         /* 00: [V5+] PSCI 0.2+ is implemented */
330313a0c13SJung-uk Kim #define ACPI_FADT_PSCI_USE_HVC      (1<<1)      /* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */
331313a0c13SJung-uk Kim 
332d6dd1baeSJung-uk Kim /* Masks for FADT flags */
333a9f12690SJung-uk Kim 
3341df130f1SJung-uk Kim #define ACPI_FADT_WBINVD            (1)         /* 00: [V1] The WBINVD instruction works properly */
3351df130f1SJung-uk Kim #define ACPI_FADT_WBINVD_FLUSH      (1<<1)      /* 01: [V1] WBINVD flushes but does not invalidate caches */
336a9f12690SJung-uk Kim #define ACPI_FADT_C1_SUPPORTED      (1<<2)      /* 02: [V1] All processors support C1 state */
337a9f12690SJung-uk Kim #define ACPI_FADT_C2_MP_SUPPORTED   (1<<3)      /* 03: [V1] C2 state works on MP system */
338a9f12690SJung-uk Kim #define ACPI_FADT_POWER_BUTTON      (1<<4)      /* 04: [V1] Power button is handled as a control method device */
339a9f12690SJung-uk Kim #define ACPI_FADT_SLEEP_BUTTON      (1<<5)      /* 05: [V1] Sleep button is handled as a control method device */
3401df130f1SJung-uk Kim #define ACPI_FADT_FIXED_RTC         (1<<6)      /* 06: [V1] RTC wakeup status is not in fixed register space */
341a9f12690SJung-uk Kim #define ACPI_FADT_S4_RTC_WAKE       (1<<7)      /* 07: [V1] RTC alarm can wake system from S4 */
342a9f12690SJung-uk Kim #define ACPI_FADT_32BIT_TIMER       (1<<8)      /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */
343a9f12690SJung-uk Kim #define ACPI_FADT_DOCKING_SUPPORTED (1<<9)      /* 09: [V1] Docking supported */
344a9f12690SJung-uk Kim #define ACPI_FADT_RESET_REGISTER    (1<<10)     /* 10: [V2] System reset via the FADT RESET_REG supported */
345a9f12690SJung-uk Kim #define ACPI_FADT_SEALED_CASE       (1<<11)     /* 11: [V3] No internal expansion capabilities and case is sealed */
346a9f12690SJung-uk Kim #define ACPI_FADT_HEADLESS          (1<<12)     /* 12: [V3] No local video capabilities or local input devices */
347a9f12690SJung-uk Kim #define ACPI_FADT_SLEEP_TYPE        (1<<13)     /* 13: [V3] Must execute native instruction after writing  SLP_TYPx register */
348a9f12690SJung-uk Kim #define ACPI_FADT_PCI_EXPRESS_WAKE  (1<<14)     /* 14: [V4] System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
349a9f12690SJung-uk Kim #define ACPI_FADT_PLATFORM_CLOCK    (1<<15)     /* 15: [V4] OSPM should use platform-provided timer (ACPI 3.0) */
350a9f12690SJung-uk Kim #define ACPI_FADT_S4_RTC_VALID      (1<<16)     /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
351a9f12690SJung-uk Kim #define ACPI_FADT_REMOTE_POWER_ON   (1<<17)     /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */
352a9f12690SJung-uk Kim #define ACPI_FADT_APIC_CLUSTER      (1<<18)     /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
353a9f12690SJung-uk Kim #define ACPI_FADT_APIC_PHYSICAL     (1<<19)     /* 19: [V4] All local xAPICs must use physical dest mode (ACPI 3.0) */
3543f0275a0SJung-uk Kim #define ACPI_FADT_HW_REDUCED        (1<<20)     /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */
355ec3fc72fSJung-uk Kim #define ACPI_FADT_LOW_POWER_S0      (1<<21)     /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */
356a9f12690SJung-uk Kim 
357a9f12690SJung-uk Kim 
3581df130f1SJung-uk Kim /* Values for PreferredProfile (Preferred Power Management Profiles) */
359a9f12690SJung-uk Kim 
3601df130f1SJung-uk Kim enum AcpiPreferredPmProfiles
361a9f12690SJung-uk Kim {
362a9f12690SJung-uk Kim     PM_UNSPECIFIED          = 0,
363a9f12690SJung-uk Kim     PM_DESKTOP              = 1,
364a9f12690SJung-uk Kim     PM_MOBILE               = 2,
365a9f12690SJung-uk Kim     PM_WORKSTATION          = 3,
366a9f12690SJung-uk Kim     PM_ENTERPRISE_SERVER    = 4,
367a9f12690SJung-uk Kim     PM_SOHO_SERVER          = 5,
3683f0275a0SJung-uk Kim     PM_APPLIANCE_PC         = 6,
3693f0275a0SJung-uk Kim     PM_PERFORMANCE_SERVER   = 7,
370ec3fc72fSJung-uk Kim     PM_TABLET               = 8
371a9f12690SJung-uk Kim };
372a9f12690SJung-uk Kim 
373*a371a5fdSJung-uk Kim /* Values for SleepStatus and SleepControl registers (V5+ FADT) */
374a159c266SJung-uk Kim 
375a159c266SJung-uk Kim #define ACPI_X_WAKE_STATUS          0x80
376a159c266SJung-uk Kim #define ACPI_X_SLEEP_TYPE_MASK      0x1C
377a159c266SJung-uk Kim #define ACPI_X_SLEEP_TYPE_POSITION  0x02
378a159c266SJung-uk Kim #define ACPI_X_SLEEP_ENABLE         0x20
379a159c266SJung-uk Kim 
380a9f12690SJung-uk Kim 
381a9f12690SJung-uk Kim /* Reset to default packing */
382a9f12690SJung-uk Kim 
383a9f12690SJung-uk Kim #pragma pack()
384a9f12690SJung-uk Kim 
385a9f12690SJung-uk Kim 
386d6dd1baeSJung-uk Kim /*
387d6dd1baeSJung-uk Kim  * Internal table-related structures
388d6dd1baeSJung-uk Kim  */
389a9f12690SJung-uk Kim typedef union acpi_name_union
390a9f12690SJung-uk Kim {
391a9f12690SJung-uk Kim     UINT32                          Integer;
392a9f12690SJung-uk Kim     char                            Ascii[4];
393a9f12690SJung-uk Kim 
394a9f12690SJung-uk Kim } ACPI_NAME_UNION;
395a9f12690SJung-uk Kim 
396d6dd1baeSJung-uk Kim 
397d6dd1baeSJung-uk Kim /* Internal ACPI Table Descriptor. One per ACPI table. */
398d6dd1baeSJung-uk Kim 
399a9f12690SJung-uk Kim typedef struct acpi_table_desc
400a9f12690SJung-uk Kim {
401a9f12690SJung-uk Kim     ACPI_PHYSICAL_ADDRESS           Address;
402a9f12690SJung-uk Kim     ACPI_TABLE_HEADER               *Pointer;
4031df130f1SJung-uk Kim     UINT32                          Length;     /* Length fixed at 32 bits (fixed in table header) */
404a9f12690SJung-uk Kim     ACPI_NAME_UNION                 Signature;
405a9f12690SJung-uk Kim     ACPI_OWNER_ID                   OwnerId;
406a9f12690SJung-uk Kim     UINT8                           Flags;
407a9f12690SJung-uk Kim 
408a9f12690SJung-uk Kim } ACPI_TABLE_DESC;
409a9f12690SJung-uk Kim 
410d6dd1baeSJung-uk Kim /* Masks for Flags field above */
411a9f12690SJung-uk Kim 
412313a0c13SJung-uk Kim #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL  (0) /* Virtual address, external maintained */
413313a0c13SJung-uk Kim #define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1) /* Physical address, internally mapped */
414313a0c13SJung-uk Kim #define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL  (2) /* Virtual address, internallly allocated */
415313a0c13SJung-uk Kim #define ACPI_TABLE_ORIGIN_MASK              (3)
416a9f12690SJung-uk Kim #define ACPI_TABLE_IS_LOADED                (8)
417a9f12690SJung-uk Kim 
418a9f12690SJung-uk Kim 
419a9f12690SJung-uk Kim /*
420a9f12690SJung-uk Kim  * Get the remaining ACPI tables
421a9f12690SJung-uk Kim  */
422ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/actbl1.h>
423ca8a21efSJung-uk Kim #include <contrib/dev/acpica/include/actbl2.h>
4243f0275a0SJung-uk Kim #include <contrib/dev/acpica/include/actbl3.h>
425a9f12690SJung-uk Kim 
426a9f12690SJung-uk Kim /* Macros used to generate offsets to specific table fields */
427a9f12690SJung-uk Kim 
428ec3fc72fSJung-uk Kim #define ACPI_FADT_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_FADT, f)
429a9f12690SJung-uk Kim 
4300b94ba42SJung-uk Kim /*
4310b94ba42SJung-uk Kim  * Sizes of the various flavors of FADT. We need to look closely
4320b94ba42SJung-uk Kim  * at the FADT length because the version number essentially tells
4330b94ba42SJung-uk Kim  * us nothing because of many BIOS bugs where the version does not
4340b94ba42SJung-uk Kim  * match the expected length. In other words, the length of the
4350b94ba42SJung-uk Kim  * FADT is the bottom line as to what the version really is.
4360b94ba42SJung-uk Kim  *
4370b94ba42SJung-uk Kim  * For reference, the values below are as follows:
4383f0275a0SJung-uk Kim  *     FADT V1 size: 0x074
4393f0275a0SJung-uk Kim  *     FADT V2 size: 0x084
4403f0275a0SJung-uk Kim  *     FADT V3 size: 0x0F4
4413f0275a0SJung-uk Kim  *     FADT V4 size: 0x0F4
442ec3fc72fSJung-uk Kim  *     FADT V5 size: 0x10C
443*a371a5fdSJung-uk Kim  *     FADT V6 size: 0x114
4440b94ba42SJung-uk Kim  */
4450b94ba42SJung-uk Kim #define ACPI_FADT_V1_SIZE       (UINT32) (ACPI_FADT_OFFSET (Flags) + 4)
446313a0c13SJung-uk Kim #define ACPI_FADT_V2_SIZE       (UINT32) (ACPI_FADT_OFFSET (MinorRevision) + 1)
447ec3fc72fSJung-uk Kim #define ACPI_FADT_V3_SIZE       (UINT32) (ACPI_FADT_OFFSET (SleepControl))
448*a371a5fdSJung-uk Kim #define ACPI_FADT_V5_SIZE       (UINT32) (ACPI_FADT_OFFSET (HypervisorId))
449*a371a5fdSJung-uk Kim #define ACPI_FADT_V6_SIZE       (UINT32) (sizeof (ACPI_TABLE_FADT))
4500b94ba42SJung-uk Kim 
451a9f12690SJung-uk Kim #endif /* __ACTBL_H__ */
452