]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/SmbiosPlatformDxe/Qemu.c
UefiCpuPkg CpuCommFeaturesLib: Fix GP fault issue about ProcTrace
[mirror_edk2.git] / OvmfPkg / SmbiosPlatformDxe / Qemu.c
1 /** @file
2 Find and extract QEMU SMBIOS data from fw_cfg.
3
4 Copyright (C) 2014, Gabriel L. Somlo <somlo@cmu.edu>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7 **/
8
9 #include "SmbiosPlatformDxe.h"
10 #include <Library/QemuFwCfgLib.h>
11 #include <Library/MemoryAllocationLib.h>
12 #include <Library/PcdLib.h>
13
14 /**
15 Locates and extracts the QEMU SMBIOS data if present in fw_cfg
16
17 @return Address of extracted QEMU SMBIOS data
18
19 **/
20 UINT8 *
21 GetQemuSmbiosTables (
22 VOID
23 )
24 {
25 EFI_STATUS Status;
26 FIRMWARE_CONFIG_ITEM Tables;
27 UINTN TablesSize;
28 UINT8 *QemuTables;
29
30 if (!PcdGetBool (PcdQemuSmbiosValidated)) {
31 return NULL;
32 }
33
34 Status = QemuFwCfgFindFile ("etc/smbios/smbios-tables", &Tables,
35 &TablesSize);
36 ASSERT_EFI_ERROR (Status);
37 ASSERT (TablesSize > 0);
38
39 QemuTables = AllocatePool (TablesSize);
40 if (QemuTables == NULL) {
41 return NULL;
42 }
43
44 QemuFwCfgSelectItem (Tables);
45 QemuFwCfgReadBytes (TablesSize, QemuTables);
46
47 return QemuTables;
48 }