summaryrefslogtreecommitdiff
path: root/kernel/include/madt.h
blob: b824b38358328338cc15991ef36399d53dcdb32d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef MADT_H
#define MADT_H

#include <rsdp.h>

struct MADT {
	struct ACPI_header h;
	uint32_t lapic_addr;
	uint32_t flags;
} __attribute__((packed));

struct MADT_type_header {
	uint8_t type;
	uint8_t len;
} __attribute__((packed));

struct MADT_cpu_local_apic {
	struct MADT_type_header h;
	uint8_t acpi_id;
	uint8_t apic_id;
	uint32_t flags;
} __attribute__((packed));

struct MADT_io_apic {
	struct MADT_type_header h;
	uint8_t apic_id;
	uint8_t reserved;
	uint32_t io_apic_addr;
	uint32_t int_base;
} __attribute__((packed));

struct MADT_io_apic_int {
	struct MADT_type_header h;
	uint8_t bus_source;
	uint8_t irq_source;
	uint32_t global_sys_int;
	uint16_t flags;
} __attribute__((packed));

struct MADT_lapic_nmi {
	struct MADT_type_header h;
	uint8_t acpi_cpu_id;
	uint16_t flags;
	uint8_t lint;
} __attribute__((packed));

struct MADT_lapic_addr {
	struct MADT_type_header h;
	uint16_t reserved;
	uint64_t phys_addr;
} __attribute__((packed));

void madt_parse_cpu(uint64_t *addr);
void madt_parse_ioapic(uint64_t *addr);
void madt_parse_int(uint64_t *addr);
void madt_parse_lapic_nmi(uint64_t *addr);
void madt_parse_lapic_addr_ovr(uint64_t *addr);
void parse_madt(void);

#endif