diff options
author | Liran Alon <liran.alon@oracle.com> | 2020-03-28 23:00:51 +0300 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-03-30 16:45:07 +0000 |
commit | c08eaaaf373bafe71f8a506d55230f1a4874e9e2 (patch) | |
tree | ad26e2d95166f4895eb916daf20b7cb16577d95d | |
parent | 9c2d8281af9bc4a3c598994ba1fee96f49dfc8e9 (diff) | |
download | edk2-c08eaaaf373bafe71f8a506d55230f1a4874e9e2.tar.gz edk2-c08eaaaf373bafe71f8a506d55230f1a4874e9e2.tar.bz2 edk2-c08eaaaf373bafe71f8a506d55230f1a4874e9e2.zip |
OvmfPkg/PvScsiDxe: Open PciIo protocol for later use
This will give us an exclusive access to the PciIo of this device
after it was started and until it will be stopped.
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-9-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
-rw-r--r-- | OvmfPkg/PvScsiDxe/PvScsi.c | 29 | ||||
-rw-r--r-- | OvmfPkg/PvScsiDxe/PvScsi.h | 1 |
2 files changed, 29 insertions, 1 deletions
diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c index 76fc1eb910..e0380d729b 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.c +++ b/OvmfPkg/PvScsiDxe/PvScsi.c @@ -412,11 +412,23 @@ PvScsiDriverBindingStart ( return EFI_OUT_OF_RESOURCES;
}
- Status = PvScsiInit (Dev);
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiPciIoProtocolGuid,
+ (VOID **)&Dev->PciIo,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
if (EFI_ERROR (Status)) {
goto FreePvScsi;
}
+ Status = PvScsiInit (Dev);
+ if (EFI_ERROR (Status)) {
+ goto ClosePciIo;
+ }
+
//
// Setup complete, attempt to export the driver instance's PassThru interface
//
@@ -436,6 +448,14 @@ PvScsiDriverBindingStart ( UninitDev:
PvScsiUninit (Dev);
+ClosePciIo:
+ gBS->CloseProtocol (
+ ControllerHandle,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+
FreePvScsi:
FreePool (Dev);
@@ -481,6 +501,13 @@ PvScsiDriverBindingStop ( PvScsiUninit (Dev);
+ gBS->CloseProtocol (
+ ControllerHandle,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+
FreePool (Dev);
return EFI_SUCCESS;
diff --git a/OvmfPkg/PvScsiDxe/PvScsi.h b/OvmfPkg/PvScsiDxe/PvScsi.h index dd3e0c68e6..e1e5ae18eb 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.h +++ b/OvmfPkg/PvScsiDxe/PvScsi.h @@ -19,6 +19,7 @@ typedef struct {
UINT32 Signature;
+ EFI_PCI_IO_PROTOCOL *PciIo;
UINT8 MaxTarget;
UINT8 MaxLun;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;
|