2 Find and extract QEMU SMBIOS data from fw_cfg.
4 Copyright (C) 2014, Gabriel L. Somlo <somlo@cmu.edu>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include <Library/DebugLib.h> // ASSERT_EFI_ERROR()
10 #include <Library/MemoryAllocationLib.h> // AllocatePool()
11 #include <Library/PcdLib.h> // PcdGetBool()
12 #include <Library/QemuFwCfgLib.h> // QemuFwCfgFindFile()
14 #include "SmbiosPlatformDxe.h"
17 Locates and extracts the QEMU SMBIOS data if present in fw_cfg
19 @return Address of extracted QEMU SMBIOS data
28 FIRMWARE_CONFIG_ITEM Tables
;
32 if (!PcdGetBool (PcdQemuSmbiosValidated
)) {
36 Status
= QemuFwCfgFindFile (
37 "etc/smbios/smbios-tables",
41 ASSERT_EFI_ERROR (Status
);
42 ASSERT (TablesSize
> 0);
44 QemuTables
= AllocatePool (TablesSize
);
45 if (QemuTables
== NULL
) {
49 QemuFwCfgSelectItem (Tables
);
50 QemuFwCfgReadBytes (TablesSize
, QemuTables
);
56 Installs SMBIOS information for OVMF
58 @param ImageHandle Module's image handle
59 @param SystemTable Pointer of EFI_SYSTEM_TABLE
61 @retval EFI_SUCCESS Smbios data successfully installed
62 @retval Other Smbios data was not installed
67 SmbiosTablePublishEntry (
68 IN EFI_HANDLE ImageHandle
,
69 IN EFI_SYSTEM_TABLE
*SystemTable
75 Status
= EFI_NOT_FOUND
;
77 // Add QEMU SMBIOS data if found
79 SmbiosTables
= GetQemuSmbiosTables ();
80 if (SmbiosTables
!= NULL
) {
81 Status
= InstallAllStructures (SmbiosTables
);
82 FreePool (SmbiosTables
);