FreeBSD kernel usb device Code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/condvar.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/ethernet.h>
#include <net/if_types.h>
#include <net/if_media.h>
#include <net/if_vlan_var.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_axereg.h>
#include "miibus_if.h"
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR axe_debug |
#define | AXE_178_MAX_FRAME_BURST 1 |
#define | AXE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) |
#define | AXE_DEV(v, p, i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } |
#define | AXE_GPIO_WRITE(x, y) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | axe_attach_post_sub (struct usb_ether *) |
static int | axe_ifmedia_upd (struct ifnet *) |
static void | axe_ifmedia_sts (struct ifnet *, struct ifmediareq *) |
static int | axe_cmd (struct axe_softc *, int, int, int, void *) |
static void | axe_ax88178_init (struct axe_softc *) |
static void | axe_ax88772_init (struct axe_softc *) |
static void | axe_ax88772_phywake (struct axe_softc *) |
static void | axe_ax88772a_init (struct axe_softc *) |
static void | axe_ax88772b_init (struct axe_softc *) |
static int | axe_get_phyno (struct axe_softc *, int) |
static int | axe_ioctl (struct ifnet *, u_long, caddr_t) |
static int | axe_rx_frame (struct usb_ether *, struct usb_page_cache *, int) |
static int | axe_rxeof (struct usb_ether *, struct usb_page_cache *, unsigned int offset, unsigned int, struct axe_csum_hdr *) |
static void | axe_csum_cfg (struct usb_ether *) |
DRIVER_MODULE (axe, uhub, axe_driver, axe_devclass, NULL, 0) | |
DRIVER_MODULE (miibus, axe, miibus_driver, miibus_devclass, 0, 0) | |
MODULE_DEPEND (axe, uether, 1, 1, 1) | |
MODULE_DEPEND (axe, usb, 1, 1, 1) | |
MODULE_DEPEND (axe, ether, 1, 1, 1) | |
MODULE_DEPEND (axe, miibus, 1, 1, 1) | |
MODULE_VERSION (axe, 1) | |
USB_PNP_HOST_INFO (axe_devs) | |
static int | axe_miibus_readreg (device_t dev, int phy, int reg) |
static int | axe_miibus_writereg (device_t dev, int phy, int reg, int val) |
static void | axe_miibus_statchg (device_t dev) |
static u_int | axe_hash_maddr (void *arg, struct sockaddr_dl *sdl, u_int cnt) |
static void | axe_setmulti (struct usb_ether *ue) |
static void | axe_reset (struct axe_softc *sc) |
static void | axe_attach_post (struct usb_ether *ue) |
static int | axe_probe (device_t dev) |
static int | axe_attach (device_t dev) |
static int | axe_detach (device_t dev) |
static void | axe_bulk_read_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | axe_bulk_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | axe_tick (struct usb_ether *ue) |
static void | axe_start (struct usb_ether *ue) |
static void | axe_init (struct usb_ether *ue) |
static void | axe_setpromisc (struct usb_ether *ue) |
static void | axe_stop (struct usb_ether *ue) |
Variables | |
static const STRUCT_USB_HOST_ID | axe_devs [] |
static device_probe_t | axe_probe |
static device_attach_t | axe_attach |
static device_detach_t | axe_detach |
static usb_callback_t | axe_bulk_read_callback |
static usb_callback_t | axe_bulk_write_callback |
static miibus_readreg_t | axe_miibus_readreg |
static miibus_writereg_t | axe_miibus_writereg |
static miibus_statchg_t | axe_miibus_statchg |
static uether_fn_t | axe_attach_post |
static uether_fn_t | axe_init |
static uether_fn_t | axe_stop |
static uether_fn_t | axe_start |
static uether_fn_t | axe_tick |
static uether_fn_t | axe_setmulti |
static uether_fn_t | axe_setpromisc |
static const struct usb_config | axe_config [AXE_N_TRANSFER] |
static const struct ax88772b_mfb | ax88772b_mfb_table [] |
static device_method_t | axe_methods [] |
static driver_t | axe_driver |
static devclass_t | axe_devclass |
static const struct usb_ether_methods | axe_ue_methods |
#define AXE_DEV | ( | v, | |
p, | |||
i | |||
) | { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } |
#define AXE_GPIO_WRITE | ( | x, | |
y | |||
) |
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 936 of file if_axe.c.
References axe_config, axe_detach, AXE_IFACE_IDX, AXE_N_TRANSFER, axe_ue_methods, dev, usb_attach_arg::device, device_set_usb_desc(), error, axe_softc::sc_flags, axe_softc::sc_mtx, axe_softc::sc_ue, axe_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 819 of file if_axe.c.
References AXE_172_CMD_READ_NODEID, AXE_178_CMD_READ_NODEID, axe_ax88178_init(), axe_ax88772_init(), axe_ax88772a_init(), axe_ax88772b_init(), axe_cmd(), AXE_CMD_READ_IPG012, AXE_CMD_READ_PHYID, AXE_FLAG_178, AXE_FLAG_772, AXE_FLAG_772A, AXE_FLAG_772B, axe_get_phyno(), AXE_PHY_SEL_PRI, AXE_PHY_SEL_SEC, axe_softc::sc_flags, axe_softc::sc_ipgs, axe_softc::sc_phyaddrs, axe_softc::sc_phyno, axe_softc::sc_ue, usb_ether::ue_dev, usb_ether::ue_eaddr, and uether_getsc().
|
static |
Definition at line 867 of file if_axe.c.
References AXE_CSUM_FEATURES, AXE_FLAG_178, AXE_FLAG_772A, AXE_FLAG_772B, axe_ioctl(), AXE_IS_178_FAMILY, error, axe_softc::sc_flags, axe_softc::sc_phyno, usb_ether::ue_dev, usb_ether::ue_ifp, usb_ether::ue_methods, usb_ether_methods::ue_mii_sts, usb_ether::ue_miibus, uether_getsc(), uether_ifmedia_upd(), uether_init(), and uether_start().
|
static |
Definition at line 552 of file if_axe.c.
References AXE_178_RESET_MAGIC, axe_cmd(), AXE_CMD_RXCTL_WRITE, AXE_CMD_SROM_READ, AXE_CMD_SROM_WR_DISABLE, AXE_CMD_SROM_WR_ENABLE, AXE_CMD_SW_PHY_SELECT, AXE_CMD_SW_RESET_REG, AXE_GPIO0, AXE_GPIO0_EN, AXE_GPIO1, AXE_GPIO1_EN, AXE_GPIO2, AXE_GPIO2_EN, AXE_GPIO_RELOAD_EEPROM, AXE_GPIO_WRITE, axe_miibus_readreg, axe_miibus_writereg, AXE_PHY_MODE_AGERE, AXE_PHY_MODE_CICADA, AXE_PHY_MODE_CICADA_V2, AXE_PHY_MODE_CICADA_V2_ASIX, AXE_PHY_MODE_MARVELL, AXE_PHY_MODE_REALTEK_8211BN, AXE_PHY_MODE_REALTEK_8211CL, AXE_PHY_MODE_REALTEK_8251CL, AXE_SW_RESET_CLEAR, AXE_SW_RESET_PRL, axe_softc::sc_phyno, axe_softc::sc_ue, usb_ether::ue_dev, uether_pause(), and val.
Referenced by axe_attach_post(), and axe_reset().
|
static |
Definition at line 669 of file if_axe.c.
References AXE_772_PHY_NO_EPHY, axe_cmd(), AXE_CMD_RXCTL_WRITE, AXE_CMD_SW_PHY_SELECT, AXE_CMD_SW_RESET_REG, AXE_CMD_WRITE_GPIO, AXE_SW_RESET_CLEAR, AXE_SW_RESET_IPPD, AXE_SW_RESET_IPRL, AXE_SW_RESET_PRL, axe_softc::sc_phyno, axe_softc::sc_ue, and uether_pause().
Referenced by axe_attach_post(), and axe_reset().
|
static |
Definition at line 710 of file if_axe.c.
References AXE_772_PHY_NO_EPHY, axe_cmd(), AXE_CMD_SW_PHY_SELECT, AXE_CMD_SW_RESET_REG, AXE_SW_PHY_SELECT_EMBEDDED, AXE_SW_PHY_SELECT_EXT, AXE_SW_PHY_SELECT_SS_ENB, AXE_SW_PHY_SELECT_SS_MII, AXE_SW_RESET_CLEAR, AXE_SW_RESET_IPPD, AXE_SW_RESET_IPRL, axe_softc::sc_phyno, axe_softc::sc_ue, and uether_pause().
Referenced by axe_ax88772a_init(), and axe_ax88772b_init().
|
static |
Definition at line 740 of file if_axe.c.
References axe_ax88772_phywake(), axe_cmd(), AXE_CMD_RXCTL_WRITE, AXE_GPIO_RELOAD_EEPROM, AXE_GPIO_WRITE, and axe_softc::sc_ue.
Referenced by axe_attach_post(), and axe_reset().
|
static |
Definition at line 753 of file if_axe.c.
References axe_ax88772_phywake(), axe_cmd(), AXE_CMD_RXCTL_WRITE, AXE_CMD_SROM_READ, AXE_EEPROM_772B_NODE_ID, AXE_EEPROM_772B_PHY_PWRCFG, AXE_GPIO_RELOAD_EEPROM, AXE_GPIO_WRITE, axe_softc::sc_pwrcfg, axe_softc::sc_ue, and usb_ether::ue_eaddr.
Referenced by axe_attach_post(), and axe_reset().
|
static |
Definition at line 994 of file if_axe.c.
References axe_rx_frame(), DPRINTF, error, axe_softc::sc_ue, uether_rxflush(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, 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 1158 of file if_axe.c.
References AXE_CSUM_FEATURES, AXE_FLAG_LINK, AXE_IS_178_FAMILY, AXE_TX_CSUM_DIS, AXE_TX_CSUM_PSEUDO_HDR, error, axe_sframe_hdr::ilen, axe_sframe_hdr::len, axe_softc::sc_flags, axe_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_frame_offset(), usbd_xfer_set_frames(), usbd_xfer_set_stall(), and usbd_xfer_softc().
|
static |
Definition at line 302 of file if_axe.c.
References AXE_CMD_CMD, AXE_CMD_IS_WRITE, AXE_CMD_LEN, AXE_LOCK_ASSERT, index, req, axe_softc::sc_ue, uether_do_request, USETW, UT_READ_VENDOR_DEVICE, UT_WRITE_VENDOR_DEVICE, and val.
Referenced by axe_attach_post(), axe_ax88178_init(), axe_ax88772_init(), axe_ax88772_phywake(), axe_ax88772a_init(), axe_ax88772b_init(), axe_csum_cfg(), axe_init(), axe_miibus_readreg(), axe_miibus_statchg(), axe_miibus_writereg(), axe_setmulti(), and axe_setpromisc().
|
static |
Definition at line 1300 of file if_axe.c.
References AXE_772B_CMD_WRITE_RXCSUM, AXE_772B_CMD_WRITE_TXCSUM, axe_cmd(), AXE_FLAG_772B, AXE_LOCK_ASSERT, AXE_RXCSUM_ICMP, AXE_RXCSUM_IGMP, AXE_RXCSUM_IP, AXE_RXCSUM_IPVE, AXE_RXCSUM_TCP, AXE_RXCSUM_UDP, AXE_TXCSUM_IP, AXE_TXCSUM_TCP, AXE_TXCSUM_UDP, axe_softc::sc_flags, uether_getifp(), and uether_getsc().
Referenced by axe_init().
|
static |
Definition at line 977 of file if_axe.c.
References AXE_N_TRANSFER, dev, axe_softc::sc_mtx, axe_softc::sc_ue, axe_softc::sc_xfer, uether_ifdetach(), and usbd_transfer_unsetup().
|
static |
Definition at line 523 of file if_axe.c.
References AXE_PHY_NO, AXE_PHY_TYPE, PHY_TYPE_100_HOME, PHY_TYPE_GIG, PHY_TYPE_NON_SUP, PHY_TYPE_RSVD, PHY_TYPE_SPECIAL, and axe_softc::sc_phyaddrs.
Referenced by axe_attach_post().
|
static |
Definition at line 485 of file if_axe.c.
Referenced by axe_setmulti().
|
static |
Definition at line 472 of file if_axe.c.
References AXE_LOCK, AXE_UNLOCK, and GET_MII.
|
static |
Definition at line 453 of file if_axe.c.
References AXE_LOCK_ASSERT, error, and GET_MII.
Referenced by axe_init().
|
static |
Definition at line 1328 of file if_axe.c.
References AX88772B_MFB_16K, ax88772b_mfb_table, AXE_172_CMD_WRITE_IPG0, AXE_172_CMD_WRITE_IPG1, AXE_172_CMD_WRITE_IPG2, AXE_172_CMD_WRITE_NODEID, AXE_172_RXCMD_UNICAST, AXE_178_CMD_WRITE_IPG012, AXE_178_CMD_WRITE_NODEID, AXE_178_RXCMD_MFB_16384, AXE_772B_CMD_RXCTL_WRITE_CFG, AXE_772B_RXCMD_HDR_TYPE_1, AXE_772B_RXCMD_IPHDR_ALIGN, AXE_BULK_DT_WR, axe_cmd(), AXE_CMD_RXCTL_WRITE, axe_csum_cfg(), AXE_CSUM_HDR_LEN_MASK, AXE_FLAG_772B, AXE_FLAG_CSUM_FRAME, AXE_FLAG_STD_FRAME, AXE_HDR_LEN_MASK, axe_ifmedia_upd(), AXE_IS_178_FAMILY, AXE_LOCK_ASSERT, axe_reset(), AXE_RXCMD_BROADCAST, AXE_RXCMD_ENABLE, AXE_RXCMD_MULTICAST, AXE_RXCMD_PROMISC, axe_setmulti, axe_stop, axe_softc::sc_flags, axe_softc::sc_ipgs, axe_softc::sc_lenmask, axe_softc::sc_xfer, uether_getifp(), uether_getsc(), and usbd_xfer_set_stall().
|
static |
Definition at line 1466 of file if_axe.c.
References AXE_CSUM_FEATURES, AXE_LOCK, AXE_UNLOCK, data, error, uether_getsc(), uether_init(), and uether_ioctl().
Referenced by axe_attach_post_sub().
|
static |
Definition at line 323 of file if_axe.c.
References axe_cmd(), AXE_CMD_MII_OPMODE_HW, AXE_CMD_MII_OPMODE_SW, AXE_CMD_MII_READ_REG, AXE_IS_772, AXE_LOCK, AXE_UNLOCK, dev, reg, axe_softc::sc_mtx, and val.
|
static |
Definition at line 374 of file if_axe.c.
References AXE_178_MEDIA_100TX, AXE_178_MEDIA_ENCK, AXE_178_MEDIA_GMII, AXE_178_MEDIA_MAGIC, AXE_178_MEDIA_RX_EN, AXE_178_MEDIA_RXFLOW_CONTROL_EN, AXE_178_MEDIA_TXFLOW_CONTROL_EN, axe_cmd(), AXE_CMD_WRITE_MEDIA, AXE_FLAG_178, AXE_FLAG_LINK, AXE_IS_178_FAMILY, AXE_LOCK, AXE_MEDIA_FULL_DUPLEX, AXE_UNLOCK, dev, GET_MII, axe_softc::sc_flags, axe_softc::sc_mtx, axe_softc::sc_ue, uether_getifp(), and val.
|
static |
Definition at line 354 of file if_axe.c.
References axe_cmd(), AXE_CMD_MII_OPMODE_HW, AXE_CMD_MII_OPMODE_SW, AXE_CMD_MII_WRITE_REG, AXE_LOCK, AXE_UNLOCK, dev, reg, axe_softc::sc_mtx, and val.
|
static |
Definition at line 917 of file if_axe.c.
References AXE_CONFIG_IDX, axe_devs, AXE_IFACE_IDX, usbd_lookup_info::bConfigIndex, usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::info, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
Definition at line 792 of file if_axe.c.
References axe_ax88178_init(), axe_ax88772_init(), axe_ax88772a_init(), axe_ax88772b_init(), AXE_FLAG_178, AXE_FLAG_772, AXE_FLAG_772A, AXE_FLAG_772B, usb_config_descriptor::bConfigurationValue, DPRINTF, axe_softc::sc_flags, axe_softc::sc_mtx, axe_softc::sc_ue, usb_ether::ue_udev, uether_pause(), usbd_get_config_descriptor(), and usbd_req_set_config().
Referenced by axe_init().
|
static |
Definition at line 1029 of file if_axe.c.
References AXE_CSUM_RXBYTES, AXE_FLAG_CSUM_FRAME, AXE_FLAG_STD_FRAME, axe_rxeof(), axe_csum_hdr::cstatus, error, axe_sframe_hdr::ilen, axe_csum_hdr::ilen, len, axe_sframe_hdr::len, axe_csum_hdr::len, axe_softc::sc_flags, axe_softc::sc_lenmask, usb_ether::ue_ifp, uether_getsc(), and usbd_copy_out().
Referenced by axe_bulk_read_callback().
|
static |
Definition at line 1108 of file if_axe.c.
References AXE_CSUM_HDR_L3_CSUM_ERR, AXE_CSUM_HDR_L3_TYPE_IPV4, AXE_CSUM_HDR_L4_CSUM_ERR, AXE_CSUM_HDR_L4_TYPE_MASK, AXE_CSUM_HDR_L4_TYPE_TCP, AXE_CSUM_HDR_L4_TYPE_UDP, axe_csum_hdr::cstatus, len, offset, usb_ether::ue_ifp, usb_ether::ue_rxq, and usbd_copy_out().
Referenced by axe_rx_frame().
|
static |
Definition at line 497 of file if_axe.c.
References axe_cmd(), AXE_CMD_RXCTL_READ, AXE_CMD_RXCTL_WRITE, AXE_CMD_WRITE_MCAST, axe_hash_maddr(), AXE_LOCK_ASSERT, AXE_RXCMD_ALLMULTI, uether_getifp(), and uether_getsc().
|
static |
Definition at line 1426 of file if_axe.c.
References axe_cmd(), AXE_CMD_RXCTL_READ, AXE_CMD_RXCTL_WRITE, AXE_RXCMD_PROMISC, axe_setmulti, uether_getifp(), and uether_getsc().
|
static |
Definition at line 1288 of file if_axe.c.
References AXE_BULK_DT_RD, AXE_BULK_DT_WR, axe_softc::sc_xfer, uether_getsc(), and usbd_transfer_start().
|
static |
Definition at line 1448 of file if_axe.c.
References AXE_BULK_DT_RD, AXE_BULK_DT_WR, AXE_LOCK_ASSERT, axe_softc::sc_flags, axe_softc::sc_xfer, uether_getifp(), uether_getsc(), and usbd_transfer_stop().
|
static |
Definition at line 1272 of file if_axe.c.
References AXE_FLAG_LINK, AXE_LOCK_ASSERT, axe_miibus_statchg, axe_start, GET_MII, axe_softc::sc_flags, usb_ether::ue_dev, and uether_getsc().
DRIVER_MODULE | ( | axe | , |
uhub | , | ||
axe_driver | , | ||
axe_devclass | , | ||
NULL | , | ||
0 | |||
) |
DRIVER_MODULE | ( | miibus | , |
axe | , | ||
miibus_driver | , | ||
miibus_devclass | , | ||
0 | , | ||
0 | |||
) |
MODULE_DEPEND | ( | axe | , |
ether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | axe | , |
miibus | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | axe | , |
uether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | axe | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | axe | , |
1 | |||
) |
USB_PNP_HOST_INFO | ( | axe_devs | ) |
|
static |
Definition at line 246 of file if_axe.c.
Referenced by axe_init().
|
static |
|
static |
|
static |
|
static |
Definition at line 223 of file if_axe.c.
Referenced by axe_attach().
|
static |
Definition at line 190 of file if_axe.c.
Referenced by axe_attach().
|
static |
Definition at line 150 of file if_axe.c.
Referenced by axe_probe().
|
static |
|
static |
|
static |
|
static |
Definition at line 195 of file if_axe.c.
Referenced by axe_ax88178_init().
|
static |
Definition at line 197 of file if_axe.c.
Referenced by axe_tick().
|
static |
Definition at line 196 of file if_axe.c.
Referenced by axe_ax88178_init().
|
static |
Definition at line 204 of file if_axe.c.
Referenced by axe_init(), and axe_setpromisc().
|
static |
|
static |
Definition at line 202 of file if_axe.c.
Referenced by axe_tick().
|
static |
Definition at line 201 of file if_axe.c.
Referenced by axe_init().
|
static |
|
static |
Definition at line 288 of file if_axe.c.
Referenced by axe_attach().