]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c
56423e5ad48587c421dd26ee092c1cde4e299351
[mirror_edk2.git] / Nt32Pkg / MiscSubClassPlatformDxe / MiscResetCapabilitiesFunction.c
1 /*++
2
3 Copyright (c) 2009, Intel Corporation. All rights reserved. <BR>
4 This software and associated documentation (if any) is furnished
5 under a license and may only be used or copied in accordance
6 with the terms of the license. Except as permitted by such
7 license, no part of this software or documentation may be
8 reproduced, stored in a retrieval system, or transmitted in any
9 form or by any means without the express written consent of
10 Intel Corporation.
11
12 Module Name:
13
14 MiscResetCapabilitiesFunction.c
15
16 Abstract:
17
18 ResetCapabilities.
19 SMBIOS type 23.
20
21 --*/
22
23
24 #include "MiscSubclassDriver.h"
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 // Make handle chosen by smbios protocol.add automatically.
63 //
64 SmbiosRecord->Hdr.Handle = 0;
65 SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities);
66 SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount;
67 SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit;
68 SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
69 SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout;
70
71 //
72 // Now we have got the full smbios record, call smbios protocol to add this record.
73 //
74 SmbiosHandle = 0;
75 Status = Smbios-> Add(
76 Smbios,
77 NULL,
78 &SmbiosHandle,
79 (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
80 );
81 FreePool(SmbiosRecord);
82 return Status;
83 }
84