Date: Thu, 15 Jul 2010 21:47:30 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r210140 - projects/ofed/head/sys/ofed/include/linux Message-ID: <201007152147.o6FLlUSH010449@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <vm/vm.h> +#include <vm/pmap.h> +#include <machine/pmap.h> + +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_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007152147.o6FLlUSH010449>