2 Provides platform policy services used during a capsule update that uses the
3 services of the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL.
5 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include "CapsuleUpdatePolicyDxe.h"
14 /// Handle for the Capsule Update Policy Protocol
16 EFI_HANDLE mHandle
= NULL
;
19 /// Capsule Update Policy Protocol instance
21 EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL mCapsuleUpdatePolicy
= {
22 CapsuleUpdatePolicyCheckSystemPower
,
23 CapsuleUpdatePolicyCheckSystemThermal
,
24 CapsuleUpdatePolicyCheckSystemEnvironment
,
25 CapsuleUpdatePolicyIsLowestSupportedVersionCheckRequired
,
26 CapsuleUpdatePolicyIsLockFmpDeviceAtLockEventGuidRequired
30 Determine if the system power state supports a capsule update.
32 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
33 @param[out] Good Returns TRUE if system power state supports a capsule
34 update. Returns FALSE if system power state does not
35 support a capsule update. Return value is only valid if
36 return status is EFI_SUCCESS.
38 @retval EFI_SUCCESS Good parameter has been updated with result.
39 @retval EFI_INVALID_PARAMETER Good is NULL.
40 @retval EFI_DEVICE_ERROR System power state can not be determined.
45 CapsuleUpdatePolicyCheckSystemPower (
46 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
,
50 return CheckSystemPower (Good
);
54 Determines if the system thermal state supports a capsule update.
56 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
57 @param[out] Good Returns TRUE if system thermal state supports a capsule
58 update. Returns FALSE if system thermal state does not
59 support a capsule update. Return value is only valid if
60 return status is EFI_SUCCESS.
62 @retval EFI_SUCCESS Good parameter has been updated with result.
63 @retval EFI_INVALID_PARAMETER Good is NULL.
64 @retval EFI_DEVICE_ERROR System thermal state can not be determined.
69 CapsuleUpdatePolicyCheckSystemThermal (
70 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
,
74 return CheckSystemThermal (Good
);
78 Determines if the system environment state supports a capsule update.
80 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
81 @param[out] Good Returns TRUE if system environment state supports a capsule
82 update. Returns FALSE if system environment state does not
83 support a capsule update. Return value is only valid if
84 return status is EFI_SUCCESS.
86 @retval EFI_SUCCESS Good parameter has been updated with result.
87 @retval EFI_INVALID_PARAMETER Good is NULL.
88 @retval EFI_DEVICE_ERROR System environment state can not be determined.
93 CapsuleUpdatePolicyCheckSystemEnvironment (
94 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
,
98 return CheckSystemEnvironment (Good
);
102 Determines if the Lowest Supported Version checks should be performed. The
103 expected result from this function is TRUE. A platform can choose to return
104 FALSE (e.g. during manufacturing or servicing) to allow a capsule update to a
105 version below the current Lowest Supported Version.
107 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
109 @retval TRUE The lowest supported version check is required.
110 @retval FALSE Do not perform lowest support version check.
115 CapsuleUpdatePolicyIsLowestSupportedVersionCheckRequired (
116 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
119 return IsLowestSupportedVersionCheckRequired ();
123 Determines if the FMP device should be locked when the event specified by
124 PcdFmpDeviceLockEventGuid is signaled. The expected result from this function
125 is TRUE so the FMP device is always locked. A platform can choose to return
126 FALSE (e.g. during manufacturing) to allow FMP devices to remain unlocked.
128 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
130 @retval TRUE The FMP device lock action is required at lock event guid.
131 @retval FALSE Do not perform FMP device lock at lock event guid.
136 CapsuleUpdatePolicyIsLockFmpDeviceAtLockEventGuidRequired (
137 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
140 return IsLockFmpDeviceAtLockEventGuidRequired ();
144 The user Entry Point for module CapsuleUpdatePolicyDxe. The user code starts
147 @param[in] ImageHandle The firmware allocated handle for the EFI image.
148 @param[in] SystemTable A pointer to the EFI System Table.
150 @retval EFI_SUCCESS The entry point is executed successfully.
151 @retval other Some error occurs when executing this entry point.
156 CapsuleUpdatePolicyInitialize (
157 IN EFI_HANDLE ImageHandle
,
158 IN EFI_SYSTEM_TABLE
*SystemTable
163 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEdkiiCapsuleUpdatePolicyProtocolGuid
);
164 Status
= gBS
->InstallMultipleProtocolInterfaces (
166 &gEdkiiCapsuleUpdatePolicyProtocolGuid
,
167 &mCapsuleUpdatePolicy
,
170 ASSERT_EFI_ERROR (Status
);