bus_funcs.h revision 1.1.4.2 1 1.1.4.2 rmind /* $NetBSD: bus_funcs.h,v 1.1.4.2 2014/05/18 17:45:11 rmind Exp $ */
2 1.1.4.2 rmind
3 1.1.4.2 rmind /* $OpenBSD: bus.h,v 1.13 2001/07/30 14:15:59 art Exp $ */
4 1.1.4.2 rmind
5 1.1.4.2 rmind /*
6 1.1.4.2 rmind * Copyright (c) 1998-2004 Michael Shalayeff
7 1.1.4.2 rmind * All rights reserved.
8 1.1.4.2 rmind *
9 1.1.4.2 rmind * Redistribution and use in source and binary forms, with or without
10 1.1.4.2 rmind * modification, are permitted provided that the following conditions
11 1.1.4.2 rmind * are met:
12 1.1.4.2 rmind * 1. Redistributions of source code must retain the above copyright
13 1.1.4.2 rmind * notice, this list of conditions and the following disclaimer.
14 1.1.4.2 rmind * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.4.2 rmind * notice, this list of conditions and the following disclaimer in the
16 1.1.4.2 rmind * documentation and/or other materials provided with the distribution.
17 1.1.4.2 rmind *
18 1.1.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 1.1.4.2 rmind * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 1.1.4.2 rmind * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 1.1.4.2 rmind * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
22 1.1.4.2 rmind * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 1.1.4.2 rmind * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 1.1.4.2 rmind * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 1.1.4.2 rmind * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 1.1.4.2 rmind * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 1.1.4.2 rmind * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 1.1.4.2 rmind * THE POSSIBILITY OF SUCH DAMAGE.
29 1.1.4.2 rmind */
30 1.1.4.2 rmind
31 1.1.4.2 rmind
32 1.1.4.2 rmind #ifndef _MACHINE_BUS_FUNCS_H_
33 1.1.4.2 rmind #define _MACHINE_BUS_FUNCS_H_
34 1.1.4.2 rmind
35 1.1.4.2 rmind extern const struct hppa_bus_space_tag hppa_bustag;
36 1.1.4.2 rmind
37 1.1.4.2 rmind #define bus_space_map(t,a,c,ca,hp) \
38 1.1.4.2 rmind (((t)->hbt_map)((t)->hbt_cookie,(a),(c),(ca),(hp)))
39 1.1.4.2 rmind #define bus_space_unmap(t,h,c) \
40 1.1.4.2 rmind (((t)->hbt_unmap)((t)->hbt_cookie,(h),(c)))
41 1.1.4.2 rmind #define bus_space_subregion(t,h,o,c,hp) \
42 1.1.4.2 rmind (((t)->hbt_subregion)((t)->hbt_cookie,(h),(o),(c),(hp)))
43 1.1.4.2 rmind #define bus_space_alloc(t,b,e,c,al,bn,ca,ap,hp) \
44 1.1.4.2 rmind (((t)->hbt_alloc)((t)->hbt_cookie,(b),(e),(c),(al),(bn),(ca),(ap),(hp)))
45 1.1.4.2 rmind #define bus_space_free(t,h,c) \
46 1.1.4.2 rmind (((t)->hbt_free)((t)->hbt_cookie,(h),(c)))
47 1.1.4.2 rmind #define bus_space_barrier(t,h,o,l,op) \
48 1.1.4.2 rmind ((t)->hbt_barrier((t)->hbt_cookie, (h), (o), (l), (op)))
49 1.1.4.2 rmind #define bus_space_vaddr(t,h) \
50 1.1.4.2 rmind (((t)->hbt_vaddr)((t)->hbt_cookie,(h)))
51 1.1.4.2 rmind #define bus_space_mmap(t, a, o, p, f) \
52 1.1.4.2 rmind (*(t)->hbt_mmap)((t)->hbt_cookie, (a), (o), (p), (f))
53 1.1.4.2 rmind
54 1.1.4.2 rmind #define bus_space_read_1(t,h,o) (((t)->hbt_r1)((t)->hbt_cookie,(h),(o)))
55 1.1.4.2 rmind #define bus_space_read_2(t,h,o) (((t)->hbt_r2)((t)->hbt_cookie,(h),(o)))
56 1.1.4.2 rmind #define bus_space_read_4(t,h,o) (((t)->hbt_r4)((t)->hbt_cookie,(h),(o)))
57 1.1.4.2 rmind #define bus_space_read_8(t,h,o) (((t)->hbt_r8)((t)->hbt_cookie,(h),(o)))
58 1.1.4.2 rmind
59 1.1.4.2 rmind #define bus_space_write_1(t,h,o,v) (((t)->hbt_w1)((t)->hbt_cookie,(h),(o),(v)))
60 1.1.4.2 rmind #define bus_space_write_2(t,h,o,v) (((t)->hbt_w2)((t)->hbt_cookie,(h),(o),(v)))
61 1.1.4.2 rmind #define bus_space_write_4(t,h,o,v) (((t)->hbt_w4)((t)->hbt_cookie,(h),(o),(v)))
62 1.1.4.2 rmind #define bus_space_write_8(t,h,o,v) (((t)->hbt_w8)((t)->hbt_cookie,(h),(o),(v)))
63 1.1.4.2 rmind
64 1.1.4.2 rmind /* XXX fredette */
65 1.1.4.2 rmind #define bus_space_read_stream_2 bus_space_read_2
66 1.1.4.2 rmind #define bus_space_read_stream_4 bus_space_read_4
67 1.1.4.2 rmind #define bus_space_read_stream_8 bus_space_read_8
68 1.1.4.2 rmind
69 1.1.4.2 rmind #define bus_space_write_stream_2 bus_space_write_2
70 1.1.4.2 rmind #define bus_space_write_stream_4 bus_space_write_4
71 1.1.4.2 rmind #define bus_space_write_stream_8 bus_space_write_8
72 1.1.4.2 rmind
73 1.1.4.2 rmind #define bus_space_read_multi_1(t,h,o,a,c) \
74 1.1.4.2 rmind (((t)->hbt_rm_1)((t)->hbt_cookie, (h), (o), (a), (c)))
75 1.1.4.2 rmind #define bus_space_read_multi_2(t,h,o,a,c) \
76 1.1.4.2 rmind (((t)->hbt_rm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
77 1.1.4.2 rmind #define bus_space_read_multi_4(t,h,o,a,c) \
78 1.1.4.2 rmind (((t)->hbt_rm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
79 1.1.4.2 rmind #define bus_space_read_multi_8(t,h,o,a,c) \
80 1.1.4.2 rmind (((t)->hbt_rm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
81 1.1.4.2 rmind
82 1.1.4.2 rmind #define bus_space_write_multi_1(t,h,o,a,c) \
83 1.1.4.2 rmind (((t)->hbt_wm_1)((t)->hbt_cookie, (h), (o), (a), (c)))
84 1.1.4.2 rmind #define bus_space_write_multi_2(t,h,o,a,c) \
85 1.1.4.2 rmind (((t)->hbt_wm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
86 1.1.4.2 rmind #define bus_space_write_multi_4(t,h,o,a,c) \
87 1.1.4.2 rmind (((t)->hbt_wm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
88 1.1.4.2 rmind #define bus_space_write_multi_8(t,h,o,a,c) \
89 1.1.4.2 rmind (((t)->hbt_wm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
90 1.1.4.2 rmind
91 1.1.4.2 rmind #define bus_space_set_multi_1(t,h,o,v,c) \
92 1.1.4.2 rmind (((t)->hbt_sm_1)((t)->hbt_cookie, (h), (o), (v), (c)))
93 1.1.4.2 rmind #define bus_space_set_multi_2(t,h,o,v,c) \
94 1.1.4.2 rmind (((t)->hbt_sm_2)((t)->hbt_cookie, (h), (o), (v), (c)))
95 1.1.4.2 rmind #define bus_space_set_multi_4(t,h,o,v,c) \
96 1.1.4.2 rmind (((t)->hbt_sm_4)((t)->hbt_cookie, (h), (o), (v), (c)))
97 1.1.4.2 rmind #define bus_space_set_multi_8(t,h,o,v,c) \
98 1.1.4.2 rmind (((t)->hbt_sm_8)((t)->hbt_cookie, (h), (o), (v), (c)))
99 1.1.4.2 rmind
100 1.1.4.2 rmind #define bus_space_read_multi_stream_2(t, h, o, a, c) \
101 1.1.4.2 rmind (((t)->hbt_rrm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
102 1.1.4.2 rmind #define bus_space_read_multi_stream_4(t, h, o, a, c) \
103 1.1.4.2 rmind (((t)->hbt_rrm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
104 1.1.4.2 rmind #define bus_space_read_multi_stream_8(t, h, o, a, c) \
105 1.1.4.2 rmind (((t)->hbt_rrm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
106 1.1.4.2 rmind
107 1.1.4.2 rmind #define bus_space_write_multi_stream_2(t, h, o, a, c) \
108 1.1.4.2 rmind (((t)->hbt_wrm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
109 1.1.4.2 rmind #define bus_space_write_multi_stream_4(t, h, o, a, c) \
110 1.1.4.2 rmind (((t)->hbt_wrm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
111 1.1.4.2 rmind #define bus_space_write_multi_stream_8(t, h, o, a, c) \
112 1.1.4.2 rmind (((t)->hbt_wrm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
113 1.1.4.2 rmind
114 1.1.4.2 rmind #define bus_space_read_region_1(t, h, o, a, c) \
115 1.1.4.2 rmind (((t)->hbt_rr_1)((t)->hbt_cookie, (h), (o), (a), (c)))
116 1.1.4.2 rmind #define bus_space_read_region_2(t, h, o, a, c) \
117 1.1.4.2 rmind (((t)->hbt_rr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
118 1.1.4.2 rmind #define bus_space_read_region_4(t, h, o, a, c) \
119 1.1.4.2 rmind (((t)->hbt_rr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
120 1.1.4.2 rmind #define bus_space_read_region_8(t, h, o, a, c) \
121 1.1.4.2 rmind (((t)->hbt_rr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
122 1.1.4.2 rmind
123 1.1.4.2 rmind #define bus_space_write_region_1(t, h, o, a, c) \
124 1.1.4.2 rmind (((t)->hbt_wr_1)((t)->hbt_cookie, (h), (o), (a), (c)))
125 1.1.4.2 rmind #define bus_space_write_region_2(t, h, o, a, c) \
126 1.1.4.2 rmind (((t)->hbt_wr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
127 1.1.4.2 rmind #define bus_space_write_region_4(t, h, o, a, c) \
128 1.1.4.2 rmind (((t)->hbt_wr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
129 1.1.4.2 rmind #define bus_space_write_region_8(t, h, o, a, c) \
130 1.1.4.2 rmind (((t)->hbt_wr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
131 1.1.4.2 rmind
132 1.1.4.2 rmind #define bus_space_read_region_stream_2(t, h, o, a, c) \
133 1.1.4.2 rmind (((t)->hbt_rrr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
134 1.1.4.2 rmind #define bus_space_read_region_stream_4(t, h, o, a, c) \
135 1.1.4.2 rmind (((t)->hbt_rrr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
136 1.1.4.2 rmind #define bus_space_read_region_stream_8(t, h, o, a, c) \
137 1.1.4.2 rmind (((t)->hbt_rrr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
138 1.1.4.2 rmind
139 1.1.4.2 rmind #define bus_space_write_region_stream_2(t, h, o, a, c) \
140 1.1.4.2 rmind (((t)->hbt_wrr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
141 1.1.4.2 rmind #define bus_space_write_region_stream_4(t, h, o, a, c) \
142 1.1.4.2 rmind (((t)->hbt_wrr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
143 1.1.4.2 rmind #define bus_space_write_region_stream_8(t, h, o, a, c) \
144 1.1.4.2 rmind (((t)->hbt_wrr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
145 1.1.4.2 rmind
146 1.1.4.2 rmind #define bus_space_set_region_1(t, h, o, v, c) \
147 1.1.4.2 rmind (((t)->hbt_sr_1)((t)->hbt_cookie, (h), (o), (v), (c)))
148 1.1.4.2 rmind #define bus_space_set_region_2(t, h, o, v, c) \
149 1.1.4.2 rmind (((t)->hbt_sr_2)((t)->hbt_cookie, (h), (o), (v), (c)))
150 1.1.4.2 rmind #define bus_space_set_region_4(t, h, o, v, c) \
151 1.1.4.2 rmind (((t)->hbt_sr_4)((t)->hbt_cookie, (h), (o), (v), (c)))
152 1.1.4.2 rmind #define bus_space_set_region_8(t, h, o, v, c) \
153 1.1.4.2 rmind (((t)->hbt_sr_8)((t)->hbt_cookie, (h), (o), (v), (c)))
154 1.1.4.2 rmind
155 1.1.4.2 rmind #define bus_space_copy_1(t, h1, o1, h2, o2, c) \
156 1.1.4.2 rmind (((t)->hbt_cp_1)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
157 1.1.4.2 rmind #define bus_space_copy_2(t, h1, o1, h2, o2, c) \
158 1.1.4.2 rmind (((t)->hbt_cp_2)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
159 1.1.4.2 rmind #define bus_space_copy_4(t, h1, o1, h2, o2, c) \
160 1.1.4.2 rmind (((t)->hbt_cp_4)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
161 1.1.4.2 rmind #define bus_space_copy_8(t, h1, o1, h2, o2, c) \
162 1.1.4.2 rmind (((t)->hbt_cp_8)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
163 1.1.4.2 rmind
164 1.1.4.2 rmind /* Forwards needed by prototypes below. */
165 1.1.4.2 rmind struct mbuf;
166 1.1.4.2 rmind struct proc;
167 1.1.4.2 rmind struct uio;
168 1.1.4.2 rmind
169 1.1.4.2 rmind #define bus_dmamap_create(t, s, n, m, b, f, p) \
170 1.1.4.2 rmind (*(t)->_dmamap_create)((t)->_cookie, (s), (n), (m), (b), (f), (p))
171 1.1.4.2 rmind #define bus_dmamap_destroy(t, p) \
172 1.1.4.2 rmind (*(t)->_dmamap_destroy)((t)->_cookie, (p))
173 1.1.4.2 rmind #define bus_dmamap_load(t, m, b, s, p, f) \
174 1.1.4.2 rmind (*(t)->_dmamap_load)((t)->_cookie, (m), (b), (s), (p), (f))
175 1.1.4.2 rmind #define bus_dmamap_load_mbuf(t, m, b, f) \
176 1.1.4.2 rmind (*(t)->_dmamap_load_mbuf)((t)->_cookie, (m), (b), (f))
177 1.1.4.2 rmind #define bus_dmamap_load_uio(t, m, u, f) \
178 1.1.4.2 rmind (*(t)->_dmamap_load_uio)((t)->_cookie, (m), (u), (f))
179 1.1.4.2 rmind #define bus_dmamap_load_raw(t, m, sg, n, s, f) \
180 1.1.4.2 rmind (*(t)->_dmamap_load_raw)((t)->_cookie, (m), (sg), (n), (s), (f))
181 1.1.4.2 rmind #define bus_dmamap_unload(t, p) \
182 1.1.4.2 rmind (*(t)->_dmamap_unload)((t)->_cookie, (p))
183 1.1.4.2 rmind #define bus_dmamap_sync(t, p, o, l, ops) \
184 1.1.4.2 rmind (void)((t)->_dmamap_sync ? \
185 1.1.4.2 rmind (*(t)->_dmamap_sync)((t)->_cookie, (p), (o), (l), (ops)) : (void)0)
186 1.1.4.2 rmind
187 1.1.4.2 rmind #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
188 1.1.4.2 rmind (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f))
189 1.1.4.2 rmind #define bus_dmamem_free(t, sg, n) \
190 1.1.4.2 rmind (*(t)->_dmamem_free)((t)->_cookie, (sg), (n))
191 1.1.4.2 rmind #define bus_dmamem_map(t, sg, n, s, k, f) \
192 1.1.4.2 rmind (*(t)->_dmamem_map)((t)->_cookie, (sg), (n), (s), (k), (f))
193 1.1.4.2 rmind #define bus_dmamem_unmap(t, k, s) \
194 1.1.4.2 rmind (*(t)->_dmamem_unmap)((t)->_cookie, (k), (s))
195 1.1.4.2 rmind #define bus_dmamem_mmap(t, sg, n, o, p, f) \
196 1.1.4.2 rmind (*(t)->_dmamem_mmap)((t)->_cookie, (sg), (n), (o), (p), (f))
197 1.1.4.2 rmind
198 1.1.4.2 rmind #define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
199 1.1.4.2 rmind #define bus_dmatag_destroy(t)
200 1.1.4.2 rmind
201 1.1.4.2 rmind #endif /* _MACHINE_BUS_FUNCS_H_ */
202