Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Merge in a large batch of changes from Nick Hibm...



details:   https://anonhg.NetBSD.org/src/rev/534133d8e548
branches:  trunk
changeset: 477160:534133d8e548
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Oct 13 08:10:55 1999 +0000

description:
Merge in a large batch of changes from Nick Hibma <hibma%skylink.it@localhost> so
the USB stack compiles on FreeBSD again.

diffstat:

 sys/dev/usb/hid.c        |    4 +-
 sys/dev/usb/ohci.c       |   68 +++++++++++------
 sys/dev/usb/ohcivar.h    |   11 +--
 sys/dev/usb/ugen.c       |   33 ++++----
 sys/dev/usb/uhci.c       |   82 ++++++++++++++-------
 sys/dev/usb/uhcivar.h    |   11 +--
 sys/dev/usb/uhid.c       |   36 +++-----
 sys/dev/usb/uhub.c       |   65 ++++++++++++----
 sys/dev/usb/ukbd.c       |   10 +-
 sys/dev/usb/ulpt.c       |   82 +++++++++++++++++++--
 sys/dev/usb/umass.c      |    9 +-
 sys/dev/usb/ums.c        |   10 +-
 sys/dev/usb/usb.c        |   58 ++++++++++++---
 sys/dev/usb/usb.h        |   47 ++++++++---
 sys/dev/usb/usb_mem.h    |    9 +-
 sys/dev/usb/usb_port.h   |  112 +++++++++++++++++++++++------
 sys/dev/usb/usb_subr.c   |   63 ++++++++++------
 sys/dev/usb/usbdi.c      |  177 +++++++++-------------------------------------
 sys/dev/usb/usbdi.h      |   62 +++++----------
 sys/dev/usb/usbdi_util.c |    6 +-
 20 files changed, 533 insertions(+), 422 deletions(-)

diffs (truncated from 2215 to 300 lines):

diff -r 317022ef6084 -r 534133d8e548 sys/dev/usb/hid.c
--- a/sys/dev/usb/hid.c Wed Oct 13 04:01:06 1999 +0000
+++ b/sys/dev/usb/hid.c Wed Oct 13 08:10:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hid.c,v 1.8 1999/08/14 14:49:31 augustss Exp $ */
+/*     $NetBSD: hid.c,v 1.9 1999/10/13 08:10:55 augustss Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
 
 #include <dev/usb/hid.h>
 
-#ifdef USB_DEBUG
+#ifdef UHID_DEBUG
 #define DPRINTF(x)     if (usbdebug) logprintf x
 #define DPRINTFN(n,x)  if (usbdebug>(n)) logprintf x
 extern int usbdebug;
diff -r 317022ef6084 -r 534133d8e548 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Wed Oct 13 04:01:06 1999 +0000
+++ b/sys/dev/usb/ohci.c        Wed Oct 13 08:10:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.51 1999/10/12 20:02:47 augustss Exp $       */
+/*     $NetBSD: ohci.c,v 1.52 1999/10/13 08:10:55 augustss Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -53,6 +53,8 @@
 #elif defined(__FreeBSD__)
 #include <sys/module.h>
 #include <sys/bus.h>
+#include <machine/bus_pio.h>
+#include <machine/bus_memio.h>
 #endif
 #include <sys/proc.h>
 #include <sys/queue.h>
@@ -72,9 +74,7 @@
 
 #if defined(__FreeBSD__)
 #include <machine/clock.h>
-
 #define delay(d)                DELAY(d)
-
 #endif
 
 #if defined(__OpenBSD__)
@@ -83,6 +83,15 @@
 };
 #endif
 
+#ifdef OHCI_DEBUG
+#define DPRINTF(x)     if (ohcidebug) logprintf x
+#define DPRINTFN(n,x)  if (ohcidebug>(n)) logprintf x
+int ohcidebug = 0;
+#else
+#define DPRINTF(x)
+#define DPRINTFN(n,x)
+#endif
+
 /*
  * The OHCI controller is little endian, so on big endian machines
  * the data strored in memory needs to be swapped.
@@ -177,7 +186,7 @@
 void           ohci_device_clear_toggle __P((usbd_pipe_handle pipe));
 void           ohci_noop __P((usbd_pipe_handle pipe));
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 ohci_softc_t   *thesc;
 void           ohci_dumpregs __P((ohci_softc_t *));
 void           ohci_dump_tds __P((ohci_soft_td_t *));
@@ -620,7 +629,7 @@
                r = USBD_IOERROR;
                goto bad3;
        }
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
        thesc = sc;
        if (ohcidebug > 15)
                ohci_dumpregs(sc);
@@ -656,7 +665,7 @@
 
        sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A));
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
        if (ohcidebug > 5)
                ohci_dumpregs(sc);
 #endif
@@ -684,7 +693,9 @@
        usb_dma_t *dma;
        u_int32_t size;
 {
+#if defined(__NetBSD__) || defined(__OpenBSD__)
        struct ohci_softc *sc = (struct ohci_softc *)bus;
+#endif
 
        return (usb_allocmem(&sc->sc_bus, size, 0, dma));
 }
@@ -694,18 +705,20 @@
        struct usbd_bus *bus;
        usb_dma_t *dma;
 {
+#if defined(__NetBSD__) || defined(__OpenBSD__)
        struct ohci_softc *sc = (struct ohci_softc *)bus;
+#endif
 
        usb_freemem(&sc->sc_bus, dma);
 }
 
-#if !defined(__OpenBSD__)
+#if defined(__NetBSD__)
 void
 ohci_power(why, v)
        int why;
        void *v;
 {
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
        ohci_softc_t *sc = v;
 
        DPRINTF(("ohci_power: sc=%p, why=%d\n", sc, why));
@@ -713,9 +726,9 @@
        ohci_dumpregs(sc);
 #endif
 }
-#endif /* !defined(__OpenBSD__) */
+#endif /* defined(__NetBSD__) */
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 void ohcidump(void);
 void ohcidump(void) { ohci_dumpregs(thesc); }
 
