TianoCore EDK2 master
Loading...
Searching...
No Matches
MiscBootInformationFunction.c
Go to the documentation of this file.
1
15#include <Library/BaseLib.h>
17#include <Library/DebugLib.h>
19#include <Library/OemMiscLib.h>
21
22#include "SmbiosMisc.h"
23
36SMBIOS_MISC_TABLE_FUNCTION (MiscBootInformation) {
37 EFI_STATUS Status;
38 SMBIOS_TABLE_TYPE32 *SmbiosRecord;
39 SMBIOS_TABLE_TYPE32 *InputData;
40
41 //
42 // First check for invalid parameters.
43 //
44 if (RecordData == NULL) {
45 return EFI_INVALID_PARAMETER;
46 }
47
48 InputData = (SMBIOS_TABLE_TYPE32 *)RecordData;
49
50 //
51 // Two zeros following the last string.
52 //
53 SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
54 if (SmbiosRecord == NULL) {
55 return EFI_OUT_OF_RESOURCES;
56 }
57
58 (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE32));
59
60 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
61
62 SmbiosRecord->BootStatus = OemGetBootStatus ();
63
64 //
65 // Now we have got the full smbios record, call smbios protocol to add this record.
66 //
67 Status = SmbiosMiscAddRecord ((UINT8 *)SmbiosRecord, NULL);
68 if (EFI_ERROR (Status)) {
69 DEBUG ((
70 DEBUG_ERROR,
71 "[%a]:[%dL] Smbios Type32 Table Log Failed! %r \n",
72 __func__,
73 DEBUG_LINE_NUMBER,
74 Status
75 ));
76 }
77
78 FreePool (SmbiosRecord);
79 return Status;
80}
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define DEBUG(Expression)
Definition: DebugLib.h:434
MISC_BOOT_INFORMATION_STATUS_DATA_TYPE EFIAPI OemGetBootStatus(VOID)
Definition: OemMiscLib.c:151
EFI_STATUS SmbiosMiscAddRecord(IN UINT8 *Buffer, IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle OPTIONAL)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINT8 BootStatus
The enumeration value from MISC_BOOT_INFORMATION_STATUS_DATA_TYPE.
Definition: SmBios.h:2446