FreeBSD kernel usb device Code
if_ure.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/condvar.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/sbuf.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/unistd.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_media.h>
#include <netinet/in.h>
#include <netinet/ip.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_urereg.h>
#include "miibus_if.h"
#include "opt_inet6.h"
Include dependency graph for if_ure.c:

Go to the source code of this file.

Macros

#define USB_DEBUG_VAR   ure_debug
 
#define DEVPRINTF(...)   do { } while (0)
 
#define DEVPRINTFN(...)   do { } while (0)
 
#define URE_DEV(v, p, i)
 
#define URE_SETBIT_1(sc, reg, index, x)    ure_write_1(sc, reg, index, ure_read_1(sc, reg, index) | (x))
 
#define URE_SETBIT_2(sc, reg, index, x)    ure_write_2(sc, reg, index, ure_read_2(sc, reg, index) | (x))
 
#define URE_SETBIT_4(sc, reg, index, x)    ure_write_4(sc, reg, index, ure_read_4(sc, reg, index) | (x))
 
#define URE_CLRBIT_1(sc, reg, index, x)    ure_write_1(sc, reg, index, ure_read_1(sc, reg, index) & ~(x))
 
#define URE_CLRBIT_2(sc, reg, index, x)    ure_write_2(sc, reg, index, ure_read_2(sc, reg, index) & ~(x))
 
#define URE_CLRBIT_4(sc, reg, index, x)    ure_write_4(sc, reg, index, ure_read_4(sc, reg, index) & ~(x))
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int ure_ctl (struct ure_softc *, uint8_t, uint16_t, uint16_t, void *, int)
 
static int ure_read_mem (struct ure_softc *, uint16_t, uint16_t, void *, int)
 
static int ure_write_mem (struct ure_softc *, uint16_t, uint16_t, void *, int)
 
static uint8_t ure_read_1 (struct ure_softc *, uint16_t, uint16_t)
 
static uint16_t ure_read_2 (struct ure_softc *, uint16_t, uint16_t)
 
static uint32_t ure_read_4 (struct ure_softc *, uint16_t, uint16_t)
 
static int ure_write_1 (struct ure_softc *, uint16_t, uint16_t, uint32_t)
 
static int ure_write_2 (struct ure_softc *, uint16_t, uint16_t, uint32_t)
 
static int ure_write_4 (struct ure_softc *, uint16_t, uint16_t, uint32_t)
 
static uint16_t ure_ocp_reg_read (struct ure_softc *, uint16_t)
 
static void ure_ocp_reg_write (struct ure_softc *, uint16_t, uint16_t)
 
static void ure_sram_write (struct ure_softc *, uint16_t, uint16_t)
 
static int ure_sysctl_chipver (SYSCTL_HANDLER_ARGS)
 
static void ure_read_chipver (struct ure_softc *)
 
static int ure_attach_post_sub (struct usb_ether *)
 
static void ure_reset (struct ure_softc *)
 
static int ure_ifmedia_upd (struct ifnet *)
 
static void ure_ifmedia_sts (struct ifnet *, struct ifmediareq *)
 
static void ure_add_media_types (struct ure_softc *)
 
static void ure_link_state (struct ure_softc *sc)
 
static int ure_get_link_status (struct ure_softc *)
 
static int ure_ioctl (struct ifnet *, u_long, caddr_t)
 
static void ure_rtl8152_init (struct ure_softc *)
 
static void ure_rtl8152_nic_reset (struct ure_softc *)
 
static void ure_rtl8153_init (struct ure_softc *)
 
static void ure_rtl8153b_init (struct ure_softc *)
 
static void ure_rtl8153b_nic_reset (struct ure_softc *)
 
static void ure_disable_teredo (struct ure_softc *)
 
static void ure_enable_aldps (struct ure_softc *, bool)
 
static uint16_t ure_phy_status (struct ure_softc *, uint16_t)
 
static void ure_rxcsum (int capenb, struct ure_rxpkt *rp, struct mbuf *m)
 
static int ure_txcsum (struct mbuf *m, int caps, uint32_t *regout)
 
 DRIVER_MODULE (ure, uhub, ure_driver, ure_devclass, NULL, NULL)
 
 DRIVER_MODULE (miibus, ure, miibus_driver, miibus_devclass, NULL, NULL)
 
 MODULE_DEPEND (ure, uether, 1, 1, 1)
 
 MODULE_DEPEND (ure, usb, 1, 1, 1)
 
 MODULE_DEPEND (ure, ether, 1, 1, 1)
 
 MODULE_DEPEND (ure, miibus, 1, 1, 1)
 
 MODULE_VERSION (ure, 1)
 
 USB_PNP_HOST_INFO (ure_devs)
 
