]> git.proxmox.com Git - mirror_edk2.git/blame - QuarkPlatformPkg/Platform/Dxe/SmbiosMiscDxe/MiscOemStringFunction.c
QuarkPlatformPkg: Add new package for Galileo boards
[mirror_edk2.git] / QuarkPlatformPkg / Platform / Dxe / SmbiosMiscDxe / MiscOemStringFunction.c
CommitLineData
b303605e
MK
1/** @file\r
2boot information boot time changes.\r
3SMBIOS type 11.\r
4\r
5Copyright (c) 2013-2015 Intel Corporation.\r
6\r
7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17\r
18#include "CommonHeader.h"\r
19#include "SmbiosMisc.h"\r
20\r
21/**\r
22 This function makes boot time changes to the contents of the\r
23 MiscOemString (Type 11).\r
24\r
25 @param RecordData Pointer to copy of RecordData from the Data Table.\r
26\r
27 @retval EFI_SUCCESS All parameters were valid.\r
28 @retval EFI_UNSUPPORTED Unexpected RecordType value.\r
29 @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r
30\r
31**/\r
32MISC_SMBIOS_TABLE_FUNCTION(MiscOemString)\r
33{\r
34 UINTN OemStrLen;\r
35 CHAR8 *OptionalStrStart;\r
36 EFI_STATUS Status;\r
37 EFI_STRING OemStr;\r
38 STRING_REF TokenToGet;\r
39 EFI_SMBIOS_HANDLE SmbiosHandle;\r
40 SMBIOS_TABLE_TYPE11 *SmbiosRecord;\r
41 EFI_MISC_OEM_STRING *ForType11InputData;\r
42\r
43 ForType11InputData = (EFI_MISC_OEM_STRING *)RecordData;\r
44\r
45 //\r
46 // First check for invalid parameters.\r
47 //\r
48 if (RecordData == NULL) {\r
49 return EFI_INVALID_PARAMETER;\r
50 }\r
51\r
52 TokenToGet = STRING_TOKEN (STR_MISC_OEM_EN_US);\r
53 OemStr = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);\r
54 OemStrLen = StrLen(OemStr);\r
55 if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) {\r
56 return EFI_UNSUPPORTED;\r
57 }\r
58\r
59 //\r
60 // Two zeros following the last string.\r
61 //\r
62 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);\r
63 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);\r
64\r
65 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;\r
66 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11);\r
67 //\r
68 // Make handle chosen by smbios protocol.add automatically.\r
69 //\r
70 SmbiosRecord->Hdr.Handle = 0;\r
71 SmbiosRecord->StringCount = 1;\r
72 OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);\r
73 UnicodeStrToAsciiStr(OemStr, OptionalStrStart);\r
74\r
75 //\r
76 // Now we have got the full smbios record, call smbios protocol to add this record.\r
77 //\r
78 SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r
79 Status = Smbios-> Add(\r
80 Smbios,\r
81 NULL,\r
82 &SmbiosHandle,\r
83 (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord\r
84 );\r
85 FreePool(SmbiosRecord);\r
86 return Status;\r
87}\r