Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Get rid of a bunch of code that was part of an o...



details:   https://anonhg.NetBSD.org/src/rev/f32950749306
branches:  trunk
changeset: 473677:f32950749306
user:      augustss <augustss%NetBSD.org@localhost>
date:      Mon Jun 14 17:09:57 1999 +0000

description:
Get rid of a bunch of code that was part of an old USBDI proposal, but that
is unused in our USB stack.

Once upon a time, when I started writing the USB stack for NetBSD, there
was an effort to make a standard for how USB device drivers should interact
with the rest of the USB stack.  This effort had contributors from just
about all Un*x camps (but not Micro$oft :).  I based my design on one of their
early proposals since I thought it would be a good idea if we could all
share device drivers with a minimum effort.  Shortly after I started my work
all the free Un*x people were thrown out of the USBDI work since we did not
pay the USB membership fee.  Well, some time has passed now and the work of
the standardization group is almost public again.  But alas, the new standard
has grown to be a monster!  I do not want to have this as the basis for the
*BSD USB stack; it is far too complicated.
So, since we are not even close to being compilant with the standard, I've
thrown out some old baggage.

diffstat:

 sys/dev/usb/ukbd.c       |    8 +-
 sys/dev/usb/usb_quirks.c |    3 +-
 sys/dev/usb/usb_quirks.h |    5 +-
 sys/dev/usb/usb_subr.c   |   46 +----
 sys/dev/usb/usbdi.c      |  380 +----------------------------------------------
 sys/dev/usb/usbdi.h      |   88 +----------
 sys/dev/usb/usbdivar.h   |    8 +-
 7 files changed, 21 insertions(+), 517 deletions(-)

diffs (truncated from 904 to 300 lines):

diff -r 76839a98b33c -r f32950749306 sys/dev/usb/ukbd.c
--- a/sys/dev/usb/ukbd.c        Mon Jun 14 16:59:47 1999 +0000
+++ b/sys/dev/usb/ukbd.c        Mon Jun 14 17:09:57 1999 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.34 1999/06/11 19:05:13 wrstuden Exp $        */
+/*      $NetBSD: ukbd.c,v 1.35 1999/06/14 17:09:57 augustss Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -684,11 +684,11 @@
        int *data;
 {
        struct ukbd_softc *sc = v;
-       usbd_lock_token s;
+       int s;
        int c;
 
        DPRINTFN(-1,("ukbd_cngetc: enter\n"));
-       s = usbd_lock();
+       s = splusb();
        sc->sc_polling = 1;
        while(sc->sc_npollchar <= 0)
                usbd_dopoll(sc->sc_iface);
@@ -699,7 +699,7 @@
               sc->sc_npollchar * sizeof(u_int16_t));
        *type = c & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
        *data = c & CODEMASK;
-       usbd_unlock(s);
+       splx(s);
        DPRINTFN(-1,("ukbd_cngetc: return 0x%02x\n", c));
 }
 
diff -r 76839a98b33c -r f32950749306 sys/dev/usb/usb_quirks.c
--- a/sys/dev/usb/usb_quirks.c  Mon Jun 14 16:59:47 1999 +0000
+++ b/sys/dev/usb/usb_quirks.c  Mon Jun 14 17:09:57 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_quirks.c,v 1.9 1999/05/20 09:51:13 augustss Exp $  */
+/*     $NetBSD: usb_quirks.c,v 1.10 1999/06/14 17:09:57 augustss Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,6 @@
  { USB_VENDOR_GENIUS, USB_PRODUCT_GENIUS_NICHE,     0x100, { UQ_NO_SET_PROTO}},
  { USB_VENDOR_INSIDEOUT,USB_PRODUCT_INSIDEOUT_EDGEPORT4, 
                                                    0x094, { UQ_SWAP_UNICODE}},
- { USB_VENDOR_TI, USB_PRODUCT_TI_UTUSB41,          0x100, { UQ_HUB_POWER }},
  { USB_VENDOR_BTC, USB_PRODUCT_BTC_BTC7932,        0x100, { UQ_NO_STRINGS }},
  { USB_VENDOR_ADS, USB_PRODUCT_ADS_ENET,           0x002, { UQ_NO_STRINGS }},
  { USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1, 0x101, { UQ_NO_STRINGS }},
diff -r 76839a98b33c -r f32950749306 sys/dev/usb/usb_quirks.h
--- a/sys/dev/usb/usb_quirks.h  Mon Jun 14 16:59:47 1999 +0000
+++ b/sys/dev/usb/usb_quirks.h  Mon Jun 14 17:09:57 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_quirks.h,v 1.5 1998/12/29 15:23:59 augustss Exp $  */
+/*     $NetBSD: usb_quirks.h,v 1.6 1999/06/14 17:09:57 augustss Exp $  */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -41,8 +41,7 @@
        u_int32_t uq_flags;     /* Device problems: */
 #define UQ_NO_SET_PROTO        0x01    /* cannot handle SET PROTOCOL. */
 #define UQ_SWAP_UNICODE        0x02    /* has some Unicode strings swapped. */
