Date: Thu, 10 Jan 2002 20:45:55 -0700 (MST) From: "M. Warner Losh" <imp@village.org> To: tmoestl@gmx.net Cc: freebsd-arch@FreeBSD.ORG Subject: Re: adding more endian conversion and bus space functions Message-ID: <20020110.204555.14845956.imp@village.org> In-Reply-To: <20020111005207.GA7246@crow.dom2ip.de> References: <20020111005207.GA7246@crow.dom2ip.de>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20020111005207.GA7246@crow.dom2ip.de>
Thomas Moestl <tmoestl@gmx.net> writes:
: I'd like to propose some additions to the kernel endian conversion and
: bus space functions to aid the sparc64 port, taken from NetBSD:
:
: 1. htobe16(), htobe32(), htobe64(), htole16(), htole32(), htole64()
: be16toh(), be32toh(), be64toh(), le16toh(), le32toh() and le64toh(),
: to convert from the host byte order to big or little endian order
: and vice versa.
: 2. bswap16(), bswap32() and bswap64() to swap the endianess. The above
: functions could be implemented using these.
I think this is an excellent idea. We have some of the *le* functions
defined in the wi driver now.
: 3. stream variants of the bus space access functions; these become
: needed in the case where a bus system uses another endianess than
: the process, as is the case with PCI on sparc64. The normal bus
: space functions will perform byte-swapping as appropriate to convert
: the data to the host byte order (supported by hardware on sparc64).
: However if 16- or 32-bit accesses are used for stream data,
: i.e. data that should not be byte-swapped, these functions need be
: used instead.
: These will simply be defined to their non-stream counterparts on
: architectures where bus and processor byte order do not differ,
: i.e. all other currently supported architectures.
I think this may be a good thing...
: I would also like to make most of the machine/endian.h files MI, as
: sys/endian.h. The only thing that the MD files would still contain are
: the definintion of BYTE_ORDER and inline implementations of some
: functions. sys/endian.h would implemented the interfaces listed in 1.
: as well as htonl and friends for both BYTE_ORDERs.
I think that is a good idea.
Warner
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020110.204555.14845956.imp>
