From owner-svn-src-projects@FreeBSD.ORG Thu Jul 15 21:47:30 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D47AF106567B; Thu, 15 Jul 2010 21:47:30 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9DE68FC08; Thu, 15 Jul 2010 21:47:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6FLlUtK010451; Thu, 15 Jul 2010 21:47:30 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6FLlUSH010449; Thu, 15 Jul 2010 21:47:30 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201007152147.o6FLlUSH010449@svn.freebsd.org> From: Jeff Roberson Date: Thu, 15 Jul 2010 21:47:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210140 - projects/ofed/head/sys/ofed/include/linux X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2010 21:47:30 -0000 Author: jeff Date: Thu Jul 15 21:47:30 2010 New Revision: 210140 URL: http://svn.freebsd.org/changeset/base/210140 Log: - Add a somewhat x86/amd64 specific set of io routines. Using bus space is complicated because linux passes only physical/virtual addresses around while bus-space wants an opaque tag. We may have to create a hash for platforms which can't directly access io memory. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/linux/io.h Modified: projects/ofed/head/sys/ofed/include/linux/io.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/io.h Thu Jul 15 21:44:26 2010 (r210139) +++ projects/ofed/head/sys/ofed/include/linux/io.h Thu Jul 15 21:47:30 2010 (r210140) @@ -29,6 +29,22 @@ #ifndef _LINUX_IO_H_ #define _LINUX_IO_H_ +#include +#include +#include + +static inline uint32_t +__raw_readl(const volatile void *addr) +{ + return *(const volatile uint32_t *)addr; +} + +static inline void +__raw_writel(uint32_t b, volatile void *addr) +{ + *(volatile uint32_t *)addr = b; +} + static inline uint64_t __raw_readq(const volatile void *addr) { @@ -41,4 +57,44 @@ __raw_writeq(uint64_t b, volatile void * *(volatile uint64_t *)addr = b; } +/* + * XXX This is all x86 specific. It should be bus space access. + */ +#define mmiowb() + +#undef writel +static inline void +writel(uint32_t b, void *addr) +{ + *(volatile uint32_t *)addr = b; +} + +#undef writeq +static inline void +writeq(uint64_t b, void *addr) +{ + *(volatile uint64_t *)addr = b; +} + +#undef writeb +static inline void +writeb(uint8_t b, void *addr) +{ + *(volatile uint8_t *)addr = b; +} + +#undef writew +static inline void +writew(uint16_t b, void *addr) +{ + *(volatile uint16_t *)addr = b; +} + +#define ioremap pmap_mapdev + +/* + * iounmap is not defined as pmap_unmapdev requires a length that can + * not easily be determined on BSD. + */ + #endif /* _LINUX_IO_H_ */