]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c
BaseTools: Library hashing fix and optimization for --hash feature
[mirror_edk2.git] / EmulatorPkg / MiscSubClassPlatformDxe / MiscResetCapabilitiesFunction.c
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 **/
22 MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
23 {
24 EFI_STATUS Status;
25 EFI_SMBIOS_HANDLE SmbiosHandle;
26 SMBIOS_TABLE_TYPE23 *SmbiosRecord;
27 EFI_MISC_RESET_CAPABILITIES *ForType23InputData;
28
29 ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
30
31 //
32 // First check for invalid parameters.
33 //
34 if (RecordData == NULL) {
35 return EFI_INVALID_PARAMETER;
36 }
37
38
39 //
40 // Two zeros following the last string.
41 //
42 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
43 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
44
45 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
46 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
47 //
48 // Make handle chosen by smbios protocol.add automatically.
49 //
50 SmbiosRecord->Hdr.Handle = 0;
51 SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities);
52 SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount;
53 SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit;
54 SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
55 SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout;
56
57 //
58 // Now we have got the full smbios record, call smbios protocol to add this record.
59 //
60 Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
61
62 FreePool(SmbiosRecord);
63 return Status;
64 }
65