Subject: port-powerpc/28512: _bus_dmamap_sync using bus address
To: None <port-powerpc-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <nludban@terabeam.com>
List: netbsd-bugs
Date: 12/02/2004 16:18:00
>Number:         28512
>Category:       port-powerpc
>Synopsis:       _bus_dmamap_sync using bus address
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 02 16:18:00 +0000 2004
>Originator:     Neil Ludban
>Release:        2.0RC3
>Organization:
>Environment:
powerpc (only affects bebox, ibmnws, mvmeppc, and prep?)
>Description:
The cache is flushed using the bus address where the phys address
is required.  Errors would be seen only on ports where address
translation is done between the bus and physical memory.

>How-To-Repeat:

>Fix:
Patch to arch/powerpc/powerpc/bus_dma.c (line numbers are approximate):

@@ -483,7 +483,7 @@
        __asm __volatile("eieio");
        for (; len > 0; ds++, offset = 0) {
                bus_size_t seglen = ds->ds_len - offset;
-               bus_addr_t addr = ds->ds_addr + offset;
+               bus_addr_t addr = BUS_MEM_TO_PHYS(t, ds->ds_addr) + offset;
                if (seglen > len)
                        seglen = len;
                len -= seglen;