Subject: ALIGNED_POINTER() checks in drivers
To: None <tech-kern@netbsd.org>
From: None <drochner@zel459.zel.kfa-juelich.de>
List: tech-kern
Date: 03/13/1999 15:20:41
I just had to use an ISA network adapter and got a number of these
"buffer xxx not aligned to 2 bytes" messages.
I'm using BUS_SPACE_DEBUG, and the buffer is not aligned indeed,
so the message is correct in principle.

There is this ALIGNED_POINTER() check which is always "1" on
i386, so the message is triggered even if the code checks correctly.

How about a new macro, eg "BUS_SPACE_ALIGNED_POINTER", which
is basically
#ifdef BUS_SPACE_DEBUG
#define BUS_SPACE_ALIGNED_POINTER(p, t) __BUS_SPACE_ALIGNED_ADDRESS(p, t)
#else
#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
#endif
?

This macro could be used in device drivers, where the checked buffer
is passed to bus_space_xxx() methods.

best regards
Matthias