From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4044D21FC7460 for ; Mon, 9 Oct 2017 00:39:50 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Oct 2017 00:43:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,499,1500966000"; d="scan'208";a="1228641066" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 09 Oct 2017 00:42:58 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 9 Oct 2017 00:42:58 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 9 Oct 2017 00:42:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Mon, 9 Oct 2017 15:42:56 +0800 From: "Ni, Ruiyu" To: Daniil Egranov , "edk2-devel@lists.01.org" CC: "leif.lindholm@linaro.org" , "Zeng, Star" , "ard.biesheuvel@linaro.org" Thread-Topic: [edk2] [PATCH] MdeModulePkg/PciHostBridgeDxe: Fixed PCI DMA Map/Umap bounce buffer Thread-Index: AQHTQJwur0ZFkQ0trUyg/eFY5o8pbqLbIscA Date: Mon, 9 Oct 2017 07:42:55 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA8A854@SHSMSX104.ccr.corp.intel.com> References: <20171009011539.45115-1-daniil.egranov@arm.com> In-Reply-To: <20171009011539.45115-1-daniil.egranov@arm.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/PciHostBridgeDxe: Fixed PCI DMA Map/Umap bounce buffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Oct 2017 07:39:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The "read"/"write" is from the Bus Master's point of view. Thanks/Ray > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Da= niil > Egranov > Sent: Monday, October 9, 2017 9:16 AM > To: edk2-devel@lists.01.org > Cc: leif.lindholm@linaro.org; Zeng, Star ; > ard.biesheuvel@linaro.org > Subject: [edk2] [PATCH] MdeModulePkg/PciHostBridgeDxe: Fixed PCI DMA > Map/Umap bounce buffer >=20 > The patch corrects the logic of transferring data between a bounce buffer= and a > real buffer above 4GB: > 1. In the case of mapping a bounce buffer for the write operation, data f= rom a > real buffer should be copied into a bounce buffer. > 2.In the case of unmapping a bounce buffer for the read operation, data s= hould > be copied from a bounce buffer into a real buffer. >=20 > The patch resolves a Juno board issue with the the grub and SATA drives. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Daniil Egranov > --- > MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 12 ++++++-----= - > 1 file changed, 6 insertions(+), 6 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c > b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c > index dc06c16dc0..877fa2fd13 100644 > --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c > +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c > @@ -1153,12 +1153,12 @@ RootBridgeIoMap ( > } >=20 > // > - // If this is a read operation from the Bus Master's point of view, > + // If this is a write operation from the Bus Master's point of > + view, > // then copy the contents of the real buffer into the mapped buffer > // so the Bus Master can read the contents of the real buffer. > // > - if (Operation =3D=3D EfiPciOperationBusMasterRead || > - Operation =3D=3D EfiPciOperationBusMasterRead64) { > + if (Operation =3D=3D EfiPciOperationBusMasterWrite || > + Operation =3D=3D EfiPciOperationBusMasterWrite64) { > CopyMem ( > (VOID *) (UINTN) MapInfo->MappedHostAddress, > (VOID *) (UINTN) MapInfo->HostAddress, @@ -1256,12 +1256,12 @@ > RootBridgeIoUnmap ( > RemoveEntryList (&MapInfo->Link); >=20 > // > - // If this is a write operation from the Bus Master's point of view, > + // If this is a read operation from the Bus Master's point of view, > // then copy the contents of the mapped buffer into the real buffer > // so the processor can read the contents of the real buffer. > // > - if (MapInfo->Operation =3D=3D EfiPciOperationBusMasterWrite || > - MapInfo->Operation =3D=3D EfiPciOperationBusMasterWrite64) { > + if (MapInfo->Operation =3D=3D EfiPciOperationBusMasterRead || > + MapInfo->Operation =3D=3D EfiPciOperationBusMasterRead64) { > CopyMem ( > (VOID *) (UINTN) MapInfo->HostAddress, > (VOID *) (UINTN) MapInfo->MappedHostAddress, > -- > 2.11.0 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel