Index: adb_bus.c =================================================================== --- adb_bus.c (revision 184438) +++ adb_bus.c (working copy) @@ -44,6 +44,7 @@ static int adb_bus_probe(device_t dev); static int adb_bus_attach(device_t dev); static int adb_bus_detach(device_t dev); +static void adb_bus_enumerate(void *xdev); static void adb_probe_nomatch(device_t dev, device_t child); static int adb_print_child(device_t dev, device_t child); @@ -88,6 +89,27 @@ adb_bus_attach(device_t dev) { struct adb_softc *sc = device_get_softc(dev); + sc->enum_hook.ich_func = adb_bus_enumerate; + sc->enum_hook.ich_arg = dev; + + /* + * We should wait until interrupts are enabled to try to probe + * the bus. Enumerating the ADB involves receiving packets, + * which works best with interrupts enabled. + */ + + if (config_intrhook_establish(&sc->enum_hook) != 0) + return (ENOMEM); + + return (0); +} + +static void +adb_bus_enumerate(void *xdev) +{ + device_t dev = (device_t)xdev; + + struct adb_softc *sc = device_get_softc(dev); uint8_t i, next_free; uint16_t r3; @@ -165,7 +187,9 @@ } } - return (bus_generic_attach(dev)); + bus_generic_attach(dev); + + config_intrhook_disestablish(&sc->enum_hook); } static int adb_bus_detach(device_t dev) Index: adbvar.h =================================================================== --- adbvar.h (revision 184438) +++ adbvar.h (working copy) @@ -37,16 +37,15 @@ struct adb_softc { device_t sc_dev; - device_t parent; + struct intr_config_hook enum_hook; struct mtx sc_sync_mtx; volatile int sync_packet; volatile int packet_reply; uint16_t autopoll_mask; - uint8_t syncreg[8]; device_t children[16];