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