x86_64: acpi: bring up other APs in long mode

This commit is contained in:
2023-05-01 18:13:44 +01:00
parent 223b37a113
commit 4677c881e1
6 changed files with 201 additions and 114 deletions

View File

@@ -1,30 +1,43 @@
#ifndef ARCH_ACPI_LOCAL_APIC_HPP_
#define ARCH_ACPI_LOCAL_APIC_HPP_
#include <socks/status.h>
#include <stdint.h>
#define APIC_LVT_INT_MASKED 0x10000
#define APIC_LVT_TIMER_MODE_PERIODIC 0x20000
struct acpi_madt;
namespace arch::acpi {
class local_apic {
uint32_t *base_ = nullptr;
class local_apic {
uint32_t *base_ = nullptr;
public:
enum {
EOI = 0xB0,
LVT_TIMER = 0x320,
TIMER_INITCOUNT = 0x380,
TIMER_CURCOUNT = 0x390,
TIMER_DIV = 0x3E0,
};
local_apic(uint32_t *base);
uint32_t read(uint32_t reg);
void write(uint32_t reg, uint32_t val);
void ack();
public:
enum {
EOI = 0xB0,
IPI_STATUS = 0x280,
IPI_ICR = 0x300,
IPI_DEST = 0x310,
LVT_TIMER = 0x320,
TIMER_INITCOUNT = 0x380,
TIMER_CURCOUNT = 0x390,
TIMER_DIV = 0x3E0,
};
local_apic(uint32_t *base = nullptr);
static kern_status_t find(struct acpi_madt *madt, local_apic& out);
static local_apic& get(void);
uint32_t read(uint32_t reg);
void write(uint32_t reg, uint32_t val);
void ack();
uint32_t *ptr() const { return base_; }
void send_ipi(unsigned int dest, unsigned int data);
};
}
#endif