From owner-svn-src-head@FreeBSD.ORG Sat Jun 6 09:33:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B43B71065670; Sat, 6 Jun 2009 09:33:32 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1B2E8FC2A; Sat, 6 Jun 2009 09:33:32 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n569XWZ0054747; Sat, 6 Jun 2009 09:33:32 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n569XWEu054745; Sat, 6 Jun 2009 09:33:32 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906060933.n569XWEu054745@svn.freebsd.org> From: Rafal Jaworowski Date: Sat, 6 Jun 2009 09:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193578 - in head/sys/powerpc: include powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jun 2009 09:33:33 -0000 Author: raj Date: Sat Jun 6 09:33:32 2009 New Revision: 193578 URL: http://svn.freebsd.org/changeset/base/193578 Log: Provide 64-bit big endian bus space operations for PowerPC. They are required for the upcoming sec(4) driver. Submitted by: Piotr Ziecik Obtained from: Semihalf Modified: head/sys/powerpc/include/pio.h head/sys/powerpc/powerpc/bus_machdep.c Modified: head/sys/powerpc/include/pio.h ============================================================================== --- head/sys/powerpc/include/pio.h Sat Jun 6 08:22:12 2009 (r193577) +++ head/sys/powerpc/include/pio.h Sat Jun 6 09:33:32 2009 (r193578) @@ -61,6 +61,13 @@ __outl(volatile u_int32_t *a, u_int32_t } static __inline void +__outll(volatile u_int64_t *a, u_int64_t v) +{ + *a = v; + __asm__ volatile("eieio; sync"); +} + +static __inline void __outwrb(volatile u_int16_t *a, u_int16_t v) { __asm__ volatile("sthbrx %0, 0, %1" :: "r"(v), "r"(a)); @@ -104,6 +111,16 @@ __inl(volatile u_int32_t *a) return _v_; } +static __inline u_int64_t +__inll(volatile u_int64_t *a) +{ + u_int64_t _v_; + + _v_ = *a; + __asm__ volatile("eieio; sync"); + return _v_; +} + static __inline u_int16_t __inwrb(volatile u_int16_t *a) { @@ -130,12 +147,16 @@ __inlrb(volatile u_int32_t *a) #define out16(a,v) outw(a,v) #define outl(a,v) (__outl((volatile u_int32_t *)(a), v)) #define out32(a,v) outl(a,v) +#define outll(a,v) (__outll((volatile u_int64_t *)(a), v)) +#define out64(a,v) outll(a,v) #define inb(a) (__inb((volatile u_int8_t *)(a))) #define in8(a) inb(a) #define inw(a) (__inw((volatile u_int16_t *)(a))) #define in16(a) inw(a) #define inl(a) (__inl((volatile u_int32_t *)(a))) #define in32(a) inl(a) +#define inll(a) (__inll((volatile u_int64_t *)(a))) +#define in64(a) inll(a) #define out8rb(a,v) outb(a,v) #define outwrb(a,v) (__outwrb((volatile u_int16_t *)(a), v)) @@ -174,6 +195,14 @@ __outsl(volatile u_int32_t *a, const u_i } static __inline void +__outsll(volatile u_int64_t *a, const u_int64_t *s, size_t c) +{ + while (c--) + *a = *s++; + __asm__ volatile("eieio; sync"); +} + +static __inline void __outswrb(volatile u_int16_t *a, const u_int16_t *s, size_t c) { while (c--) @@ -214,6 +243,14 @@ __insl(volatile u_int32_t *a, u_int32_t } static __inline void +__insll(volatile u_int64_t *a, u_int64_t *d, size_t c) +{ + while (c--) + *d++ = *a; + __asm__ volatile("eieio; sync"); +} + +static __inline void __inswrb(volatile u_int16_t *a, u_int16_t *d, size_t c) { while (c--) @@ -235,12 +272,16 @@ __inslrb(volatile u_int32_t *a, u_int32_ #define outs16(a,s,c) outsw(a,s,c) #define outsl(a,s,c) (__outsl((volatile u_int32_t *)(a), s, c)) #define outs32(a,s,c) outsl(a,s,c) +#define outsll(a,s,c) (__outsll((volatile u_int64_t *)(a), s, c)) +#define outs64(a,s,c) outsll(a,s,c) #define insb(a,d,c) (__insb((volatile u_int8_t *)(a), d, c)) #define ins8(a,d,c) insb(a,d,c) #define insw(a,d,c) (__insw((volatile u_int16_t *)(a), d, c)) #define ins16(a,d,c) insw(a,d,c) #define insl(a,d,c) (__insl((volatile u_int32_t *)(a), d, c)) #define ins32(a,d,c) insl(a,d,c) +#define insll(a,d,c) (__insll((volatile u_int64_t *)(a), d, c)) +#define ins64(a,d,c) insll(a,d,c) #define outs8rb(a,s,c) outsb(a,s,c) #define outswrb(a,s,c) (__outswrb((volatile u_int16_t *)(a), s, c)) Modified: head/sys/powerpc/powerpc/bus_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/bus_machdep.c Sat Jun 6 08:22:12 2009 (r193577) +++ head/sys/powerpc/powerpc/bus_machdep.c Sat Jun 6 09:33:32 2009 (r193578) @@ -190,7 +190,12 @@ bs_be_rs_4(bus_space_handle_t bsh, bus_s static uint64_t bs_be_rs_8(bus_space_handle_t bsh, bus_size_t ofs) { - TODO; + volatile uint64_t *addr; + uint64_t res; + + addr = __ppc_ba(bsh, ofs); + res = *addr; + return (res); } static void @@ -212,9 +217,9 @@ bs_be_rm_4(bus_space_handle_t bsh, bus_s } static void -bs_be_rm_8(bus_space_handle_t bshh, bus_size_t ofs, uint64_t *addr, size_t cnt) +bs_be_rm_8(bus_space_handle_t bsh, bus_size_t ofs, uint64_t *addr, size_t cnt) { - TODO; + ins64(__ppc_ba(bsh, ofs), addr, cnt); } static void @@ -250,7 +255,11 @@ bs_be_rr_4(bus_space_handle_t bsh, bus_s static void bs_be_rr_8(bus_space_handle_t bsh, bus_size_t ofs, uint64_t *addr, size_t cnt) { - TODO; + volatile uint64_t *s = __ppc_ba(bsh, ofs); + + while (cnt--) + *addr++ = *s++; + __asm __volatile("eieio; sync"); } static void @@ -286,7 +295,10 @@ bs_be_ws_4(bus_space_handle_t bsh, bus_s static void bs_be_ws_8(bus_space_handle_t bsh, bus_size_t ofs, uint64_t val) { - TODO; + volatile uint64_t *addr; + + addr = __ppc_ba(bsh, ofs); + *addr = val; } static void @@ -314,7 +326,7 @@ static void bs_be_wm_8(bus_space_handle_t bsh, bus_size_t ofs, const uint64_t *addr, bus_size_t cnt) { - TODO; + outsll(__ppc_ba(bsh, ofs), addr, cnt); } static void @@ -354,7 +366,11 @@ static void bs_be_wr_8(bus_space_handle_t bsh, bus_size_t ofs, const uint64_t *addr, size_t cnt) { - TODO; + volatile uint64_t *d = __ppc_ba(bsh, ofs); + + while (cnt--) + *d++ = *addr++; + __asm __volatile("eieio; sync"); } static void @@ -390,7 +406,11 @@ bs_be_sm_4(bus_space_handle_t bsh, bus_s static void bs_be_sm_8(bus_space_handle_t bsh, bus_size_t ofs, uint64_t val, size_t cnt) { - TODO; + volatile uint64_t *d = __ppc_ba(bsh, ofs); + + while (cnt--) + *d = val; + __asm __volatile("eieio; sync"); } static void @@ -426,7 +446,11 @@ bs_be_sr_4(bus_space_handle_t bsh, bus_s static void bs_be_sr_8(bus_space_handle_t bsh, bus_size_t ofs, uint64_t val, size_t cnt) { - TODO; + volatile uint64_t *d = __ppc_ba(bsh, ofs); + + while (cnt--) + *d++ = val; + __asm __volatile("eieio; sync"); } /*