From owner-svn-src-head@FreeBSD.ORG Tue Jan 20 22:57:00 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D14A261B; Tue, 20 Jan 2015 22:57:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B122DA61; Tue, 20 Jan 2015 22:57:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0KMv0RS086897; Tue, 20 Jan 2015 22:57:00 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0KMv0Bi086894; Tue, 20 Jan 2015 22:57:00 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201501202257.t0KMv0Bi086894@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 20 Jan 2015 22:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277454 - in head/sys/arm: arm include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 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: Tue, 20 Jan 2015 22:57:00 -0000 Author: ian Date: Tue Jan 20 22:56:59 2015 New Revision: 277454 URL: https://svnweb.freebsd.org/changeset/base/277454 Log: Add inline implementations of arm bus_space_read/write_N(). Reviewed by: cognet Modified: head/sys/arm/arm/bus_space-v6.c head/sys/arm/include/bus.h Modified: head/sys/arm/arm/bus_space-v6.c ============================================================================== --- head/sys/arm/arm/bus_space-v6.c Tue Jan 20 22:51:29 2015 (r277453) +++ head/sys/arm/arm/bus_space-v6.c Tue Jan 20 22:56:59 2015 (r277454) @@ -65,10 +65,10 @@ static struct bus_space _base_tag = { generic_bs_barrier, /* read (single) */ - generic_bs_r_1, - generic_armv4_bs_r_2, - generic_bs_r_4, - NULL, + NULL, /* bs_r_1, Use inline code in bus.h */ + NULL, /* bs_r_2, Use inline code in bus.h */ + NULL, /* bs_r_4, Use inline code in bus.h */ + NULL, /* bs_r_8, Use inline code in bus.h */ /* read multiple */ generic_bs_rm_1, @@ -83,10 +83,10 @@ static struct bus_space _base_tag = { NULL, /* write (single) */ - generic_bs_w_1, - generic_armv4_bs_w_2, - generic_bs_w_4, - NULL, + NULL, /* bs_w_1, Use inline code in bus.h */ + NULL, /* bs_w_2, Use inline code in bus.h */ + NULL, /* bs_w_4, Use inline code in bus.h */ + NULL, /* bs_w_8, Use inline code in bus.h */ /* write multiple */ generic_bs_wm_1, @@ -119,10 +119,10 @@ static struct bus_space _base_tag = { NULL, /* read stream (single) */ - NULL, - NULL, - NULL, - NULL, + NULL, /* bs_r_1_s, Use inline code in bus.h */ + NULL, /* bs_r_2_s, Use inline code in bus.h */ + NULL, /* bs_r_4_s, Use inline code in bus.h */ + NULL, /* bs_r_8_s, Use inline code in bus.h */ /* read multiple stream */ NULL, @@ -137,10 +137,10 @@ static struct bus_space _base_tag = { NULL, /* write stream (single) */ - NULL, - NULL, - NULL, - NULL, + NULL, /* bs_w_1_s, Use inline code in bus.h */ + NULL, /* bs_w_2_s, Use inline code in bus.h */ + NULL, /* bs_w_4_s, Use inline code in bus.h */ + NULL, /* bs_w_8_s, Use inline code in bus.h */ /* write multiple stream */ NULL, Modified: head/sys/arm/include/bus.h ============================================================================== --- head/sys/arm/include/bus.h Tue Jan 20 22:51:29 2015 (r277453) +++ head/sys/arm/include/bus.h Tue Jan 20 22:56:59 2015 (r277454) @@ -252,10 +252,6 @@ struct bus_space { #define __bs_c(a,b) __CONCAT(a,b) #define __bs_opname(op,size) __bs_c(__bs_c(__bs_c(bs_,op),_),size) -#define __bs_rs(sz, t, h, o) \ - (*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o) -#define __bs_ws(sz, t, h, o, v) \ - (*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v) #define __bs_nonsingle(type, sz, t, h, o, a, c) \ (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c) #define __bs_set(type, sz, t, h, o, v, c) \ @@ -272,6 +268,28 @@ struct bus_space { (*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c) +#define __generate_inline_bs_rs(IFN, MBR, TYP) \ + static inline TYP \ + IFN(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) \ + { \ + \ + if (__predict_true(t->MBR == NULL)) \ + return (*(volatile TYP *)(h + o)); \ + else \ + return (t->MBR(t->bs_cookie, h, o)); \ + } + +#define __generate_inline_bs_ws(IFN, MBR, TYP) \ + static inline void \ + IFN(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, TYP v)\ + { \ + \ + if (__predict_true(t->MBR == NULL)) \ + *(volatile TYP *)(h + o) = v; \ + else \ + t->MBR(t->bs_cookie, h, o, v); \ + } + /* * Mapping and unmapping operations. */ @@ -304,15 +322,15 @@ struct bus_space { /* * Bus read (single) operations. */ -#define bus_space_read_1(t, h, o) __bs_rs(1,(t),(h),(o)) -#define bus_space_read_2(t, h, o) __bs_rs(2,(t),(h),(o)) -#define bus_space_read_4(t, h, o) __bs_rs(4,(t),(h),(o)) -#define bus_space_read_8(t, h, o) __bs_rs(8,(t),(h),(o)) - -#define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t), (h), (o)) -#define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t), (h), (o)) -#define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t), (h), (o)) -#define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,8,(t),(h),(o)) +__generate_inline_bs_rs(bus_space_read_1, bs_r_1, uint8_t); +__generate_inline_bs_rs(bus_space_read_2, bs_r_2, uint16_t); +__generate_inline_bs_rs(bus_space_read_4, bs_r_4, uint32_t); +__generate_inline_bs_rs(bus_space_read_8, bs_r_8, uint64_t); + +__generate_inline_bs_rs(bus_space_read_stream_1, bs_r_1_s, uint8_t); +__generate_inline_bs_rs(bus_space_read_stream_2, bs_r_2_s, uint16_t); +__generate_inline_bs_rs(bus_space_read_stream_4, bs_r_4_s, uint32_t); +__generate_inline_bs_rs(bus_space_read_stream_8, bs_r_8_s, uint64_t); /* * Bus read multiple operations. @@ -361,15 +379,15 @@ struct bus_space { /* * Bus write (single) operations. */ -#define bus_space_write_1(t, h, o, v) __bs_ws(1,(t),(h),(o),(v)) -#define bus_space_write_2(t, h, o, v) __bs_ws(2,(t),(h),(o),(v)) -#define bus_space_write_4(t, h, o, v) __bs_ws(4,(t),(h),(o),(v)) -#define bus_space_write_8(t, h, o, v) __bs_ws(8,(t),(h),(o),(v)) - -#define bus_space_write_stream_1(t, h, o, v) __bs_ws_s(1,(t),(h),(o),(v)) -#define bus_space_write_stream_2(t, h, o, v) __bs_ws_s(2,(t),(h),(o),(v)) -#define bus_space_write_stream_4(t, h, o, v) __bs_ws_s(4,(t),(h),(o),(v)) -#define bus_space_write_stream_8(t, h, o, v) __bs_ws_s(8,(t),(h),(o),(v)) +__generate_inline_bs_ws(bus_space_write_1, bs_w_1, uint8_t); +__generate_inline_bs_ws(bus_space_write_2, bs_w_2, uint16_t); +__generate_inline_bs_ws(bus_space_write_4, bs_w_4, uint32_t); +__generate_inline_bs_ws(bus_space_write_8, bs_w_8, uint64_t); + +__generate_inline_bs_ws(bus_space_write_stream_1, bs_w_1_s, uint8_t); +__generate_inline_bs_ws(bus_space_write_stream_2, bs_w_2_s, uint16_t); +__generate_inline_bs_ws(bus_space_write_stream_4, bs_w_4_s, uint32_t); +__generate_inline_bs_ws(bus_space_write_stream_8, bs_w_8_s, uint64_t); /*