Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Change the test for cold boot slightly to avoid ...



details:   https://anonhg.NetBSD.org/src/rev/3f9f1aa0025d
branches:  trunk
changeset: 484100:3f9f1aa0025d
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sat Mar 25 17:59:34 2000 +0000

description:
Change the test for cold boot slightly to avoid a long busy wait with UHCI.

diffstat:

 sys/dev/usb/if_kue.c |  26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r a22dbc252c85 -r 3f9f1aa0025d sys/dev/usb/if_kue.c
--- a/sys/dev/usb/if_kue.c      Sat Mar 25 17:30:00 2000 +0000
+++ b/sys/dev/usb/if_kue.c      Sat Mar 25 17:59:34 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_kue.c,v 1.21 2000/03/24 22:03:30 augustss Exp $     */
+/*     $NetBSD: if_kue.c,v 1.22 2000/03/25 17:59:34 augustss Exp $     */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -198,6 +198,7 @@
 static usbd_status kue_ctl     __P((struct kue_softc *, int, u_int8_t,
                                    u_int16_t, void *, u_int32_t));
 static usbd_status kue_setword __P((struct kue_softc *, u_int8_t, u_int16_t));
+static int kue_is_warm         __P((struct kue_softc *));
 static int kue_load_fw         __P((struct kue_softc *));
 
 #if defined(__FreeBSD__)
@@ -295,6 +296,25 @@
 }
 
 static int
+kue_is_warm(sc)
+       struct kue_softc        *sc;
+{
+       usbd_status             err;
+       usb_device_request_t    req;
+
+       /* Just issue some random command. */
+       req.bmRequestType = UT_READ_VENDOR_DEVICE;
+       req.bRequest = KUE_CMD_GET_ETHER_DESCRIPTOR;
+       USETW(req.wValue, 0);
+       USETW(req.wIndex, 0);
+       USETW(req.wLength, sizeof(sc->kue_desc));
+
+       err = usbd_do_request(sc->kue_udev, &req, &sc->kue_desc);
+
+       return (!err);
+}
+
+static int
 kue_load_fw(sc)
        struct kue_softc        *sc;
 {
@@ -314,9 +334,7 @@
         * We can test this quickly by issuing a request that
         * is only valid after firmware download.
         */
-       err = kue_ctl(sc, KUE_CTL_READ, KUE_CMD_GET_ETHER_DESCRIPTOR,
-           0, &sc->kue_desc, sizeof(sc->kue_desc));
-       if (!err) {
+       if (kue_is_warm(sc)) {
                printf("%s: warm boot, no firmware download\n",
                       USBDEVNAME(sc->kue_dev));
                return (0);



Home | Main Index | Thread Index | Old Index