|
|
1.1 root 1: /*
2: * GRUB -- GRand Unified Bootloader
3: * Copyright (C) 2009 Free Software Foundation, Inc.
4: *
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.
9: *
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.
14: *
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/>.
17: */
18:
19: #ifndef GRUB_ACPI_HEADER
20: #define GRUB_ACPI_HEADER 1
21:
22: #ifndef GRUB_DSDT_TEST
23: #include <grub/types.h>
24: #include <grub/err.h>
25: #endif
26:
27: #define GRUB_RSDP_SIGNATURE "RSD PTR "
28: #define GRUB_RSDP_SIGNATURE_SIZE 8
29:
30: struct grub_acpi_rsdp_v10
31: {
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;
38:
39: struct grub_acpi_rsdp_v20
40: {
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;
47:
48: struct grub_acpi_table_header
49: {
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;
60:
61: #define GRUB_ACPI_FADT_SIGNATURE "FACP"
62:
63: struct grub_acpi_fadt
64: {
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;
75:
76: #define GRUB_ACPI_MADT_SIGNATURE "APIC"
77:
78: struct grub_acpi_madt_entry_header
79: {
80: grub_uint8_t type;
81: grub_uint8_t len;
82: };
83:
84: struct grub_acpi_madt
85: {
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];
90: };
91:
92: enum
93: {
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
101: };
102:
103: struct grub_acpi_madt_entry_lapic
104: {
105: struct grub_acpi_madt_entry_header hdr;
106: grub_uint8_t acpiid;
107: grub_uint8_t apicid;
108: grub_uint32_t flags;
109: };
110:
111: struct grub_acpi_madt_entry_ioapic
112: {
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;
118: };
119:
120: struct grub_acpi_madt_entry_interrupt_override
121: {
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;
128:
129:
130: struct grub_acpi_madt_entry_lapic_nmi
131: {
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;
137:
138: struct grub_acpi_madt_entry_sapic
139: {
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;
145: };
146:
147: struct grub_acpi_madt_entry_lsapic
148: {
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];
157: };
158:
159: struct grub_acpi_madt_entry_platform_int_source
160: {
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;
169: };
170:
171: enum
172: {
173: GRUB_ACPI_MADT_ENTRY_SAPIC_FLAGS_ENABLED = 1
174: };
175:
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);
182:
183: grub_err_t grub_acpi_create_ebda (void);
184:
185: void grub_acpi_halt (void);
186: #endif
187:
188: #define GRUB_ACPI_SLP_EN (1 << 13)
189: #define GRUB_ACPI_SLP_TYP_OFFSET 10
190:
191: enum
192: {
193: GRUB_ACPI_OPCODE_ZERO = 0, GRUB_ACPI_OPCODE_ONE = 1,
194: GRUB_ACPI_OPCODE_NAME = 8, GRUB_ACPI_OPCODE_BYTE_CONST = 0x0a,
195: GRUB_ACPI_OPCODE_WORD_CONST = 0x0b,
196: GRUB_ACPI_OPCODE_DWORD_CONST = 0x0c,
197: GRUB_ACPI_OPCODE_STRING_CONST = 0x0d,
198: GRUB_ACPI_OPCODE_SCOPE = 0x10,
199: GRUB_ACPI_OPCODE_BUFFER = 0x11,
200: GRUB_ACPI_OPCODE_PACKAGE = 0x12,
201: GRUB_ACPI_OPCODE_METHOD = 0x14, GRUB_ACPI_OPCODE_EXTOP = 0x5b,
202: GRUB_ACPI_OPCODE_CREATE_WORD_FIELD = 0x8b,
203: GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD = 0x8c,
204: GRUB_ACPI_OPCODE_IF = 0xa0, GRUB_ACPI_OPCODE_ONES = 0xff
205: };
206: enum
207: {
208: GRUB_ACPI_EXTOPCODE_MUTEX = 0x01,
209: GRUB_ACPI_EXTOPCODE_EVENT_OP = 0x02,
210: GRUB_ACPI_EXTOPCODE_OPERATION_REGION = 0x80,
211: GRUB_ACPI_EXTOPCODE_FIELD_OP = 0x81,
212: GRUB_ACPI_EXTOPCODE_DEVICE_OP = 0x82,
213: GRUB_ACPI_EXTOPCODE_PROCESSOR_OP = 0x83,
214: GRUB_ACPI_EXTOPCODE_POWER_RES_OP = 0x84,
215: GRUB_ACPI_EXTOPCODE_THERMAL_ZONE_OP = 0x85,
216: GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP = 0x86,
217: GRUB_ACPI_EXTOPCODE_BANK_FIELD_OP = 0x87,
218: };
219:
220: #endif /* ! GRUB_ACPI_HEADER */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.