diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2013-12-05 18:43:20 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2013-12-27 12:42:12 -0500 |
commit | ec443fff52edeaa08f2b978faeca46137bfe74d9 (patch) | |
tree | d9e984eb430be2c54c5b471a67aa451e83928bda /src/hw/usb.c | |
parent | 60f3b8022c643d7d5a77c3af58f0f13266f39cc5 (diff) | |
download | seabios-hppa-ec443fff52edeaa08f2b978faeca46137bfe74d9.zip seabios-hppa-ec443fff52edeaa08f2b978faeca46137bfe74d9.tar.gz seabios-hppa-ec443fff52edeaa08f2b978faeca46137bfe74d9.tar.bz2 |
usb: Replace EHCI to UHCI/OHCI synchronization with new scheme.
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>
Diffstat (limited to 'src/hw/usb.c')
-rw-r--r-- | src/hw/usb.c | 59 |
1 files changed, 12 insertions, 47 deletions
diff --git a/src/hw/usb.c b/src/hw/usb.c index 8fe741f..8430e50 100644 --- a/src/hw/usb.c +++ b/src/hw/usb.c @@ -1,6 +1,6 @@ // Main code for handling USB controllers and devices. // -// Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> +// Copyright (C) 2009-2013 Kevin O'Connor <kevin@koconnor.net> // // This file may be distributed under the terms of the GNU LGPLv3 license. @@ -8,9 +8,6 @@ #include "config.h" // CONFIG_* #include "malloc.h" // free #include "output.h" // dprintf -#include "pci.h" // foreachpci -#include "pci_ids.h" // PCI_CLASS_SERIAL_USB_UHCI -#include "pci_regs.h" // PCI_CLASS_REVISION #include "string.h" // memset #include "usb.h" // struct usb_s #include "usb-ehci.h" // ehci_setup @@ -439,52 +436,20 @@ usb_enumerate(struct usbhub_s *hub) } void +__usb_setup(void *data) +{ + dprintf(3, "init usb\n"); + xhci_setup(); + ehci_setup(); + uhci_setup(); + ohci_setup(); +} + +void usb_setup(void) { ASSERT32FLAT(); if (! CONFIG_USB) return; - - dprintf(3, "init usb\n"); - - // Look for USB controllers - int count = 0; - struct pci_device *pci, *ehcipci = NULL; - foreachpci(pci) { - if (pci->class != PCI_CLASS_SERIAL_USB) - continue; - - if (!ehcipci || pci->bdf >= ehcipci->bdf) { - // Check to see if this device has an ehci controller - int found = 0; - ehcipci = pci; - for (;;) { - if (pci_classprog(ehcipci) == PCI_CLASS_SERIAL_USB_EHCI) { - // Found an ehci controller. - int ret = ehci_setup(ehcipci, count++, pci); - if (ret) - // Error - break; - count += found; - pci = ehcipci; - break; - } - if (ehcipci->class == PCI_CLASS_SERIAL_USB) - found++; - ehcipci = container_of_or_null( - ehcipci->node.next, struct pci_device, node); - if (!ehcipci || (pci_bdf_to_busdev(ehcipci->bdf) - != pci_bdf_to_busdev(pci->bdf))) - // No ehci controller found. - break; - } - } - - if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_UHCI) - uhci_setup(pci, count++); - else if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_OHCI) - ohci_setup(pci, count++); - else if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_XHCI) - xhci_setup(pci, count++); - } + run_thread(__usb_setup, NULL); } |