|
@@ -34,6 +34,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
34
|
34
|
#include <ipxe/umalloc.h>
|
35
|
35
|
#include <ipxe/pci.h>
|
36
|
36
|
#include <ipxe/usb.h>
|
|
37
|
+#include <ipxe/init.h>
|
37
|
38
|
#include <ipxe/profile.h>
|
38
|
39
|
#include "xhci.h"
|
39
|
40
|
|
|
@@ -521,6 +522,9 @@ static inline void xhci_dump_port ( struct xhci_device *xhci,
|
521
|
522
|
******************************************************************************
|
522
|
523
|
*/
|
523
|
524
|
|
|
525
|
+/** Prevent the release of ownership back to BIOS */
|
|
526
|
+static int xhci_legacy_prevent_release;
|
|
527
|
+
|
524
|
528
|
/**
|
525
|
529
|
* Initialise USB legacy support
|
526
|
530
|
*
|
|
@@ -610,6 +614,12 @@ static void xhci_legacy_release ( struct xhci_device *xhci ) {
|
610
|
614
|
if ( ! xhci->legacy )
|
611
|
615
|
return;
|
612
|
616
|
|
|
617
|
+ /* Do nothing if releasing ownership is prevented */
|
|
618
|
+ if ( xhci_legacy_prevent_release ) {
|
|
619
|
+ DBGC ( xhci, "XHCI %p not releasing ownership to BIOS\n", xhci);
|
|
620
|
+ return;
|
|
621
|
+ }
|
|
622
|
+
|
613
|
623
|
/* Release ownership */
|
614
|
624
|
writeb ( 0, xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS );
|
615
|
625
|
DBGC ( xhci, "XHCI %p released ownership to BIOS\n", xhci );
|
|
@@ -3190,3 +3200,20 @@ struct pci_driver xhci_driver __pci_driver = {
|
3190
|
3200
|
.probe = xhci_probe,
|
3191
|
3201
|
.remove = xhci_remove,
|
3192
|
3202
|
};
|
|
3203
|
+
|
|
3204
|
+/**
|
|
3205
|
+ * Prepare for exit
|
|
3206
|
+ *
|
|
3207
|
+ * @v booting System is shutting down for OS boot
|
|
3208
|
+ */
|
|
3209
|
+static void xhci_shutdown ( int booting ) {
|
|
3210
|
+ /* If we are shutting down to boot an OS, then prevent the
|
|
3211
|
+ * release of ownership back to BIOS.
|
|
3212
|
+ */
|
|
3213
|
+ xhci_legacy_prevent_release = booting;
|
|
3214
|
+}
|
|
3215
|
+
|
|
3216
|
+/** Startup/shutdown function */
|
|
3217
|
+struct startup_fn xhci_startup __startup_fn ( STARTUP_LATE ) = {
|
|
3218
|
+ .shutdown = xhci_shutdown,
|
|
3219
|
+};
|