1 | #ifndef __LIBSAIO_ACPI_H␊ |
2 | #define __LIBSAIO_ACPI_H␊ |
3 | ␊ |
4 | #define ACPI_RANGE_START (0x0E0000)␊ |
5 | #define ACPI_RANGE_END (0x0FFFFF)␊ |
6 | ␊ |
7 | #define UINT64_LE_FROM_CHARS(a,b,c,d,e,f,g,h) \␊ |
8 | ( ((uint64_t)h << 56) \␊ |
9 | | ((uint64_t)g << 48) \␊ |
10 | | ((uint64_t)f << 40) \␊ |
11 | | ((uint64_t)e << 32) \␊ |
12 | | ((uint64_t)d << 24) \␊ |
13 | | ((uint64_t)c << 16) \␊ |
14 | | ((uint64_t)b << 8) \␊ |
15 | | ((uint64_t)a << 0) \␊ |
16 | )␊ |
17 | ␊ |
18 | #define ACPI_SIGNATURE_UINT64_LE UINT64_LE_FROM_CHARS('R','S','D',' ','P','T','R',' ')␊ |
19 | ␊ |
20 | /* Per ACPI 3.0a spec */␊ |
21 | ␊ |
22 | // TODO Migrate␊ |
23 | struct acpi_2_rsdp {␊ |
24 | char Signature[8];␊ |
25 | uint8_t Checksum;␊ |
26 | char OEMID[6];␊ |
27 | uint8_t Revision;␊ |
28 | uint32_t RsdtAddress;␊ |
29 | uint32_t Length;␊ |
30 | uint64_t XsdtAddress;␊ |
31 | uint8_t ExtendedChecksum;␊ |
32 | char Reserved[3];␊ |
33 | } __attribute__((packed));␊ |
34 | ␊ |
35 | // TODO Migrate␊ |
36 | struct acpi_2_rsdt {␊ |
37 | ␉char Signature[4];␊ |
38 | ␉uint32_t Length;␊ |
39 | ␉uint8_t Revision;␊ |
40 | ␉uint8_t Checksum;␊ |
41 | ␉char OEMID[6];␊ |
42 | ␉char OEMTableId[8];␊ |
43 | ␉uint32_t OEMRevision;␊ |
44 | ␉uint32_t CreatorId;␊ |
45 | ␉uint32_t CreatorRevision;␊ |
46 | } __attribute__((packed));␊ |
47 | ␊ |
48 | // TODO Migrate␊ |
49 | struct acpi_2_xsdt {␊ |
50 | ␉char Signature[4];␊ |
51 | ␉uint32_t Length;␊ |
52 | ␉uint8_t Revision;␊ |
53 | ␉uint8_t Checksum;␊ |
54 | ␉char OEMID[6];␊ |
55 | ␉char OEMTableId[8];␊ |
56 | ␉uint32_t OEMRevision;␊ |
57 | ␉uint32_t CreatorId;␊ |
58 | ␉uint32_t CreatorRevision;␊ |
59 | } __attribute__((packed));␊ |
60 | ␊ |
61 | // TODO Migrate␊ |
62 | struct acpi_2_gas {␊ |
63 | ␉uint8_t␉␉␉␉Address_Space_ID;␊ |
64 | ␉uint8_t␉␉␉␉Register_Bit_Width;␊ |
65 | ␉uint8_t␉␉␉␉Register_Bit_Offset;␊ |
66 | ␉uint8_t␉␉␉␉Access_Size;␊ |
67 | ␉uint64_t␉␉␉Address;␊ |
68 | } __attribute__((packed));␊ |
69 | ␊ |
70 | // TODO Migrate␊ |
71 | struct acpi_2_fadt {␊ |
72 | ␉char␉␉␉␉Signature[4];␊ |
73 | ␉uint32_t␉␉␉Length;␊ |
74 | ␉uint8_t␉␉␉␉Revision;␊ |
75 | ␉uint8_t␉␉␉␉Checksum;␊ |
76 | ␉char␉␉␉␉OEMID[6];␊ |
77 | ␉char␉␉␉␉OEMTableId[8];␊ |
78 | ␉uint32_t␉␉␉OEMRevision;␊ |
79 | ␉uint32_t␉␉␉CreatorId;␊ |
80 | ␉uint32_t␉␉␉CreatorRevision;␊ |
81 | ␉uint32_t␉␉␉FIRMWARE_CTRL;␊ |
82 | ␉uint32_t␉␉␉DSDT;␊ |
83 | ␉uint8_t␉␉␉␉INT_MODEL; // JrCs␊ |
84 | ␉uint8_t␉␉␉␉Preferred_PM_Profile; // JrCs␊ |
85 | ␉uint16_t␉␉␉SCI_INT;␊ |
86 | ␉uint32_t␉␉␉SMI_CMD;␊ |
87 | ␉uint8_t␉␉␉␉ACPI_ENABLE;␊ |
88 | ␉uint8_t␉␉␉␉ACPI_DISABLE;␊ |
89 | ␉uint8_t␉␉␉␉S4BIOS_REQ;␊ |
90 | ␉uint8_t␉␉␉␉PSTATE_CNT;␊ |
91 | ␉uint32_t␉␉␉PM1a_EVT_BLK;␊ |
92 | ␉uint32_t␉␉␉PM1b_EVT_BLK;␊ |
93 | ␉uint32_t␉␉␉PM1a_CNT_BLK;␊ |
94 | ␉uint32_t␉␉␉PM1b_CNT_BLK;␊ |
95 | ␉uint32_t␉␉␉PM2_CNT_BLK;␊ |
96 | ␉uint32_t␉␉␉PM_TMR_BLK;␊ |
97 | ␉uint32_t␉␉␉GPE0_BLK;␊ |
98 | ␉uint32_t␉␉␉GPE1_BLK;␊ |
99 | ␉uint8_t␉␉␉␉PM1_EVT_LEN;␊ |
100 | ␉uint8_t␉␉␉␉PM1_CNT_LEN;␊ |
101 | ␉uint8_t␉␉␉␉PM2_CNT_LEN;␊ |
102 | ␉uint8_t␉␉␉␉PM_TMR_LEN;␊ |
103 | ␉uint8_t␉␉␉␉GPE0_BLK_LEN;␊ |
104 | ␉uint8_t␉␉␉␉GPE1_BLK_LEN;␊ |
105 | ␉uint8_t␉␉␉␉GPE1_BASE;␊ |
106 | ␉uint8_t␉␉␉␉CST_CNT;␊ |
107 | ␉uint16_t␉␉␉P_LVL2_LAT;␊ |
108 | ␉uint16_t␉␉␉P_LVL3_LAT;␊ |
109 | ␉uint16_t␉␉␉FLUSH_SIZE;␊ |
110 | ␉uint16_t␉␉␉FLUSH_STRIDE;␊ |
111 | ␉uint8_t␉␉␉␉DUTY_OFFSET;␊ |
112 | ␉uint8_t␉␉␉␉DUTY_WIDTH;␊ |
113 | ␉uint8_t␉␉␉␉DAY_ALRM;␊ |
114 | ␉uint8_t␉␉␉␉MON_ALRM;␊ |
115 | ␉uint8_t␉␉␉␉CENTURY;␊ |
116 | ␉uint16_t␉␉␉IAPC_BOOT_ARCH;␊ |
117 | ␉uint8_t␉␉␉␉Reserved1;␊ |
118 | ␉uint32_t␉␉␉Flags;␊ |
119 | ␉struct acpi_2_gas␉RESET_REG;␊ |
120 | ␉uint8_t␉␉␉␉RESET_VALUE;␊ |
121 | ␉uint8_t␉␉␉␉Reserved2[3];␊ |
122 | ␉uint64_t␉␉␉X_FIRMWARE_CTRL;␊ |
123 | ␉uint64_t␉␉␉X_DSDT;␊ |
124 | ␉struct acpi_2_gas␉X_PM1a_EVT_BLK;␊ |
125 | ␉struct acpi_2_gas␉X_PM1b_EVT_BLK;␊ |
126 | ␉struct acpi_2_gas␉X_PM1a_CNT_BLK;␊ |
127 | ␉struct acpi_2_gas␉X_PM1b_CNT_BLK;␊ |
128 | ␉struct acpi_2_gas␉X_PM2_CNT_BLK;␊ |
129 | ␉struct acpi_2_gas␉X_PM_TMR_BLK;␊ |
130 | ␉struct acpi_2_gas␉X_GPE0_BLK;␊ |
131 | ␉struct acpi_2_gas␉X_GPE1_BLK;␊ |
132 | } __attribute__((packed));␊ |
133 | ␊ |
134 | #endif /* !__LIBSAIO_ACPI_H */␊ |
135 | |