]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c
ArmPkg: Apply uncrustify changes
[mirror_edk2.git] / ArmPkg / Universal / Smbios / SmbiosMiscDxe / Type32 / MiscBootInformationFunction.c
1 /** @file
2 boot information boot time changes.
3 SMBIOS type 32.
4
5 Based on files under Nt32Pkg/MiscSubClassPlatformDxe/
6
7 Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
8 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
9 Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR>
10 Copyright (c) 2015, Linaro Limited. All rights reserved.<BR>
11 SPDX-License-Identifier: BSD-2-Clause-Patent
12
13 **/
14
15 #include <Library/BaseLib.h>
16 #include <Library/BaseMemoryLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/MemoryAllocationLib.h>
19 #include <Library/OemMiscLib.h>
20 #include <Library/UefiBootServicesTableLib.h>
21
22 #include "SmbiosMisc.h"
23
24 /**
25 This function makes boot time changes to the contents of the
26 MiscBootInformation (Type 32) record.
27
28 @param RecordData Pointer to SMBIOS table with default values.
29 @param Smbios SMBIOS protocol.
30
31 @retval EFI_SUCCESS The SMBIOS table was successfully added.
32 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
33 @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory.
34
35 **/
36 SMBIOS_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 __FUNCTION__,
73 DEBUG_LINE_NUMBER,
74 Status
75 ));
76 }
77
78 FreePool (SmbiosRecord);
79 return Status;
80 }