FreeBSD kernel usb device Code
uhci.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/uhci.h>
#include <dev/usb/controller/uhcireg.h>
Include dependency graph for uhci.c:

Go to the source code of this file.

Data Structures

struct  uhci_mem_layout
 
struct  uhci_std_temp
 

Macros

#define USB_DEBUG_VAR   uhcidebug
 
#define alt_next   next
 
#define UHCI_BUS2SC(bus)    __containerof(bus, uhci_softc_t, sc_bus)
 
#define UBARR(sc)
 
#define UWRITE1(sc, r, x)
 
#define UWRITE2(sc, r, x)
 
#define UWRITE4(sc, r, x)
 
#define UREAD1(sc, r)   (UBARR(sc), bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
 
#define UREAD2(sc, r)   (UBARR(sc), bus_space_read_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
 
#define UREAD4(sc, r)   (UBARR(sc), bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))
 
#define UHCICMD(sc, cmd)   UWRITE2(sc, UHCI_CMD, cmd)
 
#define UHCISTS(sc)   UREAD2(sc, UHCI_STS)
 
#define UHCI_RESET_TIMEOUT   100 /* ms, reset timeout */
 
#define UHCI_INTR_ENDPT   1
 
#define UHCI_APPEND_TD(std, last)   (last) = _uhci_append_td(std,last)
 
#define UHCI_APPEND_QH(sqh, last)   (last) = _uhci_append_qh(sqh,last)
 
#define UHCI_REMOVE_TD(std, last)   (last) = _uhci_remove_td(std,last)
 
#define UHCI_REMOVE_QH(sqh, last)   (last) = _uhci_remove_qh(sqh,last)
 
#define C(x, y)   ((x) | ((y) << 8))
 

Functions

static uint8_t uhci_restart (uhci_softc_t *sc)
 
static void uhci_do_poll (struct usb_bus *)
 
static void uhci_device_done (struct usb_xfer *, usb_error_t)
 
static void uhci_transfer_intr_enqueue (struct usb_xfer *)
 
static void uhci_timeout (void *)
 
static uint8_t uhci_check_transfer (struct usb_xfer *)
 
static void uhci_root_intr (uhci_softc_t *sc)
 
void uhci_iterate_hw_softc (struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb)
 
static void uhci_mem_layout_init (struct uhci_mem_layout *ml, struct usb_xfer *xfer)
 
static void uhci_mem_layout_fixup (struct uhci_mem_layout *ml, struct uhci_td *td)
 
void uhci_reset (uhci_softc_t *sc)
 
static void uhci_start (uhci_softc_t *sc)
 
static struct uhci_qhuhci_init_qh (struct usb_page_cache *pc)
 
static struct uhci_tduhci_init_td (struct usb_page_cache *pc)
 
usb_error_t uhci_init (uhci_softc_t *sc)
 
static void uhci_suspend (uhci_softc_t *sc)
 
static void uhci_resume (uhci_softc_t *sc)
 
static void uhci_add_loop (uhci_softc_t *sc)
 
static void uhci_rem_loop (uhci_softc_t *sc)
 
static uhci_td_t_uhci_append_td (uhci_td_t *std, uhci_td_t *last)
 
static uhci_qh_t_uhci_append_qh (uhci_qh_t *sqh, uhci_qh_t *last)
 
static uhci_td_t_uhci_remove_td (uhci_td_t *std, uhci_td_t *last)
 
static uhci_qh_t_uhci_remove_qh (uhci_qh_t *sqh, uhci_qh_t *last)
 
static void uhci_isoc_done (uhci_softc_t *sc, struct usb_xfer *xfer)
 
static usb_error_t uhci_non_isoc_done_sub (struct usb_xfer *xfer)
 
static void uhci_non_isoc_done (struct usb_xfer *xfer)
 
static void uhci_check_transfer_sub (struct usb_xfer *xfer)
 
static void uhci_interrupt_poll (uhci_softc_t *sc)
 
void uhci_interrupt (uhci_softc_t *sc)
 
static void uhci_setup_standard_chain_sub (struct uhci_std_temp *temp)
 
static uhci_td_tuhci_setup_standard_chain (struct usb_xfer *xfer)
 
static void uhci_device_bulk_open (struct usb_xfer *xfer)
 
