iPXE
|
USB Enhanced Host Controller Interface (EHCI) driver. More...
#include <stdlib.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 "ehci.h"
Go to the source code of this file.
Macros | |
#define | EIO_STATUS(status) EUNIQ ( EINFO_EIO, ( ( (status) >> 2 ) & 0xf ) ) |
Construct error code from transfer descriptor status. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | ehci_init (struct ehci_device *ehci, void *regs) |
Initialise device. More... | |
static unsigned int | ehci_extended_capability (struct ehci_device *ehci, struct pci_device *pci, unsigned int id, unsigned int offset) |
Find extended capability. More... | |
static size_t | ehci_align (size_t len) |
Calculate buffer alignment. More... | |
static int | ehci_ctrl_reachable (struct ehci_device *ehci, void *ptr) |
Check control data structure reachability. More... | |
static __unused void | ehci_dump (struct ehci_device *ehci) |
Dump host controller registers. More... | |
static void | ehci_legacy_init (struct ehci_device *ehci, struct pci_device *pci) |
Initialise USB legacy support. More... | |
static void | ehci_legacy_claim (struct ehci_device *ehci, struct pci_device *pci) |
Claim ownership from BIOS. More... | |
static void | ehci_legacy_release (struct ehci_device *ehci, struct pci_device *pci) |
Release ownership back to BIOS. More... | |
static void | ehci_poll_companions (struct ehci_device *ehci) |
Poll child companion controllers. More... | |
unsigned int | ehci_companion (struct pci_device *pci) |
Locate EHCI companion controller. More... | |
static void | ehci_run (struct ehci_device *ehci) |
Start EHCI device. More... | |
static int | ehci_stop (struct ehci_device *ehci) |
Stop EHCI device. More... | |
static int | ehci_reset (struct ehci_device *ehci) |
Reset EHCI device. More... | |
static int | ehci_ring_alloc (struct ehci_device *ehci, struct ehci_ring *ring) |
Allocate transfer descriptor ring. More... | |
static void | ehci_ring_free (struct ehci_ring *ring) |
Free transfer descriptor ring. More... | |
static int | ehci_enqueue (struct ehci_device *ehci, struct ehci_ring *ring, struct io_buffer *iobuf, const struct ehci_transfer *xfer, unsigned int count) |
Enqueue transfer descriptors. More... | |
static struct io_buffer * | ehci_dequeue (struct ehci_ring *ring) |
Dequeue a transfer descriptor. More... | |
static uint32_t | ehci_link_qh (struct ehci_queue_head *queue) |
Get link value for a queue head. More... | |
static void | ehci_async_schedule (struct ehci_device *ehci) |
(Re)build asynchronous schedule More... | |
static void | ehci_async_add (struct ehci_endpoint *endpoint) |
Add endpoint to asynchronous schedule. More... | |
static int | ehci_async_del (struct ehci_endpoint *endpoint) |
Remove endpoint from asynchronous schedule. More... | |
static void | ehci_periodic_schedule (struct ehci_device *ehci) |
(Re)build periodic schedule More... | |
static void | ehci_periodic_add (struct ehci_endpoint *endpoint) |
Add endpoint to periodic schedule. More... | |
static int | ehci_periodic_del (struct ehci_endpoint *endpoint) |
Remove endpoint from periodic schedule. More... | |
static void | ehci_schedule_add (struct ehci_endpoint *endpoint) |
Add endpoint to appropriate schedule. More... | |
static int | ehci_schedule_del (struct ehci_endpoint *endpoint) |
Remove endpoint from appropriate schedule. More... | |
static uint32_t | ehci_endpoint_characteristics (struct usb_endpoint *ep) |
Determine endpoint characteristics. More... | |
static uint32_t | ehci_endpoint_capabilities (struct usb_endpoint *ep) |
Determine endpoint capabilities. More... | |
static void | ehci_endpoint_update (struct usb_endpoint *ep) |
Update endpoint characteristics and capabilities. More... | |
static int | ehci_endpoint_open (struct usb_endpoint *ep) |
Open endpoint. More... | |
static void | ehci_endpoint_close (struct usb_endpoint *ep) |
Close endpoint. More... | |
static int | ehci_endpoint_reset (struct usb_endpoint *ep) |
Reset endpoint. More... | |
static int | ehci_endpoint_mtu (struct usb_endpoint *ep) |
Update MTU. More... | |
static int | ehci_endpoint_message (struct usb_endpoint *ep, struct io_buffer *iobuf) |
Enqueue message transfer. More... | |
static unsigned int | ehci_endpoint_count (size_t len, int zlp) |
Calculate number of transfer descriptors. More... | |
static int | ehci_endpoint_stream (struct usb_endpoint *ep, struct io_buffer *iobuf, int zlp) |
Enqueue stream transfer. More... | |
static void | ehci_endpoint_poll (struct ehci_endpoint *endpoint) |
Poll for completions. More... | |
static int | ehci_device_open (struct usb_device *usb) |
Open device. More... | |
static void | ehci_device_close (struct usb_device *usb) |
Close device. More... | |
static int | ehci_device_address (struct usb_device *usb) |
Assign device address. More... | |
static int | ehci_hub_open (struct usb_hub *hub __unused) |
Open hub. More... | |
static void | ehci_hub_close (struct usb_hub *hub __unused) |
Close hub. More... | |
static int | ehci_root_open (struct usb_hub *hub) |
Open root hub. More... | |
static void | ehci_root_close (struct usb_hub *hub) |
Close root hub. More... | |
static int | ehci_root_enable (struct usb_hub *hub, struct usb_port *port) |
Enable port. More... | |
static int | ehci_root_disable (struct usb_hub *hub, struct usb_port *port) |
Disable port. More... | |
static int | ehci_root_speed (struct usb_hub *hub, struct usb_port *port) |
Update root hub port speed. More... | |
static int | ehci_root_clear_tt (struct usb_hub *hub, struct usb_port *port, struct usb_endpoint *ep) |
Clear transaction translator buffer. More... | |
static void | ehci_root_poll (struct usb_hub *hub, struct usb_port *port) |
Poll for port status changes. More... | |
static int | ehci_bus_open (struct usb_bus *bus) |
Open USB bus. More... | |
static void | ehci_bus_close (struct usb_bus *bus) |
Close USB bus. More... | |
static void | ehci_bus_poll (struct usb_bus *bus) |
Poll USB bus. More... | |
static int | ehci_probe (struct pci_device *pci) |
Probe PCI device. More... | |
static void | ehci_remove (struct pci_device *pci) |
Remove PCI device. More... | |
static void | ehci_shutdown (int booting) |
Prepare for exit. More... | |
struct startup_fn ehci_startup | __startup_fn (STARTUP_LATE) |
Startup/shutdown function. More... | |
Variables | |
static int | ehci_legacy_prevent_release |
Prevent the release of ownership back to BIOS. More... | |
static struct usb_host_operations | ehci_operations |
USB host controller operations. More... | |
static struct pci_device_id | ehci_ids [] |
EHCI PCI device IDs. More... | |
struct pci_driver ehci_driver | __pci_driver |
EHCI PCI driver. More... | |
USB Enhanced Host Controller Interface (EHCI) driver.
Definition in file ehci.c.
Construct error code from transfer descriptor status.
status | Transfer descriptor status |
rc | Error code |
Bits 2-5 of the status code provide some indication as to the root cause of the error. We incorporate these into the error code as reported to usb_complete_err().
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Initialise device.
ehci | EHCI device |
regs | MMIO registers |
Definition at line 69 of file ehci.c.
References ehci_device::addr64, ehci_device::cap, DBGC, DBGC2, ehci_device::eecp, EHCI_CAP_CAPLENGTH, EHCI_CAP_HCCPARAMS, EHCI_CAP_HCSPARAMS, EHCI_FLSIZE_DEFAULT, EHCI_FLSIZE_SMALL, EHCI_HCCPARAMS_ADDR64, EHCI_HCCPARAMS_EECP, EHCI_HCCPARAMS_FLSIZE, EHCI_HCSPARAMS_PORTS, ehci_device::flsize, ehci_device::name, ehci_device::op, ehci_device::ports, readb(), readl(), regs, and virt_to_phys().
Referenced by ehci_probe().
|
static |
Find extended capability.
ehci | EHCI device |
pci | PCI 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 105 of file ehci.c.
References ehci_device::eecp, EHCI_EECP_ID, EHCI_EECP_NEXT, offset, and pci_read_config_dword().
Referenced by ehci_legacy_init().
Calculate buffer alignment.
len | Length |
align | Buffer alignment |
Determine alignment required for a buffer which must be aligned to at least EHCI_MIN_ALIGN and which must not cross a page boundary.
Definition at line 140 of file ehci.c.
References align, EHCI_MIN_ALIGN, fls, and len.
Referenced by ehci_bus_open(), and ehci_ring_alloc().
|
static |
Check control data structure reachability.
ehci | EHCI device |
ptr | Data structure pointer |
rc | Return status code |
Definition at line 160 of file ehci.c.
References ehci_device::ctrldssegment, ENOTSUP, phys, segment, and virt_to_phys().
Referenced by ehci_bus_open(), and ehci_ring_alloc().
|
static |
Dump host controller registers.
ehci | EHCI device |
Definition at line 188 of file ehci.c.
References ehci_device::cap, DBG_LOG, DBGC, EHCI_CAP_CAPLENGTH, EHCI_CAP_HCCPARAMS, EHCI_CAP_HCIVERSION, EHCI_CAP_HCSPARAMS, EHCI_OP_ASYNCLISTADDR, EHCI_OP_CONFIGFLAG, EHCI_OP_CTRLDSSEGMENT, EHCI_OP_FRINDEX, EHCI_OP_PERIODICLISTBASE, EHCI_OP_USBCMD, EHCI_OP_USBINTR, EHCI_OP_USBSTS, ehci_device::name, ehci_device::op, readb(), readl(), and readw().
|
static |
Initialise USB legacy support.
ehci | EHCI device |
pci | PCI device |
Definition at line 247 of file ehci.c.
References DBGC, EHCI_EECP_ID_LEGACY, ehci_extended_capability(), EHCI_USBLEGSUP_BIOS, EHCI_USBLEGSUP_BIOS_OWNED, ehci_device::legacy, ehci_device::name, and pci_read_config_byte().
Referenced by ehci_probe().
|
static |
Claim ownership from BIOS.
ehci | EHCI device |
pci | PCI device |
Definition at line 280 of file ehci.c.
References DBGC, EHCI_USBLEGSUP_BIOS, EHCI_USBLEGSUP_BIOS_OWNED, EHCI_USBLEGSUP_CTLSTS, EHCI_USBLEGSUP_MAX_WAIT_MS, EHCI_USBLEGSUP_OS, EHCI_USBLEGSUP_OS_OWNED, ehci_device::legacy, mdelay(), ehci_device::name, pci_read_config_byte(), pci_read_config_dword(), pci_write_config_byte(), and pci_write_config_dword().
Referenced by ehci_probe().
|
static |
Release ownership back to BIOS.
ehci | EHCI device |
pci | PCI device |
Definition at line 340 of file ehci.c.
References DBGC, ehci_legacy_prevent_release, EHCI_USBLEGSUP_CTLSTS, EHCI_USBLEGSUP_OS, ehci_device::legacy, ehci_device::name, pci_read_config_dword(), and pci_write_config_byte().
Referenced by ehci_probe(), and ehci_remove().
|
static |
Poll child companion controllers.
ehci | EHCI device |
Definition at line 379 of file ehci.c.
References bus, ehci_device::bus, BUS_TYPE_PCI, DBGC2, desc, device::desc, usb_bus::dev, for_each_usb_bus, device_description::location, ehci_device::name, PCI_CLASS, PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB, PCI_CLASS_SERIAL_USB_OHCI, PCI_CLASS_SERIAL_USB_UHCI, PCI_FIRST_FUNC, and usb_poll().
Referenced by ehci_root_enable().
unsigned int ehci_companion | ( | struct pci_device * | pci | ) |
Locate EHCI companion controller.
pci | PCI device |
busdevfn | EHCI companion controller bus:dev.fn (if any) |
Definition at line 420 of file ehci.c.
References busdevfn, pci_device::busdevfn, PCI_CLASS, PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB, PCI_CLASS_SERIAL_USB_EHCI, pci_init(), PCI_LAST_FUNC, pci_read_config(), rc, and tmp.
|
static |
Start EHCI device.
ehci | EHCI device |
Definition at line 452 of file ehci.c.
References EHCI_OP_USBCMD, EHCI_USBCMD_ASYNC, EHCI_USBCMD_FLSIZE, EHCI_USBCMD_FLSIZE_MASK, EHCI_USBCMD_PERIODIC, EHCI_USBCMD_RUN, ehci_device::flsize, ehci_device::op, readl(), and writel().
Referenced by ehci_bus_open().
|
static |
Stop EHCI device.
ehci | EHCI device |
rc | Return status code |
Definition at line 469 of file ehci.c.
References DBGC, EHCI_OP_USBCMD, EHCI_OP_USBSTS, EHCI_STOP_MAX_WAIT_MS, EHCI_USBCMD_ASYNC, EHCI_USBCMD_PERIODIC, EHCI_USBCMD_RUN, EHCI_USBSTS_HCH, ETIMEDOUT, mdelay(), ehci_device::name, ehci_device::op, readl(), and writel().
Referenced by ehci_bus_close(), ehci_bus_open(), and ehci_reset().
|
static |
Reset EHCI device.
ehci | EHCI device |
rc | Return status code |
Definition at line 502 of file ehci.c.
References DBGC, EHCI_OP_USBCMD, EHCI_RESET_MAX_WAIT_MS, ehci_stop(), EHCI_USBCMD_HCRST, ETIMEDOUT, mdelay(), ehci_device::name, ehci_device::op, rc, readl(), and writel().
Referenced by ehci_probe(), and ehci_remove().
|
static |
Allocate transfer descriptor ring.
ehci | EHCI device |
ring | Transfer descriptor ring |
rc | Return status code |
Definition at line 548 of file ehci.c.
References ehci_queue_head::cache, cpu_to_le32, DBGC, desc, ehci_ring::desc, ehci_align(), ehci_ctrl_reachable(), EHCI_RING_COUNT, ENOMEM, free, free_phys(), ehci_ring::head, ehci_ring::iobuf, len, link, malloc_phys(), memset(), ehci_device::name, next, ehci_transfer_descriptor::next, rc, virt_to_phys(), and zalloc().
Referenced by ehci_endpoint_open().
|
static |
Free transfer descriptor ring.
ring | Transfer descriptor ring |
Definition at line 625 of file ehci.c.
References assert(), ehci_ring::desc, EHCI_RING_COUNT, ehci_ring_fill(), free, free_phys(), ehci_ring::head, ehci_ring::iobuf, and NULL.
Referenced by ehci_endpoint_close(), and ehci_endpoint_open().
|
static |
Enqueue transfer descriptors.
ehci | EHCI device |
ring | Transfer descriptor ring |
iobuf | I/O buffer |
xfers | Transfers |
count | Number of transfers |
rc | Return status code |
Definition at line 654 of file ehci.c.
References ehci_device::addr64, assert(), count, cpu_to_le16, cpu_to_le32, data, ehci_transfer::data, desc, ehci_ring::desc, EHCI_FL_CERR_MAX, EHCI_FL_TOGGLE, EHCI_LEN_MASK, EHCI_LEN_TOGGLE, EHCI_PAGE_ALIGN, EHCI_RING_COUNT, ehci_ring_remaining(), EHCI_STATUS_ACTIVE, ENOBUFS, ENOTSUP, ehci_transfer::flags, index, ehci_ring::iobuf, len, ehci_transfer::len, NULL, offset, phys, ehci_ring::prod, virt_to_phys(), and wmb().
Referenced by ehci_endpoint_message(), and ehci_endpoint_stream().
Dequeue a transfer descriptor.
ring | Transfer descriptor ring |
iobuf | I/O buffer (or NULL) |
Definition at line 744 of file ehci.c.
References assert(), ehci_ring::cons, desc, ehci_ring::desc, EHCI_RING_COUNT, ehci_ring_fill(), index, ehci_ring::iobuf, and NULL.
Referenced by ehci_endpoint_close(), and ehci_endpoint_poll().
|
inlinestatic |
Get link value for a queue head.
queue | Queue head |
link | Link value |
Definition at line 779 of file ehci.c.
References EHCI_LINK_TYPE_QH, queue, and virt_to_phys().
Referenced by ehci_async_schedule(), and ehci_periodic_schedule().
|
static |
(Re)build asynchronous schedule
ehci | EHCI device |
Definition at line 789 of file ehci.c.
References ehci_device::async, cpu_to_le32, ehci_link_qh(), ehci_ring::head, ehci_device::head, link, ehci_queue_head::link, list_for_each_entry_reverse, queue, ehci_endpoint::ring, and wmb().
Referenced by ehci_async_add(), ehci_async_del(), and ehci_bus_open().
|
static |
Add endpoint to asynchronous schedule.
endpoint | Endpoint |
Definition at line 815 of file ehci.c.
References ehci_device::async, ehci_endpoint::ehci, ehci_async_schedule(), list_add_tail, and ehci_endpoint::schedule.
Referenced by ehci_schedule_add().
|
static |
Remove endpoint from asynchronous schedule.
endpoint | Endpoint |
rc | Return status code |
Definition at line 831 of file ehci.c.
References ehci_device::async, DBGC, ehci_endpoint::ehci, EHCI_ASYNC_ADVANCE_MAX_WAIT_MS, ehci_async_schedule(), EHCI_OP_USBCMD, EHCI_OP_USBSTS, EHCI_USBCMD_ASYNC_ADVANCE, EHCI_USBSTS_ASYNC_ADVANCE, EHCI_USBSTS_CHANGE, ETIMEDOUT, list_check_contains_entry, list_del, mdelay(), ehci_device::name, ehci_device::op, readl(), ehci_endpoint::schedule, and writel().
Referenced by ehci_schedule_del().
|
static |
(Re)build periodic schedule
ehci | EHCI device |
Definition at line 876 of file ehci.c.
References cpu_to_le32, DBGCP, ehci_link_qh(), EHCI_LINK_TERMINATE, EHCI_PERIODIC_FRAMES, ehci_endpoint::ep, ffs, ehci_device::flsize, ehci_device::frame, ehci_ring::head, usb_endpoint::interval, link, ehci_periodic_frame::link, list_for_each_entry, list_for_each_entry_reverse, ehci_device::name, ehci_device::periodic, queue, ehci_endpoint::ring, and wmb().
Referenced by ehci_bus_open(), ehci_periodic_add(), and ehci_periodic_del().
|
static |
Add endpoint to periodic schedule.
endpoint | Endpoint |
Definition at line 946 of file ehci.c.
References before, ehci_endpoint::ehci, ehci_periodic_schedule(), ehci_endpoint::ep, usb_endpoint::interval, list_add_tail, list_for_each_entry, ehci_device::periodic, and ehci_endpoint::schedule.
Referenced by ehci_schedule_add().
|
static |
Remove endpoint from periodic schedule.
endpoint | Endpoint |
rc | Return status code |
Definition at line 968 of file ehci.c.
References ehci_endpoint::ehci, ehci_periodic_schedule(), list_check_contains_entry, list_del, mdelay(), ehci_device::periodic, and ehci_endpoint::schedule.
Referenced by ehci_schedule_del().
|
static |
Add endpoint to appropriate schedule.
endpoint | Endpoint |
Definition at line 989 of file ehci.c.
References attr, usb_endpoint::attributes, ehci_async_add(), ehci_periodic_add(), ehci_endpoint::ep, USB_ENDPOINT_ATTR_INTERRUPT, and USB_ENDPOINT_ATTR_TYPE_MASK.
Referenced by ehci_endpoint_open().
|
static |
Remove endpoint from appropriate schedule.
endpoint | Endpoint |
rc | Return status code |
Definition at line 1006 of file ehci.c.
References attr, usb_endpoint::attributes, ehci_async_del(), ehci_periodic_del(), ehci_endpoint::ep, USB_ENDPOINT_ATTR_INTERRUPT, and USB_ENDPOINT_ATTR_TYPE_MASK.
Referenced by ehci_endpoint_close().
|
static |
Determine endpoint characteristics.
ep | USB endpoint |
chr | Endpoint characteristics |
Definition at line 1030 of file ehci.c.
References usb_endpoint::address, usb_device::address, attr, usb_endpoint::attributes, EHCI_CHR_ADDRESS, EHCI_CHR_CONTROL, EHCI_CHR_ENDPOINT, EHCI_CHR_EPS_FULL, EHCI_CHR_EPS_HIGH, EHCI_CHR_EPS_LOW, EHCI_CHR_MAX_LEN, EHCI_CHR_TOGGLE, usb_device::ep, usb_endpoint::mtu, usb_device::speed, usb_endpoint::usb, USB_ENDPOINT_ATTR_CONTROL, USB_ENDPOINT_ATTR_TYPE_MASK, USB_SPEED_FULL, and USB_SPEED_HIGH.
Referenced by ehci_endpoint_update().
|
static |
Determine endpoint capabilities.
ep | USB endpoint |
cap | Endpoint capabilities |
Definition at line 1066 of file ehci.c.
References usb_device::address, usb_port::address, assert(), attr, usb_endpoint::attributes, usb_endpoint::burst, EHCI_CAP_INTR_SCHED, EHCI_CAP_MULT, EHCI_CAP_SPLIT_SCHED_DEFAULT, EHCI_CAP_TT_HUB, EHCI_CAP_TT_PORT, usb_device::ep, usb_port::hub, usb_endpoint::interval, usb_endpoint::usb, usb_port::usb, usb_hub::usb, USB_ENDPOINT_ATTR_INTERRUPT, USB_ENDPOINT_ATTR_TYPE_MASK, and usb_transaction_translator().
Referenced by ehci_endpoint_update().
|
static |
Update endpoint characteristics and capabilities.
ep | USB endpoint |
Definition at line 1102 of file ehci.c.
References cpu_to_le32, ehci_endpoint_capabilities(), ehci_endpoint_characteristics(), ehci_endpoint::ep, head, ehci_ring::head, ehci_endpoint::ring, and usb_endpoint_get_hostdata().
Referenced by ehci_device_address(), ehci_endpoint_mtu(), and ehci_endpoint_open().
|
static |
Open endpoint.
ep | USB endpoint |
rc | Return status code |
Definition at line 1118 of file ehci.c.
References ehci_endpoint::ehci, ehci_endpoint_update(), ehci_ring_alloc(), ehci_ring_free(), ehci_schedule_add(), ehci_device::endpoints, ENOMEM, ehci_endpoint::ep, usb_device::ep, free, ehci_endpoint::list, list_add_tail, rc, ehci_endpoint::ring, usb_endpoint::usb, usb_endpoint_set_hostdata(), usb_get_hostdata(), and zalloc().
|
static |
Close endpoint.
ep | USB endpoint |
Definition at line 1161 of file ehci.c.
References DBGC, ECANCELED, ehci_endpoint::ehci, ehci_dequeue(), ehci_ring_fill(), ehci_ring_free(), ehci_schedule_del(), ehci_endpoint::ep, usb_device::ep, free, ehci_endpoint::list, list_del, usb_device::name, rc, ehci_endpoint::ring, strerror(), usb_endpoint::usb, usb_complete_err(), usb_endpoint_get_hostdata(), and usb_endpoint_name().
|
static |
Reset endpoint.
ep | USB endpoint |
rc | Return status code |
Definition at line 1201 of file ehci.c.
References assert(), ehci_queue_head::cache, ehci_ring::cons, cpu_to_le32, ehci_ring::desc, EHCI_RING_COUNT, EHCI_STATUS_ACTIVE, EHCI_STATUS_HALTED, ehci_endpoint::ep, ehci_ring::head, ehci_transfer_descriptor::len, link, ehci_transfer_descriptor::next, ehci_ring::residual, ehci_endpoint::ring, ehci_transfer_descriptor::status, usb_endpoint_get_hostdata(), virt_to_phys(), and wmb().
|
static |
Update MTU.
ep | USB endpoint |
rc | Return status code |
Definition at line 1234 of file ehci.c.
References ehci_endpoint_update().
|
static |
Enqueue message transfer.
ep | USB endpoint |
iobuf | I/O buffer |
rc | Return status code |
Definition at line 1249 of file ehci.c.
References assert(), cpu_to_le16, io_buffer::data, ehci_transfer::data, ehci_endpoint::ehci, ehci_enqueue(), EHCI_FL_IOC, EHCI_FL_PID_IN, EHCI_FL_PID_OUT, EHCI_FL_PID_SETUP, EHCI_FL_TOGGLE, ehci_endpoint::ep, ehci_transfer::flags, iob_len(), iob_pull, len, ehci_transfer::len, NULL, rc, usb_setup_packet::request, ehci_endpoint::ring, USB_DIR_IN, and usb_endpoint_get_hostdata().
|
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 1327 of file ehci.c.
References usb_endpoint::address, count, data, io_buffer::data, ehci_transfer::data, ehci_endpoint::ehci, ehci_endpoint_count(), ehci_enqueue(), EHCI_FL_IOC, EHCI_FL_PID_IN, EHCI_FL_PID_OUT, EHCI_MTU, ehci_endpoint::ep, flags, ehci_transfer::flags, iob_len(), len, ehci_transfer::len, rc, ehci_endpoint::ring, USB_DIR_IN, and usb_endpoint_get_hostdata().
|
static |
Poll for completions.
endpoint | Endpoint |
Definition at line 1375 of file ehci.c.
References ehci_ring::cons, DBGC, desc, ehci_ring::desc, ehci_endpoint::ehci, ehci_dequeue(), EHCI_LEN_MASK, EHCI_RING_COUNT, ehci_ring_fill(), EHCI_STATUS_ACTIVE, EHCI_STATUS_HALTED, EIO_STATUS, ehci_endpoint::ep, usb_device::ep, index, iob_unput, le16_to_cpu, usb_device::name, rc, ehci_ring::residual, ehci_endpoint::ring, rmb, status, strerror(), usb_endpoint::usb, usb_complete(), usb_complete_err(), and usb_endpoint_name().
Referenced by ehci_bus_poll().
|
static |
Open device.
usb | USB device |
rc | Return status code |
Definition at line 1448 of file ehci.c.
References usb_hub::bus, usb_port::hub, usb_device::port, usb_bus_get_hostdata(), and usb_set_hostdata().
|
static |
Close device.
usb | USB device |
Definition at line 1460 of file ehci.c.
References usb_device::address, bus, ehci_device::bus, usb_free_address(), and usb_get_hostdata().
|
static |
Assign device address.
usb | USB device |
rc | Return status code |
Definition at line 1475 of file ehci.c.
References address, usb_device::address, assert(), bus, ehci_device::bus, DBGC, ehci_endpoint_update(), usb_device::name, NULL, rc, strerror(), usb_endpoint::usb, usb_alloc_address(), usb_endpoint(), USB_EP0_ADDRESS, usb_free_address(), usb_get_hostdata(), and usb_set_address().
|
static |
|
static |
|
static |
Open root hub.
hub | USB hub |
rc | Return status code |
Definition at line 1555 of file ehci.c.
References EHCI_CONFIGFLAG_CF, EHCI_OP_CONFIGFLAG, EHCI_OP_PORTSC, EHCI_PORT_POWER_DELAY_MS, EHCI_PORTSC_CHANGE, EHCI_PORTSC_PP, mdelay(), ehci_device::op, ehci_device::ports, readl(), usb_hub_get_drvdata(), and writel().
|
static |
Close root hub.
hub | USB hub |
Definition at line 1582 of file ehci.c.
References EHCI_OP_CONFIGFLAG, ehci_device::op, usb_hub_get_drvdata(), and writel().
Enable port.
hub | USB hub |
port | USB port |
rc | Return status code |
Definition at line 1596 of file ehci.c.
References DBGC, EHCI_DISOWN_DELAY_MS, EHCI_OP_PORTSC, ehci_poll_companions(), EHCI_PORT_RESET_MAX_WAIT_MS, EHCI_PORTSC_CHANGE, EHCI_PORTSC_LINE_STATUS, EHCI_PORTSC_LINE_STATUS_LOW, EHCI_PORTSC_OWNER, EHCI_PORTSC_PED, EHCI_PORTSC_PR, ENODEV, ETIMEDOUT, mdelay(), ehci_device::name, ehci_device::op, port, readl(), usb_hub_get_drvdata(), USB_RESET_DELAY_MS, and writel().
Disable port.
hub | USB hub |
port | USB port |
rc | Return status code |
Definition at line 1662 of file ehci.c.
References EHCI_OP_PORTSC, EHCI_PORTSC_CHANGE, EHCI_PORTSC_PED, ehci_device::op, port, readl(), usb_hub_get_drvdata(), and writel().
Update root hub port speed.
hub | USB hub |
port | USB port |
rc | Return status code |
Definition at line 1681 of file ehci.c.
References DBGC2, EHCI_OP_PORTSC, EHCI_PORTSC_CCS, EHCI_PORTSC_CSC, EHCI_PORTSC_LINE_STATUS, EHCI_PORTSC_LINE_STATUS_LOW, EHCI_PORTSC_PED, ehci_device::name, ehci_device::op, port, readl(), usb_hub_get_drvdata(), USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_LOW, USB_SPEED_NONE, and writel().
|
static |
Clear transaction translator buffer.
hub | USB hub |
port | USB port |
ep | USB endpoint |
rc | Return status code |
Definition at line 1731 of file ehci.c.
References DBGC, ENOTSUP, ehci_device::name, usb_device::name, port, usb_endpoint::usb, usb_endpoint_name(), and usb_hub_get_drvdata().
Poll for port status changes.
hub | USB hub |
port | USB port |
Definition at line 1748 of file ehci.c.
References EHCI_OP_PORTSC, EHCI_PORTSC_CHANGE, EHCI_PORTSC_CSC, ehci_device::op, port, readl(), usb_hub_get_drvdata(), usb_port_changed(), and writel().
Referenced by ehci_bus_poll().
|
static |
Open USB bus.
bus | USB bus |
rc | Return status code |
Definition at line 1780 of file ehci.c.
References ehci_device::addr64, assert(), ehci_device::async, bus, ehci_queue_head::cache, ehci_queue_head::chr, cpu_to_le32, ehci_device::ctrldssegment, DBGC, ehci_align(), ehci_async_schedule(), EHCI_CHR_HEAD, ehci_ctrl_reachable(), EHCI_LINK_TERMINATE, EHCI_OP_ASYNCLISTADDR, EHCI_OP_CTRLDSSEGMENT, EHCI_OP_PERIODICLISTBASE, EHCI_PAGE_ALIGN, EHCI_PERIODIC_FRAMES, ehci_periodic_schedule(), ehci_run(), EHCI_STATUS_HALTED, ehci_stop(), ENOMEM, ENOTSUP, ehci_device::flsize, ehci_device::frame, free_phys(), ehci_device::head, len, list_empty, malloc_phys(), memset(), ehci_device::name, ehci_transfer_descriptor::next, ehci_device::op, ehci_device::periodic, rc, ehci_transfer_descriptor::status, usb_bus_get_hostdata(), virt_to_phys(), and writel().
|
static |
Close USB bus.
bus | USB bus |
Definition at line 1853 of file ehci.c.
References assert(), ehci_device::async, bus, EHCI_PERIODIC_FRAMES, ehci_stop(), ehci_device::flsize, ehci_device::frame, free_phys(), ehci_device::head, list_empty, ehci_device::periodic, and usb_bus_get_hostdata().
|
static |
Poll USB bus.
bus | USB bus |
Definition at line 1876 of file ehci.c.
References assert(), bus, DBGC, ehci_endpoint::ehci, ehci_endpoint_poll(), EHCI_OP_USBSTS, ehci_root_poll(), EHCI_USBSTS_ASYNC, EHCI_USBSTS_CHANGE, EHCI_USBSTS_HCH, EHCI_USBSTS_PERIODIC, EHCI_USBSTS_PORT, EHCI_USBSTS_SYSERR, EHCI_USBSTS_USBERRINT, EHCI_USBSTS_USBINT, ehci_device::endpoints, ehci_endpoint::list, list_for_each_entry, ehci_device::name, ehci_device::op, ehci_device::ports, readl(), usb_bus_get_hostdata(), and writel().
|
static |
Probe PCI device.
pci | PCI device |
rc | Return status code |
Definition at line 1968 of file ehci.c.
References adjust_pci_device(), alloc_usb_bus(), ehci_device::async, ehci_device::bus, pci_device::dev, EHCI_BAR, ehci_init(), ehci_legacy_claim(), ehci_legacy_init(), ehci_legacy_release(), EHCI_MTU, ehci_operations, ehci_reset(), ehci_device::endpoints, ENODEV, ENOMEM, free, free_usb_bus(), usb_bus::hub, INIT_LIST_HEAD, iounmap(), device::name, ehci_device::name, pci_bar_size(), pci_bar_start(), pci_ioremap(), pci_set_drvdata(), ehci_device::periodic, port, ehci_device::ports, rc, register_usb_bus(), ehci_device::regs, unregister_usb_bus(), usb_bus_set_hostdata(), usb_hub_set_drvdata(), usb_port(), USB_PROTO_2_0, and zalloc().
|
static |
Remove PCI device.
pci | PCI device |
Definition at line 2052 of file ehci.c.
References assert(), ehci_device::async, bus, ehci_device::bus, ehci_legacy_release(), ehci_reset(), free, free_usb_bus(), iounmap(), list_empty, pci_get_drvdata(), ehci_device::periodic, ehci_device::regs, and unregister_usb_bus().
|
static |
Prepare for exit.
booting | System is shutting down for OS boot |
Definition at line 2086 of file ehci.c.
References ehci_legacy_prevent_release.
struct startup_fn ehci_startup __startup_fn | ( | STARTUP_LATE | ) |
Startup/shutdown function.
|
static |
Prevent the release of ownership back to BIOS.
Definition at line 239 of file ehci.c.
Referenced by ehci_legacy_release(), and ehci_shutdown().
|
static |
|
static |
struct pci_driver ehci_driver __pci_driver |
EHCI PCI driver.