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