@@ -854,7 +867,7 @@
        }
 }
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 char *ohci_cc_strs[] = {
        "NO_ERROR",
        "CRC",
@@ -890,7 +903,7 @@
                sdone = std;
        }
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
        if (ohcidebug > 10) {
                DPRINTF(("ohci_process_done: TD done:\n"));
                ohci_dump_tds(sdone);
@@ -1088,7 +1101,7 @@
                usb_delay_ms(&sc->sc_bus, 1);
                intrs = OREAD4(sc, OHCI_INTERRUPT_STATUS) & sc->sc_eintrs;
                DPRINTFN(15,("ohci_waitintr: 0x%04x\n", intrs));
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
                if (ohcidebug > 15)
                        ohci_dumpregs(sc);
 #endif
@@ -1214,7 +1227,7 @@
        stat->len = 0;
        stat->reqh = reqh;
 
-#if USB_DEBUG
+#ifdef OHCI_DEBUG
        if (ohcidebug > 5) {
                DPRINTF(("ohci_device_request:\n"));
                ohci_dump_ed(sed);
@@ -1237,7 +1250,7 @@
        }
        splx(s);
 
-#if USB_DEBUG
+#ifdef OHCI_DEBUG
        if (ohcidebug > 5) {
                delay(5000);
                DPRINTF(("ohci_device_request: status=%x\n",
@@ -1360,7 +1373,7 @@
        splx(s);
 }
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
 void
 ohci_dump_tds(std)
        ohci_soft_td_t *std;
@@ -1398,7 +1411,8 @@
                 (int)LE(sed->ed.ed_flags),
                 "\20\14OUT\15IN\16LOWSPEED\17SKIP\20ISO",
                 (u_long)LE(sed->ed.ed_tailp),
-                (u_long)LE(sed->ed.ed_headp), "\20\1HALT\2CARRY",
+                (u_long)LE(sed->ed.ed_headp),
+                "\20\1HALT\2CARRY",
                 (u_long)LE(sed->ed.ed_nexted)));
 }
 #endif