-#define UQ_HUB_POWER   0x04    /* does not respond correctly to get
-                                  device status; use get hub status. */
+/*#define UQ_          0x04 */
 #define UQ_NO_STRINGS  0x08    /* string descriptors are broken. */
 #define UQ_BAD_ADC     0x10    /* bad audio spec version number. */
 };
diff -r 76839a98b33c -r f32950749306 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Mon Jun 14 16:59:47 1999 +0000
+++ b/sys/dev/usb/usb_subr.c    Mon Jun 14 17:09:57 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.32 1999/05/16 13:51:05 augustss Exp $   */
+/*     $NetBSD: usb_subr.c,v 1.33 1999/06/14 17:09:57 augustss Exp $   */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -110,12 +110,10 @@
        "PENDING_REQUESTS",
        "NOT_STARTED",
        "INVAL",
-       "IS_IDLE",
        "NOMEM",
        "CANCELLED",
        "BAD_ADDRESS",
        "IN_USE",
-       "INTERFACE_NOT_ACTIVE",
        "NO_ADDR",
        "SET_ADDR_FAILED",
        "NO_POWER",
@@ -125,6 +123,7 @@
        "TIMEOUT",
        "SHORT_XFER",
        "STALLED",
+       "INTERRUPTED",
        "XXX",
 };
 #endif
@@ -459,14 +458,12 @@
                goto bad;
        found:
                ifc->endpoints[endpt].edesc = ed;
-               ifc->endpoints[endpt].state = USBD_ENDPOINT_ACTIVE;
                ifc->endpoints[endpt].refcnt = 0;
                ifc->endpoints[endpt].toggle = 0;
                p += ed->bLength;
        }
 #undef ed
        LIST_INIT(&ifc->pipes);
-       ifc->state = USBD_INTERFACE_ACTIVE;
        return (USBD_NORMAL_COMPLETION);
 
  bad:
@@ -528,7 +525,6 @@
        int msg;
 {
        usb_status_t ds;
-       usb_hub_status_t hs;
        usb_config_descriptor_t cd, *cdp;
        usbd_status r;
        int ifcidx, nifc, len, selfpowered, power;
@@ -547,7 +543,6 @@
                dev->ifaces = 0;
                dev->cdesc = 0;
                dev->config = 0;
-               dev->state = USBD_DEVICE_ADDRESSED;
        }
 
        /* Figure out what config number to use. */
