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