FreeBSD kernel usb device Code
ehci.c File Reference
#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/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 <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usb_core.h>
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_busdma.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_transfer.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_hub.h>
#include <dev/usb/usb_util.h>
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/ehci.h>
#include <dev/usb/controller/ehcireg.h>
Include dependency graph for ehci.c:

Go to the source code of this file.

Data Structures

struct  ehci_std_temp
 

Macros

#define USB_DEBUG_VAR   ehcidebug
 
#define EHCI_BUS2SC(bus)    __containerof(bus, ehci_softc_t, sc_bus)
 
#define EHCI_INTR_ENDPT   1
 
#define EHCI_APPEND_FS_TD(std, last)   (last) = _ehci_append_fs_td(std,last)
 
#define EHCI_APPEND_HS_TD(std, last)   (last) = _ehci_append_hs_td(std,last)
 
#define EHCI_APPEND_QH(sqh, last)   (last) = _ehci_append_qh(sqh,last)
 
#define EHCI_REMOVE_FS_TD(std, last)   (last) = _ehci_remove_fs_td(std,last)
 
#define EHCI_REMOVE_HS_TD(std, last)   (last) = _ehci_remove_hs_td(std,last)
 
#define EHCI_REMOVE_QH(sqh, last)   (last) = _ehci_remove_qh(sqh,last)
 
#define C(x, y)   ((x) | ((y) << 8))
 

Functions

static void ehci_do_poll (struct usb_bus *)
 
static void ehci_device_done (struct usb_xfer *, usb_error_t)
 
static uint8_t ehci_check_transfer (struct usb_xfer *)
 
static void ehci_timeout (void *)
 
static void ehci_poll_timeout (void *)
 
static void ehci_root_intr (ehci_softc_t *sc)
 
void ehci_iterate_hw_softc (struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb)
 
usb_error_t ehci_reset (ehci_softc_t *sc)
 
static usb_error_t ehci_hcreset (ehci_softc_t *sc)
 
static int ehci_init_sub (struct ehci_softc *sc)
 
usb_error_t ehci_init (ehci_softc_t *sc)
 
void ehci_detach (ehci_softc_t *sc)
 
static void ehci_suspend (ehci_softc_t *sc)
 
static void ehci_resume (ehci_softc_t *sc)
 
static void ehci_transfer_intr_enqueue (struct usb_xfer *xfer)
 
static ehci_sitd_t_ehci_append_fs_td (ehci_sitd_t *std, ehci_sitd_t *last)
 
static ehci_itd_t_ehci_append_hs_td (ehci_itd_t *std, ehci_itd_t *last)
 
static ehci_qh_t_ehci_append_qh (ehci_qh_t *sqh, ehci_qh_t *last)
 
static ehci_sitd_t_ehci_remove_fs_td (ehci_sitd_t *std, ehci_sitd_t *last)
 
static ehci_itd_t_ehci_remove_hs_td (ehci_itd_t *std, ehci_itd_t *last)
 
static ehci_qh_t_ehci_remove_qh (ehci_qh_t *sqh, ehci_qh_t *last)
 
static void ehci_data_toggle_update (struct usb_xfer *xfer, uint16_t actlen, uint16_t xlen)
 
static usb_error_t ehci_non_isoc_done_sub (struct usb_xfer *xfer)
 
static void ehci_non_isoc_done (struct usb_xfer *xfer)
 
static void ehci_pcd_enable (ehci_softc_t *sc)
 
static void ehci_interrupt_poll (ehci_softc_t *sc)
 
void ehci_interrupt (ehci_softc_t *sc)
 
static void ehci_setup_standard_chain_sub (struct ehci_std_temp *temp)
 
static void ehci_setup_standard_chain (struct usb_xfer *xfer, ehci_qh_t **qh_last)
 
static void ehci_isoc_fs_done (ehci_softc_t *sc, struct usb_xfer *xfer)
 
static void ehci_isoc_hs_done (ehci_softc_t *sc, struct usb_xfer *xfer)
 
static void ehci_device_bulk_open (struct usb_xfer *xfer)
 
static void ehci_device_bulk_close (struct usb_xfer *xfer)
 
static void ehci_device_bulk_enter (struct usb_xfer *xfer)
 
static void ehci_doorbell_async (struct ehci_softc *sc)
 
static void ehci_device_bulk_start (struct usb_xfer *xfer)
 
static void ehci_device_ctrl_open (struct usb_xfer *xfer)
 
static void ehci_device_ctrl_close (struct usb_xfer *xfer)
 
static void ehci_device_ctrl_enter (struct usb_xfer *xfer)
 
static void ehci_device_ctrl_start (struct usb_xfer *xfer)
 
static void ehci_device_intr_open (struct usb_xfer *xfer)
 
static void ehci_device_intr_close (struct usb_xfer *xfer)
 
static void ehci_device_intr_enter (struct usb_xfer *xfer)
 
static void ehci_device_intr_start (struct usb_xfer *xfer)
 
static void ehci_device_isoc_fs_open (struct usb_xfer *xfer)
 
static void ehci_device_isoc_fs_close (struct usb_xfer *xfer)
 
static void ehci_device_isoc_fs_enter (struct usb_xfer *xfer)
 
static void ehci_device_isoc_fs_start (struct usb_xfer *xfer)
 
static void ehci_device_isoc_hs_open (struct usb_xfer *xfer)
 
static void ehci_device_isoc_hs_close (struct usb_xfer *xfer)
 
static void ehci_device_isoc_hs_enter (struct usb_xfer *xfer)
 
