summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2004-01-13 11:25:40 +0000
committergrehan <grehan@FreeBSD.org>2004-01-13 11:25:40 +0000
commiteb45b910dfa5ae6f9b796caedaec6f2ecfab86d5 (patch)
treee2e71a12355237a7b59b4b16097fef2ca40a1c18
parentf31f435513a72bd9462d2c1602f1a1f023f17497 (diff)
downloadFreeBSD-src-eb45b910dfa5ae6f9b796caedaec6f2ecfab86d5.zip
FreeBSD-src-eb45b910dfa5ae6f9b796caedaec6f2ecfab86d5.tar.gz
Use a device identify entry point to attach to nexus, since the
nexus code no longer searches for interrupt controllers.
-rw-r--r--sys/powerpc/powermac/hrowpic.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/sys/powerpc/powermac/hrowpic.c b/sys/powerpc/powermac/hrowpic.c
index ed4b9c2..f98adfe 100644
--- a/sys/powerpc/powermac/hrowpic.c
+++ b/sys/powerpc/powermac/hrowpic.c
@@ -68,6 +68,7 @@
/*
* Device interface.
*/
+static void hrowpic_identify(driver_t *, device_t);
static int hrowpic_probe(device_t);
static int hrowpic_attach(device_t);
@@ -108,6 +109,7 @@ static struct hrowpic_softc *hpicsoftc;
*/
static device_method_t hrowpic_methods[] = {
/* Device interface */
+ DEVMETHOD(device_identify, hrowpic_identify),
DEVMETHOD(device_probe, hrowpic_probe),
DEVMETHOD(device_attach, hrowpic_attach),
@@ -130,21 +132,36 @@ static devclass_t hrowpic_devclass;
DRIVER_MODULE(hrowpic, nexus, hrowpic_driver, hrowpic_devclass, 0, 0);
+static void
+hrowpic_identify(driver_t *driver, device_t parent)
+{
+ phandle_t chosen, pic;
+ char type[40];
+
+ chosen = OF_finddevice("/chosen");
+ if (chosen == -1)
+ return;
+
+ if (OF_getprop(chosen, "interrupt-controller", &pic, 4) != 4)
+ return;
+
+ OF_getprop(pic, "compatible", type, sizeof(type));
+ if (strcmp(type, "heathrow"))
+ return;
+
+ BUS_ADD_CHILD(parent, 0, "hrowpic", 0);
+}
+
static int
hrowpic_probe(device_t dev)
{
- char *type, *compatible;
-
- type = nexus_get_device_type(dev);
- compatible = nexus_get_compatible(dev);
+ char *name;
- if (strcmp(type, "interrupt-controller"))
- return (ENXIO);
+ name = nexus_get_name(dev);
- if (strcmp(compatible, "heathrow")) {
+ if (strcmp(name, "hrowpic"))
return (ENXIO);
- }
-
+
device_set_desc(dev, "Heathrow interrupt controller");
return (0);
}
@@ -165,6 +182,7 @@ hrowpic_attach(device_t dev)
return (ENXIO);
}
+ nexus_install_intcntlr(dev);
intr_init(hrowpic_intr, HROWPIC_IRQMAX, hrowpic_ext_enable_irq,
hrowpic_ext_disable_irq);
OpenPOWER on IntegriCloud