]>
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 | |
19 | #include <Library/UefiBootServicesTableLib.h>\r | |
20 | \r | |
21 | #include "SmbiosMisc.h"\r | |
22 | \r | |
23 | /**\r | |
24 | This function makes boot time changes to the contents of the\r | |
25 | MiscBootInformation (Type 32) record.\r | |
26 | \r | |
27 | @param RecordData Pointer to SMBIOS table with default values.\r | |
28 | @param Smbios SMBIOS protocol.\r | |
29 | \r | |
30 | @retval EFI_SUCCESS The SMBIOS table was successfully added.\r | |
31 | @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r | |
32 | @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory.\r | |
33 | \r | |
34 | **/\r | |
35 | SMBIOS_MISC_TABLE_FUNCTION(MiscBootInformation)\r | |
36 | {\r | |
37 | EFI_STATUS Status;\r | |
38 | SMBIOS_TABLE_TYPE32 *SmbiosRecord;\r | |
39 | SMBIOS_TABLE_TYPE32 *InputData;\r | |
40 | \r | |
41 | //\r | |
42 | // First check for invalid parameters.\r | |
43 | //\r | |
44 | if (RecordData == NULL) {\r | |
45 | return EFI_INVALID_PARAMETER;\r | |
46 | }\r | |
47 | \r | |
48 | InputData = (SMBIOS_TABLE_TYPE32 *)RecordData;\r | |
49 | \r | |
50 | //\r | |
51 | // Two zeros following the last string.\r | |
52 | //\r | |
53 | SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);\r | |
54 | if (SmbiosRecord == NULL) {\r | |
55 | return EFI_OUT_OF_RESOURCES;\r | |
56 | }\r | |
57 | \r | |
58 | (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE32));\r | |
59 | \r | |
60 | SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);\r | |
61 | \r | |
62 | //\r | |
63 | // Now we have got the full smbios record, call smbios protocol to add this record.\r | |
64 | //\r | |
65 | Status = SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL);\r | |
66 | if (EFI_ERROR (Status)) {\r | |
67 | DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type32 Table Log Failed! %r \n",\r | |
68 | __FUNCTION__, __LINE__, Status));\r | |
69 | }\r | |
70 | \r | |
71 | FreePool (SmbiosRecord);\r | |
72 | return Status;\r | |
73 | }\r |