static void ehci_device_isoc_hs_start (struct usb_xfer *xfer)
 
uint16_t ehci_get_port_speed_portsc (struct ehci_softc *sc, uint16_t index)
 
uint16_t ehci_get_port_speed_hostc (struct ehci_softc *sc, uint16_t index)
 
static void ehci_disown (ehci_softc_t *sc, uint16_t index, uint8_t lowspeed)
 
static usb_error_t ehci_roothub_exec (struct usb_device *udev, struct usb_device_request *req, const void **pptr, uint16_t *plength)
 
static void ehci_xfer_setup (struct usb_setup_params *parm)
 
static void ehci_xfer_unsetup (struct usb_xfer *xfer)
 
static void ehci_ep_init (struct usb_device *udev, struct usb_endpoint_descriptor *edesc, struct usb_endpoint *ep)
 
static void ehci_get_dma_delay (struct usb_device *udev, uint32_t *pus)
 
static void ehci_device_resume (struct usb_device *udev)
 
static void ehci_device_suspend (struct usb_device *udev)
 
static void ehci_set_hw_power_sleep (struct usb_bus *bus, uint32_t state)
 
static void ehci_set_hw_power (struct usb_bus *bus)
 
static void ehci_start_dma_delay_second (struct usb_xfer *xfer)
 
static void ehci_start_dma_delay (struct usb_xfer *xfer)
 

Variables

static const struct usb_bus_methods ehci_bus_methods
 
static const struct usb_pipe_methods ehci_device_bulk_methods
 
static const struct usb_pipe_methods ehci_device_ctrl_methods
 
static const struct usb_pipe_methods ehci_device_intr_methods
 
static const struct usb_pipe_methods ehci_device_isoc_fs_methods
 
static const struct usb_pipe_methods ehci_device_isoc_hs_methods
 
static const struct usb_device_descriptor ehci_devd
 
static const struct usb_device_qualifier ehci_odevd
 
static const struct ehci_config_desc ehci_confd
 
static const struct usb_hub_descriptor ehci_hubd
 

Macro Definition Documentation

◆ C

#define C (   x,
 
)    ((x) | ((y) << 8))

◆ EHCI_APPEND_FS_TD

#define EHCI_APPEND_FS_TD (   std,
  last 
)    (last) = _ehci_append_fs_td(std,last)

Definition at line 919 of file ehci.c.

◆ EHCI_APPEND_HS_TD

#define EHCI_APPEND_HS_TD (   std,
  last 
)    (last) = _ehci_append_hs_td(std,last)

Definition at line 945 of file ehci.c.

◆ EHCI_APPEND_QH

#define EHCI_APPEND_QH (   sqh,
  last 
)    (last) = _ehci_append_qh(sqh,last)

Definition at line 971 of file ehci.c.

◆ EHCI_BUS2SC

#define EHCI_BUS2SC (   bus)     __containerof(bus, ehci_softc_t, sc_bus)

Definition at line 92 of file ehci.c.

◆ EHCI_INTR_ENDPT

#define EHCI_INTR_ENDPT   1

Definition at line 117 of file ehci.c.

◆ EHCI_REMOVE_FS_TD

#define EHCI_REMOVE_FS_TD (   std,
  last 
)    (last) = _ehci_remove_fs_td(std,last)

Definition at line 1003 of file ehci.c.

◆ EHCI_REMOVE_HS_TD

#define EHCI_REMOVE_HS_TD (   std,
  last 
)    (last) = _ehci_remove_hs_td(std,last)

Definition at line 1023 of file ehci.c.

◆ EHCI_REMOVE_QH

#define EHCI_REMOVE_QH (   sqh,
  last 
)    (last) = _ehci_remove_qh(sqh,last)

Definition at line 1043 of file ehci.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   ehcidebug

Definition at line 74 of file ehci.c.

Function Documentation

◆ _ehci_append_fs_td()

static ehci_sitd_t * _ehci_append_fs_td ( ehci_sitd_t std,
ehci_sitd_t last 
)
static

Definition at line 921 of file ehci.c.

References ehci_sitd::next, ehci_sitd::page_cache, ehci_sitd::prev, ehci_sitd::sitd_next, ehci_sitd::sitd_self, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ _ehci_append_hs_td()

static ehci_itd_t * _ehci_append_hs_td ( ehci_itd_t std,
ehci_itd_t last 
)
static

Definition at line 947 of file ehci.c.

References ehci_itd::itd_next, ehci_itd::itd_self, ehci_itd::next, ehci_itd::page_cache, ehci_itd::prev, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ _ehci_append_qh()

static ehci_qh_t * _ehci_append_qh ( ehci_qh_t sqh,
ehci_qh_t last 
)
static

Definition at line 973 of file ehci.c.

References ehci_qh::next, ehci_qh::page_cache, ehci_qh::prev, ehci_qh::qh_link, ehci_qh::qh_self, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ _ehci_remove_fs_td()

static ehci_sitd_t * _ehci_remove_fs_td ( ehci_sitd_t std,
ehci_sitd_t last 
)
static

Definition at line 1005 of file ehci.c.

References ehci_sitd::next, ehci_sitd::page_cache, ehci_sitd::prev, ehci_sitd::sitd_next, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ _ehci_remove_hs_td()

static ehci_itd_t * _ehci_remove_hs_td ( ehci_itd_t std,
ehci_itd_t last 
)
static

Definition at line 1025 of file ehci.c.

References ehci_itd::itd_next, ehci_itd::next, ehci_itd::page_cache, ehci_itd::prev, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ _ehci_remove_qh()

