From nobody Tue Feb 10 06:58:19 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+55454+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+55454+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1583349744; cv=none; d=zohomail.com; s=zohoarc; b=X0VF3/ENb0IUmT6p9cUUEv+RCoa4FMjqdtLzZ7Zl8/hS4auv7X+FZdJuTCu9Eg23EC1j920vH588fJQAcLTu2JSosz8lc3bCSw9d1Eo6SWO7xCuw+dSfzpJ6WHNkepqOUMPtQW9sV16hHBBhNwbrab3rphsqnBavGdv8nishuL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583349744; 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=O2WueDNsQEWex7pP8A2LCUa7Tu5wCvZEWDdQbD8HiIE=; b=Zd565d/yVYN0brss+jXyjeqxvEOUvaNVSCBmhiYfzZ9ndimzyJxWr/9brlVCKJnqSVcDhAugPgA9jeA5HY1v1nHcPISiT+VL2xM8H0MXOfXRfarNodBpgtbKDw9J1RUJcpEOgxwkrJ+mMpEJVJkgwSYkFmhYEy3gi/EMwY4gf6c= 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+55454+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 1583349744305660.7003008411968; Wed, 4 Mar 2020 11:22:24 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id V8xlYY1788612xKnIDQGB2tS; Wed, 04 Mar 2020 11:22:23 -0800 X-Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by mx.groups.io with SMTP id smtpd.web10.16873.1583349743109864239 for ; Wed, 04 Mar 2020 11:22:23 -0800 X-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 024Ix0J8092258; Wed, 4 Mar 2020 19:22:22 GMT X-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2yghn3c76a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Mar 2020 19:22:22 +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 024JF1jZ145994; Wed, 4 Mar 2020 19:22:22 GMT X-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2yg1eqkmtx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Mar 2020 19:22:22 +0000 X-Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 024JMLrm014455; Wed, 4 Mar 2020 19:22:21 GMT X-Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 04 Mar 2020 11:22:20 -0800 From: "Nikita Leshenko" To: devel@edk2.groups.io Cc: Nikita Leshenko , liran.alon@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, lersek@redhat.com, ard.biesheuvel@linaro.org Subject: [edk2-devel] [PATCH v3 10/13] OvmfPkg/MptScsiDxe: Set and restore PCI attributes Date: Wed, 4 Mar 2020 21:22:54 +0200 Message-Id: <20200304192257.96736-11-nikita.leshchenko@oracle.com> In-Reply-To: <20200304192257.96736-1-nikita.leshchenko@oracle.com> References: <20200304192257.96736-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: 0ppkDEEZQo3LwP9UbWNoYEA4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1583349743; bh=tDd5oiyxJBNcHGRa8NEE6tEh0st8wXRB/f/8M+dNP70=; h=Cc:Date:From:Reply-To:Subject:To; b=qe79uiUjbomCXjae9a5xZ3Hf6hWfp0pXZwv1RFRrEzNxx5OJjbwouOQdr+HGFoTQMW3 YNSyHSpCa9Z+S5qpjTSAhYiU5y+XytjBJuV3Pfs2+Q6BDi6eRFZVqBzyQ4iNLtEAuCoq4 qTlYpVEuqFhM/O4e20r6b8OUb9Co1HWaVSE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Enable the IO Space and Bus Mastering and restore the original values when the device is stopped. This is a standard procedure in PCI drivers. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2390 Signed-off-by: Nikita Leshenko Reviewed-by: Liran Alon --- OvmfPkg/MptScsiDxe/MptScsi.c | 42 +++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index f05383e479b6..4a52dee902c7 100644 --- a/OvmfPkg/MptScsiDxe/MptScsi.c +++ b/OvmfPkg/MptScsiDxe/MptScsi.c @@ -41,6 +41,7 @@ typedef struct { EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru; EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode; EFI_PCI_IO_PROTOCOL *PciIo; + UINT64 OriginalPciAttributes; } MPT_SCSI_DEV; =20 #define MPT_SCSI_FROM_PASS_THRU(PassThruPtr) \ @@ -311,6 +312,30 @@ MptScsiControllerStart ( goto FreePool; } =20 + Status =3D Dev->PciIo->Attributes ( + Dev->PciIo, + EfiPciIoAttributeOperationGet, + 0, + &Dev->OriginalPciAttributes + ); + if (EFI_ERROR (Status)) { + goto CloseProtocol; + } + + // + // Enable I/O Space & Bus-Mastering + // + Status =3D Dev->PciIo->Attributes ( + Dev->PciIo, + EfiPciIoAttributeOperationEnable, + (EFI_PCI_IO_ATTRIBUTE_IO | + EFI_PCI_IO_ATTRIBUTE_BUS_MASTER), + NULL + ); + if (EFI_ERROR (Status)) { + goto CloseProtocol; + } + // // Host adapter channel, doesn't exist // @@ -335,11 +360,19 @@ MptScsiControllerStart ( &Dev->PassThru ); if (EFI_ERROR (Status)) { - goto CloseProtocol; + goto RestoreAttributes; } =20 return EFI_SUCCESS; =20 +RestoreAttributes: + Dev->PciIo->Attributes ( + Dev->PciIo, + EfiPciIoAttributeOperationEnable, + Dev->OriginalPciAttributes, + NULL + ); + CloseProtocol: gBS->CloseProtocol ( ControllerHandle, @@ -389,6 +422,13 @@ MptScsiControllerStop ( ); ASSERT_EFI_ERROR (Status); =20 + Dev->PciIo->Attributes ( + Dev->PciIo, + EfiPciIoAttributeOperationEnable, + Dev->OriginalPciAttributes, + NULL + ); + gBS->CloseProtocol ( ControllerHandle, &gEfiPciIoProtocolGuid, --=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 (#55454): https://edk2.groups.io/g/devel/message/55454 Mute This Topic: https://groups.io/mt/71733505/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-