static void uhci_device_bulk_close (struct usb_xfer *xfer)
 
static void uhci_device_bulk_enter (struct usb_xfer *xfer)
 
static void uhci_device_bulk_start (struct usb_xfer *xfer)
 
static void uhci_device_ctrl_open (struct usb_xfer *xfer)
 
static void uhci_device_ctrl_close (struct usb_xfer *xfer)
 
static void uhci_device_ctrl_enter (struct usb_xfer *xfer)
 
static void uhci_device_ctrl_start (struct usb_xfer *xfer)
 
static void uhci_device_intr_open (struct usb_xfer *xfer)
 
static void uhci_device_intr_close (struct usb_xfer *xfer)
 
static void uhci_device_intr_enter (struct usb_xfer *xfer)
 
static void uhci_device_intr_start (struct usb_xfer *xfer)
 
static void uhci_device_isoc_open (struct usb_xfer *xfer)
 
static void uhci_device_isoc_close (struct usb_xfer *xfer)
 
static void uhci_device_isoc_enter (struct usb_xfer *xfer)
 
static void uhci_device_isoc_start (struct usb_xfer *xfer)
 
static usb_error_t uhci_portreset (uhci_softc_t *sc, uint16_t index)
 
static usb_error_t uhci_roothub_exec (struct usb_device *udev, struct usb_device_request *req, const void **pptr, uint16_t *plength)
 
static void uhci_xfer_setup (struct usb_setup_params *parm)
 
static void uhci_ep_init (struct usb_device *udev, struct usb_endpoint_descriptor *edesc, struct usb_endpoint *ep)
 
static void uhci_xfer_unsetup (struct usb_xfer *xfer)
 
static void uhci_get_dma_delay (struct usb_device *udev, uint32_t *pus)
 
static void uhci_device_resume (struct usb_device *udev)
 
static void uhci_device_suspend (struct usb_device *udev)
 
static void uhci_set_hw_power_sleep (struct usb_bus *bus, uint32_t state)
 
static void uhci_set_hw_power (struct usb_bus *bus)
 

Variables

static const struct usb_bus_methods uhci_bus_methods
 
static const struct usb_pipe_methods uhci_device_bulk_methods
 
static const struct usb_pipe_methods uhci_device_ctrl_methods
 
static const struct usb_pipe_methods uhci_device_intr_methods
 
static const struct usb_pipe_methods uhci_device_isoc_methods
 
static const struct usb_device_descriptor uhci_devd
 
static const struct uhci_config_desc uhci_confd
 
static const struct usb_hub_descriptor_min uhci_hubd_piix
 

Macro Definition Documentation

◆ alt_next

#define alt_next   next

Definition at line 84 of file uhci.c.

◆ C

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

◆ UBARR

#define UBARR (   sc)
Value:
bus_space_barrier((sc)->sc_io_tag, (sc)->sc_io_hdl, 0, (sc)->sc_io_size, \
BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE)

Definition at line 104 of file uhci.c.

◆ UHCI_APPEND_QH

#define UHCI_APPEND_QH (   sqh,
  last 
)    (last) = _uhci_append_qh(sqh,last)

Definition at line 915 of file uhci.c.

◆ UHCI_APPEND_TD

#define UHCI_APPEND_TD (   std,
  last 
)    (last) = _uhci_append_td(std,last)

Definition at line 889 of file uhci.c.

◆ UHCI_BUS2SC

#define UHCI_BUS2SC (   bus)     __containerof(bus, uhci_softc_t, sc_bus)

Definition at line 85 of file uhci.c.

◆ UHCI_INTR_ENDPT

#define UHCI_INTR_ENDPT   1

Definition at line 124 of file uhci.c.

◆ UHCI_REMOVE_QH

#define UHCI_REMOVE_QH (   sqh,
  last 
)    (last) = _uhci_remove_qh(sqh,last)

Definition at line 971 of file uhci.c.

◆ UHCI_REMOVE_TD

#define UHCI_REMOVE_TD (   std,
  last 
)    (last) = _uhci_remove_td(std,last)

Definition at line 951 of file uhci.c.

◆ UHCI_RESET_TIMEOUT

#define UHCI_RESET_TIMEOUT   100 /* ms, reset timeout */

