]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FmpDevicePkg/FmpDxe/FmpDxe.c
FmpDevicePkg FmpDxe: Add comment in mFmpDeviceLocked's declaration
[mirror_edk2.git] / FmpDevicePkg / FmpDxe / FmpDxe.c
index eb452737543ec1585f985b976700e72e3cd41f87..fb02e34f708f68092bdc13feab4fe2793081ef1d 100644 (file)
@@ -89,6 +89,13 @@ UINT64  mImageId      = 0x1;
 CHAR16  *mVersionName = NULL;\r
 \r
 EFI_EVENT  mFmpDeviceLockEvent;\r
+//\r
+// Indicates if an attempt has been made to lock a \r
+// FLASH storage device by calling FmpDeviceLock().\r
+// A FLASH storage device may not support being locked,\r
+// so this variable is set to TRUE even if FmpDeviceLock()\r
+// returns an error.\r
+//\r
 BOOLEAN    mFmpDeviceLocked = FALSE;\r
 \r
 /**\r
@@ -497,6 +504,15 @@ GetTheImage (
 \r
   Status = EFI_SUCCESS;\r
 \r
+  //\r
+  // Check to make sure index is 1 (only 1 image for this device)\r
+  //\r
+  if (ImageIndex != 1) {\r
+    DEBUG ((DEBUG_ERROR, "FmpDxe: GetImage() - Image Index Invalid.\n"));\r
+    Status = EFI_INVALID_PARAMETER;\r
+    goto cleanup;\r
+  }\r
+\r
   if ((ImageSize == NULL)) {\r
     DEBUG ((DEBUG_ERROR, "FmpDxe: GetImage() - ImageSize Pointer Parameter is NULL.\n"));\r
     Status = EFI_INVALID_PARAMETER;\r
@@ -523,16 +539,6 @@ GetTheImage (
     goto cleanup;\r
   }\r
 \r
-  //\r
-  // Check to make sure index is 1 (only 1 image for this device)\r
-  //\r
-  if (ImageIndex != 1) {\r
-    DEBUG ((DEBUG_ERROR, "FmpDxe: GetImage() - Image Index Invalid.\n"));\r
-    Status = EFI_INVALID_PARAMETER;\r
-    goto cleanup;\r
-  }\r
-\r
-\r
   Status = FmpDeviceGetImage (Image, ImageSize);\r
 cleanup:\r
 \r
@@ -899,6 +905,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
@@ -1111,10 +1120,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