Fix alignment bug in pci_bios_init_root_regions().
[seabios.git] / src / usb-ehci.c
index d60465e86dbf7f1cf08b2e0e791243ba108ed6f4..a60c60715cad93693170fb1bf9798ca7e460bacd 100644 (file)
@@ -50,6 +50,10 @@ ehci_note_port(struct usb_ehci_s *cntl)
         struct pci_device *pci = cntl->companion[i];
         if (!pci)
             break;
+
+        // ohci/uhci_init call pci_config_XXX - don't run from irq handler.
+        wait_preempt();
+
         if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_UHCI)
             uhci_init(pci, cntl->usb.busid + i);
         else if (pci_classprog(pci) == PCI_CLASS_SERIAL_USB_OHCI)
@@ -259,6 +263,10 @@ ehci_init(struct pci_device *pci, int busid, struct pci_device *comppci)
     }
 
     struct usb_ehci_s *cntl = malloc_tmphigh(sizeof(*cntl));
+    if (!cntl) {
+        warn_noalloc();
+        return -1;
+    }
     memset(cntl, 0, sizeof(*cntl));
     cntl->usb.busid = busid;
     cntl->usb.pci = pci;