Module Name: src
Committed By: dyoung
Date: Fri Sep 4 17:53:58 UTC 2009
Modified Files:
src/sys/dev/usb: if_atu.c if_atureg.h if_aue.c if_auereg.h if_axe.c
if_axereg.h if_cdce.c if_cdcereg.h if_cuereg.h
Log Message:
Expand <dev/usb/usb_port.h> definitions, and lightly unifdef(1).
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/usb/if_atu.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/if_atureg.h
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/usb/if_auereg.h
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/if_axereg.h
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/usb/if_cdcereg.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/if_cuereg.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/if_atu.c
diff -u src/sys/dev/usb/if_atu.c:1.30 src/sys/dev/usb/if_atu.c:1.31
--- src/sys/dev/usb/if_atu.c:1.30 Wed Mar 18 16:00:20 2009
+++ src/sys/dev/usb/if_atu.c Fri Sep 4 17:53:58 2009
@@ -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));
return;
}
@@ -1368,7 +1378,7 @@
ic->ic_ibss_chan = &ic->ic_channels[0];
ifp->if_softc = sc;
- memcpy(ifp->if_xname, USBDEVNAME(sc->atu_dev), IFNAMSIZ);
+ memcpy(ifp->if_xname, device_xname(sc->atu_dev), IFNAMSIZ);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_init = atu_init;
ifp->if_stop = atu_stop;
@@ -1393,9 +1403,10 @@
sc->sc_state = ATU_S_OK;
}
-USB_DETACH(atu)
+int
+atu_detach(device_t self, int flags)
{
- USB_DETACH_START(atu, sc);
+ struct atu_softc *sc = device_private(self);
struct ifnet *ifp = &sc->sc_if;
DPRINTFN(10, ("%s: atu_detach state=%d\n", USBDEVNAME(sc->atu_dev),
@@ -1412,7 +1423,7 @@
}
int
-atu_activate(device_ptr_t self, enum devact act)
+atu_activate(device_t self, enum devact act)
{
struct atu_softc *sc = device_private(self);
@@ -1918,11 +1929,11 @@
/* Init TX ring */
if (atu_tx_list_init(sc))
- printf("%s: tx list init failed\n", USBDEVNAME(sc->atu_dev));
+ printf("%s: tx list init failed\n", device_xname(sc->atu_dev));
/* Init RX ring */
if (atu_rx_list_init(sc))
- printf("%s: rx list init failed\n", USBDEVNAME(sc->atu_dev));
+ printf("%s: rx list init failed\n", device_xname(sc->atu_dev));
/* Load the multicast filter. */
/*atu_setmulti(sc); */
Index: src/sys/dev/usb/if_atureg.h
diff -u src/sys/dev/usb/if_atureg.h:1.6 src/sys/dev/usb/if_atureg.h:1.7
--- src/sys/dev/usb/if_atureg.h:1.6 Mon Dec 25 18:39:48 2006
+++ src/sys/dev/usb/if_atureg.h Fri Sep 4 17:53:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_atureg.h,v 1.6 2006/12/25 18:39:48 wiz Exp $ */
+/* $NetBSD: if_atureg.h,v 1.7 2009/09/04 17:53:58 dyoung Exp $ */
/* $OpenBSD: if_atureg.h,v 1.21 2004/12/23 13:19:38 dlg Exp $ */
/*
* Copyright (c) 2003
@@ -129,7 +129,7 @@
#define ATU_AVG_TIME 20
struct atu_softc {
- USBBASEDEVICE atu_dev;
+ device_t atu_dev;
struct ethercom sc_ec;
struct ieee80211com sc_ic;
int (*sc_newstate)(struct ieee80211com *,
Index: src/sys/dev/usb/if_aue.c
diff -u src/sys/dev/usb/if_aue.c:1.112 src/sys/dev/usb/if_aue.c:1.113
--- src/sys/dev/usb/if_aue.c:1.112 Fri Nov 7 00:20:12 2008
+++ src/sys/dev/usb/if_aue.c Fri Sep 4 17:53:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aue.c,v 1.112 2008/11/07 00:20:12 dyoung Exp $ */
+/* $NetBSD: if_aue.c,v 1.113 2009/09/04 17:53:58 dyoung Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <[email protected]>. All rights reserved.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.112 2008/11/07 00:20:12 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.113 2009/09/04 17:53:58 dyoung Exp $");
#if defined(__NetBSD__)
#include "opt_inet.h"
@@ -232,7 +232,13 @@
};
#define aue_lookup(v, p) ((const struct aue_type *)usb_lookup(aue_devs, v, p))
-USB_DECLARE_DRIVER(aue);
+int aue_match(device_t, cfdata_t, void *);
+void aue_attach(device_t, device_t, void *);
+int aue_detach(device_t, int);
+int aue_activate(device_t, enum devact);
+extern struct cfdriver aue_cd;
+CFATTACH_DECL_NEW(aue, sizeof(struct aue_softc), aue_match, aue_attach,
+ aue_detach, aue_activate);
#if defined(__NetBSD__)
Static void aue_multithread(void *);
@@ -258,9 +264,9 @@
Static int aue_eeprom_getword(struct aue_softc *, int);
Static void aue_read_mac(struct aue_softc *, u_char *);
-Static int aue_miibus_readreg(device_ptr_t, int, int);
-Static void aue_miibus_writereg(device_ptr_t, int, int, int);
-Static void aue_miibus_statchg(device_ptr_t);
+Static int aue_miibus_readreg(device_t, int, int);
+Static void aue_miibus_writereg(device_t, int, int, int);
+Static void aue_miibus_statchg(device_t);
Static void aue_lock_mii(struct aue_softc *);
Static void aue_unlock_mii(struct aue_softc *);
@@ -300,7 +306,7 @@
if (err) {
DPRINTF(("%s: aue_csr_read_1: reg=0x%x err=%s\n",
- USBDEVNAME(sc->aue_dev), reg, usbd_errstr(err)));
+ device_xname(sc->aue_dev), reg, usbd_errstr(err)));
return (0);
}
@@ -327,7 +333,7 @@
if (err) {
DPRINTF(("%s: aue_csr_read_2: reg=0x%x err=%s\n",
- USBDEVNAME(sc->aue_dev), reg, usbd_errstr(err)));
+ device_xname(sc->aue_dev), reg, usbd_errstr(err)));
return (0);
}
@@ -355,7 +361,7 @@
if (err) {
DPRINTF(("%s: aue_csr_write_1: reg=0x%x err=%s\n",
- USBDEVNAME(sc->aue_dev), reg, usbd_errstr(err)));
+ device_xname(sc->aue_dev), reg, usbd_errstr(err)));
return (-1);
}
@@ -383,7 +389,7 @@
if (err) {
DPRINTF(("%s: aue_csr_write_2: reg=0x%x err=%s\n",
- USBDEVNAME(sc->aue_dev), reg, usbd_errstr(err)));
+ device_xname(sc->aue_dev), reg, usbd_errstr(err)));
return (-1);
}
@@ -408,7 +414,7 @@
if (i == AUE_TIMEOUT) {
printf("%s: EEPROM read timed out\n",
- USBDEVNAME(sc->aue_dev));
+ device_xname(sc->aue_dev));
}
return (aue_csr_read_2(sc, AUE_EE_DATA));
@@ -424,7 +430,7 @@
int off = 0;
int word;
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
for (i = 0; i < 3; i++) {
word = aue_eeprom_getword(sc, off + i);
@@ -446,19 +452,19 @@
{
mutex_exit(&sc->aue_mii_lock);
if (--sc->aue_refcnt < 0)
- usb_detach_wakeup(USBDEV(sc->aue_dev));
+ usb_detach_wakeup((sc->aue_dev));
}
Static int
-aue_miibus_readreg(device_ptr_t dev, int phy, int reg)
+aue_miibus_readreg(device_t dev, int phy, int reg)
{
- struct aue_softc *sc = USBGETSOFTC(dev);
+ struct aue_softc *sc = device_private(dev);
int i;
u_int16_t val;
if (sc->aue_dying) {
#ifdef DIAGNOSTIC
- printf("%s: dying\n", USBDEVNAME(sc->aue_dev));
+ printf("%s: dying\n", device_xname(sc->aue_dev));
#endif
return 0;
}
@@ -491,22 +497,22 @@
}
if (i == AUE_TIMEOUT) {
- printf("%s: MII read timed out\n", USBDEVNAME(sc->aue_dev));
+ printf("%s: MII read timed out\n", device_xname(sc->aue_dev));
}
val = aue_csr_read_2(sc, AUE_PHY_DATA);
DPRINTFN(11,("%s: %s: phy=%d reg=%d => 0x%04x\n",
- USBDEVNAME(sc->aue_dev), __func__, phy, reg, val));
+ device_xname(sc->aue_dev), __func__, phy, reg, val));
aue_unlock_mii(sc);
return (val);
}
Static void
-aue_miibus_writereg(device_ptr_t dev, int phy, int reg, int data)
+aue_miibus_writereg(device_t dev, int phy, int reg, int data)
{
- struct aue_softc *sc = USBGETSOFTC(dev);
+ struct aue_softc *sc = device_private(dev);
int i;
#if 0
@@ -518,7 +524,7 @@
#endif
DPRINTFN(11,("%s: %s: phy=%d reg=%d data=0x%04x\n",
- USBDEVNAME(sc->aue_dev), __func__, phy, reg, data));
+ device_xname(sc->aue_dev), __func__, phy, reg, data));
aue_lock_mii(sc);
aue_csr_write_2(sc, AUE_PHY_DATA, data);
@@ -531,19 +537,18 @@
}
if (i == AUE_TIMEOUT) {
- printf("%s: MII read timed out\n",
- USBDEVNAME(sc->aue_dev));
+ printf("%s: MII read timed out\n", device_xname(sc->aue_dev));
}
aue_unlock_mii(sc);
}
Static void
-aue_miibus_statchg(device_ptr_t dev)
+aue_miibus_statchg(device_t dev)
{
- struct aue_softc *sc = USBGETSOFTC(dev);
+ struct aue_softc *sc = device_private(dev);
struct mii_data *mii = GET_MII(sc);
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
aue_lock_mii(sc);
AUE_CLRBIT(sc, AUE_CTL0, AUE_CTL0_RX_ENB | AUE_CTL0_TX_ENB);
@@ -572,7 +577,7 @@
auxmode = aue_miibus_readreg(dev, 0, 0x1b);
aue_miibus_writereg(dev, 0, 0x1b, auxmode | 0x04);
}
- DPRINTFN(5,("%s: %s: exit\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: exit\n", device_xname(sc->aue_dev), __func__));
}
#define AUE_POLY 0xEDB88320
@@ -603,7 +608,7 @@
struct ether_multistep step;
u_int32_t h = 0, i;
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
ifp = GET_IFP(sc);
@@ -658,7 +663,7 @@
{
int i;
- DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(2,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
AUE_SETBIT(sc, AUE_CTL1, AUE_CTL1_RESETMAC);
@@ -668,7 +673,7 @@
}
if (i == AUE_TIMEOUT)
- printf("%s: reset failed\n", USBDEVNAME(sc->aue_dev));
+ printf("%s: reset failed\n", device_xname(sc->aue_dev));
#if 0
/* XXX what is mii_mode supposed to be */
@@ -708,9 +713,10 @@
/*
* Probe for a Pegasus chip.
*/
-USB_MATCH(aue)
+int
+aue_match(device_t parent, cfdata_t match, void *aux)
{
- USB_MATCH_START(aue, uaa);
+ struct usb_attach_arg *uaa = aux;
/*
* Some manufacturers use the same vendor and product id for
@@ -740,9 +746,11 @@
* Attach the interface. Allocate softc structures, do ifmedia
* setup and ethernet/BPF attach.
*/
-USB_ATTACH(aue)
+void
+aue_attach(device_t parent, device_t self, void *aux)
{
- USB_ATTACH_START(aue, sc, uaa);
+ struct aue_softc *sc = device_private(self);
+ struct usb_attach_arg *uaa = aux;
char *devinfop;
int s;
u_char eaddr[ETHER_ADDR_LEN];
@@ -760,24 +768,25 @@
sc->aue_dev = self;
devinfop = usbd_devinfo_alloc(uaa->device, 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, AUE_CONFIG_NO, 1);
if (err) {
aprint_error_dev(self, "setting config no failed\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
- usb_init_task(&sc->aue_tick_task, aue_tick_task, sc);
- usb_init_task(&sc->aue_stop_task, (void (*)(void *))aue_stop, sc);
+ usb_init_task(&sc->aue_tick_task, aue_tick_task, sc);
+ usb_init_task(&sc->aue_stop_task, (void (*)(void *))aue_stop, sc);
mutex_init(&sc->aue_mii_lock, MUTEX_DEFAULT, IPL_NONE);
err = usbd_device2interface_handle(dev, AUE_IFACE_IDX, &iface);
if (err) {
aprint_error_dev(self, "getting interface handle failed\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
#if defined(__NetBSD__)
sc->aue_closing = 0;
@@ -788,12 +797,12 @@
err = kthread_create(PRI_NONE, 0, NULL,
aue_multithread, sc, &sc->aue_thread,
- "%s-mc", USBDEVNAME(sc->aue_dev));
+ "%s-mc", device_xname(sc->aue_dev));
if (err) {
aprint_error_dev(self,
"creating multicast configuration thread\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
#endif
sc->aue_flags = aue_lookup(uaa->vendor, uaa->product)->aue_flags;
@@ -811,7 +820,7 @@
if (ed == NULL) {
aprint_error_dev(self,
"couldn't get endpoint descriptor %d\n", i);
- USB_ATTACH_ERROR_RETURN;
+ return;
}
if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
@@ -828,7 +837,7 @@
if (sc->aue_ed[AUE_ENDPT_RX] == 0 || sc->aue_ed[AUE_ENDPT_TX] == 0 ||
sc->aue_ed[AUE_ENDPT_INTR] == 0) {
aprint_error_dev(self, "missing endpoint\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
@@ -858,7 +867,7 @@
#if defined(__OpenBSD__)
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
#endif
- strncpy(ifp->if_xname, USBDEVNAME(sc->aue_dev), IFNAMSIZ);
+ strncpy(ifp->if_xname, device_xname(sc->aue_dev), IFNAMSIZ);
IFQ_SET_READY(&ifp->if_snd);
@@ -880,37 +889,38 @@
/* Attach the interface. */
if_attach(ifp);
- Ether_ifattach(ifp, eaddr);
+ ether_ifattach(ifp, eaddr);
#if NRND > 0
- rnd_attach_source(&sc->rnd_source, USBDEVNAME(sc->aue_dev),
+ rnd_attach_source(&sc->rnd_source, device_xname(sc->aue_dev),
RND_TYPE_NET, 0);
#endif
- usb_callout_init(sc->aue_stat_ch);
+ callout_init(&(sc->aue_stat_ch), 0);
sc->aue_attached = 1;
splx(s);
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->aue_udev,
- USBDEV(sc->aue_dev));
+ (sc->aue_dev));
- USB_ATTACH_SUCCESS_RETURN;
+ return;
}
-USB_DETACH(aue)
+int
+aue_detach(device_t self, int flags)
{
- USB_DETACH_START(aue, sc);
+ struct aue_softc *sc = device_private(self);
struct ifnet *ifp = GET_IFP(sc);
int s;
- DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(2,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
if (!sc->aue_attached) {
/* Detached before attached finished, so just bail out. */
return (0);
}
- usb_uncallout(sc->aue_stat_ch, aue_tick, sc);
+ callout_stop(&(sc->aue_stat_ch));
/*
* Remove any pending tasks. They cannot be executing because they run
* in the same thread as detach.
@@ -956,12 +966,12 @@
if (--sc->aue_refcnt >= 0) {
/* Wait for processes to go away. */
- usb_detach_wait(USBDEV(sc->aue_dev));
+ usb_detach_wait((sc->aue_dev));
}
splx(s);
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->aue_udev,
- USBDEV(sc->aue_dev));
+ (sc->aue_dev));
mutex_destroy(&sc->aue_mii_lock);
#if 0
@@ -971,11 +981,11 @@
}
int
-aue_activate(device_ptr_t self, enum devact act)
+aue_activate(device_t self, enum devact act)
{
struct aue_softc *sc = device_private(self);
- DPRINTFN(2,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(2,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
switch (act) {
case DVACT_ACTIVATE:
@@ -998,7 +1008,7 @@
{
struct mbuf *m_new = NULL;
- DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__));
+ DPRINTFN(10,("%s: %s: enter\n", device_xname(sc->aue_dev),__func__));
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
@@ -1035,7 +1045,7 @@
struct aue_chain *c;
int i;
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
cd = &sc->aue_cdata;
for (i = 0; i < AUE_RX_LIST_CNT; i++) {
@@ -1064,7 +1074,7 @@
struct aue_chain *c;
int i;
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
cd = &sc->aue_cdata;
for (i = 0; i < AUE_TX_LIST_CNT; i++) {
@@ -1093,7 +1103,7 @@
struct ifnet *ifp = GET_IFP(sc);
struct aue_intrpkt *p = &sc->aue_cdata.aue_ibuf;
- DPRINTFN(15,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__));
+ DPRINTFN(15,("%s: %s: enter\n", device_xname(sc->aue_dev),__func__));
if (sc->aue_dying)
return;
@@ -1139,7 +1149,7 @@
struct aue_rxpkt r;
int s;
- DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__));
+ DPRINTFN(10,("%s: %s: enter\n", device_xname(sc->aue_dev),__func__));
if (sc->aue_dying)
return;
@@ -1207,9 +1217,9 @@
BPF_MTAP(ifp, m);
#endif
- DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->aue_dev),
+ DPRINTFN(10,("%s: %s: deliver %d\n", device_xname(sc->aue_dev),
__func__, m->m_len));
- IF_INPUT(ifp, m);
+ (*(ifp)->if_input)((ifp), (m));
done1:
splx(s);
@@ -1222,7 +1232,7 @@
USBD_NO_TIMEOUT, aue_rxeof);
usbd_transfer(xfer);
- DPRINTFN(10,("%s: %s: start rx\n", USBDEVNAME(sc->aue_dev),
+ DPRINTFN(10,("%s: %s: start rx\n", device_xname(sc->aue_dev),
__func__));
}
@@ -1245,7 +1255,7 @@
s = splnet();
- DPRINTFN(10,("%s: %s: enter status=%d\n", USBDEVNAME(sc->aue_dev),
+ DPRINTFN(10,("%s: %s: enter status=%d\n", device_xname(sc->aue_dev),
__func__, status));
ifp->if_timer = 0;
@@ -1281,7 +1291,7 @@
{
struct aue_softc *sc = xsc;
- DPRINTFN(15,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__));
+ DPRINTFN(15,("%s: %s: enter\n", device_xname(sc->aue_dev),__func__));
if (sc == NULL)
return;
@@ -1301,7 +1311,7 @@
struct mii_data *mii;
int s;
- DPRINTFN(15,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__));
+ DPRINTFN(15,("%s: %s: enter\n", device_xname(sc->aue_dev),__func__));
if (sc->aue_dying)
return;
@@ -1319,14 +1329,14 @@
if (mii->mii_media_status & IFM_ACTIVE &&
IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
DPRINTFN(2,("%s: %s: got link\n",
- USBDEVNAME(sc->aue_dev),__func__));
+ device_xname(sc->aue_dev),__func__));
sc->aue_link++;
if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
aue_start(ifp);
}
}
- usb_callout(sc->aue_stat_ch, hz, aue_tick, sc);
+ callout_reset(&(sc->aue_stat_ch), (hz), (aue_tick), (sc));
splx(s);
}
@@ -1338,7 +1348,7 @@
struct aue_chain *c;
usbd_status err;
- DPRINTFN(10,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev),__func__));
+ DPRINTFN(10,("%s: %s: enter\n", device_xname(sc->aue_dev),__func__));
c = &sc->aue_cdata.aue_tx_chain[idx];
@@ -1373,7 +1383,7 @@
USB_TASKQ_DRIVER);
return (EIO);
}
- DPRINTFN(5,("%s: %s: send %d bytes\n", USBDEVNAME(sc->aue_dev),
+ DPRINTFN(5,("%s: %s: send %d bytes\n", device_xname(sc->aue_dev),
__func__, total_len));
sc->aue_cdata.aue_tx_cnt++;
@@ -1387,7 +1397,7 @@
struct aue_softc *sc = ifp->if_softc;
struct mbuf *m_head = NULL;
- DPRINTFN(5,("%s: %s: enter, link=%d\n", USBDEVNAME(sc->aue_dev),
+ DPRINTFN(5,("%s: %s: enter, link=%d\n", device_xname(sc->aue_dev),
__func__, sc->aue_link));
if (sc->aue_dying)
@@ -1436,7 +1446,7 @@
int i, s;
const u_char *eaddr;
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
if (sc->aue_dying)
return;
@@ -1501,7 +1511,7 @@
splx(s);
- usb_callout(sc->aue_stat_ch, hz, aue_tick, sc);
+ callout_reset(&(sc->aue_stat_ch), (hz), (aue_tick), (sc));
}
Static int
@@ -1544,7 +1554,7 @@
USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT,
aue_rxeof);
(void)usbd_transfer(c->aue_xfer); /* XXX */
- DPRINTFN(5,("%s: %s: start read\n", USBDEVNAME(sc->aue_dev),
+ DPRINTFN(5,("%s: %s: start read\n", device_xname(sc->aue_dev),
__func__));
}
@@ -1561,7 +1571,7 @@
struct mii_data *mii = GET_MII(sc);
int rc;
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
if (sc->aue_dying)
return (0);
@@ -1666,7 +1676,7 @@
usbd_status stat;
int s;
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
ifp->if_oerrors++;
aprint_error_dev(sc->aue_dev, "watchdog timeout\n");
@@ -1692,7 +1702,7 @@
struct ifnet *ifp;
int i;
- DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
+ DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
ifp = GET_IFP(sc);
ifp->if_timer = 0;
@@ -1700,19 +1710,19 @@
aue_csr_write_1(sc, AUE_CTL0, 0);
aue_csr_write_1(sc, AUE_CTL1, 0);
aue_reset(sc);
- usb_uncallout(sc->aue_stat_ch, aue_tick, sc);
+ callout_stop(&(sc->aue_stat_ch));
/* Stop transfers. */
if (sc->aue_ep[AUE_ENDPT_RX] != NULL) {
err = usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_RX]);
if (err) {
printf("%s: abort rx pipe failed: %s\n",
- USBDEVNAME(sc->aue_dev), usbd_errstr(err));
+ device_xname(sc->aue_dev), usbd_errstr(err));
}
err = usbd_close_pipe(sc->aue_ep[AUE_ENDPT_RX]);
if (err) {
printf("%s: close rx pipe failed: %s\n",
- USBDEVNAME(sc->aue_dev), usbd_errstr(err));
+ device_xname(sc->aue_dev), usbd_errstr(err));
}
sc->aue_ep[AUE_ENDPT_RX] = NULL;
}
@@ -1721,12 +1731,12 @@
err = usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_TX]);
if (err) {
printf("%s: abort tx pipe failed: %s\n",
- USBDEVNAME(sc->aue_dev), usbd_errstr(err));
+ device_xname(sc->aue_dev), usbd_errstr(err));
}
err = usbd_close_pipe(sc->aue_ep[AUE_ENDPT_TX]);
if (err) {
printf("%s: close tx pipe failed: %s\n",
- USBDEVNAME(sc->aue_dev), usbd_errstr(err));
+ device_xname(sc->aue_dev), usbd_errstr(err));
}
sc->aue_ep[AUE_ENDPT_TX] = NULL;
}
@@ -1735,12 +1745,12 @@
err = usbd_abort_pipe(sc->aue_ep[AUE_ENDPT_INTR]);
if (err) {
printf("%s: abort intr pipe failed: %s\n",
- USBDEVNAME(sc->aue_dev), usbd_errstr(err));
+ device_xname(sc->aue_dev), usbd_errstr(err));
}
err = usbd_close_pipe(sc->aue_ep[AUE_ENDPT_INTR]);
if (err) {
printf("%s: close intr pipe failed: %s\n",
- USBDEVNAME(sc->aue_dev), usbd_errstr(err));
+ device_xname(sc->aue_dev), usbd_errstr(err));
}
sc->aue_ep[AUE_ENDPT_INTR] = NULL;
}
Index: src/sys/dev/usb/if_auereg.h
diff -u src/sys/dev/usb/if_auereg.h:1.21 src/sys/dev/usb/if_auereg.h:1.22
--- src/sys/dev/usb/if_auereg.h:1.21 Thu May 22 01:21:18 2008
+++ src/sys/dev/usb/if_auereg.h Fri Sep 4 17:53:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_auereg.h,v 1.21 2008/05/22 01:21:18 dyoung Exp $ */
+/* $NetBSD: if_auereg.h,v 1.22 2009/09/04 17:53:58 dyoung Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <[email protected]>. All rights reserved.
@@ -224,7 +224,7 @@
};
struct aue_softc {
- USBBASEDEVICE aue_dev;
+ device_t aue_dev;
struct ethercom aue_ec;
struct mii_data aue_mii;
@@ -239,7 +239,7 @@
#define GET_IFP(sc) (&(sc)->aue_ec.ec_if)
#define GET_MII(sc) (&(sc)->aue_mii)
- usb_callout_t aue_stat_ch;
+ struct callout aue_stat_ch;
usbd_device_handle aue_udev;
usbd_interface_handle aue_iface;
Index: src/sys/dev/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.26 src/sys/dev/usb/if_axe.c:1.27
--- src/sys/dev/usb/if_axe.c:1.26 Fri Nov 7 00:20:12 2008
+++ src/sys/dev/usb/if_axe.c Fri Sep 4 17:53:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axe.c,v 1.26 2008/11/07 00:20:12 dyoung Exp $ */
+/* $NetBSD: if_axe.c,v 1.27 2009/09/04 17:53:58 dyoung Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.26 2008/11/07 00:20:12 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.27 2009/09/04 17:53:58 dyoung Exp $");
#if defined(__NetBSD__)
#include "opt_inet.h"
@@ -164,7 +164,13 @@
};
#define axe_lookup(v, p) ((const struct axe_type *)usb_lookup(axe_devs, v, p))
-USB_DECLARE_DRIVER(axe);
+int axe_match(device_t, cfdata_t, void *);
+void axe_attach(device_t, device_t, void *);
+int axe_detach(device_t, int);
+int axe_activate(device_t, enum devact);
+extern struct cfdriver axe_cd;
+CFATTACH_DECL_NEW(axe, sizeof(struct axe_softc), axe_match, axe_attach,
+ axe_detach, axe_activate);
Static int axe_tx_list_init(struct axe_softc *);
Static int axe_rx_list_init(struct axe_softc *);
@@ -182,9 +188,9 @@
Static void axe_init(void *);
Static void axe_stop(struct axe_softc *);
Static void axe_watchdog(struct ifnet *);
-Static int axe_miibus_readreg(device_ptr_t, int, int);
-Static void axe_miibus_writereg(device_ptr_t, int, int, int);
-Static void axe_miibus_statchg(device_ptr_t);
+Static int axe_miibus_readreg(device_t, int, int);
+Static void axe_miibus_writereg(device_t, int, int, int);
+Static void axe_miibus_statchg(device_t);
Static int axe_cmd(struct axe_softc *, int, int, int, void *);
Static void axe_reset(struct axe_softc *sc);
@@ -205,7 +211,7 @@
{
mutex_exit(&sc->axe_mii_lock);
if (--sc->axe_refcnt < 0)
- usb_detach_wakeup(USBDEV(sc->axe_dev));
+ usb_detach_wakeup((sc->axe_dev));
}
Static int
@@ -237,9 +243,9 @@
}
Static int
-axe_miibus_readreg(device_ptr_t dev, int phy, int reg)
+axe_miibus_readreg(device_t dev, int phy, int reg)
{
- struct axe_softc *sc = USBGETSOFTC(dev);
+ struct axe_softc *sc = device_private(dev);
usbd_status err;
u_int16_t val;
@@ -283,9 +289,9 @@
}
Static void
-axe_miibus_writereg(device_ptr_t dev, int phy, int reg, int aval)
+axe_miibus_writereg(device_t dev, int phy, int reg, int aval)
{
- struct axe_softc *sc = USBGETSOFTC(dev);
+ struct axe_softc *sc = device_private(dev);
usbd_status err;
u_int16_t val;
@@ -306,9 +312,9 @@
}
Static void
-axe_miibus_statchg(device_ptr_t dev)
+axe_miibus_statchg(device_t dev)
{
- struct axe_softc *sc = USBGETSOFTC(dev);
+ struct axe_softc *sc = device_private(dev);
struct mii_data *mii = GET_MII(sc);
int val, err;
@@ -391,9 +397,10 @@
/*
* Probe for a AX88172 chip.
*/
-USB_MATCH(axe)
+int
+axe_match(device_t parent, cfdata_t match, void *aux)
{
- USB_MATCH_START(axe, uaa);
+ struct usb_attach_arg *uaa = aux;
return (axe_lookup(uaa->vendor, uaa->product) != NULL ?
UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
@@ -403,9 +410,11 @@
* Attach the interface. Allocate softc structures, do ifmedia
* setup and ethernet/BPF attach.
*/
-USB_ATTACH(axe)
+void
+axe_attach(device_t parent, device_t self, void *aux)
{
- USB_ATTACH_START(axe, sc, uaa);
+ struct axe_softc *sc = device_private(self);
+ struct usb_attach_arg *uaa = aux;
usbd_device_handle dev = uaa->device;
usbd_status err;
usb_interface_descriptor_t *id;
@@ -418,14 +427,14 @@
int i, s;
devinfop = usbd_devinfo_alloc(dev, 0);
- USB_ATTACH_SETUP;
+ do { aprint_naive("\n"); aprint_normal("\n"); } while (0);
sc->axe_dev = self;
err = usbd_set_config_no(dev, AXE_CONFIG_NO, 1);
if (err) {
aprint_error_dev(self, "getting interface handle failed\n");
usbd_devinfo_free(devinfop);
- USB_ATTACH_ERROR_RETURN;
+ return;
}
usb_init_task(&sc->axe_tick_task, axe_tick_task, sc);
@@ -436,7 +445,7 @@
if (err) {
aprint_error_dev(self, "getting interface handle failed\n");
usbd_devinfo_free(devinfop);
- USB_ATTACH_ERROR_RETURN;
+ return;
}
sc->axe_udev = dev;
@@ -453,7 +462,7 @@
ed = usbd_interface2endpoint_descriptor(sc->axe_iface, i);
if (!ed) {
aprint_error_dev(self, "couldn't get ep %d\n", i);
- USB_ATTACH_ERROR_RETURN;
+ return;
}
if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
@@ -529,26 +538,27 @@
/* Attach the interface. */
if_attach(ifp);
- Ether_ifattach(ifp, eaddr);
+ ether_ifattach(ifp, eaddr);
#if NRND > 0
- rnd_attach_source(&sc->rnd_source, USBDEVNAME(sc->axe_dev),
+ rnd_attach_source(&sc->rnd_source, device_xname(sc->axe_dev),
RND_TYPE_NET, 0);
#endif
- usb_callout_init(sc->axe_stat_ch);
+ callout_init(&(sc->axe_stat_ch), 0);
sc->axe_attached = 1;
splx(s);
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->axe_udev,
- USBDEV(sc->axe_dev));
+ (sc->axe_dev));
- USB_ATTACH_SUCCESS_RETURN;
+ return;
}
-USB_DETACH(axe)
+int
+axe_detach(device_t self, int flags)
{
- USB_DETACH_START(axe, sc);
+ struct axe_softc *sc = device_private(self);
int s;
struct ifnet *ifp = GET_IFP(sc);
@@ -558,7 +568,7 @@
if (!sc->axe_attached)
return (0);
- usb_uncallout(sc->axe_stat_ch, axe_tick, sc);
+ callout_stop(&(sc->axe_stat_ch));
sc->axe_dying = 1;
@@ -582,7 +592,7 @@
if (--sc->axe_refcnt >= 0) {
/* Wait for processes to go away */
- usb_detach_wait(USBDEV(sc->axe_dev));
+ usb_detach_wait((sc->axe_dev));
}
if (ifp->if_flags & IFF_RUNNING)
@@ -609,18 +619,18 @@
if (--sc->axe_refcnt >= 0) {
/* Wait for processes to go away. */
- usb_detach_wait(USBDEV(sc->axe_dev));
+ usb_detach_wait((sc->axe_dev));
}
splx(s);
- usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->axe_udev,
- USBDEV(sc->axe_dev));
+ usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->axe_udev,
+ (sc->axe_dev));
return (0);
}
int
-axe_activate(device_ptr_t self, enum devact act)
+axe_activate(device_t self, enum devact act)
{
struct axe_softc *sc = device_private(self);
@@ -797,7 +807,7 @@
return;
if (usbd_ratecheck(&sc->axe_rx_notice)) {
printf("%s: usb errors on rx: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(status));
+ device_xname(sc->axe_dev), usbd_errstr(status));
}
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->axe_ep[AXE_ENDPT_RX]);
@@ -838,7 +848,7 @@
DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->axe_dev),
__func__, m->m_len));
- IF_INPUT(ifp, m);
+ (*(ifp)->if_input)((ifp), (m));
done1:
splx(s);
@@ -885,8 +895,8 @@
return;
}
ifp->if_oerrors++;
- printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->axe_dev),
- usbd_errstr(status));
+ printf("%s: usb error on tx: %s\n", device_xname(sc->axe_dev),
+ usbd_errstr(status));
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->axe_ep[AXE_ENDPT_TX]);
splx(s);
@@ -951,7 +961,7 @@
mii_tick(mii);
- usb_callout(sc->axe_stat_ch, hz, axe_tick, sc);
+ callout_reset(&(sc->axe_stat_ch), (hz), (axe_tick), (sc));
splx(s);
}
@@ -1052,14 +1062,14 @@
/* Init RX ring. */
if (axe_rx_list_init(sc) == ENOBUFS) {
- printf("%s: rx list init failed\n", USBDEVNAME(sc->axe_dev));
+ printf("%s: rx list init failed\n", device_xname(sc->axe_dev));
splx(s);
return;
}
/* Init TX ring. */
if (axe_tx_list_init(sc) == ENOBUFS) {
- printf("%s: tx list init failed\n", USBDEVNAME(sc->axe_dev));
+ printf("%s: tx list init failed\n", device_xname(sc->axe_dev));
splx(s);
return;
}
@@ -1091,7 +1101,7 @@
USBD_EXCLUSIVE_USE, &sc->axe_ep[AXE_ENDPT_RX]);
if (err) {
printf("%s: open rx pipe failed: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(err));
+ device_xname(sc->axe_dev), usbd_errstr(err));
splx(s);
return;
}
@@ -1100,7 +1110,7 @@
USBD_EXCLUSIVE_USE, &sc->axe_ep[AXE_ENDPT_TX]);
if (err) {
printf("%s: open tx pipe failed: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(err));
+ device_xname(sc->axe_dev), usbd_errstr(err));
splx(s);
return;
}
@@ -1119,8 +1129,8 @@
splx(s);
- usb_callout_init(sc->axe_stat_ch);
- usb_callout(sc->axe_stat_ch, hz, axe_tick, sc);
+ callout_init(&(sc->axe_stat_ch), 0);
+ callout_reset(&(sc->axe_stat_ch), (hz), (axe_tick), (sc));
return;
}
@@ -1234,7 +1244,7 @@
sc = ifp->if_softc;
ifp->if_oerrors++;
- printf("%s: watchdog timeout\n", USBDEVNAME(sc->axe_dev));
+ printf("%s: watchdog timeout\n", device_xname(sc->axe_dev));
s = splusb();
c = &sc->axe_cdata.axe_tx_chain[0];
@@ -1262,19 +1272,19 @@
ifp = GET_IFP(sc);
ifp->if_timer = 0;
- usb_uncallout(sc->axe_stat_ch, axe_tick, sc);
+ callout_stop(&(sc->axe_stat_ch));
/* Stop transfers. */
if (sc->axe_ep[AXE_ENDPT_RX] != NULL) {
err = usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_RX]);
if (err) {
printf("%s: abort rx pipe failed: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(err));
+ device_xname(sc->axe_dev), usbd_errstr(err));
}
err = usbd_close_pipe(sc->axe_ep[AXE_ENDPT_RX]);
if (err) {
printf("%s: close rx pipe failed: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(err));
+ device_xname(sc->axe_dev), usbd_errstr(err));
}
sc->axe_ep[AXE_ENDPT_RX] = NULL;
}
@@ -1283,12 +1293,12 @@
err = usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_TX]);
if (err) {
printf("%s: abort tx pipe failed: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(err));
+ device_xname(sc->axe_dev), usbd_errstr(err));
}
err = usbd_close_pipe(sc->axe_ep[AXE_ENDPT_TX]);
if (err) {
printf("%s: close tx pipe failed: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(err));
+ device_xname(sc->axe_dev), usbd_errstr(err));
}
sc->axe_ep[AXE_ENDPT_TX] = NULL;
}
@@ -1297,12 +1307,12 @@
err = usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_INTR]);
if (err) {
printf("%s: abort intr pipe failed: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(err));
+ device_xname(sc->axe_dev), usbd_errstr(err));
}
err = usbd_close_pipe(sc->axe_ep[AXE_ENDPT_INTR]);
if (err) {
printf("%s: close intr pipe failed: %s\n",
- USBDEVNAME(sc->axe_dev), usbd_errstr(err));
+ device_xname(sc->axe_dev), usbd_errstr(err));
}
sc->axe_ep[AXE_ENDPT_INTR] = NULL;
}
Index: src/sys/dev/usb/if_axereg.h
diff -u src/sys/dev/usb/if_axereg.h:1.5 src/sys/dev/usb/if_axereg.h:1.6
--- src/sys/dev/usb/if_axereg.h:1.5 Sat Jan 19 22:10:20 2008
+++ src/sys/dev/usb/if_axereg.h Fri Sep 4 17:53:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axereg.h,v 1.5 2008/01/19 22:10:20 dyoung Exp $ */
+/* $NetBSD: if_axereg.h,v 1.6 2009/09/04 17:53:58 dyoung Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003
@@ -151,13 +151,7 @@
#define AXE_INC(x, y) (x) = (x + 1) % y
struct axe_softc {
- USBBASEDEVICE axe_dev;
-#if defined(__FreeBSD__)
- struct arpcom arpcom;
- device_t axe_miibus;
-#define GET_IFP(sc) (&(sc)->arpcom.ac_if)
-#define GET_MII(sc) (device_get_softc((sc)->axe_miibus))
-#elif defined(__NetBSD__)
+ device_t axe_dev;
struct ethercom axe_ec;
struct mii_data axe_mii;
#if NRND > 0
@@ -165,15 +159,6 @@
#endif
#define GET_IFP(sc) (&(sc)->axe_ec.ec_if)
#define GET_MII(sc) (&(sc)->axe_mii)
-#elif defined(__OpenBSD__)
- struct arpcom arpcom;
- struct mii_data axe_mii;
-#if NRND > 0
- rndsource_element_t rnd_source;
-#endif
-#define GET_IFP(sc) (&(sc)->arpcom.ac_if)
-#define GET_MII(sc) (&(sc)->axe_mii)
-#endif
usbd_device_handle axe_udev;
usbd_interface_handle axe_iface;
@@ -184,7 +169,7 @@
usbd_pipe_handle axe_ep[AXE_ENDPT_MAX];
int axe_if_flags;
struct axe_cdata axe_cdata;
- usb_callout_t axe_stat_ch;
+ struct callout axe_stat_ch;
int axe_refcnt;
char axe_dying;
Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.22 src/sys/dev/usb/if_cdce.c:1.23
--- src/sys/dev/usb/if_cdce.c:1.22 Sun Aug 16 14:18:49 2009
+++ src/sys/dev/usb/if_cdce.c Fri Sep 4 17:53:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cdce.c,v 1.22 2009/08/16 14:18:49 tron Exp $ */
+/* $NetBSD: if_cdce.c,v 1.23 2009/09/04 17:53:58 dyoung Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <[email protected]>
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.22 2009/08/16 14:18:49 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.23 2009/09/04 17:53:58 dyoung Exp $");
#include "bpfilter.h"
#ifdef __NetBSD__
#include "opt_inet.h"
@@ -127,11 +127,18 @@
};
#define cdce_lookup(v, p) ((const struct cdce_type *)usb_lookup(cdce_devs, v, p))
-USB_DECLARE_DRIVER(cdce);
+int cdce_match(device_t, cfdata_t, void *);
+void cdce_attach(device_t, device_t, void *);
+int cdce_detach(device_t, int);
+int cdce_activate(device_t, enum devact);
+extern struct cfdriver cdce_cd;
+CFATTACH_DECL_NEW(cdce, sizeof(struct cdce_softc), cdce_match, cdce_attach,
+ cdce_detach, cdce_activate);
-USB_MATCH(cdce)
+int
+cdce_match(device_t parent, cfdata_t match, void *aux)
{
- USB_IFMATCH_START(cdce, uaa);
+ struct usbif_attach_arg *uaa = aux;
if (cdce_lookup(uaa->vendor, uaa->product) != NULL)
return (UMATCH_VENDOR_PRODUCT);
@@ -143,9 +150,11 @@
return (UMATCH_NONE);
}
-USB_ATTACH(cdce)
+void
+cdce_attach(device_t parent, device_t self, void *aux)
{
- USB_IFATTACH_START(cdce, sc, uaa);
+ struct cdce_softc *sc = device_private(self);
+ struct usbif_attach_arg *uaa = aux;
char *devinfop;
int s;
struct ifnet *ifp;
@@ -162,7 +171,8 @@
char eaddr_str[USB_MAX_ENCODED_STRING_LEN];
devinfop = usbd_devinfo_alloc(dev, 0);
- USB_ATTACH_SETUP;
+ aprint_naive("\n");
+ aprint_normal("\n");
sc->cdce_dev = self;
aprint_normal_dev(self, "%s\n", devinfop);
usbd_devinfo_free(devinfop);
@@ -181,7 +191,7 @@
UDESC_CS_INTERFACE, UDESCSUB_CDC_UNION);
if (ud == NULL) {
aprint_error_dev(self, "no union descriptor\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
data_ifcno = ud->bSlaveInterface[0];
@@ -200,7 +210,7 @@
if (sc->cdce_data_iface == NULL) {
aprint_error_dev(self, "no data interface\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
/*
@@ -229,7 +239,7 @@
if (usbd_set_interface(sc->cdce_data_iface, j)) {
aprint_error_dev(sc->cdce_dev,
"setting alternate interface failed\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
/* Find endpoints. */
id = usbd_get_interface_descriptor(sc->cdce_data_iface);
@@ -239,7 +249,7 @@
if (!ed) {
aprint_error_dev(self,
"could not read endpoint descriptor\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
@@ -262,11 +272,11 @@
if (sc->cdce_bulkin_no == -1) {
aprint_error_dev(self, "could not find data bulk in\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
if (sc->cdce_bulkout_no == -1 ) {
aprint_error_dev(self, "could not find data bulk out\n");
- USB_ATTACH_ERROR_RETURN;
+ return;
}
ue = (const usb_cdc_ethernet_descriptor_t *)usb_find_desc(dev,
@@ -290,25 +300,26 @@
ifp->if_ioctl = cdce_ioctl;
ifp->if_start = cdce_start;
ifp->if_watchdog = cdce_watchdog;
- strncpy(ifp->if_xname, USBDEVNAME(sc->cdce_dev), IFNAMSIZ);
+ strncpy(ifp->if_xname, device_xname(sc->cdce_dev), IFNAMSIZ);
IFQ_SET_READY(&ifp->if_snd);
if_attach(ifp);
- Ether_ifattach(ifp, eaddr);
+ ether_ifattach(ifp, eaddr);
sc->cdce_attached = 1;
splx(s);
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->cdce_udev,
- USBDEV(sc->cdce_dev));
+ (sc->cdce_dev));
- USB_ATTACH_SUCCESS_RETURN;
+ return;
}
-USB_DETACH(cdce)
+int
+cdce_detach(device_t self, int flags)
{
- USB_DETACH_START(cdce, sc);
+ struct cdce_softc *sc = device_private(self);
struct ifnet *ifp = GET_IFP(sc);
int s;
@@ -408,11 +419,11 @@
err = usbd_abort_pipe(sc->cdce_bulkin_pipe);
if (err)
printf("%s: abort rx pipe failed: %s\n",
- USBDEVNAME(sc->cdce_dev), usbd_errstr(err));
+ device_xname(sc->cdce_dev), usbd_errstr(err));
err = usbd_close_pipe(sc->cdce_bulkin_pipe);
if (err)
printf("%s: close rx pipe failed: %s\n",
- USBDEVNAME(sc->cdce_dev), usbd_errstr(err));
+ device_xname(sc->cdce_dev), usbd_errstr(err));
sc->cdce_bulkin_pipe = NULL;
}
@@ -420,11 +431,11 @@
err = usbd_abort_pipe(sc->cdce_bulkout_pipe);
if (err)
printf("%s: abort tx pipe failed: %s\n",
- USBDEVNAME(sc->cdce_dev), usbd_errstr(err));
+ device_xname(sc->cdce_dev), usbd_errstr(err));
err = usbd_close_pipe(sc->cdce_bulkout_pipe);
if (err)
printf("%s: close tx pipe failed: %s\n",
- USBDEVNAME(sc->cdce_dev), usbd_errstr(err));
+ device_xname(sc->cdce_dev), usbd_errstr(err));
sc->cdce_bulkout_pipe = NULL;
}
@@ -525,7 +536,7 @@
return;
ifp->if_oerrors++;
- printf("%s: watchdog timeout\n", USBDEVNAME(sc->cdce_dev));
+ printf("%s: watchdog timeout\n", device_xname(sc->cdce_dev));
}
Static void
@@ -543,13 +554,13 @@
s = splnet();
if (cdce_tx_list_init(sc) == ENOBUFS) {
- printf("%s: tx list init failed\n", USBDEVNAME(sc->cdce_dev));
+ printf("%s: tx list init failed\n", device_xname(sc->cdce_dev));
splx(s);
return;
}
if (cdce_rx_list_init(sc) == ENOBUFS) {
- printf("%s: rx list init failed\n", USBDEVNAME(sc->cdce_dev));
+ printf("%s: rx list init failed\n", device_xname(sc->cdce_dev));
splx(s);
return;
}
@@ -559,7 +570,7 @@
err = usbd_open_pipe(sc->cdce_data_iface, sc->cdce_bulkin_no,
USBD_EXCLUSIVE_USE, &sc->cdce_bulkin_pipe);
if (err) {
- printf("%s: open rx pipe failed: %s\n", USBDEVNAME(sc->cdce_dev),
+ printf("%s: open rx pipe failed: %s\n", device_xname(sc->cdce_dev),
usbd_errstr(err));
splx(s);
return;
@@ -568,7 +579,7 @@
err = usbd_open_pipe(sc->cdce_data_iface, sc->cdce_bulkout_no,
USBD_EXCLUSIVE_USE, &sc->cdce_bulkout_pipe);
if (err) {
- printf("%s: open tx pipe failed: %s\n", USBDEVNAME(sc->cdce_dev),
+ printf("%s: open tx pipe failed: %s\n", device_xname(sc->cdce_dev),
usbd_errstr(err));
splx(s);
return;
@@ -597,13 +608,13 @@
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
printf("%s: no memory for rx list "
- "-- packet dropped!\n", USBDEVNAME(sc->cdce_dev));
+ "-- packet dropped!\n", device_xname(sc->cdce_dev));
return (ENOBUFS);
}
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
printf("%s: no memory for rx list "
- "-- packet dropped!\n", USBDEVNAME(sc->cdce_dev));
+ "-- packet dropped!\n", device_xname(sc->cdce_dev));
m_freem(m_new);
return (ENOBUFS);
}
@@ -688,7 +699,7 @@
return;
if (sc->cdce_rxeof_errors == 0)
printf("%s: usb error on rx: %s\n",
- USBDEVNAME(sc->cdce_dev), usbd_errstr(status));
+ device_xname(sc->cdce_dev), usbd_errstr(status));
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->cdce_bulkin_pipe);
DELAY(sc->cdce_rxeof_errors * 10000);
@@ -728,7 +739,7 @@
BPF_MTAP(ifp, m);
#endif
- IF_INPUT(ifp, m);
+ (*(ifp)->if_input)((ifp), (m));
done1:
splx(s);
@@ -765,8 +776,8 @@
return;
}
ifp->if_oerrors++;
- printf("%s: usb error on tx: %s\n", USBDEVNAME(sc->cdce_dev),
- usbd_errstr(status));
+ printf("%s: usb error on tx: %s\n", device_xname(sc->cdce_dev),
+ usbd_errstr(status));
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->cdce_bulkout_pipe);
splx(s);
@@ -792,7 +803,7 @@
}
int
-cdce_activate(device_ptr_t self, enum devact act)
+cdce_activate(device_t self, enum devact act)
{
struct cdce_softc *sc = device_private(self);
Index: src/sys/dev/usb/if_cdcereg.h
diff -u src/sys/dev/usb/if_cdcereg.h:1.3 src/sys/dev/usb/if_cdcereg.h:1.4
--- src/sys/dev/usb/if_cdcereg.h:1.3 Thu May 22 01:21:18 2008
+++ src/sys/dev/usb/if_cdcereg.h Fri Sep 4 17:53:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cdcereg.h,v 1.3 2008/05/22 01:21:18 dyoung Exp $ */
+/* $NetBSD: if_cdcereg.h,v 1.4 2009/09/04 17:53:58 dyoung Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <[email protected]>
@@ -66,7 +66,7 @@
};
struct cdce_softc {
- USBBASEDEVICE cdce_dev;
+ device_t cdce_dev;
struct ethercom cdce_ec;
#if NRND > 0
rndsource_element_t rnd_source;
Index: src/sys/dev/usb/if_cuereg.h
diff -u src/sys/dev/usb/if_cuereg.h:1.14 src/sys/dev/usb/if_cuereg.h:1.15
--- src/sys/dev/usb/if_cuereg.h:1.14 Sun Jan 21 22:09:24 2001
+++ src/sys/dev/usb/if_cuereg.h Fri Sep 4 17:53:58 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cuereg.h,v 1.14 2001/01/21 22:09:24 augustss Exp $ */
+/* $NetBSD: if_cuereg.h,v 1.15 2009/09/04 17:53:58 dyoung Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <[email protected]>. All rights reserved.
@@ -165,20 +165,15 @@
};
struct cue_softc {
- USBBASEDEVICE cue_dev;
+ device_t cue_dev;
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
- struct arpcom arpcom;
-#define GET_IFP(sc) (&(sc)->arpcom.ac_if)
-#elif defined(__NetBSD__)
struct ethercom cue_ec;
#if NRND > 0
rndsource_element_t rnd_source;
#endif
#define GET_IFP(sc) (&(sc)->cue_ec.ec_if)
-#endif
- usb_callout_t cue_stat_ch;
+ struct callout cue_stat_ch;
usbd_device_handle cue_udev;
usbd_interface_handle cue_iface;