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