apic: Added madt entry struct types
This also moves madt parsing to apic.c
This commit is contained in:
parent
6627486995
commit
57ed3eefe6
6 changed files with 130 additions and 41 deletions
|
|
@ -1,22 +1,83 @@
|
|||
#ifndef _APIC_H_
|
||||
#define _APIC_H_
|
||||
|
||||
#define MADT_LAPIC 0
|
||||
#define MADT_IOAPIC 1
|
||||
#define MADT_IOAPIC_OVRD 2
|
||||
#define MADT_IOAPIC_NMI 3
|
||||
#define MADT_LAPIC_NMI 4
|
||||
#define MADT_LAPIC_OVRD 5
|
||||
#define MADT_X2_LAPIC 9
|
||||
|
||||
#ifndef __ASM__
|
||||
|
||||
#include <kernel/common.h>
|
||||
#include <kernel/acpi.h>
|
||||
|
||||
struct madt {
|
||||
char signature[4];
|
||||
uint32_t length;
|
||||
uint8_t revision;
|
||||
uint8_t checksum;
|
||||
char oemid[6];
|
||||
uint64_t oem_tableid;
|
||||
uint32_t oem_rev;
|
||||
uint32_t creator_id;
|
||||
uint32_t creator_revision;
|
||||
struct acpi_sdt_header h;
|
||||
uint32_t lapic_addr;
|
||||
uint32_t flags;
|
||||
} PACKED;
|
||||
|
||||
} __attribute__((packed));
|
||||
struct madt_header {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
} PACKED;
|
||||
|
||||
struct madt_lapic {
|
||||
struct madt_header h;
|
||||
uint8_t acpi_cpu_id;
|
||||
uint8_t apic_id;
|
||||
uint32_t flags;
|
||||
} PACKED;
|
||||
|
||||
struct madt_ioapic {
|
||||
struct madt_header h;
|
||||
uint8_t ioapic_id;
|
||||
uint8_t reserved;
|
||||
uint32_t ioapic_addr;
|
||||
uint32_t intr_base;
|
||||
} PACKED;
|
||||
|
||||
struct madt_ioapic_ovrd {
|
||||
struct madt_header h;
|
||||
uint8_t bus;
|
||||
uint8_t irq;
|
||||
uint32_t intr;
|
||||
uint16_t flags;
|
||||
} PACKED;
|
||||
|
||||
struct madt_ioapic_nmi {
|
||||
struct madt_header h;
|
||||
uint8_t nmi;
|
||||
uint8_t reserved;
|
||||
uint16_t flags;
|
||||
uint32_t intr;
|
||||
} PACKED;
|
||||
|
||||
struct madt_lapic_nmi {
|
||||
struct madt_header h;
|
||||
uint8_t acpi_cpu_id;
|
||||
uint16_t flags;
|
||||
uint8_t lint;
|
||||
} PACKED;
|
||||
|
||||
struct madt_lapic_ovrd {
|
||||
struct madt_header h;
|
||||
uint16_t reserved;
|
||||
uint64_t lapic_addr;
|
||||
} PACKED;
|
||||
|
||||
struct madt_x2_lapic {
|
||||
struct madt_header h;
|
||||
uint16_t reserved;
|
||||
uint32_t lapic_id;
|
||||
uint32_t flags;
|
||||
uint32_t acpi_id;
|
||||
} PACKED;
|
||||
|
||||
int madt_parse_next_entry(int offset);
|
||||
|
||||
#endif /* __ASM__ */
|
||||
#endif /* _APIC_H_ */
|
||||
|
|
|
|||
|
|
@ -30,12 +30,6 @@ struct rsdt {
|
|||
uint32_t sdt[];
|
||||
} PACKED;
|
||||
|
||||
struct madt {
|
||||
struct acpi_sdt_header h;
|
||||
uint32_t lapic_addr;
|
||||
uint32_t flags;
|
||||
} PACKED;
|
||||
|
||||
void acpi_init();
|
||||
|
||||
extern struct madt *__madt;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <kernel/common.h>
|
||||
|
||||
#define MSR_APIC_BASE 0x1B
|
||||
|
||||
#ifndef __ASM__
|
||||
|
||||
uint64_t rdmsr(uint32_t msr);
|
||||
|
|
|
|||
Loading…
Reference in a new issue