NetBSD Problem Report #8132

Received: (qmail 2000 invoked from network); 2 Aug 1999 10:09:48 -0000
Message-Id: <199908021009.LAA27715@shark1.cambridge.arm.com>
Date: Mon, 2 Aug 1999 11:09:18 +0100 (BST)
From: Richard Earnshaw <rearnsha@cambridge.arm.com>
Reply-To: rearnsha@cambridge.arm.com
To: gnats-bugs@gnats.netbsd.org
Subject: Buglet in arm32/bus_dma.c
X-Send-Pr-Version: 3.95

>Number:         8132
>Category:       port-arm32
>Synopsis:       Buglet in arm32/bus_dma.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    is
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 02 03:20:01 +0000 1999
>Closed-Date:    Fri Sep 10 10:56:03 +0000 1999
>Last-Modified:  Fri Sep 10 10:56:34 +0000 1999
>Originator:     Richard Earnshaw
>Release:        NetBSD-current 19990802<NetBSD-current source date>
>Organization:
ARM
-- 
>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;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: port-arm32-maintainer->is 
Responsible-Changed-By: is 
Responsible-Changed-When: Wed Sep 8 06:53:30 PDT 1999 
Responsible-Changed-Why:  
I'm testing this. 
State-Changed-From-To: open->closed 
State-Changed-By: is 
State-Changed-When: Fri Sep 10 03:56:03 PDT 1999 
State-Changed-Why:  
Patch tested and applied. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.