Definition at line 122 of file uhci.c.

◆ UHCICMD

#define UHCICMD (   sc,
  cmd 
)    UWRITE2(sc, UHCI_CMD, cmd)

Definition at line 119 of file uhci.c.

◆ UHCISTS

#define UHCISTS (   sc)    UREAD2(sc, UHCI_STS)

Definition at line 120 of file uhci.c.

◆ UREAD1

#define UREAD1 (   sc,
  r 
)    (UBARR(sc), bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))

Definition at line 115 of file uhci.c.

◆ UREAD2

#define UREAD2 (   sc,
  r 
)    (UBARR(sc), bus_space_read_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))

Definition at line 116 of file uhci.c.

◆ UREAD4

#define UREAD4 (   sc,
  r 
)    (UBARR(sc), bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (r)))

Definition at line 117 of file uhci.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   uhcidebug

Definition at line 66 of file uhci.c.

◆ UWRITE1

#define UWRITE1 (   sc,
  r,
 
)
Value:
do { UBARR(sc); bus_space_write_1((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); \
} while (/*CONSTCOND*/0)
uint8_t r
Definition: if_run.c:612
#define UBARR(sc)
Definition: uhci.c:104

Definition at line 106 of file uhci.c.

◆ UWRITE2

#define UWRITE2 (   sc,
  r,
 
)
Value:
do { UBARR(sc); bus_space_write_2((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); \
} while (/*CONSTCOND*/0)

Definition at line 109 of file uhci.c.

◆ UWRITE4

#define UWRITE4 (   sc,
  r,
 
)
Value:
do { UBARR(sc); bus_space_write_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (r), (x)); \
} while (/*CONSTCOND*/0)

Definition at line 112 of file uhci.c.

Function Documentation

◆ _uhci_append_qh()

static uhci_qh_t * _uhci_append_qh ( uhci_qh_t sqh,
uhci_qh_t last 
)
static

Definition at line 917 of file uhci.c.

References uhci_qh::h_next, uhci_qh::h_prev, uhci_qh::page_cache, uhci_qh::qh_h_next, uhci_qh::qh_self, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ _uhci_append_td()

static uhci_td_t * _uhci_append_td ( uhci_td_t std,
uhci_td_t last 
)
static

Definition at line 891 of file uhci.c.

References uhci_td::next, uhci_td::page_cache, uhci_td::prev, uhci_td::td_next, uhci_td::td_self, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ _uhci_remove_qh()

static uhci_qh_t * _uhci_remove_qh ( uhci_qh_t sqh,
uhci_qh_t last 
)
static

Definition at line 973 of file uhci.c.

References uhci_qh::h_next, uhci_qh::h_prev, uhci_qh::page_cache, uhci_qh::qh_h_next, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ _uhci_remove_td()

static uhci_td_t * _uhci_remove_td ( uhci_td_t std,
uhci_td_t last 
)
static

Definition at line 953 of file uhci.c.

References uhci_td::next, uhci_td::page_cache, uhci_td::prev, uhci_td::td_next, and usb_pc_cpu_flush().

Here is the call graph for this function:

◆ uhci_add_loop()

static void uhci_add_loop ( uhci_softc_t sc)
static

Definition at line 831 of file uhci.c.

References uhci_qh::page_cache, uhci_qh::qh_h_next, uhci_qh::qh_self, uhci_softc::sc_last_qh_p, uhci_softc::sc_loops, uhci_softc::sc_reclaim_qh_p, and usb_pc_cpu_flush().

Referenced by uhci_device_bulk_start(), and uhci_device_resume().

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

◆ uhci_check_transfer()

◆ uhci_check_transfer_sub()

static void uhci_check_transfer_sub ( struct usb_xfer xfer)
static

◆ uhci_device_bulk_close()

static void uhci_device_bulk_close ( struct usb_xfer xfer)
static

Definition at line 1876 of file uhci.c.

References uhci_device_done(), and USB_ERR_CANCELLED.

Here is the call graph for this function:

◆ uhci_device_bulk_enter()

static void uhci_device_bulk_enter ( struct usb_xfer xfer)
static

Definition at line 1882 of file uhci.c.

◆ uhci_device_bulk_open()

