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 | /*␊ |
8 | * SIGNATURE_16, SIGNATURE_32, SIGNATURE_64 are extracted from the edk2 project (Base.h), and are under the following license:␊ |
9 | *␊ |
10 | * Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.␊ |
11 | * Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.␊ |
12 | * This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.␊ |
13 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.␊ |
14 | */␊ |
15 | ␊ |
16 | #define SIGNATURE_16(A, B) ((A) | (B << 8))␊ |
17 | ␊ |
18 | #define SIGNATURE_32(A, B, C, D) (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))␊ |
19 | ␊ |
20 | #define SIGNATURE_64(A, B, C, D, E, F, G, H) \␊ |
21 | (SIGNATURE_32 (A, B, C, D) | ((uint64_t) (SIGNATURE_32 (E, F, G, H)) << 32))␊ |
22 | ␊ |
23 | #define ACPI_SIGNATURE_UINT64_LE SIGNATURE_64('R','S','D',' ','P','T','R',' ')␊ |
24 | ␊ |
25 | #define Unspecified 0␊ |
26 | #define Desktop 1␊ |
27 | #define Mobile 2␊ |
28 | #define Workstation 3␊ |
29 | #define EnterpriseServer 4␊ |
30 | #define SOHOServer 5␊ |
31 | #define AppliancePC 6␊ |
32 | ␊ |
33 | #define MaxSupportedPMProfile AppliancePC // max profile currently supported ␊ |
34 | #define PMProfileError MaxSupportedPMProfile + 1␊ |
35 | ␊ |
36 | /* Per ACPI 3.0a spec */␊ |
37 | ␊ |
38 | // TODO Migrate␊ |
39 | struct acpi_2_rsdp {␊ |
40 | char Signature[8];␊ |
41 | uint8_t Checksum;␊ |
42 | char OEMID[6];␊ |
43 | uint8_t Revision;␊ |
44 | uint32_t RsdtAddress;␊ |
45 | uint32_t Length;␊ |
46 | uint64_t XsdtAddress;␊ |
47 | uint8_t ExtendedChecksum;␊ |
48 | char Reserved[3];␊ |
49 | } __attribute__((packed));␊ |
50 | ␊ |
51 | ␊ |
52 | #define ACPI_HEADER_CORE␉␉␉\␊ |
53 | ␉char Signature[4];␉\␊ |
54 | ␉uint32_t Length;␉␉␉\␊ |
55 | ␉uint8_t Revision;␉␉\␊ |
56 | ␉uint8_t Checksum;␉␉\␊ |
57 | ␉char OEMID[6];␉␉\␊ |
58 | ␉char OEMTableId[8];␉\␊ |
59 | ␉uint32_t OEMRevision;␉\␊ |
60 | ␉uint32_t CreatorId;␉␉\␊ |
61 | ␉uint32_t CreatorRevision;␊ |
62 | ␊ |
63 | struct acpi_common_header {␊ |
64 | ␉ACPI_HEADER_CORE␉␊ |
65 | } __attribute__((packed));␊ |
66 | ␊ |
67 | // TODO Migrate␊ |
68 | struct acpi_2_rsdt {␊ |
69 | ␉ACPI_HEADER_CORE␉␊ |
70 | } __attribute__((packed));␊ |
71 | ␊ |
72 | // TODO Migrate␊ |
73 | struct acpi_2_xsdt {␊ |
74 | ␉ACPI_HEADER_CORE␉␊ |
75 | } __attribute__((packed));␊ |
76 | ␊ |
77 | // TODO Migrate␊ |
78 | struct acpi_2_gas {␊ |
79 | ␉uint8_t␉␉␉␉Address_Space_ID;␊ |
80 | ␉uint8_t␉␉␉␉Register_Bit_Width;␊ |
81 | ␉uint8_t␉␉␉␉Register_Bit_Offset;␊ |
82 | ␉uint8_t␉␉␉␉Access_Size;␊ |
83 | ␉uint64_t␉␉␉Address;␊ |
84 | } __attribute__((packed));␊ |
85 | ␊ |
86 | // TODO Migrate␊ |
87 | struct acpi_2_ssdt {␊ |
88 | ␉ACPI_HEADER_CORE␉␊ |
89 | } __attribute__((packed));␊ |
90 | ␊ |
91 | // TODO Migrate␊ |
92 | struct acpi_2_dsdt {␊ |
93 | ␉ACPI_HEADER_CORE␉␊ |
94 | } __attribute__((packed));␊ |
95 | ␊ |
96 | // TODO Migrate␊ |
97 | struct acpi_2_fadt {␊ |
98 | ␉ACPI_HEADER_CORE␉␊ |
99 | ␉uint32_t FIRMWARE_CTRL;␊ |
100 | ␉uint32_t DSDT;␊ |
101 | ␉uint8_t Model;␉␉␉// JrCs␊ |
102 | ␉uint8_t PM_Profile;␉␉// JrCs␊ |
103 | ␉uint16_t␉␉SCI_Interrupt;␊ |
104 | ␉uint32_t␉␉SMI_Command_Port;␊ |
105 | ␉uint8_t␉␉␉ACPI_Enable;␊ |
106 | ␉uint8_t␉␉␉ACPI_Disable;␊ |
107 | ␉uint8_t␉␉␉S4BIOS_Command;␊ |
108 | ␉uint8_t␉␉␉PState_Control;␊ |
109 | ␉uint32_t␉␉PM1A_Event_Block_Address;␊ |
110 | ␉uint32_t␉␉PM1B_Event_Block_Address;␊ |
111 | ␉uint32_t␉␉PM1A_Control_Block_Address;␊ |
112 | ␉uint32_t␉␉PM1B_Control_Block_Address;␊ |
113 | ␉uint32_t␉␉PM2_Control_Block_Address;␊ |
114 | ␉uint32_t␉␉PM_Timer_Block_Address;␊ |
115 | ␉uint32_t␉␉GPE0_Block_Address;␊ |
116 | ␉uint32_t␉␉GPE1_Block_Address;␊ |
117 | ␉uint8_t␉␉␉PM1_Event_Block_Length;␊ |
118 | ␉uint8_t␉␉␉PM1_Control_Block_Length;␊ |
119 | ␉uint8_t␉␉␉PM2_Control_Block_Length;␊ |
120 | ␉uint8_t␉␉␉PM_Timer_Block_Length;␊ |
121 | ␉uint8_t␉␉␉GPE0_Block_Length;␊ |
122 | ␉uint8_t␉␉␉GPE1_Block_Length;␊ |
123 | ␉uint8_t␉␉␉GPE1_Base_Offset;␊ |
124 | ␉uint8_t␉␉␉CST_Support;␊ |
125 | ␉uint16_t␉␉C2_Latency;␊ |
126 | ␉uint16_t␉␉C3_Latency;␊ |
127 | ␉uint16_t␉␉CPU_Cache_Size;␊ |
128 | ␉uint16_t␉␉Cache_Flush_Stride;␊ |
129 | ␉uint8_t␉␉␉Duty_Cycle_Offset;␊ |
130 | ␉uint8_t␉␉␉Duty_Cycle_Width;␊ |
131 | ␉uint8_t␉␉␉RTC_Day_Alarm_Index;␊ |
132 | ␉uint8_t␉␉␉RTC_Month_Alarm_Index;␊ |
133 | ␉uint8_t␉␉␉RTC_Century_Index;␊ |
134 | ␉uint16_t␉␉Boot_Flags;␊ |
135 | ␉uint8_t␉␉␉Reserved0;␊ |
136 | /* Begin Asere */␊ |
137 | ␉//Reset Fix␊ |
138 | ␉uint32_t␉␉␉Flags;␊ |
139 | ␉struct acpi_2_gas␉RESET_REG;␉␊ |
140 | ␉uint8_t␉␉␉␉Reset_Value;␊ |
141 | ␉uint8_t␉␉␉␉Reserved[3];␊ |
142 | ␊ |
143 | ␉uint64_t␉␉␉X_FIRMWARE_CTRL;␊ |
144 | ␉uint64_t␉␉␉X_DSDT;␊ |
145 | ␊ |
146 | #if UNUSED␊ |
147 | ␉/* End Asere */␊ |
148 | ␉/*We absolutely don't care about theese fields*/␊ |
149 | ␉uint8_t␉␉notimp2[96];␊ |
150 | #else␊ |
151 | ␉struct acpi_2_gas␉X_PM1a_EVT_BLK;␊ |
152 | ␉struct acpi_2_gas␉X_PM1b_EVT_BLK;␊ |
153 | ␉struct acpi_2_gas␉X_PM1a_CNT_BLK;␊ |
154 | ␉struct acpi_2_gas␉X_PM1b_CNT_BLK;␊ |
155 | ␉struct acpi_2_gas␉X_PM2_CNT_BLK;␊ |
156 | ␉struct acpi_2_gas␉X_PM_TMR_BLK;␊ |
157 | ␉struct acpi_2_gas␉X_GPE0_BLK;␊ |
158 | ␉struct acpi_2_gas␉X_GPE1_BLK;␊ |
159 | #endif␊ |
160 | ␉␊ |
161 | } __attribute__((packed));␊ |
162 | ␊ |
163 | struct acpi_2_facs {␊ |
164 | ␉char␉␉␉Signature[4];␉␊ |
165 | ␉uint32_t Length;␉␉␉␊ |
166 | ␉uint32_t␉␉hardware_signature;␊ |
167 | ␉uint32_t␉␉firmware_waking_vector;␊ |
168 | ␉uint32_t␉␉global_lock;␊ |
169 | ␉uint32_t␉␉flags;␊ |
170 | ␉uint64_t␉␉x_firmware_waking_vector;␉␊ |
171 | ␉uint8_t␉␉␉version;␊ |
172 | ␉uint8_t␉␉␉Reserved[31];␊ |
173 | } __attribute__ ((packed));␊ |
174 | ␊ |
175 | #endif /* !__LIBSAIO_ACPI_H */␊ |
176 | |