Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Expand <dev/usb/usb_port.h> definitions, and lig...
details: https://anonhg.NetBSD.org/src/rev/a2d3cb9fd7bd
branches: trunk
changeset: 747168:a2d3cb9fd7bd
user: dyoung <dyoung%NetBSD.org@localhost>
date: Fri Sep 04 17:53:12 2009 +0000
description:
Expand <dev/usb/usb_port.h> definitions, and lightly unifdef(1).
diffstat:
sys/dev/usb/ehci.c | 43 +++++-----
sys/dev/usb/ehcivar.h | 10 +-
sys/dev/usb/if_atu.c | 51 ++++++++-----
sys/dev/usb/if_atureg.h | 4 +-
sys/dev/usb/if_aue.c | 182 ++++++++++++++++++++++++----------------------
sys/dev/usb/if_auereg.h | 6 +-
sys/dev/usb/if_axe.c | 116 ++++++++++++++++-------------
sys/dev/usb/if_axereg.h | 21 +----
sys/dev/usb/if_cdce.c | 83 ++++++++++++---------
sys/dev/usb/if_cdcereg.h | 4 +-
sys/dev/usb/if_cuereg.h | 11 +--
sys/dev/usb/usbdi.h | 4 +-
sys/dev/usb/usbdi_util.h | 10 +-
sys/dev/usb/usbdivar.h | 20 +++--
14 files changed, 292 insertions(+), 273 deletions(-)
diffs (truncated from 1884 to 300 lines):
diff -r f9c222a6a26b -r a2d3cb9fd7bd sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Fri Sep 04 17:46:06 2009 +0000
+++ b/sys/dev/usb/ehci.c Fri Sep 04 17:53:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.158 2009/07/27 14:41:19 sketch Exp $ */
+/* $NetBSD: ehci.c,v 1.159 2009/09/04 17:55:03 dyoung Exp $ */
/*
* Copyright (c) 2004-2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.158 2009/07/27 14:41:19 sketch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.159 2009/09/04 17:55:03 dyoung Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -84,9 +84,6 @@
#define DPRINTF(x) do { if (ehcidebug) printf x; } while(0)
#define DPRINTFN(n,x) do { if (ehcidebug>(n)) printf x; } while (0)
int ehcidebug = 0;
-#ifndef __NetBSD__
-#define snprintb((q), (f), "%b", q,f,b,l) snprintf((b), (l))
-#endif
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
@@ -510,7 +507,7 @@
sc->sc_async_head = sqh;
EOWRITE4(sc, EHCI_ASYNCLISTADDR, sqh->physaddr | EHCI_LINK_QH);
- usb_callout_init(sc->sc_tmo_intrlist);
+ callout_init(&(sc->sc_tmo_intrlist), 0);
mutex_init(&sc->sc_doorbell_lock, MUTEX_DEFAULT, IPL_NONE);
@@ -694,8 +691,8 @@
/* Schedule a callout to catch any dropped transactions. */
if ((sc->sc_flags & EHCIF_DROPPED_INTR_WORKAROUND) &&
!TAILQ_EMPTY(&sc->sc_intrhead))
- usb_callout(sc->sc_tmo_intrlist, hz,
- ehci_intrlist_timeout, sc);
+ callout_reset(&(sc->sc_tmo_intrlist),
+ (hz), (ehci_intrlist_timeout), (sc));
#ifdef USB_USE_SOFTINTR
if (sc->sc_softwake) {
@@ -781,7 +778,7 @@
}
done:
DPRINTFN(12, ("ehci_check_intr: ex=%p done\n", ex));
- usb_uncallout(ex->xfer.timeout_handle, ehci_timeout, ex);
+ callout_stop(&(ex->xfer.timeout_handle));
ehci_idone(ex);
}
@@ -828,7 +825,7 @@
return;
done:
DPRINTFN(12, ("ehci_check_itd_intr: ex=%p done\n", ex));
- usb_uncallout(ex->xfer.timeout_handle, ehci_timeout, ex);
+ callout_stop(&(ex->xfer.timeout_handle));
ehci_idone(ex);
}
@@ -1087,7 +1084,7 @@
if (rv != 0)
return (rv);
- usb_uncallout(sc->sc_tmo_intrlist, ehci_intrlist_timeout, sc);
+ callout_stop(&(sc->sc_tmo_intrlist));
usb_delay_ms(&sc->sc_bus, 300); /* XXX let stray task complete */
@@ -2866,7 +2863,7 @@
/* If we're dying, just do the software part. */
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+ callout_stop(&(xfer->timeout_handle));
usb_transfer_complete(xfer);
splx(s);
return;
@@ -2900,7 +2897,7 @@
*/
s = splusb();
xfer->status = status; /* make software ignore it */
- usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+ callout_stop(&(xfer->timeout_handle));
usb_syncmem(&sqh->dma,
sqh->offs + offsetof(ehci_qh_t, qh_qtd.qtd_status),
@@ -3016,7 +3013,7 @@
if (sc->sc_dying) {
s = splusb();
xfer->status = status;
- usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+ callout_stop(&(xfer->timeout_handle));
usb_transfer_complete(xfer);
splx(s);
return;
@@ -3040,7 +3037,7 @@
xfer->hcflags |= UXFER_ABORTING;
xfer->status = status;
- usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+ callout_stop(&(xfer->timeout_handle));
s = splusb();
for (itd = exfer->itdstart; itd != NULL; itd = itd->xfer_next) {
@@ -3342,8 +3339,8 @@
s = splusb();
ehci_set_qh_qtd(sqh, setup); /* also does usb_syncmem(sqh) */
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, mstohz(xfer->timeout),
- ehci_timeout, xfer);
+ callout_reset(&(xfer->timeout_handle), (mstohz(xfer->timeout)),
+ (ehci_timeout), (xfer));
}
mutex_enter(&sc->sc_intrhead_lock);
ehci_add_intr_list(sc, exfer);
@@ -3477,8 +3474,8 @@
s = splusb();
ehci_set_qh_qtd(sqh, data); /* also does usb_syncmem(sqh) */
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, mstohz(xfer->timeout),
- ehci_timeout, xfer);
+ callout_reset(&(xfer->timeout_handle), (mstohz(xfer->timeout)),
+ (ehci_timeout), (xfer));
}
mutex_enter(&sc->sc_intrhead_lock);
ehci_add_intr_list(sc, exfer);
@@ -3655,8 +3652,8 @@
s = splusb();
ehci_set_qh_qtd(sqh, data); /* also does usb_syncmem(sqh) */
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle, mstohz(xfer->timeout),
- ehci_timeout, xfer);
+ callout_reset(&(xfer->timeout_handle), (mstohz(xfer->timeout)),
+ (ehci_timeout), (xfer));
}
mutex_enter(&sc->sc_intrhead_lock);
ehci_add_intr_list(sc, exfer);
@@ -3760,8 +3757,8 @@
s = splusb();
ehci_set_qh_qtd(sqh, data); /* also does usb_syncmem(sqh) */
if (xfer->timeout && !sc->sc_bus.use_polling) {
- usb_callout(xfer->timeout_handle,
- mstohz(xfer->timeout), ehci_timeout, xfer);
+ callout_reset(&(xfer->timeout_handle),
+ (mstohz(xfer->timeout)), (ehci_timeout), (xfer));
}
splx(s);
diff -r f9c222a6a26b -r a2d3cb9fd7bd sys/dev/usb/ehcivar.h
--- a/sys/dev/usb/ehcivar.h Fri Sep 04 17:46:06 2009 +0000
+++ b/sys/dev/usb/ehcivar.h Fri Sep 04 17:53:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehcivar.h,v 1.33 2008/10/14 18:12:38 jmcneill Exp $ */
+/* $NetBSD: ehcivar.h,v 1.34 2009/09/04 17:55:03 dyoung Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -162,15 +162,11 @@
kmutex_t sc_doorbell_lock;
- usb_callout_t sc_tmo_intrlist;
+ struct callout sc_tmo_intrlist;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- device_ptr_t sc_child; /* /dev/usb# device */
-#endif
+ device_t sc_child; /* /dev/usb# device */
char sc_dying;
-#if defined(__NetBSD__)
struct usb_dma_reserve sc_dma_reserve;
-#endif
} ehci_softc_t;
#define EREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (a))
diff -r f9c222a6a26b -r a2d3cb9fd7bd sys/dev/usb/if_atu.c
--- a/sys/dev/usb/if_atu.c Fri Sep 04 17:46:06 2009 +0000
+++ b/sys/dev/usb/if_atu.c Fri Sep 04 17:53:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_atu.c,v 1.30 2009/03/18 16:00:20 cegger Exp $ */
+/* $NetBSD: if_atu.c,v 1.31 2009/09/04 17:53:58 dyoung Exp $ */
/* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */
/*
* Copyright (c) 2003, 2004
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.30 2009/03/18 16:00:20 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.31 2009/09/04 17:53:58 dyoung Exp $");
#include "bpfilter.h"
@@ -221,7 +221,13 @@
void atu_complete_attach(struct atu_softc *);
u_int8_t atu_calculate_padding(int);
-USB_DECLARE_DRIVER(atu);
+int atu_match(device_t, cfdata_t, void *);
+void atu_attach(device_t, device_t, void *);
+int atu_detach(device_t, int);
+int atu_activate(device_t, enum devact);
+extern struct cfdriver atu_cd;
+CFATTACH_DECL_NEW(atu, sizeof(struct atu_softc), atu_match, atu_attach,
+ atu_detach, atu_activate);
usbd_status
atu_usb_request(struct atu_softc *sc, u_int8_t type,
@@ -1018,9 +1024,10 @@
/*
* Probe for an AT76c503 chip.
*/
-USB_MATCH(atu)
+int
+atu_match(device_t parent, cfdata_t match, void *aux)
{
- USB_MATCH_START(atu, uaa);
+ struct usb_attach_arg *uaa = aux;
int i;
for (i = 0; i < __arraycount(atu_devs); i++) {
@@ -1161,9 +1168,11 @@
* Attach the interface. Allocate softc structures, do
* setup and ethernet/BPF attach.
*/
-USB_ATTACH(atu)
+void
+atu_attach(device_t parent, device_t self, void *aux)
{
- USB_ATTACH_START(atu, sc, uaa);
+ struct atu_softc *sc = device_private(self);
+ struct usb_attach_arg *uaa = aux;
char *devinfop;
usbd_status err;
usbd_device_handle dev = uaa->device;
@@ -1174,20 +1183,21 @@
sc->sc_state = ATU_S_UNCONFIG;
devinfop = usbd_devinfo_alloc(dev, 0);
- USB_ATTACH_SETUP;
+ aprint_naive("\n");
+ aprint_normal("\n");
aprint_normal_dev(self, "%s\n", devinfop);
usbd_devinfo_free(devinfop);
err = usbd_set_config_no(dev, ATU_CONFIG_NO, 1);
if (err) {
aprint_error_dev(self, "setting config no failed\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
err = usbd_device2interface_handle(dev, ATU_IFACE_IDX, &sc->atu_iface);
if (err) {
aprint_error_dev(self, "getting interface handle failed\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
sc->atu_unit = device_unit(self);
@@ -1229,7 +1239,7 @@
* so we don't want to do any more configuration after this
* point.
*/
- USB_ATTACH_SUCCESS_RETURN;
+ return;
}
if (mode != MODE_NETCARD) {
@@ -1254,7 +1264,7 @@
" been downloaded\n",
USBDEVNAME(sc->atu_dev)));
atu_complete_attach(sc);
- USB_ATTACH_SUCCESS_RETURN;
+ return;
}
}
@@ -1269,7 +1279,7 @@
atu_complete_attach(sc);
}
- USB_ATTACH_SUCCESS_RETURN;
+ return;
}
void
@@ -1310,7 +1320,7 @@
err = atu_get_card_config(sc);
if (err) {
aprint_error("\n%s: could not get card cfg!\n",
- USBDEVNAME(sc->atu_dev));
+ device_xname(sc->atu_dev));
Home |
Main Index |
Thread Index |
Old Index