From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c (limited to 'roms/edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c') 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 + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include "SmbiosPlatformDxe.h" +#include +#include +#include + +/** + 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; +} -- cgit 1.2.3-korg