Subject: port-arm32/8132: Buglet in arm32/bus_dma.c
To: None <gnats-bugs@gnats.netbsd.org>
From: Richard Earnshaw <rearnsha@cambridge.arm.com>
List: netbsd-bugs
Date: 08/02/1999 03:21:06
>Number: 8132
>Category: port-arm32
>Synopsis: Buglet in arm32/bus_dma.c
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-arm32-maintainer (NetBSD/arm32 Portmaster)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 2 03:20:01 1999
>Last-Modified:
>Originator: Richard Earnshaw
>Organization:
ARM
--
>Release: NetBSD-current 19990802<NetBSD-current source date>
>Environment:
System: NetBSD shark1 1.4F NetBSD 1.4F (SHARK) #42: Mon Jul 12 14:07:55 BST 1999 rearnsha@shark1:/usr/src/sys/arch/arm32/compile/SHARK arm32
>Description:
Whilst browsing the arm32 bus_dma sources over the weekend I noticed
the following buglet. It doesn't actually break anything, but does
make the code less efficient than it need be. The bus_dmamap_sync
function has two variables len and length (the former being the
length of the buffer to synchronize, the latter being the length
of the current segment. The wrong one (the longer of the two) is
being passed to cpu_cache_purgeD_rng, so more of the cache is being
synchronized than necessary.
>How-To-Repeat:
Look at arm32/bus_dma.c (_bus_dmamap_sync()).
>Fix:
Patch below
Index: bus_dma.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arm32/arm32/bus_dma.c,v
retrieving revision 1.15
diff -p -r1.15 bus_dma.c
*** bus_dma.c 1999/07/08 18:05:24 1.15
--- bus_dma.c 1999/08/02 09:58:06
*************** _bus_dmamap_sync(t, map, offset, len, op
*** 390,396 ****
printf("syncing: %lx,%lx\n", vaddr, length);
#endif /* DEBUG_DMA */
/* Actually sync the cache */
! cpu_cache_purgeD_rng(vaddr, len);
/* Adjust the length */
len -= length;
--- 390,396 ----
printf("syncing: %lx,%lx\n", vaddr, length);
#endif /* DEBUG_DMA */
/* Actually sync the cache */
! cpu_cache_purgeD_rng(vaddr, length);
/* Adjust the length */
len -= length;
>Audit-Trail:
>Unformatted: