summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/mambo
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2011-01-29 20:58:38 +0000
committermarcel <marcel@FreeBSD.org>2011-01-29 20:58:38 +0000
commitd129fb0e44db1f4eba2f03627ac099e40f08122d (patch)
treefec042adbb304ebfd29a4edbd235c9e905009e06 /sys/powerpc/mambo
parentf9d6eb1e7555188ea1354e0096c8c5ba13fd5676 (diff)
downloadFreeBSD-src-d129fb0e44db1f4eba2f03627ac099e40f08122d.zip
FreeBSD-src-d129fb0e44db1f4eba2f03627ac099e40f08122d.tar.gz
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
Diffstat (limited to 'sys/powerpc/mambo')
-rw-r--r--sys/powerpc/mambo/mambo_openpic.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sys/powerpc/mambo/mambo_openpic.c b/sys/powerpc/mambo/mambo_openpic.c
index 3edb027..883c9d7 100644
--- a/sys/powerpc/mambo/mambo_openpic.c
+++ b/sys/powerpc/mambo/mambo_openpic.c
@@ -56,12 +56,11 @@ __FBSDID("$FreeBSD$");
* Mambo interface
*/
static int openpic_mambo_probe(device_t);
-static uint32_t openpic_mambo_id(device_t dev);
+static int openpic_mambo_attach(device_t);
static int openpicbus_mambo_probe(device_t dev);
static int openpicbus_mambo_attach(device_t dev);
-static struct resource *openpicbus_alloc_resource(device_t bus, device_t dev,
- int type, int *rid, u_long start, u_long end, u_long count,
- u_int flags);
+static struct resource *openpicbus_alloc_resource(device_t bus, device_t dev,
+ int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
static device_method_t openpicbus_mambo_methods[] = {
/* Device interface */
@@ -87,7 +86,7 @@ static driver_t openpicbus_mambo_driver = {
static device_method_t openpic_mambo_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, openpic_mambo_probe),
- DEVMETHOD(device_attach, openpic_attach),
+ DEVMETHOD(device_attach, openpic_mambo_attach),
/* PIC interface */
DEVMETHOD(pic_config, openpic_config),
@@ -97,7 +96,6 @@ static device_method_t openpic_mambo_methods[] = {
DEVMETHOD(pic_ipi, openpic_ipi),
DEVMETHOD(pic_mask, openpic_mask),
DEVMETHOD(pic_unmask, openpic_unmask),
- DEVMETHOD(pic_id, openpic_mambo_id),
{ 0, 0 },
};
@@ -167,14 +165,15 @@ openpicbus_alloc_resource(device_t bus, device_t dev, int type, int *rid,
static int
openpic_mambo_probe(device_t dev)
{
+
device_set_desc(dev, OPENPIC_DEVSTR);
-
return (0);
}
-static uint32_t
-openpic_mambo_id(device_t dev)
+static int
+openpic_mambo_attach(device_t dev)
{
- return (ofw_bus_get_node(device_get_parent(dev)));
+
+ return (openpic_common_attach(dev,
+ ofw_bus_get_node(device_get_parent(dev))));
}
-
OpenPOWER on IntegriCloud