From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=daniil.egranov@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 8DD0021CF58CC for ; Sun, 8 Oct 2017 18:12:25 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 32F0D1435; Sun, 8 Oct 2017 18:15:51 -0700 (PDT) Received: from usa.arm.com (dbox2.austin.arm.com [10.118.34.15]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 611353F58C; Sun, 8 Oct 2017 18:15:50 -0700 (PDT) From: Daniil Egranov To: edk2-devel@lists.01.org Cc: star.zeng@intel.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, Daniil Egranov Date: Sun, 8 Oct 2017 20:15:39 -0500 Message-Id: <20171009011539.45115-1-daniil.egranov@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [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 01:12:25 -0000 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 from a real buffer should be copied into a bounce buffer. 2.In the case of unmapping a bounce buffer for the read operation, data should be copied from a bounce buffer into a real buffer. The patch resolves a Juno board issue with the the grub and SATA drives. 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(-) 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 ( } // - // 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 == EfiPciOperationBusMasterRead || - Operation == EfiPciOperationBusMasterRead64) { + if (Operation == EfiPciOperationBusMasterWrite || + Operation == EfiPciOperationBusMasterWrite64) { CopyMem ( (VOID *) (UINTN) MapInfo->MappedHostAddress, (VOID *) (UINTN) MapInfo->HostAddress, @@ -1256,12 +1256,12 @@ RootBridgeIoUnmap ( RemoveEntryList (&MapInfo->Link); // - // 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 == EfiPciOperationBusMasterWrite || - MapInfo->Operation == EfiPciOperationBusMasterWrite64) { + if (MapInfo->Operation == EfiPciOperationBusMasterRead || + MapInfo->Operation == EfiPciOperationBusMasterRead64) { CopyMem ( (VOID *) (UINTN) MapInfo->HostAddress, (VOID *) (UINTN) MapInfo->MappedHostAddress, -- 2.11.0