At this point all platforms that use OvmfPkg/SmbiosPlatformDxe in edk2, namely ArmVirtQemu.dsc and OvmfPkg*.dsc, have been migrated to SmbiosVersionLib. Therefore SmbiosPlatformDxe itself can forego verifying QEMU's SMBIOS entry point; if SmbiosVersionLib's validation was successful, it should just rely on that. (Note that SmbiosPlatformDxe has a depex on EFI_SMBIOS_PROTOCOL, installed by SmbiosDxe, containing SmbiosVersionLib, therefore the set/get order of PcdQemuSmbiosValidated is ensured.) Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Wei Huang <wei@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Gabriel L. Somlo <somlo@cmu.edu> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18180 6f19259b-4bc3-4df7-8a09-765794883524
55 lines
1.4 KiB
C
55 lines
1.4 KiB
C
/** @file
|
|
Find and extract QEMU SMBIOS data from fw_cfg.
|
|
|
|
Copyright (C) 2014, Gabriel L. Somlo <somlo@cmu.edu>
|
|
|
|
This program and the accompanying materials are licensed and made
|
|
available under the terms and conditions of the BSD License which
|
|
accompanies this distribution. The full text of the license may
|
|
be found at http://opensource.org/licenses/bsd-license.php
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
**/
|
|
|
|
#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;
|
|
}
|