diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-18 14:18:25 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-18 14:18:25 +0000 |
commit | 9e99ce325a97c4b6d7f5aaaa48b7087b131c4272 (patch) | |
tree | 06405bf524339dd66da7747f5fc959be88e4e7b1 /EdkCompatibilityPkg/Compatibility | |
parent | 6d8f3e5d5741a55428dc328fa0f7e5905eee94cc (diff) | |
download | edk2-platforms-9e99ce325a97c4b6d7f5aaaa48b7087b131c4272.tar.xz |
Covert the FvAttributes back to format defined in PI spec after calling the Framework FV Protocol. This behavior is defined in PI spec.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6611 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility')
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c b/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c index 5a89866b0d..6a2b1f8643 100644 --- a/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c +++ b/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c @@ -783,6 +783,24 @@ InitializeFirmwareVolume ( return EFI_SUCCESS;
}
+EFI_FV_ATTRIBUTES
+FvAttributesToFv2Attributes (
+ EFI_FV_ATTRIBUTES FvAttributes
+ )
+{
+ INTN Alignment;
+
+ Alignment = LowBitSet64 (RShiftU64 (FvAttributes, 16) & 0xffff);
+ if (Alignment != -1) {
+ Alignment = Alignment << 16;
+ } else {
+ Alignment = 0;
+ }
+ FvAttributes = (FvAttributes & 0x1ff) | Alignment;
+
+ return FvAttributes;
+}
+
/**
Because of constraints imposed by the underlying firmware
@@ -827,13 +845,7 @@ Fv2GetVolumeAttributes ( (FRAMEWORK_EFI_FV_ATTRIBUTES *)FvAttributes
);
if (!EFI_ERROR (Status)) {
- Alignment = LowBitSet64 (RShiftU64 (*FvAttributes, 16) & 0xffff);
- if (Alignment != -1) {
- Alignment = Alignment << 16;
- } else {
- Alignment = 0;
- }
- *FvAttributes = (*FvAttributes & 0x1ff) | Alignment;
+ *FvAttributes = FvAttributeToFv2Attribute (*FvAttributes);
}
return Status;
}
@@ -936,8 +948,18 @@ Fv2SetVolumeAttributes ( FIRMWARE_VOLUME2_PRIVATE_DATA *Private;
EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
FRAMEWORK_EFI_FV_ATTRIBUTES FrameworkFvAttributes;
+ EFI_STATUS Status;
UINTN Shift;
+ if (*FvAttributes & (EFI_FV2_READ_LOCK_STATUS | EFI_FV2_WRITE_LOCK_STATUS)) {
+ //
+ // Framework FV protocol does not support EFI_FV2_READ_LOCK_* | EFI_FV2_WRITE_LOCK_*
+ //
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *FvAttributes = *FvAttributes & (EFI_FV2_READ_STATUS | EFI_FV2_WRITE_STATUS | EFI_FV2_LOCK_STATUS);
+
Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This);
FirmwareVolume = Private->FirmwareVolume;
@@ -945,10 +967,16 @@ Fv2SetVolumeAttributes ( Shift = (UINTN) RShiftU64(*FvAttributes & EFI_FV2_ALIGNMENT, 16);
FrameworkFvAttributes = FrameworkFvAttributes | LShiftU64 (EFI_FV_ALIGNMENT_2, Shift);
- return FirmwareVolume->SetVolumeAttributes (
+ Status = FirmwareVolume->SetVolumeAttributes (
FirmwareVolume,
&FrameworkFvAttributes
);
+
+ if (!EFI_ERROR (Status)) {
+ *FvAttributes = FvAttributesToFv2Attributes (FrameworkFvAttributes);
+ }
+
+ return Status;
}
/**
|