From 5f9f92bd29234c7f5e7aa59b595adc15b3ceda92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Wed, 15 Jul 2009 17:45:06 +0000 Subject: [PATCH] [ 2815726 ] Fix HALFWORD and BYTE DMA read access (Jochen Friedrich) git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1662 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 3 +++ urjtag/THANKS | 1 + urjtag/src/bus/ejtag_dma.c | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 302a9f0e..cf8b328a 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,5 +1,8 @@ 2009-07-15 Arnim Laeuger + * src/bus/ejtag_dma.c: [ 2815726 ] Fix HALFWORD and BYTE DMA read access + (Jochen Friedrich) + * src/flash/amd_flash.c: [ 2821629 ] Can't find flash_info : amd_flash.c (MURANAKA Masaki) * src/flash/amd_flash.c: [ 2821646 ] Possible buffer overrun in amd_detect diff --git a/urjtag/THANKS b/urjtag/THANKS index 169e8009..326c246d 100644 --- a/urjtag/THANKS +++ b/urjtag/THANKS @@ -25,6 +25,7 @@ Andrew Dyer Chris Ellec Ralf Engels Steve Franks +Jochen Friedrich Thomas Fröhlich Mike Frysinger Robin Getz diff --git a/urjtag/src/bus/ejtag_dma.c b/urjtag/src/bus/ejtag_dma.c index d81130c0..986fbabc 100644 --- a/urjtag/src/bus/ejtag_dma.c +++ b/urjtag/src/bus/ejtag_dma.c @@ -342,10 +342,20 @@ ejtag_dma_read (urj_bus_t *bus, unsigned int addr, int sz) switch (sz) { case DMA_HALFWORD: - ret &= ret & 0xffff; + if (addr & 2) + ret = (ret >> 16) & 0xffff; + else + ret = ret & 0xffff; break; case DMA_BYTE: - ret &= ret & 0xff; + if ((addr & 3) == 3) + ret = (ret >> 24) & 0xff; + else if ((addr & 3) == 2) + ret = (ret >> 16) & 0xff; + else if ((addr & 3) == 1) + ret = (ret >> 8) & 0xff; + else + ret = ret & 0xff; break; case DMA_WORD: default: