summaryrefslogtreecommitdiffstats
path: root/src/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/usb')
-rw-r--r--src/drivers/usb/xhci.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/drivers/usb/xhci.c b/src/drivers/usb/xhci.c
index 6306e1580..a71d12788 100644
--- a/src/drivers/usb/xhci.c
+++ b/src/drivers/usb/xhci.c
@@ -34,6 +34,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/umalloc.h>
#include <ipxe/pci.h>
#include <ipxe/usb.h>
+#include <ipxe/init.h>
#include <ipxe/profile.h>
#include "xhci.h"
@@ -521,6 +522,9 @@ static inline void xhci_dump_port ( struct xhci_device *xhci,
******************************************************************************
*/
+/** Prevent the release of ownership back to BIOS */
+static int xhci_legacy_prevent_release;
+
/**
* Initialise USB legacy support
*
@@ -610,6 +614,12 @@ static void xhci_legacy_release ( struct xhci_device *xhci ) {
if ( ! xhci->legacy )
return;
+ /* Do nothing if releasing ownership is prevented */
+ if ( xhci_legacy_prevent_release ) {
+ DBGC ( xhci, "XHCI %p not releasing ownership to BIOS\n", xhci);
+ return;
+ }
+
/* Release ownership */
writeb ( 0, xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS );
DBGC ( xhci, "XHCI %p released ownership to BIOS\n", xhci );
@@ -3190,3 +3200,20 @@ struct pci_driver xhci_driver __pci_driver = {
.probe = xhci_probe,
.remove = xhci_remove,
};
+
+/**
+ * Prepare for exit
+ *
+ * @v booting System is shutting down for OS boot
+ */
+static void xhci_shutdown ( int booting ) {
+ /* If we are shutting down to boot an OS, then prevent the
+ * release of ownership back to BIOS.
+ */
+ xhci_legacy_prevent_release = booting;
+}
+
+/** Startup/shutdown function */
+struct startup_fn xhci_startup __startup_fn ( STARTUP_LATE ) = {
+ .shutdown = xhci_shutdown,
+};