Index: sys/powerpc/powermac/smu.c =================================================================== --- sys/powerpc/powermac/smu.c +++ sys/powerpc/powermac/smu.c @@ -278,22 +278,14 @@ sc->sc_cmd_phys = segs[0].ds_addr; } -static int -smu_attach(device_t dev) +static void +smu_intrhook(void *xsc) { - struct smu_softc *sc; + struct smu_softc *sc = xsc; phandle_t node, child; uint8_t data[12]; - sc = device_get_softc(dev); - - mtx_init(&sc->sc_mtx, "smu", NULL, MTX_DEF); - sc->sc_cur_cmd = NULL; - sc->sc_doorbellirqid = -1; - - sc->sc_u3 = 0; - if (OF_finddevice("/u3") != -1) - sc->sc_u3 = 1; + KASSERT(smu_doorbell != NULL, "SMC Dooorbell missing"); /* * Map the mailbox area. This should be determined from firmware, @@ -405,6 +397,26 @@ return (bus_generic_attach(dev)); } +static int +smu_attach(device_t dev) +{ + struct smu_softc *sc; + + sc = device_get_softc(dev); + + mtx_init(&sc->sc_mtx, "smu", NULL, MTX_DEF); + sc->sc_cur_cmd = NULL; + sc->sc_doorbellirqid = -1; + + sc->sc_u3 = 0; + if (OF_finddevice("/u3") != -1) + sc->sc_u3 = 1; + + /* Defer everything else until we have interrupts and the doorbell device */ + config_intrhook_oneshot(smc_intrhook, sc); + return (0); +} + static const struct ofw_bus_devinfo * smu_get_devinfo(device_t bus, device_t dev) {