Home | History | Annotate | Download | only in SmBiosMiscDxe
      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 /**
     40   This function makes boot time changes to the contents of the
     41   MiscOemString (Type 11).
     42 
     43   @param  RecordData                 Pointer to copy of RecordData from the Data Table.
     44 
     45   @retval EFI_SUCCESS                All parameters were valid.
     46   @retval EFI_UNSUPPORTED            Unexpected RecordType value.
     47   @retval EFI_INVALID_PARAMETER      Invalid parameter was found.
     48 
     49 **/
     50 MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
     51 {
     52   EFI_STATUS               Status;
     53   EFI_SMBIOS_HANDLE        SmbiosHandle;
     54   SMBIOS_TABLE_TYPE23      *SmbiosRecord;
     55   EFI_MISC_RESET_CAPABILITIES   *ForType23InputData;
     56 
     57   ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
     58 
     59   //
     60   // First check for invalid parameters.
     61   //
     62   if (RecordData == NULL) {
     63     return EFI_INVALID_PARAMETER;
     64   }
     65 
     66 
     67   //
     68   // Two zeros following the last string.
     69   //
     70   SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
     71   ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
     72 
     73   SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
     74   SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
     75 
     76   //
     77   // Make handle chosen by smbios protocol.add automatically.
     78   //
     79   SmbiosRecord->Hdr.Handle    = 0;
     80   SmbiosRecord->Capabilities  = *(UINT8*)&(ForType23InputData->ResetCapabilities);
     81   SmbiosRecord->ResetCount    = (UINT16)ForType23InputData->ResetCount;
     82   SmbiosRecord->ResetLimit    = (UINT16)ForType23InputData->ResetLimit;
     83   SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
     84   SmbiosRecord->Timeout       = (UINT16)ForType23InputData->ResetTimeout;
     85 
     86   //
     87   // Now we have got the full smbios record, call smbios protocol to add this record.
     88   //
     89   SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
     90   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