Subject: README: changes to i386 bus_space
To: None <port-i386@NetBSD.ORG>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: current-users
Date: 06/06/1998 20:29:54
Hi folks...

I've just make some changes to the i386 bus_space macros that won't affect
normal use, but can aid debugging.

Basically, if BUS_SPACE_DEBUG (or the global DEBUG) option is enabled,
the bus_space macros will perform strict alignment checking of both
bus addresses and kernel buffer addresses.  While these checks are not
strictly necessary on the x86, having the alignment right can help
performance, and helps make device drivers more portable to other platforms
which _do_ have strict alignment constraints (Alpha, StrongARM, UltraSPARC,
just to name a few).

It's known that a few drivers have some problems in this area, but debugging
them on platforms where alignment matters can sometimes be problematic; some
platforms die with unaligned access faults, some platforms just corrupt the
data (the StrongARM is an example of the latter).

If you would like to particpate in the effort to clean up drivers with
alignment problems, here's how to do it:

	(1) Enable bus_space alignment checking in your kernel configuration
	    file.  Use the BUS_SPACE_DEBUG or DEBUG option (the latter turns
	    on other kernel debugging code, as well, so you may not want it).

	(2) Re-run config, make clean, make depend, and make your kernel.

	(3) Boot the resulting kernel, and use it as you normally would.
	    If you see an error like:

buffer <address> not aligned to 2 bytes ../../../../dev/ic/aic6360.c:1426

	    displayed on your console, collect them, and submit a bug
	    report using send-pr(1).  If you want to take a stab at fixing
	    the code, that'd be cool, too.  :-)

It's easy, it's fun, and it is a good way to take an active role in
improving the portability of the NetBSD kernel.  Your efforts will be
greatly appreciated by the developers and users of these other architectures.

The ISA network drivers and PIO SCSI drivers (aic and esp on ISA) are
especially suspect... FYI :-)

If you have any questions, or encounter any problems, don't hesitate to send
me e-mail (and _PLEASE_ submit a bug report w/ send-pr(1) :-).

Enjoy!

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 428 6939