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.web11.250.1585242318696910997 for ; Thu, 26 Mar 2020 10:05:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BTXzwUDn; 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=1585242317; 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=ggQyN+P1CTbgnBEF3kxu+wrg175S3XV73CTfvBzEE38=; b=BTXzwUDnsMclbOt+BJ5Zar8ffkSsCSS6UOZm4g4pMQ3K4qoBe5fZ1DDH0ZGHFmEOdBH4y5 /tmrIbdUFPCpNNzr7SDKSUeM1dI1fB9HLvac0xfxlt+B3gYAx5WYRatJJNbENWkriM8kPX KX0S96TLoVt7MubHdMF1A/Yo1cKV9SA= 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-136-UR_1lwDHNPeun6woNuTdyQ-1; Thu, 26 Mar 2020 13:05:11 -0400 X-MC-Unique: UR_1lwDHNPeun6woNuTdyQ-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 697BF8017DF; Thu, 26 Mar 2020 17:05:10 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-128.ams2.redhat.com [10.36.113.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08A0F5C1D8; Thu, 26 Mar 2020 17:04:42 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 09/17] OvmfPkg/PvScsiDxe: Backup/Restore PCI attributes on Init/UnInit 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: <20200325161005.16743-1-liran.alon@oracle.com> <20200325161005.16743-10-liran.alon@oracle.com> From: "Laszlo Ersek" Message-ID: <2782c056-cb06-b8b1-307b-cfdb36504548@redhat.com> Date: Thu, 26 Mar 2020 18:04:33 +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: <20200325161005.16743-10-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/25/20 17:09, Liran Alon wrote: > 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=2567 > Signed-off-by: Liran Alon > --- > OvmfPkg/PvScsiDxe/PvScsi.c | 54 +++++++++++++++++++++++++++++++++++++- > OvmfPkg/PvScsiDxe/PvScsi.h | 1 + > 2 files changed, 54 insertions(+), 1 deletion(-) Reviewed-by: Laszlo Ersek Thanks, Laszlo > > diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c > index e0380d729b3c..5566b4cce467 100644 > --- a/OvmfPkg/PvScsiDxe/PvScsi.c > +++ b/OvmfPkg/PvScsiDxe/PvScsi.c > @@ -283,18 +283,70 @@ PvScsiGetNextTarget ( > return EFI_NOT_FOUND; > } > > +STATIC > +EFI_STATUS > +PvScsiSetPciAttributes ( > + IN OUT PVSCSI_DEV *Dev > + ) > +{ > + EFI_STATUS Status; > + > + // > + // Backup original PCI Attributes > + // > + Status = Dev->PciIo->Attributes ( > + Dev->PciIo, > + EfiPciIoAttributeOperationGet, > + 0, > + &Dev->OriginalPciAttributes > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + // > + // TODO: Change PCI Attributes > + // > + > + return EFI_SUCCESS; > +} > + > +STATIC > +VOID > +PvScsiRestorePciAttributes ( > + IN PVSCSI_DEV *Dev > + ) > +{ > + Dev->PciIo->Attributes ( > + Dev->PciIo, > + EfiPciIoAttributeOperationSet, > + Dev->OriginalPciAttributes, > + NULL > + ); > +} > + > STATIC > EFI_STATUS > PvScsiInit ( > IN OUT PVSCSI_DEV *Dev > ) > { > + EFI_STATUS Status; > + > // > // Init configuration > // > Dev->MaxTarget = PcdGet8 (PcdPvScsiMaxTargetLimit); > Dev->MaxLun = PcdGet8 (PcdPvScsiMaxLunLimit); > > + // > + // Set PCI Attributes > + // > + Status = PvScsiSetPciAttributes (Dev); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > // > // Populate the exported interface's attributes > // > @@ -333,7 +385,7 @@ PvScsiUninit ( > IN OUT PVSCSI_DEV *Dev > ) > { > - // Currently nothing to do here > + PvScsiRestorePciAttributes (Dev); > } > > // > 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; >