16fc729afSOlivier Houchard /* $NetBSD: bus.h,v 1.11 2003/07/28 17:35:54 thorpej Exp $ */ 26fc729afSOlivier Houchard 36fc729afSOlivier Houchard /*- 46fc729afSOlivier Houchard * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. 56fc729afSOlivier Houchard * All rights reserved. 66fc729afSOlivier Houchard * 76fc729afSOlivier Houchard * This code is derived from software contributed to The NetBSD Foundation 86fc729afSOlivier Houchard * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 96fc729afSOlivier Houchard * NASA Ames Research Center. 106fc729afSOlivier Houchard * 116fc729afSOlivier Houchard * Redistribution and use in source and binary forms, with or without 126fc729afSOlivier Houchard * modification, are permitted provided that the following conditions 136fc729afSOlivier Houchard * are met: 146fc729afSOlivier Houchard * 1. Redistributions of source code must retain the above copyright 156fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer. 166fc729afSOlivier Houchard * 2. Redistributions in binary form must reproduce the above copyright 176fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer in the 186fc729afSOlivier Houchard * documentation and/or other materials provided with the distribution. 196fc729afSOlivier Houchard * 206fc729afSOlivier Houchard * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 216fc729afSOlivier Houchard * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 226fc729afSOlivier Houchard * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 236fc729afSOlivier Houchard * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 246fc729afSOlivier Houchard * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 256fc729afSOlivier Houchard * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 266fc729afSOlivier Houchard * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 276fc729afSOlivier Houchard * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 286fc729afSOlivier Houchard * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 296fc729afSOlivier Houchard * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 306fc729afSOlivier Houchard * POSSIBILITY OF SUCH DAMAGE. 316fc729afSOlivier Houchard */ 326fc729afSOlivier Houchard 33d8315c79SWarner Losh /*- 346fc729afSOlivier Houchard * Copyright (c) 1996 Charles M. Hannum. All rights reserved. 356fc729afSOlivier Houchard * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 366fc729afSOlivier Houchard * 376fc729afSOlivier Houchard * Redistribution and use in source and binary forms, with or without 386fc729afSOlivier Houchard * modification, are permitted provided that the following conditions 396fc729afSOlivier Houchard * are met: 406fc729afSOlivier Houchard * 1. Redistributions of source code must retain the above copyright 416fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer. 426fc729afSOlivier Houchard * 2. Redistributions in binary form must reproduce the above copyright 436fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer in the 446fc729afSOlivier Houchard * documentation and/or other materials provided with the distribution. 456fc729afSOlivier Houchard * 3. All advertising materials mentioning features or use of this software 466fc729afSOlivier Houchard * must display the following acknowledgement: 476fc729afSOlivier Houchard * This product includes software developed by Christopher G. Demetriou 486fc729afSOlivier Houchard * for the NetBSD Project. 496fc729afSOlivier Houchard * 4. The name of the author may not be used to endorse or promote products 506fc729afSOlivier Houchard * derived from this software without specific prior written permission 516fc729afSOlivier Houchard * 526fc729afSOlivier Houchard * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 536fc729afSOlivier Houchard * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 546fc729afSOlivier Houchard * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 556fc729afSOlivier Houchard * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 566fc729afSOlivier Houchard * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 576fc729afSOlivier Houchard * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 586fc729afSOlivier Houchard * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 596fc729afSOlivier Houchard * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 606fc729afSOlivier Houchard * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 616fc729afSOlivier Houchard * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 626fc729afSOlivier Houchard * 636fc729afSOlivier Houchard * $FreeBSD$ 646fc729afSOlivier Houchard */ 656fc729afSOlivier Houchard 666fc729afSOlivier Houchard #ifndef _MACHINE_BUS_H_ 676fc729afSOlivier Houchard #define _MACHINE_BUS_H_ 686fc729afSOlivier Houchard 6906db52b6SWarner Losh #include <machine/_bus.h> 706fc729afSOlivier Houchard 716fc729afSOlivier Houchard /* 726fc729afSOlivier Houchard * int bus_space_map (bus_space_tag_t t, bus_addr_t addr, 736fc729afSOlivier Houchard * bus_size_t size, int flags, bus_space_handle_t *bshp); 746fc729afSOlivier Houchard * 756fc729afSOlivier Houchard * Map a region of bus space. 766fc729afSOlivier Houchard */ 776fc729afSOlivier Houchard 786fc729afSOlivier Houchard #define BUS_SPACE_MAP_CACHEABLE 0x01 796fc729afSOlivier Houchard #define BUS_SPACE_MAP_LINEAR 0x02 806fc729afSOlivier Houchard #define BUS_SPACE_MAP_PREFETCHABLE 0x04 816fc729afSOlivier Houchard 826fc729afSOlivier Houchard struct bus_space { 836fc729afSOlivier Houchard /* cookie */ 846fc729afSOlivier Houchard void *bs_cookie; 856fc729afSOlivier Houchard 866fc729afSOlivier Houchard /* mapping/unmapping */ 876fc729afSOlivier Houchard int (*bs_map) (void *, bus_addr_t, bus_size_t, 886fc729afSOlivier Houchard int, bus_space_handle_t *); 89588a2322SSam Leffler void (*bs_unmap) (void *, bus_space_handle_t, bus_size_t); 906fc729afSOlivier Houchard int (*bs_subregion) (void *, bus_space_handle_t, 916fc729afSOlivier Houchard bus_size_t, bus_size_t, bus_space_handle_t *); 926fc729afSOlivier Houchard 936fc729afSOlivier Houchard /* allocation/deallocation */ 946fc729afSOlivier Houchard int (*bs_alloc) (void *, bus_addr_t, bus_addr_t, 956fc729afSOlivier Houchard bus_size_t, bus_size_t, bus_size_t, int, 966fc729afSOlivier Houchard bus_addr_t *, bus_space_handle_t *); 976fc729afSOlivier Houchard void (*bs_free) (void *, bus_space_handle_t, 986fc729afSOlivier Houchard bus_size_t); 996fc729afSOlivier Houchard 1006fc729afSOlivier Houchard /* get kernel virtual address */ 1016fc729afSOlivier Houchard /* barrier */ 1026fc729afSOlivier Houchard void (*bs_barrier) (void *, bus_space_handle_t, 1036fc729afSOlivier Houchard bus_size_t, bus_size_t, int); 1046fc729afSOlivier Houchard 1056fc729afSOlivier Houchard /* read (single) */ 1066fc729afSOlivier Houchard u_int8_t (*bs_r_1) (void *, bus_space_handle_t, bus_size_t); 1076fc729afSOlivier Houchard u_int16_t (*bs_r_2) (void *, bus_space_handle_t, bus_size_t); 1086fc729afSOlivier Houchard u_int32_t (*bs_r_4) (void *, bus_space_handle_t, bus_size_t); 1096fc729afSOlivier Houchard u_int64_t (*bs_r_8) (void *, bus_space_handle_t, bus_size_t); 1106fc729afSOlivier Houchard 1116fc729afSOlivier Houchard /* read multiple */ 1126fc729afSOlivier Houchard void (*bs_rm_1) (void *, bus_space_handle_t, bus_size_t, 1136fc729afSOlivier Houchard u_int8_t *, bus_size_t); 1146fc729afSOlivier Houchard void (*bs_rm_2) (void *, bus_space_handle_t, bus_size_t, 1156fc729afSOlivier Houchard u_int16_t *, bus_size_t); 1166fc729afSOlivier Houchard void (*bs_rm_4) (void *, bus_space_handle_t, 1176fc729afSOlivier Houchard bus_size_t, u_int32_t *, bus_size_t); 1186fc729afSOlivier Houchard void (*bs_rm_8) (void *, bus_space_handle_t, 1196fc729afSOlivier Houchard bus_size_t, u_int64_t *, bus_size_t); 1206fc729afSOlivier Houchard 1216fc729afSOlivier Houchard /* read region */ 1226fc729afSOlivier Houchard void (*bs_rr_1) (void *, bus_space_handle_t, 1236fc729afSOlivier Houchard bus_size_t, u_int8_t *, bus_size_t); 1246fc729afSOlivier Houchard void (*bs_rr_2) (void *, bus_space_handle_t, 1256fc729afSOlivier Houchard bus_size_t, u_int16_t *, bus_size_t); 1266fc729afSOlivier Houchard void (*bs_rr_4) (void *, bus_space_handle_t, 1276fc729afSOlivier Houchard bus_size_t, u_int32_t *, bus_size_t); 1286fc729afSOlivier Houchard void (*bs_rr_8) (void *, bus_space_handle_t, 1296fc729afSOlivier Houchard bus_size_t, u_int64_t *, bus_size_t); 1306fc729afSOlivier Houchard 1316fc729afSOlivier Houchard /* write (single) */ 1326fc729afSOlivier Houchard void (*bs_w_1) (void *, bus_space_handle_t, 1336fc729afSOlivier Houchard bus_size_t, u_int8_t); 1346fc729afSOlivier Houchard void (*bs_w_2) (void *, bus_space_handle_t, 1356fc729afSOlivier Houchard bus_size_t, u_int16_t); 1366fc729afSOlivier Houchard void (*bs_w_4) (void *, bus_space_handle_t, 1376fc729afSOlivier Houchard bus_size_t, u_int32_t); 1386fc729afSOlivier Houchard void (*bs_w_8) (void *, bus_space_handle_t, 1396fc729afSOlivier Houchard bus_size_t, u_int64_t); 1406fc729afSOlivier Houchard 1416fc729afSOlivier Houchard /* write multiple */ 1426fc729afSOlivier Houchard void (*bs_wm_1) (void *, bus_space_handle_t, 1436fc729afSOlivier Houchard bus_size_t, const u_int8_t *, bus_size_t); 1446fc729afSOlivier Houchard void (*bs_wm_2) (void *, bus_space_handle_t, 1456fc729afSOlivier Houchard bus_size_t, const u_int16_t *, bus_size_t); 1466fc729afSOlivier Houchard void (*bs_wm_4) (void *, bus_space_handle_t, 1476fc729afSOlivier Houchard bus_size_t, const u_int32_t *, bus_size_t); 1486fc729afSOlivier Houchard void (*bs_wm_8) (void *, bus_space_handle_t, 1496fc729afSOlivier Houchard bus_size_t, const u_int64_t *, bus_size_t); 1506fc729afSOlivier Houchard 1516fc729afSOlivier Houchard /* write region */ 1526fc729afSOlivier Houchard void (*bs_wr_1) (void *, bus_space_handle_t, 1536fc729afSOlivier Houchard bus_size_t, const u_int8_t *, bus_size_t); 1546fc729afSOlivier Houchard void (*bs_wr_2) (void *, bus_space_handle_t, 1556fc729afSOlivier Houchard bus_size_t, const u_int16_t *, bus_size_t); 1566fc729afSOlivier Houchard void (*bs_wr_4) (void *, bus_space_handle_t, 1576fc729afSOlivier Houchard bus_size_t, const u_int32_t *, bus_size_t); 1586fc729afSOlivier Houchard void (*bs_wr_8) (void *, bus_space_handle_t, 1596fc729afSOlivier Houchard bus_size_t, const u_int64_t *, bus_size_t); 1606fc729afSOlivier Houchard 1616fc729afSOlivier Houchard /* set multiple */ 1626fc729afSOlivier Houchard void (*bs_sm_1) (void *, bus_space_handle_t, 1636fc729afSOlivier Houchard bus_size_t, u_int8_t, bus_size_t); 1646fc729afSOlivier Houchard void (*bs_sm_2) (void *, bus_space_handle_t, 1656fc729afSOlivier Houchard bus_size_t, u_int16_t, bus_size_t); 1666fc729afSOlivier Houchard void (*bs_sm_4) (void *, bus_space_handle_t, 1676fc729afSOlivier Houchard bus_size_t, u_int32_t, bus_size_t); 1686fc729afSOlivier Houchard void (*bs_sm_8) (void *, bus_space_handle_t, 1696fc729afSOlivier Houchard bus_size_t, u_int64_t, bus_size_t); 1706fc729afSOlivier Houchard 1716fc729afSOlivier Houchard /* set region */ 1726fc729afSOlivier Houchard void (*bs_sr_1) (void *, bus_space_handle_t, 1736fc729afSOlivier Houchard bus_size_t, u_int8_t, bus_size_t); 1746fc729afSOlivier Houchard void (*bs_sr_2) (void *, bus_space_handle_t, 1756fc729afSOlivier Houchard bus_size_t, u_int16_t, bus_size_t); 1766fc729afSOlivier Houchard void (*bs_sr_4) (void *, bus_space_handle_t, 1776fc729afSOlivier Houchard bus_size_t, u_int32_t, bus_size_t); 1786fc729afSOlivier Houchard void (*bs_sr_8) (void *, bus_space_handle_t, 1796fc729afSOlivier Houchard bus_size_t, u_int64_t, bus_size_t); 1806fc729afSOlivier Houchard 1816fc729afSOlivier Houchard /* copy */ 1826fc729afSOlivier Houchard void (*bs_c_1) (void *, bus_space_handle_t, bus_size_t, 1836fc729afSOlivier Houchard bus_space_handle_t, bus_size_t, bus_size_t); 1846fc729afSOlivier Houchard void (*bs_c_2) (void *, bus_space_handle_t, bus_size_t, 1856fc729afSOlivier Houchard bus_space_handle_t, bus_size_t, bus_size_t); 1866fc729afSOlivier Houchard void (*bs_c_4) (void *, bus_space_handle_t, bus_size_t, 1876fc729afSOlivier Houchard bus_space_handle_t, bus_size_t, bus_size_t); 1886fc729afSOlivier Houchard void (*bs_c_8) (void *, bus_space_handle_t, bus_size_t, 1896fc729afSOlivier Houchard bus_space_handle_t, bus_size_t, bus_size_t); 1906fc729afSOlivier Houchard 191588a2322SSam Leffler /* read stream (single) */ 192588a2322SSam Leffler u_int8_t (*bs_r_1_s) (void *, bus_space_handle_t, bus_size_t); 193588a2322SSam Leffler u_int16_t (*bs_r_2_s) (void *, bus_space_handle_t, bus_size_t); 194588a2322SSam Leffler u_int32_t (*bs_r_4_s) (void *, bus_space_handle_t, bus_size_t); 195588a2322SSam Leffler u_int64_t (*bs_r_8_s) (void *, bus_space_handle_t, bus_size_t); 196588a2322SSam Leffler 197588a2322SSam Leffler /* read multiple stream */ 198588a2322SSam Leffler void (*bs_rm_1_s) (void *, bus_space_handle_t, bus_size_t, 199588a2322SSam Leffler u_int8_t *, bus_size_t); 200588a2322SSam Leffler void (*bs_rm_2_s) (void *, bus_space_handle_t, bus_size_t, 201588a2322SSam Leffler u_int16_t *, bus_size_t); 202588a2322SSam Leffler void (*bs_rm_4_s) (void *, bus_space_handle_t, 203588a2322SSam Leffler bus_size_t, u_int32_t *, bus_size_t); 204588a2322SSam Leffler void (*bs_rm_8_s) (void *, bus_space_handle_t, 205588a2322SSam Leffler bus_size_t, u_int64_t *, bus_size_t); 206588a2322SSam Leffler 207588a2322SSam Leffler /* read region stream */ 208588a2322SSam Leffler void (*bs_rr_1_s) (void *, bus_space_handle_t, 209588a2322SSam Leffler bus_size_t, u_int8_t *, bus_size_t); 210588a2322SSam Leffler void (*bs_rr_2_s) (void *, bus_space_handle_t, 211588a2322SSam Leffler bus_size_t, u_int16_t *, bus_size_t); 212588a2322SSam Leffler void (*bs_rr_4_s) (void *, bus_space_handle_t, 213588a2322SSam Leffler bus_size_t, u_int32_t *, bus_size_t); 214588a2322SSam Leffler void (*bs_rr_8_s) (void *, bus_space_handle_t, 215588a2322SSam Leffler bus_size_t, u_int64_t *, bus_size_t); 216588a2322SSam Leffler 217588a2322SSam Leffler /* write stream (single) */ 218588a2322SSam Leffler void (*bs_w_1_s) (void *, bus_space_handle_t, 219588a2322SSam Leffler bus_size_t, u_int8_t); 220588a2322SSam Leffler void (*bs_w_2_s) (void *, bus_space_handle_t, 221588a2322SSam Leffler bus_size_t, u_int16_t); 222588a2322SSam Leffler void (*bs_w_4_s) (void *, bus_space_handle_t, 223588a2322SSam Leffler bus_size_t, u_int32_t); 224588a2322SSam Leffler void (*bs_w_8_s) (void *, bus_space_handle_t, 225588a2322SSam Leffler bus_size_t, u_int64_t); 226588a2322SSam Leffler 227588a2322SSam Leffler /* write multiple stream */ 228588a2322SSam Leffler void (*bs_wm_1_s) (void *, bus_space_handle_t, 229588a2322SSam Leffler bus_size_t, const u_int8_t *, bus_size_t); 230588a2322SSam Leffler void (*bs_wm_2_s) (void *, bus_space_handle_t, 231588a2322SSam Leffler bus_size_t, const u_int16_t *, bus_size_t); 232588a2322SSam Leffler void (*bs_wm_4_s) (void *, bus_space_handle_t, 233588a2322SSam Leffler bus_size_t, const u_int32_t *, bus_size_t); 234588a2322SSam Leffler void (*bs_wm_8_s) (void *, bus_space_handle_t, 235588a2322SSam Leffler bus_size_t, const u_int64_t *, bus_size_t); 236588a2322SSam Leffler 237588a2322SSam Leffler /* write region stream */ 238588a2322SSam Leffler void (*bs_wr_1_s) (void *, bus_space_handle_t, 239588a2322SSam Leffler bus_size_t, const u_int8_t *, bus_size_t); 240588a2322SSam Leffler void (*bs_wr_2_s) (void *, bus_space_handle_t, 241588a2322SSam Leffler bus_size_t, const u_int16_t *, bus_size_t); 242588a2322SSam Leffler void (*bs_wr_4_s) (void *, bus_space_handle_t, 243588a2322SSam Leffler bus_size_t, const u_int32_t *, bus_size_t); 244588a2322SSam Leffler void (*bs_wr_8_s) (void *, bus_space_handle_t, 245588a2322SSam Leffler bus_size_t, const u_int64_t *, bus_size_t); 2466fc729afSOlivier Houchard }; 2476fc729afSOlivier Houchard 2486fc729afSOlivier Houchard 2496fc729afSOlivier Houchard /* 2506fc729afSOlivier Houchard * Utility macros; INTERNAL USE ONLY. 2516fc729afSOlivier Houchard */ 2526fc729afSOlivier Houchard #define __bs_c(a,b) __CONCAT(a,b) 2536fc729afSOlivier Houchard #define __bs_opname(op,size) __bs_c(__bs_c(__bs_c(bs_,op),_),size) 2546fc729afSOlivier Houchard 2556fc729afSOlivier Houchard #define __bs_rs(sz, t, h, o) \ 2566fc729afSOlivier Houchard (*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o) 2576fc729afSOlivier Houchard #define __bs_ws(sz, t, h, o, v) \ 2586fc729afSOlivier Houchard (*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v) 2596fc729afSOlivier Houchard #define __bs_nonsingle(type, sz, t, h, o, a, c) \ 2606fc729afSOlivier Houchard (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c) 2616fc729afSOlivier Houchard #define __bs_set(type, sz, t, h, o, v, c) \ 2626fc729afSOlivier Houchard (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c) 2636fc729afSOlivier Houchard #define __bs_copy(sz, t, h1, o1, h2, o2, cnt) \ 2646fc729afSOlivier Houchard (*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt) 2656fc729afSOlivier Houchard 266588a2322SSam Leffler #define __bs_opname_s(op,size) __bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s) 267588a2322SSam Leffler #define __bs_rs_s(sz, t, h, o) \ 268588a2322SSam Leffler (*(t)->__bs_opname_s(r,sz))((t)->bs_cookie, h, o) 269588a2322SSam Leffler #define __bs_ws_s(sz, t, h, o, v) \ 270588a2322SSam Leffler (*(t)->__bs_opname_s(w,sz))((t)->bs_cookie, h, o, v) 271588a2322SSam Leffler #define __bs_nonsingle_s(type, sz, t, h, o, a, c) \ 272588a2322SSam Leffler (*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c) 273588a2322SSam Leffler 2746fc729afSOlivier Houchard 2756fc729afSOlivier Houchard /* 2766fc729afSOlivier Houchard * Mapping and unmapping operations. 2776fc729afSOlivier Houchard */ 2786fc729afSOlivier Houchard #define bus_space_map(t, a, s, c, hp) \ 2796fc729afSOlivier Houchard (*(t)->bs_map)((t)->bs_cookie, (a), (s), (c), (hp)) 2806fc729afSOlivier Houchard #define bus_space_unmap(t, h, s) \ 2816fc729afSOlivier Houchard (*(t)->bs_unmap)((t)->bs_cookie, (h), (s)) 2826fc729afSOlivier Houchard #define bus_space_subregion(t, h, o, s, hp) \ 2836fc729afSOlivier Houchard (*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp)) 2846fc729afSOlivier Houchard 2856fc729afSOlivier Houchard 2866fc729afSOlivier Houchard /* 2876fc729afSOlivier Houchard * Allocation and deallocation operations. 2886fc729afSOlivier Houchard */ 2896fc729afSOlivier Houchard #define bus_space_alloc(t, rs, re, s, a, b, c, ap, hp) \ 2906fc729afSOlivier Houchard (*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b), \ 2916fc729afSOlivier Houchard (c), (ap), (hp)) 2926fc729afSOlivier Houchard #define bus_space_free(t, h, s) \ 2936fc729afSOlivier Houchard (*(t)->bs_free)((t)->bs_cookie, (h), (s)) 2946fc729afSOlivier Houchard 2956fc729afSOlivier Houchard /* 2966fc729afSOlivier Houchard * Bus barrier operations. 2976fc729afSOlivier Houchard */ 2986fc729afSOlivier Houchard #define bus_space_barrier(t, h, o, l, f) \ 2996fc729afSOlivier Houchard (*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f)) 3006fc729afSOlivier Houchard 3016fc729afSOlivier Houchard #define BUS_SPACE_BARRIER_READ 0x01 3026fc729afSOlivier Houchard #define BUS_SPACE_BARRIER_WRITE 0x02 3036fc729afSOlivier Houchard 3046fc729afSOlivier Houchard /* 3056fc729afSOlivier Houchard * Bus read (single) operations. 3066fc729afSOlivier Houchard */ 3076fc729afSOlivier Houchard #define bus_space_read_1(t, h, o) __bs_rs(1,(t),(h),(o)) 3086fc729afSOlivier Houchard #define bus_space_read_2(t, h, o) __bs_rs(2,(t),(h),(o)) 3096fc729afSOlivier Houchard #define bus_space_read_4(t, h, o) __bs_rs(4,(t),(h),(o)) 3106fc729afSOlivier Houchard #define bus_space_read_8(t, h, o) __bs_rs(8,(t),(h),(o)) 3116fc729afSOlivier Houchard 312588a2322SSam Leffler #define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t), (h), (o)) 313588a2322SSam Leffler #define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t), (h), (o)) 314588a2322SSam Leffler #define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t), (h), (o)) 315588a2322SSam Leffler #define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,8,(t),(h),(o)) 3166fc729afSOlivier Houchard 3176fc729afSOlivier Houchard /* 3186fc729afSOlivier Houchard * Bus read multiple operations. 3196fc729afSOlivier Houchard */ 3206fc729afSOlivier Houchard #define bus_space_read_multi_1(t, h, o, a, c) \ 3216fc729afSOlivier Houchard __bs_nonsingle(rm,1,(t),(h),(o),(a),(c)) 3226fc729afSOlivier Houchard #define bus_space_read_multi_2(t, h, o, a, c) \ 3236fc729afSOlivier Houchard __bs_nonsingle(rm,2,(t),(h),(o),(a),(c)) 3246fc729afSOlivier Houchard #define bus_space_read_multi_4(t, h, o, a, c) \ 3256fc729afSOlivier Houchard __bs_nonsingle(rm,4,(t),(h),(o),(a),(c)) 3266fc729afSOlivier Houchard #define bus_space_read_multi_8(t, h, o, a, c) \ 3276fc729afSOlivier Houchard __bs_nonsingle(rm,8,(t),(h),(o),(a),(c)) 3286fc729afSOlivier Houchard 329588a2322SSam Leffler #define bus_space_read_multi_stream_1(t, h, o, a, c) \ 330588a2322SSam Leffler __bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c)) 331588a2322SSam Leffler #define bus_space_read_multi_stream_2(t, h, o, a, c) \ 332588a2322SSam Leffler __bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c)) 333588a2322SSam Leffler #define bus_space_read_multi_stream_4(t, h, o, a, c) \ 334588a2322SSam Leffler __bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c)) 335588a2322SSam Leffler #define bus_space_read_multi_stream_8(t, h, o, a, c) \ 336588a2322SSam Leffler __bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c)) 337588a2322SSam Leffler 3386fc729afSOlivier Houchard 3396fc729afSOlivier Houchard /* 3406fc729afSOlivier Houchard * Bus read region operations. 3416fc729afSOlivier Houchard */ 3426fc729afSOlivier Houchard #define bus_space_read_region_1(t, h, o, a, c) \ 3436fc729afSOlivier Houchard __bs_nonsingle(rr,1,(t),(h),(o),(a),(c)) 3446fc729afSOlivier Houchard #define bus_space_read_region_2(t, h, o, a, c) \ 3456fc729afSOlivier Houchard __bs_nonsingle(rr,2,(t),(h),(o),(a),(c)) 3466fc729afSOlivier Houchard #define bus_space_read_region_4(t, h, o, a, c) \ 3476fc729afSOlivier Houchard __bs_nonsingle(rr,4,(t),(h),(o),(a),(c)) 3486fc729afSOlivier Houchard #define bus_space_read_region_8(t, h, o, a, c) \ 3496fc729afSOlivier Houchard __bs_nonsingle(rr,8,(t),(h),(o),(a),(c)) 3506fc729afSOlivier Houchard 351588a2322SSam Leffler #define bus_space_read_region_stream_1(t, h, o, a, c) \ 352588a2322SSam Leffler __bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c)) 353588a2322SSam Leffler #define bus_space_read_region_stream_2(t, h, o, a, c) \ 354588a2322SSam Leffler __bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c)) 355588a2322SSam Leffler #define bus_space_read_region_stream_4(t, h, o, a, c) \ 356588a2322SSam Leffler __bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c)) 357588a2322SSam Leffler #define bus_space_read_region_stream_8(t, h, o, a, c) \ 358588a2322SSam Leffler __bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c)) 359588a2322SSam Leffler 3606fc729afSOlivier Houchard 3616fc729afSOlivier Houchard /* 3626fc729afSOlivier Houchard * Bus write (single) operations. 3636fc729afSOlivier Houchard */ 3646fc729afSOlivier Houchard #define bus_space_write_1(t, h, o, v) __bs_ws(1,(t),(h),(o),(v)) 3656fc729afSOlivier Houchard #define bus_space_write_2(t, h, o, v) __bs_ws(2,(t),(h),(o),(v)) 3666fc729afSOlivier Houchard #define bus_space_write_4(t, h, o, v) __bs_ws(4,(t),(h),(o),(v)) 3676fc729afSOlivier Houchard #define bus_space_write_8(t, h, o, v) __bs_ws(8,(t),(h),(o),(v)) 3686fc729afSOlivier Houchard 369588a2322SSam Leffler #define bus_space_write_stream_1(t, h, o, v) __bs_ws_s(1,(t),(h),(o),(v)) 370588a2322SSam Leffler #define bus_space_write_stream_2(t, h, o, v) __bs_ws_s(2,(t),(h),(o),(v)) 371588a2322SSam Leffler #define bus_space_write_stream_4(t, h, o, v) __bs_ws_s(4,(t),(h),(o),(v)) 372588a2322SSam Leffler #define bus_space_write_stream_8(t, h, o, v) __bs_ws_s(8,(t),(h),(o),(v)) 373588a2322SSam Leffler 3746fc729afSOlivier Houchard 3756fc729afSOlivier Houchard /* 3766fc729afSOlivier Houchard * Bus write multiple operations. 3776fc729afSOlivier Houchard */ 3786fc729afSOlivier Houchard #define bus_space_write_multi_1(t, h, o, a, c) \ 3796fc729afSOlivier Houchard __bs_nonsingle(wm,1,(t),(h),(o),(a),(c)) 3806fc729afSOlivier Houchard #define bus_space_write_multi_2(t, h, o, a, c) \ 3816fc729afSOlivier Houchard __bs_nonsingle(wm,2,(t),(h),(o),(a),(c)) 3826fc729afSOlivier Houchard #define bus_space_write_multi_4(t, h, o, a, c) \ 3836fc729afSOlivier Houchard __bs_nonsingle(wm,4,(t),(h),(o),(a),(c)) 3846fc729afSOlivier Houchard #define bus_space_write_multi_8(t, h, o, a, c) \ 3856fc729afSOlivier Houchard __bs_nonsingle(wm,8,(t),(h),(o),(a),(c)) 3866fc729afSOlivier Houchard 387588a2322SSam Leffler #define bus_space_write_multi_stream_1(t, h, o, a, c) \ 388588a2322SSam Leffler __bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c)) 389588a2322SSam Leffler #define bus_space_write_multi_stream_2(t, h, o, a, c) \ 390588a2322SSam Leffler __bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c)) 391588a2322SSam Leffler #define bus_space_write_multi_stream_4(t, h, o, a, c) \ 392588a2322SSam Leffler __bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c)) 393588a2322SSam Leffler #define bus_space_write_multi_stream_8(t, h, o, a, c) \ 394588a2322SSam Leffler __bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c)) 395588a2322SSam Leffler 3966fc729afSOlivier Houchard 3976fc729afSOlivier Houchard /* 3986fc729afSOlivier Houchard * Bus write region operations. 3996fc729afSOlivier Houchard */ 4006fc729afSOlivier Houchard #define bus_space_write_region_1(t, h, o, a, c) \ 4016fc729afSOlivier Houchard __bs_nonsingle(wr,1,(t),(h),(o),(a),(c)) 4026fc729afSOlivier Houchard #define bus_space_write_region_2(t, h, o, a, c) \ 4036fc729afSOlivier Houchard __bs_nonsingle(wr,2,(t),(h),(o),(a),(c)) 4046fc729afSOlivier Houchard #define bus_space_write_region_4(t, h, o, a, c) \ 4056fc729afSOlivier Houchard __bs_nonsingle(wr,4,(t),(h),(o),(a),(c)) 4066fc729afSOlivier Houchard #define bus_space_write_region_8(t, h, o, a, c) \ 4076fc729afSOlivier Houchard __bs_nonsingle(wr,8,(t),(h),(o),(a),(c)) 4086fc729afSOlivier Houchard 409588a2322SSam Leffler #define bus_space_write_region_stream_1(t, h, o, a, c) \ 410588a2322SSam Leffler __bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c)) 411588a2322SSam Leffler #define bus_space_write_region_stream_2(t, h, o, a, c) \ 412588a2322SSam Leffler __bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c)) 413588a2322SSam Leffler #define bus_space_write_region_stream_4(t, h, o, a, c) \ 414588a2322SSam Leffler __bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c)) 415588a2322SSam Leffler #define bus_space_write_region_stream_8(t, h, o, a, c) \ 416588a2322SSam Leffler __bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c)) 417588a2322SSam Leffler 4186fc729afSOlivier Houchard 4196fc729afSOlivier Houchard /* 4206fc729afSOlivier Houchard * Set multiple operations. 4216fc729afSOlivier Houchard */ 4226fc729afSOlivier Houchard #define bus_space_set_multi_1(t, h, o, v, c) \ 4236fc729afSOlivier Houchard __bs_set(sm,1,(t),(h),(o),(v),(c)) 4246fc729afSOlivier Houchard #define bus_space_set_multi_2(t, h, o, v, c) \ 4256fc729afSOlivier Houchard __bs_set(sm,2,(t),(h),(o),(v),(c)) 4266fc729afSOlivier Houchard #define bus_space_set_multi_4(t, h, o, v, c) \ 4276fc729afSOlivier Houchard __bs_set(sm,4,(t),(h),(o),(v),(c)) 4286fc729afSOlivier Houchard #define bus_space_set_multi_8(t, h, o, v, c) \ 4296fc729afSOlivier Houchard __bs_set(sm,8,(t),(h),(o),(v),(c)) 4306fc729afSOlivier Houchard 4316fc729afSOlivier Houchard 4326fc729afSOlivier Houchard /* 4336fc729afSOlivier Houchard * Set region operations. 4346fc729afSOlivier Houchard */ 4356fc729afSOlivier Houchard #define bus_space_set_region_1(t, h, o, v, c) \ 4366fc729afSOlivier Houchard __bs_set(sr,1,(t),(h),(o),(v),(c)) 4376fc729afSOlivier Houchard #define bus_space_set_region_2(t, h, o, v, c) \ 4386fc729afSOlivier Houchard __bs_set(sr,2,(t),(h),(o),(v),(c)) 4396fc729afSOlivier Houchard #define bus_space_set_region_4(t, h, o, v, c) \ 4406fc729afSOlivier Houchard __bs_set(sr,4,(t),(h),(o),(v),(c)) 4416fc729afSOlivier Houchard #define bus_space_set_region_8(t, h, o, v, c) \ 4426fc729afSOlivier Houchard __bs_set(sr,8,(t),(h),(o),(v),(c)) 4436fc729afSOlivier Houchard 4446fc729afSOlivier Houchard 4456fc729afSOlivier Houchard /* 4466fc729afSOlivier Houchard * Copy operations. 4476fc729afSOlivier Houchard */ 4486fc729afSOlivier Houchard #define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ 4496fc729afSOlivier Houchard __bs_copy(1, t, h1, o1, h2, o2, c) 4506fc729afSOlivier Houchard #define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ 4516fc729afSOlivier Houchard __bs_copy(2, t, h1, o1, h2, o2, c) 4526fc729afSOlivier Houchard #define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ 4536fc729afSOlivier Houchard __bs_copy(4, t, h1, o1, h2, o2, c) 4546fc729afSOlivier Houchard #define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \ 4556fc729afSOlivier Houchard __bs_copy(8, t, h1, o1, h2, o2, c) 4566fc729afSOlivier Houchard 4576fc729afSOlivier Houchard /* 4586fc729afSOlivier Houchard * Macros to provide prototypes for all the functions used in the 4596fc729afSOlivier Houchard * bus_space structure 4606fc729afSOlivier Houchard */ 4616fc729afSOlivier Houchard 4626fc729afSOlivier Houchard #define bs_map_proto(f) \ 4636fc729afSOlivier Houchard int __bs_c(f,_bs_map) (void *t, bus_addr_t addr, \ 4646fc729afSOlivier Houchard bus_size_t size, int cacheable, bus_space_handle_t *bshp); 4656fc729afSOlivier Houchard 4666fc729afSOlivier Houchard #define bs_unmap_proto(f) \ 467588a2322SSam Leffler void __bs_c(f,_bs_unmap) (void *t, bus_space_handle_t bsh, \ 468588a2322SSam Leffler bus_size_t size); 4696fc729afSOlivier Houchard 4706fc729afSOlivier Houchard #define bs_subregion_proto(f) \ 4716fc729afSOlivier Houchard int __bs_c(f,_bs_subregion) (void *t, bus_space_handle_t bsh, \ 4726fc729afSOlivier Houchard bus_size_t offset, bus_size_t size, \ 4736fc729afSOlivier Houchard bus_space_handle_t *nbshp); 4746fc729afSOlivier Houchard 4756fc729afSOlivier Houchard #define bs_alloc_proto(f) \ 4766fc729afSOlivier Houchard int __bs_c(f,_bs_alloc) (void *t, bus_addr_t rstart, \ 4776fc729afSOlivier Houchard bus_addr_t rend, bus_size_t size, bus_size_t align, \ 4786fc729afSOlivier Houchard bus_size_t boundary, int cacheable, bus_addr_t *addrp, \ 4796fc729afSOlivier Houchard bus_space_handle_t *bshp); 4806fc729afSOlivier Houchard 4816fc729afSOlivier Houchard #define bs_free_proto(f) \ 4826fc729afSOlivier Houchard void __bs_c(f,_bs_free) (void *t, bus_space_handle_t bsh, \ 4836fc729afSOlivier Houchard bus_size_t size); 4846fc729afSOlivier Houchard 4856fc729afSOlivier Houchard #define bs_mmap_proto(f) \ 48689c9c53dSPoul-Henning Kamp int __bs_c(f,_bs_mmap) (struct cdev *, vm_offset_t, vm_paddr_t *, int); 4876fc729afSOlivier Houchard 4886fc729afSOlivier Houchard #define bs_barrier_proto(f) \ 4896fc729afSOlivier Houchard void __bs_c(f,_bs_barrier) (void *t, bus_space_handle_t bsh, \ 4906fc729afSOlivier Houchard bus_size_t offset, bus_size_t len, int flags); 4916fc729afSOlivier Houchard 4926fc729afSOlivier Houchard #define bs_r_1_proto(f) \ 4936fc729afSOlivier Houchard u_int8_t __bs_c(f,_bs_r_1) (void *t, bus_space_handle_t bsh, \ 4946fc729afSOlivier Houchard bus_size_t offset); 4956fc729afSOlivier Houchard 4966fc729afSOlivier Houchard #define bs_r_2_proto(f) \ 4976fc729afSOlivier Houchard u_int16_t __bs_c(f,_bs_r_2) (void *t, bus_space_handle_t bsh, \ 4986fc729afSOlivier Houchard bus_size_t offset); 4996fc729afSOlivier Houchard 5006fc729afSOlivier Houchard #define bs_r_4_proto(f) \ 5016fc729afSOlivier Houchard u_int32_t __bs_c(f,_bs_r_4) (void *t, bus_space_handle_t bsh, \ 5026fc729afSOlivier Houchard bus_size_t offset); 5036fc729afSOlivier Houchard 5046fc729afSOlivier Houchard #define bs_r_8_proto(f) \ 5056fc729afSOlivier Houchard u_int64_t __bs_c(f,_bs_r_8) (void *t, bus_space_handle_t bsh, \ 5066fc729afSOlivier Houchard bus_size_t offset); 5076fc729afSOlivier Houchard 508588a2322SSam Leffler #define bs_r_1_s_proto(f) \ 509588a2322SSam Leffler u_int8_t __bs_c(f,_bs_r_1_s) (void *t, bus_space_handle_t bsh, \ 510588a2322SSam Leffler bus_size_t offset); 511588a2322SSam Leffler 512588a2322SSam Leffler #define bs_r_2_s_proto(f) \ 513588a2322SSam Leffler u_int16_t __bs_c(f,_bs_r_2_s) (void *t, bus_space_handle_t bsh, \ 514588a2322SSam Leffler bus_size_t offset); 515588a2322SSam Leffler 516588a2322SSam Leffler #define bs_r_4_s_proto(f) \ 517588a2322SSam Leffler u_int32_t __bs_c(f,_bs_r_4_s) (void *t, bus_space_handle_t bsh, \ 518588a2322SSam Leffler bus_size_t offset); 519588a2322SSam Leffler 5206fc729afSOlivier Houchard #define bs_w_1_proto(f) \ 5216fc729afSOlivier Houchard void __bs_c(f,_bs_w_1) (void *t, bus_space_handle_t bsh, \ 5226fc729afSOlivier Houchard bus_size_t offset, u_int8_t value); 5236fc729afSOlivier Houchard 5246fc729afSOlivier Houchard #define bs_w_2_proto(f) \ 5256fc729afSOlivier Houchard void __bs_c(f,_bs_w_2) (void *t, bus_space_handle_t bsh, \ 5266fc729afSOlivier Houchard bus_size_t offset, u_int16_t value); 5276fc729afSOlivier Houchard 5286fc729afSOlivier Houchard #define bs_w_4_proto(f) \ 5296fc729afSOlivier Houchard void __bs_c(f,_bs_w_4) (void *t, bus_space_handle_t bsh, \ 5306fc729afSOlivier Houchard bus_size_t offset, u_int32_t value); 5316fc729afSOlivier Houchard 5326fc729afSOlivier Houchard #define bs_w_8_proto(f) \ 5336fc729afSOlivier Houchard void __bs_c(f,_bs_w_8) (void *t, bus_space_handle_t bsh, \ 5346fc729afSOlivier Houchard bus_size_t offset, u_int64_t value); 5356fc729afSOlivier Houchard 536588a2322SSam Leffler #define bs_w_1_s_proto(f) \ 537588a2322SSam Leffler void __bs_c(f,_bs_w_1_s) (void *t, bus_space_handle_t bsh, \ 538588a2322SSam Leffler bus_size_t offset, u_int8_t value); 539588a2322SSam Leffler 540588a2322SSam Leffler #define bs_w_2_s_proto(f) \ 541588a2322SSam Leffler void __bs_c(f,_bs_w_2_s) (void *t, bus_space_handle_t bsh, \ 542588a2322SSam Leffler bus_size_t offset, u_int16_t value); 543588a2322SSam Leffler 544588a2322SSam Leffler #define bs_w_4_s_proto(f) \ 545588a2322SSam Leffler void __bs_c(f,_bs_w_4_s) (void *t, bus_space_handle_t bsh, \ 546588a2322SSam Leffler bus_size_t offset, u_int32_t value); 547588a2322SSam Leffler 5486fc729afSOlivier Houchard #define bs_rm_1_proto(f) \ 5496fc729afSOlivier Houchard void __bs_c(f,_bs_rm_1) (void *t, bus_space_handle_t bsh, \ 5506fc729afSOlivier Houchard bus_size_t offset, u_int8_t *addr, bus_size_t count); 5516fc729afSOlivier Houchard 5526fc729afSOlivier Houchard #define bs_rm_2_proto(f) \ 5536fc729afSOlivier Houchard void __bs_c(f,_bs_rm_2) (void *t, bus_space_handle_t bsh, \ 5546fc729afSOlivier Houchard bus_size_t offset, u_int16_t *addr, bus_size_t count); 5556fc729afSOlivier Houchard 5566fc729afSOlivier Houchard #define bs_rm_4_proto(f) \ 5576fc729afSOlivier Houchard void __bs_c(f,_bs_rm_4) (void *t, bus_space_handle_t bsh, \ 5586fc729afSOlivier Houchard bus_size_t offset, u_int32_t *addr, bus_size_t count); 5596fc729afSOlivier Houchard 5606fc729afSOlivier Houchard #define bs_rm_8_proto(f) \ 5616fc729afSOlivier Houchard void __bs_c(f,_bs_rm_8) (void *t, bus_space_handle_t bsh, \ 5626fc729afSOlivier Houchard bus_size_t offset, u_int64_t *addr, bus_size_t count); 5636fc729afSOlivier Houchard 5646fc729afSOlivier Houchard #define bs_wm_1_proto(f) \ 5656fc729afSOlivier Houchard void __bs_c(f,_bs_wm_1) (void *t, bus_space_handle_t bsh, \ 5666fc729afSOlivier Houchard bus_size_t offset, const u_int8_t *addr, bus_size_t count); 5676fc729afSOlivier Houchard 5686fc729afSOlivier Houchard #define bs_wm_2_proto(f) \ 5696fc729afSOlivier Houchard void __bs_c(f,_bs_wm_2) (void *t, bus_space_handle_t bsh, \ 5706fc729afSOlivier Houchard bus_size_t offset, const u_int16_t *addr, bus_size_t count); 5716fc729afSOlivier Houchard 5726fc729afSOlivier Houchard #define bs_wm_4_proto(f) \ 5736fc729afSOlivier Houchard void __bs_c(f,_bs_wm_4) (void *t, bus_space_handle_t bsh, \ 5746fc729afSOlivier Houchard bus_size_t offset, const u_int32_t *addr, bus_size_t count); 5756fc729afSOlivier Houchard 5766fc729afSOlivier Houchard #define bs_wm_8_proto(f) \ 5776fc729afSOlivier Houchard void __bs_c(f,_bs_wm_8) (void *t, bus_space_handle_t bsh, \ 5786fc729afSOlivier Houchard bus_size_t offset, const u_int64_t *addr, bus_size_t count); 5796fc729afSOlivier Houchard 5806fc729afSOlivier Houchard #define bs_rr_1_proto(f) \ 5816fc729afSOlivier Houchard void __bs_c(f, _bs_rr_1) (void *t, bus_space_handle_t bsh, \ 5826fc729afSOlivier Houchard bus_size_t offset, u_int8_t *addr, bus_size_t count); 5836fc729afSOlivier Houchard 5846fc729afSOlivier Houchard #define bs_rr_2_proto(f) \ 5856fc729afSOlivier Houchard void __bs_c(f, _bs_rr_2) (void *t, bus_space_handle_t bsh, \ 5866fc729afSOlivier Houchard bus_size_t offset, u_int16_t *addr, bus_size_t count); 5876fc729afSOlivier Houchard 5886fc729afSOlivier Houchard #define bs_rr_4_proto(f) \ 5896fc729afSOlivier Houchard void __bs_c(f, _bs_rr_4) (void *t, bus_space_handle_t bsh, \ 5906fc729afSOlivier Houchard bus_size_t offset, u_int32_t *addr, bus_size_t count); 5916fc729afSOlivier Houchard 5926fc729afSOlivier Houchard #define bs_rr_8_proto(f) \ 5936fc729afSOlivier Houchard void __bs_c(f, _bs_rr_8) (void *t, bus_space_handle_t bsh, \ 5946fc729afSOlivier Houchard bus_size_t offset, u_int64_t *addr, bus_size_t count); 5956fc729afSOlivier Houchard 5966fc729afSOlivier Houchard #define bs_wr_1_proto(f) \ 5976fc729afSOlivier Houchard void __bs_c(f, _bs_wr_1) (void *t, bus_space_handle_t bsh, \ 5986fc729afSOlivier Houchard bus_size_t offset, const u_int8_t *addr, bus_size_t count); 5996fc729afSOlivier Houchard 6006fc729afSOlivier Houchard #define bs_wr_2_proto(f) \ 6016fc729afSOlivier Houchard void __bs_c(f, _bs_wr_2) (void *t, bus_space_handle_t bsh, \ 6026fc729afSOlivier Houchard bus_size_t offset, const u_int16_t *addr, bus_size_t count); 6036fc729afSOlivier Houchard 6046fc729afSOlivier Houchard #define bs_wr_4_proto(f) \ 6056fc729afSOlivier Houchard void __bs_c(f, _bs_wr_4) (void *t, bus_space_handle_t bsh, \ 6066fc729afSOlivier Houchard bus_size_t offset, const u_int32_t *addr, bus_size_t count); 6076fc729afSOlivier Houchard 6086fc729afSOlivier Houchard #define bs_wr_8_proto(f) \ 6096fc729afSOlivier Houchard void __bs_c(f, _bs_wr_8) (void *t, bus_space_handle_t bsh, \ 6106fc729afSOlivier Houchard bus_size_t offset, const u_int64_t *addr, bus_size_t count); 6116fc729afSOlivier Houchard 6126fc729afSOlivier Houchard #define bs_sm_1_proto(f) \ 6136fc729afSOlivier Houchard void __bs_c(f,_bs_sm_1) (void *t, bus_space_handle_t bsh, \ 6146fc729afSOlivier Houchard bus_size_t offset, u_int8_t value, bus_size_t count); 6156fc729afSOlivier Houchard 6166fc729afSOlivier Houchard #define bs_sm_2_proto(f) \ 6176fc729afSOlivier Houchard void __bs_c(f,_bs_sm_2) (void *t, bus_space_handle_t bsh, \ 6186fc729afSOlivier Houchard bus_size_t offset, u_int16_t value, bus_size_t count); 6196fc729afSOlivier Houchard 6206fc729afSOlivier Houchard #define bs_sm_4_proto(f) \ 6216fc729afSOlivier Houchard void __bs_c(f,_bs_sm_4) (void *t, bus_space_handle_t bsh, \ 6226fc729afSOlivier Houchard bus_size_t offset, u_int32_t value, bus_size_t count); 6236fc729afSOlivier Houchard 6246fc729afSOlivier Houchard #define bs_sm_8_proto(f) \ 6256fc729afSOlivier Houchard void __bs_c(f,_bs_sm_8) (void *t, bus_space_handle_t bsh, \ 6266fc729afSOlivier Houchard bus_size_t offset, u_int64_t value, bus_size_t count); 6276fc729afSOlivier Houchard 6286fc729afSOlivier Houchard #define bs_sr_1_proto(f) \ 6296fc729afSOlivier Houchard void __bs_c(f,_bs_sr_1) (void *t, bus_space_handle_t bsh, \ 6306fc729afSOlivier Houchard bus_size_t offset, u_int8_t value, bus_size_t count); 6316fc729afSOlivier Houchard 6326fc729afSOlivier Houchard #define bs_sr_2_proto(f) \ 6336fc729afSOlivier Houchard void __bs_c(f,_bs_sr_2) (void *t, bus_space_handle_t bsh, \ 6346fc729afSOlivier Houchard bus_size_t offset, u_int16_t value, bus_size_t count); 6356fc729afSOlivier Houchard 6366fc729afSOlivier Houchard #define bs_sr_4_proto(f) \ 6376fc729afSOlivier Houchard void __bs_c(f,_bs_sr_4) (void *t, bus_space_handle_t bsh, \ 6386fc729afSOlivier Houchard bus_size_t offset, u_int32_t value, bus_size_t count); 6396fc729afSOlivier Houchard 6406fc729afSOlivier Houchard #define bs_sr_8_proto(f) \ 6416fc729afSOlivier Houchard void __bs_c(f,_bs_sr_8) (void *t, bus_space_handle_t bsh, \ 6426fc729afSOlivier Houchard bus_size_t offset, u_int64_t value, bus_size_t count); 6436fc729afSOlivier Houchard 6446fc729afSOlivier Houchard #define bs_c_1_proto(f) \ 6456fc729afSOlivier Houchard void __bs_c(f,_bs_c_1) (void *t, bus_space_handle_t bsh1, \ 6466fc729afSOlivier Houchard bus_size_t offset1, bus_space_handle_t bsh2, \ 6476fc729afSOlivier Houchard bus_size_t offset2, bus_size_t count); 6486fc729afSOlivier Houchard 6496fc729afSOlivier Houchard #define bs_c_2_proto(f) \ 6506fc729afSOlivier Houchard void __bs_c(f,_bs_c_2) (void *t, bus_space_handle_t bsh1, \ 6516fc729afSOlivier Houchard bus_size_t offset1, bus_space_handle_t bsh2, \ 6526fc729afSOlivier Houchard bus_size_t offset2, bus_size_t count); 6536fc729afSOlivier Houchard 6546fc729afSOlivier Houchard #define bs_c_4_proto(f) \ 6556fc729afSOlivier Houchard void __bs_c(f,_bs_c_4) (void *t, bus_space_handle_t bsh1, \ 6566fc729afSOlivier Houchard bus_size_t offset1, bus_space_handle_t bsh2, \ 6576fc729afSOlivier Houchard bus_size_t offset2, bus_size_t count); 6586fc729afSOlivier Houchard 6596fc729afSOlivier Houchard #define bs_c_8_proto(f) \ 6606fc729afSOlivier Houchard void __bs_c(f,_bs_c_8) (void *t, bus_space_handle_t bsh1, \ 6616fc729afSOlivier Houchard bus_size_t offset1, bus_space_handle_t bsh2, \ 6626fc729afSOlivier Houchard bus_size_t offset2, bus_size_t count); 6636fc729afSOlivier Houchard 6646fc729afSOlivier Houchard #define bs_protos(f) \ 6656fc729afSOlivier Houchard bs_map_proto(f); \ 6666fc729afSOlivier Houchard bs_unmap_proto(f); \ 6676fc729afSOlivier Houchard bs_subregion_proto(f); \ 6686fc729afSOlivier Houchard bs_alloc_proto(f); \ 6696fc729afSOlivier Houchard bs_free_proto(f); \ 6706fc729afSOlivier Houchard bs_mmap_proto(f); \ 6716fc729afSOlivier Houchard bs_barrier_proto(f); \ 6726fc729afSOlivier Houchard bs_r_1_proto(f); \ 6736fc729afSOlivier Houchard bs_r_2_proto(f); \ 6746fc729afSOlivier Houchard bs_r_4_proto(f); \ 6756fc729afSOlivier Houchard bs_r_8_proto(f); \ 676588a2322SSam Leffler bs_r_1_s_proto(f); \ 677588a2322SSam Leffler bs_r_2_s_proto(f); \ 678588a2322SSam Leffler bs_r_4_s_proto(f); \ 6796fc729afSOlivier Houchard bs_w_1_proto(f); \ 6806fc729afSOlivier Houchard bs_w_2_proto(f); \ 6816fc729afSOlivier Houchard bs_w_4_proto(f); \ 6826fc729afSOlivier Houchard bs_w_8_proto(f); \ 683588a2322SSam Leffler bs_w_1_s_proto(f); \ 684588a2322SSam Leffler bs_w_2_s_proto(f); \ 685588a2322SSam Leffler bs_w_4_s_proto(f); \ 6866fc729afSOlivier Houchard bs_rm_1_proto(f); \ 6876fc729afSOlivier Houchard bs_rm_2_proto(f); \ 6886fc729afSOlivier Houchard bs_rm_4_proto(f); \ 6896fc729afSOlivier Houchard bs_rm_8_proto(f); \ 6906fc729afSOlivier Houchard bs_wm_1_proto(f); \ 6916fc729afSOlivier Houchard bs_wm_2_proto(f); \ 6926fc729afSOlivier Houchard bs_wm_4_proto(f); \ 6936fc729afSOlivier Houchard bs_wm_8_proto(f); \ 6946fc729afSOlivier Houchard bs_rr_1_proto(f); \ 6956fc729afSOlivier Houchard bs_rr_2_proto(f); \ 6966fc729afSOlivier Houchard bs_rr_4_proto(f); \ 6976fc729afSOlivier Houchard bs_rr_8_proto(f); \ 6986fc729afSOlivier Houchard bs_wr_1_proto(f); \ 6996fc729afSOlivier Houchard bs_wr_2_proto(f); \ 7006fc729afSOlivier Houchard bs_wr_4_proto(f); \ 7016fc729afSOlivier Houchard bs_wr_8_proto(f); \ 7026fc729afSOlivier Houchard bs_sm_1_proto(f); \ 7036fc729afSOlivier Houchard bs_sm_2_proto(f); \ 7046fc729afSOlivier Houchard bs_sm_4_proto(f); \ 7056fc729afSOlivier Houchard bs_sm_8_proto(f); \ 7066fc729afSOlivier Houchard bs_sr_1_proto(f); \ 7076fc729afSOlivier Houchard bs_sr_2_proto(f); \ 7086fc729afSOlivier Houchard bs_sr_4_proto(f); \ 7096fc729afSOlivier Houchard bs_sr_8_proto(f); \ 7106fc729afSOlivier Houchard bs_c_1_proto(f); \ 7116fc729afSOlivier Houchard bs_c_2_proto(f); \ 7126fc729afSOlivier Houchard bs_c_4_proto(f); \ 7136fc729afSOlivier Houchard bs_c_8_proto(f); 7146fc729afSOlivier Houchard 7156fc729afSOlivier Houchard #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t) 7166fc729afSOlivier Houchard 717a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF 718a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF 719a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXADDR 0xFFFFFFFF 720a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF 721a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF 722a5bb1c85SOlivier Houchard #define BUS_SPACE_MAXSIZE 0xFFFFFFFF 723a5bb1c85SOlivier Houchard 724b938b7a3SWarner Losh #define BUS_SPACE_UNRESTRICTED (~0) 725b938b7a3SWarner Losh 7265974e5c7SScott Long #include <machine/bus_dma.h> 7275974e5c7SScott Long 728*33ff10eaSIan Lepore /* 729*33ff10eaSIan Lepore * Get the physical address of a bus space memory-mapped resource. 730*33ff10eaSIan Lepore * Doing this as a macro is a temporary solution until a more robust fix is 731*33ff10eaSIan Lepore * designed. It also serves to mark the locations needing that fix. 732*33ff10eaSIan Lepore */ 733*33ff10eaSIan Lepore #define BUS_SPACE_PHYSADDR(res, offs) \ 734*33ff10eaSIan Lepore (vtophys(rman_get_start(res)+(offs))) 735*33ff10eaSIan Lepore 7366fc729afSOlivier Houchard #endif /* _MACHINE_BUS_H_ */ 737