static ehci_qh_t * _ehci_remove_qh ( ehci_qh_t sqh,
ehci_qh_t last 
)
static

Definition at line 1045 of file ehci.c.

References ehci_qh::next, ehci_qh::page_cache, ehci_qh::prev, ehci_qh::qh_link, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ ehci_check_transfer()

◆ ehci_data_toggle_update()

static void ehci_data_toggle_update ( struct usb_xfer xfer,
uint16_t  actlen,
uint16_t  xlen 
)
static

Definition at line 1072 of file ehci.c.

References usb_xfer::endpoint, usb_xfer::max_packet_size, and usb_endpoint::toggle_next.

Referenced by ehci_non_isoc_done_sub().

Here is the caller graph for this function:

◆ ehci_detach()

void ehci_detach ( ehci_softc_t sc)

◆ ehci_device_bulk_close()

static void ehci_device_bulk_close ( struct usb_xfer xfer)
static

Definition at line 2205 of file ehci.c.

References ehci_device_done(), and USB_ERR_CANCELLED.

Here is the call graph for this function:

◆ ehci_device_bulk_enter()

static void ehci_device_bulk_enter ( struct usb_xfer xfer)
static

Definition at line 2211 of file ehci.c.

◆ ehci_device_bulk_open()

static void ehci_device_bulk_open ( struct usb_xfer xfer)
static

Definition at line 2199 of file ehci.c.

◆ ehci_device_bulk_start()

static void ehci_device_bulk_start ( struct usb_xfer xfer)
static

◆ ehci_device_ctrl_close()

static void ehci_device_ctrl_close ( struct usb_xfer xfer)
static

Definition at line 2272 of file ehci.c.

References ehci_device_done(), and USB_ERR_CANCELLED.

Here is the call graph for this function:

◆ ehci_device_ctrl_enter()

static void ehci_device_ctrl_enter ( struct usb_xfer xfer)
static

Definition at line 2278 of file ehci.c.

◆ ehci_device_ctrl_open()

static void ehci_device_ctrl_open ( struct usb_xfer xfer)
static

Definition at line 2266 of file ehci.c.

◆ ehci_device_ctrl_start()

static void ehci_device_ctrl_start ( struct usb_xfer xfer)
static

Definition at line 2284 of file ehci.c.

References usb_xfer_root::bus, EHCI_BUS2SC, ehci_setup_standard_chain(), ehci_transfer_intr_enqueue(), ehci_softc::sc_async_p_last, and usb_xfer::xroot.

Here is the call graph for this function:

◆ ehci_device_done()

◆ ehci_device_intr_close()

static void ehci_device_intr_close ( struct usb_xfer xfer)
static

Definition at line 2346 of file ehci.c.

References usb_xfer_root::bus, EHCI_BUS2SC, ehci_device_done(), usb_xfer::qh_pos, ehci_softc::sc_intr_stat, USB_ERR_CANCELLED, usb_hs_bandwidth_free(), and usb_xfer::xroot.

Here is the call graph for this function:

◆ ehci_device_intr_enter()

static void ehci_device_intr_enter ( struct usb_xfer xfer)
static

Definition at line 2359 of file ehci.c.

◆ ehci_device_intr_open()

static void ehci_device_intr_open ( struct usb_xfer xfer)
static

◆ ehci_device_intr_start()

static void ehci_device_intr_start ( struct usb_xfer xfer)
static

Definition at line 2365 of file ehci.c.

References usb_xfer_root::bus, EHCI_BUS2SC, ehci_setup_standard_chain(), ehci_transfer_intr_enqueue(), usb_xfer::qh_pos, ehci_softc::sc_intr_p_last, and usb_xfer::xroot.

Here is the call graph for this function:

◆ ehci_device_isoc_fs_close()

static void ehci_device_isoc_fs_close ( struct usb_xfer xfer)
static

Definition at line 2427 of file ehci.c.

References ehci_device_done(), and USB_ERR_CANCELLED.

Here is the call graph for this function:

◆ ehci_device_isoc_fs_enter()

◆ ehci_device_isoc_fs_open()

◆ ehci_device_isoc_fs_start()

static void ehci_device_isoc_fs_start ( struct usb_xfer xfer)
static

Definition at line 2616 of file ehci.c.

References usb_xfer_flags_int::can_cancel_immed, ehci_transfer_intr_enqueue(), usb_xfer::flags_int, and usb_xfer::timeout.

Here is the call graph for this function:

◆ ehci_device_isoc_hs_close()

static void ehci_device_isoc_hs_close ( struct usb_xfer xfer)
static

Definition at line 2692 of file ehci.c.

References ehci_device_done(), USB_ERR_CANCELLED, and usb_hs_bandwidth_free().

Here is the call graph for this function:

◆ ehci_device_isoc_hs_enter()

◆ ehci_device_isoc_hs_open()

◆ ehci_device_isoc_hs_start()

static void ehci_device_isoc_hs_start ( struct usb_xfer xfer)
static

Definition at line 2869 of file ehci.c.

References ehci_transfer_intr_enqueue().

Here is the call graph for this function:

◆ ehci_device_resume()

◆ ehci_device_suspend()

◆ ehci_disown()

static void ehci_disown ( ehci_softc_t sc,
uint16_t  index,
uint8_t  lowspeed 
)
static

Definition at line 2985 of file ehci.c.

References DPRINTF, EHCI_PORTSC, EHCI_PS_PO, EOREAD4, EOWRITE4, and index.

Referenced by ehci_roothub_exec().

Here is the caller graph for this function:

