]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c
OvmfPkg: SmbiosPlatformDxe: eliminate duplicate entry point validation
[mirror_edk2.git] / OvmfPkg / Library / SmbiosVersionLib / DetectSmbiosVersionLib.c
index 0efe020eea4a1343b272e31df0106a484b43a811..9d5e337e1a3ac1c5777b9b9814df50e489fc70fb 100644 (file)
@@ -40,6 +40,15 @@ DetectSmbiosVersion (
   QEMU_SMBIOS_ANCHOR   QemuAnchor;\r
   UINT16               SmbiosVersion;\r
 \r
+  if (PcdGetBool (PcdQemuSmbiosValidated)) {\r
+    //\r
+    // Some other module, linked against this library, has already performed\r
+    // the task at hand. This should never happen, but it's easy to handle;\r
+    // just exit early.\r
+    //\r
+    return RETURN_SUCCESS;\r
+  }\r
+\r
   if (RETURN_ERROR (QemuFwCfgFindFile (\r
                       "etc/smbios/smbios-anchor", &Anchor, &AnchorSize)) ||\r
       RETURN_ERROR (QemuFwCfgFindFile (\r
@@ -72,5 +81,10 @@ DetectSmbiosVersion (
     SmbiosVersion));\r
   PcdSet16 (PcdSmbiosVersion, SmbiosVersion);\r
 \r
+  //\r
+  // SMBIOS platform drivers can now fetch and install\r
+  // "etc/smbios/smbios-tables" from QEMU.\r
+  //\r
+  PcdSetBool (PcdQemuSmbiosValidated, TRUE);\r
   return RETURN_SUCCESS;\r
 }\r