TianoCore EDK2 master
Loading...
Searching...
No Matches
Qemu.c
Go to the documentation of this file.
1
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()
13
20UINT8 *
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 (
35 "etc/smbios/smbios-tables",
36 &Tables,
37 &TablesSize
38 );
39 ASSERT_EFI_ERROR (Status);
40 ASSERT (TablesSize > 0);
41
42 QemuTables = AllocatePool (TablesSize);
43 if (QemuTables == NULL) {
44 return NULL;
45 }
46
47 QemuFwCfgSelectItem (Tables);
48 QemuFwCfgReadBytes (TablesSize, QemuTables);
49
50 return QemuTables;
51}
UINT64 UINTN
#define NULL
Definition: Base.h:319
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
UINT8 * GetQemuSmbiosTables(VOID)
Definition: Qemu.c:21
RETURN_STATUS EFIAPI QemuFwCfgFindFile(IN CONST CHAR8 *Name, OUT FIRMWARE_CONFIG_ITEM *Item, OUT UINTN *Size)
Definition: QemuFwCfgLib.c:250
VOID EFIAPI QemuFwCfgReadBytes(IN UINTN Size, IN VOID *Buffer OPTIONAL)
Definition: QemuFwCfgNull.c:66
VOID EFIAPI QemuFwCfgSelectItem(IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem)
Definition: QemuFwCfgLib.c:33
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29