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