1 /** @file 2 ResetCapabilities. 3 SMBIOS type 23. 4 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 6 SPDX-License-Identifier: BSD-2-Clause-Patent 7 8 **/ 9 10 #include "MiscSubClassDriver.h" 11 /** 12 This function makes boot time changes to the contents of the 13 MiscOemString (Type 11). 14 15 @param RecordData Pointer to copy of RecordData from the Data Table. 16 17 @retval EFI_SUCCESS All parameters were valid. 18 @retval EFI_UNSUPPORTED Unexpected RecordType value. 19 @retval EFI_INVALID_PARAMETER Invalid parameter was found. 20 21 **/ MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString)22MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString) 23 { 24 EFI_STATUS Status; 25 EFI_SMBIOS_HANDLE SmbiosHandle; 26 SMBIOS_TABLE_TYPE13 *SmbiosRecord; 27 UINTN StrLeng; 28 CHAR8 *OptionalStrStart; 29 EFI_STRING Str; 30 STRING_REF TokenToGet; 31 32 33 // 34 // First check for invalid parameters. 35 // 36 if (RecordData == NULL) { 37 return EFI_INVALID_PARAMETER; 38 } 39 40 TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_STRING); 41 Str = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL); 42 StrLeng = StrLen(Str); 43 if (StrLeng > SMBIOS_STRING_MAX_LENGTH) { 44 return EFI_UNSUPPORTED; 45 } 46 47 // 48 // Two zeros following the last string. 49 // 50 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1); 51 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1); 52 53 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION; 54 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13); 55 // 56 // Make handle chosen by smbios protocol.add automatically. 57 // 58 SmbiosRecord->Hdr.Handle = 0; 59 SmbiosRecord->InstallableLanguages = 1; 60 SmbiosRecord->Flags = 1; 61 SmbiosRecord->CurrentLanguages = 1; 62 OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); 63 UnicodeStrToAsciiStr(Str, OptionalStrStart); 64 65 66 // 67 // Now we have got the full smbios record, call smbios protocol to add this record. 68 // 69 Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); 70 71 FreePool(SmbiosRecord); 72 return Status; 73 } 74 75