From nobody Tue Feb 10 10:03:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+54913+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54913+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1582739411; cv=none; d=zohomail.com; s=zohoarc; b=iV++pzwqURD75oh493JmDwQ6AMAl62XSYgeqHkGCqz9pCNxH2nHdQBPEuciKKCQtS0kJYmcZE4vWAL8puB9E4yjhp8id9jQAVAd/Kyq+DBnXOmfWT46n7C2dPwzn4iRSls6JEbObZ74JUldCNPDSwATYm51VWSY+AfU8lrqxjTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582739411; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ZFHvZX1efC25tH8y1MB9g7Y+tDhbkLGzXz64nBxmgP0=; b=gpD2Y/4G5fq2cVWWIcxPvaVGwgy1hNJ42L2cM+lw1vqWBoXoDbCNd9KaTcyXMOOnS361odipLsAqttAq05hLPsAjbbFdylTJpG5TIoZ+mL7AliAzYquYlS7Qv++x7fHFhOEKOwSSwyH+7I3btKPx91K/e7YyfhRHYg+KA9uP30w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54913+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1582739411169389.8710403800188; Wed, 26 Feb 2020 09:50:11 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id MjEOYY1788612xkj1zFWkMjJ; Wed, 26 Feb 2020 09:50:10 -0800 X-Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by mx.groups.io with SMTP id smtpd.web09.11140.1582735241154175379 for ; Wed, 26 Feb 2020 08:40:41 -0800 X-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01QGNUOC078055; Wed, 26 Feb 2020 16:40:40 GMT X-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2ydcsncvvk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Feb 2020 16:40:40 +0000 X-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01QGMFpE165673; Wed, 26 Feb 2020 16:40:40 GMT X-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2ydcs2hn9h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Feb 2020 16:40:40 +0000 X-Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01QGedkW013178; Wed, 26 Feb 2020 16:40:39 GMT X-Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Feb 2020 08:40:39 -0800 From: "Nikita Leshenko" To: devel@edk2.groups.io Cc: liran.alon@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, lersek@redhat.com, ard.biesheuvel@linaro.org, Nikita Leshenko Subject: [edk2-devel] [PATCH v2 09/13] OvmfPkg/MptScsiDxe: Open PciIo protocol for later use Date: Wed, 26 Feb 2020 18:41:47 +0200 Message-Id: <20200226164151.125182-10-nikita.leshchenko@oracle.com> In-Reply-To: <20200226164151.125182-1-nikita.leshchenko@oracle.com> References: <20200226164151.125182-1-nikita.leshchenko@oracle.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nikita.leshchenko@oracle.com X-Gm-Message-State: DdXUEmoyuv7Q59bkgujE8WZOx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1582739410; bh=cjhjD4X71zMFC4gx0Lwve4IXcAVP7IaL7ouAz3pNPf8=; h=Cc:Date:From:Reply-To:Subject:To; b=XmPsx+0jAhj07O3D2cRu2S9L97tPpG3RWZ6FKdTfxnKN8ZuxGaocL4M1QGRXvnFB/m7 Ur4IU6FZOErKrEY6YNI6Pfe2nlVJaD0Cpsfuw+LaloVsZ0MXNqV+9dcKHrFAv9NK87A8b /TXhLokY95aCQKyImK3jPJGlKvH29ZT2WOE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This will give us an exclusive access to the PciIo of this device after it was started and until is will be stopped. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2390 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Nikita Leshenko Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Aaron Young Reviewed-by: Liran Alon --- OvmfPkg/MptScsiDxe/MptScsi.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index d72af2b3f7..22001da763 100644 --- a/OvmfPkg/MptScsiDxe/MptScsi.c +++ b/OvmfPkg/MptScsiDxe/MptScsi.c @@ -40,6 +40,7 @@ typedef struct { UINT32 Signature; EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru; EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode; + EFI_PCI_IO_PROTOCOL *PciIo; } MPT_SCSI_DEV; =20 #define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \ @@ -270,6 +271,18 @@ MptScsiControllerStart ( =20 Dev->Signature =3D MPT_SCSI_DEV_SIGNATURE; =20 + Status =3D gBS->OpenProtocol ( + ControllerHandle, + &gEfiPciIoProtocolGuid, + (VOID **)&Dev->PciIo, + This->DriverBindingHandle, + ControllerHandle, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + if (EFI_ERROR (Status)) { + goto Done; + } + // // Host adapter channel, doesn't exist // @@ -299,6 +312,15 @@ MptScsiControllerStart ( =20 Done: if (EFI_ERROR (Status)) { + if (Dev->PciIo) { + gBS->CloseProtocol ( + ControllerHandle, + &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + } + FreePool (Dev); } =20 @@ -339,6 +361,13 @@ MptScsiControllerStop ( &Dev->PassThru ); =20 + gBS->CloseProtocol ( + ControllerHandle, + &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, + ControllerHandle + ); + FreePool (Dev); =20 return Status; --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#54913): https://edk2.groups.io/g/devel/message/54913 Mute This Topic: https://groups.io/mt/71570013/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-