When OVMF tried to load the file-based NvVars, it checked all the PCI instances and connected the drivers to the mass storage device. However, Xen registered its PCI device with a special class id (0xFF80), so ConnectRecursivelyIfPciMassStorage() couldn't recognize it and skipped the driver connecting for Xen PCI devices. In the end, the Xen block device wasn't initialized until EfiBootManagerConnectAll() was called, and it's already too late to load NvVars.
This commit connects the Xen drivers in ConnectRecursivelyIfPciMassStorage() so that Xen can use the file-based NvVars. Cc: Jordan Justen <jordan.l.jus...@intel.com> Cc: Laszlo Ersek <ler...@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <g...@suse.com> --- OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 9 +++++++-- .../Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c index befcc57..8b09956 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -1049,8 +1049,12 @@ ConnectRecursivelyIfPciMassStorage ( EFI_STATUS Status; EFI_DEVICE_PATH_PROTOCOL *DevicePath; CHAR16 *DevPathStr; + BOOLEAN isXenPci; - if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) { + isXenPci = PcdGetBool (PcdPciDisableBusEnumeration) && \ + IS_CLASS2 (PciHeader, 0xFF, 0x80); + + if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE) || isXenPci) { DevicePath = NULL; Status = gBS->HandleProtocol ( Handle, @@ -1068,7 +1072,8 @@ ConnectRecursivelyIfPciMassStorage ( if (DevPathStr != NULL) { DEBUG(( EFI_D_INFO, - "Found Mass Storage device: %s\n", + "Found %s device: %s\n", + !isXenPci ? L"Mass Storage" : L"Xen", DevPathStr )); FreePool(DevPathStr); diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 5fcee3c..cd28be0 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -62,6 +62,7 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration [Pcd.IA32, Pcd.X64] gEfiMdePkgTokenSpaceGuid.PcdFSBClock -- 2.8.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel