Subject: Re: pcitoh() and htopci()
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-kern
Date: 11/03/1999 12:22:28
Jason Thorpe <thorpej@nas.nasa.gov> writes:
> On Wed, 03 Nov 1999 11:06:45 +0100
> Lennart Augustsson <lennart@augustsson.net> wrote:
>
> > Just about every PCI device driver that is converted to work
> > on big-endian machines will need to do byte swapping.
> >
> > Should we define pcitoh() and htopci() macros in pci.h?
> > Currently each driver has its own homegrown definitions
> > (possibly with different names).
>
> No, because the names are wrong.
>
> What we need is:
>
> hto{le,be}{16,32}()
> {le,be}toh{16,32}()
Actually, I'd argue that you still want #defines to "pci-ish" names.
The reason is that there are very few places where people actually
need to worry about PCI bus endianness; e.g. the bus_space routines
paper over it, etc. using appropriately-named functions make the
logical intent clear: "use the endianness of the PCI (or somet other)
bus," rather than "use little endianness (or big endianness)."
cgd
--
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.