]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscResetCapabilitiesFunction.c
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[mirror_edk2.git] / Vlv2TbltDevicePkg / SmBiosMiscDxe / MiscResetCapabilitiesFunction.c
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
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13
14 Module Name:
15
16 MiscResetCapabilitiesFunction.c
17
18 Abstract:
19
20 ResetCapabilities.
21 SMBIOS type 23.
22
23 --*/
24
25
26 #include "CommonHeader.h"
27
28 #include "MiscSubclassDriver.h"
29
30 /**
31 This function makes boot time changes to the contents of the
32 MiscOemString (Type 11).
33
34 @param RecordData Pointer to copy of RecordData from the Data Table.
35
36 @retval EFI_SUCCESS All parameters were valid.
37 @retval EFI_UNSUPPORTED Unexpected RecordType value.
38 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
39
40 **/
41 MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
42 {
43 EFI_STATUS Status;
44 EFI_SMBIOS_HANDLE SmbiosHandle;
45 SMBIOS_TABLE_TYPE23 *SmbiosRecord;
46 EFI_MISC_RESET_CAPABILITIES *ForType23InputData;
47
48 ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
49
50 //
51 // First check for invalid parameters.
52 //
53 if (RecordData == NULL) {
54 return EFI_INVALID_PARAMETER;
55 }
56
57
58 //
59 // Two zeros following the last string.
60 //
61 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
62 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
63
64 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
65 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
66
67 //
68 // Make handle chosen by smbios protocol.add automatically.
69 //
70 SmbiosRecord->Hdr.Handle = 0;
71 SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities);
72 SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount;
73 SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit;
74 SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
75 SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout;
76
77 //
78 // Now we have got the full smbios record, call smbios protocol to add this record.
79 //
80 SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
81 Status = Smbios-> Add(
82 Smbios,
83 NULL,
84 &SmbiosHandle,
85 (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
86 );
87 FreePool(SmbiosRecord);
88 return Status;
89 }
90