]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c
According to PI errata 0000654 and 000811, we need use 0xFFFE to instead of 0 for...
[mirror_edk2.git] / EmulatorPkg / MiscSubClassPlatformDxe / MiscSystemLanguageStringFunction.c
CommitLineData
949f388f 1/** @file\r
2 ResetCapabilities.\r
3 SMBIOS type 23.\r
4\r
2bfd90f9 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
949f388f 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
d18d8a1d 21 @param RecordData Pointer to copy of RecordData from the Data Table.\r
949f388f 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(SystemLanguageString)\r
29{\r
30 EFI_STATUS Status;\r
31 EFI_SMBIOS_HANDLE SmbiosHandle;\r
32 SMBIOS_TABLE_TYPE13 *SmbiosRecord;\r
33 UINTN StrLeng;\r
34 CHAR8 *OptionalStrStart;\r
35 EFI_STRING Str;\r
36 STRING_REF TokenToGet;\r
d18d8a1d 37\r
949f388f 38\r
39 //\r
40 // First check for invalid parameters.\r
41 //\r
42 if (RecordData == NULL) {\r
43 return EFI_INVALID_PARAMETER;\r
44 }\r
45\r
46 TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_STRING);\r
47 Str = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);\r
48 StrLeng = StrLen(Str);\r
49 if (StrLeng > SMBIOS_STRING_MAX_LENGTH) {\r
50 return EFI_UNSUPPORTED;\r
51 }\r
52\r
53 //\r
54 // Two zeros following the last string.\r
55 //\r
56 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);\r
57 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);\r
58\r
59 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;\r
60 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);\r
61 //\r
62 // Make handle chosen by smbios protocol.add automatically.\r
d18d8a1d 63 //\r
949f388f 64 SmbiosRecord->Hdr.Handle = 0;\r
65 SmbiosRecord->InstallableLanguages = 1;\r
66 SmbiosRecord->Flags = 1;\r
67 SmbiosRecord->CurrentLanguages = 1;\r
68 OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);\r
69 UnicodeStrToAsciiStr(Str, OptionalStrStart);\r
d18d8a1d 70\r
949f388f 71\r
72 //\r
73 // Now we have got the full smbios record, call smbios protocol to add this record.\r
74 //\r
2bfd90f9
SZ
75 Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);\r
76\r
949f388f 77 FreePool(SmbiosRecord);\r
78 return Status;\r
79}\r
80\r