]> xenbits.xensource.com Git - osstest/seabios.git/commitdiff
usb/xhci: add support for mmio host adapters (via acpi).
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 30 Sep 2020 11:14:33 +0000 (13:14 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 13 Oct 2020 09:04:03 +0000 (11:04 +0200)
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 <kraxel@redhat.com>
Message-id: 20200930111433.21533-4-kraxel@redhat.com

src/hw/usb-xhci.c

index f27867e4f18492be5109dc2fe9bbd782e41a46ef..c35f2211983d4854dd7ae3078676fa3dd19e272d 100644 (file)
@@ -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);
+    }
 }