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_ruereg.h>
#include "miibus_if.h"
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR rue_debug |
#define | RUE_SETBIT(sc, reg, x) rue_csr_write_1(sc, reg, rue_csr_read_1(sc, reg) | (x)) |
#define | RUE_CLRBIT(sc, reg, x) rue_csr_write_1(sc, reg, rue_csr_read_1(sc, reg) & ~(x)) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | rue_read_mem (struct rue_softc *, uint16_t, void *, int) |
static int | rue_write_mem (struct rue_softc *, uint16_t, void *, int) |
static uint8_t | rue_csr_read_1 (struct rue_softc *, uint16_t) |
static uint16_t | rue_csr_read_2 (struct rue_softc *, uint16_t) |
static int | rue_csr_write_1 (struct rue_softc *, uint16_t, uint8_t) |
static int | rue_csr_write_2 (struct rue_softc *, uint16_t, uint16_t) |
static int | rue_csr_write_4 (struct rue_softc *, int, uint32_t) |
static void | rue_reset (struct rue_softc *) |
static int | rue_ifmedia_upd (struct ifnet *) |
static void | rue_ifmedia_sts (struct ifnet *, struct ifmediareq *) |
DRIVER_MODULE_ORDERED (rue, uhub, rue_driver, rue_devclass, NULL, NULL, SI_ORDER_ANY) | |
DRIVER_MODULE (miibus, rue, miibus_driver, miibus_devclass, NULL, NULL) | |
MODULE_DEPEND (rue, uether, 1, 1, 1) | |
MODULE_DEPEND (rue, usb, 1, 1, 1) | |
MODULE_DEPEND (rue, ether, 1, 1, 1) | |
MODULE_DEPEND (rue, miibus, 1, 1, 1) | |
MODULE_VERSION (rue, 1) | |
USB_PNP_HOST_INFO (rue_devs) | |
static int | rue_miibus_readreg (device_t dev, int phy, int reg) |
static int | rue_miibus_writereg (device_t dev, int phy, int reg, int data) |
static void | rue_miibus_statchg (device_t dev) |
static void | rue_setpromisc (struct usb_ether *ue) |
static u_int | rue_hash_maddr (void *arg, struct sockaddr_dl *sdl, u_int cnt) |
static void | rue_setmulti (struct usb_ether *ue) |
static void | rue_attach_post (struct usb_ether *ue) |
static int | rue_probe (device_t dev) |
static int | rue_attach (device_t dev) |
static int | rue_detach (device_t dev) |
static void | rue_intr_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | rue_bulk_read_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | rue_bulk_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | rue_tick (struct usb_ether *ue) |
static void | rue_start (struct usb_ether *ue) |
static void | rue_init (struct usb_ether *ue) |
static void | rue_stop (struct usb_ether *ue) |
Variables | |
static const STRUCT_USB_HOST_ID | rue_devs [] |
static device_probe_t | rue_probe |
static device_attach_t | rue_attach |
static device_detach_t | rue_detach |
static miibus_readreg_t | rue_miibus_readreg |
static miibus_writereg_t | rue_miibus_writereg |
static miibus_statchg_t | rue_miibus_statchg |
static usb_callback_t | rue_intr_callback |
static usb_callback_t | rue_bulk_read_callback |
static usb_callback_t | rue_bulk_write_callback |
static uether_fn_t | rue_attach_post |
static uether_fn_t | rue_init |
static uether_fn_t | rue_stop |
static uether_fn_t | rue_start |
static uether_fn_t | rue_tick |
static uether_fn_t | rue_setmulti |
static uether_fn_t | rue_setpromisc |
static const struct usb_config | rue_config [RUE_N_TRANSFER] |
static device_method_t | rue_methods [] |
static driver_t | rue_driver |
static devclass_t | rue_devclass |
static const struct usb_ether_methods | rue_ue_methods |
#define RUE_CLRBIT | ( | sc, | |
reg, | |||
x | |||
) | rue_csr_write_1(sc, reg, rue_csr_read_1(sc, reg) & ~(x)) |
#define RUE_SETBIT | ( | sc, | |
reg, | |||
x | |||
) | rue_csr_write_1(sc, reg, rue_csr_read_1(sc, reg) | (x)) |
__FBSDID | ( | "$FreeBSD$" | ) |
DRIVER_MODULE | ( | miibus | , |
rue | , | ||
miibus_driver | , | ||
miibus_devclass | , | ||
NULL | , | ||
NULL | |||
) |
DRIVER_MODULE_ORDERED | ( | rue | , |
uhub | , | ||
rue_driver | , | ||
rue_devclass | , | ||
NULL | , | ||
NULL | , | ||
SI_ORDER_ANY | |||
) |
MODULE_DEPEND | ( | rue | , |
ether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | rue | , |
miibus | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | rue | , |
uether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | rue | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | rue | , |
1 | |||
) |
|
static |
Definition at line 589 of file if_rue.c.
References dev, usb_attach_arg::device, device_set_usb_desc(), error, rue_config, rue_detach, RUE_IFACE_IDX, RUE_N_TRANSFER, rue_ue_methods, rue_softc::sc_mtx, rue_softc::sc_ue, rue_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(), and usbd_transfer_setup().
|
static |
Definition at line 555 of file if_rue.c.
References RUE_EEPROM_IDR0, rue_read_mem(), rue_reset(), usb_ether::ue_eaddr, and uether_getsc().
|
static |
Definition at line 681 of file if_rue.c.
References DPRINTF, error, RUE_RXSTAT_VALID, rue_softc::sc_ue, status, 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 732 of file if_rue.c.
References error, RUE_FLAG_LINK, RUE_MIN_FRAMELEN, rue_softc::sc_flags, rue_softc::sc_ue, uether_getifp(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_errstr(), usbd_frame_zero(), usbd_m_copy_in(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), and usbd_xfer_softc().
|
static |
Definition at line 274 of file if_rue.c.
References reg, rue_read_mem(), and val.
Referenced by rue_miibus_readreg(), and rue_reset().
|
static |
Definition at line 283 of file if_rue.c.
References reg, rue_read_mem(), UGETW, and val.
Referenced by rue_miibus_readreg(), rue_miibus_statchg(), and rue_setmulti().
|
static |
Definition at line 292 of file if_rue.c.
References reg, rue_write_mem(), and val.
Referenced by rue_init(), rue_miibus_writereg(), rue_reset(), and rue_stop().
|
static |
Definition at line 298 of file if_rue.c.
References reg, rue_write_mem(), USETW, and val.
Referenced by rue_init(), rue_miibus_statchg(), rue_miibus_writereg(), and rue_setmulti().
|
static |
Definition at line 307 of file if_rue.c.
References reg, rue_write_mem(), USETDW, and val.
Referenced by rue_setmulti().
|
static |
Definition at line 628 of file if_rue.c.
References dev, RUE_N_TRANSFER, rue_softc::sc_mtx, rue_softc::sc_ue, rue_softc::sc_xfer, uether_ifdetach(), and usbd_transfer_unsetup().
|
static |
Definition at line 477 of file if_rue.c.
Referenced by rue_setmulti().
|
static |
Definition at line 896 of file if_rue.c.
References GET_MII, RUE_LOCK, and RUE_UNLOCK.
|
static |
Definition at line 876 of file if_rue.c.
References error, GET_MII, RUE_LOCK_ASSERT, and rue_softc::sc_flags.
|
static |
Definition at line 835 of file if_rue.c.
References RUE_BULK_DT_WR, RUE_CR, RUE_CR_EP3CLREN, RUE_CR_RE, RUE_CR_TE, rue_csr_write_1(), rue_csr_write_2(), RUE_IDR0, RUE_LOCK_ASSERT, RUE_RCR, RUE_RCR_AB, RUE_RCR_CONFIG, rue_reset(), rue_setmulti, rue_setpromisc, rue_start, rue_stop, RUE_TCR, RUE_TCR_CONFIG, rue_write_mem(), rue_softc::sc_xfer, uether_getifp(), uether_getsc(), and usbd_xfer_set_stall().
|
static |
Definition at line 641 of file if_rue.c.
References error, rue_intrpkt::rue_col_cnt, rue_intrpkt::rue_crcerr_cnt, rue_intrpkt::rue_rxlost_cnt, rue_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 316 of file if_rue.c.
References dev, reg, RUE_AER, RUE_ANAR, RUE_ANLP, RUE_BMCR, RUE_BMSR, rue_csr_read_1(), rue_csr_read_2(), RUE_LOCK, RUE_REG_MAX, RUE_REG_MIN, RUE_UNLOCK, rue_softc::sc_mtx, rue_softc::sc_ue, and usb_ether::ue_dev.
|
static |
Definition at line 416 of file if_rue.c.
References dev, GET_MII, RUE_BMCR, RUE_BMCR_DUPLEX, RUE_BMCR_SPD_SET, RUE_CLRBIT, RUE_CR, RUE_CR_RE, RUE_CR_TE, rue_csr_read_2(), rue_csr_write_2(), RUE_LOCK, RUE_SETBIT, RUE_UNLOCK, and rue_softc::sc_mtx.
|
static |
Definition at line 368 of file if_rue.c.
References data, dev, reg, RUE_AER, RUE_ANAR, RUE_ANLP, RUE_BMCR, RUE_BMSR, rue_csr_write_1(), rue_csr_write_2(), RUE_LOCK, RUE_REG_MAX, RUE_REG_MIN, RUE_UNLOCK, rue_softc::sc_mtx, rue_softc::sc_ue, and usb_ether::ue_dev.
|
static |
Definition at line 570 of file if_rue.c.
References usbd_lookup_info::bConfigIndex, usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::info, RUE_CONFIG_IDX, rue_devs, RUE_IFACE_IDX, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
Definition at line 246 of file if_rue.c.
References addr, len, req, rue_softc::sc_ue, uether_do_request, UR_SET_ADDRESS, USETW, and UT_READ_VENDOR_DEVICE.
Referenced by rue_attach_post(), rue_csr_read_1(), and rue_csr_read_2().
|
static |
Definition at line 536 of file if_rue.c.
References RUE_CR, RUE_CR_SOFT_RST, rue_csr_read_1(), rue_csr_write_1(), RUE_TIMEOUT, rue_softc::sc_ue, usb_ether::ue_dev, and uether_pause().
Referenced by rue_attach_post(), rue_init(), and rue_stop().
|
static |
Definition at line 495 of file if_rue.c.
References rue_csr_read_2(), rue_csr_write_2(), rue_csr_write_4(), rue_hash_maddr(), RUE_LOCK_ASSERT, RUE_MAR0, RUE_MAR4, RUE_RCR, RUE_RCR_AAM, RUE_RCR_AAP, RUE_RCR_AM, uether_getifp(), and uether_getsc().
|
static |
Definition at line 462 of file if_rue.c.
References RUE_CLRBIT, RUE_LOCK_ASSERT, RUE_RCR, RUE_RCR_AAP, RUE_SETBIT, uether_getifp(), and uether_getsc().
|
static |
Definition at line 822 of file if_rue.c.
References RUE_BULK_DT_RD, RUE_BULK_DT_WR, RUE_INTR_DT_RD, rue_softc::sc_xfer, uether_getsc(), and usbd_transfer_start().
|
static |
Definition at line 909 of file if_rue.c.
References RUE_BULK_DT_RD, RUE_BULK_DT_WR, RUE_CR, rue_csr_write_1(), RUE_INTR_DT_RD, RUE_LOCK_ASSERT, rue_reset(), rue_softc::sc_flags, rue_softc::sc_xfer, uether_getifp(), uether_getsc(), and usbd_transfer_stop().
|
static |
Definition at line 805 of file if_rue.c.
References GET_MII, RUE_FLAG_LINK, RUE_LOCK_ASSERT, rue_start, rue_softc::sc_flags, and uether_getsc().
|
static |
Definition at line 260 of file if_rue.c.
References addr, len, req, rue_softc::sc_ue, uether_do_request, UR_SET_ADDRESS, USETW, and UT_WRITE_VENDOR_DEVICE.
Referenced by rue_csr_write_1(), rue_csr_write_2(), rue_csr_write_4(), and rue_init().
USB_PNP_HOST_INFO | ( | rue_devs | ) |
|
static |
|
static |
|
static |
|
static |
Definition at line 164 of file if_rue.c.
Referenced by rue_attach().
|
static |
Definition at line 134 of file if_rue.c.
Referenced by rue_attach().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 149 of file if_rue.c.
Referenced by rue_init().
|
static |
Definition at line 150 of file if_rue.c.
Referenced by rue_init().
|
static |
Definition at line 147 of file if_rue.c.
Referenced by rue_init(), and rue_tick().
|
static |
Definition at line 146 of file if_rue.c.
Referenced by rue_init().
|
static |
|
static |
Definition at line 227 of file if_rue.c.
Referenced by rue_attach().