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>
27 struct grub_acpi_rsdp_v10
29 grub_uint8_t signature
[8];
30 grub_uint8_t checksum
;
31 grub_uint8_t oemid
[6];
32 grub_uint8_t revision
;
33 grub_uint32_t rsdt_addr
;
34 } __attribute__ ((packed
));
36 struct grub_acpi_rsdp_v20
38 struct grub_acpi_rsdp_v10 rsdpv1
;
40 grub_uint64_t xsdt_addr
;
41 grub_uint8_t checksum
;
42 grub_uint8_t reserved
[3];
43 } __attribute__ ((packed
));
45 struct grub_acpi_table_header
47 grub_uint8_t signature
[4];
49 grub_uint8_t revision
;
50 grub_uint8_t checksum
;
51 grub_uint8_t oemid
[6];
52 grub_uint8_t oemtable
[8];
54 grub_uint8_t creator_id
[4];
55 grub_uint32_t creator_rev
;
56 } __attribute__ ((packed
));
58 #define GRUB_ACPI_FADT_SIGNATURE "FACP"
62 struct grub_acpi_table_header hdr
;
63 grub_uint32_t facs_addr
;
64 grub_uint32_t dsdt_addr
;
65 grub_uint8_t somefields1
[20];
67 grub_uint8_t somefields2
[64];
68 grub_uint64_t facs_xaddr
;
69 grub_uint64_t dsdt_xaddr
;
70 grub_uint8_t somefields3
[96];
71 } __attribute__ ((packed
));
73 #define GRUB_ACPI_MADT_SIGNATURE "APIC"
75 struct grub_acpi_madt_entry_header
83 struct grub_acpi_table_header hdr
;
84 grub_uint32_t lapic_addr
;
86 struct grub_acpi_madt_entry_header entries
[0];
91 GRUB_ACPI_MADT_ENTRY_TYPE_INTERRUPT_OVERRIDE
= 2,
92 GRUB_ACPI_MADT_ENTRY_TYPE_SAPIC
= 6,
93 GRUB_ACPI_MADT_ENTRY_TYPE_LSAPIC
= 7,
94 GRUB_ACPI_MADT_ENTRY_TYPE_PLATFORM_INT_SOURCE
= 8
97 struct grub_acpi_madt_entry_interrupt_override
99 struct grub_acpi_madt_entry_header hdr
;
102 grub_uint32_t global_sys_interrupt
;
106 struct grub_acpi_madt_entry_sapic
108 struct grub_acpi_madt_entry_header hdr
;
111 grub_uint32_t global_sys_interrupt_base
;
115 struct grub_acpi_madt_entry_lsapic
117 struct grub_acpi_madt_entry_header hdr
;
123 grub_uint32_t cpu_uid
;
124 grub_uint8_t cpu_uid_str
[0];
127 struct grub_acpi_madt_entry_platform_int_source
129 struct grub_acpi_madt_entry_header hdr
;
131 grub_uint8_t inttype
;
133 grub_uint8_t cpu_eid
;
134 grub_uint8_t sapic_vector
;
135 grub_uint32_t global_sys_int
;
136 grub_uint32_t src_flags
;
141 GRUB_ACPI_MADT_ENTRY_SAPIC_FLAGS_ENABLED
= 1
144 #ifndef GRUB_DSDT_TEST
145 struct grub_acpi_rsdp_v10
*grub_acpi_get_rsdpv1 (void);
146 struct grub_acpi_rsdp_v20
*grub_acpi_get_rsdpv2 (void);
147 struct grub_acpi_rsdp_v10
*grub_machine_acpi_get_rsdpv1 (void);
148 struct grub_acpi_rsdp_v20
*grub_machine_acpi_get_rsdpv2 (void);
149 grub_uint8_t
grub_byte_checksum (void *base
, grub_size_t size
);
151 grub_err_t
grub_acpi_create_ebda (void);
153 void grub_acpi_halt (void);
156 #define GRUB_ACPI_SLP_EN (1 << 13)
157 #define GRUB_ACPI_SLP_TYP_OFFSET 10
161 GRUB_ACPI_OPCODE_ZERO
= 0, GRUB_ACPI_OPCODE_ONE
= 1,
162 GRUB_ACPI_OPCODE_NAME
= 8, GRUB_ACPI_OPCODE_BYTE_CONST
= 0x0a,
163 GRUB_ACPI_OPCODE_WORD_CONST
= 0x0b, GRUB_ACPI_OPCODE_DWORD_CONST
= 0x0c,
164 GRUB_ACPI_OPCODE_SCOPE
= 0x10, GRUB_ACPI_OPCODE_PACKAGE
= 0x12,
165 GRUB_ACPI_OPCODE_METHOD
= 0x14, GRUB_ACPI_OPCODE_EXTOP
= 0x5b,
166 GRUB_ACPI_OPCODE_IF
= 0xa0, GRUB_ACPI_OPCODE_ONES
= 0xff
170 GRUB_ACPI_EXTOPCODE_MUTEX
= 0x01,
171 GRUB_ACPI_EXTOPCODE_OPERATION_REGION
= 0x80,
172 GRUB_ACPI_EXTOPCODE_FIELD_OP
= 0x81,
173 GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP
= 0x86,
176 #endif /* ! GRUB_ACPI_HEADER */