From nobody Mon Feb 9 22:38:05 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+55876+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+55876+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1584373399; cv=none; d=zohomail.com; s=zohoarc; b=ghbhhFqLdQ7KahNkNyntyCXKGsiZGhW0vGwEHOPLFchVthjNOEfk9V543m71ZlurRTWBySh6UA1RD9xKiYsLz9lb0K41faDc01/b05fa/EXWK3jt1dbutGUzKQjUKHprgRW4g0TIba3FEvaoKznN3rUrgBzFLiIlqvaGNYr/Nos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584373399; 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=+6MH8wD6suc5QoBndLECXZ0ouLUboYCWIXXiQvN3T6I=; b=bUJvYU9VP5k637lzirCfpLgelI6Re9HriH0LQiLgPL857USoF1+v4sKT2zwCC+rVStmCf9z59Iqd6heiZfwZmIc78FATP5i47PvZpFSrksVTWc0g9OCFZ1vgNUJ1+iTPIHOAlYWLZtZi7a4lxqSmHCMRZQodFNq01osdxNzKdco= 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+55876+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 1584373399430224.42017776586158; Mon, 16 Mar 2020 08:43:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8YgDYY1788612xlYoTQaixR5; Mon, 16 Mar 2020 08:43:19 -0700 X-Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by mx.groups.io with SMTP id smtpd.web10.69834.1584370829017941145 for ; Mon, 16 Mar 2020 08:00:29 -0700 X-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02GEqjxe149326; Mon, 16 Mar 2020 15:00:28 GMT X-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2yrq7kqd8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Mar 2020 15:00:28 +0000 X-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02GEqXaw114389; Mon, 16 Mar 2020 15:00:28 GMT X-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2ys8tpw9s3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Mar 2020 15:00:25 +0000 X-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 02GF0PPd009289; Mon, 16 Mar 2020 15:00:25 GMT X-Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Mar 2020 08:00:25 -0700 From: "Liran Alon" To: devel@edk2.groups.io, lersek@redhat.com Cc: nikita.leshchenko@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, ard.biesheuvel@linaro.org, Liran Alon Subject: [edk2-devel] [PATCH 09/17] OvmfPkg/PvScsiDxe: Backup/Restore PCI attributes on Init/UnInit Date: Mon, 16 Mar 2020 17:01:05 +0200 Message-Id: <20200316150113.104630-10-liran.alon@oracle.com> In-Reply-To: <20200316150113.104630-1-liran.alon@oracle.com> References: <20200316150113.104630-1-liran.alon@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,liran.alon@oracle.com X-Gm-Message-State: Ql6ON6DPOvW8O7MVyakjwiDmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584373399; bh=YrkMKI8W45CW4/vnIFbOoBgJ5gBbSHLOJVmTLhvxIpE=; h=Cc:Date:From:Reply-To:Subject:To; b=m9wy0HhR6DS/nBkjtjhwP11hcAXQMpqt1g+BiHOvKw95Ljwh0BXlKrlkzm0Kj/bFf+2 ajJc4LGaQnH2mMPliOO9Elyj+m6681xbbCZazX45MzFMTXwLoL5K/5NzA1sxohldjAr0J CtUPTG/lk2pogdy0wgR3EEt3lERYPQcKelw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This commit doesn't change semantics. It is done as a preparation for future commits which will modify PCI attributes. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2567 Reviewed-by: Nikita Leshenko Signed-off-by: Liran Alon --- OvmfPkg/PvScsiDxe/PvScsi.c | 53 +++++++++++++++++++++++++++++++++++++- OvmfPkg/PvScsiDxe/PvScsi.h | 1 + 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c index b6a83d73cead..92e0f4a98965 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.c +++ b/OvmfPkg/PvScsiDxe/PvScsi.c @@ -281,18 +281,59 @@ PvScsiGetNextTarget ( return EFI_NOT_FOUND; } =20 +STATIC +EFI_STATUS +PvScsiSetPCIAttributes ( + IN OUT PVSCSI_DEV *Dev + ) +{ + EFI_STATUS Status; + + // + // Set saved original PCI attirubtes to invalid value + // such that cleanup logic could determine if it should restore + // PCI attributes or not + // + Dev->OriginalPciAttributes =3D (UINT64)(-1); + + // + // Backup original PCI Attributes + // + Status =3D Dev->PciIo->Attributes ( + Dev->PciIo, + EfiPciIoAttributeOperationGet, + 0, + &Dev->OriginalPciAttributes + ); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} + STATIC EFI_STATUS PvScsiInit ( IN OUT PVSCSI_DEV *Dev ) { + EFI_STATUS Status; + // // Init configuration // Dev->MaxTarget =3D PcdGet8 (PcdPvScsiMaxTargetLimit); Dev->MaxLun =3D PcdGet8 (PcdPvScsiMaxLunLimit); =20 + // + // Set PCI Attributes + // + Status =3D PvScsiSetPCIAttributes (Dev); + if (EFI_ERROR (Status)) { + return Status; + } + // // Populate the exported interface's attributes // @@ -331,7 +372,17 @@ PvScsiUninit ( IN OUT PVSCSI_DEV *Dev ) { - // Currently nothing to do here + // + // Restore PCI Attributes + // + if (Dev->OriginalPciAttributes !=3D (UINT64)(-1)) { + Dev->PciIo->Attributes ( + Dev->PciIo, + EfiPciIoAttributeOperationSet, + Dev->OriginalPciAttributes, + NULL + ); + } } =20 // diff --git a/OvmfPkg/PvScsiDxe/PvScsi.h b/OvmfPkg/PvScsiDxe/PvScsi.h index e1e5ae18ebf2..5f611dbbc98c 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.h +++ b/OvmfPkg/PvScsiDxe/PvScsi.h @@ -20,6 +20,7 @@ typedef struct { UINT32 Signature; EFI_PCI_IO_PROTOCOL *PciIo; + UINT64 OriginalPciAttributes; UINT8 MaxTarget; UINT8 MaxLun; EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru; --=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 (#55876): https://edk2.groups.io/g/devel/message/55876 Mute This Topic: https://groups.io/mt/72001278/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-