3 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
8 #include "MiscSubclassDriver.h"
10 This function makes boot time changes to the contents of the
11 MiscOemString (Type 11).
13 @param RecordData Pointer to copy of RecordData from the Data Table.
15 @retval EFI_SUCCESS All parameters were valid.
16 @retval EFI_UNSUPPORTED Unexpected RecordType value.
17 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
20 MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString
)
23 EFI_SMBIOS_HANDLE SmbiosHandle
;
24 SMBIOS_TABLE_TYPE13
*SmbiosRecord
;
26 CHAR8
*OptionalStrStart
;
28 STRING_REF TokenToGet
;
32 // First check for invalid parameters.
34 if (RecordData
== NULL
) {
35 return EFI_INVALID_PARAMETER
;
38 TokenToGet
= STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_STRING
);
39 Str
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
40 StrLeng
= StrLen(Str
);
41 if (StrLeng
> SMBIOS_STRING_MAX_LENGTH
) {
42 return EFI_UNSUPPORTED
;
46 // Two zeros following the last string.
48 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE13
) + StrLeng
+ 1 + 1);
49 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE13
) + StrLeng
+ 1 + 1);
51 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION
;
52 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE13
);
54 // Make handle chosen by smbios protocol.add automatically.
56 SmbiosRecord
->Hdr
.Handle
= 0;
57 SmbiosRecord
->InstallableLanguages
= 1;
58 SmbiosRecord
->Flags
= 1;
59 SmbiosRecord
->CurrentLanguages
= 1;
60 OptionalStrStart
= (CHAR8
*)(SmbiosRecord
+ 1);
61 UnicodeStrToAsciiStr(Str
, OptionalStrStart
);
65 // Now we have got the full smbios record, call smbios protocol to add this record.
67 Status
= AddSmbiosRecord (Smbios
, &SmbiosHandle
, (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
);
69 FreePool(SmbiosRecord
);