◆ ehci_do_poll()

static void ehci_do_poll ( struct usb_bus bus)
static

Definition at line 1536 of file ehci.c.

References bus, EHCI_BUS2SC, ehci_interrupt_poll(), ehci_softc::sc_bus, USB_BUS_LOCK, and USB_BUS_UNLOCK.

Referenced by ehci_init(), and ehci_resume().

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

◆ ehci_doorbell_async()

static void ehci_doorbell_async ( struct ehci_softc sc)
static

Definition at line 2217 of file ehci.c.

References EHCI_CMD_IAAD, EHCI_USBCMD, EOREAD4, and EOWRITE4.

Referenced by ehci_device_bulk_start(), ehci_start_dma_delay(), and ehci_start_dma_delay_second().

Here is the caller graph for this function:

◆ ehci_ep_init()

◆ ehci_get_dma_delay()

static void ehci_get_dma_delay ( struct usb_device udev,
uint32_t *  pus 
)
static

Definition at line 3692 of file ehci.c.

◆ ehci_get_port_speed_hostc()

uint16_t ehci_get_port_speed_hostc ( struct ehci_softc sc,
uint16_t  index 
)

◆ ehci_get_port_speed_portsc()

uint16_t ehci_get_port_speed_portsc ( struct ehci_softc sc,
uint16_t  index 
)

Definition at line 2955 of file ehci.c.

References EHCI_PORT_SPEED_HIGH, EHCI_PORT_SPEED_LOW, EHCI_PORTSC, EHCI_PORTSC_PSPD_MASK, EHCI_PORTSC_PSPD_SHIFT, EOREAD4, index, UPS_HIGH_SPEED, and UPS_LOW_SPEED.

Referenced by imx_ehci_attach(), and mv_ehci_attach().

Here is the caller graph for this function:

◆ ehci_hcreset()

static usb_error_t ehci_hcreset ( ehci_softc_t sc)
static

Definition at line 204 of file ehci.c.

References usb_bus::bdev, ehci_reset(), EHCI_STS_HCH, EHCI_USBCMD, EHCI_USBSTS, EOREAD4, EOWRITE4, ehci_softc::sc_bus, and usb_pause_mtx().

Referenced by ehci_detach(), ehci_init(), ehci_resume(), and ehci_suspend().

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

◆ ehci_init()

usb_error_t ehci_init ( ehci_softc_t sc)

Definition at line 281 of file ehci.c.

References ehci_hw_softc::async_start_pc, usb_bus::bdev, usb_page_search::buffer, usb_bus::bus_mtx, DPRINTF, ehci_bus_methods, EHCI_CAPLEN_HCIVERSION, EHCI_CAPLENGTH, EHCI_CMD_FLS, ehci_do_poll(), EHCI_FRAMELIST_COUNT, EHCI_HCIVERSION, ehci_hcreset(), EHCI_HCS_N_PORTS, EHCI_HCSPARAMS, ehci_init_sub(), ehci_iterate_hw_softc(), EHCI_LINK_ITD, EHCI_LINK_QH, EHCI_LINK_SITD, EHCI_LINK_TERMINATE, EHCI_NORMAL_INTRS, EHCI_QH_HRECL, EHCI_QH_SET_EPS, EHCI_QH_SET_MULT, EHCI_QH_SPEED_HIGH, EHCI_QTD_HALTED, EHCI_SCFLG_DONTRESET, EHCI_SCFLG_IAADBUG, EHCI_SCFLG_LOSTINTRBUG, EHCI_USBCMD, EHCI_VIRTUAL_FRAMELIST_COUNT, EOREAD4, EREAD4, htohc32(), ehci_hw_softc::intr_start_pc, ehci_hw_softc::isoc_fs_start_pc, ehci_hw_softc::isoc_hs_start_pc, ehci_itd::itd_next, itd_self, ehci_itd::itd_self, usb_bus::methods, ehci_itd::page_cache, ehci_sitd::page_cache, ehci_qh::page_cache, ehci_hw_softc::pframes_pc, ehci_qh::qh_curqtd, ehci_qh::qh_endp, ehci_qh::qh_endphub, ehci_qh::qh_link, ehci_qh::qh_qtd, qh_self, ehci_qh::qh_self, ehci_qh_sub::qtd_altnext, ehci_qh_sub::qtd_next, ehci_qh_sub::qtd_status, ehci_softc::sc_async_p_last, ehci_softc::sc_bus, ehci_softc::sc_eintrs, ehci_softc::sc_flags, ehci_softc::sc_hw, ehci_softc::sc_intr_p_last, ehci_softc::sc_isoc_fs_p_last, ehci_softc::sc_isoc_hs_p_last, ehci_softc::sc_noport, ehci_softc::sc_offs, ehci_softc::sc_terminate_self, ehci_softc::sc_tmo_pcd, ehci_softc::sc_tmo_poll, ehci_sitd::sitd_back, ehci_sitd::sitd_next, ehci_sitd::sitd_self, ehci_hw_softc::terminate_pc, usb_bus_mem_flush_all(), usb_callout_init_mtx, USB_ERR_IOERROR, USB_REV_2_0, usbd_get_page(), and usb_bus::usbrev.

Referenced by ehci_msm_attach(), ehci_pci_attach(), fsl_ehci_attach(), generic_ehci_attach(), imx_ehci_attach(), and mv_ehci_attach().

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

◆ ehci_init_sub()

◆ ehci_interrupt()

◆ ehci_interrupt_poll()

static void ehci_interrupt_poll ( ehci_softc_t sc)
static

Definition at line 1405 of file ehci.c.

References ehci_check_transfer(), usb_bus::intr_q, and ehci_softc::sc_bus.

Referenced by ehci_do_poll(), ehci_interrupt(), and ehci_poll_timeout().

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

◆ ehci_isoc_fs_done()

static void ehci_isoc_fs_done ( ehci_softc_t sc,
struct usb_xfer xfer 
)
static

◆ ehci_isoc_hs_done()

static void ehci_isoc_hs_done ( ehci_softc_t sc,
struct usb_xfer xfer 
)
static

◆ ehci_iterate_hw_softc()

◆ ehci_non_isoc_done()

◆ ehci_non_isoc_done_sub()

◆ ehci_pcd_enable()

static void ehci_pcd_enable ( ehci_softc_t sc)
static

Definition at line 1391 of file ehci.c.

References ehci_root_intr(), EHCI_STS_PCD, EHCI_USBINTR, EHCI_USBSTS, EOWRITE4, ehci_softc::sc_bus, ehci_softc::sc_eintrs, and USB_BUS_LOCK_ASSERT.

Referenced by ehci_interrupt().

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

◆ ehci_poll_timeout()

static void ehci_poll_timeout ( void *  arg)
static

Definition at line 1435 of file ehci.c.

References ehci_interrupt_poll().

Referenced by ehci_interrupt().

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

◆ ehci_reset()

usb_error_t ehci_reset ( ehci_softc_t sc)

Definition at line 184 of file ehci.c.

References usb_bus::bdev, EHCI_CMD_HCRESET, EHCI_USBCMD, EOREAD4, EOWRITE4, ehci_softc::sc_bus, ehci_softc::sc_vendor_post_reset, USB_ERR_IOERROR, and usb_pause_mtx().

Referenced by ehci_hcreset(), and fsl_ehci_attach().

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

◆ ehci_resume()

static void ehci_resume ( ehci_softc_t sc)
static

Definition at line 584 of file ehci.c.

References ehci_do_poll(), ehci_hcreset(), ehci_init_sub(), and ehci_softc::sc_bus.

Referenced by ehci_set_hw_power_sleep().

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

◆ ehci_root_intr()

static void ehci_root_intr ( ehci_softc_t sc)
static

Definition at line 1996 of file ehci.c.

References DPRINTF, EHCI_PORTSC, EHCI_PS_CLEAR, EOREAD4, ehci_softc::sc_bus, ehci_softc::sc_hub_idata, ehci_softc::sc_noport, uhub_root_intr(), and USB_BUS_LOCK_ASSERT.

Referenced by ehci_interrupt(), and ehci_pcd_enable().

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

◆ ehci_roothub_exec()

static usb_error_t ehci_roothub_exec ( struct usb_device udev,
struct usb_device_request req,
const void **  pptr,
uint16_t *  plength 
)
static

Definition at line 2998 of file ehci.c.

References usb_hub_descriptor::bDescLength, usb_bus::bdev, usb_hub_descriptor::bNbrPorts, usb_hub_descriptor::bPwrOn2PwrGood, usb_device::bus, usb_bus::bus_mtx, C, DPRINTF, EHCI_BUS2SC, ehci_confd, ehci_devd, ehci_disown(), EHCI_HCS_P_INDICATOR, EHCI_HCS_PPC, EHCI_HCSPARAMS, ehci_hubd, EHCI_MAX_DEVICES, ehci_odevd, EHCI_PORT_RESET_COMPLETE, EHCI_PORTSC, EHCI_PS_CS, EHCI_PS_CSC, EHCI_PS_FPR, EHCI_PS_IS_LOWSPEED, EHCI_PS_OCA, EHCI_PS_OCC, EHCI_PS_PE, EHCI_PS_PEC, EHCI_PS_PIC, EHCI_PS_PP, EHCI_PS_PR, EHCI_PS_SUSP, EHCI_SCFLG_NORESTERM, EHCI_SCFLG_TT, EOREAD4, EOWRITE4, EREAD4, ehci_hub_desc::hubd, index, len, pptr, ehci_hub_desc::ps, req, ehci_softc::sc_addr, ehci_softc::sc_bus, ehci_softc::sc_conf, ehci_softc::sc_flags, ehci_softc::sc_hub_desc, ehci_softc::sc_isreset, ehci_softc::sc_noport, ehci_softc::sc_vendor, ehci_softc::sc_vendor_get_port_speed, ehci_hub_desc::stat, ehci_hub_desc::temp, UDESC_CONFIG, UDESC_DEVICE, UDESC_DEVICE_QUALIFIER, UDESC_STRING, UDS_SELF_POWERED, UGETW, UHD_PORT_IND, UHD_PWR_INDIVIDUAL, UHD_PWR_NO_SWITCH, UHF_C_PORT_CONNECTION, UHF_C_PORT_ENABLE, UHF_C_PORT_OVER_CURRENT, UHF_C_PORT_RESET, UHF_C_PORT_SUSPEND, UHF_PORT_ENABLE, UHF_PORT_INDICATOR, UHF_PORT_POWER, UHF_PORT_RESET, UHF_PORT_SUSPEND, UHF_PORT_TEST, UPS_C_CONNECT_STATUS, UPS_C_OVERCURRENT_INDICATOR, UPS_C_PORT_ENABLED, UPS_C_PORT_RESET, UPS_C_SUSPEND, UPS_CURRENT_CONNECT_STATUS, UPS_HIGH_SPEED, UPS_OVERCURRENT_INDICATOR, UPS_PORT_ENABLED, UPS_PORT_POWER, UPS_RESET, UPS_SUSPEND, UR_CLEAR_FEATURE, UR_CLEAR_TT_BUFFER, UR_GET_CONFIG, UR_GET_DESCRIPTOR, UR_GET_INTERFACE, UR_GET_STATUS, UR_GET_TT_STATE, UR_RESET_TT, UR_SET_ADDRESS, UR_SET_CONFIG, UR_SET_DESCRIPTOR, UR_SET_FEATURE, UR_SET_INTERFACE, UR_STOP_TT, UR_SYNCH_FRAME, USB_BUS_LOCK_ASSERT, USB_ERR_IOERROR, USB_ERR_TIMEOUT, usb_make_str_desc(), USB_MS_TO_TICKS, usb_pause_mtx(), usb_port_root_reset_delay, USETW, UT_READ_CLASS_DEVICE, UT_READ_CLASS_OTHER, UT_READ_DEVICE, UT_READ_ENDPOINT, UT_READ_INTERFACE, UT_WRITE_CLASS_DEVICE, UT_WRITE_CLASS_OTHER, UT_WRITE_DEVICE, UT_WRITE_ENDPOINT, UT_WRITE_INTERFACE, value, usb_hub_descriptor::wHubCharacteristics, usb_port_status::wPortChange, usb_port_status::wPortStatus, and usb_status::wStatus.

Here is the call graph for this function:

◆ ehci_set_hw_power()

static void ehci_set_hw_power ( struct usb_bus bus)
static

◆ ehci_set_hw_power_sleep()

static void ehci_set_hw_power_sleep ( struct usb_bus bus,
uint32_t  state 
)
static

Definition at line 3764 of file ehci.c.

References bus, EHCI_BUS2SC, ehci_resume(), ehci_suspend(), state, USB_HW_POWER_RESUME, USB_HW_POWER_SHUTDOWN, and USB_HW_POWER_SUSPEND.

Here is the call graph for this function:

◆ ehci_setup_standard_chain()

static void ehci_setup_standard_chain ( struct usb_xfer xfer,
ehci_qh_t **  qh_last 
)
static

Definition at line 1734 of file ehci.c.

References usb_xfer::address, usb_device::address, ehci_std_temp::auto_data_toggle, ehci_std_temp::average, usb_xfer_root::bus, usb_xfer_flags_int::control_act, usb_xfer_flags_int::control_hdr, usb_xfer_flags_int::control_xfr, usb_xfer_flags_int::curr_dma_set, DPRINTF, EHCI_APPEND_QH, EHCI_BUS2SC, ehci_device_ctrl_methods, ehci_device_intr_methods, EHCI_LINK_TERMINATE, EHCI_QH_CTL, EHCI_QH_DTC, EHCI_QH_SET_ADDR, EHCI_QH_SET_CMASK, EHCI_QH_SET_ENDPT, EHCI_QH_SET_EPS, EHCI_QH_SET_HUBA, EHCI_QH_SET_MPL, EHCI_QH_SET_MULT, EHCI_QH_SET_NRL, EHCI_QH_SET_PORT, EHCI_QH_SET_SMASK, EHCI_QH_SPEED_FULL, EHCI_QH_SPEED_HIGH, EHCI_QH_SPEED_LOW, EHCI_QTD_ACTIVE, EHCI_QTD_PID_IN, EHCI_QTD_PID_OUT, EHCI_QTD_PID_SETUP, EHCI_QTD_SET_CERR, EHCI_QTD_SET_PID, EHCI_QTD_SET_TOGGLE, ehci_setup_standard_chain_sub(), usb_xfer::endpoint, usb_xfer::endpointno, usb_xfer::flags, usb_device::flags, usb_xfer::flags_int, usb_xfer_flags::force_short_xfer, usb_xfer::frbuffers, usb_xfer::frlengths, usb_device::hs_hub_addr, usb_device::hs_port_no, htohc32(), ehci_std_temp::last_frame, ehci_std_temp::len, ehci_std_temp::max_frame_size, usb_xfer::max_frame_size, usb_xfer::max_hc_frame_size, usb_xfer::max_packet_count, usb_xfer::max_packet_size, usb_endpoint::methods, usb_xfer::nframes, ehci_qtd::page_cache, ehci_qh::page_cache, usb_device::parent_hs_hub, ehci_std_temp::pc, ehci_qh::qh_curqtd, qh_endp, ehci_qh::qh_endp, qh_endphub, ehci_qh::qh_endphub, ehci_qh::qh_qtd, usb_xfer::qh_start, ehci_qtd::qtd_altnext, ehci_qh_sub::qtd_altnext, ehci_qh_sub::qtd_buffer, ehci_qh_sub::qtd_buffer_hi, ehci_qtd::qtd_next, ehci_qh_sub::qtd_next, ehci_qtd::qtd_self, ehci_std_temp::qtd_status, ehci_qh_sub::qtd_status, ehci_std_temp::sc, usb_device_flags::self_suspended, ehci_std_temp::setup_alt_next, usb_xfer_flags_int::short_frames_ok, ehci_std_temp::shortpkt, usb_xfer::sumlen, ehci_std_temp::td, ehci_std_temp::td_next, usb_xfer::td_start, usb_xfer::td_transfer_cache, usb_xfer::td_transfer_first, usb_xfer::td_transfer_last, usb_endpoint::toggle_next, usb_xfer_root::udev, UE_DIR_IN, UE_DIR_OUT, UE_GET_ADDR, UE_GET_DIR, usb_endpoint::usb_cmask, usb_pc_cpu_flush(), usb_endpoint::usb_smask, USB_SPEED_FULL, USB_SPEED_HIGH, usbd_get_speed(), and usb_xfer::xroot.

