]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c
the implementation of FVB->SetAttribute() interface should check the unchanged bit...
[mirror_edk2.git] / Nt32Pkg / FvbServicesRuntimeDxe / FWBlockService.c
index 7b00fd9b3a80a5f35ac58127f59381309559282b..a95d3b400d519c1354a5bad322a648f11b0d33fb 100644 (file)
@@ -740,6 +740,7 @@ Returns:
   UINT32              OldStatus;\r
   UINT32              NewStatus;\r
   EFI_STATUS          Status;\r
+  EFI_FVB_ATTRIBUTES  UnchangedAttributes;\r
 \r
   //\r
   // Find the right instance of the FVB private data\r
@@ -758,6 +759,24 @@ Returns:
   OldStatus     = OldAttributes & EFI_FVB2_STATUS;\r
   NewStatus     = *Attributes & EFI_FVB2_STATUS;\r
 \r
+  UnchangedAttributes = EFI_FVB2_READ_DISABLED_CAP  | \\r
+                        EFI_FVB2_READ_ENABLED_CAP   | \\r
+                        EFI_FVB2_WRITE_DISABLED_CAP | \\r
+                        EFI_FVB2_WRITE_ENABLED_CAP  | \\r
+                        EFI_FVB2_LOCK_CAP           | \\r
+                        EFI_FVB2_STICKY_WRITE       | \\r
+                        EFI_FVB2_MEMORY_MAPPED      | \\r
+                        EFI_FVB2_ERASE_POLARITY     | \\r
+                        EFI_FVB2_READ_LOCK_CAP      | \\r
+                        EFI_FVB2_WRITE_LOCK_CAP     | \\r
+                        EFI_FVB2_ALIGNMENT;\r
+\r
+  //\r
+  // Some attributes of FV is read only can *not* be set\r
+  //\r
+  if ((OldAttributes & UnchangedAttributes) ^ (*Attributes & UnchangedAttributes)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
   //\r
   // If firmware volume is locked, no status bit can be updated\r
   //\r