Subject: port-mips/31910: mips bus_space implementation doesn't support mismatched cpu/bus endianness
To: None <port-mips-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <garrett_damore@tadpole.com>
List: netbsd-bugs
Date: 10/24/2005 23:40:00
>Number:         31910
>Category:       port-mips
>Synopsis:       mips bus_space implementation doesn't support mismatched cpu/bus endianness
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-mips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 24 23:40:00 +0000 2005
>Originator:     Garrett D'Amore
>Release:        -current (3.99.10)
>Organization:
Tadpole Computer, Inc.
>Environment:
NetBSD cabernet 3.99.10 NetBSD 3.99.10 (PB1000) #17: Mon Oct 24 14:32:47 PDT 2005  garrett@zippy:/home/garrett/work/meteor/netbsd/src/sys/arch/evbmips/compile/obj/PB1000 evbmips
>Description:
The file mips/include/bus_space.h (and supporting mips/mips/bus_space_alignstride_chipdep.c incorrectly #define the _stream variants of the bus_space methods to be the same as the normal ones.

This is clearly wrong on busses where the CPU endianness does not match that of the bus.  (And in fact, bus_space_alignstride_chip.c does not perform the swapping for the non-stream versions that it should, in such cases.)

Currently the only port which uses this mips-specific implementation is the evbmips port, and folks probably are running these procs little endian (anecdotal evidence with other bugs suggests this), so they might not be seeing it.

>How-To-Repeat:
Visual examination of the source shows the problem.  Unfortunately to "prove" the problem exists, you need to build evbmips-eb and then include support for a PCI bus.  Since to my knowledge I have the only such bus implementation in existence and it isn't committed yet, it will be hard to demonstrate.

However, I think this bug should be fixed as a prelude to me putting back my PCI support for the Alchemy processors.

I will be submitting diffs shortly.
>Fix: