diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2001-09-25 16:13:40 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2001-09-25 16:13:40 +0000 |
commit | 0db29bd86e91130f8d2ed2f9d277756e08902963 (patch) | |
tree | f804bd1e80d6bbbb590e86913990d03b62d69ce1 /sys/dev | |
parent | b354d45b5706773be16c9e4f8c3cfcabfc8576fe (diff) |
Change to umass to not attach immediately if the system is still 'cold'.
Accessing the device via polling would cause a crash in the usb subsystem.
this change delays the media configuration using startuphooks, when
the system is fully up and running. This allows it to configure properly
and on macppc it is possible to use a umass device as root device.
Has little effect on other system, because they do not force USB configuration
during 'cold'. Tested by myself and brad@.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/umass.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 4f64a171dd6..6341db4d916 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass.c,v 1.11 2001/05/24 06:21:44 csapuntz Exp $ */ +/* $OpenBSD: umass.c,v 1.12 2001/09/25 16:13:39 drahn Exp $ */ /* $NetBSD: umass.c,v 1.49 2001/01/21 18:56:38 augustss Exp $ */ /*- * Copyright (c) 1999 MAEKAWA Masahide <bishop@rr.iij4u.or.jp>, @@ -867,6 +867,8 @@ USB_MATCH(umass) return (umass_match_proto(sc, uaa->iface, uaa->device)); } +void umass_delayed_attach(struct umass_softc *sc); + USB_ATTACH(umass) { USB_ATTACH_START(umass, sc, uaa); @@ -1156,6 +1158,22 @@ USB_ATTACH(umass) USB_ATTACH_ERROR_RETURN; } + if (cold) { + startuphook_establish((void (*)(void *))umass_delayed_attach, + sc); + } else { + /* hot plug, do it now */ + umass_delayed_attach(sc); + } + + DPRINTF(UDMASS_GEN, ("%s: Attach finished\n", USBDEVNAME(sc->sc_dev))); + + USB_ATTACH_SUCCESS_RETURN; +} + +void +umass_delayed_attach(struct umass_softc *sc) +{ sc->sc_child = config_found(&sc->sc_dev, &sc->u, scsipiprint); if (sc->sc_child == NULL) { umass_disco(sc); @@ -1165,10 +1183,6 @@ USB_ATTACH(umass) usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); - - DPRINTF(UDMASS_GEN, ("%s: Attach finished\n", USBDEVNAME(sc->sc_dev))); - - USB_ATTACH_SUCCESS_RETURN; } Static int |