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