From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A56DB81F11 for ; Sat, 12 Nov 2016 05:02:30 -0800 (PST) Received: by mail-wm0-x22d.google.com with SMTP id a197so23477195wmd.0 for ; Sat, 12 Nov 2016 05:02:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hona29oIgn/7zUx/tyFgQT41IHc1rCL3kJN7sDo1ZPc=; b=CKgaS+ZBPQBni57eZe6RGdApISJ9eKWzavbEYZKhFG0tnKoRBJs4bk5p58kebd3HkR yv0uHkB/UNKAxKWb+aTJ5s4U6mzn6zGj2v25mygpJe16nfm2lOX62FWgDoQ3w2MwMI9x GhDNftJCcj6ZESpJtj2+fWYgsBjg55SyKJc6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hona29oIgn/7zUx/tyFgQT41IHc1rCL3kJN7sDo1ZPc=; b=i/FnrK8eT5dZnrFDU0nOx+Ycifpck+9ErrriRaXjwssaTF1VgIonuMTHL5XvLm45OM 9acslttZBSeuSfwQqXgMcc6BqRk4jAQWF9sI2ygs72kTwg/dC6rfXSxE7PKL+2JUPTRH KOf0ZviISFyM+AGEB5XMnErhWz2JGJv4St2P1FHVsnMbyA2sJBcKbYTqNhkJjXXcm+Ex QsmBQnhKGEaj87fM7u5TKNtRp7FSyllAp98S5jlzgKr+IWSzUXrq2H9nSqS7RVBbrLpb 8fHgDpDbnqzWnL3kyTES3AjfNEVbGBCApTgK0r6GUFRULcZ/g52dmzkS5iKtmALEWlNO laXQ== X-Gm-Message-State: ABUngvfUULnQekOQ7jFdNBUD2kKX/3VeBXJlhe2aNB0d/It+9cd6DnoPipqiFf5XZUGWNNAS X-Received: by 10.195.18.201 with SMTP id go9mr12874750wjd.200.1478955753107; Sat, 12 Nov 2016 05:02:33 -0800 (PST) Received: from ards-macbook-pro.access.network ([193.57.185.11]) by smtp.gmail.com with ESMTPSA id e188sm6084212wma.21.2016.11.12.05.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Nov 2016 05:02:32 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Cc: Ard Biesheuvel Date: Sat, 12 Nov 2016 14:02:26 +0100 Message-Id: <1478955748-14819-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478955748-14819-1-git-send-email-ard.biesheuvel@linaro.org> References: <1478955748-14819-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH v2 2/4] ArmPkg/ArmDmaLib: fix incorrect device address of double buffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2016 13:02:31 -0000 If double buffering is not required in DmaMap(), the returned device address is passed through ConvertToPhysicalAddress () to convert the host address (which in case of DebugUncachedMemoryAllocationLib is not 1:1 mapped) to a physical address, which is what a device would expect to be able to perform DMA. By the same reasoning, a double buffer allocated using DmaAllocateBuffer () should be converted in the same way, considering that the buffer is allocated using UncachedAllocatePages (), to which the above equally applies. So add the missing ConvertToPhysicalAddress () invocation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/ArmDmaLib/ArmDmaLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c index 03fd9f3278e6..c2a44398d25a 100644 --- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c +++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c @@ -127,7 +127,7 @@ DmaMap ( CopyMem (Buffer, HostAddress, *NumberOfBytes); } - *DeviceAddress = (PHYSICAL_ADDRESS)(UINTN)Buffer; + *DeviceAddress = ConvertToPhysicalAddress ((UINTN)Buffer); } else { Map->DoubleBuffer = FALSE; } -- 2.7.4