@@ -572,18 +567,10 @@
                /* May be self powered. */
                if (cdp->bmAttributes & UC_BUS_POWERED) {
                        /* Must ask device. */
-                       if (dev->quirks->uq_flags & UQ_HUB_POWER) {
-                               /* Buggy hub, use hub descriptor. */
-                               r = usbd_get_hub_status(dev, &hs);
-                               if (r == USBD_NORMAL_COMPLETION && 
-                                   !(UGETW(hs.wHubStatus) & UHS_LOCAL_POWER))
-                                       selfpowered = 1;
-                       } else {
-                               r = usbd_get_device_status(dev, &ds);
-                               if (r == USBD_NORMAL_COMPLETION && 
-                                   (UGETW(ds.wStatus) & UDS_SELF_POWERED))
-                                       selfpowered = 1;
-                       }
+                       r = usbd_get_device_status(dev, &ds);
+                       if (r == USBD_NORMAL_COMPLETION && 
+                           (UGETW(ds.wStatus) & UDS_SELF_POWERED))
+                               selfpowered = 1;
                        DPRINTF(("usbd_set_config_index: status=0x%04x, "
                                 "error=%d(%s)\n",
                                 UGETW(ds.wStatus), r, usbd_error_strs[r]));
@@ -591,10 +578,9 @@
                        selfpowered = 1;
        }
        DPRINTF(("usbd_set_config_index: (addr %d) attr=0x%02x, "
-                "selfpowered=%d, power=%d, powerquirk=%x\n", 
+                "selfpowered=%d, power=%d\n", 
                 dev->address, cdp->bmAttributes, 
-                selfpowered, cdp->bMaxPower * 2,
-                dev->quirks->uq_flags & UQ_HUB_POWER));
+                selfpowered, cdp->bMaxPower * 2));
 #ifdef USB_DEBUG
        if (!dev->powersrc) {
                printf("usbd_set_config_index: No power source?\n");
@@ -637,7 +623,6 @@
        DPRINTFN(5,("usbd_set_config_index: dev=%p cdesc=%p\n", dev, cdp));
        dev->cdesc = cdp;
        dev->config = cdp->bConfigurationValue;
-       dev->state = USBD_DEVICE_CONFIGURED;
        for (ifcidx = 0; ifcidx < nifc; ifcidx++) {
                r = usbd_fill_iface_data(dev, ifcidx, 0);
                if (r != USBD_NORMAL_COMPLETION) {
@@ -673,7 +658,6 @@
                return (USBD_NOMEM);
        p->device = dev;
        p->iface = iface;
-       p->state = USBD_PIPE_ACTIVE;
        p->endpoint = ep;
        ep->refcnt++;
        p->refcnt = 1;
@@ -873,7 +857,6 @@
 
        /* Set up default endpoint handle. */
        dev->def_ep.edesc = &dev->def_ep_desc;
-       dev->def_ep.state = USBD_ENDPOINT_ACTIVE;
 
        /* Set up default endpoint descriptor. */
        dev->def_ep_desc.bLength = USB_ENDPOINT_DESCRIPTOR_SIZE;
@@ -883,7 +866,6 @@
        USETW(dev->def_ep_desc.wMaxPacketSize, USB_MAX_IPACKET);
        dev->def_ep_desc.bInterval = 0;
 
-       dev->state = USBD_DEVICE_DEFAULT;
        dev->quirks = &usbd_no_quirk;
        dev->address = USB_START_ADDR;
        dev->ddesc.bMaxPacketSize = 0;
@@ -956,7 +938,6 @@
        usbd_delay_ms(dev, USB_SET_ADDRESS_SETTLE);
 
        dev->address = addr;    /* New device address now */
-       dev->state = USBD_DEVICE_ADDRESSED;
        bus->devices[addr] = dev;
 
        /* Assume 100mA bus powered for now. Changed when configured. */
@@ -1073,15 +1054,8 @@
        usbd_request_handle reqh;
 {
        usbd_pipe_handle pipe = reqh->pipe;
-       usbd_interface_handle iface = pipe->iface;
 
-       if (pipe->state == USBD_PIPE_IDLE ||
-           (iface && iface->state == USBD_INTERFACE_IDLE))
-               return (USBD_IS_IDLE);
        SIMPLEQ_INSERT_TAIL(&pipe->queue, reqh, next);
-       if (pipe->state != USBD_PIPE_ACTIVE ||
-           (iface && iface->state != USBD_INTERFACE_ACTIVE))
-               return (USBD_NOT_STARTED);
        if (pipe->running)
                return (USBD_IN_PROGRESS);
        pipe->running = 1;
@@ -1114,10 +1088,6 @@
 
        /* First remove remove old */
        SIMPLEQ_REMOVE_HEAD(&pipe->queue, SIMPLEQ_FIRST(&pipe->queue), next);
-       if (pipe->state != USBD_PIPE_ACTIVE) {
-               pipe->running = 0;
-               return;
-       }
        reqh = SIMPLEQ_FIRST(&pipe->queue);
        DPRINTFN(5, ("usb_start_next: start reqh=%p\n", reqh));
        if (!reqh)
diff -r 76839a98b33c -r f32950749306 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Mon Jun 14 16:59:47 1999 +0000
+++ b/sys/dev/usb/usbdi.c       Mon Jun 14 17:09:57 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.23 1999/05/13 23:29:41 augustss Exp $      */
+/*     $NetBSD: usbdi.c,v 1.24 1999/06/14 17:09:58 augustss Exp $      */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -70,7 +70,6 @@
 #endif
 
 static usbd_status usbd_ar_pipe  __P((usbd_pipe_handle pipe));
-static usbd_status usbd_ar_iface __P((usbd_interface_handle iface));
 static void usbd_transfer_cb __P((usbd_request_handle reqh));
 static void usbd_sync_transfer_cb __P((usbd_request_handle reqh));
 static usbd_status usbd_do_transfer __P((usbd_request_handle reqh));
@@ -97,8 +96,6 @@
        usbd_status r;
        int i;
 
-       if (iface->state != USBD_INTERFACE_ACTIVE)
-               return (USBD_INTERFACE_NOT_ACTIVE);
        for (i = 0; i < iface->idesc->bNumEndpoints; i++) {
                ep = &iface->endpoints[i];
                if (ep->edesc->bEndpointAddress == address)
@@ -192,8 +189,6 @@
 usbd_close_pipe(pipe)
        usbd_pipe_handle pipe;
 {
-       if (pipe->iface->state != USBD_INTERFACE_ACTIVE)
-               return (USBD_INTERFACE_NOT_ACTIVE);
        if (--pipe->refcnt != 0)
                return (USBD_NORMAL_COMPLETION);
        if (SIMPLEQ_FIRST(&pipe->queue) != 0)
@@ -278,16 +273,6 @@
 }
 
 usbd_status 
-usbd_setup_device_request(reqh, req)
-       usbd_request_handle reqh;
-       usb_device_request_t *req;
-{
-       reqh->isreq = 1;
-       reqh->request = *req;
-       return (USBD_NORMAL_COMPLETION);
-}
-
-usbd_status 
 usbd_setup_default_request(reqh, dev, priv, timeout, req, buffer, 
                           length, flags, callback)
        usbd_request_handle reqh;
@@ -318,15 +303,6 @@
 }
 
 usbd_status 
-usbd_set_request_timeout(reqh, timeout)
-       usbd_request_handle reqh;
-       u_int32_t timeout;
-{
-       reqh->timeout = timeout;
-       return (USBD_NORMAL_COMPLETION);
-}
-
-usbd_status 
 usbd_get_request_status(reqh, priv, buffer, count, status)
        usbd_request_handle reqh;
        usbd_private_handle *priv;



Home | Main Index | Thread Index | Old Index