From 1d5026909d9bb497082970a453043976f13b580d Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 15 Sep 2009 20:22:04 +0000 Subject: [PATCH] Basically reverted previous commit, since at that point we haven't yet checked the existence of the apics. Moved the code to disable the local apic from arch_timer.c to arch_int.cpp, so we also avoid installing the interrupt handler for it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33149 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/bios_ia32/menu.cpp | 27 ++++++++------------- src/system/kernel/arch/x86/arch_int.cpp | 14 ++++++++++- src/system/kernel/arch/x86/arch_timer.c | 12 --------- 3 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/system/boot/platform/bios_ia32/menu.cpp b/src/system/boot/platform/bios_ia32/menu.cpp index 35906d6fa6..174a1a9173 100644 --- a/src/system/boot/platform/bios_ia32/menu.cpp +++ b/src/system/boot/platform/bios_ia32/menu.cpp @@ -7,10 +7,6 @@ #include "smp.h" #include "video.h" -// TODO: Move these away! -#include -#include - #include #include #include @@ -54,20 +50,17 @@ platform_add_menus(Menu *menu) #if 0 // TODO: IOAPIC isn't yet used anywhere - if (gKernelArgs.arch_args.ioapic != NULL) { - menu->AddItem(item = new(nothrow) MenuItem("Disable IO-APIC")); - item->SetType(MENU_ITEM_MARKABLE); - item->SetData(B_SAFEMODE_DISABLE_IOAPIC); - item->SetHelpText("Disables using the IO APIC for interrupt handling, " - "forcing instead the use of the PIC."); - } + menu->AddItem(item = new(nothrow) MenuItem("Disable IO-APIC")); + item->SetType(MENU_ITEM_MARKABLE); + 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 != NULL) { - menu->AddItem(item = new(nothrow) MenuItem("Disable APIC Timers")); - item->SetType(MENU_ITEM_MARKABLE); - item->SetData(B_SAFEMODE_DISABLE_APIC); - item->SetHelpText("Disables using the LOCAL APIC for timekeeping."); - } + menu->AddItem(item = new(nothrow) MenuItem("Disable LOCAL APIC")); + item->SetType(MENU_ITEM_MARKABLE); + item->SetData(B_SAFEMODE_DISABLE_APIC); + item->SetHelpText("Disables using the LOCAL APIC for timekeeping."); + break; default: break; diff --git a/src/system/kernel/arch/x86/arch_int.cpp b/src/system/kernel/arch/x86/arch_int.cpp index 955df6cb0b..4b829449d5 100644 --- a/src/system/kernel/arch/x86/arch_int.cpp +++ b/src/system/kernel/arch/x86/arch_int.cpp @@ -560,6 +560,18 @@ ioapic_init(kernel_args *args) return; } + bool disableAPIC = false; + void *handle = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS); + if (handle != NULL) { + disableAPIC = get_driver_boolean_parameter(handle, B_SAFEMODE_DISABLE_APIC, + disableAPIC, disableAPIC); + unload_driver_settings(handle); + } + + if (disableAPIC) { + args->arch_args.apic = NULL; + return; + } // always map the local apic as it can be used for timers even if we // don't end up using the io apic sLocalAPIC = args->arch_args.apic; @@ -569,7 +581,7 @@ ioapic_init(kernel_args *args) panic("mapping the local apic failed"); return; } - + if (args->arch_args.ioapic == NULL) { dprintf("no ioapic available, not using ioapics for interrupt routing\n"); return; diff --git a/src/system/kernel/arch/x86/arch_timer.c b/src/system/kernel/arch/x86/arch_timer.c index f025a6482b..4f43360317 100644 --- a/src/system/kernel/arch/x86/arch_timer.c +++ b/src/system/kernel/arch/x86/arch_timer.c @@ -68,23 +68,11 @@ arch_init_timer(kernel_args *args) int i = 0; int bestPriority = -1; timer_info *timer = NULL; - bool disableAPIC = false; - void *handle = NULL; cpu_status state = disable_interrupts(); - handle = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS); - if (handle != NULL) { - disableAPIC = get_driver_boolean_parameter(handle, B_SAFEMODE_DISABLE_APIC, - disableAPIC, disableAPIC); - unload_driver_settings(handle); - } - for (i = 0; (timer = sTimers[i]) != NULL; i++) { int priority = timer->get_priority(); - if (timer == &gAPICTimer && disableAPIC) - continue; - if (priority < bestPriority) { TRACE(("arch_init_timer: Skipping %s because there is a higher priority timer (%s) initialized.\n", timer->name, sTimer->name)); continue;