static int ure_miibus_readreg (device_t dev, int phy, int reg)
 
static int ure_miibus_writereg (device_t dev, int phy, int reg, int val)
 
static void ure_miibus_statchg (device_t dev)
 
static int ure_probe (device_t dev)
 
static int ure_attach (device_t dev)
 
static int ure_detach (device_t dev)
 
static struct mbuf * ure_makembuf (struct usb_page_cache *pc, usb_frlength_t offset, usb_frlength_t len)
 
static void ure_bulk_read_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void ure_bulk_write_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void ure_attach_post (struct usb_ether *ue)
 
static void ure_init (struct usb_ether *ue)
 
static void ure_tick (struct usb_ether *ue)
 
static u_int ure_hash_maddr (void *arg, struct sockaddr_dl *sdl, u_int cnt)
 
static void ure_rxfilter (struct usb_ether *ue)
 
static void ure_start (struct usb_ether *ue)
 
static void ure_stop (struct usb_ether *ue)
 

Variables

static const STRUCT_USB_HOST_ID ure_devs []
 
static device_probe_t ure_probe
 
static device_attach_t ure_attach
 
static device_detach_t ure_detach
 
static usb_callback_t ure_bulk_read_callback
 
static usb_callback_t ure_bulk_write_callback
 
static miibus_readreg_t ure_miibus_readreg
 
static miibus_writereg_t ure_miibus_writereg
 
static miibus_statchg_t ure_miibus_statchg
 
static uether_fn_t ure_attach_post
 
static uether_fn_t ure_init
 
static uether_fn_t ure_stop
 
static uether_fn_t ure_start
 
static uether_fn_t ure_tick
 
static uether_fn_t ure_rxfilter
 
static device_method_t ure_methods []
 
static driver_t ure_driver
 
static devclass_t ure_devclass
 
static const struct usb_ether_methods ure_ue_methods
 

Macro Definition Documentation

◆ DEVPRINTF

#define DEVPRINTF (   ...)    do { } while (0)

Definition at line 89 of file if_ure.c.

◆ DEVPRINTFN

#define DEVPRINTFN (   ...)    do { } while (0)

Definition at line 90 of file if_ure.c.

◆ URE_CLRBIT_1

#define URE_CLRBIT_1 (   sc,
  reg,
  index,
 
)     ure_write_1(sc, reg, index, ure_read_1(sc, reg, index) & ~(x))

Definition at line 223 of file if_ure.c.

◆ URE_CLRBIT_2

#define URE_CLRBIT_2 (   sc,
  reg,
  index,
 
)     ure_write_2(sc, reg, index, ure_read_2(sc, reg, index) & ~(x))

Definition at line 225 of file if_ure.c.

◆ URE_CLRBIT_4

#define URE_CLRBIT_4 (   sc,
  reg,
  index,
 
)     ure_write_4(sc, reg, index, ure_read_4(sc, reg, index) & ~(x))

Definition at line 227 of file if_ure.c.

◆ URE_DEV

#define URE_DEV (   v,
  p,
 
)
Value:
{ \
USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i), \
USB_IFACE_CLASS(UICLASS_VENDOR), \
USB_IFACE_SUBCLASS(UISUBCLASS_VENDOR) }
#define UICLASS_VENDOR
Definition: usb.h:520
#define UISUBCLASS_VENDOR
Definition: usb.h:522

◆ URE_SETBIT_1

#define URE_SETBIT_1 (   sc,
  reg,
  index,
 
)     ure_write_1(sc, reg, index, ure_read_1(sc, reg, index) | (x))

Definition at line 216 of file if_ure.c.

◆ URE_SETBIT_2

#define URE_SETBIT_2 (   sc,
  reg,
  index,
 
)     ure_write_2(sc, reg, index, ure_read_2(sc, reg, index) | (x))

Definition at line 218 of file if_ure.c.

◆ URE_SETBIT_4

#define URE_SETBIT_4 (   sc,
  reg,
  index,
 
)     ure_write_4(sc, reg, index, ure_read_4(sc, reg, index) | (x))

Definition at line 220 of file if_ure.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   ure_debug

Definition at line 59 of file if_ure.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE() [1/2]

DRIVER_MODULE ( miibus  ,
ure  ,
miibus_driver  ,
miibus_devclass  ,
NULL  ,
NULL   
)

◆ DRIVER_MODULE() [2/2]

DRIVER_MODULE ( ure  ,
uhub  ,
ure_driver  ,
ure_devclass  ,
NULL  ,
NULL   
)

◆ MODULE_DEPEND() [1/4]

MODULE_DEPEND ( ure  ,
ether  ,
,
,
 
)

