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
This commit is contained in:
qwang12 2008-11-18 14:18:25 +00:00
parent 6d8f3e5d57
commit 9e99ce325a
1 changed files with 36 additions and 8 deletions

View File

@ -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;
}
/**