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/**
403cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  This function makes boot time changes to the contents of the
413cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  MiscOemString (Type 11).
423cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
433cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  @param  RecordData                 Pointer to copy of RecordData from the Data Table.
443cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
453cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  @retval EFI_SUCCESS                All parameters were valid.
463cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  @retval EFI_UNSUPPORTED            Unexpected RecordType value.
473cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  @retval EFI_INVALID_PARAMETER      Invalid parameter was found.
483cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
493cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei**/
503cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiMISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
513cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei{
523cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_STATUS               Status;
533cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_SMBIOS_HANDLE        SmbiosHandle;
543cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SMBIOS_TABLE_TYPE23      *SmbiosRecord;
553cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_MISC_RESET_CAPABILITIES   *ForType23InputData;
563cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
573cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
583cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
593cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
603cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  // First check for invalid parameters.
613cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
623cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  if (RecordData == NULL) {
633cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    return EFI_INVALID_PARAMETER;
643cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  }
653cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
663cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
673cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
683cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  // Two zeros following the last string.
693cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
703cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
713cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
723cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
733cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
743cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
753cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
763cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
773cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  // Make handle chosen by smbios protocol.add automatically.
783cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
793cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Hdr.Handle    = 0;
803cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Capabilities  = *(UINT8*)&(ForType23InputData->ResetCapabilities);
813cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->ResetCount    = (UINT16)ForType23InputData->ResetCount;
823cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->ResetLimit    = (UINT16)ForType23InputData->ResetLimit;
833cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
843cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosRecord->Timeout       = (UINT16)ForType23InputData->ResetTimeout;
853cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
863cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
873cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  // Now we have got the full smbios record, call smbios protocol to add this record.
883cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  //
893cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
903cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  Status = Smbios-> Add(
91                      Smbios,
92                      NULL,
93                      &SmbiosHandle,
94                      (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
95                      );
96  FreePool(SmbiosRecord);
97  return Status;
98}
99
100