◆ MODULE_DEPEND() [2/4]

MODULE_DEPEND ( ure  ,
miibus  ,
,
,
 
)

◆ MODULE_DEPEND() [3/4]

MODULE_DEPEND ( ure  ,
uether  ,
,
,
 
)

◆ MODULE_DEPEND() [4/4]

MODULE_DEPEND ( ure  ,
usb  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( ure  ,
 
)

◆ ure_add_media_types()

static void ure_add_media_types ( struct ure_softc sc)
static

Definition at line 1391 of file if_ure.c.

References ure_softc::sc_ifmedia.

Referenced by ure_attach_post_sub().

Here is the caller graph for this function:

◆ ure_attach()

◆ ure_attach_post()

◆ ure_attach_post_sub()

◆ ure_bulk_read_callback()

◆ ure_bulk_write_callback()

◆ ure_ctl()

static int ure_ctl ( struct ure_softc sc,
uint8_t  rw,
uint16_t  val,
uint16_t  index,
void *  buf,
int  len 
)
static

Definition at line 231 of file if_ure.c.

References index, len, req, ure_softc::sc_ue, uether_do_request, UR_SET_ADDRESS, URE_CTL_WRITE, URE_LOCK_ASSERT, USETW, UT_READ_VENDOR_DEVICE, UT_WRITE_VENDOR_DEVICE, and val.

Referenced by ure_read_mem(), and ure_write_mem().

Here is the caller graph for this function:

◆ ure_detach()

static int ure_detach ( device_t  dev)
static

Definition at line 585 of file if_ure.c.

References dev, ure_softc::sc_mtx, ure_softc::sc_rx_xfer, ure_softc::sc_tx_xfer, ure_softc::sc_ue, uether_ifdetach(), URE_MAX_RX, URE_MAX_TX, and usbd_transfer_unsetup().

Here is the call graph for this function:

◆ ure_disable_teredo()

static void ure_disable_teredo ( struct ure_softc sc)
static

◆ ure_enable_aldps()

static void ure_enable_aldps ( struct ure_softc sc,
bool  enable 
)
static

Definition at line 2010 of file if_ure.c.

References ure_softc::sc_ue, uether_pause(), URE_DIS_SDSAVE, URE_EN_ALDPS, URE_ENPDNPS, URE_LINKENA, URE_OCP_ALDPS_CONFIG, URE_OCP_POWER_CFG, ure_ocp_reg_read(), and ure_ocp_reg_write().

Referenced by ure_rtl8152_init(), ure_rtl8153_init(), ure_rtl8153b_init(), and ure_rtl8153b_nic_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_get_link_status()

static int ure_get_link_status ( struct ure_softc sc)
static

Definition at line 1426 of file if_ure.c.

References ure_softc::sc_flags, URE_FLAG_LINK, URE_MCU_TYPE_PLA, URE_PHYSTATUS_LINK, URE_PLA_PHYSTATUS, and ure_read_2().

Referenced by ure_ifmedia_sts(), ure_link_state(), and ure_rtl8153b_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_hash_maddr()

static u_int ure_hash_maddr ( void *  arg,
struct sockaddr_dl *  sdl,
u_int  cnt 
)
static

Definition at line 1177 of file if_ure.c.

Referenced by ure_rxfilter().

Here is the caller graph for this function:

◆ ure_ifmedia_sts()

static void ure_ifmedia_sts ( struct ifnet *  ifp,
struct ifmediareq *  ifmr 
)
static

◆ ure_ifmedia_upd()

static int ure_ifmedia_upd ( struct ifnet *  ifp)
static

Definition at line 1269 of file if_ure.c.

References error, GET_MII, reg, ure_softc::sc_flags, ure_softc::sc_ifmedia, ure_softc::sc_mtx, ure_softc::sc_ue, usb_ether::ue_dev, URE_ADV_2500TFDX, URE_FLAG_8156, URE_FLAG_8156B, URE_LOCK, URE_LOCK_ASSERT, URE_OCP_BASE_MII, ure_ocp_reg_read(), ure_ocp_reg_write(), and URE_UNLOCK.

Referenced by ure_attach_post_sub(), and ure_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_init()

◆ ure_ioctl()

static int ure_ioctl ( struct ifnet *  ifp,
u_long  cmd,
caddr_t  data 
)
static

Definition at line 1439 of file if_ure.c.

References data, error, ure_softc::sc_flags, ure_softc::sc_ifmedia, uether_getsc(), uether_init(), uether_ioctl(), URE_FLAG_8156, URE_FLAG_8156B, URE_LOCK, and URE_UNLOCK.

Referenced by ure_attach_post_sub().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_link_state()

static void ure_link_state ( struct ure_softc sc)
static

Definition at line 1402 of file if_ure.c.

References ure_softc::sc_ue, uether_getifp(), URE_CLRBIT_2, URE_CR_RE, URE_CR_TE, ure_get_link_status(), URE_MCU_TYPE_PLA, URE_PHYSTATUS_2500MBPS, URE_PLA_CR, URE_PLA_MAC_PWR_CTRL4, URE_PLA_PHYSTATUS, ure_read_2(), URE_SETBIT_1, and URE_SETBIT_2.

Referenced by ure_tick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_makembuf()

static struct mbuf * ure_makembuf ( struct usb_page_cache pc,
usb_frlength_t  offset,
usb_frlength_t  len 
)
static

Definition at line 605 of file if_ure.c.

References len, offset, and usbd_copy_out().

Referenced by ure_bulk_read_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_miibus_readreg()

static int ure_miibus_readreg ( device_t  dev,
int  phy,
int  reg 
)
static

Definition at line 390 of file if_ure.c.

References dev, reg, ure_softc::sc_mtx, URE_GMEDIASTAT, URE_LOCK, URE_MCU_TYPE_PLA, URE_OCP_BASE_MII, ure_ocp_reg_read(), ure_read_1(), URE_UNLOCK, and val.

Here is the call graph for this function:

◆ ure_miibus_statchg()

static void ure_miibus_statchg ( device_t  dev)
static

Definition at line 437 of file if_ure.c.

References dev, GET_MII, ure_softc::sc_flags, ure_softc::sc_mtx, ure_softc::sc_rxstarted, ure_softc::sc_ue, uether_getifp(), URE_FLAG_8152, URE_FLAG_LINK, URE_LOCK, and URE_UNLOCK.

Here is the call graph for this function:

◆ ure_miibus_writereg()

static int ure_miibus_writereg ( device_t  dev,
int  phy,
int  reg,
int  val 
)
static

Definition at line 416 of file if_ure.c.

References dev, reg, ure_softc::sc_mtx, ure_softc::sc_phyno, URE_LOCK, URE_OCP_BASE_MII, ure_ocp_reg_write(), URE_UNLOCK, and val.

Here is the call graph for this function:

◆ ure_ocp_reg_read()

static uint16_t ure_ocp_reg_read ( struct ure_softc sc,
uint16_t  addr 
)
static

Definition at line 361 of file if_ure.c.

References addr, reg, URE_MCU_TYPE_PLA, URE_PLA_OCP_GPHY_BASE, ure_read_2(), and ure_write_2().

Referenced by ure_enable_aldps(), ure_ifmedia_upd(), ure_miibus_readreg(), ure_phy_status(), ure_rtl8153_init(), and ure_rtl8153b_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_ocp_reg_write()

static void ure_ocp_reg_write ( struct ure_softc sc,
uint16_t  addr,
uint16_t  data 
)
static

Definition at line 372 of file if_ure.c.

References addr, data, reg, URE_MCU_TYPE_PLA, URE_PLA_OCP_GPHY_BASE, and ure_write_2().

Referenced by ure_enable_aldps(), ure_ifmedia_upd(), ure_miibus_writereg(), ure_rtl8153_init(), ure_rtl8153b_init(), and ure_sram_write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_phy_status()

static uint16_t ure_phy_status ( struct ure_softc sc,
uint16_t  desired 
)
static

Definition at line 2029 of file if_ure.c.

References ure_softc::sc_ue, usb_ether::ue_dev, uether_pause(), URE_OCP_PHY_STATUS, ure_ocp_reg_read(), URE_PHY_STAT_EXT_INIT, URE_PHY_STAT_LAN_ON, URE_PHY_STAT_MASK, URE_PHY_STAT_PWRDN, URE_TIMEOUT, and val.

Referenced by ure_rtl8153b_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_probe()

static int ure_probe ( device_t  dev)
static

Definition at line 487 of file if_ure.c.

References usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::info, ure_devs, URE_IFACE_IDX, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().

Here is the call graph for this function:

◆ ure_read_1()

static uint8_t ure_read_1 ( struct ure_softc sc,
uint16_t  reg,
uint16_t  index 
)
static

Definition at line 267 of file if_ure.c.

References index, reg, UGETDW, ure_read_mem(), and val.

Referenced by ure_miibus_readreg(), ure_reset(), ure_rtl8152_nic_reset(), ure_rtl8153_init(), ure_rtl8153b_init(), and ure_rtl8153b_nic_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_read_2()

static uint16_t ure_read_2 ( struct ure_softc sc,
uint16_t  reg,
uint16_t  index 
)
static

Definition at line 284 of file if_ure.c.

References index, reg, UGETDW, ure_read_mem(), and val.

Referenced by ure_get_link_status(), ure_ifmedia_sts(), ure_init(), ure_link_state(), ure_ocp_reg_read(), ure_read_chipver(), ure_rtl8153_init(), ure_rtl8153b_init(), and ure_rtl8153b_nic_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_read_4()

static uint32_t ure_read_4 ( struct ure_softc sc,
uint16_t  reg,
uint16_t  index 
)
static

Definition at line 301 of file if_ure.c.

References index, reg, UGETDW, and ure_read_mem().

Referenced by ure_rtl8152_init(), ure_rtl8152_nic_reset(), ure_rtl8153b_nic_reset(), and ure_rxfilter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_read_chipver()

◆ ure_read_mem()

static int ure_read_mem ( struct ure_softc sc,
uint16_t  addr,
uint16_t  index,
void *  buf,
int  len 
)
static

Definition at line 251 of file if_ure.c.

References addr, index, len, ure_ctl(), and URE_CTL_READ.

Referenced by ure_attach_post(), ure_read_1(), ure_read_2(), and ure_read_4().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_reset()

static void ure_reset ( struct ure_softc sc)
static

Definition at line 1249 of file if_ure.c.

References ure_softc::sc_ue, usb_ether::ue_dev, uether_pause(), URE_CR_RST, URE_MCU_TYPE_PLA, URE_PLA_CR, ure_read_1(), URE_TIMEOUT, and ure_write_1().

Referenced by ure_init(), ure_rtl8152_nic_reset(), and ure_rtl8153b_nic_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_rtl8152_init()

◆ ure_rtl8152_nic_reset()

◆ ure_rtl8153_init()

static void ure_rtl8153_init ( struct ure_softc sc)
static

Definition at line 1558 of file if_ure.c.

References ure_softc::sc_chip, ure_softc::sc_ue, usb_ether::ue_dev, usb_ether::ue_udev, uether_pause(), URE_ADC_EN, URE_ALDPS_SPDWN_RATIO, URE_AUTOLOAD_DONE, URE_BYTE_EN_SIX_BYTES, URE_CHIP_VER_5C00, URE_CHIP_VER_5C10, URE_CHIP_VER_5C20, URE_CHIP_VER_5C30, URE_CKADSEL_L, URE_CLRBIT_1, URE_CLRBIT_2, URE_CTAP_SHORT_EN, URE_DYNAMIC_BURST, URE_ECM_ALDPS, URE_EEE_CLKDIV_EN, URE_EEE_SPDWN_EN, URE_EEE_SPDWN_RATIO, URE_EN_10M_BGOFF, URE_EN_10M_PLLOFF, URE_EN_EMI_L, ure_enable_aldps(), URE_EP4_FULL_FC, URE_FIFO_EMPTY_1FB, URE_L1_SPDWN_EN, URE_LED_MODE_MASK, URE_LPM_TIMER_500MS, URE_LPM_TIMER_500US, URE_MCU_TYPE_PLA, URE_MCU_TYPE_USB, URE_OCP_ADC_CFG, URE_OCP_DOWN_SPEED, URE_OCP_EEE_CFG, URE_OCP_PHY_STATUS, URE_OCP_POWER_CFG, ure_ocp_reg_read(), ure_ocp_reg_write(), URE_PCUT_STATUS, URE_PFM_PWM_SWITCH, URE_PHASE2_EN, URE_PHY_STAT_LAN_ON, URE_PHY_STAT_MASK, URE_PHY_STAT_PWRDN, URE_PKT_AVAIL_SPDWN_EN, URE_PLA_BOOT_CTRL, URE_PLA_DMY_REG0, URE_PLA_LED_FEATURE, URE_PLA_MAC_PWR_CTRL, URE_PLA_MAC_PWR_CTRL2, URE_PLA_MAC_PWR_CTRL3, URE_PLA_MAC_PWR_CTRL4, URE_PLA_PHY_PWR, URE_PWD_DN_SCALE, URE_PWR_EN, URE_PWRSAVE_SPDWN_EN, ure_read_1(), ure_read_2(), URE_ROK_EXIT_LPM, ure_rtl8152_nic_reset(), URE_RX_AGG_DISABLE, URE_RX_ZERO_EN, URE_RXDV_SPDWN_EN, URE_SEL_RXIDLE, URE_SEN_VAL_NORMAL, URE_SETBIT_1, URE_SETBIT_2, URE_SRAM_10M_AMP1, URE_SRAM_10M_AMP2, URE_SRAM_IMPEDANCE, URE_SRAM_LPF_CFG, ure_sram_write(), URE_SUSPEND_SPDWN_EN, URE_TIMEOUT, URE_TIMER11_EN, URE_TP1000_SPDWN_EN, URE_TP100_SPDWN_EN, URE_TP500_SPDWN_EN, URE_TX10MIDLE_EN, URE_U1U2_SPDWN_EN, URE_U2P3_ENABLE, URE_USB2PHY_L1, URE_USB2PHY_SUSPEND, URE_USB_AFE_CTRL2, URE_USB_BURST_SIZE, URE_USB_CONNECT_TIMER, URE_USB_CSR_DUMMY1, URE_USB_CSR_DUMMY2, URE_USB_LPM_CTRL, URE_USB_MISC_0, URE_USB_POWER_CUT, URE_USB_SSPHYLINK2, URE_USB_TOLERANCE, URE_USB_U2P3_CTRL, URE_USB_USB2PHY, URE_USB_USB_CTRL, URE_USB_WDT11_CTRL, ure_write_1(), ure_write_2(), ure_write_mem(), USB_SPEED_SUPER, usbd_get_speed(), and val.

Referenced by ure_attach_post().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_rtl8153b_init()

static void ure_rtl8153b_init ( struct ure_softc sc)
static

Definition at line 1714 of file if_ure.c.

References ure_softc::sc_chip, ure_softc::sc_flags, ure_softc::sc_ue, usb_ether::ue_dev, usb_ether::ue_udev, uether_pause(), URE_AUTOLOAD_DONE, URE_CHIP_VER_7410, URE_CLRBIT_1, URE_CLRBIT_2, URE_CRWECR_CONFIG, URE_CRWECR_NORAML, URE_CTRL_TIMER_EN, URE_CUR_LINK_OK, ure_enable_aldps(), URE_FC_PATCH_TASK, URE_FLAG_8156, URE_FLAG_8156B, URE_FLOW_CTRL_PATCH_OPT, ure_get_link_status(), URE_LINK_CHANGE_FLAG, URE_LINK_CHG_EVENT, URE_LINK_OFF_WAKE_EN, URE_LPM_U1U2_EN, URE_MAC_CLK_SPDWN_EN, URE_MCU_TYPE_PLA, URE_MCU_TYPE_USB, URE_OCP_BASE_MII, ure_ocp_reg_read(), ure_ocp_reg_write(), URE_PCUT_STATUS, URE_PHY_STAT_EXT_INIT, URE_PHY_STAT_LAN_ON, ure_phy_status(), URE_PLA_BOOT_CTRL, URE_PLA_CONFIG34, URE_PLA_CRWECR, URE_PLA_EXTRA_STATUS, URE_PLA_INDICATE_FALG, URE_PLA_MAC_PWR_CTRL, URE_PLA_MAC_PWR_CTRL2, URE_PLA_MAC_PWR_CTRL3, URE_PLA_MCU_SPDWN_EN, URE_PLA_RSTTALLY, URE_PLA_SUSPEND_FLAG, URE_POLL_LINK_CHG, URE_PWR_EN, ure_read_1(), ure_read_2(), URE_RX_AGG_DISABLE, URE_RX_ZERO_EN, URE_SETBIT_1, URE_SETBIT_2, URE_TALLY_RESET, URE_TIMEOUT, URE_U2P3_ENABLE, URE_UPCOMING_RUNTIME_D3, URE_UPS_EN, URE_USB_FC_TIMER, URE_USB_FW_CTRL, URE_USB_FW_TASK, URE_USB_LPM_CONFIG, URE_USB_MISC_0, URE_USB_MSC_TIMER, URE_USB_POWER_CUT, URE_USB_U1U2_TIMER, URE_USB_U2P3_CTRL, URE_USB_USB_CTRL, URE_USP_PREWAKE, ure_write_1(), ure_write_2(), USB_SPEED_SUPER, usbd_get_speed(), and val.

Referenced by ure_attach_post().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_rtl8153b_nic_reset()

◆ ure_rxcsum()

static void ure_rxcsum ( int  capenb,
struct ure_rxpkt rp,
struct mbuf *  m 
)
static

Definition at line 2121 of file if_ure.c.

References ure_rxpkt::ure_csum, ure_rxpkt::ure_misc, URE_RXPKT_IP_F, URE_RXPKT_IPV4_CS, URE_RXPKT_IPV6_CS, URE_RXPKT_TCP_CS, URE_RXPKT_TCP_F, URE_RXPKT_UDP_CS, and URE_RXPKT_UDP_F.

Referenced by ure_bulk_read_callback().

Here is the caller graph for this function:

◆ ure_rxfilter()

static void ure_rxfilter ( struct usb_ether ue)
static

◆ ure_sram_write()

static void ure_sram_write ( struct ure_softc sc,
uint16_t  addr,
uint16_t  data 
)
static

Definition at line 383 of file if_ure.c.

References addr, data, ure_ocp_reg_write(), URE_OCP_SRAM_ADDR, and URE_OCP_SRAM_DATA.

Referenced by ure_rtl8153_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_start()

static void ure_start ( struct usb_ether ue)
static

Definition at line 1231 of file if_ure.c.

References ure_softc::sc_rx_xfer, ure_softc::sc_rxstarted, ure_softc::sc_tx_xfer, uether_getsc(), URE_LOCK_ASSERT, URE_MAX_RX, URE_MAX_TX, and usbd_transfer_start().

Here is the call graph for this function:

◆ ure_stop()

static void ure_stop ( struct usb_ether ue)
static

◆ ure_sysctl_chipver()

static int ure_sysctl_chipver ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 934 of file if_ure.c.

References error, req, and ure_softc::sc_ver.

Referenced by ure_attach_post_sub().

Here is the caller graph for this function:

◆ ure_tick()

◆ ure_txcsum()

static int ure_txcsum ( struct mbuf *  m,
int  caps,
uint32_t *  regout 
)
static

Definition at line 2170 of file if_ure.c.

References data, reg, type, URE_L4_OFFSET_MAX, URE_L4_OFFSET_SHIFT, URE_TXPKT_IPV4_CS, URE_TXPKT_IPV6_CS, URE_TXPKT_TCP_CS, and URE_TXPKT_UDP_CS.

Referenced by ure_bulk_write_callback().

Here is the caller graph for this function:

◆ ure_write_1()

static int ure_write_1 ( struct ure_softc sc,
uint16_t  reg,
uint16_t  index,
uint32_t  val 
)
static

Definition at line 310 of file if_ure.c.

References index, reg, URE_BYTE_EN_BYTE, ure_write_mem(), USETDW, and val.

Referenced by ure_disable_teredo(), ure_init(), ure_reset(), ure_rtl8152_init(), ure_rtl8152_nic_reset(), ure_rtl8153_init(), ure_rtl8153b_init(), and ure_rtl8153b_nic_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_write_2()

static int ure_write_2 ( struct ure_softc sc,
uint16_t  reg,
uint16_t  index,
uint32_t  val 
)
static

Definition at line 331 of file if_ure.c.

References index, reg, URE_BYTE_EN_WORD, ure_write_mem(), USETDW, and val.

Referenced by ure_disable_teredo(), ure_init(), ure_ocp_reg_read(), ure_ocp_reg_write(), ure_rtl8152_init(), ure_rtl8153_init(), ure_rtl8153b_init(), and ure_rtl8153b_nic_reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_write_4()

static int ure_write_4 ( struct ure_softc sc,
uint16_t  reg,
uint16_t  index,
uint32_t  val 
)
static

Definition at line 352 of file if_ure.c.

References index, reg, URE_BYTE_EN_DWORD, ure_write_mem(), USETDW, and val.

Referenced by ure_disable_teredo(), ure_rtl8152_init(), ure_rtl8152_nic_reset(), ure_rtl8153b_nic_reset(), and ure_rxfilter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ure_write_mem()

static int ure_write_mem ( struct ure_softc sc,
uint16_t  addr,
uint16_t  index,
void *  buf,
int  len 
)
static

Definition at line 259 of file if_ure.c.

References addr, index, len, ure_ctl(), and URE_CTL_WRITE.

Referenced by ure_init(), ure_rtl8153_init(), ure_write_1(), ure_write_2(), and ure_write_4().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ USB_PNP_HOST_INFO()

USB_PNP_HOST_INFO ( ure_devs  )

Variable Documentation

◆ ure_attach

device_attach_t ure_attach
static

Definition at line 117 of file if_ure.c.

◆ ure_attach_post

uether_fn_t ure_attach_post
static

Definition at line 127 of file if_ure.c.

◆ ure_bulk_read_callback

usb_callback_t ure_bulk_read_callback
static

Definition at line 120 of file if_ure.c.

Referenced by ure_attach().

◆ ure_bulk_write_callback

usb_callback_t ure_bulk_write_callback
static

Definition at line 121 of file if_ure.c.

Referenced by ure_attach().

◆ ure_detach

device_detach_t ure_detach
static

Definition at line 118 of file if_ure.c.

Referenced by ure_attach().

◆ ure_devclass

devclass_t ure_devclass
static

Definition at line 192 of file if_ure.c.

◆ ure_devs

const STRUCT_USB_HOST_ID ure_devs[]
static
Initial value:
= {
#define URE_DEV(v,p,i)
URE_DEV(LENOVO, RTL8153, URE_FLAG_8153),
URE_DEV(LENOVO, TBT3LAN, 0),
URE_DEV(LENOVO, TBT3LANGEN2, 0),
URE_DEV(LENOVO, ONELINK, 0),
URE_DEV(LENOVO, USBCLAN, 0),
URE_DEV(LENOVO, USBCLANGEN2, 0),
URE_DEV(NVIDIA, RTL8153, URE_FLAG_8153),
URE_DEV(REALTEK, RTL8152, URE_FLAG_8152),
URE_DEV(REALTEK, RTL8153, URE_FLAG_8153),
URE_DEV(TPLINK, RTL8153, URE_FLAG_8153),
URE_DEV(REALTEK, RTL8156, URE_FLAG_8156),
}
#define URE_DEV(v, p, i)
#define URE_FLAG_8156
Definition: if_urereg.h:599
#define URE_FLAG_8153
Definition: if_urereg.h:597
#define URE_FLAG_8152
Definition: if_urereg.h:596

Definition at line 97 of file if_ure.c.

Referenced by ure_probe().

◆ ure_driver

driver_t ure_driver
static
Initial value:
= {
.name = "ure",
.methods = ure_methods,
.size = sizeof(struct ure_softc),
}
static device_method_t ure_methods[]
Definition: if_ure.c:172

Definition at line 186 of file if_ure.c.

◆ ure_init

uether_fn_t ure_init
static

Definition at line 128 of file if_ure.c.

◆ ure_methods

device_method_t ure_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, ure_probe),
DEVMETHOD(device_attach, ure_attach),
DEVMETHOD(device_detach, ure_detach),
DEVMETHOD(miibus_readreg, ure_miibus_readreg),
DEVMETHOD(miibus_writereg, ure_miibus_writereg),
DEVMETHOD(miibus_statchg, ure_miibus_statchg),
DEVMETHOD_END
}
static device_attach_t ure_attach
Definition: if_ure.c:117
static miibus_readreg_t ure_miibus_readreg
Definition: if_ure.c:123
static device_detach_t ure_detach
Definition: if_ure.c:118
static device_probe_t ure_probe
Definition: if_ure.c:116
static miibus_writereg_t ure_miibus_writereg
Definition: if_ure.c:124
static miibus_statchg_t ure_miibus_statchg
Definition: if_ure.c:125

