aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/psim
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2011-01-29 20:58:38 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2011-01-29 20:58:38 +0000
commit6d2d7b8c0d17743d61c63a66ec0a29f18676282f (patch)
treefec042adbb304ebfd29a4edbd235c9e905009e06 /sys/powerpc/psim
parent696703e5ea1d25b36197d548f9c3ee7a5e294ef3 (diff)
downloadsrc-6d2d7b8c0d17743d61c63a66ec0a29f18676282f.tar.gz
src-6d2d7b8c0d17743d61c63a66ec0a29f18676282f.zip
Fix the interrupt code, broken 7 months ago. The interrupt framework
already supported nested PICs, but was limited to having a nested AT-PIC only. With G5 support the need for nested OpenPIC controllers needed to be added. This was done the wrong way and broke the MPC8555 eval system in the process. OFW, as well as FDT, describe the interrupt routing in terms of a controller and an interrupt pin on it. This needs to be mapped to a flat and global resource: the IRQ. The IRQ is the same as the PCI intline and as such needs to be representable in 8 bits. Secondly, ISA support pretty much dictates that IRQ 0-15 should be reserved for ISA interrupts, because of the internal workins of south bridges. Both were broken. This change reverts revision 209298 for a big part and re-implements it simpler. In particular: o The id() method of the PIC I/F is removed again. It's not needed. o The openpic_attach() function has been changed to take the OFW or FDT phandle of the controller as a second argument. All bus attachments that previously used openpic_attach() as the attach method of the device I/F now implement as bus-specific method and pass the phandle_t to the renamed openpic_attach(). o Change powerpc_register_pic() to take a few more arguments. In particular: - Pass the number of IPIs specificly. The number of IRQs carved out for a PIC is the sum of the number of int. pins and IPIs. - Pass a flag indicating whether the PIC is an AT-PIC or not. This tells the interrupt framework whether to assign IRQ 0-15 or some other range. o Until we implement proper multi-pass bus enumeration, we have to handle the case where we need to map from PIC+pin to IRQ *before* the PIC gets registered. This is done in a similar way as before, but rather than carving out 256 IRQs per PIC, we carve out 128 IRQs (124 pins + 4 IPIs). This is supposed to handle the G5 case, but should really be fixed properly using multiple passes. o Have the interrupt framework set root_pic in most cases and not put that burden in PIC drivers (for the most part). o Remove powerpc_ign_lookup() and replace it with powerpc_get_irq(). Remove IGN_SHIFT, INTR_INTLINE and INTR_IGN. Related to the above, fix the Freescale PCI controller driver, broken by the FDT code. Besides not attaching properly, bus numbers were assigned improperly and enumeration was broken in general. This prevented the AT PIC from being discovered and interrupt routing to work properly. Consequently, the ata(4) controller stopped functioning. Fix the driver, and FDT PCI support, enough to get the MPC8555CDS going again. The FDT PCI code needs a whole lot more work. No breakages are expected, but lackiong G5 hardware, it's possible that there are unpleasant side-effects. At least MPC85xx support is back to where it was 7 months ago -- it's amazing how badly support can be broken in just 7 months... Sponsored by: Juniper Networks
Notes
Notes: svn path=/head/; revision=218075
Diffstat (limited to 'sys/powerpc/psim')
-rw-r--r--sys/powerpc/psim/openpic_iobus.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/powerpc/psim/openpic_iobus.c b/sys/powerpc/psim/openpic_iobus.c
index 65229854d107..f2e7cdb7c9c2 100644
--- a/sys/powerpc/psim/openpic_iobus.c
+++ b/sys/powerpc/psim/openpic_iobus.c
@@ -62,11 +62,12 @@ __FBSDID("$FreeBSD$");
* PSIM IOBus interface
*/
static int openpic_iobus_probe(device_t);
+static int openpic_iobus_attach(device_t);
static device_method_t openpic_iobus_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, openpic_iobus_probe),
- DEVMETHOD(device_attach, openpic_attach),
+ DEVMETHOD(device_attach, openpic_iobus_attach),
/* PIC interface */
DEVMETHOD(pic_config, openpic_config),
@@ -109,3 +110,10 @@ openpic_iobus_probe(device_t dev)
return (0);
}
+
+static int
+openpic_iobus_attach(device_t dev)
+{
+
+ return (openpic_common_attach(dev, 0));
+}