From owner-freebsd-arch Thu Jan 10 16:51:59 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by hub.freebsd.org (Postfix) with SMTP id 1362037B416 for ; Thu, 10 Jan 2002 16:51:49 -0800 (PST) Received: (qmail 13301 invoked by uid 0); 11 Jan 2002 00:51:46 -0000 Received: from p5086ff09.dip.t-dialin.net (HELO forge.local) (80.134.255.9) by mail.gmx.net (mp004-rz3) with SMTP; 11 Jan 2002 00:51:46 -0000 Received: from tmm by forge.local with local (Exim 3.30 #1) id 16OpvU-0002ej-00 for ; Fri, 11 Jan 2002 01:52:08 +0100 Date: Fri, 11 Jan 2002 01:52:07 +0100 From: Thomas Moestl To: freebsd-arch@FreeBSD.org Subject: adding more endian conversion and bus space functions Message-ID: <20020111005207.GA7246@crow.dom2ip.de> Mail-Followup-To: freebsd-arch@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, 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. 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 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. Comments? Suggestions? Thanks, - thomas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message