* We should check for the I/O APIC before mapping it (since we panic if mapping
it failed...). * Moved IRQ table reading much earlier (before starting to program the I/O APIC), though it currently fails, possibly because the device manager isn't up yet, and there is no embedded controller driver. * The kernel now enables I/O APICs by default, but the boot loader disables them - you can now enable them using the safe mode menu, but it currently won't have any (positive) effect. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36293 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -577,16 +577,17 @@ void
|
|||||||
smp_add_safemode_menus(Menu *menu)
|
smp_add_safemode_menus(Menu *menu)
|
||||||
{
|
{
|
||||||
MenuItem *item;
|
MenuItem *item;
|
||||||
#if 0
|
|
||||||
if (gKernelArgs.arch_args.ioapic_phys != 0) {
|
if (gKernelArgs.arch_args.ioapic_phys != 0) {
|
||||||
// TODO: IOAPIC isn't yet used anywhere
|
|
||||||
menu->AddItem(item = new(nothrow) MenuItem("Disable IO-APIC"));
|
menu->AddItem(item = new(nothrow) MenuItem("Disable IO-APIC"));
|
||||||
item->SetType(MENU_ITEM_MARKABLE);
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
|
item->SetMarked(true);
|
||||||
|
// TODO: disabled by default for now
|
||||||
item->SetData(B_SAFEMODE_DISABLE_IOAPIC);
|
item->SetData(B_SAFEMODE_DISABLE_IOAPIC);
|
||||||
item->SetHelpText("Disables using the IO APIC for interrupt handling, "
|
item->SetHelpText("Disables using the IO APIC for interrupt handling, "
|
||||||
"forcing instead the use of the PIC.");
|
"forcing instead the use of the PIC.");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (gKernelArgs.arch_args.apic_phys != 0) {
|
if (gKernelArgs.arch_args.apic_phys != 0) {
|
||||||
menu->AddItem(item = new(nothrow) MenuItem("Disable LOCAL APIC"));
|
menu->AddItem(item = new(nothrow) MenuItem("Disable LOCAL APIC"));
|
||||||
item->SetType(MENU_ITEM_MARKABLE);
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
|
|||||||
@@ -540,6 +540,16 @@ ioapic_configure_io_interrupt(int32 num, uint32 config)
|
|||||||
static void
|
static void
|
||||||
ioapic_map(kernel_args* args)
|
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
|
// map in the ioapic
|
||||||
sIOAPIC = (ioapic *)args->arch_args.ioapic;
|
sIOAPIC = (ioapic *)args->arch_args.ioapic;
|
||||||
if (vm_map_physical_memory(B_SYSTEM_TEAM, "ioapic", (void**)&sIOAPIC,
|
if (vm_map_physical_memory(B_SYSTEM_TEAM, "ioapic", (void**)&sIOAPIC,
|
||||||
@@ -564,17 +574,10 @@ ioapic_init(kernel_args* args)
|
|||||||
&ioapic_end_of_interrupt
|
&ioapic_end_of_interrupt
|
||||||
};
|
};
|
||||||
|
|
||||||
if (args->arch_args.apic == NULL) {
|
if (sIOAPIC == NULL)
|
||||||
dprintf("no local apic available\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (args->arch_args.ioapic == NULL) {
|
if (!get_safemode_boolean(B_SAFEMODE_DISABLE_IOAPIC, true)) {
|
||||||
dprintf("no ioapic available, not using ioapics for interrupt routing\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!get_safemode_boolean(B_SAFEMODE_DISABLE_IOAPIC, false)) {
|
|
||||||
dprintf("ioapic explicitly disabled, not using ioapics for interrupt "
|
dprintf("ioapic explicitly disabled, not using ioapics for interrupt "
|
||||||
"routing\n");
|
"routing\n");
|
||||||
return;
|
return;
|
||||||
@@ -607,6 +610,16 @@ ioapic_init(kernel_args* args)
|
|||||||
CObjectDeleter<const char, status_t> pciModulePutter(B_PCI_MODULE_NAME,
|
CObjectDeleter<const char, status_t> pciModulePutter(B_PCI_MODULE_NAME,
|
||||||
put_module);
|
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;
|
sLevelTriggeredInterrupts = 0;
|
||||||
sIOAPICMaxRedirectionEntry
|
sIOAPICMaxRedirectionEntry
|
||||||
= ((version >> IO_APIC_MAX_REDIRECTION_ENTRY_SHIFT)
|
= ((version >> IO_APIC_MAX_REDIRECTION_ENTRY_SHIFT)
|
||||||
@@ -649,14 +662,6 @@ ioapic_init(kernel_args* args)
|
|||||||
for (uint32 i = 0; i < 256; i++)
|
for (uint32 i = 0; i < 256; i++)
|
||||||
sIRQToIOAPICPin[i] = 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
|
// configure apic interrupts assume 1:1 mapping
|
||||||
for (int i = 0; i < table.Count(); i++) {
|
for (int i = 0; i < table.Count(); i++) {
|
||||||
irq_routing_entry& entry = table.ElementAt(i);
|
irq_routing_entry& entry = table.ElementAt(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user