Revision: 14618
          http://sourceforge.net/p/edk2/code/14618
Author:   oliviermartin
Date:     2013-09-02 13:13:29 +0000 (Mon, 02 Sep 2013)
Log Message:
-----------
ArmPkg/ArmDmaLib: Fixed the calculation of the Base Address of the Buffer

The former calculation 'ALIGN_VALUE(*DeviceAddress - BASE_4KB - 1,BASE_4KB)' did
not return the lowest aligned address.

Example:
*DeviceAddress = 0xB000C001;
*DeviceAddress - BASE_4KB - 1 = 0xB000B000;
Aligned value = 0xB000B000 + ((0x1000 - 0xB000B000)) & 0xFFF) = 0xB000B000
... while we where expected 0xB000C000.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c

Modified: trunk/edk2/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c
===================================================================
--- trunk/edk2/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c     2013-09-02 13:12:17 UTC 
(rev 14617)
+++ trunk/edk2/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c     2013-09-02 13:13:29 UTC 
(rev 14618)
@@ -131,7 +131,7 @@
 
     if ((Operation == MapOperationBusMasterRead) || (Operation == 
MapOperationBusMasterCommonBuffer)) {
       // In case the buffer is used for instance to send command to a PCI 
controller, we must ensure the memory is uncached
-      Status = gDS->SetMemorySpaceAttributes (ALIGN_VALUE(*DeviceAddress - 
BASE_4KB - 1,BASE_4KB), ALIGN_VALUE(*NumberOfBytes,BASE_4KB), EFI_MEMORY_WC);
+      Status = gDS->SetMemorySpaceAttributes (*DeviceAddress & ~(BASE_4KB - 
1), ALIGN_VALUE (*NumberOfBytes, BASE_4KB), EFI_MEMORY_WC);
       ASSERT_EFI_ERROR (Status);
     }
   }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to