Referenced by ehci_device_bulk_start(), ehci_device_ctrl_start(), and ehci_device_intr_start().

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

◆ ehci_setup_standard_chain_sub()

◆ ehci_start_dma_delay()

static void ehci_start_dma_delay ( struct usb_xfer xfer)
static

Definition at line 3836 of file ehci.c.

References usb_xfer_root::bus, DPRINTF, EHCI_BUS2SC, ehci_doorbell_async(), ehci_start_dma_delay_second(), usbd_transfer_timeout_ms(), and usb_xfer::xroot.

Here is the call graph for this function:

◆ ehci_start_dma_delay_second()

static void ehci_start_dma_delay_second ( struct usb_xfer xfer)
static

Definition at line 3816 of file ehci.c.

References usb_xfer_root::bus, DPRINTF, EHCI_BUS2SC, ehci_doorbell_async(), usb_dma_delay_done_cb(), usbd_transfer_timeout_ms(), and usb_xfer::xroot.

Referenced by ehci_start_dma_delay().

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

◆ ehci_suspend()

static void ehci_suspend ( ehci_softc_t sc)
static

Definition at line 575 of file ehci.c.

References DPRINTF, and ehci_hcreset().

Referenced by ehci_set_hw_power_sleep().

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

◆ ehci_timeout()

static void ehci_timeout ( void *  arg)
static

Definition at line 1523 of file ehci.c.

References usb_xfer_root::bus, DPRINTF, ehci_device_done(), USB_BUS_LOCK_ASSERT, USB_ERR_TIMEOUT, and usb_xfer::xroot.

Referenced by ehci_transfer_intr_enqueue().

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

◆ ehci_transfer_intr_enqueue()

static void ehci_transfer_intr_enqueue ( struct usb_xfer xfer)
static

◆ ehci_xfer_setup()

◆ ehci_xfer_unsetup()

static void ehci_xfer_unsetup ( struct usb_xfer xfer)
static

Definition at line 3640 of file ehci.c.

Variable Documentation

◆ ehci_bus_methods

static const struct usb_bus_methods ehci_bus_methods
static
Initial value:
=
{
.endpoint_init = ehci_ep_init,
.xfer_setup = ehci_xfer_setup,
.xfer_unsetup = ehci_xfer_unsetup,
.get_dma_delay = ehci_get_dma_delay,
.device_resume = ehci_device_resume,
.device_suspend = ehci_device_suspend,
.set_hw_power = ehci_set_hw_power,
.set_hw_power_sleep = ehci_set_hw_power_sleep,
.roothub_exec = ehci_roothub_exec,
.xfer_poll = ehci_do_poll,
.start_dma_delay = ehci_start_dma_delay,
}
static usb_error_t ehci_roothub_exec(struct usb_device *udev, struct usb_device_request *req, const void **pptr, uint16_t *plength)
Definition: ehci.c:2998
static void ehci_xfer_setup(struct usb_setup_params *parm)
Definition: ehci.c:3394
static void ehci_device_resume(struct usb_device *udev)
Definition: ehci.c:3702
static void ehci_device_suspend(struct usb_device *udev)
Definition: ehci.c:3734
static void ehci_set_hw_power(struct usb_bus *bus)
Definition: ehci.c:3782
static void ehci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, struct usb_endpoint *ep)
Definition: ehci.c:3646
static void ehci_get_dma_delay(struct usb_device *udev, uint32_t *pus)
Definition: ehci.c:3692
static void ehci_start_dma_delay(struct usb_xfer *xfer)
Definition: ehci.c:3836
static void ehci_do_poll(struct usb_bus *)
Definition: ehci.c:1536
static void ehci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state)
Definition: ehci.c:3764
static void ehci_xfer_unsetup(struct usb_xfer *xfer)
Definition: ehci.c:3640

Definition at line 119 of file ehci.c.

Referenced by ehci_init().

◆ ehci_confd

const struct ehci_config_desc ehci_confd
static
Initial value:
= {
.confd = {
.bLength = sizeof(struct usb_config_descriptor),
.wTotalLength[0] = sizeof(ehci_confd),
.bMaxPower = 0
},
.ifcd = {
.bLength = sizeof(struct usb_interface_descriptor),
.bNumEndpoints = 1,
.bInterfaceClass = UICLASS_HUB,
.bInterfaceSubClass = UISUBCLASS_HUB,
.bInterfaceProtocol = 0,
},
.endpd = {
.bLength = sizeof(struct usb_endpoint_descriptor),
.bEndpointAddress = UE_DIR_IN | EHCI_INTR_ENDPT,
.bmAttributes = UE_INTERRUPT,
.wMaxPacketSize[0] = 8,
.bInterval = 255,
},
}
static const struct ehci_config_desc ehci_confd
Definition: ehci.c:2918
#define EHCI_INTR_ENDPT
Definition: ehci.c:117
uByte bDescriptorType
Definition: usb.h:387
uByte bNumInterface
Definition: usb.h:389
uByte bmAttributes
Definition: usb.h:393
uByte iConfiguration
Definition: usb.h:392
uByte bConfigurationValue
Definition: usb.h:390
uByte bDescriptorType
Definition: usb.h:527
#define UE_INTERRUPT
Definition: usb.h:544
#define UC_SELF_POWERED
Definition: usb.h:395
#define UISUBCLASS_HUB
Definition: usb.h:480
#define UDESC_CONFIG
Definition: usb.h:196
#define UDESC_ENDPOINT
Definition: usb.h:200
#define UE_DIR_IN
Definition: usb.h:531
#define UICLASS_HUB
Definition: usb.h:479
#define UDESC_INTERFACE
Definition: usb.h:199

