[edk2-devel] [PATCH 08/17] OvmfPkg/PvScsiDxe: Open PciIo protocol for later use

Laszlo Ersek lersek at redhat.com
Tue Mar 24 13:47:32 UTC 2020


On 03/16/20 16:01, Liran Alon wrote:
> This will give us an exclusive access to the PciIo of this device
> after it was started and until is will be stopped.

(1) typo: s/is will be/it will be/

> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
> Reviewed-by: Nikita Leshenko <nikita.leshchenko at oracle.com>
> Signed-off-by: Liran Alon <liran.alon at oracle.com>
> ---
>  OvmfPkg/PvScsiDxe/PvScsi.c | 29 ++++++++++++++++++++++++++++-
>  OvmfPkg/PvScsiDxe/PvScsi.h |  1 +
>  2 files changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c
> index f613870e80f2..b6a83d73cead 100644
> --- a/OvmfPkg/PvScsiDxe/PvScsi.c
> +++ b/OvmfPkg/PvScsiDxe/PvScsi.c
> @@ -410,11 +410,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
>    //
> @@ -434,6 +446,14 @@ PvScsiDriverBindingStart (
>  UninitDev:
>    PvScsiUninit (Dev);
>  
> +ClosePciIo:
> +  gBS->CloseProtocol (
> +         ControllerHandle,
> +         &gEfiPciIoProtocolGuid,
> +         This->DriverBindingHandle,
> +         ControllerHandle
> +         );
> +
>  FreePvScsi:
>    FreePool (Dev);
>  
> @@ -479,6 +499,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 dd3e0c68e6da..e1e5ae18ebf2 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;
> 

With (1) fixed up:

Reviewed-by: Laszlo Ersek <lersek at redhat.com>

Thanks,
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56152): https://edk2.groups.io/g/devel/message/56152
Mute This Topic: https://groups.io/mt/72001289/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list