static void uhci_device_bulk_open ( struct usb_xfer xfer)
static

Definition at line 1870 of file uhci.c.

◆ uhci_device_bulk_start()

◆ uhci_device_ctrl_close()

static void uhci_device_ctrl_close ( struct usb_xfer xfer)
static

Definition at line 1933 of file uhci.c.

References uhci_device_done(), and USB_ERR_CANCELLED.

Here is the call graph for this function:

◆ uhci_device_ctrl_enter()

static void uhci_device_ctrl_enter ( struct usb_xfer xfer)
static

Definition at line 1939 of file uhci.c.

◆ uhci_device_ctrl_open()

static void uhci_device_ctrl_open ( struct usb_xfer xfer)
static

Definition at line 1927 of file uhci.c.

◆ uhci_device_ctrl_start()

◆ uhci_device_done()

◆ uhci_device_intr_close()

static void uhci_device_intr_close ( struct usb_xfer xfer)
static

Definition at line 2022 of file uhci.c.

References usb_xfer_root::bus, usb_xfer::qh_pos, uhci_softc::sc_intr_stat, UHCI_BUS2SC, uhci_device_done(), USB_ERR_CANCELLED, and usb_xfer::xroot.

Here is the call graph for this function:

◆ uhci_device_intr_enter()

static void uhci_device_intr_enter ( struct usb_xfer xfer)
static

Definition at line 2032 of file uhci.c.

◆ uhci_device_intr_open()

static void uhci_device_intr_open ( struct usb_xfer xfer)
static

◆ uhci_device_intr_start()

◆ uhci_device_isoc_close()

static void uhci_device_isoc_close ( struct usb_xfer xfer)
static

Definition at line 2103 of file uhci.c.

References uhci_device_done(), and USB_ERR_CANCELLED.

Here is the call graph for this function:

◆ uhci_device_isoc_enter()

◆ uhci_device_isoc_open()

static void uhci_device_isoc_open ( struct usb_xfer xfer)
static

◆ uhci_device_isoc_start()

static void uhci_device_isoc_start ( struct usb_xfer xfer)
static

Definition at line 2233 of file uhci.c.

References uhci_transfer_intr_enqueue().

Here is the call graph for this function:

◆ uhci_device_resume()

◆ uhci_device_suspend()

◆ uhci_do_poll()

static void uhci_do_poll ( struct usb_bus bus)
static

Definition at line 1498 of file uhci.c.

References bus, uhci_softc::sc_bus, UHCI_BUS2SC, uhci_interrupt_poll(), USB_BUS_LOCK, and USB_BUS_UNLOCK.

Referenced by uhci_init(), and uhci_resume().

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

◆ uhci_ep_init()

◆ uhci_get_dma_delay()

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

Definition at line 3006 of file uhci.c.

◆ uhci_init()

◆ uhci_init_qh()

static struct uhci_qh * uhci_init_qh ( struct usb_page_cache pc)
static

Definition at line 412 of file uhci.c.

References usb_page_search::buffer, uhci_qh::page_cache, uhci_qh::qh_self, UHCI_PTR_QH, and usbd_get_page().

Referenced by uhci_init().

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

◆ uhci_init_td()

static struct uhci_td * uhci_init_td ( struct usb_page_cache pc)
static

Definition at line 431 of file uhci.c.

References usb_page_search::buffer, uhci_td::page_cache, uhci_td::td_self, UHCI_PTR_TD, and usbd_get_page().

Referenced by uhci_init().

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

◆ uhci_interrupt()

void uhci_interrupt ( uhci_softc_t sc)

Definition at line 1414 of file uhci.c.

References DPRINTF, uhci_softc::sc_bus, status, uhci_interrupt_poll(), UHCI_STS, UHCI_STS_ALLINTRS, UHCI_STS_HCH, UHCI_STS_HCPE, UHCI_STS_HSE, UHCI_STS_RD, UHCI_STS_USBEI, UHCI_STS_USBINT, UREAD2, USB_BUS_LOCK, USB_BUS_UNLOCK, and UWRITE2.

Referenced by uhci_pci_attach().

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

◆ uhci_interrupt_poll()

static void uhci_interrupt_poll ( uhci_softc_t sc)
static

Definition at line 1390 of file uhci.c.