Definition at line 2918 of file ehci.c.

Referenced by ehci_roothub_exec().

◆ ehci_devd

const struct usb_device_descriptor ehci_devd
static
Initial value:
=
{
sizeof(struct usb_device_descriptor),
{0x00, 0x02},
64,
{0}, {0}, {0x00, 0x01},
1, 2, 0,
1
}
#define UDSUBCLASS_HUB
Definition: usb.h:374
#define UDCLASS_HUB
Definition: usb.h:373
#define UDPROTO_HSHUBSTT
Definition: usb.h:376
#define UDESC_DEVICE
Definition: usb.h:195

Definition at line 2890 of file ehci.c.

Referenced by ehci_roothub_exec().

◆ ehci_device_bulk_methods

static const struct usb_pipe_methods ehci_device_bulk_methods
static
Initial value:
=
{
}
static void ehci_device_bulk_enter(struct usb_xfer *xfer)
Definition: ehci.c:2211
static void ehci_device_bulk_start(struct usb_xfer *xfer)
Definition: ehci.c:2234
static void ehci_device_bulk_open(struct usb_xfer *xfer)
Definition: ehci.c:2199
static void ehci_device_bulk_close(struct usb_xfer *xfer)
Definition: ehci.c:2205

Definition at line 120 of file ehci.c.

Referenced by ehci_device_done(), ehci_device_resume(), ehci_device_suspend(), ehci_ep_init(), and ehci_xfer_setup().

◆ ehci_device_ctrl_methods

static const struct usb_pipe_methods ehci_device_ctrl_methods
static
Initial value:
=
{
}
static void ehci_device_ctrl_open(struct usb_xfer *xfer)
Definition: ehci.c:2266
static void ehci_device_ctrl_enter(struct usb_xfer *xfer)
Definition: ehci.c:2278
static void ehci_device_ctrl_close(struct usb_xfer *xfer)
Definition: ehci.c:2272
static void ehci_device_ctrl_start(struct usb_xfer *xfer)
Definition: ehci.c:2284

Definition at line 121 of file ehci.c.

Referenced by ehci_device_done(), ehci_device_resume(), ehci_device_suspend(), ehci_ep_init(), ehci_setup_standard_chain(), and ehci_xfer_setup().

◆ ehci_device_intr_methods

static const struct usb_pipe_methods ehci_device_intr_methods
static
Initial value:
=
{
}
static void ehci_device_intr_open(struct usb_xfer *xfer)
Definition: ehci.c:2307
static void ehci_device_intr_start(struct usb_xfer *xfer)
Definition: ehci.c:2365
static void ehci_device_intr_enter(struct usb_xfer *xfer)
Definition: ehci.c:2359
static void ehci_device_intr_close(struct usb_xfer *xfer)
Definition: ehci.c:2346

Definition at line 122 of file ehci.c.

Referenced by ehci_device_done(), ehci_device_resume(), ehci_device_suspend(), ehci_ep_init(), ehci_setup_standard_chain(), and ehci_xfer_setup().

◆ ehci_device_isoc_fs_methods

static const struct usb_pipe_methods ehci_device_isoc_fs_methods
static
Initial value:
=
{
}
static void ehci_device_isoc_fs_enter(struct usb_xfer *xfer)
Definition: ehci.c:2433
static void ehci_device_isoc_fs_open(struct usb_xfer *xfer)
Definition: ehci.c:2388
static void ehci_device_isoc_fs_start(struct usb_xfer *xfer)
Definition: ehci.c:2616
static void ehci_device_isoc_fs_close(struct usb_xfer *xfer)
Definition: ehci.c:2427

Definition at line 123 of file ehci.c.

Referenced by ehci_check_transfer(), ehci_device_done(), ehci_ep_init(), and ehci_xfer_setup().

◆ ehci_device_isoc_hs_methods

static const struct usb_pipe_methods ehci_device_isoc_hs_methods
static
Initial value:
=
{
}
static void ehci_device_isoc_hs_close(struct usb_xfer *xfer)
Definition: ehci.c:2692
static void ehci_device_isoc_hs_enter(struct usb_xfer *xfer)
Definition: ehci.c:2701
static void ehci_device_isoc_hs_start(struct usb_xfer *xfer)
Definition: ehci.c:2869
static void ehci_device_isoc_hs_open(struct usb_xfer *xfer)
Definition: ehci.c:2645

Definition at line 124 of file ehci.c.

Referenced by ehci_check_transfer(), ehci_device_done(), ehci_ep_init(), and ehci_xfer_setup().

◆ ehci_hubd

const struct usb_hub_descriptor ehci_hubd
static
Initial value:
=
{
.bDescLength = 0,
.bDescriptorType = UDESC_HUB,
}
#define UDESC_HUB
Definition: usb.h:214

Definition at line 2948 of file ehci.c.

Referenced by ehci_roothub_exec().

◆ ehci_odevd

const struct usb_device_qualifier ehci_odevd
static
Initial value:
=
{
sizeof(struct usb_device_qualifier),
{0x00, 0x02},
0,
0,
0
}
#define UDESC_DEVICE_QUALIFIER
Definition: usb.h:201
#define UDPROTO_FSHUB
Definition: usb.h:375

Definition at line 2905 of file ehci.c.

Referenced by ehci_roothub_exec().