* Moved I/O APIC initialization to a later point, now the APCI and DPC modules

can safely be used.
* Since using the I/O APIC is disabled by default, I've removed the "return"
  that prevented its use when enabled. Let's see if it already does anything.
* Adapted other arch_int.cpp with a bit of cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36290 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-04-15 12:42:10 +00:00
parent e1bef3de00
commit 9de17be600
9 changed files with 104 additions and 49 deletions
+7 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2005, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2002-2010, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -15,19 +15,21 @@
#define B_LOW_ACTIVE_POLARITY 4
#define B_HIGH_ACTIVE_POLARITY 8
#ifdef __cplusplus
extern "C" {
#endif
struct kernel_args;
status_t arch_int_init(struct kernel_args *args);
status_t arch_int_init_post_vm(struct kernel_args *args);
status_t arch_int_init_post_device_manager(struct kernel_args *args);
status_t arch_int_init(struct kernel_args* args);
status_t arch_int_init_post_vm(struct kernel_args* args);
status_t arch_int_init_io(kernel_args* args);
status_t arch_int_init_post_device_manager(struct kernel_args* args);
void arch_int_enable_interrupts(void);
int arch_int_disable_interrupts(void);
void arch_int_restore_interrupts(int oldstate);
void arch_int_restore_interrupts(int oldState);
void arch_int_enable_io_interrupt(int irq);
void arch_int_disable_io_interrupt(int irq);
void arch_int_configure_io_interrupt(int irq, uint32 config);
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2006, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2003-2010, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -23,9 +23,10 @@ struct kernel_args;
extern "C" {
#endif
status_t int_init(struct kernel_args *args);
status_t int_init_post_vm(struct kernel_args *args);
status_t int_init_post_device_manager(struct kernel_args *args);
status_t int_init(struct kernel_args* args);
status_t int_init_post_vm(struct kernel_args* args);
status_t int_init_io(kernel_args* args);
status_t int_init_post_device_manager(struct kernel_args* args);
int int_io_interrupt_handler(int vector, bool levelTriggered);
bool interrupts_enabled(void);
+9 -4
View File
@@ -1,21 +1,19 @@
/*
* Copyright 2003-2006, Haiku Inc. All rights reserved.
* Copyright 2003-2010, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler <[email protected]>
* Ingo Weinhold <[email protected]>
* François Revol <[email protected]>
* Distributed under the terms of the MIT License.
*
*
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
*/
#include <int.h>
//#include <arch_platform.h>
#include <arch/smp.h>
#include <boot/kernel_args.h>
#include <device_manager.h>
@@ -112,6 +110,7 @@ print_iframe(struct iframe *frame)
#warning ARM WRITEME
}
status_t
arch_int_init(kernel_args *args)
{
@@ -145,6 +144,12 @@ arch_int_init_post_vm(kernel_args *args)
}
status_t
arch_int_init_io(kernel_args* args)
{
return B_OK;
}
status_t
arch_int_init_post_device_manager(struct kernel_args *args)
+12 -3
View File
@@ -1,18 +1,17 @@
/*
* Copyright 2003-2009, Haiku Inc. All rights reserved.
* Copyright 2003-2010, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler <[email protected]>
* Ingo Weinhold <[email protected]>
* François Revol <[email protected]>
* Distributed under the terms of the MIT License.
*
*
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
*/
#include <int.h>
#include <arch_platform.h>
@@ -121,6 +120,7 @@ print_iframe(struct iframe *frame)
#endif
}
static addr_t
fault_address(struct iframe *iframe)
{
@@ -145,6 +145,7 @@ fault_address(struct iframe *iframe)
}
}
static bool
fault_was_write(struct iframe *iframe)
{
@@ -162,6 +163,7 @@ fault_was_write(struct iframe *iframe)
}
}
extern "C" void m68k_exception_entry(struct iframe *iframe);
void
m68k_exception_entry(struct iframe *iframe)
@@ -347,6 +349,13 @@ arch_int_init_post_vm(kernel_args *args)
}
status_t
arch_int_init_io(kernel_args* args)
{
return B_OK;
}
#if 0 /* PIC modules */
template<typename ModuleInfo>
struct Module : DoublyLinkedListLinkImpl<Module<ModuleInfo> > {
+9 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2009, Haiku Inc. All rights reserved.
* Copyright 2003-2010, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -11,9 +11,9 @@
* Distributed under the terms of the NewOS License.
*/
#include <int.h>
//#include <arch_platform.h>
#include <arch/smp.h>
#include <boot/kernel_args.h>
#include <device_manager.h>
@@ -79,6 +79,13 @@ arch_int_init_post_vm(kernel_args* args)
}
status_t
arch_int_init_io(kernel_args* args)
{
return B_OK;
}
status_t
arch_int_init_post_device_manager(struct kernel_args* args)
{
+10 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2009, Haiku Inc. All rights reserved.
* Copyright 2003-2010, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -10,6 +10,7 @@
* Distributed under the terms of the NewOS License.
*/
#include <int.h>
#include <arch/smp.h>
@@ -28,6 +29,7 @@
#include <string.h>
// defined in arch_exceptions.S
extern int __irqvec_start;
extern int __irqvec_end;
@@ -313,6 +315,13 @@ arch_int_init_post_vm(kernel_args *args)
}
status_t
arch_int_init_io(kernel_args* args)
{
return B_OK;
}
template<typename ModuleInfo>
struct Module : DoublyLinkedListLinkImpl<Module<ModuleInfo> > {
Module(ModuleInfo *module)
+38 -25
View File
@@ -1,7 +1,7 @@
/*
* Copyright 2010, Clemens Zeidler, haiku@clemens-zeidler.de.
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
@@ -538,7 +538,22 @@ ioapic_configure_io_interrupt(int32 num, uint32 config)
static void
ioapic_init(kernel_args *args)
ioapic_map(kernel_args* args)
{
// map in the ioapic
sIOAPIC = (ioapic *)args->arch_args.ioapic;
if (vm_map_physical_memory(B_SYSTEM_TEAM, "ioapic", (void**)&sIOAPIC,
B_EXACT_ADDRESS, B_PAGE_SIZE,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
args->arch_args.ioapic_phys, true) < 0) {
panic("mapping the ioapic failed");
return;
}
}
static void
ioapic_init(kernel_args* args)
{
static const interrupt_controller ioapicController = {
"82093AA IOAPIC",
@@ -549,10 +564,6 @@ ioapic_init(kernel_args *args)
&ioapic_end_of_interrupt
};
// always init the local apic as it can be used for timers even if we
// don't end up using the io apic
apic_init(args);
if (args->arch_args.apic == NULL) {
dprintf("no local apic available\n");
return;
@@ -569,8 +580,11 @@ ioapic_init(kernel_args *args)
return;
}
// TODO: remove when the PCI IRQ routing through ACPI is available below
return;
uint32 version = ioapic_read_32(IO_APIC_VERSION);
if (version == 0xffffffff) {
dprintf("ioapic seems inaccessible, not using it\n");
return;
}
// load acpi module
status_t status;
@@ -582,6 +596,7 @@ ioapic_init(kernel_args *args)
}
BPrivate::CObjectDeleter<const char, status_t>
acpiModulePutter(B_ACPI_MODULE_NAME, put_module);
// load pci module
pci_module_info* pciModule;
status = get_module(B_PCI_MODULE_NAME, (module_info**)&pciModule);
@@ -592,22 +607,6 @@ ioapic_init(kernel_args *args)
CObjectDeleter<const char, status_t> pciModulePutter(B_PCI_MODULE_NAME,
put_module);
// map in the ioapic
sIOAPIC = (ioapic *)args->arch_args.ioapic;
if (vm_map_physical_memory(B_SYSTEM_TEAM, "ioapic", (void**)&sIOAPIC,
B_EXACT_ADDRESS, B_PAGE_SIZE,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
args->arch_args.ioapic_phys, true) < 0) {
panic("mapping the ioapic failed");
return;
}
uint32 version = ioapic_read_32(IO_APIC_VERSION);
if (version == 0xffffffff) {
dprintf("ioapic seems inaccessible, not using it\n");
return;
}
sLevelTriggeredInterrupts = 0;
sIOAPICMaxRedirectionEntry
= ((version >> IO_APIC_MAX_REDIRECTION_ENTRY_SHIFT)
@@ -1346,7 +1345,13 @@ arch_int_init(struct kernel_args *args)
status_t
arch_int_init_post_vm(struct kernel_args *args)
{
ioapic_init(args);
// Always init the local apic as it can be used for timers even if we
// don't end up using the io apic
apic_init(args);
// We need to map in the I/O APIC here, since we would lose the already
// wired mapping before arch_int_init_io() is called.
ioapic_map(args);
// create IDT area for the boot CPU
area_id area = create_area("idt", (void**)&sIDTs[0], B_EXACT_ADDRESS,
@@ -1378,6 +1383,14 @@ arch_int_init_post_vm(struct kernel_args *args)
}
status_t
arch_int_init_io(kernel_args* args)
{
ioapic_init(args);
return B_OK;
}
status_t
arch_int_init_post_device_manager(struct kernel_args *args)
{
+12 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -120,7 +120,7 @@ interrupts_enabled(void)
status_t
int_init(kernel_args *args)
int_init(kernel_args* args)
{
TRACE(("init_int_handlers: entry\n"));
@@ -129,7 +129,7 @@ int_init(kernel_args *args)
status_t
int_init_post_vm(kernel_args *args)
int_init_post_vm(kernel_args* args)
{
int i;
@@ -157,7 +157,14 @@ int_init_post_vm(kernel_args *args)
status_t
int_init_post_device_manager(kernel_args *args)
int_init_io(kernel_args* args)
{
return arch_int_init_io(args);
}
status_t
int_init_post_device_manager(kernel_args* args)
{
arch_debug_install_interrupt_handlers();
@@ -172,7 +179,7 @@ int
int_io_interrupt_handler(int vector, bool levelTriggered)
{
int status = B_UNHANDLED_INTERRUPT;
struct io_handler *io;
struct io_handler* io;
bool handled = false;
if (!sVectors[vector].no_lock_vector)
+2
View File
@@ -171,6 +171,8 @@ _start(kernel_args *bootKernelArgs, int currentCPU)
kernel_daemon_init();
arch_platform_init_post_thread(&sKernelArgs);
TRACE("init I/O interrupts\n");
int_init_io(&sKernelArgs);
TRACE("init VM threads\n");
vm_init_post_thread(&sKernelArgs);
low_resource_manager_init_post_thread();