References usb_bus::intr_q, uhci_softc::sc_bus, and uhci_check_transfer().

Referenced by uhci_do_poll(), and uhci_interrupt().

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

◆ uhci_isoc_done()

◆ uhci_iterate_hw_softc()

◆ uhci_mem_layout_fixup()

◆ uhci_mem_layout_init()

static void uhci_mem_layout_init ( struct uhci_mem_layout ml,
struct usb_xfer xfer 
)
static

◆ uhci_non_isoc_done()

static void uhci_non_isoc_done ( struct usb_xfer xfer)
static

◆ uhci_non_isoc_done_sub()

◆ uhci_portreset()

static usb_error_t uhci_portreset ( uhci_softc_t sc,
uint16_t  index 
)
static

◆ uhci_rem_loop()

static void uhci_rem_loop ( uhci_softc_t sc)
static

Definition at line 855 of file uhci.c.

References uhci_qh::page_cache, uhci_qh::qh_h_next, uhci_softc::sc_last_qh_p, uhci_softc::sc_loops, UHCI_PTR_T, and usb_pc_cpu_flush().

Referenced by uhci_device_done(), and uhci_device_suspend().

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

◆ uhci_reset()

◆ uhci_restart()

static uint8_t uhci_restart ( uhci_softc_t sc)
static

Definition at line 277 of file uhci.c.

References usb_bus::bus_mtx, uhci_hw_softc::pframes_pc, uhci_softc::sc_bus, uhci_softc::sc_hw, UHCI_CMD, UHCI_CMD_MAXP, UHCI_CMD_RS, UHCI_FLBASEADDR, UHCI_STS, UHCI_STS_HCH, UHCICMD, UREAD2, USB_BUS_LOCK_ASSERT, usb_pause_mtx(), usbd_get_page(), and UWRITE4.

Referenced by uhci_portreset(), uhci_set_hw_power(), and uhci_start().

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

◆ uhci_resume()

static void uhci_resume ( uhci_softc_t sc)
static

Definition at line 678 of file uhci.c.

References uhci_softc::sc_bus, UHCI_CMD_FGR, uhci_do_poll(), uhci_reset(), uhci_start(), UHCICMD, USB_BUS_LOCK, and USB_BUS_UNLOCK.

Referenced by uhci_set_hw_power_sleep().

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

◆ uhci_root_intr()

static void uhci_root_intr ( uhci_softc_t sc)
static

Definition at line 2743 of file uhci.c.

References uhci_softc::sc_bus, uhci_softc::sc_hub_idata, uhci_softc::sc_root_intr, UHCI_PORTSC1, UHCI_PORTSC2, UHCI_PORTSC_CSC, UHCI_PORTSC_OCIC, UHCI_PORTSC_RD, uhci_root_intr(), uhub_root_intr(), UREAD2, USB_BUS_LOCK_ASSERT, and usb_callout_reset.

Referenced by uhci_root_intr(), and uhci_start().

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

◆ uhci_roothub_exec()

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

Definition at line 2418 of file uhci.c.

