From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.groups.io with SMTP id smtpd.web12.6396.1585057664347268796 for ; Tue, 24 Mar 2020 06:47:44 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LBGksJeP; spf=pass (domain: redhat.com, ip: 63.128.21.74, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585057663; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Q+5LXcj3rgng38+2rzPgQxYqhpgmNUwZfUuGiIJLVI=; b=LBGksJePQvg+/GAtDszblpO4Vx/Y/OFWDozncr6kLCzbC0v9Er1kWBYh15ypa+uFe6UwPc z2YNCtqXcMVsoW+H/cghVrhr/5VbY2Eg+s4w8n58sAV85mu8m57X3cpFuSxhVdQTtfw9s4 6m62QrUMvVcrmzNKbSTrcLU/2sYr4VA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-3Vt_zUgRPzuMbSjx53SEgQ-1; Tue, 24 Mar 2020 09:47:36 -0400 X-MC-Unique: 3Vt_zUgRPzuMbSjx53SEgQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12E35800D53; Tue, 24 Mar 2020 13:47:35 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-115-139.ams2.redhat.com [10.36.115.139]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BF855C21B; Tue, 24 Mar 2020 13:47:33 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 08/17] OvmfPkg/PvScsiDxe: Open PciIo protocol for later use To: devel@edk2.groups.io, liran.alon@oracle.com Cc: nikita.leshchenko@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, ard.biesheuvel@linaro.org References: <20200316150113.104630-1-liran.alon@oracle.com> <20200316150113.104630-9-liran.alon@oracle.com> From: "Laszlo Ersek" Message-ID: <8a265373-e1c5-20f2-1981-d16bab5d8a83@redhat.com> Date: Tue, 24 Mar 2020 14:47:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200316150113.104630-9-liran.alon@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 > Signed-off-by: Liran Alon > --- > 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 Thanks, Laszlo