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
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
\r
FvbDevice = FVB_DEVICE_FROM_THIS (This);\r
\r
- return FvbWriteBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());\r
+ return FvbWriteBlock (FvbDevice->Instance, (EFI_LBA)Lba, (UINTN)Offset, NumBytes, (UINT8 *)Buffer, mFvbModuleGlobal, EfiGoneVirtual ());\r
}\r
\r
EFI_STATUS\r