Definition at line 172 of file if_ure.c.

◆ ure_miibus_readreg

miibus_readreg_t ure_miibus_readreg
static

Definition at line 123 of file if_ure.c.

◆ ure_miibus_statchg

miibus_statchg_t ure_miibus_statchg
static

Definition at line 125 of file if_ure.c.

◆ ure_miibus_writereg

miibus_writereg_t ure_miibus_writereg
static

Definition at line 124 of file if_ure.c.

◆ ure_probe

device_probe_t ure_probe
static

Definition at line 116 of file if_ure.c.

◆ ure_rxfilter

uether_fn_t ure_rxfilter
static

Definition at line 132 of file if_ure.c.

Referenced by ure_init().

◆ ure_start

uether_fn_t ure_start
static

Definition at line 130 of file if_ure.c.

Referenced by ure_tick().

◆ ure_stop

uether_fn_t ure_stop
static

Definition at line 129 of file if_ure.c.

Referenced by ure_init().

◆ ure_tick

uether_fn_t ure_tick
static

Definition at line 131 of file if_ure.c.

◆ ure_ue_methods

const struct usb_ether_methods ure_ue_methods
static
Initial value:
= {
.ue_attach_post = ure_attach_post,
.ue_attach_post_sub = ure_attach_post_sub,
.ue_start = ure_start,
.ue_init = ure_init,
.ue_stop = ure_stop,
.ue_tick = ure_tick,
.ue_setmulti = ure_rxfilter,
.ue_setpromisc = ure_rxfilter,
.ue_mii_upd = ure_ifmedia_upd,
.ue_mii_sts = ure_ifmedia_sts,
}
static uether_fn_t ure_attach_post
Definition: if_ure.c:127
static uether_fn_t ure_init
Definition: if_ure.c:128
static uether_fn_t ure_stop
Definition: if_ure.c:129
static uether_fn_t ure_rxfilter
Definition: if_ure.c:132
static uether_fn_t ure_start
Definition: if_ure.c:130
static void ure_ifmedia_sts(struct ifnet *, struct ifmediareq *)
Definition: if_ure.c:1349
static uether_fn_t ure_tick
Definition: if_ure.c:131
static int ure_attach_post_sub(struct usb_ether *)
Definition: if_ure.c:986
static int ure_ifmedia_upd(struct ifnet *)
Definition: if_ure.c:1269

Definition at line 203 of file if_ure.c.

Referenced by ure_attach().