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
);
55 Determines if the system thermal state supports a capsule update.
57 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
58 @param[out] Good Returns TRUE if system thermal state supports a capsule
59 update. Returns FALSE if system thermal state does not
60 support a capsule update. Return value is only valid if
61 return status is EFI_SUCCESS.
63 @retval EFI_SUCCESS Good parameter has been updated with result.
64 @retval EFI_INVALID_PARAMETER Good is NULL.
65 @retval EFI_DEVICE_ERROR System thermal state can not be determined.
70 CapsuleUpdatePolicyCheckSystemThermal (
71 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
,
75 return CheckSystemThermal (Good
);
79 Determines if the system environment state supports a capsule update.
81 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
82 @param[out] Good Returns TRUE if system environment state supports a capsule
83 update. Returns FALSE if system environment state does not
84 support a capsule update. Return value is only valid if
85 return status is EFI_SUCCESS.
87 @retval EFI_SUCCESS Good parameter has been updated with result.
88 @retval EFI_INVALID_PARAMETER Good is NULL.
89 @retval EFI_DEVICE_ERROR System environment state can not be determined.
94 CapsuleUpdatePolicyCheckSystemEnvironment (
95 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
,
99 return CheckSystemEnvironment (Good
);
103 Determines if the Lowest Supported Version checks should be performed. The
104 expected result from this function is TRUE. A platform can choose to return
105 FALSE (e.g. during manufacturing or servicing) to allow a capsule update to a
106 version below the current Lowest Supported Version.
108 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
110 @retval TRUE The lowest supported version check is required.
111 @retval FALSE Do not perform lowest support version check.
116 CapsuleUpdatePolicyIsLowestSupportedVersionCheckRequired (
117 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
120 return IsLowestSupportedVersionCheckRequired ();
124 Determines if the FMP device should be locked when the event specified by
125 PcdFmpDeviceLockEventGuid is signaled. The expected result from this function
126 is TRUE so the FMP device is always locked. A platform can choose to return
127 FALSE (e.g. during manufacturing) to allow FMP devices to remain unlocked.
129 @param[in] This A pointer to the EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL instance.
131 @retval TRUE The FMP device lock action is required at lock event guid.
132 @retval FALSE Do not perform FMP device lock at lock event guid.
137 CapsuleUpdatePolicyIsLockFmpDeviceAtLockEventGuidRequired (
138 IN EDKII_CAPSULE_UPDATE_POLICY_PROTOCOL
*This
141 return IsLockFmpDeviceAtLockEventGuidRequired ();
145 The user Entry Point for module CapsuleUpdatePolicyDxe. The user code starts
148 @param[in] ImageHandle The firmware allocated handle for the EFI image.
149 @param[in] SystemTable A pointer to the EFI System Table.
151 @retval EFI_SUCCESS The entry point is executed successfully.
152 @retval other Some error occurs when executing this entry point.
157 CapsuleUpdatePolicyInitialize (
158 IN EFI_HANDLE ImageHandle
,
159 IN EFI_SYSTEM_TABLE
*SystemTable
164 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEdkiiCapsuleUpdatePolicyProtocolGuid
);
165 Status
= gBS
->InstallMultipleProtocolInterfaces (
167 &gEdkiiCapsuleUpdatePolicyProtocolGuid
, &mCapsuleUpdatePolicy
,
170 ASSERT_EFI_ERROR (Status
);