13cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei/*++
23cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
33cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiCopyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
43cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
53cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
63cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  This program and the accompanying materials are licensed and made available under
73cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
83cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  the terms and conditions of the BSD License that accompanies this distribution.
93cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
103cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  The full text of the license may be found at
113cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
123cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  http://opensource.org/licenses/bsd-license.php.
133cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
143cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
153cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
163cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
173cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
183cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
193cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
203cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
213cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
223cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
233cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiModule Name:
243cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
253cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  MiscResetCapabilitiesFunction.c
263cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
273cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiAbstract:
283cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
293cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  ResetCapabilities.
303cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SMBIOS type 23.
313cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
323cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei--*/
333cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
343cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
353cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#include "CommonHeader.h"
363cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
373cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#include "MiscSubclassDriver.h"
383cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei/**
393cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  This function makes boot time changes to the contents of the
403cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  MiscOemString (Type 11).
413cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
423cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  @param  RecordData                 Pointer to copy of RecordData from the Data Table.
433cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
443cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  @retval EFI_SUCCESS                All parameters were valid.
453cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  @retval EFI_UNSUPPORTED            Unexpected RecordType value.
463cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  @retval EFI_INVALID_PARAMETER      Invalid parameter was found.
473cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
483cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei**/
493cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
503cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiMISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString)
513cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei{
523cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_STATUS               Status;
533cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_SMBIOS_HANDLE        SmbiosHandle;
543cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SMBIOS_TABLE_TYPE13      *SmbiosRecord;
553cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINTN                    StrLeng;
563cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  CHAR8                    *OptionalStrStart;
573cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_STRING               Str;
583cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  STRING_REF               TokenToGet;
593cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
603cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
613cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
623cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  // First check for invalid parameters.
633cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
643cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  if (RecordData == NULL) {
653cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    return EFI_INVALID_PARAMETER;
663cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  }
673cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
683cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_EN_US);
693cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  Str = SmbiosMiscGetString (TokenToGet);
703cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  StrLeng = StrLen(Str);
713cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  if (StrLeng > SMBIOS_STRING_MAX_LENGTH) {
723cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    return EFI_UNSUPPORTED;
733cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  }
743cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
753cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
763cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  // Two zeros following the last string.
773cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
783cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
793cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
803cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
813cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;
823cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);
833cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
843cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
853cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  // Make handle chosen by smbios protocol.add automatically.
863cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
873cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Hdr.Handle    = 0;
883cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->InstallableLanguages = 1;
893cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Flags   = 1;
903cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->CurrentLanguages = 1;
913cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
923cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UnicodeStrToAsciiStr(Str, OptionalStrStart);
933cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
943cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
953cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  // Now we have got the full smbios record, call smbios protocol to add this record.
963cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
973cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
983cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  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