]>
Commit | Line | Data |
---|---|---|
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 | |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
7 | **/\r | |
8 | \r | |
9 | #include "SmbiosPlatformDxe.h"\r | |
10 | #include <Library/QemuFwCfgLib.h>\r | |
11 | #include <Library/MemoryAllocationLib.h>\r | |
12 | #include <Library/PcdLib.h>\r | |
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 | |
20 | UINT8 *\r | |
21 | GetQemuSmbiosTables (\r | |
22 | VOID\r | |
23 | )\r | |
24 | {\r | |
25 | EFI_STATUS Status;\r | |
26 | FIRMWARE_CONFIG_ITEM Tables;\r | |
27 | UINTN TablesSize;\r | |
28 | UINT8 *QemuTables;\r | |
29 | \r | |
30 | if (!PcdGetBool (PcdQemuSmbiosValidated)) {\r | |
31 | return NULL;\r | |
32 | }\r | |
33 | \r | |
34 | Status = QemuFwCfgFindFile ("etc/smbios/smbios-tables", &Tables,\r | |
35 | &TablesSize);\r | |
36 | ASSERT_EFI_ERROR (Status);\r | |
37 | ASSERT (TablesSize > 0);\r | |
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 |