diff options
author | Liran Alon <liran.alon@oracle.com> | 2020-03-28 23:00:52 +0300 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-03-30 16:45:07 +0000 |
commit | 45098e8a9aeefaf8405e4b772ffa2694efe507a0 (patch) | |
tree | f0ab2591d152471bf0f4c15e05b6c74dbc9b30fc /OvmfPkg/PvScsiDxe | |
parent | c08eaaaf373bafe71f8a506d55230f1a4874e9e2 (diff) | |
download | edk2-45098e8a9aeefaf8405e4b772ffa2694efe507a0.tar.gz edk2-45098e8a9aeefaf8405e4b772ffa2694efe507a0.tar.bz2 edk2-45098e8a9aeefaf8405e4b772ffa2694efe507a0.zip |
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>
Diffstat (limited to 'OvmfPkg/PvScsiDxe')
-rw-r--r-- | OvmfPkg/PvScsiDxe/PvScsi.c | 54 | ||||
-rw-r--r-- | OvmfPkg/PvScsiDxe/PvScsi.h | 1 |
2 files changed, 54 insertions, 1 deletions
diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c index e0380d729b..5566b4cce4 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.c +++ b/OvmfPkg/PvScsiDxe/PvScsi.c @@ -285,10 +285,54 @@ PvScsiGetNextTarget ( 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
//
@@ -296,6 +340,14 @@ PvScsiInit ( Dev->MaxLun = PcdGet8 (PcdPvScsiMaxLunLimit);
//
+ // Set PCI Attributes
+ //
+ Status = PvScsiSetPciAttributes (Dev);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
// Populate the exported interface's attributes
//
Dev->PassThru.Mode = &Dev->PassThruMode;
@@ -333,7 +385,7 @@ PvScsiUninit ( IN OUT PVSCSI_DEV *Dev
)
{
- // Currently nothing to do here
+ PvScsiRestorePciAttributes (Dev);
}
//
diff --git a/OvmfPkg/PvScsiDxe/PvScsi.h b/OvmfPkg/PvScsiDxe/PvScsi.h index e1e5ae18eb..5f611dbbc9 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.h +++ b/OvmfPkg/PvScsiDxe/PvScsi.h @@ -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;
|