References usb_device::bus, usb_bus::bus_mtx, C, index, len, pptr, uhci_hub_desc::ps, req, uhci_softc::sc_addr, uhci_softc::sc_bus, uhci_softc::sc_conf, uhci_softc::sc_hub_desc, uhci_softc::sc_isreset, uhci_softc::sc_isresumed, uhci_softc::sc_vendor, uhci_hub_desc::stat, status, uhci_hub_desc::temp, UDESC_CONFIG, UDESC_DEVICE, UDESC_STRING, UDS_SELF_POWERED, UGETW, UHCI_BUS2SC, uhci_confd, uhci_devd, uhci_hubd_piix, UHCI_MAX_DEVICES, uhci_portreset(), UHCI_PORTSC1, UHCI_PORTSC2, UHCI_PORTSC_CCS, UHCI_PORTSC_CSC, UHCI_PORTSC_LS, UHCI_PORTSC_LS_SHIFT, UHCI_PORTSC_LSDA, UHCI_PORTSC_OCI, UHCI_PORTSC_OCIC, UHCI_PORTSC_PE, UHCI_PORTSC_POEDC, UHCI_PORTSC_PR, UHCI_PORTSC_RD, UHCI_PORTSC_SUSP, UHF_C_PORT_CONNECTION, UHF_C_PORT_ENABLE, UHF_C_PORT_OVER_CURRENT, UHF_C_PORT_RESET, UHF_C_PORT_SUSPEND, UHF_PORT_CONNECTION, UHF_PORT_ENABLE, UHF_PORT_LOW_SPEED, UHF_PORT_OVER_CURRENT, UHF_PORT_POWER, UHF_PORT_RESET, UHF_PORT_SUSPEND, UPS_C_CONNECT_STATUS, UPS_C_OVERCURRENT_INDICATOR, UPS_C_PORT_ENABLED, UPS_C_PORT_RESET, UPS_C_SUSPEND, UPS_CURRENT_CONNECT_STATUS, UPS_LOW_SPEED, UPS_OVERCURRENT_INDICATOR, UPS_PORT_ENABLED, UPS_PORT_POWER, UPS_SUSPEND, UR_CLEAR_FEATURE, UR_GET_BUS_STATE, UR_GET_CONFIG, UR_GET_DESCRIPTOR, UR_GET_INTERFACE, UR_GET_STATUS, UR_SET_ADDRESS, UR_SET_CONFIG, UR_SET_DESCRIPTOR, UR_SET_FEATURE, UR_SET_INTERFACE, UR_SYNCH_FRAME, UREAD2, URWMASK, USB_BUS_LOCK_ASSERT, USB_ERR_IOERROR, USB_ERR_NORMAL_COMPLETION, usb_make_str_desc(), usb_pause_mtx(), 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, UWRITE2, value, usb_port_status::wPortChange, usb_port_status::wPortStatus, and usb_status::wStatus.

Here is the call graph for this function:

◆ uhci_set_hw_power()

static void uhci_set_hw_power ( struct usb_bus bus)
static

◆ uhci_set_hw_power_sleep()

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

Definition at line 3098 of file uhci.c.

References bus, state, UHCI_BUS2SC, uhci_resume(), uhci_suspend(), USB_HW_POWER_RESUME, USB_HW_POWER_SHUTDOWN, and USB_HW_POWER_SUSPEND.

Here is the call graph for this function:

◆ uhci_setup_standard_chain()

static uhci_td_t * uhci_setup_standard_chain ( struct usb_xfer xfer)
static

Definition at line 1643 of file uhci.c.

References usb_xfer::address, uhci_std_temp::average, uhci_mem_layout::buf_pc, 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, usb_xfer::endpoint, usb_xfer::endpointno, usb_xfer::flags, usb_xfer::flags_int, usb_xfer_flags::force_short_xfer, usb_xfer::frbuffers, usb_xfer::frlengths, uhci_std_temp::last_frame, uhci_std_temp::len, uhci_std_temp::max_frame_size, usb_xfer::max_frame_size, uhci_std_temp::ml, usb_xfer::nframes, uhci_td::page_cache, uhci_std_temp::setup_alt_next, usb_xfer_flags_int::short_frames_ok, uhci_std_temp::shortpkt, usb_device::speed, usb_xfer::sumlen, uhci_std_temp::td, uhci_std_temp::td_next, uhci_td::td_next, usb_xfer::td_start, uhci_std_temp::td_status, uhci_td::td_status, uhci_std_temp::td_token, 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, uhci_mem_layout_init(), UHCI_PTR_T, uhci_setup_standard_chain_sub(), UHCI_TD_ACTIVE, UHCI_TD_IOC, UHCI_TD_LS, UHCI_TD_PID_IN, UHCI_TD_PID_OUT, UHCI_TD_PID_SETUP, UHCI_TD_SET_DEVADDR, UHCI_TD_SET_DT, UHCI_TD_SET_ENDPT, UHCI_TD_SET_ERRCNT, UHCI_TD_ZERO_ACTLEN, usb_pc_cpu_flush(), USB_SPEED_LOW, usbd_get_speed(), and usb_xfer::xroot.

Referenced by uhci_device_bulk_start(), uhci_device_ctrl_start(), and uhci_device_intr_start().

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

◆ uhci_setup_standard_chain_sub()

◆ uhci_start()

static void uhci_start ( uhci_softc_t sc)
static

Definition at line 388 of file uhci.c.

