]>
Commit | Line | Data |
---|---|---|
5905e09c RC |
1 | /** @file\r |
2 | boot information boot time changes.\r | |
3 | SMBIOS type 32.\r | |
4 | \r | |
5 | Based on files under Nt32Pkg/MiscSubClassPlatformDxe/\r | |
6 | \r | |
7 | Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>\r | |
8 | Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r | |
9 | Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR>\r | |
10 | Copyright (c) 2015, Linaro Limited. All rights reserved.<BR>\r | |
11 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include <Library/BaseLib.h>\r | |
16 | #include <Library/BaseMemoryLib.h>\r | |
17 | #include <Library/DebugLib.h>\r | |
18 | #include <Library/MemoryAllocationLib.h>\r | |
bbeb1bea | 19 | #include <Library/OemMiscLib.h>\r |
5905e09c RC |
20 | #include <Library/UefiBootServicesTableLib.h>\r |
21 | \r | |
22 | #include "SmbiosMisc.h"\r | |
23 | \r | |
24 | /**\r | |
25 | This function makes boot time changes to the contents of the\r | |
26 | MiscBootInformation (Type 32) record.\r | |
27 | \r | |
28 | @param RecordData Pointer to SMBIOS table with default values.\r | |
29 | @param Smbios SMBIOS protocol.\r | |
30 | \r | |
31 | @retval EFI_SUCCESS The SMBIOS table was successfully added.\r | |
32 | @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r | |
33 | @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory.\r | |
34 | \r | |
35 | **/\r | |
36 | SMBIOS_MISC_TABLE_FUNCTION(MiscBootInformation)\r | |
37 | {\r | |
38 | EFI_STATUS Status;\r | |
39 | SMBIOS_TABLE_TYPE32 *SmbiosRecord;\r | |
40 | SMBIOS_TABLE_TYPE32 *InputData;\r | |
41 | \r | |
42 | //\r | |
43 | // First check for invalid parameters.\r | |
44 | //\r | |
45 | if (RecordData == NULL) {\r | |
46 | return EFI_INVALID_PARAMETER;\r | |
47 | }\r | |
48 | \r | |
49 | InputData = (SMBIOS_TABLE_TYPE32 *)RecordData;\r | |
50 | \r | |
51 | //\r | |
52 | // Two zeros following the last string.\r | |
53 | //\r | |
54 | SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);\r | |
55 | if (SmbiosRecord == NULL) {\r | |
56 | return EFI_OUT_OF_RESOURCES;\r | |
57 | }\r | |
58 | \r | |
59 | (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE32));\r | |
60 | \r | |
61 | SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);\r | |
62 | \r | |
bbeb1bea RC |
63 | SmbiosRecord->BootStatus = OemGetBootStatus ();\r |
64 | \r | |
5905e09c RC |
65 | //\r |
66 | // Now we have got the full smbios record, call smbios protocol to add this record.\r | |
67 | //\r | |
68 | Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);\r | |
69 | if (EFI_ERROR (Status)) {\r | |
70 | DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type32 Table Log Failed! %r \n",\r | |
f331310a | 71 | __FUNCTION__, DEBUG_LINE_NUMBER, Status));\r |
5905e09c RC |
72 | }\r |
73 | \r | |
74 | FreePool (SmbiosRecord);\r | |
75 | return Status;\r | |
76 | }\r |