Files
system76-edk2/OvmfPkg/SmbiosPlatformDxe/Qemu.c
Sebastien Boeuf 2ccefa32a6 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>
2021-12-11 14:26:05 +00:00

52 lines
1.2 KiB
C

/** @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 <Library/DebugLib.h> // ASSERT_EFI_ERROR()
#include <Library/MemoryAllocationLib.h> // AllocatePool()
#include <Library/PcdLib.h> // PcdGetBool()
#include <Library/QemuFwCfgLib.h> // QemuFwCfgFindFile()
/**
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;
}