]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesFunction.c
Vlv2TbltDevicePkg: Remove directory assumptions from build scripts
[mirror_edk2.git] / Vlv2TbltDevicePkg / SmBiosMiscDxe / MiscResetCapabilitiesFunction.c
1 /*++
2
3 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7
8
9 Module Name:
10
11 MiscResetCapabilitiesFunction.c
12
13 Abstract:
14
15 ResetCapabilities.
16 SMBIOS type 23.
17
18 --*/
19
20
21 #include "CommonHeader.h"
22
23 #include "MiscSubclassDriver.h"
24
25 /**
26 This function makes boot time changes to the contents of the
27 MiscOemString (Type 11).
28
29 @param RecordData Pointer to copy of RecordData from the Data Table.
30
31 @retval EFI_SUCCESS All parameters were valid.
32 @retval EFI_UNSUPPORTED Unexpected RecordType value.
33 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
34
35 **/
36 MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
37 {
38 EFI_STATUS Status;
39 EFI_SMBIOS_HANDLE SmbiosHandle;
40 SMBIOS_TABLE_TYPE23 *SmbiosRecord;
41 EFI_MISC_RESET_CAPABILITIES *ForType23InputData;
42
43 ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
44
45 //
46 // First check for invalid parameters.
47 //
48 if (RecordData == NULL) {
49 return EFI_INVALID_PARAMETER;
50 }
51
52
53 //
54 // Two zeros following the last string.
55 //
56 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
57 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
58
59 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
60 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
61
62 //
63 // Make handle chosen by smbios protocol.add automatically.
64 //
65 SmbiosRecord->Hdr.Handle = 0;
66 SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities);
67 SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount;
68 SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit;
69 SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
70 SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout;
71
72 //
73 // Now we have got the full smbios record, call smbios protocol to add this record.
74 //
75 SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
76 Status = Smbios-> Add(
77 Smbios,
78 NULL,
79 &SmbiosHandle,
80 (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
81 );
82 FreePool(SmbiosRecord);
83 return Status;
84 }
85