#include <Protocol/EsrtManagement.h>\r
#include <Protocol/GraphicsOutput.h>\r
#include <Protocol/LoadedImage.h>\r
+#include <Protocol/NonDiscoverableDevice.h>\r
#include <Protocol/PciIo.h>\r
#include <Protocol/PciRootBridgeIo.h>\r
#include <Protocol/PlatformBootManager.h>\r
#include <Guid/EventGroup.h>\r
+#include <Guid/NonDiscoverableDevice.h>\r
#include <Guid/TtyTerm.h>\r
#include <Guid/SerialPortLibVendor.h>\r
\r
}\r
\r
\r
+/**\r
+ This FILTER_FUNCTION checks if a handle corresponds to a non-discoverable\r
+ USB host controller.\r
+**/\r
+STATIC\r
+BOOLEAN\r
+EFIAPI\r
+IsUsbHost (\r
+ IN EFI_HANDLE Handle,\r
+ IN CONST CHAR16 *ReportText\r
+ )\r
+{\r
+ NON_DISCOVERABLE_DEVICE *Device;\r
+ EFI_STATUS Status;\r
+\r
+ Status = gBS->HandleProtocol (Handle,\r
+ &gEdkiiNonDiscoverableDeviceProtocolGuid,\r
+ (VOID **)&Device);\r
+ if (EFI_ERROR (Status)) {\r
+ return FALSE;\r
+ }\r
+\r
+ if (CompareGuid (Device->Type, &gEdkiiNonDiscoverableUhciDeviceGuid) ||\r
+ CompareGuid (Device->Type, &gEdkiiNonDiscoverableEhciDeviceGuid) ||\r
+ CompareGuid (Device->Type, &gEdkiiNonDiscoverableXhciDeviceGuid)) {\r
+ return TRUE;\r
+ }\r
+ return FALSE;\r
+}\r
+\r
+\r
/**\r
This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking\r
the matching driver to produce all first-level child handles.\r
//\r
FilterAndProcess (&gEfiGraphicsOutputProtocolGuid, NULL, AddOutput);\r
\r
+ //\r
+ // The core BDS code connects short-form USB device paths by explicitly\r
+ // looking for handles with PCI I/O installed, and checking the PCI class\r
+ // code whether it matches the one for a USB host controller. This means\r
+ // non-discoverable USB host controllers need to have the non-discoverable\r
+ // PCI driver attached first.\r
+ //\r
+ FilterAndProcess (&gEdkiiNonDiscoverableDeviceProtocolGuid, IsUsbHost, Connect);\r
+\r
//\r
// Add the hardcoded short-form USB keyboard device path to ConIn.\r
//\r