FmpDevicePkg FmpDxe: Use Attributes to know whether reset is required
authorStar Zeng <star.zeng@intel.com>
Wed, 18 Jul 2018 11:00:32 +0000 (19:00 +0800)
committerKinney, Michael D <michael.d.kinney@intel.com>
Thu, 2 Aug 2018 21:46:19 +0000 (14:46 -0700)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1040

Use Attributes to know whether reset is required and remove
PcdFmpDeviceSystemResetRequired.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
FmpDevicePkg/FmpDevicePkg.dec
FmpDevicePkg/FmpDevicePkg.uni
FmpDevicePkg/FmpDxe/FmpDxe.c
FmpDevicePkg/FmpDxe/FmpDxe.inf
FmpDevicePkg/FmpDxe/FmpDxeLib.inf

index 9ea0d73..ad0730a 100644 (file)
   gFmpDevicePkgTokenSpaceGuid = { 0x40b2d964, 0xfe11, 0x40dc, { 0x82, 0x83, 0x2e, 0xfb, 0xda, 0x29, 0x53, 0x56 } }\r
 \r
 [PcdsFixedAtBuild]\r
-  ## Indicates if a full system reset is required before a firmware update to a\r
-  #  firmware devices takes effect.<BR><BR>\r
-  #   TRUE  - System reset is required.<BR>\r
-  #   FALSE - System reset is not required.<BR>\r
-  # @Prompt FMP Device System Reset Required.\r
-  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceSystemResetRequired|TRUE|BOOLEAN|0x40000008\r
-\r
   ## The SHA-256 hash of a PKCS7 test key that is used to detect if a test key\r
   #  is being used to authenticate capsules.  Test key detection is disabled by\r
   #  setting the value to {0}.\r
index da31d0a..fed1da4 100644 (file)
 \r
 #string STR_PACKAGE_DESCRIPTION  #language en-US  "This package provides libraries that support the implementation of a module that produces the Firmware Management Protocol to support the update of a system firmware component."\r
 \r
-#string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceSystemResetRequired_PROMPT  #language en-US "FMP Device System Reset Required."\r
-#string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceSystemResetRequired_HELP    #language en-US "Indicates if a full system reset is required before a firmware update to a firmware device takes effect.<BR><BR>\n"\r
-                                                                                                "TRUE  - System reset is required.<BR>\n"\r
-                                                                                                "FALSE - System reset is not required.<BR>"\r
-\r
 #string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceTestKeySha256Digest_PROMPT  #language en-US "SHA-256 hash of PKCS7 test key."\r
 #string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceTestKeySha256Digest_HELP    #language en-US "The SHA-256 hash of a PKCS7 test key that is used to detect if a test key"\r
                                                                                                 "is being used to authenticate capsules.  Test key detection can be disabled"\r
index 94fdf56..3544afd 100644 (file)
@@ -898,6 +898,9 @@ SetTheImage (
   UINT32      AllHeaderSize;\r
   UINT32      IncommingFwVersion;\r
   UINT32      LastAttemptStatus;\r
+  EFI_STATUS  GetAttributesStatus;\r
+  UINT64      AttributesSupported;\r
+  UINT64      AttributesSetting;\r
 \r
   Status             = EFI_SUCCESS;\r
   Updateable         = 0;\r
@@ -1110,10 +1113,14 @@ SetTheImage (
 \r
   //\r
   // Set flag so the descriptor is repopulated\r
-  // This only applied to devices that do not require system reboot\r
+  // This is only applied to devices that do not require reset\r
   //\r
-  if (!PcdGetBool (PcdFmpDeviceSystemResetRequired)) {\r
-    mDescriptorPopulated = FALSE;\r
+  GetAttributesStatus = FmpDeviceGetAttributes (&AttributesSupported, &AttributesSetting);\r
+  if (!EFI_ERROR (GetAttributesStatus)) {\r
+    if (((AttributesSupported & IMAGE_ATTRIBUTE_RESET_REQUIRED) == 0) ||\r
+        ((AttributesSetting & IMAGE_ATTRIBUTE_RESET_REQUIRED) == 0)) {\r
+      mDescriptorPopulated = FALSE;\r
+    }\r
   }\r
 \r
 cleanup:\r
index ec2bb2d..228e536 100644 (file)
@@ -76,7 +76,6 @@
   gEdkiiFirmwareManagementProgressProtocolGuid  ## PRODUCES\r
 \r
 [Pcd]\r
-  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceSystemResetRequired              ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageIdName                      ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceBuildTimeLowestSupportedVersion  ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceLockEventGuid                    ## CONSUMES\r
index 41acf45..5484531 100644 (file)
@@ -76,7 +76,6 @@
   gEdkiiFirmwareManagementProgressProtocolGuid  ## PRODUCES\r
 \r
 [Pcd]\r
-  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceSystemResetRequired              ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageIdName                      ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceBuildTimeLowestSupportedVersion  ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceLockEventGuid                    ## CONSUMES\r