@@ -1706,7 +1720,7 @@
 {
        ohci_softc_t *sc = (ohci_softc_t *)reqh->pipe->device->bus;
        usb_device_request_t *req;
-       void *buf;
+       void *buf = NULL;
        int port, i;
        int s, len, value, index, l, totlen = 0;
        usb_port_status_t ps;
@@ -1730,10 +1744,6 @@
 
        if (len != 0)
                buf = KERNADDR(&reqh->dmabuf);
-#ifdef DIAGNOSTIC
-       else
-               buf = 0;
-#endif
 
 #define C(x,y) ((x) | ((y) << 8))
        switch(C(req->bRequest, req->bmRequestType)) {
@@ -2219,7 +2229,7 @@
                    (int)LE(sed->ed.ed_flags), (int)LE(data->td.td_flags),
                    (int)LE(data->td.td_cbp), (int)LE(data->td.td_be)));
 
-#ifdef USB_DEBUG
+#ifdef OHCI_DEBUG
        if (ohcidebug > 4) {
                ohci_dump_ed(sed);
                ohci_dump_tds(data);
@@ -2241,7 +2251,8 @@
                            MS_TO_TICKS(reqh->timeout), reqh->timo_handle);
        }
 
-#ifdef USB_DEBUG
+#if 0
+/* This goes wrong if we are too slow. */
        if (ohcidebug > 5) {
                delay(5000);
                DPRINTF(("ohci_device_intr_transfer: status=%x\n",
@@ -2337,7 +2348,7 @@
        data->flags = OHCI_CALL_DONE | OHCI_ADD_LEN;
        reqh->hcpriv = data;
 
-#if USB_DEBUG
+#ifdef OHCI_DEBUG
        if (ohcidebug > 5) {
                DPRINTF(("ohci_device_intr_transfer:\n"));
                ohci_dump_ed(sed);
@@ -2352,7 +2363,12 @@
        opipe->tail = tail;
        sed->ed.ed_flags &= LE(~OHCI_ED_SKIP);
 
-#ifdef USB_DEBUG
+#if 0
+/*
+ * This goes horribly wrong, printing thousands of descriptors,
+ * because false references are followed due to the fact that the
+ * TD is gone.
+ */
        if (ohcidebug > 5) {
                delay(5000);
                DPRINTF(("ohci_device_intr_transfer: status=%x\n",
diff -r 317022ef6084 -r 534133d8e548 sys/dev/usb/ohcivar.h
--- a/sys/dev/usb/ohcivar.h     Wed Oct 13 04:01:06 1999 +0000
+++ b/sys/dev/usb/ohcivar.h     Wed Oct 13 08:10:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohcivar.h,v 1.12 1999/10/12 11:21:26 augustss Exp $    */
+/*     $NetBSD: ohcivar.h,v 1.13 1999/10/13 08:10:55 augustss Exp $    */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -102,12 +102,3 @@
 int            ohci_activate __P((device_ptr_t, enum devact));
 
 #define MS_TO_TICKS(ms) ((ms) * hz / 1000)
-
-#ifdef USB_DEBUG
-#define DPRINTF(x)     if (ohcidebug) printf x
-#define DPRINTFN(n,x)  if (ohcidebug>(n)) printf x
-extern int ohcidebug;
-#else
-#define DPRINTF(x)
-#define DPRINTFN(n,x)
-#endif
diff -r 317022ef6084 -r 534133d8e548 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Wed Oct 13 04:01:06 1999 +0000
+++ b/sys/dev/usb/ugen.c        Wed Oct 13 08:10:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.24 1999/10/12 11:54:56 augustss Exp $       */
+/*     $NetBSD: ugen.c,v 1.25 1999/10/13 08:10:55 augustss Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 #include <dev/usb/usbdi.h>
 #include <dev/usb/usbdi_util.h>
 
-#ifdef USB_DEBUG
+#ifdef UGEN_DEBUG
 #define DPRINTF(x)     if (ugendebug) logprintf x
 #define DPRINTFN(n,x)  if (ugendebug>(n)) logprintf x
 int    ugendebug = 0;



Home | Main Index | Thread Index | Old Index