x86_64: create idle thread and initialise runqueue during AP bootstrap

This commit is contained in:
2023-05-03 19:27:39 +01:00
parent c64577e24e
commit d0371d9204
3 changed files with 46 additions and 34 deletions

View File

@@ -70,7 +70,7 @@ static io_apic *get_ioapic_for_irq(unsigned int vec)
static void configure_legacy_pic(void)
{
printk("acpi: APIC unavailable");
pit_start(10);
pit_start(HZ);
}
static void ioapic_init(uintptr_t base, unsigned int int_base)
@@ -172,14 +172,21 @@ static void init_all_ioapic(struct acpi_madt *madt)
parse_legacy_irq_override(madt);
}
kern_status_t ap_apic_init(void)
{
struct acpi_madt *madt = (struct acpi_madt *)acpi_find_sdt(ACPI_SIG_MADT);
local_apic_enable(madt);
//irq_enable();
local_apic_config_timer();
return KERN_OK;
}
/* only the bootstrap processor should call apic_init()
all other APs should call ap_apic_init() instead */
kern_status_t apic_init(void)
{
/* the bootstrap processor will be the first one ro call apic_init().
it is responsible for initialising the I/O APICs */
if (bsp_id == (unsigned int)-1) {
bsp_id = this_cpu();
}
struct acpi_madt *madt = (struct acpi_madt *)acpi_find_sdt(ACPI_SIG_MADT);
if (check_apic() == 0 || !madt) {
@@ -187,9 +194,8 @@ kern_status_t apic_init(void)
return KERN_UNSUPPORTED;
}
if (this_cpu() == bsp_id) {
init_all_ioapic(madt);
}
bsp_id = this_cpu();
init_all_ioapic(madt);
local_apic_enable(madt);
disable_8259();
@@ -198,7 +204,6 @@ kern_status_t apic_init(void)
irq_enable();
pit_start(HZ);
return KERN_OK;
local_apic_config_timer();
pit_stop();