mirror of https://github.com/acidanthera/audk.git
OvmfPkg/PvScsiDxe: Backup/Restore PCI attributes on Init/UnInit
This commit doesn't change semantics. It is done as a preparation for future commits which will modify PCI attributes. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567 Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Liran Alon <liran.alon@oracle.com> Message-Id: <20200328200100.60786-10-liran.alon@oracle.com> Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
This commit is contained in:
parent
c08eaaaf37
commit
45098e8a9a
|
@ -283,18 +283,70 @@ PvScsiGetNextTarget (
|
|||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
PvScsiSetPciAttributes (
|
||||
IN OUT PVSCSI_DEV *Dev
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Backup original PCI Attributes
|
||||
//
|
||||
Status = Dev->PciIo->Attributes (
|
||||
Dev->PciIo,
|
||||
EfiPciIoAttributeOperationGet,
|
||||
0,
|
||||
&Dev->OriginalPciAttributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Change PCI Attributes
|
||||
//
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
PvScsiRestorePciAttributes (
|
||||
IN PVSCSI_DEV *Dev
|
||||
)
|
||||
{
|
||||
Dev->PciIo->Attributes (
|
||||
Dev->PciIo,
|
||||
EfiPciIoAttributeOperationSet,
|
||||
Dev->OriginalPciAttributes,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
PvScsiInit (
|
||||
IN OUT PVSCSI_DEV *Dev
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Init configuration
|
||||
//
|
||||
Dev->MaxTarget = PcdGet8 (PcdPvScsiMaxTargetLimit);
|
||||
Dev->MaxLun = PcdGet8 (PcdPvScsiMaxLunLimit);
|
||||
|
||||
//
|
||||
// Set PCI Attributes
|
||||
//
|
||||
Status = PvScsiSetPciAttributes (Dev);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Populate the exported interface's attributes
|
||||
//
|
||||
|
@ -333,7 +385,7 @@ PvScsiUninit (
|
|||
IN OUT PVSCSI_DEV *Dev
|
||||
)
|
||||
{
|
||||
// Currently nothing to do here
|
||||
PvScsiRestorePciAttributes (Dev);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
typedef struct {
|
||||
UINT32 Signature;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 OriginalPciAttributes;
|
||||
UINT8 MaxTarget;
|
||||
UINT8 MaxLun;
|
||||
EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;
|
||||
|
|
Loading…
Reference in New Issue