acpi: calibrate local APIC timer on BSP
This commit is contained in:
@@ -33,6 +33,8 @@ namespace arch::acpi {
|
||||
kern_status_t read_irq(unsigned int index, irq_entry &entry);
|
||||
void write_irq(unsigned int index, const irq_entry &entry);
|
||||
void map_irq(unsigned int src, unsigned int dest);
|
||||
void mask_irq(unsigned int vec);
|
||||
void unmask_irq(unsigned int vec, unsigned int dest_cpu = (unsigned int)-1);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,22 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define APIC_LVT_INT_MASKED 0x10000
|
||||
#define APIC_LVT_TIMER_MODE_PERIODIC 0x20000
|
||||
|
||||
namespace arch::acpi {
|
||||
class local_apic {
|
||||
uint32_t *base_ = nullptr;
|
||||
|
||||
public:
|
||||
enum {
|
||||
EOI = 0xB0,
|
||||
LVT_TIMER = 320,
|
||||
TIMER_INITCOUNT = 0x380,
|
||||
TIMER_CURCOUNT = 0x390,
|
||||
TIMER_DIV = 0x3E0,
|
||||
};
|
||||
|
||||
local_apic(uint32_t *base);
|
||||
|
||||
uint32_t read(uint32_t reg);
|
||||
|
||||
@@ -9,6 +9,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define ml_cpu_block_get_id(p) ((p)->c_cpu_id)
|
||||
#define ml_cpu_block_get_data(p) ((p)->c_data)
|
||||
|
||||
struct cpu_data;
|
||||
|
||||
typedef struct ml_cpu_block {
|
||||
struct ml_cpu_block *c_this;
|
||||
@@ -18,6 +21,8 @@ typedef struct ml_cpu_block {
|
||||
|
||||
struct idt_ptr c_idt_ptr;
|
||||
unsigned int c_cpu_id;
|
||||
|
||||
struct cpu_data *c_data;
|
||||
} ml_cpu_block;
|
||||
|
||||
#define ml_cpu_pause() __asm__ __volatile__("hlt")
|
||||
|
||||
Reference in New Issue
Block a user