diff --git a/src/system/boot/platform/bios_ia32/smp.cpp b/src/system/boot/platform/bios_ia32/smp.cpp index 6b63742229..779680e130 100644 --- a/src/system/boot/platform/bios_ia32/smp.cpp +++ b/src/system/boot/platform/bios_ia32/smp.cpp @@ -577,16 +577,17 @@ void smp_add_safemode_menus(Menu *menu) { MenuItem *item; -#if 0 + if (gKernelArgs.arch_args.ioapic_phys != 0) { - // TODO: IOAPIC isn't yet used anywhere menu->AddItem(item = new(nothrow) MenuItem("Disable IO-APIC")); item->SetType(MENU_ITEM_MARKABLE); + item->SetMarked(true); + // TODO: disabled by default for now item->SetData(B_SAFEMODE_DISABLE_IOAPIC); item->SetHelpText("Disables using the IO APIC for interrupt handling, " "forcing instead the use of the PIC."); } -#endif + if (gKernelArgs.arch_args.apic_phys != 0) { menu->AddItem(item = new(nothrow) MenuItem("Disable LOCAL APIC")); item->SetType(MENU_ITEM_MARKABLE); diff --git a/src/system/kernel/arch/x86/arch_int.cpp b/src/system/kernel/arch/x86/arch_int.cpp index 2cc09b5658..55bca5cd37 100644 --- a/src/system/kernel/arch/x86/arch_int.cpp +++ b/src/system/kernel/arch/x86/arch_int.cpp @@ -540,6 +540,16 @@ ioapic_configure_io_interrupt(int32 num, uint32 config) static void ioapic_map(kernel_args* args) { + if (args->arch_args.apic == NULL) { + dprintf("no local apic available\n"); + return; + } + + if (args->arch_args.ioapic == NULL) { + dprintf("no ioapic available, not using ioapics for interrupt routing\n"); + return; + } + // map in the ioapic sIOAPIC = (ioapic *)args->arch_args.ioapic; if (vm_map_physical_memory(B_SYSTEM_TEAM, "ioapic", (void**)&sIOAPIC, @@ -564,17 +574,10 @@ ioapic_init(kernel_args* args) &ioapic_end_of_interrupt }; - if (args->arch_args.apic == NULL) { - dprintf("no local apic available\n"); + if (sIOAPIC == NULL) return; - } - if (args->arch_args.ioapic == NULL) { - dprintf("no ioapic available, not using ioapics for interrupt routing\n"); - return; - } - - if (!get_safemode_boolean(B_SAFEMODE_DISABLE_IOAPIC, false)) { + if (!get_safemode_boolean(B_SAFEMODE_DISABLE_IOAPIC, true)) { dprintf("ioapic explicitly disabled, not using ioapics for interrupt " "routing\n"); return; @@ -607,6 +610,16 @@ ioapic_init(kernel_args* args) CObjectDeleter pciModulePutter(B_PCI_MODULE_NAME, put_module); + // TODO: here ACPI needs to be used to properly set up the PCI IRQ + // routing. + + IRQRoutingTable table; + status = read_irq_routing_table(pciModule, acpiModule, &table); + if (status != B_OK) { + dprintf("reading IRQ routing table failed, no ioapic.\n"); + return; + } + sLevelTriggeredInterrupts = 0; sIOAPICMaxRedirectionEntry = ((version >> IO_APIC_MAX_REDIRECTION_ENTRY_SHIFT) @@ -649,14 +662,6 @@ ioapic_init(kernel_args* args) for (uint32 i = 0; i < 256; i++) sIRQToIOAPICPin[i] = i; - // TODO: here ACPI needs to be used to properly set up the PCI IRQ - // routing. - - IRQRoutingTable table; - status = read_irq_routing_table(pciModule, acpiModule, &table); - if (status != B_OK) - return; - // configure apic interrupts assume 1:1 mapping for (int i = 0; i < table.Count(); i++) { irq_routing_entry& entry = table.ElementAt(i);