References usb_bus::bdev, uhci_softc::sc_bus, UHCI_INTR, UHCI_INTR_IOCE, UHCI_INTR_RIE, UHCI_INTR_SPIE, UHCI_INTR_TOCRCIE, uhci_restart(), uhci_root_intr(), USB_BUS_LOCK_ASSERT, and UWRITE2.

Referenced by uhci_init(), and uhci_resume().

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

◆ uhci_suspend()

static void uhci_suspend ( uhci_softc_t sc)
static

Definition at line 656 of file uhci.c.

References uhci_softc::sc_bus, UHCI_CMD_EGSM, uhci_reset(), UHCICMD, USB_BUS_LOCK, and USB_BUS_UNLOCK.

Referenced by uhci_set_hw_power_sleep().

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

◆ uhci_timeout()

static void uhci_timeout ( void *  arg)
static

Definition at line 1485 of file uhci.c.

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

Referenced by uhci_transfer_intr_enqueue().

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

◆ uhci_transfer_intr_enqueue()

static void uhci_transfer_intr_enqueue ( struct usb_xfer xfer)
static

Definition at line 874 of file uhci.c.

References usb_xfer_root::bus, usb_bus::intr_q, usb_xfer::timeout, uhci_check_transfer(), uhci_timeout(), usbd_transfer_enqueue(), usbd_transfer_timeout_ms(), and usb_xfer::xroot.

Referenced by uhci_device_bulk_start(), uhci_device_ctrl_start(), uhci_device_intr_start(), and uhci_device_isoc_start().

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

◆ uhci_xfer_setup()

◆ uhci_xfer_unsetup()

static void uhci_xfer_unsetup ( struct usb_xfer xfer)
static

Definition at line 3000 of file uhci.c.

Variable Documentation

◆ uhci_bus_methods

static const struct usb_bus_methods uhci_bus_methods
static
Initial value:
=
{
.endpoint_init = uhci_ep_init,
.xfer_setup = uhci_xfer_setup,
.xfer_unsetup = uhci_xfer_unsetup,
.get_dma_delay = uhci_get_dma_delay,
.device_resume = uhci_device_resume,
.device_suspend = uhci_device_suspend,
.set_hw_power = uhci_set_hw_power,
.set_hw_power_sleep = uhci_set_hw_power_sleep,
.roothub_exec = uhci_roothub_exec,
.xfer_poll = uhci_do_poll,
}
static usb_error_t uhci_roothub_exec(struct usb_device *udev, struct usb_device_request *req, const void **pptr, uint16_t *plength)
Definition: uhci.c:2418
static void uhci_xfer_setup(struct usb_setup_params *parm)
Definition: uhci.c:2771
static void uhci_xfer_unsetup(struct usb_xfer *xfer)
Definition: uhci.c:3000
static void uhci_do_poll(struct usb_bus *)
Definition: uhci.c:1498
static void uhci_device_suspend(struct usb_device *udev)
Definition: uhci.c:3056
static void uhci_device_resume(struct usb_device *udev)
Definition: uhci.c:3016
static void uhci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, struct usb_endpoint *ep)
Definition: uhci.c:2966
static void uhci_set_hw_power(struct usb_bus *bus)
Definition: uhci.c:3116
static void uhci_get_dma_delay(struct usb_device *udev, uint32_t *pus)
Definition: uhci.c:3006
static void uhci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state)
Definition: uhci.c:3098

Definition at line 152 of file uhci.c.

Referenced by uhci_init().

◆ uhci_confd

const struct uhci_config_desc uhci_confd
static
Initial value:
= {
.confd = {
.bLength = sizeof(struct usb_config_descriptor),
.wTotalLength[0] = sizeof(uhci_confd),
.bMaxPower = 0
},
.ifcd = {
.bLength = sizeof(struct usb_interface_descriptor),
.bNumEndpoints = 1,
.bInterfaceClass = UICLASS_HUB,
.bInterfaceSubClass = UISUBCLASS_HUB,
.bInterfaceProtocol = UIPROTO_FSHUB,
},
.endpd = {
.bLength = sizeof(struct usb_endpoint_descriptor),
.bEndpointAddress = UE_DIR_IN | UHCI_INTR_ENDPT,
.bmAttributes = UE_INTERRUPT,
.wMaxPacketSize[0] = 8,
.bInterval = 255,
},
}
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 UHCI_INTR_ENDPT
Definition: uhci.c:124
static const struct uhci_config_desc uhci_confd
Definition: uhci.c:2268
#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
#define UIPROTO_FSHUB
Definition: usb.h:481

