diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c')
-rw-r--r-- | roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c b/roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c new file mode 100644 index 000000000..e34658238 --- /dev/null +++ b/roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c @@ -0,0 +1,48 @@ +/** @file
+ Find and extract QEMU SMBIOS data from fw_cfg.
+
+ Copyright (C) 2014, Gabriel L. Somlo <somlo@cmu.edu>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include "SmbiosPlatformDxe.h"
+#include <Library/QemuFwCfgLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+
+/**
+ Locates and extracts the QEMU SMBIOS data if present in fw_cfg
+
+ @return Address of extracted QEMU SMBIOS data
+
+**/
+UINT8 *
+GetQemuSmbiosTables (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ FIRMWARE_CONFIG_ITEM Tables;
+ UINTN TablesSize;
+ UINT8 *QemuTables;
+
+ if (!PcdGetBool (PcdQemuSmbiosValidated)) {
+ return NULL;
+ }
+
+ Status = QemuFwCfgFindFile ("etc/smbios/smbios-tables", &Tables,
+ &TablesSize);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (TablesSize > 0);
+
+ QemuTables = AllocatePool (TablesSize);
+ if (QemuTables == NULL) {
+ return NULL;
+ }
+
+ QemuFwCfgSelectItem (Tables);
+ QemuFwCfgReadBytes (TablesSize, QemuTables);
+
+ return QemuTables;
+}
|