AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
sdt.h
Go to the documentation of this file.
1
#ifndef _X86_SDT_H
2
#define _X86_SDT_H
3
4
#include <
core/system.h
>
5
6
/* x86: ACPI's tables, as the firmware lays them out (see the ACPI
7
* specification). acpi.c finds them, apic.c and hpet.c read them. */
8
10
struct
acpi_rsdp
{
11
char
signature
[8];
12
uint8_t
checksum
;
13
char
oem_id
[6];
14
uint8_t
rev
;
15
uint32_t
rsdt
;
16
}
__packed
;
17
20
struct
acpi_rsdp2
{
21
struct
acpi_rsdp
v1
;
22
uint32_t
length
;
23
uint64_t
xsdt
;
24
uint8_t
xchecksum
;
25
uint8_t
reserved
[3];
26
}
__packed
;
27
29
struct
acpi_sdt_header
{
30
char
signature
[4];
31
uint32_t
length
;
32
uint8_t
rev
;
33
uint8_t
checksum
;
34
char
oemid
[6];
35
char
oem_table_id
[8];
36
uint32_t
oem_rev
;
37
uint32_t
creator_id
;
38
uint32_t
creator_rev
;
39
}
__packed
;
40
42
struct
acpi_rsdt
{
43
struct
acpi_sdt_header
header
;
44
uint32_t
sdt
[0];
45
}
__packed
;
46
48
struct
acpi_xsdt
{
49
struct
acpi_sdt_header
header
;
50
uint64_t
sdt
[0];
51
}
__packed
;
52
54
struct
acpi_gas
{
55
uint8_t
space
;
/* 0: memory, 1: I/O ports */
56
uint8_t
bit_width
;
57
uint8_t
bit_offset
;
58
uint8_t
access_size
;
59
uint64_t
address
;
60
}
__packed
;
61
63
struct
acpi_hpet
{
64
struct
acpi_sdt_header
header
;
65
uint32_t
event_timer_block_id
;
66
struct
acpi_gas
address
;
67
uint8_t
hpet_number
;
68
uint16_t
minimum_tick
;
69
uint8_t
page_protection
;
70
}
__packed
;
71
72
/* The MADT (signature "APIC") lists the interrupt controllers, in
73
* entries after its header, each with a type and a length. */
74
#define ACPI_MADT_LOCAL_APIC 0
75
#define ACPI_MADT_IO_APIC 1
76
#define ACPI_MADT_INT_SRC_OVERRIDE 2
77
#define ACPI_MADT_LOCAL_APIC_NMI 4
78
79
#define ACPI_MADT_PCAT_COMPAT 0x1
/* the machine has 8259s too */
80
81
#define ACPI_MADT_ENABLED 0x1
/* a local APIC's flag: its CPU is there */
82
83
/* an override's flags: the polarity (bits 0 and 1), the trigger mode
84
* (bits 2 and 3) */
85
#define ACPI_MPS_POLARITY_MASK 0x3
86
#define ACPI_MPS_POLARITY_HIGH 0x1
87
#define ACPI_MPS_POLARITY_LOW 0x3
88
#define ACPI_MPS_TRIGGER_MASK 0xc
89
#define ACPI_MPS_TRIGGER_EDGE 0x4
90
#define ACPI_MPS_TRIGGER_LEVEL 0xc
91
93
struct
acpi_madt_entry
{
94
uint8_t
type
;
95
uint8_t
length
;
96
}
__packed
;
97
99
struct
acpi_madt_local_apic
{
100
struct
acpi_madt_entry
entry
;
101
uint8_t
processor_id
;
102
uint8_t
apic_id
;
103
uint32_t
flags
;
/* bit 0: enabled */
104
}
__packed
;
105
107
struct
acpi_madt_io_apic
{
108
struct
acpi_madt_entry
entry
;
109
uint8_t
id
;
110
uint8_t
reserved
;
111
uint32_t
address
;
112
uint32_t
gsi_base
;
113
}
__packed
;
114
117
struct
acpi_madt_override
{
118
struct
acpi_madt_entry
entry
;
119
uint8_t
bus
;
/* 0: ISA */
120
uint8_t
source
;
/* the ISA IRQ */
121
uint32_t
gsi
;
122
uint16_t
flags
;
123
}
__packed
;
124
126
struct
acpi_madt_local_apic_nmi
{
127
struct
acpi_madt_entry
entry
;
128
uint8_t
processor_id
;
/* 0xff for all CPUs */
129
uint16_t
flags
;
130
uint8_t
lint
;
/* LINT0 or LINT1 */
131
}
__packed
;
132
134
struct
acpi_madt
{
135
struct
acpi_sdt_header
header
;
136
uint32_t
local_apic_address
;
137
uint32_t
flags
;
138
}
__packed
;
139
140
#endif
/* ! _X86_SDT_H */
system.h
__packed
#define __packed
Definition
system.h:30
uint32_t
unsigned int uint32_t
Definition
stddef.h:22
uint8_t
unsigned char uint8_t
Definition
stddef.h:20
uint64_t
unsigned long long int uint64_t
Definition
stddef.h:23
uint16_t
unsigned short int uint16_t
Definition
stddef.h:21
acpi_gas
A register's address, ACPI's Generic Address Structure.
Definition
sdt.h:54
acpi_gas::bit_offset
uint8_t bit_offset
Definition
sdt.h:57
acpi_gas::bit_width
uint8_t bit_width
Definition
sdt.h:56
acpi_gas::access_size
uint8_t access_size
Definition
sdt.h:58
acpi_gas::address
uint64_t address
Definition
sdt.h:59
acpi_gas::space
uint8_t space
Definition
sdt.h:55
acpi_hpet
The HPET table: where the HPET's registers are.
Definition
sdt.h:63
acpi_hpet::event_timer_block_id
uint32_t event_timer_block_id
Definition
sdt.h:65
acpi_hpet::hpet_number
uint8_t hpet_number
Definition
sdt.h:67
acpi_hpet::page_protection
uint8_t page_protection
Definition
sdt.h:69
acpi_hpet::minimum_tick
uint16_t minimum_tick
Definition
sdt.h:68
acpi_hpet::header
struct acpi_sdt_header header
Definition
sdt.h:64
acpi_hpet::address
struct acpi_gas address
Definition
sdt.h:66
acpi_madt_entry
The start of every MADT entry.
Definition
sdt.h:93
acpi_madt_entry::length
uint8_t length
Definition
sdt.h:95
acpi_madt_entry::type
uint8_t type
Definition
sdt.h:94
acpi_madt_io_apic
An I/O APIC: its registers, and the first GSI its pins bring.
Definition
sdt.h:107
acpi_madt_io_apic::entry
struct acpi_madt_entry entry
Definition
sdt.h:108
acpi_madt_io_apic::id
uint8_t id
Definition
sdt.h:109
acpi_madt_io_apic::gsi_base
uint32_t gsi_base
Definition
sdt.h:112
acpi_madt_io_apic::address
uint32_t address
Definition
sdt.h:111
acpi_madt_io_apic::reserved
uint8_t reserved
Definition
sdt.h:110
acpi_madt_local_apic_nmi
Which local APIC input (LINT0 or LINT1) is the NMI.
Definition
sdt.h:126
acpi_madt_local_apic_nmi::flags
uint16_t flags
Definition
sdt.h:129
acpi_madt_local_apic_nmi::lint
uint8_t lint
Definition
sdt.h:130
acpi_madt_local_apic_nmi::processor_id
uint8_t processor_id
Definition
sdt.h:128
acpi_madt_local_apic_nmi::entry
struct acpi_madt_entry entry
Definition
sdt.h:127
acpi_madt_local_apic
A CPU's local APIC.
Definition
sdt.h:99
acpi_madt_local_apic::flags
uint32_t flags
Definition
sdt.h:103
acpi_madt_local_apic::apic_id
uint8_t apic_id
Definition
sdt.h:102
acpi_madt_local_apic::entry
struct acpi_madt_entry entry
Definition
sdt.h:100
acpi_madt_local_apic::processor_id
uint8_t processor_id
Definition
sdt.h:101
acpi_madt_override
An ISA IRQ that comes on another GSI, or with another polarity or trigger mode, than the default.
Definition
sdt.h:117
acpi_madt_override::bus
uint8_t bus
Definition
sdt.h:119
acpi_madt_override::entry
struct acpi_madt_entry entry
Definition
sdt.h:118
acpi_madt_override::gsi
uint32_t gsi
Definition
sdt.h:121
acpi_madt_override::source
uint8_t source
Definition
sdt.h:120
acpi_madt_override::flags
uint16_t flags
Definition
sdt.h:122
acpi_madt
The MADT's header: the local APICs' address, and flags.
Definition
sdt.h:134
acpi_madt::flags
uint32_t flags
Definition
sdt.h:137
acpi_madt::local_apic_address
uint32_t local_apic_address
Definition
sdt.h:136
acpi_madt::header
struct acpi_sdt_header header
Definition
sdt.h:135
acpi_rsdp2
ACPI 2.0's RSDP (revision 2 or more), which also says where the XSDT is, with 64-bit addresses.
Definition
sdt.h:20
acpi_rsdp2::length
uint32_t length
Definition
sdt.h:22
acpi_rsdp2::xchecksum
uint8_t xchecksum
Definition
sdt.h:24
acpi_rsdp2::reserved
uint8_t reserved[3]
Definition
sdt.h:25
acpi_rsdp2::xsdt
uint64_t xsdt
Definition
sdt.h:23
acpi_rsdp2::v1
struct acpi_rsdp v1
Definition
sdt.h:21
acpi_rsdp
The Root System Description Pointer, which says where the RSDT is.
Definition
sdt.h:10
acpi_rsdp::rsdt
uint32_t rsdt
Definition
sdt.h:15
acpi_rsdp::signature
char signature[8]
Definition
sdt.h:11
acpi_rsdp::checksum
uint8_t checksum
Definition
sdt.h:12
acpi_rsdp::oem_id
char oem_id[6]
Definition
sdt.h:13
acpi_rsdp::rev
uint8_t rev
Definition
sdt.h:14
acpi_rsdt
The RSDT: the other tables' 32-bit addresses.
Definition
sdt.h:42
acpi_rsdt::sdt
uint32_t sdt[0]
Definition
sdt.h:44
acpi_rsdt::header
struct acpi_sdt_header header
Definition
sdt.h:43
acpi_sdt_header
The header that every table starts with.
Definition
sdt.h:29
acpi_sdt_header::checksum
uint8_t checksum
Definition
sdt.h:33
acpi_sdt_header::oem_rev
uint32_t oem_rev
Definition
sdt.h:36
acpi_sdt_header::signature
char signature[4]
Definition
sdt.h:30
acpi_sdt_header::length
uint32_t length
Definition
sdt.h:31
acpi_sdt_header::creator_rev
uint32_t creator_rev
Definition
sdt.h:38
acpi_sdt_header::oem_table_id
char oem_table_id[8]
Definition
sdt.h:35
acpi_sdt_header::rev
uint8_t rev
Definition
sdt.h:32
acpi_sdt_header::creator_id
uint32_t creator_id
Definition
sdt.h:37
acpi_sdt_header::oemid
char oemid[6]
Definition
sdt.h:34
acpi_xsdt
The XSDT: the other tables' 64-bit addresses.
Definition
sdt.h:48
acpi_xsdt::sdt
uint64_t sdt[0]
Definition
sdt.h:50
acpi_xsdt::header
struct acpi_sdt_header header
Definition
sdt.h:49
kernel
arch
i386
include
cpu
sdt.h
Generated by
1.18.0