aboutsummaryrefslogtreecommitdiff
path: root/src/hw/usb-ehci.c
AgeCommit message (Collapse)AuthorFilesLines
2019-02-04usb-ehci: Clear pipe token on pipe reallocateKevin O'Connor1-0/+1
Make sure to clear the token before reuse as it may otherwise have an incorrect toggle setting. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-03pci: Split low-level pci code from higher-level 'struct pci_device' codeKevin O'Connor1-1/+1
Split pci.c into pci.c and pcidevice.c. The low-level code that interacts directly with the PCI devices remains in pci.c, while functions dealing with the higher level pci_device cache move to pcidevice.c. Only pci.c is needed in 16bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-03pci: Implement '%pP' printf handler for 'struct pci_device' pointersKevin O'Connor1-3/+1
Handle '%pP' format descriptions as a pointer to a 'struct pci_device' and display it in bus:device.function (%02x:%02x.%x) format. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02ehci: Convert to new PCI BAR helper functionsKevin O'Connor1-6/+6
Use the pci_enable_x() functions. The ehci controller code will now explicitly set PCI_COMMAND_MEMORY instead of assuming it has already been enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02usb: Eliminate USB controller setup threadKevin O'Connor1-1/+0
There are no longer any sleep or yield calls during the usb controller device scans, so there is no need to run these device scans in a separate thread. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-02ehci: Only delay UHCI/OHCI port scan until after EHCI setup completesKevin O'Connor1-3/+7
EHCI controller setup needs to occur prior to checking any UHCI or OHCI ports to ensure a high speed device is not mistakenly configured on a full speed "companion" controller. However, only the UHCI/OHCI port scan needs to be delayed, not the full UHCI/OHCI controller init. This change moves back the ehci controller setup check until port scan in UHCI/OHCI. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07usb: Control transfers always have an 8 byte command sizeKevin O'Connor1-3/+3
There is no need to pass 'cmdsize' to the usb drivers as the cmdsize is always 8 bytes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07ehci: Merge ehci_send_control with ehci_send_bulkKevin O'Connor1-66/+30
Merge both the control and bulk pipe sending functions into one new function: ehci_send_pipe(). The two existing functions were similar, and by merging them the resulting code supports more flexible control transfers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07ehci: Simplify fillTDbuffer() and renameKevin O'Connor1-28/+17
Simplify the calculation of the maximum transfer size per qtd, simplify the fillTDbuffer() function so that it only fills the buffer pointers, and rename fillTDbuffer() to ehci_fill_tdbuf(). Also, don't modify 'data' or 'datasize' so that usb_xfer_time() can use 'datasize' at the end of the function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07ehci: No need to support td array wrappingKevin O'Connor1-15/+13
The maximum bulk transfer is 64K and 4 QTDs can always transfer 64K. So, there is no need to support a transfer with more than 4 QTDs. Build the entire transaction and then submit it in one operation to simplify the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16ehci: Export ehci_realloc_pipe() instead of ehci_alloc_pipe()Kevin O'Connor1-2/+5
Support alloc, update, and free from the single exported function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16usb: Clarify usb freelist manipulationsKevin O'Connor1-2/+2
Rename usb_getFreePipe() to usb_get_freelist(). Add usb_is_freelist() and usb_add_freelist() functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16usb: Rename usb_getFrameExp() to usb_get_period()Kevin O'Connor1-1/+1
This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-16usb: Rename ?hci_control() to ?hci_send_control()Kevin O'Connor1-2/+2
This is just function renaming - no code implementation changes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-09-16ehci: Fix bug in hub port assignmentKevin O'Connor1-1/+1
The usbdev->port field is zero indexed, while the USB spec expects the port values to start at one. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-09-16usb: Perform device detect polling on all usb controllers.Kevin O'Connor1-2/+2
Move the 100ms (USB_TIME_SIGATT) device detect polling from the ohci/uhci/usb-hub code to the generic usb_hub_port_setup() code. This extends the 100ms polling to ehci and xhci controllers. The code in usb_hub_port_setup() now compares USB_TIME_SIGATT to the start of usb_enumerate(), which may make boots faster when threads are disabled. This patch also changes the meaning of the return code for hub->op->detect() calls. Now 1 indicates device found, 0 indicates device not found, and -1 indicates permanent failure. Also, the xhci controller generic delay of 100ms is replaced with a 20ms root hub power stabilize time. This in combination with the 100ms for USB_TIME_SIGATT should be closer to the USB2 spec (the USB3 spec does not seem to declare an equivalent of USB_TIME_SIGATT). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-09-16ehci: Stall uhci/ohci init only until default port routing is done.Kevin O'Connor1-18/+13
Now that uhci and ohci will continually poll for a device connect, the ehci controller only needs to ensure that the default routing is setup properly before allowing uhci and ohci to be initialized. This also fixes two error paths in configure_ehci() that were not properly updating PendingEHCIPorts. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-09-10ehci: Move port power up from ehci_hub_detect() to check_ehci_ports().Kevin O'Connor1-13/+12
Don't perform port power up in the detect code. Instead do it prior to calling usb_enumerate(). This makes the code more similar to the ohci and xhci drivers. It can also reduce the total boot time when threads are disabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-14ehci: Update usb command timeouts to use usb_xfer_time()Kevin O'Connor1-5/+6
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-20ehci: memset the qTD structures in ehci_alloc_intr_pipeKevin O'Connor1-0/+2
The qTD structures were not being cleared in ehci_alloc_intr_pipe() and it was possible that garbage could have been in some of the fields. Also, memset the data array for sanity purposes. A similar fix is in the Chromium seabios repo (3e711dc261). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-27usb: Replace EHCI to UHCI/OHCI synchronization with new scheme.Kevin O'Connor1-56/+27
The previous code attempts to correlate which UHCI and OHCI controllers correlate with which EHCI controllers so that it can ensure high speed devices are handled by the EHCI code while low/full speed devices are handled by the UHCI/OHCI code. Replace this logic by initializing all EHCI controllers first, and then initializing all UHCI and OHCI controllers. This simplifies the code and improves support for some hardware devices that don't follow the OHCI/UHCI to EHCI correlation standard. Also, remove the unused usb->busid field. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-28Remove ioport.h; disperse its contents to other header files.Kevin O'Connor1-1/+0
Move the inb(), insb(), etc. code from ioport.h to x86.h. Move the PORT_* definitions to their appropriate hardware files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor1-7/+8
Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move malloc code from pmm.c to new files malloc.c and malloc.h.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Rename util.c to string.c and introduce string.h.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Split x86 specific functions out of util.c/h to new files x86.c/h.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-02Move code centered around specific hardware devices to src/hw/Kevin O'Connor1-0/+723
Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>