Fix cross compilation (e.g. on Darwin). Following changes to make.tmpl,
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / acpi.h
blobf6e6a11c53f16a11eda38632a19b3c577c353f66
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_ACPI_HEADER
20 #define GRUB_ACPI_HEADER 1
22 #ifndef GRUB_DSDT_TEST
23 #include <grub/types.h>
24 #include <grub/err.h>
25 #endif
27 #define GRUB_RSDP_SIGNATURE "RSD PTR "
28 #define GRUB_RSDP_SIGNATURE_SIZE 8
30 struct grub_acpi_rsdp_v10
32 grub_uint8_t signature[GRUB_RSDP_SIGNATURE_SIZE];
33 grub_uint8_t checksum;
34 grub_uint8_t oemid[6];
35 grub_uint8_t revision;
36 grub_uint32_t rsdt_addr;
37 } GRUB_PACKED;
39 struct grub_acpi_rsdp_v20
41 struct grub_acpi_rsdp_v10 rsdpv1;
42 grub_uint32_t length;
43 grub_uint64_t xsdt_addr;
44 grub_uint8_t checksum;
45 grub_uint8_t reserved[3];
46 } GRUB_PACKED;
48 struct grub_acpi_table_header
50 grub_uint8_t signature[4];
51 grub_uint32_t length;
52 grub_uint8_t revision;
53 grub_uint8_t checksum;
54 grub_uint8_t oemid[6];
55 grub_uint8_t oemtable[8];
56 grub_uint32_t oemrev;
57 grub_uint8_t creator_id[4];
58 grub_uint32_t creator_rev;
59 } GRUB_PACKED;
61 #define GRUB_ACPI_FADT_SIGNATURE "FACP"
63 struct grub_acpi_fadt
65 struct grub_acpi_table_header hdr;
66 grub_uint32_t facs_addr;
67 grub_uint32_t dsdt_addr;
68 grub_uint8_t somefields1[20];
69 grub_uint32_t pm1a;
70 grub_uint8_t somefields2[64];
71 grub_uint64_t facs_xaddr;
72 grub_uint64_t dsdt_xaddr;
73 grub_uint8_t somefields3[96];
74 } GRUB_PACKED;
76 #define GRUB_ACPI_MADT_SIGNATURE "APIC"
78 struct grub_acpi_madt_entry_header
80 grub_uint8_t type;
81 grub_uint8_t len;
84 struct grub_acpi_madt
86 struct grub_acpi_table_header hdr;
87 grub_uint32_t lapic_addr;
88 grub_uint32_t flags;
89 struct grub_acpi_madt_entry_header entries[0];
92 enum
94 GRUB_ACPI_MADT_ENTRY_TYPE_LAPIC = 0,
95 GRUB_ACPI_MADT_ENTRY_TYPE_IOAPIC = 1,
96 GRUB_ACPI_MADT_ENTRY_TYPE_INTERRUPT_OVERRIDE = 2,
97 GRUB_ACPI_MADT_ENTRY_TYPE_LAPIC_NMI = 4,
98 GRUB_ACPI_MADT_ENTRY_TYPE_SAPIC = 6,
99 GRUB_ACPI_MADT_ENTRY_TYPE_LSAPIC = 7,
100 GRUB_ACPI_MADT_ENTRY_TYPE_PLATFORM_INT_SOURCE = 8
103 struct grub_acpi_madt_entry_lapic
105 struct grub_acpi_madt_entry_header hdr;
106 grub_uint8_t acpiid;
107 grub_uint8_t apicid;
108 grub_uint32_t flags;
111 struct grub_acpi_madt_entry_ioapic
113 struct grub_acpi_madt_entry_header hdr;
114 grub_uint8_t id;
115 grub_uint8_t pad;
116 grub_uint32_t address;
117 grub_uint32_t global_sys_interrupt;
120 struct grub_acpi_madt_entry_interrupt_override
122 struct grub_acpi_madt_entry_header hdr;
123 grub_uint8_t bus;
124 grub_uint8_t source;
125 grub_uint32_t global_sys_interrupt;
126 grub_uint16_t flags;
127 } GRUB_PACKED;
130 struct grub_acpi_madt_entry_lapic_nmi
132 struct grub_acpi_madt_entry_header hdr;
133 grub_uint8_t acpiid;
134 grub_uint16_t flags;
135 grub_uint8_t lint;
136 } GRUB_PACKED;
138 struct grub_acpi_madt_entry_sapic
140 struct grub_acpi_madt_entry_header hdr;
141 grub_uint8_t id;
142 grub_uint8_t pad;
143 grub_uint32_t global_sys_interrupt_base;
144 grub_uint64_t addr;
147 struct grub_acpi_madt_entry_lsapic
149 struct grub_acpi_madt_entry_header hdr;
150 grub_uint8_t cpu_id;
151 grub_uint8_t id;
152 grub_uint8_t eid;
153 grub_uint8_t pad[3];
154 grub_uint32_t flags;
155 grub_uint32_t cpu_uid;
156 grub_uint8_t cpu_uid_str[0];
159 struct grub_acpi_madt_entry_platform_int_source
161 struct grub_acpi_madt_entry_header hdr;
162 grub_uint16_t flags;
163 grub_uint8_t inttype;
164 grub_uint8_t cpu_id;
165 grub_uint8_t cpu_eid;
166 grub_uint8_t sapic_vector;
167 grub_uint32_t global_sys_int;
168 grub_uint32_t src_flags;
171 enum
173 GRUB_ACPI_MADT_ENTRY_SAPIC_FLAGS_ENABLED = 1
176 #ifndef GRUB_DSDT_TEST
177 struct grub_acpi_rsdp_v10 *grub_acpi_get_rsdpv1 (void);
178 struct grub_acpi_rsdp_v20 *grub_acpi_get_rsdpv2 (void);
179 struct grub_acpi_rsdp_v10 *grub_machine_acpi_get_rsdpv1 (void);
180 struct grub_acpi_rsdp_v20 *grub_machine_acpi_get_rsdpv2 (void);
181 grub_uint8_t grub_byte_checksum (void *base, grub_size_t size);
183 grub_err_t grub_acpi_create_ebda (void);
185 void grub_acpi_halt (void);
186 #endif
188 #define GRUB_ACPI_SLP_EN (1 << 13)
189 #define GRUB_ACPI_SLP_TYP_OFFSET 10
191 enum
193 GRUB_ACPI_OPCODE_ZERO = 0, GRUB_ACPI_OPCODE_ONE = 1,
194 GRUB_ACPI_OPCODE_NAME = 8, GRUB_ACPI_OPCODE_ALIAS = 0x06,
195 GRUB_ACPI_OPCODE_BYTE_CONST = 0x0a,
196 GRUB_ACPI_OPCODE_WORD_CONST = 0x0b,
197 GRUB_ACPI_OPCODE_DWORD_CONST = 0x0c,
198 GRUB_ACPI_OPCODE_STRING_CONST = 0x0d,
199 GRUB_ACPI_OPCODE_SCOPE = 0x10,
200 GRUB_ACPI_OPCODE_BUFFER = 0x11,
201 GRUB_ACPI_OPCODE_PACKAGE = 0x12,
202 GRUB_ACPI_OPCODE_METHOD = 0x14, GRUB_ACPI_OPCODE_EXTOP = 0x5b,
203 GRUB_ACPI_OPCODE_ADD = 0x72,
204 GRUB_ACPI_OPCODE_CONCAT = 0x73,
205 GRUB_ACPI_OPCODE_SUBTRACT = 0x74,
206 GRUB_ACPI_OPCODE_MULTIPLY = 0x77,
207 GRUB_ACPI_OPCODE_DIVIDE = 0x78,
208 GRUB_ACPI_OPCODE_LSHIFT = 0x79,
209 GRUB_ACPI_OPCODE_RSHIFT = 0x7a,
210 GRUB_ACPI_OPCODE_AND = 0x7b,
211 GRUB_ACPI_OPCODE_NAND = 0x7c,
212 GRUB_ACPI_OPCODE_OR = 0x7d,
213 GRUB_ACPI_OPCODE_NOR = 0x7e,
214 GRUB_ACPI_OPCODE_XOR = 0x7f,
215 GRUB_ACPI_OPCODE_CONCATRES = 0x84,
216 GRUB_ACPI_OPCODE_MOD = 0x85,
217 GRUB_ACPI_OPCODE_INDEX = 0x88,
218 GRUB_ACPI_OPCODE_TOSTRING = 0x9c,
219 GRUB_ACPI_OPCODE_CREATE_WORD_FIELD = 0x8b,
220 GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD = 0x8c,
221 GRUB_ACPI_OPCODE_IF = 0xa0, GRUB_ACPI_OPCODE_ONES = 0xff
223 enum
225 GRUB_ACPI_EXTOPCODE_MUTEX = 0x01,
226 GRUB_ACPI_EXTOPCODE_EVENT_OP = 0x02,
227 GRUB_ACPI_EXTOPCODE_OPERATION_REGION = 0x80,
228 GRUB_ACPI_EXTOPCODE_FIELD_OP = 0x81,
229 GRUB_ACPI_EXTOPCODE_DEVICE_OP = 0x82,
230 GRUB_ACPI_EXTOPCODE_PROCESSOR_OP = 0x83,
231 GRUB_ACPI_EXTOPCODE_POWER_RES_OP = 0x84,
232 GRUB_ACPI_EXTOPCODE_THERMAL_ZONE_OP = 0x85,
233 GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP = 0x86,
234 GRUB_ACPI_EXTOPCODE_BANK_FIELD_OP = 0x87,
237 #endif /* ! GRUB_ACPI_HEADER */