|
iPXE
|
USB eXtensible Host Controller Interface (xHCI) driver. More...
#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <string.h>#include <strings.h>#include <errno.h>#include <byteswap.h>#include <ipxe/malloc.h>#include <ipxe/pci.h>#include <ipxe/usb.h>#include <ipxe/init.h>#include <ipxe/profile.h>#include <ipxe/xhci.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| void | xhci_init (struct xhci_device *xhci) |
| Initialise device. More... | |
| static unsigned int | xhci_extended_capability (struct xhci_device *xhci, unsigned int id, unsigned int offset) |
| Find extended capability. More... | |
| static int | xhci_writeq (struct xhci_device *xhci, physaddr_t value, void *reg) |
| Write potentially 64-bit register. More... | |
| static size_t | xhci_align (size_t len) |
| Calculate buffer alignment. More... | |
| static size_t | xhci_device_context_offset (struct xhci_device *xhci, unsigned int ctx) |
| Calculate device context offset. More... | |
| static size_t | xhci_input_context_offset (struct xhci_device *xhci, unsigned int ctx) |
| Calculate input context offset. More... | |
| static void | xhci_dump (struct xhci_device *xhci) |
| Dump host controller registers. More... | |
| static void | xhci_dump_port (struct xhci_device *xhci, unsigned int port) |
| Dump port registers. More... | |
| static void | xhci_legacy_init (struct xhci_device *xhci) |
| Initialise USB legacy support. More... | |
| static void | xhci_legacy_claim (struct xhci_device *xhci) |
| Claim ownership from BIOS. More... | |
| static void | xhci_legacy_release (struct xhci_device *xhci) |
| Release ownership back to BIOS. More... | |
| static const char * | xhci_speed_name (uint32_t psi) |
| Transcribe port speed (for debugging) More... | |
| static unsigned int | xhci_supported_protocol (struct xhci_device *xhci, unsigned int port) |
| Find supported protocol extended capability for a port. More... | |
| static unsigned int | xhci_port_protocol (struct xhci_device *xhci, unsigned int port) |
| Find port protocol. More... | |
| static int | xhci_port_slot_type (struct xhci_device *xhci, unsigned int port) |
| Find port slot type. More... | |
| static int | xhci_port_speed (struct xhci_device *xhci, unsigned int port, unsigned int psiv) |
| Find port speed. More... | |
| static int | xhci_port_psiv (struct xhci_device *xhci, unsigned int port, unsigned int speed) |
| Find protocol speed ID value. More... | |
| static int | xhci_dcbaa_alloc (struct xhci_device *xhci) |
| Allocate device context base address array. More... | |
| static void | xhci_dcbaa_free (struct xhci_device *xhci) |
| Free device context base address array. More... | |
| static int | xhci_scratchpad_alloc (struct xhci_device *xhci) |
| Allocate scratchpad buffers. More... | |
| static void | xhci_scratchpad_free (struct xhci_device *xhci) |
| Free scratchpad buffers. More... | |
| static void | xhci_run (struct xhci_device *xhci) |
| Start xHCI device. More... | |
| static int | xhci_stop (struct xhci_device *xhci) |
| Stop xHCI device. More... | |
| static int | xhci_reset (struct xhci_device *xhci) |
| Reset xHCI device. More... | |
| static int | xhci_fail (struct xhci_device *xhci) |
| Mark xHCI device as permanently failed. More... | |
| static int | xhci_ring_alloc (struct xhci_device *xhci, struct xhci_trb_ring *ring, unsigned int shift, unsigned int slot, unsigned int target, unsigned int stream) |
| Allocate transfer request block ring. More... | |
| static void | xhci_ring_reset (struct xhci_trb_ring *ring) |
| Reset transfer request block ring. More... | |
| static void | xhci_ring_free (struct xhci_trb_ring *ring) |
| Free transfer request block ring. More... | |
| static int | xhci_enqueue (struct xhci_trb_ring *ring, struct io_buffer *iobuf, const union xhci_trb *trb) |
| Enqueue a transfer request block. More... | |
| static struct io_buffer * | xhci_dequeue (struct xhci_trb_ring *ring) |
| Dequeue a transfer request block. More... | |
| static int | xhci_enqueue_multi (struct xhci_trb_ring *ring, struct io_buffer *iobuf, const union xhci_trb *trbs, unsigned int count) |
| Enqueue multiple transfer request blocks. More... | |
| static struct io_buffer * | xhci_dequeue_multi (struct xhci_trb_ring *ring) |
| Dequeue multiple transfer request blocks. More... | |
| static void | xhci_doorbell (struct xhci_trb_ring *ring) |
| Ring doorbell register. More... | |
| static int | xhci_command_alloc (struct xhci_device *xhci) |
| Allocate command ring. More... | |
| static void | xhci_command_free (struct xhci_device *xhci) |
| Free command ring. More... | |
| static int | xhci_event_alloc (struct xhci_device *xhci) |
| Allocate event ring. More... | |
| static void | xhci_event_free (struct xhci_device *xhci) |
| Free event ring. More... | |
| static void | xhci_transfer (struct xhci_device *xhci, struct xhci_trb_transfer *trb) |
| Handle transfer event. More... | |
| static void | xhci_complete (struct xhci_device *xhci, struct xhci_trb_complete *trb) |
| Handle command completion event. More... | |
| static void | xhci_port_status (struct xhci_device *xhci, struct xhci_trb_port_status *trb) |
| Handle port status event. More... | |
| static void | xhci_host_controller (struct xhci_device *xhci, struct xhci_trb_host_controller *trb) |
| Handle host controller event. More... | |
| static void | xhci_event_poll (struct xhci_device *xhci) |
| Poll event ring. More... | |
| static void | xhci_abort (struct xhci_device *xhci) |
| Abort command. More... | |
| static int | xhci_command (struct xhci_device *xhci, union xhci_trb *trb) |
| Issue command and wait for completion. More... | |
| static int | xhci_nop (struct xhci_device *xhci) |
| Issue NOP and wait for completion. More... | |
| static int | xhci_enable_slot (struct xhci_device *xhci, unsigned int type) |
| Enable slot. More... | |
| static int | xhci_disable_slot (struct xhci_device *xhci, unsigned int slot) |
| Disable slot. More... | |
| static int | xhci_context (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint, unsigned int type, void(*populate)(struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint, void *input)) |
| Issue context-based command and wait for completion. More... | |
| static void | xhci_address_device_input (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint, void *input) |
| Populate address device input context. More... | |
| static int | xhci_address_device (struct xhci_device *xhci, struct xhci_slot *slot) |
| Address device. More... | |
| static void | xhci_configure_endpoint_input (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint, void *input) |
| Populate configure endpoint input context. More... | |
| static int | xhci_configure_endpoint (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint) |
| Configure endpoint. More... | |
| static void | xhci_deconfigure_endpoint_input (struct xhci_device *xhci __unused, struct xhci_slot *slot __unused, struct xhci_endpoint *endpoint, void *input) |
| Populate deconfigure endpoint input context. More... | |
| static int | xhci_deconfigure_endpoint (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint) |
| Deconfigure endpoint. More... | |
| static void | xhci_evaluate_context_input (struct xhci_device *xhci, struct xhci_slot *slot __unused, struct xhci_endpoint *endpoint, void *input) |
| Populate evaluate context input context. More... | |
| static int | xhci_evaluate_context (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint) |
| Evaluate context. More... | |
| static int | xhci_reset_endpoint (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint) |
| Reset endpoint. More... | |
| static int | xhci_stop_endpoint (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint) |
| Stop endpoint. More... | |
| static int | xhci_set_tr_dequeue_pointer (struct xhci_device *xhci, struct xhci_slot *slot, struct xhci_endpoint *endpoint) |
| Set transfer ring dequeue pointer. More... | |
| static int | xhci_endpoint_open (struct usb_endpoint *ep) |
| Open endpoint. More... | |
| static void | xhci_endpoint_close (struct usb_endpoint *ep) |
| Close endpoint. More... | |
| static int | xhci_endpoint_reset (struct usb_endpoint *ep) |
| Reset endpoint. More... | |
| static int | xhci_endpoint_mtu (struct usb_endpoint *ep) |
| Update MTU. More... | |
| static int | xhci_endpoint_message (struct usb_endpoint *ep, struct io_buffer *iobuf) |
| Enqueue message transfer. More... | |
| static unsigned int | xhci_endpoint_count (size_t len, int zlp) |
| Calculate number of TRBs. More... | |
| static int | xhci_endpoint_stream (struct usb_endpoint *ep, struct io_buffer *iobuf, int zlp) |
| Enqueue stream transfer. More... | |
| static int | xhci_device_open (struct usb_device *usb) |
| Open device. More... | |
| static void | xhci_device_close (struct usb_device *usb) |
| Close device. More... | |
| static int | xhci_device_address (struct usb_device *usb) |
| Assign device address. More... | |
| static int | xhci_bus_open (struct usb_bus *bus) |
| Open USB bus. More... | |
| static void | xhci_bus_close (struct usb_bus *bus) |
| Close USB bus. More... | |
| static void | xhci_bus_poll (struct usb_bus *bus) |
| Poll USB bus. More... | |
| static int | xhci_hub_open (struct usb_hub *hub) |
| Open hub. More... | |
| static void | xhci_hub_close (struct usb_hub *hub __unused) |
| Close hub. More... | |
| static int | xhci_root_open (struct usb_hub *hub) |
| Open root hub. More... | |
| static void | xhci_root_close (struct usb_hub *hub __unused) |
| Close root hub. More... | |
| static int | xhci_root_enable (struct usb_hub *hub, struct usb_port *port) |
| Enable port. More... | |
| static int | xhci_root_disable (struct usb_hub *hub, struct usb_port *port) |
| Disable port. More... | |
| static int | xhci_root_speed (struct usb_hub *hub, struct usb_port *port) |
| Update root hub port speed. More... | |
| static int | xhci_root_clear_tt (struct usb_hub *hub, struct usb_port *port, struct usb_endpoint *ep) |
| Clear transaction translator buffer. More... | |
| int | xhci_register (struct xhci_device *xhci) |
| Register xHCI controller. More... | |
| void | xhci_unregister (struct xhci_device *xhci) |
| Unregister xHCI controller. More... | |
| static void | xhci_pch_fix (struct xhci_device *xhci, struct pci_device *pci) |
| Fix Intel PCH-specific quirks. More... | |
| static void | xhci_pch_undo (struct xhci_device *xhci, struct pci_device *pci) |
| Undo Intel PCH-specific quirk fixes. More... | |
| static int | xhci_probe (struct pci_device *pci) |
| Probe PCI device. More... | |
| static void | xhci_remove (struct pci_device *pci) |
| Remove PCI device. More... | |
| static void | xhci_shutdown (int booting) |
| Prepare for exit. More... | |
| struct startup_fn xhci_startup | __startup_fn (STARTUP_LATE) |
| Startup/shutdown function. More... | |
Variables | |
| static struct profiler xhci_message_profiler | __profiler |
| Message transfer profiler. More... | |
| static int | xhci_legacy_prevent_release |
| Prevent the release of ownership back to BIOS. More... | |
| static struct usb_host_operations | xhci_operations |
| USB host controller operations. More... | |
| static struct pci_device_id | xhci_ids [] |
| XHCI PCI device IDs. More... | |
| struct pci_driver xhci_driver | __pci_driver |
| XHCI PCI driver. More... | |
USB eXtensible Host Controller Interface (xHCI) driver.
Definition in file xhci.c.
| #define EIO_DATA __einfo_error ( EINFO_EIO_DATA ) |
| #define EINFO_EIO_DATA |
| #define EIO_BABBLE __einfo_error ( EINFO_EIO_BABBLE ) |
| #define EINFO_EIO_BABBLE |
| #define EIO_USB __einfo_error ( EINFO_EIO_USB ) |
| #define EINFO_EIO_USB |
| #define EIO_TRB __einfo_error ( EINFO_EIO_TRB ) |
| #define EINFO_EIO_TRB |
| #define EIO_STALL __einfo_error ( EINFO_EIO_STALL ) |
| #define EINFO_EIO_STALL |
| #define EIO_RESOURCE __einfo_error ( EINFO_EIO_RESOURCE ) |
| #define EINFO_EIO_RESOURCE |
| #define EIO_BANDWIDTH __einfo_error ( EINFO_EIO_BANDWIDTH ) |
| #define EINFO_EIO_BANDWIDTH |
| #define EIO_NO_SLOTS __einfo_error ( EINFO_EIO_NO_SLOTS ) |
| #define EINFO_EIO_NO_SLOTS |
| #define EIO_STREAM_TYPE __einfo_error ( EINFO_EIO_STREAM_TYPE ) |
| #define EINFO_EIO_STREAM_TYPE |
| #define EIO_SLOT __einfo_error ( EINFO_EIO_SLOT ) |
| #define EINFO_EIO_SLOT |
| #define EIO_ENDPOINT __einfo_error ( EINFO_EIO_ENDPOINT ) |
| #define EINFO_EIO_ENDPOINT |
| #define EIO_SHORT __einfo_error ( EINFO_EIO_SHORT ) |
| #define EINFO_EIO_SHORT |
| #define EIO_UNDERRUN __einfo_error ( EINFO_EIO_UNDERRUN ) |
| #define EINFO_EIO_UNDERRUN |
| #define EIO_OVERRUN __einfo_error ( EINFO_EIO_OVERRUN ) |
| #define EINFO_EIO_OVERRUN |
| #define EIO_VF_RING_FULL __einfo_error ( EINFO_EIO_VF_RING_FULL ) |
| #define EINFO_EIO_VF_RING_FULL |
| #define EIO_PARAMETER __einfo_error ( EINFO_EIO_PARAMETER ) |
| #define EINFO_EIO_PARAMETER |
| #define EIO_BANDWIDTH_OVERRUN __einfo_error ( EINFO_EIO_BANDWIDTH_OVERRUN ) |
| #define EINFO_EIO_BANDWIDTH_OVERRUN |
| #define EIO_CONTEXT __einfo_error ( EINFO_EIO_CONTEXT ) |
| #define EINFO_EIO_CONTEXT |
| #define EIO_NO_PING __einfo_error ( EINFO_EIO_NO_PING ) |
| #define EINFO_EIO_NO_PING |
| #define EIO_RING_FULL __einfo_error ( EINFO_EIO_RING_FULL ) |
| #define EINFO_EIO_RING_FULL |
| #define EIO_INCOMPATIBLE __einfo_error ( EINFO_EIO_INCOMPATIBLE ) |
| #define EINFO_EIO_INCOMPATIBLE |
| #define EIO_MISSED __einfo_error ( EINFO_EIO_MISSED ) |
| #define EINFO_EIO_MISSED |
| #define EIO_CMD_STOPPED __einfo_error ( EINFO_EIO_CMD_STOPPED ) |
| #define EINFO_EIO_CMD_STOPPED |
| #define EIO_CMD_ABORTED __einfo_error ( EINFO_EIO_CMD_ABORTED ) |
| #define EINFO_EIO_CMD_ABORTED |
| #define EIO_STOP __einfo_error ( EINFO_EIO_STOP ) |
| #define EINFO_EIO_STOP |
| #define EIO_STOP_LEN __einfo_error ( EINFO_EIO_STOP_LEN ) |
| #define EINFO_EIO_STOP_LEN |
| #define EIO_STOP_SHORT __einfo_error ( EINFO_EIO_STOP_SHORT ) |
| #define EINFO_EIO_STOP_SHORT |
| #define EIO_LATENCY __einfo_error ( EINFO_EIO_LATENCY ) |
| #define EINFO_EIO_LATENCY |
| #define EIO_ISOCH __einfo_error ( EINFO_EIO_ISOCH ) |
| #define EINFO_EIO_ISOCH |
| #define EPROTO_LOST __einfo_error ( EINFO_EPROTO_LOST ) |
| #define EINFO_EPROTO_LOST |
| #define EPROTO_UNDEFINED __einfo_error ( EINFO_EPROTO_UNDEFINED ) |
| #define EINFO_EPROTO_UNDEFINED |
| #define EPROTO_STREAM_ID __einfo_error ( EINFO_EPROTO_STREAM_ID ) |
| #define EINFO_EPROTO_STREAM_ID |
| #define EPROTO_SECONDARY __einfo_error ( EINFO_EPROTO_SECONDARY ) |
| #define EINFO_EPROTO_SECONDARY |
| #define EPROTO_SPLIT __einfo_error ( EINFO_EPROTO_SPLIT ) |
| #define EINFO_EPROTO_SPLIT |
| #define ECODE | ( | code | ) |
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| void xhci_init | ( | struct xhci_device * | xhci | ) |
Initialise device.
| xhci | xHCI device |
Definition at line 263 of file xhci.c.
References xhci_device::addr64, assert(), xhci_device::cap, xhci_scratchpad::count, xhci_device::csz_shift, xhci_device::db, DBGC, DBGC2, xhci_device::dev, xhci_device::dma, dma_set_mask_64bit(), xhci_device::intrs, device::name, xhci_device::name, xhci_device::op, xhci_device::pagesize, xhci_device::ports, readb(), readl(), xhci_device::regs, xhci_device::run, xhci_device::scratch, xhci_device::slots, xhci_device::xecp, XHCI_CAP_CAPLENGTH, XHCI_CAP_DBOFF, XHCI_CAP_HCCPARAMS1, XHCI_CAP_HCSPARAMS1, XHCI_CAP_HCSPARAMS2, XHCI_CAP_RTSOFF, XHCI_HCCPARAMS1_ADDR64, XHCI_HCCPARAMS1_CSZ_SHIFT, XHCI_HCCPARAMS1_XECP, XHCI_HCSPARAMS1_INTRS, XHCI_HCSPARAMS1_PORTS, XHCI_HCSPARAMS1_SLOTS, XHCI_HCSPARAMS2_SCRATCHPADS, XHCI_OP_PAGESIZE, and XHCI_PAGESIZE.
Referenced by dwusb_probe(), and xhci_probe().
|
static |
Find extended capability.
| xhci | xHCI device |
| id | Capability ID |
| offset | Offset to previous extended capability instance, or zero |
| offset | Offset to extended capability, or zero if not found |
Definition at line 329 of file xhci.c.
References xhci_device::cap, next, offset, readl(), xhci_device::xecp, XHCI_XECP_ID, and XHCI_XECP_NEXT.
Referenced by xhci_legacy_init(), and xhci_supported_protocol().
|
inlinestatic |
Write potentially 64-bit register.
| xhci | xHCI device |
| value | Value |
| reg | Register address |
| rc | Return status code |
Definition at line 365 of file xhci.c.
References xhci_device::addr64, DBGC, ENOTSUP, xhci_device::name, reg, value, writel(), and writeq().
Referenced by xhci_abort(), xhci_command_alloc(), xhci_command_free(), xhci_dcbaa_alloc(), xhci_dcbaa_free(), xhci_event_alloc(), xhci_event_free(), and xhci_event_poll().
Calculate buffer alignment.
| len | Length |
| align | Buffer alignment |
Determine alignment required for a buffer which must be aligned to at least XHCI_MIN_ALIGN and which must not cross a page boundary.
Definition at line 399 of file xhci.c.
References fls, len, and XHCI_MIN_ALIGN.
Referenced by xhci_context(), xhci_dcbaa_alloc(), xhci_device_open(), xhci_event_alloc(), xhci_ring_alloc(), and xhci_scratchpad_alloc().
|
inlinestatic |
Calculate device context offset.
| xhci | xHCI device |
| ctx | Context index |
Definition at line 418 of file xhci.c.
References xhci_device::csz_shift, ctx, and XHCI_DCI.
Referenced by xhci_address_device(), xhci_device_close(), xhci_device_open(), and xhci_endpoint_open().
|
inlinestatic |
Calculate input context offset.
| xhci | xHCI device |
| ctx | Context index |
Definition at line 430 of file xhci.c.
References xhci_device::csz_shift, ctx, and XHCI_ICI.
Referenced by xhci_address_device_input(), xhci_configure_endpoint_input(), xhci_context(), xhci_deconfigure_endpoint_input(), and xhci_evaluate_context_input().
|
inlinestatic |
Dump host controller registers.
| xhci | xHCI device |
Definition at line 448 of file xhci.c.
References DBG_LOG, DBGC, xhci_device::name, xhci_device::op, readl(), XHCI_OP_CONFIG, XHCI_OP_DNCTRL, XHCI_OP_PAGESIZE, XHCI_OP_USBCMD, XHCI_OP_USBSTS, XHCI_USBCMD_HCRST, XHCI_USBCMD_RUN, and XHCI_USBSTS_HCH.
|
inlinestatic |
Dump port registers.
| xhci | xHCI device |
| port | Port number |
Definition at line 489 of file xhci.c.
References DBG_LOG, DBGC, xhci_device::name, xhci_device::op, port, readl(), XHCI_OP_PORTHLPMC, XHCI_OP_PORTLI, XHCI_OP_PORTPMSC, XHCI_OP_PORTSC, XHCI_PORTSC_CCS, XHCI_PORTSC_PED, XHCI_PORTSC_PP, XHCI_PORTSC_PR, and XHCI_PORTSC_PSIV.
|
static |
Initialise USB legacy support.
| xhci | xHCI device |
Definition at line 539 of file xhci.c.
References xhci_device::cap, DBGC, xhci_device::legacy, xhci_device::name, readb(), xhci_extended_capability(), XHCI_USBLEGSUP_BIOS, XHCI_USBLEGSUP_BIOS_OWNED, and XHCI_XECP_ID_LEGACY.
Referenced by xhci_probe().
|
static |
Claim ownership from BIOS.
| xhci | xHCI device |
Definition at line 570 of file xhci.c.
References xhci_device::cap, DBGC, xhci_device::legacy, mdelay(), xhci_device::name, readb(), readl(), writeb(), writel(), XHCI_USBLEGSUP_BIOS, XHCI_USBLEGSUP_BIOS_OWNED, XHCI_USBLEGSUP_CTLSTS, XHCI_USBLEGSUP_MAX_WAIT_MS, XHCI_USBLEGSUP_OS, and XHCI_USBLEGSUP_OS_OWNED.
Referenced by xhci_probe().
|
static |
Release ownership back to BIOS.
| xhci | xHCI device |
Definition at line 617 of file xhci.c.
References xhci_device::cap, DBGC, xhci_device::legacy, xhci_device::name, writeb(), xhci_legacy_prevent_release, and XHCI_USBLEGSUP_OS.
Referenced by xhci_probe(), and xhci_remove().
|
inlinestatic |
Transcribe port speed (for debugging)
| psi | Protocol speed ID |
| speed | Transcribed speed |
Definition at line 648 of file xhci.c.
References snprintf(), XHCI_SUPPORTED_PSI_EXPONENT, and XHCI_SUPPORTED_PSI_MANTISSA.
Referenced by xhci_port_protocol().
|
static |
Find supported protocol extended capability for a port.
| xhci | xHCI device |
| port | Port number |
| supported | Offset to extended capability, or zero if not found |
Definition at line 671 of file xhci.c.
References xhci_device::cap, count, DBGC, xhci_device::name, offset, port, readl(), supported, xhci_extended_capability(), XHCI_SUPPORTED_PORTS, XHCI_SUPPORTED_PORTS_COUNT, XHCI_SUPPORTED_PORTS_OFFSET, and XHCI_XECP_ID_SUPPORTED.
Referenced by xhci_port_protocol(), xhci_port_psiv(), xhci_port_slot_type(), and xhci_port_speed().
|
static |
Find port protocol.
| xhci | xHCI device |
| port | Port number |
| protocol | USB protocol, or zero if not found |
Definition at line 705 of file xhci.c.
References xhci_device::cap, cpu_to_le32, DBG_EXTRA, DBGC2, xhci_device::name, name, port, protocol, xhci_device::quirks, raw, readl(), revision, slot, supported, type, XHCI_BAD_PSIV, xhci_speed_name(), XHCI_SUPPORTED_NAME, XHCI_SUPPORTED_PORTS, XHCI_SUPPORTED_PORTS_PSIC, xhci_supported_protocol(), XHCI_SUPPORTED_PSI, XHCI_SUPPORTED_PSI_VALUE, XHCI_SUPPORTED_REVISION, XHCI_SUPPORTED_REVISION_VER, XHCI_SUPPORTED_SLOT, and XHCI_SUPPORTED_SLOT_TYPE.
Referenced by xhci_register().
|
static |
Find port slot type.
| xhci | xHCI device |
| port | Port number |
| type | Slot type, or negative error |
Definition at line 766 of file xhci.c.
References xhci_device::cap, ENOTSUP, port, readl(), slot, supported, type, xhci_supported_protocol(), XHCI_SUPPORTED_SLOT, and XHCI_SUPPORTED_SLOT_TYPE.
Referenced by xhci_device_open().
|
static |
Find port speed.
| xhci | xHCI device |
| port | Port number |
| psiv | Protocol speed ID value |
| speed | Port speed, or negative error |
Definition at line 790 of file xhci.c.
References xhci_device::cap, DBGC, ENOTSUP, xhci_device::name, port, xhci_device::quirks, readl(), supported, USB_SPEED, USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_LOW, USB_SPEED_SUPER, XHCI_BAD_PSIV, XHCI_SPEED_FULL, XHCI_SPEED_HIGH, XHCI_SPEED_LOW, XHCI_SPEED_SUPER, XHCI_SUPPORTED_PORTS, XHCI_SUPPORTED_PORTS_PSIC, xhci_supported_protocol(), XHCI_SUPPORTED_PSI, XHCI_SUPPORTED_PSI_EXPONENT, XHCI_SUPPORTED_PSI_MANTISSA, and XHCI_SUPPORTED_PSI_VALUE.
Referenced by xhci_root_speed().
|
static |
Find protocol speed ID value.
| xhci | xHCI device |
| port | Port number |
| speed | USB speed |
| psiv | Protocol speed ID value, or negative error |
Definition at line 854 of file xhci.c.
References xhci_device::cap, DBGC, ENOENT, ENOTSUP, xhci_device::name, port, xhci_device::quirks, readl(), supported, USB_SPEED, USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_LOW, USB_SPEED_SUPER, XHCI_BAD_PSIV, XHCI_SPEED_FULL, XHCI_SPEED_HIGH, XHCI_SPEED_LOW, XHCI_SPEED_SUPER, XHCI_SUPPORTED_PORTS, XHCI_SUPPORTED_PORTS_PSIC, xhci_supported_protocol(), XHCI_SUPPORTED_PSI, XHCI_SUPPORTED_PSI_EXPONENT, XHCI_SUPPORTED_PSI_MANTISSA, and XHCI_SUPPORTED_PSI_VALUE.
Referenced by xhci_device_address().
|
static |
Allocate device context base address array.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 916 of file xhci.c.
References xhci_dcbaa::context, DBGC, DBGC2, xhci_device::dcbaa, dma(), xhci_device::dma, dma_alloc(), dma_free(), ENOMEM, len, xhci_dcbaa::map, memset(), xhci_device::name, xhci_device::op, rc, xhci_device::slots, xhci_align(), XHCI_OP_DCBAAP, and xhci_writeq().
Referenced by xhci_bus_open().
|
static |
Free device context base address array.
| xhci | xHCI device |
Definition at line 958 of file xhci.c.
References assert(), xhci_dcbaa::context, xhci_device::dcbaa, dma_free(), len, xhci_dcbaa::map, xhci_device::op, xhci_device::slots, XHCI_OP_DCBAAP, and xhci_writeq().
Referenced by xhci_bus_close(), and xhci_bus_open().
|
static |
Allocate scratchpad buffers.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 987 of file xhci.c.
References addr, xhci_scratchpad::array, xhci_scratchpad::array_map, assert(), xhci_scratchpad::buffer, xhci_scratchpad::buffer_map, xhci_dcbaa::context, xhci_scratchpad::count, cpu_to_le64, DBGC, DBGC2, xhci_device::dcbaa, dma(), xhci_device::dma, dma_alloc(), dma_free(), dma_ufree(), dma_umalloc(), ENOMEM, memset(), xhci_device::name, NULL, xhci_device::pagesize, rc, xhci_device::scratch, and xhci_align().
Referenced by xhci_bus_open().
|
static |
Free scratchpad buffers.
| xhci | xHCI device |
Definition at line 1053 of file xhci.c.
References xhci_scratchpad::array, xhci_scratchpad::array_map, assert(), xhci_scratchpad::buffer, xhci_scratchpad::buffer_map, xhci_dcbaa::context, xhci_scratchpad::count, xhci_device::dcbaa, dma_free(), dma_ufree(), NULL, xhci_device::pagesize, and xhci_device::scratch.
Referenced by xhci_bus_close(), and xhci_bus_open().
|
static |
Start xHCI device.
| xhci | xHCI device |
Definition at line 1087 of file xhci.c.
References xhci_device::op, readl(), xhci_device::slots, writel(), XHCI_CONFIG_MAX_SLOTS_EN, XHCI_CONFIG_MAX_SLOTS_EN_MASK, XHCI_OP_CONFIG, XHCI_OP_USBCMD, and XHCI_USBCMD_RUN.
Referenced by xhci_bus_open().
|
static |
Stop xHCI device.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 1109 of file xhci.c.
References DBGC, ETIMEDOUT, mdelay(), xhci_device::name, xhci_device::op, readl(), writel(), XHCI_OP_USBCMD, XHCI_OP_USBSTS, XHCI_STOP_MAX_WAIT_MS, XHCI_USBCMD_RUN, and XHCI_USBSTS_HCH.
Referenced by xhci_bus_close(), xhci_bus_open(), and xhci_reset().
|
static |
Reset xHCI device.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 1141 of file xhci.c.
References DBGC, ETIMEDOUT, mdelay(), xhci_device::name, xhci_device::op, rc, readl(), writel(), XHCI_OP_USBCMD, XHCI_RESET_MAX_WAIT_MS, xhci_stop(), and XHCI_USBCMD_HCRST.
Referenced by xhci_fail(), xhci_register(), and xhci_unregister().
|
static |
Mark xHCI device as permanently failed.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 1179 of file xhci.c.
References assert(), xhci_dcbaa::context, xhci_device::dcbaa, xhci_device::failed, len, memset(), NULL, rc, xhci_device::slots, and xhci_reset().
Referenced by xhci_abort(), and xhci_remove().
|
static |
Allocate transfer request block ring.
| xhci | xHCI device |
| ring | TRB ring |
| shift | Ring size (log2) |
| slot | Device slot |
| target | Doorbell target |
| stream | Doorbell stream ID |
| rc | Return status code |
Definition at line 1216 of file xhci.c.
References assert(), count, cpu_to_le64, xhci_trb_ring::db, xhci_device::db, xhci_trb_ring::dbval, dma(), xhci_device::dma, dma_alloc(), dma_free(), ENOMEM, free, xhci_trb_ring::iobuf, xhci_trb_ring::len, link, xhci_trb::link, xhci_trb_ring::link, xhci_trb_ring::map, xhci_trb_ring::mask, memset(), rc, xhci_trb_ring::shift, slot, xhci_trb_ring::trb, xhci_align(), XHCI_DBVAL, XHCI_TRB_LINK, XHCI_TRB_TC, and zalloc().
Referenced by xhci_command_alloc(), and xhci_endpoint_open().
|
static |
Reset transfer request block ring.
| ring | TRB ring |
Definition at line 1273 of file xhci.c.
References xhci_trb_ring::cons, count, memset(), xhci_trb_ring::prod, xhci_trb_ring::shift, and xhci_trb_ring::trb.
Referenced by xhci_abort().
|
static |
Free transfer request block ring.
| ring | TRB ring |
Definition at line 1289 of file xhci.c.
References assert(), xhci_trb_ring::cons, count, dma_free(), free, xhci_trb_ring::iobuf, xhci_trb_ring::len, xhci_trb_ring::map, NULL, xhci_trb_ring::prod, xhci_trb_ring::shift, and xhci_trb_ring::trb.
Referenced by xhci_command_alloc(), xhci_command_free(), xhci_endpoint_close(), and xhci_endpoint_open().
|
static |
Enqueue a transfer request block.
| ring | TRB ring |
| iobuf | I/O buffer (if any) |
| trb | Transfer request block (with empty Cycle flag) |
| rc | Return status code |
This operation does not implicitly ring the doorbell register.
Definition at line 1315 of file xhci.c.
References assert(), xhci_trb::common, xhci_trb_template::control, cpu_to_le32, dest, ENOBUFS, xhci_trb_common::flags, xhci_trb_link::flags, index, xhci_trb_ring::iobuf, xhci_trb_ring::link, xhci_trb_ring::mask, xhci_trb_template::parameter, xhci_trb_ring::prod, xhci_trb_ring::shift, xhci_trb_template::status, xhci_trb::template, xhci_trb_ring::trb, wmb(), xhci_ring_remaining(), XHCI_TRB_C, and XHCI_TRB_TC.
Referenced by xhci_command(), and xhci_enqueue_multi().
|
static |
Dequeue a transfer request block.
| ring | TRB ring |
| iobuf | I/O buffer |
Definition at line 1358 of file xhci.c.
References assert(), cons, xhci_trb_ring::cons, index, xhci_trb_ring::iobuf, xhci_trb_ring::mask, NULL, and xhci_ring_fill().
Referenced by xhci_complete(), and xhci_dequeue_multi().
|
static |
Enqueue multiple transfer request blocks.
| ring | TRB ring |
| iobuf | I/O buffer |
| trbs | Transfer request blocks (with empty Cycle flag) |
| count | Number of transfer request blocks |
| rc | Return status code |
This operation does not implicitly ring the doorbell register.
Definition at line 1390 of file xhci.c.
References assert(), count, ENOBUFS, NULL, rc, xhci_enqueue(), and xhci_ring_remaining().
Referenced by xhci_endpoint_message(), and xhci_endpoint_stream().
|
static |
Dequeue multiple transfer request blocks.
| ring | TRB ring |
| iobuf | I/O buffer |
Definition at line 1419 of file xhci.c.
References NULL, and xhci_dequeue().
Referenced by xhci_endpoint_close(), and xhci_transfer().
|
inlinestatic |
Ring doorbell register.
| ring | TRB ring |
Definition at line 1436 of file xhci.c.
References xhci_trb_ring::db, xhci_trb_ring::dbval, wmb(), and writel().
Referenced by xhci_command(), xhci_endpoint_message(), xhci_endpoint_reset(), and xhci_endpoint_stream().
|
static |
Allocate command ring.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 1455 of file xhci.c.
References xhci_device::command, DBGC2, dma(), xhci_trb_ring::len, xhci_trb_ring::map, xhci_device::name, xhci_device::op, rc, xhci_trb_ring::trb, XHCI_CMD_TRBS_LOG2, XHCI_CRCR_RCS, XHCI_OP_CRCR, xhci_ring_alloc(), xhci_ring_free(), and xhci_writeq().
Referenced by xhci_bus_open().
|
static |
Free command ring.
| xhci | xHCI device |
Definition at line 1486 of file xhci.c.
References assert(), xhci_device::command, xhci_device::op, readl(), XHCI_CRCR_CRR, XHCI_OP_CRCR, xhci_ring_free(), and xhci_writeq().
Referenced by xhci_bus_close(), and xhci_bus_open().
|
static |
Allocate event ring.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 1504 of file xhci.c.
References count, cpu_to_le32, cpu_to_le64, DBGC2, dma(), xhci_device::dma, dma_alloc(), dma_free(), ENOMEM, xhci_device::event, len, memset(), xhci_device::name, rc, xhci_device::run, writel(), xhci_align(), XHCI_EVENT_TRBS_LOG2, XHCI_RUN_ERDP, XHCI_RUN_ERSTBA, XHCI_RUN_ERSTSZ, and xhci_writeq().
Referenced by xhci_bus_open().
|
static |
Free event ring.
| xhci | xHCI device |
Definition at line 1569 of file xhci.c.
References count, dma_free(), xhci_device::event, len, xhci_device::run, writel(), XHCI_EVENT_TRBS_LOG2, XHCI_RUN_ERDP, XHCI_RUN_ERSTBA, XHCI_RUN_ERSTSZ, and xhci_writeq().
Referenced by xhci_bus_close(), and xhci_bus_open().
|
static |
Handle transfer event.
| xhci | xHCI device |
| trb | Transfer event TRB |
Definition at line 1595 of file xhci.c.
References assert(), xhci_trb_transfer::code, xhci_endpoint::context, xhci_endpoint::ctx, DBGC, DBGC_HDA, ECODE, xhci_trb_transfer::endpoint, xhci_endpoint::ep, iob_unmap(), iob_unput, le16_to_cpu, le64_to_cpu, xhci_device::name, NULL, profile_start(), profile_stop(), rc, xhci_trb_transfer::residual, xhci_endpoint::ring, slot, xhci_trb_transfer::slot, xhci_device::slot, xhci_device::slots, xhci_endpoint_context::state, strerror(), xhci_trb_transfer::transfer, usb_complete(), usb_complete_err(), XHCI_CMPLT_SHORT, XHCI_CMPLT_SUCCESS, XHCI_CTX_END, xhci_dequeue_multi(), XHCI_ENDPOINT_RUNNING, XHCI_ENDPOINT_STATE_MASK, and xhci_ring_consumed().
Referenced by xhci_event_poll().
|
static |
Handle command completion event.
| xhci | xHCI device |
| trb | Command completion event |
Definition at line 1668 of file xhci.c.
References assert(), xhci_trb_complete::code, xhci_trb_complete::command, xhci_device::command, DBGC, DBGC2, DBGC_HDA, ECODE, le64_to_cpu, memcpy(), xhci_device::name, NULL, xhci_device::pending, rc, strerror(), XHCI_CMPLT_CMD_STOPPED, xhci_dequeue(), and xhci_ring_consumed().
Referenced by xhci_event_poll().
|
static |
Handle port status event.
| xhci | xHCI device |
| trb | Port status event |
Definition at line 1705 of file xhci.c.
References assert(), xhci_device::bus, usb_bus::hub, xhci_device::op, port, xhci_trb_port_status::port, xhci_device::ports, readl(), usb_port(), usb_port_changed(), writel(), XHCI_OP_PORTSC, XHCI_PORTSC_CHANGE, XHCI_PORTSC_CSC, and XHCI_PORTSC_PRESERVE.
Referenced by xhci_event_poll().
|
static |
Handle host controller event.
| xhci | xHCI device |
| trb | Host controller event |
Definition at line 1729 of file xhci.c.
References xhci_trb_host_controller::code, DBGC, ECODE, xhci_device::name, rc, and strerror().
Referenced by xhci_event_poll().
|
static |
Poll event ring.
| xhci | xHCI device |
Definition at line 1744 of file xhci.c.
References xhci_trb::common, xhci_trb::complete, count, DBGC, DBGC_HDA, dma(), xhci_device::event, xhci_device::failed, xhci_trb_common::flags, xhci_trb::host, xhci_device::name, xhci_trb::port, profile_start(), profile_stop(), rmb, xhci_device::run, xhci_trb::transfer, type, xhci_trb_common::type, xhci_complete(), XHCI_EVENT_TRBS_LOG2, xhci_host_controller(), xhci_port_status(), XHCI_RUN_ERDP, xhci_transfer(), XHCI_TRB_C, XHCI_TRB_COMPLETE, XHCI_TRB_HOST_CONTROLLER, XHCI_TRB_PORT_STATUS, XHCI_TRB_TRANSFER, XHCI_TRB_TYPE_MASK, and xhci_writeq().
Referenced by xhci_abort(), xhci_bus_poll(), and xhci_command().
|
static |
Abort command.
| xhci | xHCI device |
Definition at line 1813 of file xhci.c.
References xhci_device::command, DBGC, DBGC2, dma(), xhci_trb_ring::map, mdelay(), xhci_device::name, xhci_device::op, readl(), xhci_trb_ring::trb, XHCI_COMMAND_ABORT_DELAY_MS, XHCI_CRCR_CA, XHCI_CRCR_CRR, XHCI_CRCR_RCS, xhci_event_poll(), xhci_fail(), XHCI_OP_CRCR, xhci_ring_reset(), and xhci_writeq().
Referenced by xhci_command().
|
static |
Issue command and wait for completion.
| xhci | xHCI device |
| trb | Transfer request block (with empty Cycle flag) |
| rc | Return status code |
On a successful completion, the TRB will be overwritten with the completion.
Definition at line 1856 of file xhci.c.
References xhci_trb_complete::code, xhci_device::command, xhci_trb::complete, DBGC, DBGC_HDA, EBUSY, ECODE, EPIPE, ETIMEDOUT, xhci_device::failed, mdelay(), xhci_device::name, NULL, xhci_device::pending, rc, strerror(), xhci_abort(), XHCI_CMPLT_SUCCESS, XHCI_COMMAND_MAX_WAIT_MS, xhci_doorbell(), xhci_enqueue(), and xhci_event_poll().
Referenced by xhci_context(), xhci_disable_slot(), xhci_enable_slot(), xhci_nop(), xhci_reset_endpoint(), xhci_set_tr_dequeue_pointer(), and xhci_stop_endpoint().
|
inlinestatic |
Issue NOP and wait for completion.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 1927 of file xhci.c.
References xhci_trb::common, DBGC, DBGC2, memset(), xhci_device::name, nop, rc, strerror(), xhci_command(), XHCI_TRB_IOC, and XHCI_TRB_NOP_CMD.
|
inlinestatic |
Enable slot.
| xhci | xHCI device |
| type | Slot type |
| slot | Device slot ID, or negative error |
Definition at line 1955 of file xhci.c.
References xhci_trb::complete, DBGC, DBGC2, xhci_trb::enable, enabled, memset(), xhci_device::name, rc, slot, xhci_trb_enable_slot::slot, strerror(), type, xhci_trb_enable_slot::type, xhci_command(), and XHCI_TRB_ENABLE_SLOT.
Referenced by xhci_device_open().
|
inlinestatic |
Disable slot.
| xhci | xHCI device |
| slot | Device slot |
| rc | Return status code |
Definition at line 1989 of file xhci.c.
References DBGC, DBGC2, xhci_trb::disable, memset(), xhci_device::name, rc, slot, xhci_trb_disable_slot::slot, strerror(), xhci_trb_disable_slot::type, xhci_command(), and XHCI_TRB_DISABLE_SLOT.
Referenced by xhci_device_close(), and xhci_device_open().
|
static |
Issue context-based command and wait for completion.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| type | TRB type |
| populate | Input context populater |
| rc | Return status code |
Definition at line 2021 of file xhci.c.
References xhci_trb::context, cpu_to_le64, dma(), xhci_device::dma, dma_alloc(), dma_free(), ENOMEM, xhci_trb_context::input, len, map, memset(), rc, slot, xhci_trb_context::slot, type, xhci_trb_context::type, xhci_align(), xhci_command(), XHCI_CTX_END, and xhci_input_context_offset().
Referenced by xhci_address_device(), xhci_configure_endpoint(), xhci_deconfigure_endpoint(), and xhci_evaluate_context().
|
static |
Populate address device input context.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| input | Input context |
Definition at line 2071 of file xhci.c.
References xhci_control_context::add, assert(), usb_endpoint::burst, xhci_endpoint_context::burst, cpu_to_le16, cpu_to_le32, cpu_to_le64, xhci_endpoint::ctx, xhci_endpoint_context::dequeue, dma(), xhci_endpoint::ep, xhci_slot_context::info, xhci_trb_ring::map, usb_endpoint::mtu, xhci_endpoint_context::mtu, xhci_slot_context::port, xhci_endpoint::ring, slot, xhci_trb_ring::trb, xhci_endpoint_context::trb_len, xhci_slot_context::tt_id, xhci_slot_context::tt_port, xhci_endpoint_context::type, XHCI_CTX_EP0, XHCI_CTX_SLOT, XHCI_EP0_TRB_LEN, XHCI_EP_DCS, XHCI_EP_TYPE_CONTROL, xhci_input_context_offset(), and XHCI_SLOT_INFO.
Referenced by xhci_address_device().
|
inlinestatic |
Address device.
| xhci | xHCI device |
| slot | Device slot |
| rc | Return status code |
Definition at line 2113 of file xhci.c.
References usb_device::address, xhci_slot_context::address, DBGC, DBGC2, usb_device::name, xhci_device::name, rc, slot, strerror(), xhci_address_device_input(), xhci_context(), XHCI_CTX_EP0, XHCI_CTX_SLOT, xhci_device_context_offset(), and XHCI_TRB_ADDRESS_DEVICE.
Referenced by xhci_device_address().
|
static |
Populate configure endpoint input context.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| input | Input context |
Definition at line 2146 of file xhci.c.
References xhci_control_context::add, usb_endpoint::burst, xhci_endpoint_context::burst, cpu_to_le16, cpu_to_le32, cpu_to_le64, xhci_endpoint::ctx, xhci_endpoint_context::dequeue, dma(), xhci_endpoint::ep, xhci_slot_context::info, xhci_endpoint_context::interval, xhci_endpoint::interval, xhci_trb_ring::map, usb_endpoint::mtu, xhci_endpoint_context::mtu, xhci_slot_context::ports, xhci_endpoint::ring, slot, xhci_trb_ring::trb, xhci_endpoint_context::trb_len, xhci_endpoint_context::type, xhci_endpoint::type, XHCI_CTX_END, XHCI_CTX_SLOT, XHCI_EP_DCS, xhci_input_context_offset(), and XHCI_SLOT_INFO.
Referenced by xhci_configure_endpoint().
|
inlinestatic |
Configure endpoint.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| rc | Return status code |
Definition at line 2186 of file xhci.c.
References xhci_endpoint::ctx, DBGC, DBGC2, xhci_device::name, rc, slot, strerror(), xhci_configure_endpoint_input(), xhci_context(), and XHCI_TRB_CONFIGURE_ENDPOINT.
Referenced by xhci_endpoint_open().
|
static |
Populate deconfigure endpoint input context.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| input | Input context |
Definition at line 2214 of file xhci.c.
References xhci_control_context::add, cpu_to_le32, xhci_endpoint::ctx, xhci_control_context::drop, xhci_slot_context::info, XHCI_CTX_END, XHCI_CTX_SLOT, xhci_input_context_offset(), and XHCI_SLOT_INFO.
Referenced by xhci_deconfigure_endpoint().
|
inlinestatic |
Deconfigure endpoint.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| rc | Return status code |
Definition at line 2240 of file xhci.c.
References xhci_endpoint::ctx, DBGC, DBGC2, xhci_device::name, rc, slot, strerror(), xhci_context(), xhci_deconfigure_endpoint_input(), and XHCI_TRB_CONFIGURE_ENDPOINT.
Referenced by xhci_endpoint_close(), and xhci_endpoint_open().
|
static |
Populate evaluate context input context.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| input | Input context |
Definition at line 2268 of file xhci.c.
References xhci_control_context::add, cpu_to_le16, cpu_to_le32, xhci_endpoint::ctx, xhci_endpoint::ep, xhci_slot_context::info, usb_endpoint::mtu, xhci_endpoint_context::mtu, XHCI_CTX_END, XHCI_CTX_SLOT, xhci_input_context_offset(), and XHCI_SLOT_INFO.
Referenced by xhci_evaluate_context().
|
inlinestatic |
Evaluate context.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| rc | Return status code |
Definition at line 2299 of file xhci.c.
References xhci_endpoint::ctx, DBGC, DBGC2, xhci_device::name, rc, slot, strerror(), xhci_context(), xhci_evaluate_context_input(), and XHCI_TRB_EVALUATE_CONTEXT.
Referenced by xhci_endpoint_mtu().
|
inlinestatic |
Reset endpoint.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| rc | Return status code |
Definition at line 2327 of file xhci.c.
References DBGC, xhci_trb_reset_endpoint::endpoint, memset(), xhci_device::name, rc, xhci_trb::reset, slot, xhci_trb_reset_endpoint::slot, strerror(), xhci_trb_reset_endpoint::type, xhci_command(), and XHCI_TRB_RESET_ENDPOINT.
Referenced by xhci_endpoint_reset().
|
inlinestatic |
Stop endpoint.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| rc | Return status code |
Definition at line 2359 of file xhci.c.
References DBGC, xhci_trb_stop_endpoint::endpoint, memset(), xhci_device::name, rc, slot, xhci_trb_stop_endpoint::slot, xhci_trb::stop, strerror(), xhci_trb_stop_endpoint::type, xhci_command(), and XHCI_TRB_STOP_ENDPOINT.
|
inlinestatic |
Set transfer ring dequeue pointer.
| xhci | xHCI device |
| slot | Device slot |
| endpoint | Endpoint |
| rc | Return status code |
Definition at line 2392 of file xhci.c.
References addr, cons, xhci_trb_ring::cons, xhci_endpoint::context, cpu_to_le64, xhci_endpoint::ctx, DBGC, xhci_trb_set_tr_dequeue_pointer::dequeue, xhci_trb::dequeue, dma(), xhci_trb_set_tr_dequeue_pointer::endpoint, index, xhci_trb_ring::map, xhci_trb_ring::mask, memset(), xhci_device::name, rc, xhci_endpoint::ring, xhci_trb_ring::shift, slot, xhci_trb_set_tr_dequeue_pointer::slot, xhci_endpoint_context::state, strerror(), xhci_trb_ring::trb, xhci_trb_set_tr_dequeue_pointer::type, xhci_command(), XHCI_EP_DCS, and XHCI_TRB_SET_TR_DEQUEUE_POINTER.
Referenced by xhci_endpoint_reset().
|
static |
Open endpoint.
| ep | USB endpoint |
| rc | Return status code |
Definition at line 2441 of file xhci.c.
References usb_endpoint::address, assert(), usb_endpoint::attributes, xhci_endpoint::context, ctx, xhci_endpoint::ctx, DBGC2, ENOMEM, usb_device::ep, xhci_endpoint::ep, fls, free, usb_endpoint::interval, xhci_endpoint::interval, xhci_trb_ring::len, xhci_device::name, NULL, rc, xhci_endpoint::ring, slot, xhci_endpoint::slot, xhci_trb_ring::trb, type, xhci_endpoint::type, usb_endpoint::usb, xhci_slot::usb, USB_DIR_IN, USB_ENDPOINT_ATTR_CONTROL, USB_ENDPOINT_ATTR_TYPE_MASK, usb_endpoint_set_hostdata(), usb_get_hostdata(), xhci_endpoint::xhci, xhci_configure_endpoint(), XHCI_CTX, XHCI_CTX_EP0, xhci_deconfigure_endpoint(), xhci_device_context_offset(), XHCI_EP_TYPE, XHCI_EP_TYPE_CONTROL, XHCI_EP_TYPE_IN, XHCI_EP_TYPE_PERIODIC, xhci_ring_alloc(), xhci_ring_free(), XHCI_TRANSFER_TRBS_LOG2, and zalloc().
|
static |
Close endpoint.
| ep | USB endpoint |
Definition at line 2517 of file xhci.c.
References ctx, xhci_endpoint::ctx, ECANCELED, xhci_slot::endpoint, xhci_endpoint::ep, free, iob_unmap(), NULL, xhci_endpoint::ring, slot, xhci_endpoint::slot, usb_complete_err(), usb_endpoint_get_hostdata(), XHCI_CTX_EP0, xhci_deconfigure_endpoint(), xhci_dequeue_multi(), xhci_ring_fill(), and xhci_ring_free().
|
static |
Reset endpoint.
| ep | USB endpoint |
| rc | Return status code |
Definition at line 2547 of file xhci.c.
References xhci_endpoint::ctx, DBGC, xhci_slot::endpoint, xhci_endpoint::ep, xhci_device::name, rc, xhci_endpoint::ring, slot, xhci_endpoint::slot, usb_endpoint_get_hostdata(), xhci_doorbell(), xhci_reset_endpoint(), and xhci_set_tr_dequeue_pointer().
|
static |
Update MTU.
| ep | USB endpoint |
| rc | Return status code |
Definition at line 2575 of file xhci.c.
References xhci_slot::endpoint, xhci_endpoint::ep, rc, slot, xhci_endpoint::slot, usb_endpoint_get_hostdata(), and xhci_evaluate_context().
|
static |
Enqueue message transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 2595 of file xhci.c.
References assert(), cpu_to_le16, cpu_to_le32, cpu_to_le64, data, io_buffer::data, xhci_trb_setup::direction, xhci_device::dma, DMA_RX, DMA_TX, xhci_endpoint::ep, xhci_trb_setup::flags, iob_dma(), iob_len(), iob_map(), iob_pull, iob_unmap(), len, xhci_trb_setup::len, memcpy(), memset(), xhci_trb_setup::packet, profile_start(), profile_stop(), rc, usb_setup_packet::request, xhci_endpoint::ring, status, xhci_trb_setup::type, USB_DIR_IN, usb_endpoint_get_hostdata(), xhci_endpoint::xhci, XHCI_DATA_IN, XHCI_DATA_OUT, xhci_doorbell(), xhci_enqueue_multi(), XHCI_SETUP_IN, XHCI_SETUP_OUT, XHCI_STATUS_IN, XHCI_STATUS_OUT, XHCI_TRB_DATA, XHCI_TRB_IDT, XHCI_TRB_IOC, XHCI_TRB_SETUP, and XHCI_TRB_STATUS.
|
static |
|
static |
Enqueue stream transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| zlp | Append a zero-length packet |
| rc | Return status code |
Definition at line 2694 of file xhci.c.
References usb_endpoint::address, count, cpu_to_le32, cpu_to_le64, data, xhci_device::dma, DMA_RX, DMA_TX, xhci_endpoint::ep, xhci_trb_normal::flags, iob_dma(), iob_len(), iob_map(), iob_unmap(), len, memset(), normal, xhci_trb::normal, profile_start(), profile_stop(), rc, xhci_endpoint::ring, USB_DIR_IN, usb_endpoint_get_hostdata(), xhci_endpoint::xhci, xhci_doorbell(), xhci_endpoint_count(), xhci_enqueue_multi(), XHCI_MTU, XHCI_TRB_CH, XHCI_TRB_IOC, and XHCI_TRB_NORMAL.
|
static |
Open device.
| usb | USB device |
| rc | Return status code |
Definition at line 2777 of file xhci.c.
References usb_port::address, assert(), usb_hub::bus, xhci_dcbaa::context, cpu_to_le64, DBGC, DBGC2, xhci_device::dcbaa, dma(), xhci_device::dma, dma_alloc(), dma_free(), ENOMEM, free, usb_port::hub, id, xhci_slot::id, len, memset(), usb_device::name, xhci_device::name, NULL, usb_device::port, rc, slot, xhci_device::slot, type, usb_port::usb, usb_hub::usb, xhci_slot::usb, usb_bus_get_hostdata(), usb_get_hostdata(), usb_root_hub_port(), usb_set_hostdata(), usb_transaction_translator(), xhci_slot::xhci, xhci_align(), XHCI_CTX_END, xhci_device_context_offset(), xhci_disable_slot(), xhci_enable_slot(), xhci_port_slot_type(), and zalloc().
|
static |
Close device.
| usb | USB device |
Definition at line 2860 of file xhci.c.
References xhci_dcbaa::context, DBGC, xhci_device::dcbaa, dma_free(), free, id, len, xhci_device::name, NULL, rc, slot, xhci_device::slot, xhci_slot::usb, usb_get_hostdata(), XHCI_CTX_END, xhci_device_context_offset(), and xhci_disable_slot().
|
static |
Assign device address.
| usb | USB device |
| rc | Return status code |
Definition at line 2897 of file xhci.c.
References usb_port::address, rc, slot, usb_device::speed, usb_port::usb, xhci_slot::usb, usb_get_hostdata(), usb_root_hub_port(), usb_route_string(), xhci_address_device(), and xhci_port_psiv().
|
static |
Open USB bus.
| bus | USB bus |
| rc | Return status code |
Definition at line 2939 of file xhci.c.
References bus, ENOMEM, free, rc, xhci_device::slot, xhci_device::slots, usb_bus_get_hostdata(), xhci_command_alloc(), xhci_command_free(), xhci_dcbaa_alloc(), xhci_dcbaa_free(), xhci_event_alloc(), xhci_event_free(), xhci_run(), xhci_scratchpad_alloc(), xhci_scratchpad_free(), xhci_stop(), and zalloc().
|
static |
Close USB bus.
| bus | USB bus |
Definition at line 2990 of file xhci.c.
References assert(), bus, free, NULL, xhci_device::slot, xhci_device::slots, usb_bus_get_hostdata(), xhci_command_free(), xhci_dcbaa_free(), xhci_event_free(), xhci_scratchpad_free(), and xhci_stop().
|
static |
Poll USB bus.
| bus | USB bus |
Definition at line 3012 of file xhci.c.
References bus, usb_bus_get_hostdata(), and xhci_event_poll().
|
static |
Open hub.
| hub | USB hub |
| rc | Return status code |
Definition at line 3032 of file xhci.c.
References usb_hub::ports, slot, usb_hub::usb, and usb_get_hostdata().
|
static |
|
static |
Open root hub.
| hub | USB hub |
| rc | Return status code |
Definition at line 3077 of file xhci.c.
References usb_port::hub, mdelay(), xhci_device::op, port, xhci_device::ports, readl(), usb_hub_get_drvdata(), usb_port(), USB_PROTO_3_0, writel(), XHCI_LINK_STATE_DELAY_MS, XHCI_OP_PORTSC, XHCI_PORT_POWER_DELAY_MS, XHCI_PORTSC_LWS, XHCI_PORTSC_PLS_DISABLED, XHCI_PORTSC_PLS_MASK, XHCI_PORTSC_PLS_RXDETECT, XHCI_PORTSC_PP, and XHCI_PORTSC_PRESERVE.
|
static |
Enable port.
| hub | USB hub |
| port | USB port |
| rc | Return status code |
Definition at line 3135 of file xhci.c.
References DBGC, ETIMEDOUT, mdelay(), xhci_device::name, xhci_device::op, port, readl(), usb_hub_get_drvdata(), writel(), XHCI_OP_PORTSC, XHCI_PORT_RESET_MAX_WAIT_MS, XHCI_PORTSC_PED, XHCI_PORTSC_PR, and XHCI_PORTSC_PRESERVE.
Disable port.
| hub | USB hub |
| port | USB port |
| rc | Return status code |
Definition at line 3170 of file xhci.c.
References mdelay(), xhci_device::op, port, readl(), usb_hub_get_drvdata(), USB_PROTO_3_0, writel(), XHCI_LINK_STATE_DELAY_MS, XHCI_OP_PORTSC, XHCI_PORTSC_LWS, XHCI_PORTSC_PED, XHCI_PORTSC_PLS_RXDETECT, and XHCI_PORTSC_PRESERVE.
Update root hub port speed.
| hub | USB hub |
| port | USB port |
| rc | Return status code |
Definition at line 3203 of file xhci.c.
References DBGC2, xhci_device::name, xhci_device::op, port, rc, readl(), usb_hub_get_drvdata(), USB_PROTO_3_0, USB_SPEED_FULL, USB_SPEED_NONE, writel(), XHCI_OP_PORTSC, xhci_port_speed(), XHCI_PORTSC_CCS, XHCI_PORTSC_CHANGE, XHCI_PORTSC_CSC, XHCI_PORTSC_PED, XHCI_PORTSC_PRESERVE, and XHCI_PORTSC_PSIV.
|
static |
Clear transaction translator buffer.
| hub | USB hub |
| port | USB port |
| ep | USB endpoint |
| rc | Return status code |
Definition at line 3260 of file xhci.c.
References DBGC, ENOTSUP, usb_device::name, xhci_device::name, port, usb_endpoint::usb, usb_endpoint_name(), and usb_hub_get_drvdata().
| int xhci_register | ( | struct xhci_device * | xhci | ) |
Register xHCI controller.
| xhci | xHCI device |
| rc | Return status code |
Definition at line 3318 of file xhci.c.
References alloc_usb_bus(), xhci_device::bus, xhci_device::dev, ENOMEM, free_usb_bus(), usb_bus::hub, port, xhci_device::ports, rc, register_usb_bus(), unregister_usb_bus(), usb_bus_set_hostdata(), usb_hub_set_drvdata(), usb_port(), XHCI_MTU, xhci_operations, xhci_port_protocol(), and xhci_reset().
Referenced by dwusb_probe(), and xhci_probe().
| void xhci_unregister | ( | struct xhci_device * | xhci | ) |
Unregister xHCI controller.
| xhci | xHCI device |
Definition at line 3363 of file xhci.c.
References bus, xhci_device::bus, free_usb_bus(), unregister_usb_bus(), and xhci_reset().
Referenced by dwusb_probe(), dwusb_remove(), xhci_probe(), and xhci_remove().
|
static |
Fix Intel PCH-specific quirks.
| xhci | xHCI device |
| pci | PCI device |
Definition at line 3387 of file xhci.c.
References DBGC, xhci_device::name, xhci_device::pch, pci_read_config_dword(), pci_write_config_dword(), xhci_pch::usb3pssen, XHCI_PCH_USB3PRM, XHCI_PCH_USB3PSSEN, XHCI_PCH_XUSB2PR, XHCI_PCH_XUSB2PRM, and xhci_pch::xusb2pr.
Referenced by xhci_probe().
|
static |
Undo Intel PCH-specific quirk fixes.
| xhci | xHCI device |
| pci | PCI device |
Definition at line 3425 of file xhci.c.
References xhci_device::pch, pci_write_config_dword(), xhci_pch::usb3pssen, XHCI_PCH_USB3PSSEN, XHCI_PCH_XUSB2PR, and xhci_pch::xusb2pr.
Referenced by xhci_probe(), and xhci_remove().
|
static |
Probe PCI device.
| pci | PCI device |
| rc | Return status code |
Definition at line 3441 of file xhci.c.
References adjust_pci_device(), pci_device::dev, xhci_device::dev, pci_device::dma, xhci_device::dma, pci_device_id::driver_data, ENODEV, ENOMEM, free, pci_device::id, iounmap(), pci_bar_size(), pci_bar_start(), pci_ioremap(), pci_set_drvdata(), xhci_device::quirks, rc, xhci_device::regs, XHCI_BAR, xhci_init(), xhci_legacy_claim(), xhci_legacy_init(), xhci_legacy_release(), XHCI_PCH, xhci_pch_fix(), xhci_pch_undo(), xhci_register(), xhci_unregister(), and zalloc().
|
static |
Remove PCI device.
| pci | PCI device |
Definition at line 3504 of file xhci.c.
References command, DBGC, free, iounmap(), xhci_device::name, PCI_COMMAND, PCI_COMMAND_MASTER, pci_get_drvdata(), pci_read_config_word(), xhci_device::quirks, xhci_device::regs, xhci_fail(), xhci_legacy_release(), XHCI_PCH, xhci_pch_undo(), and xhci_unregister().
|
static |
Prepare for exit.
| booting | System is shutting down for OS boot |
Definition at line 3559 of file xhci.c.
References xhci_legacy_prevent_release.
| struct startup_fn xhci_startup __startup_fn | ( | STARTUP_LATE | ) |
Startup/shutdown function.
|
static |
|
static |
Prevent the release of ownership back to BIOS.
Definition at line 532 of file xhci.c.
Referenced by xhci_legacy_release(), and xhci_shutdown().
|
static |
USB host controller operations.
Definition at line 3279 of file xhci.c.
Referenced by xhci_register().
|
static |
XHCI PCI device IDs.
| struct pci_driver xhci_driver __pci_driver |
XHCI PCI driver.
1.8.15