]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
OvmfPkg: Check for QemuFwCfg availability before accessing it
[mirror_edk2.git] / OvmfPkg / Library / QemuBootOrderLib / QemuBootOrderLib.c
index b5768285d8c8aaa8221e31c6edaea9e35e61dac3..67d29ac6429fd5130b30bc022de083b1844b89e3 100644 (file)
@@ -2233,6 +2233,11 @@ GetFrontPageTimeoutFromQemu (
 {\r
   FIRMWARE_CONFIG_ITEM  BootMenuWaitItem;\r
   UINTN                 BootMenuWaitSize;\r
+  UINT16                Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
+\r
+  if (!QemuFwCfgIsAvailable ()) {\r
+    return Timeout;\r
+  }\r
 \r
   QemuFwCfgSelectItem (QemuFwCfgItemBootMenu);\r
   if (QemuFwCfgRead16 () == 0) {\r
@@ -2257,9 +2262,6 @@ GetFrontPageTimeoutFromQemu (
     // return three seconds if the platform default would cause us to skip the\r
     // front page, and return the platform default otherwise.\r
     //\r
-    UINT16  Timeout;\r
-\r
-    Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
     if (Timeout == 0) {\r
       Timeout = 3;\r
     }\r