Add xhci_controller_setup_acpi() function to initialize usb host
adapters declared in the DSDT table.  Search the acpi devices list
for xhci controllers.

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 src/hw/usb-xhci.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c
index f27867e4f184..c35f2211983d 100644
--- a/src/hw/usb-xhci.c
+++ b/src/hw/usb-xhci.c
@@ -637,6 +637,29 @@ xhci_controller_setup_pci(struct pci_device *pci)
     run_thread(configure_xhci, xhci);
 }
 
+static void
+xhci_controller_setup_acpi(struct acpi_device *dev)
+{
+    struct usb_xhci_s *xhci;
+    u64 mem, unused;
+    void *baseaddr;
+
+    if (acpi_dsdt_find_mem(dev, &mem, &unused) < 0)
+        return;
+    if (mem >= 0x100000000ll)
+        return;
+
+    baseaddr = (void*)(u32)mem;
+    dprintf(1, "ACPI: XHCI at mmio %p\n", baseaddr);
+
+    xhci = xhci_controller_setup(baseaddr);
+    if (!xhci)
+        return;
+
+    xhci->usb.mmio = baseaddr;
+    run_thread(configure_xhci, xhci);
+}
+
 void
 xhci_setup(void)
 {
@@ -648,6 +671,14 @@ xhci_setup(void)
         if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_XHCI)
             xhci_controller_setup_pci(pci);
     }
+
+    u16 xhci_eisaid = 0x0d10;
+    struct acpi_device *dev;
+    for (dev = acpi_dsdt_find_eisaid(NULL, xhci_eisaid);
+         dev != NULL;
+         dev = acpi_dsdt_find_eisaid(dev, xhci_eisaid)) {
+        xhci_controller_setup_acpi(dev);
+    }
 }
 
 
-- 
2.27.0
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to