54 #define EIO_STATUS( status ) EUNIQ ( EINFO_EIO, ( ( (status) >> 2 ) & 0xf ) ) 77 ehci->
op = ( ehci->
cap + caplength );
78 DBGC2 ( ehci,
"EHCI %s cap %08lx op %08lx\n", ehci->
name,
84 DBGC ( ehci,
"EHCI %s has %d ports\n", ehci->
name, ehci->
ports );
92 DBGC2 ( ehci,
"EHCI %s %d-bit flsize %d\n", ehci->
name,
211 DBGC ( ehci,
"EHCI %s caplen %02x hciversion %04x hcsparams %08x " 212 "hccparams %08x\n", ehci->
name, caplength, hciversion,
213 hcsparams, hccparams );
224 DBGC ( ehci,
"EHCI %s usbcmd %08x usbsts %08x usbint %08x frindx " 225 "%08x\n", ehci->
name, usbcmd, usbsts, usbintr, frindex );
226 DBGC ( ehci,
"EHCI %s ctrlds %08x period %08x asyncl %08x cfgflg " 227 "%08x\n", ehci->
name, ctrldssegment, periodiclistbase,
228 asynclistaddr, configflag );
256 DBGC ( ehci,
"EHCI %s has no USB legacy support capability\n",
265 DBGC ( ehci,
"EHCI %s USB legacy support already disabled\n",
282 unsigned int legacy = ehci->
legacy;
295 DBGC ( ehci,
"EHCI %s BIOS using SMIs: %08x\n",
296 ehci->
name, ctlsts );
310 DBGC ( ehci,
"EHCI %s claimed ownership from BIOS\n",
316 DBGC ( ehci,
"EHCI %s warning: BIOS retained " 317 "SMIs: %08x\n", ehci->
name, ctlsts );
329 DBGC ( ehci,
"EHCI %s could not claim ownership from BIOS: forcibly " 330 "disabling SMIs\n", ehci->
name );
342 unsigned int legacy = ehci->
legacy;
351 DBGC ( ehci,
"EHCI %s not releasing ownership to BIOS\n",
358 DBGC ( ehci,
"EHCI %s released ownership to BIOS\n", ehci->
name );
363 DBGC ( ehci,
"EHCI %s BIOS reclaimed SMIs: %08x\n",
364 ehci->
name, ctlsts );
408 DBGC2 ( ehci,
"EHCI %s polling companion %s\n",
492 DBGC ( ehci,
"EHCI %s timed out waiting for stop\n", ehci->
name );
530 DBGC ( ehci,
"EHCI %s timed out waiting for reset\n", ehci->
name );
558 memset ( ring, 0,
sizeof ( *ring ) );
562 if ( ! ring->
iobuf ) {
564 goto err_alloc_iobuf;
570 if ( ! ring->
head ) {
572 goto err_alloc_queue;
575 DBGC ( ehci,
"EHCI %s queue head unreachable\n", ehci->
name );
576 goto err_unreachable_queue;
583 if ( ! ring->
desc ) {
593 DBGC ( ehci,
"EHCI %s descriptor unreachable\n",
595 goto err_unreachable_desc;
609 err_unreachable_desc:
612 err_unreachable_queue:
635 sizeof ( ring->
desc[0] ) ) );
657 unsigned int count ) {
677 for ( i = 0 ; i <
count ; i++ ) {
681 if ( (
phys > 0xffffffffUL ) && ( ! ehci->
addr64 ) )
700 for ( i = 0 ;
len ; i++ ) {
706 if ( frag_len >
len )
712 sizeof (
desc->low[0] ) ) );
866 DBGC ( ehci,
"EHCI %s timed out waiting for asynchronous schedule " 867 "to advance\n", ehci->
name );
881 unsigned int max_interval;
889 DBGCP ( ehci,
"EHCI %s periodic schedule: ", ehci->
name );
895 DBGCP ( ehci,
"%s%d",
900 DBGCP ( ehci,
"\n" );
903 DBGCP ( ehci,
"EHCI %s periodic frame list:", ehci->
name );
905 for ( i = 0 ; i < frames ; i++ ) {
915 max_interval = ( 1 << (
ffs ( i ) - 1 ) );
919 max_interval = ( ( max_interval << 1 ) - 1 );
927 if ( endpoint->
ep->
interval <= max_interval ) {
930 DBGCP ( ehci,
" %d:%d",
938 DBGCP ( ehci,
"\n" );
949 unsigned int interval = endpoint->
ep->
interval;
953 if (
before->ep->interval < interval )
1079 for ( i = 0 ; i < 8 ;
1125 endpoint =
zalloc (
sizeof ( *endpoint ) );
1136 goto err_ring_alloc;
1173 DBGC ( ehci,
"EHCI %s %s could not unschedule: %s\n",
1262 packet = iobuf->
data;
1263 iob_pull ( iobuf,
sizeof ( *packet ) );
1264 xfer->
data = packet;
1265 xfer->
len =
sizeof ( *packet );
1289 ( xfer - xfers ) ) ) != 0 )
1313 if ( zlp || (
count == 0 ) )
1343 for ( i = 0 ; i <
count ; i++ ) {
1347 if ( xfer_len >
len )
1352 xfer->
len = xfer_len;
1407 DBGC ( ehci,
"EHCI %s %s completion %d failed (status " 1408 "%02x): %s\n", usb->
name,
1490 DBGC ( ehci,
"EHCI %s could not allocate address: %s\n",
1492 goto err_alloc_address;
1497 goto err_set_address;
1564 for ( i = 1 ; i <= ehci->
ports ; i++ ) {
1606 DBGC ( ehci,
"EHCI %s-%d detected low-speed device: " 1607 "disowning\n", ehci->
name,
port->address );
1627 DBGC ( ehci,
"EHCI %s-%d not enabled after reset: " 1628 "disowning\n", ehci->
name,
port->address );
1636 DBGC ( ehci,
"EHCI %s-%d timed out waiting for port to reset\n",
1692 DBGC2 ( ehci,
"EHCI %s-%d status is %08x\n",
1693 ehci->
name,
port->address, portsc );
1700 port->disconnected |= csc;
1719 port->speed = speed;
1736 DBGC ( ehci,
"EHCI %s-%d nonsensical CLEAR_TT for %s %s\n", ehci->
name,
1782 unsigned int frames;
1793 if ( ! ehci->
head ) {
1795 goto err_alloc_head;
1811 DBGC ( ehci,
"EHCI %s CTRLDSSEGMENT not supported\n",
1814 goto err_ctrldssegment;
1819 len = ( frames *
sizeof ( ehci->
frame[0] ) );
1821 if ( ! ehci->
frame ) {
1823 goto err_alloc_frame;
1826 DBGC ( ehci,
"EHCI %s frame list unreachable\n", ehci->
name );
1827 goto err_unreachable_frame;
1839 err_unreachable_frame:
1971 unsigned long bar_start;
1977 ehci =
zalloc (
sizeof ( *ehci ) );
1994 if ( ! ehci->
regs ) {
2013 if ( ! ehci->
bus ) {
2021 for ( i = 1 ; i <= ehci->
ports ; i++ ) {
2068 PCI_ROM ( 0xffff, 0xffff,
"ehci",
"EHCI", 0 ),
#define EHCI_USBLEGSUP_BIOS_OWNED
USB legacy support BIOS ownership flag.
unsigned int cons
Consumer counter.
static __always_inline void struct dma_mapping size_t size_t align
#define iob_pull(iobuf, len)
static void ehci_legacy_claim(struct ehci_device *ehci, struct pci_device *pci)
Claim ownership from BIOS.
static void ehci_run(struct ehci_device *ehci)
Start EHCI device.
static void usb_endpoint_set_hostdata(struct usb_endpoint *ep, void *priv)
Set USB endpoint host controller private data.
uint16_t segment
Code segment.
#define EIO_STATUS(status)
Construct error code from transfer descriptor status.
#define PCI_CLASS_ID(base, sub, progif)
Construct PCI class ID.
struct arbelprm_rc_send_wqe rc
#define EHCI_USBLEGSUP_BIOS
USB legacy support BIOS owned semaphore.
#define EHCI_USBCMD_ASYNC_ADVANCE
Asyncchronous schedule advance doorbell.
#define EHCI_USBSTS_SYSERR
Host system error.
#define EHCI_USBCMD_HCRST
Host controller reset.
#define EHCI_PERIODIC_FRAMES(flsize)
Number of elements in frame list.
unsigned int ports
Number of ports.
static struct io_buffer * ehci_dequeue(struct ehci_ring *ring)
Dequeue a transfer descriptor.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static int ehci_stop(struct ehci_device *ehci)
Stop EHCI device.
uint8_t readb(volatile uint8_t *io_addr)
Read byte from memory-mapped device.
static size_t ehci_align(size_t len)
Calculate buffer alignment.
A transfer descriptor ring.
static int ehci_endpoint_message(struct usb_endpoint *ep, struct io_buffer *iobuf)
Enqueue message transfer.
struct list_head periodic
Periodic schedule.
void * op
Operational registers.
uint32_t ctrldssegment
Control data structure segment.
#define EHCI_STATUS_ACTIVE
Active.
static int ehci_device_open(struct usb_device *usb)
Open device.
#define EHCI_CHR_CONTROL
Control endpoint flag.
size_t residual
Residual untransferred data.
#define EHCI_USBSTS_ASYNC
Asynchronous schedule enabled.
#define EHCI_HCCPARAMS_ADDR64(params)
64-bit addressing capability
uint32_t next
Next descriptor address.
static int ehci_endpoint_stream(struct usb_endpoint *ep, struct io_buffer *iobuf, int zlp)
Enqueue stream transfer.
struct usb_bus * alloc_usb_bus(struct device *dev, unsigned int ports, size_t mtu, struct usb_host_operations *op)
Allocate USB bus.
#define USB_ENDPOINT_ATTR_TYPE_MASK
Endpoint attribute transfer type mask.
static void ehci_endpoint_close(struct usb_endpoint *ep)
Close endpoint.
static int ehci_endpoint_reset(struct usb_endpoint *ep)
Reset endpoint.
uint16_t readw(volatile uint16_t *io_addr)
Read 16-bit word from memory-mapped device.
static struct pci_device_id ehci_ids[]
EHCI PCI device IDs.
#define EHCI_CAP_TT_HUB(address)
Transaction translator hub address.
static int ehci_root_clear_tt(struct usb_hub *hub, struct usb_port *port, struct usb_endpoint *ep)
Clear transaction translator buffer.
#define EHCI_FL_PID_SETUP
SETUP token.
static uint32_t ehci_endpoint_capabilities(struct usb_endpoint *ep)
Determine endpoint capabilities.
#define EHCI_FL_CERR_MAX
Error counter maximum value.
struct pci_device_id * ids
PCI ID table.
uint64_t address
Base address.
#define EHCI_CAP_CAPLENGTH
Capability register length.
static void usb_set_hostdata(struct usb_device *usb, void *priv)
Set USB device host controller private data.
#define EHCI_CHR_TOGGLE
Explicit data toggles.
uint8_t attr
Type and attributes.
#define EHCI_USBSTS_CHANGE
USB status change mask.
#define EHCI_DISOWN_DELAY_MS
Time to delay after releasing ownership of a port.
#define EHCI_USBCMD_RUN
Run/stop.
static void ehci_endpoint_update(struct usb_endpoint *ep)
Update endpoint characteristics and capabilities.
#define EHCI_HCSPARAMS_PORTS(params)
Number of ports.
#define EHCI_USBSTS_PORT
Port change detect.
#define EHCI_HCCPARAMS_EECP(params)
EHCI extended capabilities pointer.
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
uint64_t desc
Microcode descriptor list physical address.
uint16_t len
Transfer length.
#define USB_RESET_DELAY_MS
Minimum reset time.
static int ehci_legacy_prevent_release
Prevent the release of ownership back to BIOS.
struct usb_bus * bus
USB bus.
int32_t before
Initial microcode version.
static int ehci_ring_alloc(struct ehci_device *ehci, struct ehci_ring *ring)
Allocate transfer descriptor ring.
#define EHCI_USBSTS_ASYNC_ADVANCE
Asynchronous schedule advanced.
#define EHCI_PORT_RESET_MAX_WAIT_MS
Maximum time to wait for a port reset to complete.
uint32_t link
First queue head.
struct usb_device * usb
Currently attached device (if in use)
unsigned long long uint64_t
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
struct list_head schedule
Endpoint schedule.
static void ehci_shutdown(int booting)
Prepare for exit.
#define EHCI_LINK_TYPE_QH
Queue head type.
#define EHCI_LEN_MASK
Length mask.
static void ehci_bus_close(struct usb_bus *bus)
Close USB bus.
static void ehci_root_poll(struct usb_hub *hub, struct usb_port *port)
Poll for port status changes.
static int ehci_hub_open(struct usb_hub *hub __unused)
Open hub.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
#define EHCI_USBLEGSUP_CTLSTS
USB legacy support control/status.
struct device dev
Generic device.
unsigned int address
Device address, if assigned.
static void ehci_hub_close(struct usb_hub *hub __unused)
Close hub.
uint32_t next
Next transfer descriptor.
unsigned int speed
Device speed.
#define ECANCELED
Operation canceled.
#define ENOTSUP
Operation not supported.
#define STARTUP_LATE
Late startup.
void usb_port_changed(struct usb_port *port)
Report port status change.
A hardware device description.
Dynamic memory allocation.
#define EHCI_CHR_ENDPOINT(address)
Endpoint number.
#define EHCI_CAP_SPLIT_SCHED_DEFAULT
Default split completion schedule mask.
#define EHCI_PORTSC_CHANGE
Port status change mask.
static void usb_bus_set_hostdata(struct usb_bus *bus, void *priv)
Set USB bus host controller private data.
struct ehci_queue_head * head
Queue head.
#define list_empty(list)
Test whether a list is empty.
#define EHCI_MTU
Maximum transfer size.
#define EHCI_USBLEGSUP_MAX_WAIT_MS
Maximum time to wait for BIOS to release ownership.
struct ehci_queue_head * head
Asynchronous queue head.
#define EHCI_PORTSC_PED
Port enabled.
static int usb_set_address(struct usb_device *usb, unsigned int address)
Set address.
struct io_buffer ** iobuf
I/O buffers.
#define for_each_usb_bus(bus)
Iterate over all USB buses.
#define EHCI_RESET_MAX_WAIT_MS
Maximum time to wait for reset to complete.
A startup/shutdown function.
#define list_del(list)
Delete an entry from a list.
unsigned int legacy
USB legacy support capability (if present and enabled)
#define EHCI_OP_USBCMD
USB command register.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
uint16_t busdevfn
PCI bus:dev.fn address.
#define ENOMEM
Not enough space.
struct usb_device * usb
Underlying USB device, if any.
static int ehci_root_open(struct usb_hub *hub)
Open root hub.
static signed char phys[4]
struct ehci_device * ehci
EHCI device.
static int ehci_endpoint_mtu(struct usb_endpoint *ep)
Update MTU.
#define __unused
Declare a variable or data structure as unused.
#define BUS_TYPE_PCI
PCI bus type.
#define EHCI_PORTSC_CCS
Current connect status.
void unregister_usb_bus(struct usb_bus *bus)
Unregister USB bus.
struct usb_port * port
USB port.
int addr64
64-bit addressing capability
unsigned int prod
Producer counter.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define EHCI_USBSTS_USBERRINT
USB error interrupt.
struct device * dev
Underlying hardware device.
#define EHCI_PORTSC_PP
Port power.
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
struct usb_endpoint * ep
USB endpoint.
#define PCI_FIRST_FUNC(busdevfn)
#define EHCI_ASYNC_ADVANCE_MAX_WAIT_MS
Maximum time to wait for asynchronous schedule to advance.
#define EHCI_MIN_ALIGN
Minimum alignment required for data structures.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
#define EHCI_BAR
EHCI PCI BAR.
void * cap
Capability registers.
#define EHCI_USBCMD_FLSIZE(flsize)
Frame list size.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
#define EHCI_FL_IOC
Interrupt on completion.
static int ehci_probe(struct pci_device *pci)
Probe PCI device.
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
#define list_for_each_entry_reverse(pos, head, member)
Iterate over entries in a list in reverse order.
unsigned int burst
Maximum burst size.
#define EHCI_PAGE_ALIGN
Page-alignment required for some data structures.
static void ehci_periodic_add(struct ehci_endpoint *endpoint)
Add endpoint to periodic schedule.
#define PCI_CLASS(base, sub, progif)
Construct PCI class.
u32 link
Link to next descriptor.
static void ehci_remove(struct pci_device *pci)
Remove PCI device.
uint16_t count
Number of entries.
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
unsigned int flsize
Frame list size.
struct ehci_transfer_descriptor cache
Transfer descriptor cache.
static void ehci_endpoint_poll(struct ehci_endpoint *endpoint)
Poll for completions.
#define EHCI_FLSIZE_SMALL
Smallest allowed frame list size.
#define EHCI_USBSTS_HCH
Host controller halted.
static struct usb_host_operations ehci_operations
USB host controller operations.
#define USB_DIR_IN
Data transfer is from device to host.
#define EHCI_CAP_MULT(mult)
High-bandwidth pipe multiplier.
static unsigned int ehci_extended_capability(struct ehci_device *ehci, struct pci_device *pci, unsigned int id, unsigned int offset)
Find extended capability.
struct ehci_ring ring
Transfer descriptor ring.
unsigned int location
Location.
static int ehci_device_address(struct usb_device *usb)
Assign device address.
#define EHCI_USBCMD_ASYNC
Asynchronous schedule enable.
#define EHCI_FL_PID_IN
IN token.
#define cpu_to_le32(value)
#define EHCI_PORTSC_LINE_STATUS_LOW
Line status: low-speed device.
static __unused void ehci_dump(struct ehci_device *ehci)
Dump host controller registers.
static unsigned int ehci_endpoint_count(size_t len, int zlp)
Calculate number of transfer descriptors.
static void usb_poll(struct usb_bus *bus)
Poll USB bus.
static struct usb_endpoint * usb_endpoint(struct usb_device *usb, unsigned int address)
Get USB endpoint.
USB Enhanced Host Controller Interface (EHCI) driver.
#define iob_unput(iobuf, len)
#define USB_ENDPOINT_ATTR_INTERRUPT
Interrupt endpoint transfer type.
#define EHCI_OP_USBINTR
USB interrupt enable register.
char * strerror(int errno)
Retrieve string representation of error number.
#define EHCI_PORT_POWER_DELAY_MS
Time to delay after enabling power to a port.
static void(* free)(struct refcnt *refcnt))
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
void * zalloc(size_t size)
Allocate cleared memory.
static int ehci_reset(struct ehci_device *ehci)
Reset EHCI device.
#define PCI_CLASS_SERIAL_USB
#define PCI_CLASS_SERIAL_USB_OHCI
OHCI USB controller.
#define EHCI_PORTSC_PR
Port reset.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define EHCI_PORTSC_OWNER
Port owner.
#define EHCI_OP_CONFIGFLAG
Configure flag register.
#define EHCI_OP_PORTSC(port)
Port status and control register.
#define EHCI_USBCMD_PERIODIC
Periodic schedule enable.
#define EHCI_HCCPARAMS_FLSIZE(params)
Programmable frame list flag.
static int ehci_schedule_del(struct ehci_endpoint *endpoint)
Remove endpoint from appropriate schedule.
static unsigned int ehci_ring_remaining(struct ehci_ring *ring)
Calculate space remaining in transfer descriptor ring.
#define EHCI_OP_ASYNCLISTADDR
Current asynchronous list address register.
void usb_free_address(struct usb_bus *bus, unsigned int address)
Free device address.
int pci_read_config(struct pci_device *pci)
Read PCI device configuration.
#define PCI_CLASS_SERIAL_USB_EHCI
ECHI USB controller.
static void ehci_async_add(struct ehci_endpoint *endpoint)
Add endpoint to asynchronous schedule.
#define EHCI_FL_PID_OUT
OUT token.
#define ENODEV
No such device.
static uint32_t ehci_link_qh(struct ehci_queue_head *queue)
Get link value for a queue head.
#define EHCI_PORTSC_LINE_STATUS(portsc)
Line status.
#define EHCI_PORTSC_CSC
Connect status change.
static void * usb_get_hostdata(struct usb_device *usb)
Get USB device host controller private data.
struct ehci_periodic_frame * frame
Periodic frame list.
A PCI device ID list entry.
#define EHCI_CAP_HCSPARAMS
Structural parameters.
#define le16_to_cpu(value)
#define ffs(x)
Find first (i.e.
const char * usb_endpoint_name(struct usb_endpoint *ep)
Get USB endpoint name (for debugging)
#define EHCI_LINK_TERMINATE
List terminator.
#define EHCI_CAP_TT_PORT(port)
Transaction translator port number.
#define EHCI_OP_CTRLDSSEGMENT
Control data structure segment register.
#define EHCI_CHR_MAX_LEN(len)
Maximum packet length.
#define EHCI_USBSTS_USBINT
USB interrupt.
size_t mtu
Maximum transfer size.
#define EHCI_FL_TOGGLE
Set initial data toggle.
static void ehci_bus_poll(struct usb_bus *bus)
Poll USB bus.
static uint32_t ehci_endpoint_characteristics(struct usb_endpoint *ep)
Determine endpoint characteristics.
static void ehci_async_schedule(struct ehci_device *ehci)
(Re)build asynchronous schedule
#define EHCI_CHR_ADDRESS(address)
Device address.
#define PCI_LAST_FUNC(busdevfn)
struct usb_port * usb_transaction_translator(struct usb_device *usb)
Get USB transaction translator.
#define EHCI_USBLEGSUP_OS_OWNED
USB legacy support OS ownership flag.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
#define EHCI_OP_USBSTS
USB status register.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define EHCI_EECP_NEXT(eecp)
Next EHCI extended capability pointer.
#define EHCI_USBSTS_PERIODIC
Periodic schedule enabled.
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
#define INIT_LIST_HEAD(list)
Initialise a list head.
#define EHCI_CHR_EPS_FULL
Full-speed endpoint.
static void * usb_bus_get_hostdata(struct usb_bus *bus)
Get USB bus host controller private data.
struct list_head endpoints
List of all endpoints.
#define ENOBUFS
No buffer space available.
#define EHCI_LEN_TOGGLE
Data toggle.
static void ehci_schedule_add(struct ehci_endpoint *endpoint)
Add endpoint to appropriate schedule.
Universal Serial Bus (USB)
struct startup_fn ehci_startup __startup_fn(STARTUP_LATE)
Startup/shutdown function.
int register_usb_bus(struct usb_bus *bus)
Register USB bus.
#define EHCI_OP_PERIODICLISTBASE
Periodic frame list base address register.
#define EHCI_CAP_HCCPARAMS
Capability parameters.
static void usb_complete(struct usb_endpoint *ep, struct io_buffer *iobuf)
Complete transfer (without error)
unsigned int address
Port address.
static void ehci_legacy_init(struct ehci_device *ehci, struct pci_device *pci)
Initialise USB legacy support.
void * data
Start of data.
static void ehci_init(struct ehci_device *ehci, void *regs)
Initialise device.
static int ehci_ctrl_reachable(struct ehci_device *ehci, void *ptr)
Check control data structure reachability.
struct usb_hub * hub
USB hub.
#define EHCI_CHR_EPS_HIGH
High-speed endpoint.
struct usb_endpoint * ep[32]
Endpoint list.
unsigned int interval
Interval (in microframes)
unsigned int eecp
EHCI extended capabilities offset.
static int ehci_root_speed(struct usb_hub *hub, struct usb_port *port)
Update root hub port speed.
uint32_t link
Horizontal link pointer.
struct usb_endpoint_host_operations endpoint
Endpoint operations.
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
static void ehci_ring_free(struct ehci_ring *ring)
Free transfer descriptor ring.
#define cpu_to_le16(value)
#define EHCI_CHR_EPS_LOW
Low-speed endpoint.
#define EHCI_USBLEGSUP_OS
USB legacy support OS owned semaphore.
static void ehci_legacy_release(struct ehci_device *ehci, struct pci_device *pci)
Release ownership back to BIOS.
void iounmap(volatile const void *io_addr)
Unmap I/O address.
uint8_t data[48]
Additional event data.
#define PCI_CLASS_SERIAL_USB_UHCI
UHCI USB controller.
struct device_description desc
Device description.
USB host controller operations.
#define USB_ENDPOINT_ATTR_CONTROL
Control endpoint transfer type.
static unsigned int ehci_ring_fill(struct ehci_ring *ring)
Calculate space used in transfer descriptor ring.
struct usb_hub * hub
Root hub.
static int ehci_bus_open(struct usb_bus *bus)
Open USB bus.
static int ehci_periodic_del(struct ehci_endpoint *endpoint)
Remove endpoint from periodic schedule.
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
static void usb_hub_set_drvdata(struct usb_hub *hub, void *priv)
Set USB hub driver private data.
#define EHCI_CAP_HCIVERSION
Host controller interface version number.
struct usb_device * usb
USB device.
uint16_t offset
Offset to command line.
#define EHCI_OP_FRINDEX
Frame index register.
static struct usb_port * usb_port(struct usb_hub *hub, unsigned int address)
Get USB port.
#define EHCI_STATUS_HALTED
Halted.
struct list_head async
Asynchronous schedule.
static void ehci_device_close(struct usb_device *usb)
Close device.
#define EHCI_CHR_HEAD
Head of reclamation list flag.
#define EHCI_EECP_ID_LEGACY
USB legacy support extended capability.
#define EHCI_EECP_ID(eecp)
EHCI extended capability ID.
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.
#define EHCI_FLSIZE_DEFAULT
Default frame list size.
int(* open)(struct usb_endpoint *ep)
Open endpoint.
unsigned int ehci_companion(struct pci_device *pci)
Locate EHCI companion controller.
#define EHCI_CAP_INTR_SCHED(uframe)
Interrupt schedule mask.
static void pci_init(struct pci_device *pci, unsigned int busdevfn)
Initialise PCI device.
static int ehci_root_disable(struct usb_hub *hub, struct usb_port *port)
Disable port.
static void ehci_root_close(struct usb_hub *hub)
Close root hub.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
struct usb_bus * bus
USB bus.
#define fls(x)
Find last (i.e.
#define EHCI_RING_COUNT
Number of transfer descriptors in a ring.
struct list_head list
List of all endpoints.
#define list_check_contains_entry(entry, head, member)
Check list contains a specified entry.
#define USB_EP0_ADDRESS
Control endpoint address.
#define NULL
NULL pointer (VOID *)
#define ETIMEDOUT
Connection timed out.
int usb_alloc_address(struct usb_bus *bus)
Allocate device address.
static void ehci_poll_companions(struct ehci_device *ehci)
Poll child companion controllers.
#define PCI_ROM(_vendor, _device, _name, _description, _data)
unsigned int attributes
Attributes.
static void ehci_periodic_schedule(struct ehci_device *ehci)
(Re)build periodic schedule
struct pci_driver ehci_driver __pci_driver
EHCI PCI driver.
struct ehci_transfer_descriptor * desc
Transfer descriptors.
unsigned int address
Endpoint address.
void free_usb_bus(struct usb_bus *bus)
Free USB bus.
#define EHCI_CONFIGFLAG_CF
Configure flag.
void usb_complete_err(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete transfer (possibly with error)
static void * usb_hub_get_drvdata(struct usb_hub *hub)
Get USB hub driver private data.
uint32_t chr
Endpoint characteristics.
static void * usb_endpoint_get_hostdata(struct usb_endpoint *ep)
Get USB endpoint host controller private data.
#define EHCI_USBCMD_FLSIZE_MASK
Frame list size mask.
static int ehci_endpoint_open(struct usb_endpoint *ep)
Open endpoint.
#define EHCI_STOP_MAX_WAIT_MS
Maximum time to wait for host controller to stop.
static int ehci_root_enable(struct usb_hub *hub, struct usb_port *port)
Enable port.
void * memset(void *dest, int character, size_t len) __nonnull
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
static int ehci_async_del(struct ehci_endpoint *endpoint)
Remove endpoint from asynchronous schedule.