Definition at line 2268 of file uhci.c.

Referenced by uhci_roothub_exec().

◆ uhci_devd

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

Definition at line 2254 of file uhci.c.

Referenced by uhci_roothub_exec().

◆ uhci_device_bulk_methods

static const struct usb_pipe_methods uhci_device_bulk_methods
static
Initial value:
=
{
}
static void uhci_device_bulk_start(struct usb_xfer *xfer)
Definition: uhci.c:1888
static void uhci_device_bulk_open(struct usb_xfer *xfer)
Definition: uhci.c:1870
static void uhci_device_bulk_close(struct usb_xfer *xfer)
Definition: uhci.c:1876
static void uhci_device_bulk_enter(struct usb_xfer *xfer)
Definition: uhci.c:1882

Definition at line 153 of file uhci.c.

Referenced by uhci_device_done(), uhci_device_resume(), uhci_device_suspend(), uhci_ep_init(), and uhci_xfer_setup().

◆ uhci_device_ctrl_methods

static const struct usb_pipe_methods uhci_device_ctrl_methods
static
Initial value:
=
{
}
static void uhci_device_ctrl_start(struct usb_xfer *xfer)
Definition: uhci.c:1945
static void uhci_device_ctrl_open(struct usb_xfer *xfer)
Definition: uhci.c:1927
static void uhci_device_ctrl_enter(struct usb_xfer *xfer)
Definition: uhci.c:1939
static void uhci_device_ctrl_close(struct usb_xfer *xfer)
Definition: uhci.c:1933

Definition at line 154 of file uhci.c.

Referenced by uhci_device_done(), uhci_device_resume(), uhci_device_suspend(), uhci_ep_init(), and uhci_xfer_setup().

◆ uhci_device_intr_methods

static const struct usb_pipe_methods uhci_device_intr_methods
static
Initial value:
=
{
}
static void uhci_device_intr_close(struct usb_xfer *xfer)
Definition: uhci.c:2022
static void uhci_device_intr_open(struct usb_xfer *xfer)
Definition: uhci.c:1989
static void uhci_device_intr_enter(struct usb_xfer *xfer)
Definition: uhci.c:2032
static void uhci_device_intr_start(struct usb_xfer *xfer)
Definition: uhci.c:2038

Definition at line 155 of file uhci.c.

Referenced by uhci_device_done(), uhci_device_resume(), uhci_device_suspend(), uhci_ep_init(), and uhci_xfer_setup().

◆ uhci_device_isoc_methods

static const struct usb_pipe_methods uhci_device_isoc_methods
static
Initial value:
=
{
}
static void uhci_device_isoc_enter(struct usb_xfer *xfer)
Definition: uhci.c:2109
static void uhci_device_isoc_close(struct usb_xfer *xfer)
Definition: uhci.c:2103
static void uhci_device_isoc_open(struct usb_xfer *xfer)
Definition: uhci.c:2076
static void uhci_device_isoc_start(struct usb_xfer *xfer)
Definition: uhci.c:2233

Definition at line 156 of file uhci.c.

Referenced by uhci_check_transfer(), uhci_device_done(), uhci_ep_init(), and uhci_xfer_setup().

◆ uhci_hubd_piix

const struct usb_hub_descriptor_min uhci_hubd_piix
static
Initial value:
=
{
.bDescLength = sizeof(uhci_hubd_piix),
.bDescriptorType = UDESC_HUB,
.bNbrPorts = 2,
.wHubCharacteristics = {UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL, 0},
.bPwrOn2PwrGood = 50,
}
static const struct usb_hub_descriptor_min uhci_hubd_piix
Definition: uhci.c:2298
#define UDESC_HUB
Definition: usb.h:214
#define UHD_OC_INDIVIDUAL
Definition: usb.h:614
#define UHD_PWR_NO_SWITCH
Definition: usb.h:610

Definition at line 2298 of file uhci.c.

Referenced by uhci_roothub_exec().