]>
Commit | Line | Data |
---|---|---|
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 | |
6 | This program and the accompanying materials are licensed and made\r | |
7 | available under the terms and conditions of the BSD License which\r | |
8 | accompanies this distribution. The full text of the license may\r | |
9 | be found at http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | **/\r | |
14 | \r | |
15 | #include "SmbiosPlatformDxe.h"\r | |
16 | #include <Library/QemuFwCfgLib.h>\r | |
17 | #include <Library/MemoryAllocationLib.h>\r | |
92dc0bb2 | 18 | #include <Library/PcdLib.h>\r |
a145e28d GS |
19 | \r |
20 | /**\r | |
21 | Locates and extracts the QEMU SMBIOS data if present in fw_cfg\r | |
22 | \r | |
23 | @return Address of extracted QEMU SMBIOS data\r | |
24 | \r | |
25 | **/\r | |
26 | UINT8 *\r | |
27 | GetQemuSmbiosTables (\r | |
28 | VOID\r | |
29 | )\r | |
30 | {\r | |
92dc0bb2 LE |
31 | EFI_STATUS Status;\r |
32 | FIRMWARE_CONFIG_ITEM Tables;\r | |
33 | UINTN TablesSize;\r | |
a145e28d GS |
34 | UINT8 *QemuTables;\r |
35 | \r | |
92dc0bb2 | 36 | if (!PcdGetBool (PcdQemuSmbiosValidated)) {\r |
a145e28d GS |
37 | return NULL;\r |
38 | }\r | |
39 | \r | |
92dc0bb2 LE |
40 | Status = QemuFwCfgFindFile ("etc/smbios/smbios-tables", &Tables,\r |
41 | &TablesSize);\r | |
42 | ASSERT_EFI_ERROR (Status);\r | |
43 | ASSERT (TablesSize > 0);\r | |
a145e28d GS |
44 | \r |
45 | QemuTables = AllocatePool (TablesSize);\r | |
46 | if (QemuTables == NULL) {\r | |
47 | return NULL;\r | |
48 | }\r | |
49 | \r | |
50 | QemuFwCfgSelectItem (Tables);\r | |
51 | QemuFwCfgReadBytes (TablesSize, QemuTables);\r | |
52 | \r | |
53 | return QemuTables;\r | |
54 | }\r |