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_fadt {␊ |
63 | ␉char Signature[4];␊ |
64 | ␉uint32_t Length;␊ |
65 | ␉uint8_t Revision;␊ |
66 | ␉uint8_t Checksum;␊ |
67 | ␉char OEMID[6];␊ |
68 | ␉char OEMTableId[8];␊ |
69 | ␉uint32_t OEMRevision;␊ |
70 | ␉uint32_t CreatorId;␊ |
71 | ␉uint32_t CreatorRevision;␊ |
72 | ␉uint32_t FIRMWARE_CTRL;␊ |
73 | ␉uint32_t DSDT;␊ |
74 | ␉uint8_t Model;␊ |
75 | ␉uint8_t PM_Profile;␊ |
76 | ␉/*We absolutely don't care about theese fields*/␊ |
77 | ␉uint8_t notimp1[66];␊ |
78 | ␊ |
79 | ␉//Reset Fix␊ |
80 | ␉uint32_t Flags;␊ |
81 | ␉uint8_t Reset_SpaceID;␊ |
82 | ␉uint8_t Reset_BitWidth;␊ |
83 | ␉uint8_t Reset_BitOffset;␊ |
84 | ␉uint8_t Reset_AccessWidth;␊ |
85 | ␉uint64_t Reset_Address;␊ |
86 | ␉uint8_t Reset_Value;␊ |
87 | ␉uint8_t Reserved[3];␊ |
88 | ␊ |
89 | ␉uint64_t␉ X_FIRMWARE_CTRL;␊ |
90 | ␉uint64_t␉ X_DSDT;␊ |
91 | ␉/*We absolutely don't care about theese fields*/␊ |
92 | ␉uint8_t notimp2[96];␊ |
93 | } __attribute__((packed));␊ |
94 | ␊ |
95 | #endif /* !__LIBSAIO_ACPI_H */␊ |
96 | |