-
Notifications
You must be signed in to change notification settings - Fork 0
/
mptable.h
92 lines (81 loc) · 1.68 KB
/
mptable.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <cstdint>
constexpr uint32_t MPTABLE_PTR_MAGIC = ('_'<<24) | ('P'<<16) | ('M'<<8) | '_';
struct MPFloatingPointer
{
uint32_t signature;
uint32_t physaddr;
uint8_t length;
uint8_t specrev;
uint8_t checksum;
uint8_t features[5];
};
static_assert(sizeof(MPFloatingPointer) == 16);
constexpr uint32_t MPTABLE_CONFIG_MAGIC = ('P'<<24) | ('M'<<16) | ('C'<<8) | 'P';
struct MPConfigHeader
{
uint32_t signature;
uint16_t base_length;
uint8_t spec_rev;
uint8_t checksum;
char oemid[8];
char prodid[12];
uint32_t oem_table_addr;
uint16_t oem_table_size;
uint16_t entries;
uint32_t lapic_addr;
uint16_t ext_length;
uint8_t ext_checksum;
uint8_t reserved;
};
static_assert(sizeof(MPConfigHeader) == 44);
enum class MPEntryType : uint8_t
{
Processor = 0,
Bus = 1,
IOAPIC = 2,
IOInterrupt = 3,
LocalInterrupt = 4,
};
struct MPProcessorEntry
{
MPEntryType type;
uint8_t apic_id;
uint8_t apic_ver;
uint8_t cpu_flags;
uint32_t cpu_signature;
uint32_t feature_flags;
uint32_t reserved[2];
};
constexpr uint8_t MP_PROCESSOR_ENABLED = 1;
constexpr uint8_t MP_PROCESSOR_BSP = 2;
struct MPBusEntry
{
MPEntryType type;
uint8_t bus_id;
char bus_type[6];
};
struct MPIOAPICEntry
{
MPEntryType type;
uint8_t apic_id;
uint8_t apic_ver;
uint8_t flags;
uint32_t addr;
};
enum class MPInterruptType : uint8_t
{
Int = 0,
Nmi = 1,
Smi = 2,
ExtInt = 3,
};
struct MPInterruptEntry
{
MPEntryType type;
MPInterruptType int_type;
uint16_t flags;
uint8_t source_bus;
uint8_t source_irq;
uint8_t dest_apic_id;
uint8_t dest_apic_int;
};