FreeBSD kernel usb device Code
|
#include <sys/cdefs.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/socket.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_media.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include "usbdevs.h"
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/net/usb_ethernet.h>
#include <dev/usb/net/if_auereg.h>
#include "miibus_if.h"
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR aue_debug |
#define | AUE_DEV(v, p, i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } |
#define | AUE_SETBIT(sc, reg, x) aue_csr_write_1(sc, reg, aue_csr_read_1(sc, reg) | (x)) |
#define | AUE_CLRBIT(sc, reg, x) aue_csr_write_1(sc, reg, aue_csr_read_1(sc, reg) & ~(x)) |
#define | AUE_BITS 6 |
Functions | |
__FBSDID ("$FreeBSD$") | |
static uint8_t | aue_csr_read_1 (struct aue_softc *, uint16_t) |
static uint16_t | aue_csr_read_2 (struct aue_softc *, uint16_t) |
static void | aue_csr_write_1 (struct aue_softc *, uint16_t, uint8_t) |
static void | aue_csr_write_2 (struct aue_softc *, uint16_t, uint16_t) |
static uint16_t | aue_eeprom_getword (struct aue_softc *, int) |
static void | aue_reset (struct aue_softc *) |
static void | aue_reset_pegasus_II (struct aue_softc *) |
static int | aue_ifmedia_upd (struct ifnet *) |
static void | aue_ifmedia_sts (struct ifnet *, struct ifmediareq *) |
DRIVER_MODULE (aue, uhub, aue_driver, aue_devclass, NULL, 0) | |
DRIVER_MODULE (miibus, aue, miibus_driver, miibus_devclass, 0, 0) | |
MODULE_DEPEND (aue, uether, 1, 1, 1) | |
MODULE_DEPEND (aue, usb, 1, 1, 1) | |
MODULE_DEPEND (aue, ether, 1, 1, 1) | |
MODULE_DEPEND (aue, miibus, 1, 1, 1) | |
MODULE_VERSION (aue, 1) | |
USB_PNP_HOST_INFO (aue_devs) | |
static void | aue_read_mac (struct aue_softc *sc, uint8_t *eaddr) |
static int | aue_miibus_readreg (device_t dev, int phy, int reg) |
static int | aue_miibus_writereg (device_t dev, int phy, int reg, int data) |
static void | aue_miibus_statchg (device_t dev) |
static u_int | aue_hash_maddr (void *arg, struct sockaddr_dl *sdl, u_int cnt) |
static void | aue_setmulti (struct usb_ether *ue) |
static void | aue_attach_post (struct usb_ether *ue) |
static int | aue_probe (device_t dev) |
static int | aue_attach (device_t dev) |
static int | aue_detach (device_t dev) |
static void | aue_intr_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | aue_bulk_read_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | aue_bulk_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | aue_tick (struct usb_ether *ue) |
static void | aue_start (struct usb_ether *ue) |
static void | aue_init (struct usb_ether *ue) |
static void | aue_setpromisc (struct usb_ether *ue) |
static void | aue_stop (struct usb_ether *ue) |
Variables | |
static const STRUCT_USB_HOST_ID | aue_devs [] |
static device_probe_t | aue_probe |
static device_attach_t | aue_attach |
static device_detach_t | aue_detach |
static miibus_readreg_t | aue_miibus_readreg |
static miibus_writereg_t | aue_miibus_writereg |
static miibus_statchg_t | aue_miibus_statchg |
static usb_callback_t | aue_intr_callback |
static usb_callback_t | aue_bulk_read_callback |
static usb_callback_t | aue_bulk_write_callback |
static uether_fn_t | aue_attach_post |
static uether_fn_t | aue_init |
static uether_fn_t | aue_stop |
static uether_fn_t | aue_start |
static uether_fn_t | aue_tick |
static uether_fn_t | aue_setmulti |
static uether_fn_t | aue_setpromisc |
static const struct usb_config | aue_config [AUE_N_TRANSFER] |
static device_method_t | aue_methods [] |
static driver_t | aue_driver |
static devclass_t | aue_devclass |
static const struct usb_ether_methods | aue_ue_methods |
#define AUE_CLRBIT | ( | sc, | |
reg, | |||
x | |||
) | aue_csr_write_1(sc, reg, aue_csr_read_1(sc, reg) & ~(x)) |
#define AUE_DEV | ( | v, | |
p, | |||
i | |||
) | { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } |
#define AUE_SETBIT | ( | sc, | |
reg, | |||
x | |||
) | aue_csr_write_1(sc, reg, aue_csr_read_1(sc, reg) | (x)) |
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 683 of file if_aue.c.
References aue_config, aue_detach, AUE_FLAG_VER_2, AUE_IFACE_IDX, AUE_N_TRANSFER, aue_ue_methods, usbd_lookup_info::bcdDevice, dev, usb_attach_arg::device, device_set_usb_desc(), error, usb_attach_arg::info, aue_softc::sc_flags, aue_softc::sc_mtx, aue_softc::sc_ue, aue_softc::sc_xfer, usb_ether::ue_dev, usb_ether::ue_methods, usb_ether::ue_mtx, usb_ether::ue_sc, usb_ether::ue_udev, uether_ifattach(), USB_GET_DRIVER_INFO, and usbd_transfer_setup().
|
static |
Definition at line 640 of file if_aue.c.
References aue_read_mac(), aue_reset(), usb_ether::ue_eaddr, and uether_getsc().
|
static |
Definition at line 784 of file if_aue.c.
References AUE_FLAG_VER_2, aue_rxpkt::aue_rxstat, AUE_RXSTAT_MASK, DPRINTF, error, aue_softc::sc_flags, aue_softc::sc_ue, uether_getifp(), uether_rxbuf(), uether_rxflush(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_out(), usbd_errstr(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_max_len(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), usbd_xfer_softc(), and usbd_xfer_status().
|
static |
Definition at line 849 of file if_aue.c.
References AUE_FLAG_LINK, AUE_FLAG_VER_2, error, aue_softc::sc_flags, aue_softc::sc_ue, uether_getifp(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_in(), usbd_errstr(), usbd_m_copy_in(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), usbd_xfer_softc(), and usbd_xfer_status().
|
static |
Definition at line 311 of file if_aue.c.
References AUE_UR_READREG, reg, req, aue_softc::sc_ue, uether_do_request, USETW, UT_READ_VENDOR_DEVICE, and val.
Referenced by aue_eeprom_getword(), aue_miibus_readreg(), aue_miibus_writereg(), and aue_reset().
|
static |
Definition at line 330 of file if_aue.c.
References AUE_UR_READREG, reg, req, aue_softc::sc_ue, uether_do_request, USETW, UT_READ_VENDOR_DEVICE, and val.
Referenced by aue_eeprom_getword(), and aue_miibus_readreg().
|
static |
Definition at line 349 of file if_aue.c.
References AUE_UR_WRITEREG, reg, req, aue_softc::sc_ue, uether_do_request, USETW, UT_WRITE_VENDOR_DEVICE, and val.
Referenced by aue_eeprom_getword(), aue_init(), aue_miibus_readreg(), aue_miibus_writereg(), aue_reset(), aue_reset_pegasus_II(), aue_setmulti(), and aue_stop().
|
static |
Definition at line 366 of file if_aue.c.
References AUE_UR_WRITEREG, reg, req, aue_softc::sc_ue, uether_do_request, USETW, UT_WRITE_VENDOR_DEVICE, and val.
Referenced by aue_miibus_writereg().
|
static |
Definition at line 729 of file if_aue.c.
References AUE_N_TRANSFER, dev, aue_softc::sc_mtx, aue_softc::sc_ue, aue_softc::sc_xfer, uether_ifdetach(), and usbd_transfer_unsetup().
|
static |
Definition at line 387 of file if_aue.c.
References addr, aue_csr_read_1(), aue_csr_read_2(), aue_csr_write_1(), AUE_EE_CTL, AUE_EE_DATA, AUE_EE_REG, AUE_EECTL_DONE, AUE_EECTL_READ, AUE_TIMEOUT, aue_softc::sc_ue, usb_ether::ue_dev, and uether_pause().
Referenced by aue_read_mac().
|
static |
Definition at line 544 of file if_aue.c.
References AUE_BITS.
Referenced by aue_setmulti().
|
static |
Definition at line 1034 of file if_aue.c.
References AUE_LOCK, AUE_UNLOCK, and GET_MII.
|
static |
Definition at line 1014 of file if_aue.c.
References AUE_LOCK_ASSERT, error, GET_MII, and aue_softc::sc_flags.
|
static |
Definition at line 961 of file if_aue.c.
References AUE_BULK_DT_WR, aue_csr_write_1(), AUE_CTL0, AUE_CTL0_RX_ENB, AUE_CTL0_RXSTAT_APPEND, AUE_CTL0_TX_ENB, AUE_CTL2, AUE_CTL2_EP3_CLR, AUE_LOCK_ASSERT, AUE_PAR0, aue_reset(), AUE_SETBIT, aue_setmulti, aue_setpromisc, aue_start, aue_softc::sc_xfer, uether_getifp(), uether_getsc(), and usbd_xfer_set_stall().
|
static |
Definition at line 742 of file if_aue.c.
References aue_intrpkt::aue_txstat0, AUE_TXSTAT0_EXCESSCOLL, AUE_TXSTAT0_LATECOLL, error, aue_softc::sc_ue, uether_getifp(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_out(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_max_len(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), usbd_xfer_softc(), and usbd_xfer_status().
|
static |
Definition at line 424 of file if_aue.c.
References aue_csr_read_1(), aue_csr_read_2(), aue_csr_write_1(), AUE_FLAG_DUAL_PHY, AUE_LOCK, AUE_PHY_ADDR, AUE_PHY_CTL, AUE_PHY_DATA, AUE_PHYCTL_DONE, AUE_PHYCTL_READ, AUE_TIMEOUT, AUE_UNLOCK, dev, reg, aue_softc::sc_flags, aue_softc::sc_mtx, aue_softc::sc_ue, usb_ether::ue_dev, uether_pause(), and val.
|
static |
Definition at line 504 of file if_aue.c.
References AUE_CLRBIT, AUE_CTL0, AUE_CTL0_RX_ENB, AUE_CTL0_TX_ENB, AUE_CTL1, AUE_CTL1_DUPLEX, AUE_CTL1_SPEEDSEL, AUE_FLAG_LSYS, AUE_LOCK, aue_miibus_readreg, aue_miibus_writereg, AUE_SETBIT, AUE_UNLOCK, dev, GET_MII, aue_softc::sc_flags, and aue_softc::sc_mtx.
|
static |
Definition at line 471 of file if_aue.c.
References aue_csr_read_1(), aue_csr_write_1(), aue_csr_write_2(), AUE_LOCK, AUE_PHY_ADDR, AUE_PHY_CTL, AUE_PHY_DATA, AUE_PHYCTL_DONE, AUE_PHYCTL_WRITE, AUE_TIMEOUT, AUE_UNLOCK, data, dev, reg, aue_softc::sc_mtx, aue_softc::sc_ue, usb_ether::ue_dev, and uether_pause().
|
static |
Definition at line 655 of file if_aue.c.
References AUE_CONFIG_INDEX, aue_devs, AUE_IFACE_IDX, usbd_lookup_info::bcdDevice, usbd_lookup_info::bConfigIndex, usbd_lookup_info::bIfaceIndex, dev, usbd_lookup_info::idProduct, usbd_lookup_info::idVendor, usb_attach_arg::info, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
Definition at line 411 of file if_aue.c.
References aue_eeprom_getword(), and offset.
Referenced by aue_attach_post().
|
static |
Definition at line 595 of file if_aue.c.
References aue_csr_read_1(), aue_csr_write_1(), AUE_CTL1, AUE_CTL1_RESETMAC, AUE_FLAG_LSYS, AUE_FLAG_PII, AUE_GPIO0, AUE_GPIO_OUT0, AUE_GPIO_SEL0, AUE_GPIO_SEL1, aue_reset_pegasus_II(), AUE_SETBIT, AUE_TIMEOUT, aue_softc::sc_flags, aue_softc::sc_ue, usb_ether::ue_dev, and uether_pause().
Referenced by aue_attach_post(), aue_init(), and aue_stop().
|
static |
Definition at line 581 of file if_aue.c.
References aue_csr_write_1(), AUE_REG_1D, AUE_REG_7B, AUE_REG_81, and aue_softc::sc_flags.
Referenced by aue_reset().
|
static |
Definition at line 556 of file if_aue.c.
References AUE_CLRBIT, aue_csr_write_1(), AUE_CTL0, AUE_CTL0_ALLMULTI, aue_hash_maddr(), AUE_LOCK_ASSERT, AUE_MAR0, AUE_SETBIT, uether_getifp(), and uether_getsc().
|
static |
Definition at line 996 of file if_aue.c.
References AUE_CLRBIT, AUE_CTL2, AUE_CTL2_RX_PROMISC, AUE_LOCK_ASSERT, AUE_SETBIT, uether_getifp(), and uether_getsc().
|
static |
Definition at line 948 of file if_aue.c.
References AUE_BULK_DT_RD, AUE_BULK_DT_WR, AUE_INTR_DT_RD, aue_softc::sc_xfer, uether_getsc(), and usbd_transfer_start().
|
static |
Definition at line 1051 of file if_aue.c.
References AUE_BULK_DT_RD, AUE_BULK_DT_WR, aue_csr_write_1(), AUE_CTL0, AUE_CTL1, AUE_INTR_DT_RD, AUE_LOCK_ASSERT, aue_reset(), aue_softc::sc_flags, aue_softc::sc_xfer, uether_getifp(), uether_getsc(), and usbd_transfer_stop().
|
static |
Definition at line 931 of file if_aue.c.
References AUE_FLAG_LINK, AUE_LOCK_ASSERT, aue_start, GET_MII, aue_softc::sc_flags, and uether_getsc().
DRIVER_MODULE | ( | aue | , |
uhub | , | ||
aue_driver | , | ||
aue_devclass | , | ||
NULL | , | ||
0 | |||
) |
DRIVER_MODULE | ( | miibus | , |
aue | , | ||
miibus_driver | , | ||
miibus_devclass | , | ||
0 | , | ||
0 | |||
) |
MODULE_DEPEND | ( | aue | , |
ether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | aue | , |
miibus | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | aue | , |
uether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | aue | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | aue | , |
1 | |||
) |
USB_PNP_HOST_INFO | ( | aue_devs | ) |
|
static |
|
static |
|
static |
|
static |
Definition at line 231 of file if_aue.c.
Referenced by aue_attach().
|
static |
Definition at line 203 of file if_aue.c.
Referenced by aue_attach().
|
static |
Definition at line 126 of file if_aue.c.
Referenced by aue_probe().
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 204 of file if_aue.c.
Referenced by aue_miibus_statchg().
|
static |
Definition at line 205 of file if_aue.c.
Referenced by aue_miibus_statchg().
|
static |
Definition at line 217 of file if_aue.c.
Referenced by aue_init().
|
static |
Definition at line 218 of file if_aue.c.
Referenced by aue_init().
|
static |
Definition at line 215 of file if_aue.c.
Referenced by aue_init(), and aue_tick().
|
static |
|
static |
|
static |
Definition at line 292 of file if_aue.c.
Referenced by aue_attach().