summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/SmbiosPlatformDxe
diff options
context:
space:
mode:
authorSebastien Boeuf <sebastien.boeuf@intel.com>2021-12-10 22:41:55 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-11 14:26:05 +0000
commit2ccefa32a65164da2ec74e8a1e81f90257967c7f (patch)
tree0062affa0bbb20849d9769773849bfa9868bfb29 /OvmfPkg/SmbiosPlatformDxe
parent9afcd48a94e85586bc8ea61f2fba21476e716ca1 (diff)
downloadedk2-2ccefa32a65164da2ec74e8a1e81f90257967c7f.tar.gz
edk2-2ccefa32a65164da2ec74e8a1e81f90257967c7f.tar.bz2
edk2-2ccefa32a65164da2ec74e8a1e81f90257967c7f.zip
OvmfPkg: Create global entry point for SMBIOS parsing
Move the generic entry point part out of Qemu.c to anticipate the addition of new ways of retrieving the SMBIOS table. Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Diffstat (limited to 'OvmfPkg/SmbiosPlatformDxe')
-rw-r--r--OvmfPkg/SmbiosPlatformDxe/EntryPoint.c42
-rw-r--r--OvmfPkg/SmbiosPlatformDxe/Qemu.c35
-rw-r--r--OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h11
-rw-r--r--OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf1
4 files changed, 54 insertions, 35 deletions
diff --git a/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c b/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c
new file mode 100644
index 0000000000..f53af2b2e6
--- /dev/null
+++ b/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c
@@ -0,0 +1,42 @@
+/** @file
+ Find and extract SMBIOS data.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Library/MemoryAllocationLib.h> // FreePool()
+
+#include "SmbiosPlatformDxe.h"
+
+/**
+ Installs SMBIOS information for OVMF
+
+ @param ImageHandle Module's image handle
+ @param SystemTable Pointer of EFI_SYSTEM_TABLE
+
+ @retval EFI_SUCCESS Smbios data successfully installed
+ @retval Other Smbios data was not installed
+
+**/
+EFI_STATUS
+EFIAPI
+SmbiosTablePublishEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *SmbiosTables;
+
+ Status = EFI_NOT_FOUND;
+ //
+ // Add QEMU SMBIOS data if found
+ //
+ SmbiosTables = GetQemuSmbiosTables ();
+ if (SmbiosTables != NULL) {
+ Status = InstallAllStructures (SmbiosTables);
+ FreePool (SmbiosTables);
+ }
+
+ return Status;
+}
diff --git a/OvmfPkg/SmbiosPlatformDxe/Qemu.c b/OvmfPkg/SmbiosPlatformDxe/Qemu.c
index 4dae4b0b98..9613c090c5 100644
--- a/OvmfPkg/SmbiosPlatformDxe/Qemu.c
+++ b/OvmfPkg/SmbiosPlatformDxe/Qemu.c
@@ -11,8 +11,6 @@
#include <Library/PcdLib.h> // PcdGetBool()
#include <Library/QemuFwCfgLib.h> // QemuFwCfgFindFile()
-#include "SmbiosPlatformDxe.h"
-
/**
Locates and extracts the QEMU SMBIOS data if present in fw_cfg
@@ -51,36 +49,3 @@ GetQemuSmbiosTables (
return QemuTables;
}
-
-/**
- Installs SMBIOS information for OVMF
-
- @param ImageHandle Module's image handle
- @param SystemTable Pointer of EFI_SYSTEM_TABLE
-
- @retval EFI_SUCCESS Smbios data successfully installed
- @retval Other Smbios data was not installed
-
-**/
-EFI_STATUS
-EFIAPI
-SmbiosTablePublishEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- UINT8 *SmbiosTables;
-
- Status = EFI_NOT_FOUND;
- //
- // Add QEMU SMBIOS data if found
- //
- SmbiosTables = GetQemuSmbiosTables ();
- if (SmbiosTables != NULL) {
- Status = InstallAllStructures (SmbiosTables);
- FreePool (SmbiosTables);
- }
-
- return Status;
-}
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 74e314a895..b7bf004be9 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -22,4 +22,15 @@ InstallAllStructures (
IN UINT8 *TableAddress
);
+/**
+ Locates and extracts the QEMU SMBIOS data if present in fw_cfg
+
+ @return Address of extracted QEMU SMBIOS data
+
+**/
+UINT8 *
+GetQemuSmbiosTables (
+ VOID
+ );
+
#endif
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index eaee73110d..e239a631f2 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -24,6 +24,7 @@
#
[Sources]
+ EntryPoint.c
Qemu.c
SmbiosPlatformDxe.c
SmbiosPlatformDxe.h