Sun Jan 24 13:33:56 2021 UTC ()
Obey __HAVE_BUS_SPACE_8


(martin)
diff -r1.10 -r1.11 src/sys/arch/arm/include/bus_funcs.h
diff -r1.12 -r1.13 src/sys/sys/bus_proto.h

cvs diff -r1.10 -r1.11 src/sys/arch/arm/include/bus_funcs.h (expand / switch to unified diff)

--- src/sys/arch/arm/include/bus_funcs.h 2020/09/05 16:04:31 1.10
+++ src/sys/arch/arm/include/bus_funcs.h 2021/01/24 13:33:56 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bus_funcs.h,v 1.10 2020/09/05 16:04:31 jakllsch Exp $ */ 1/* $NetBSD: bus_funcs.h,v 1.11 2021/01/24 13:33:56 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center. 9 * NASA Ames Research Center.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -140,192 +140,226 @@ @@ -140,192 +140,226 @@
140 140
141/* 141/*
142 * Bus barrier operations. 142 * Bus barrier operations.
143 */ 143 */
144#define bus_space_barrier(t, h, o, l, f) \ 144#define bus_space_barrier(t, h, o, l, f) \
145 (*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f)) 145 (*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
146 146
147/* 147/*
148 * Bus read (single) operations. 148 * Bus read (single) operations.
149 */ 149 */
150#define bus_space_read_1(t, h, o) __bs_rs(1,(t),(h),(o)) 150#define bus_space_read_1(t, h, o) __bs_rs(1,(t),(h),(o))
151#define bus_space_read_2(t, h, o) __bs_rs(2,(t),(h),(o)) 151#define bus_space_read_2(t, h, o) __bs_rs(2,(t),(h),(o))
152#define bus_space_read_4(t, h, o) __bs_rs(4,(t),(h),(o)) 152#define bus_space_read_4(t, h, o) __bs_rs(4,(t),(h),(o))
 153#ifdef __HAVE_BUS_SPACE_8
153#define bus_space_read_8(t, h, o) __bs_rs(8,(t),(h),(o)) 154#define bus_space_read_8(t, h, o) __bs_rs(8,(t),(h),(o))
 155#endif
154#ifdef __BUS_SPACE_HAS_STREAM_METHODS 156#ifdef __BUS_SPACE_HAS_STREAM_METHODS
155#define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t),(h),(o)) 157#define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t),(h),(o))
156#define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t),(h),(o)) 158#define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t),(h),(o))
157#define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t),(h),(o)) 159#define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t),(h),(o))
 160#ifdef __HAVE_BUS_SPACE_8
158#define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,(t),(h),(o)) 161#define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,(t),(h),(o))
159#endif 162#endif
 163#endif
160 164
161 165
162/* 166/*
163 * Bus read multiple operations. 167 * Bus read multiple operations.
164 */ 168 */
165#define bus_space_read_multi_1(t, h, o, a, c) \ 169#define bus_space_read_multi_1(t, h, o, a, c) \
166 __bs_nonsingle(rm,1,(t),(h),(o),(a),(c)) 170 __bs_nonsingle(rm,1,(t),(h),(o),(a),(c))
167#define bus_space_read_multi_2(t, h, o, a, c) \ 171#define bus_space_read_multi_2(t, h, o, a, c) \
168 __bs_nonsingle(rm,2,(t),(h),(o),(a),(c)) 172 __bs_nonsingle(rm,2,(t),(h),(o),(a),(c))
169#define bus_space_read_multi_4(t, h, o, a, c) \ 173#define bus_space_read_multi_4(t, h, o, a, c) \
170 __bs_nonsingle(rm,4,(t),(h),(o),(a),(c)) 174 __bs_nonsingle(rm,4,(t),(h),(o),(a),(c))
 175#ifdef __HAVE_BUS_SPACE_8
171#define bus_space_read_multi_8(t, h, o, a, c) \ 176#define bus_space_read_multi_8(t, h, o, a, c) \
172 __bs_nonsingle(rm,8,(t),(h),(o),(a),(c)) 177 __bs_nonsingle(rm,8,(t),(h),(o),(a),(c))
 178#endif
173#ifdef __BUS_SPACE_HAS_STREAM_METHODS 179#ifdef __BUS_SPACE_HAS_STREAM_METHODS
174#define bus_space_read_multi_stream_1(t, h, o, a, c) \ 180#define bus_space_read_multi_stream_1(t, h, o, a, c) \
175 __bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c)) 181 __bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c))
176#define bus_space_read_multi_stream_2(t, h, o, a, c) \ 182#define bus_space_read_multi_stream_2(t, h, o, a, c) \
177 __bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c)) 183 __bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c))
178#define bus_space_read_multi_stream_4(t, h, o, a, c) \ 184#define bus_space_read_multi_stream_4(t, h, o, a, c) \
179 __bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c)) 185 __bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c))
 186#ifdef __HAVE_BUS_SPACE_8
180#define bus_space_read_multi_stream_8(t, h, o, a, c) \ 187#define bus_space_read_multi_stream_8(t, h, o, a, c) \
181 __bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c)) 188 __bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c))
182#endif 189#endif
 190#endif
183 191
184 192
185/* 193/*
186 * Bus read region operations. 194 * Bus read region operations.
187 */ 195 */
188#define bus_space_read_region_1(t, h, o, a, c) \ 196#define bus_space_read_region_1(t, h, o, a, c) \
189 __bs_nonsingle(rr,1,(t),(h),(o),(a),(c)) 197 __bs_nonsingle(rr,1,(t),(h),(o),(a),(c))
190#define bus_space_read_region_2(t, h, o, a, c) \ 198#define bus_space_read_region_2(t, h, o, a, c) \
191 __bs_nonsingle(rr,2,(t),(h),(o),(a),(c)) 199 __bs_nonsingle(rr,2,(t),(h),(o),(a),(c))
192#define bus_space_read_region_4(t, h, o, a, c) \ 200#define bus_space_read_region_4(t, h, o, a, c) \
193 __bs_nonsingle(rr,4,(t),(h),(o),(a),(c)) 201 __bs_nonsingle(rr,4,(t),(h),(o),(a),(c))
 202#ifdef __HAVE_BUS_SPACE_8
194#define bus_space_read_region_8(t, h, o, a, c) \ 203#define bus_space_read_region_8(t, h, o, a, c) \
195 __bs_nonsingle(rr,8,(t),(h),(o),(a),(c)) 204 __bs_nonsingle(rr,8,(t),(h),(o),(a),(c))
 205#endif
196#ifdef __BUS_SPACE_HAS_STREAM_METHODS 206#ifdef __BUS_SPACE_HAS_STREAM_METHODS
197#define bus_space_read_region_stream_1(t, h, o, a, c) \ 207#define bus_space_read_region_stream_1(t, h, o, a, c) \
198 __bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c)) 208 __bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c))
199#define bus_space_read_region_stream_2(t, h, o, a, c) \ 209#define bus_space_read_region_stream_2(t, h, o, a, c) \
200 __bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c)) 210 __bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c))
201#define bus_space_read_region_stream_4(t, h, o, a, c) \ 211#define bus_space_read_region_stream_4(t, h, o, a, c) \
202 __bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c)) 212 __bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c))
 213#ifdef __HAVE_BUS_SPACE_8
203#define bus_space_read_region_stream_8(t, h, o, a, c) \ 214#define bus_space_read_region_stream_8(t, h, o, a, c) \
204 __bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c)) 215 __bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c))
205#endif 216#endif
 217#endif
206 218
207 219
208/* 220/*
209 * Bus write (single) operations. 221 * Bus write (single) operations.
210 */ 222 */
211#define bus_space_write_1(t, h, o, v) __bs_ws(1,(t),(h),(o),(v)) 223#define bus_space_write_1(t, h, o, v) __bs_ws(1,(t),(h),(o),(v))
212#define bus_space_write_2(t, h, o, v) __bs_ws(2,(t),(h),(o),(v)) 224#define bus_space_write_2(t, h, o, v) __bs_ws(2,(t),(h),(o),(v))
213#define bus_space_write_4(t, h, o, v) __bs_ws(4,(t),(h),(o),(v)) 225#define bus_space_write_4(t, h, o, v) __bs_ws(4,(t),(h),(o),(v))
 226#ifdef __HAVE_BUS_SPACE_8
214#define bus_space_write_8(t, h, o, v) __bs_ws(8,(t),(h),(o),(v)) 227#define bus_space_write_8(t, h, o, v) __bs_ws(8,(t),(h),(o),(v))
 228#endif
215#ifdef __BUS_SPACE_HAS_STREAM_METHODS 229#ifdef __BUS_SPACE_HAS_STREAM_METHODS
216#define bus_space_write_stream_1(t, h, o, v) __bs_ws_s(1,(t),(h),(o),(v)) 230#define bus_space_write_stream_1(t, h, o, v) __bs_ws_s(1,(t),(h),(o),(v))
217#define bus_space_write_stream_2(t, h, o, v) __bs_ws_s(2,(t),(h),(o),(v)) 231#define bus_space_write_stream_2(t, h, o, v) __bs_ws_s(2,(t),(h),(o),(v))
218#define bus_space_write_stream_4(t, h, o, v) __bs_ws_s(4,(t),(h),(o),(v)) 232#define bus_space_write_stream_4(t, h, o, v) __bs_ws_s(4,(t),(h),(o),(v))
 233#ifdef __HAVE_BUS_SPACE_8
219#define bus_space_write_stream_8(t, h, o, v) __bs_ws_s(8,(t),(h),(o),(v)) 234#define bus_space_write_stream_8(t, h, o, v) __bs_ws_s(8,(t),(h),(o),(v))
220#endif 235#endif
 236#endif
221 237
222 238
223/* 239/*
224 * Bus write multiple operations. 240 * Bus write multiple operations.
225 */ 241 */
226#define bus_space_write_multi_1(t, h, o, a, c) \ 242#define bus_space_write_multi_1(t, h, o, a, c) \
227 __bs_nonsingle(wm,1,(t),(h),(o),(a),(c)) 243 __bs_nonsingle(wm,1,(t),(h),(o),(a),(c))
228#define bus_space_write_multi_2(t, h, o, a, c) \ 244#define bus_space_write_multi_2(t, h, o, a, c) \
229 __bs_nonsingle(wm,2,(t),(h),(o),(a),(c)) 245 __bs_nonsingle(wm,2,(t),(h),(o),(a),(c))
230#define bus_space_write_multi_4(t, h, o, a, c) \ 246#define bus_space_write_multi_4(t, h, o, a, c) \
231 __bs_nonsingle(wm,4,(t),(h),(o),(a),(c)) 247 __bs_nonsingle(wm,4,(t),(h),(o),(a),(c))
 248#ifdef __HAVE_BUS_SPACE_8
232#define bus_space_write_multi_8(t, h, o, a, c) \ 249#define bus_space_write_multi_8(t, h, o, a, c) \
233 __bs_nonsingle(wm,8,(t),(h),(o),(a),(c)) 250 __bs_nonsingle(wm,8,(t),(h),(o),(a),(c))
 251#endif
234#ifdef __BUS_SPACE_HAS_STREAM_METHODS 252#ifdef __BUS_SPACE_HAS_STREAM_METHODS
235#define bus_space_write_multi_stream_1(t, h, o, a, c) \ 253#define bus_space_write_multi_stream_1(t, h, o, a, c) \
236 __bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c)) 254 __bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c))
237#define bus_space_write_multi_stream_2(t, h, o, a, c) \ 255#define bus_space_write_multi_stream_2(t, h, o, a, c) \
238 __bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c)) 256 __bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c))
239#define bus_space_write_multi_stream_4(t, h, o, a, c) \ 257#define bus_space_write_multi_stream_4(t, h, o, a, c) \
240 __bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c)) 258 __bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c))
 259#ifdef __HAVE_BUS_SPACE_8
241#define bus_space_write_multi_stream_8(t, h, o, a, c) \ 260#define bus_space_write_multi_stream_8(t, h, o, a, c) \
242 __bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c)) 261 __bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c))
243#endif 262#endif
 263#endif
244 264
245 265
246/* 266/*
247 * Bus write region operations. 267 * Bus write region operations.
248 */ 268 */
249#define bus_space_write_region_1(t, h, o, a, c) \ 269#define bus_space_write_region_1(t, h, o, a, c) \
250 __bs_nonsingle(wr,1,(t),(h),(o),(a),(c)) 270 __bs_nonsingle(wr,1,(t),(h),(o),(a),(c))
251#define bus_space_write_region_2(t, h, o, a, c) \ 271#define bus_space_write_region_2(t, h, o, a, c) \
252 __bs_nonsingle(wr,2,(t),(h),(o),(a),(c)) 272 __bs_nonsingle(wr,2,(t),(h),(o),(a),(c))
253#define bus_space_write_region_4(t, h, o, a, c) \ 273#define bus_space_write_region_4(t, h, o, a, c) \
254 __bs_nonsingle(wr,4,(t),(h),(o),(a),(c)) 274 __bs_nonsingle(wr,4,(t),(h),(o),(a),(c))
 275#ifdef __HAVE_BUS_SPACE_8
255#define bus_space_write_region_8(t, h, o, a, c) \ 276#define bus_space_write_region_8(t, h, o, a, c) \
256 __bs_nonsingle(wr,8,(t),(h),(o),(a),(c)) 277 __bs_nonsingle(wr,8,(t),(h),(o),(a),(c))
 278#endif
257#ifdef __BUS_SPACE_HAS_STREAM_METHODS 279#ifdef __BUS_SPACE_HAS_STREAM_METHODS
258#define bus_space_write_region_stream_1(t, h, o, a, c) \ 280#define bus_space_write_region_stream_1(t, h, o, a, c) \
259 __bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c)) 281 __bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c))
260#define bus_space_write_region_stream_2(t, h, o, a, c) \ 282#define bus_space_write_region_stream_2(t, h, o, a, c) \
261 __bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c)) 283 __bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c))
262#define bus_space_write_region_stream_4(t, h, o, a, c) \ 284#define bus_space_write_region_stream_4(t, h, o, a, c) \
263 __bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c)) 285 __bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c))
 286#ifdef __HAVE_BUS_SPACE_8
264#define bus_space_write_region_stream_8(t, h, o, a, c) \ 287#define bus_space_write_region_stream_8(t, h, o, a, c) \
265 __bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c)) 288 __bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c))
266#endif 289#endif
 290#endif
267 291
268 292
269/* 293/*
270 * Set multiple operations. 294 * Set multiple operations.
271 */ 295 */
272#define bus_space_set_multi_1(t, h, o, v, c) \ 296#define bus_space_set_multi_1(t, h, o, v, c) \
273 __bs_set(sm,1,(t),(h),(o),(v),(c)) 297 __bs_set(sm,1,(t),(h),(o),(v),(c))
274#define bus_space_set_multi_2(t, h, o, v, c) \ 298#define bus_space_set_multi_2(t, h, o, v, c) \
275 __bs_set(sm,2,(t),(h),(o),(v),(c)) 299 __bs_set(sm,2,(t),(h),(o),(v),(c))
276#define bus_space_set_multi_4(t, h, o, v, c) \ 300#define bus_space_set_multi_4(t, h, o, v, c) \
277 __bs_set(sm,4,(t),(h),(o),(v),(c)) 301 __bs_set(sm,4,(t),(h),(o),(v),(c))
 302#ifdef __HAVE_BUS_SPACE_8
278#define bus_space_set_multi_8(t, h, o, v, c) \ 303#define bus_space_set_multi_8(t, h, o, v, c) \
279 __bs_set(sm,8,(t),(h),(o),(v),(c)) 304 __bs_set(sm,8,(t),(h),(o),(v),(c))
 305#endif
280 306
281/* 307/*
282 * Set region operations. 308 * Set region operations.
283 */ 309 */
284#define bus_space_set_region_1(t, h, o, v, c) \ 310#define bus_space_set_region_1(t, h, o, v, c) \
285 __bs_set(sr,1,(t),(h),(o),(v),(c)) 311 __bs_set(sr,1,(t),(h),(o),(v),(c))
286#define bus_space_set_region_2(t, h, o, v, c) \ 312#define bus_space_set_region_2(t, h, o, v, c) \
287 __bs_set(sr,2,(t),(h),(o),(v),(c)) 313 __bs_set(sr,2,(t),(h),(o),(v),(c))
288#define bus_space_set_region_4(t, h, o, v, c) \ 314#define bus_space_set_region_4(t, h, o, v, c) \
289 __bs_set(sr,4,(t),(h),(o),(v),(c)) 315 __bs_set(sr,4,(t),(h),(o),(v),(c))
 316#ifdef __HAVE_BUS_SPACE_8
290#define bus_space_set_region_8(t, h, o, v, c) \ 317#define bus_space_set_region_8(t, h, o, v, c) \
291 __bs_set(sr,8,(t),(h),(o),(v),(c)) 318 __bs_set(sr,8,(t),(h),(o),(v),(c))
 319#endif
292 320
293/* 321/*
294 * Copy operations. 322 * Copy operations.
295 */ 323 */
296#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ 324#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \
297 __bs_copy(1, t, h1, o1, h2, o2, c) 325 __bs_copy(1, t, h1, o1, h2, o2, c)
298#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ 326#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \
299 __bs_copy(2, t, h1, o1, h2, o2, c) 327 __bs_copy(2, t, h1, o1, h2, o2, c)
300#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ 328#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \
301 __bs_copy(4, t, h1, o1, h2, o2, c) 329 __bs_copy(4, t, h1, o1, h2, o2, c)
 330#ifdef __HAVE_BUS_SPACE_8
302#define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \ 331#define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \
303 __bs_copy(8, t, h1, o1, h2, o2, c) 332 __bs_copy(8, t, h1, o1, h2, o2, c)
 333#endif
304 334
305/* 335/*
306 * Probing operations. 336 * Probing operations.
307 */ 337 */
308#ifdef __BUS_SPACE_HAS_PROBING_METHODS 338#ifdef __BUS_SPACE_HAS_PROBING_METHODS
309#define bus_space_peek_1(t, h, o, p) __bs_pe(1,(t),(h),(o),(p)) 339#define bus_space_peek_1(t, h, o, p) __bs_pe(1,(t),(h),(o),(p))
310#define bus_space_peek_2(t, h, o, p) __bs_pe(2,(t),(h),(o),(p)) 340#define bus_space_peek_2(t, h, o, p) __bs_pe(2,(t),(h),(o),(p))
311#define bus_space_peek_4(t, h, o, p) __bs_pe(4,(t),(h),(o),(p)) 341#define bus_space_peek_4(t, h, o, p) __bs_pe(4,(t),(h),(o),(p))
 342#ifdef __HAVE_BUS_SPACE_8
312#define bus_space_peek_8(t, h, o, p) __bs_pe(8,(t),(h),(o),(p)) 343#define bus_space_peek_8(t, h, o, p) __bs_pe(8,(t),(h),(o),(p))
 344#endif
313 345
314#define bus_space_poke_1(t, h, o, v) __bs_po(1,(t),(h),(o),(v)) 346#define bus_space_poke_1(t, h, o, v) __bs_po(1,(t),(h),(o),(v))
315#define bus_space_poke_2(t, h, o, v) __bs_po(2,(t),(h),(o),(v)) 347#define bus_space_poke_2(t, h, o, v) __bs_po(2,(t),(h),(o),(v))
316#define bus_space_poke_4(t, h, o, v) __bs_po(4,(t),(h),(o),(v)) 348#define bus_space_poke_4(t, h, o, v) __bs_po(4,(t),(h),(o),(v))
 349#ifdef __HAVE_BUS_SPACE_8
317#define bus_space_poke_8(t, h, o, v) __bs_po(8,(t),(h),(o),(v)) 350#define bus_space_poke_8(t, h, o, v) __bs_po(8,(t),(h),(o),(v))
318#endif 351#endif
 352#endif
319 353
320/* 354/*
321 * Macros to provide prototypes for all the functions used in the 355 * Macros to provide prototypes for all the functions used in the
322 * bus_space structure 356 * bus_space structure
323 */ 357 */
324 358
325#define bs_map_proto(f) \ 359#define bs_map_proto(f) \
326int __bs_c(f,_bs_map)(void *t, bus_addr_t addr, \ 360int __bs_c(f,_bs_map)(void *t, bus_addr_t addr, \
327 bus_size_t size, int cacheable, bus_space_handle_t *bshp); 361 bus_size_t size, int cacheable, bus_space_handle_t *bshp);
328 362
329#define bs_unmap_proto(f) \ 363#define bs_unmap_proto(f) \
330void __bs_c(f,_bs_unmap)(void *t, bus_space_handle_t bsh, \ 364void __bs_c(f,_bs_unmap)(void *t, bus_space_handle_t bsh, \
331 bus_size_t size); 365 bus_size_t size);

cvs diff -r1.12 -r1.13 src/sys/sys/bus_proto.h (expand / switch to unified diff)

--- src/sys/sys/bus_proto.h 2020/11/18 07:42:46 1.12
+++ src/sys/sys/bus_proto.h 2021/01/24 13:33:56 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bus_proto.h,v 1.12 2020/11/18 07:42:46 skrll Exp $ */ 1/* $NetBSD: bus_proto.h,v 1.13 2021/01/24 13:33:56 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1998, 2001, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997, 1998, 2001, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center, and by Andrew Doran. 9 * NASA Ames Research Center, and by Andrew Doran.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -119,30 +119,32 @@ uint8_t bus_space_read_1(bus_space_tag_t @@ -119,30 +119,32 @@ uint8_t bus_space_read_1(bus_space_tag_t
119uint8_t bus_space_read_stream_1(bus_space_tag_t, bus_space_handle_t, 119uint8_t bus_space_read_stream_1(bus_space_tag_t, bus_space_handle_t,
120 bus_size_t); 120 bus_size_t);
121 121
122uint16_t bus_space_read_2(bus_space_tag_t, bus_space_handle_t, 122uint16_t bus_space_read_2(bus_space_tag_t, bus_space_handle_t,
123 bus_size_t); 123 bus_size_t);
124uint16_t bus_space_read_stream_2(bus_space_tag_t, bus_space_handle_t, 124uint16_t bus_space_read_stream_2(bus_space_tag_t, bus_space_handle_t,
125 bus_size_t); 125 bus_size_t);
126 126
127uint32_t bus_space_read_4(bus_space_tag_t, bus_space_handle_t, 127uint32_t bus_space_read_4(bus_space_tag_t, bus_space_handle_t,
128 bus_size_t); 128 bus_size_t);
129uint32_t bus_space_read_stream_4(bus_space_tag_t, bus_space_handle_t, 129uint32_t bus_space_read_stream_4(bus_space_tag_t, bus_space_handle_t,
130 bus_size_t); 130 bus_size_t);
131 131
 132#ifdef __HAVE_BUS_SPACE_8
132uint64_t bus_space_read_8(bus_space_tag_t, bus_space_handle_t, 133uint64_t bus_space_read_8(bus_space_tag_t, bus_space_handle_t,
133 bus_size_t); 134 bus_size_t);
134uint64_t bus_space_read_stream_8(bus_space_tag_t, bus_space_handle_t, 135uint64_t bus_space_read_stream_8(bus_space_tag_t, bus_space_handle_t,
135 bus_size_t); 136 bus_size_t);
 137#endif
136 138
137#if defined(KASAN) && defined(__HAVE_KASAN_INSTR_BUS) 139#if defined(KASAN) && defined(__HAVE_KASAN_INSTR_BUS)
138#define BUS_SPACE_READ_MEM_PROTOS(bytes, bits) \ 140#define BUS_SPACE_READ_MEM_PROTOS(bytes, bits) \
139void kasan_bus_space_read_multi_##bytes(bus_space_tag_t, bus_space_handle_t, \ 141void kasan_bus_space_read_multi_##bytes(bus_space_tag_t, bus_space_handle_t, \
140 bus_size_t, uint##bits##_t *, bus_size_t); \ 142 bus_size_t, uint##bits##_t *, bus_size_t); \
141void kasan_bus_space_read_multi_stream_##bytes(bus_space_tag_t, \ 143void kasan_bus_space_read_multi_stream_##bytes(bus_space_tag_t, \
142 bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); \ 144 bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); \
143void kasan_bus_space_read_region_##bytes(bus_space_tag_t, bus_space_handle_t, \ 145void kasan_bus_space_read_region_##bytes(bus_space_tag_t, bus_space_handle_t, \
144 bus_size_t, uint##bits##_t *, bus_size_t); \ 146 bus_size_t, uint##bits##_t *, bus_size_t); \
145void kasan_bus_space_read_region_stream_##bytes(bus_space_tag_t, \ 147void kasan_bus_space_read_region_stream_##bytes(bus_space_tag_t, \
146 bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t); 148 bus_space_handle_t, bus_size_t, uint##bits##_t *, bus_size_t);
147#define bus_space_read_multi_1 kasan_bus_space_read_multi_1 149#define bus_space_read_multi_1 kasan_bus_space_read_multi_1
148#define bus_space_read_multi_2 kasan_bus_space_read_multi_2 150#define bus_space_read_multi_2 kasan_bus_space_read_multi_2
@@ -234,30 +236,32 @@ void bus_space_write_1(bus_space_tag_t,  @@ -234,30 +236,32 @@ void bus_space_write_1(bus_space_tag_t,
234void bus_space_write_stream_1(bus_space_tag_t, bus_space_handle_t, 236void bus_space_write_stream_1(bus_space_tag_t, bus_space_handle_t,
235 bus_size_t, uint8_t); 237 bus_size_t, uint8_t);
236 238
237void bus_space_write_2(bus_space_tag_t, bus_space_handle_t, 239void bus_space_write_2(bus_space_tag_t, bus_space_handle_t,
238 bus_size_t, uint16_t); 240 bus_size_t, uint16_t);
239void bus_space_write_stream_2(bus_space_tag_t, bus_space_handle_t, 241void bus_space_write_stream_2(bus_space_tag_t, bus_space_handle_t,
240 bus_size_t, uint16_t); 242 bus_size_t, uint16_t);
241 243
242void bus_space_write_4(bus_space_tag_t, bus_space_handle_t, 244void bus_space_write_4(bus_space_tag_t, bus_space_handle_t,
243 bus_size_t, uint32_t); 245 bus_size_t, uint32_t);
244void bus_space_write_stream_4(bus_space_tag_t, bus_space_handle_t, 246void bus_space_write_stream_4(bus_space_tag_t, bus_space_handle_t,
245 bus_size_t, uint32_t); 247 bus_size_t, uint32_t);
246 248
 249#ifdef __HAVE_BUS_SPACE_8
247void bus_space_write_8(bus_space_tag_t, bus_space_handle_t, 250void bus_space_write_8(bus_space_tag_t, bus_space_handle_t,
248 bus_size_t, uint64_t); 251 bus_size_t, uint64_t);
249void bus_space_write_stream_8(bus_space_tag_t, bus_space_handle_t, 252void bus_space_write_stream_8(bus_space_tag_t, bus_space_handle_t,
250 bus_size_t, uint64_t); 253 bus_size_t, uint64_t);
 254#endif
251 255
252#if defined(KASAN) && defined(__HAVE_KASAN_INSTR_BUS) 256#if defined(KASAN) && defined(__HAVE_KASAN_INSTR_BUS)
253#define BUS_SPACE_WRITE_MEM_PROTOS(bytes, bits) \ 257#define BUS_SPACE_WRITE_MEM_PROTOS(bytes, bits) \
254void kasan_bus_space_write_multi_##bytes(bus_space_tag_t, bus_space_handle_t, \ 258void kasan_bus_space_write_multi_##bytes(bus_space_tag_t, bus_space_handle_t, \
255 bus_size_t, const uint##bits##_t *, bus_size_t); \ 259 bus_size_t, const uint##bits##_t *, bus_size_t); \
256void kasan_bus_space_write_multi_stream_##bytes(bus_space_tag_t, \ 260void kasan_bus_space_write_multi_stream_##bytes(bus_space_tag_t, \
257 bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t); \ 261 bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t); \
258void kasan_bus_space_write_region_##bytes(bus_space_tag_t, bus_space_handle_t, \ 262void kasan_bus_space_write_region_##bytes(bus_space_tag_t, bus_space_handle_t, \
259 bus_size_t, const uint##bits##_t *, bus_size_t); \ 263 bus_size_t, const uint##bits##_t *, bus_size_t); \
260void kasan_bus_space_write_region_stream_##bytes(bus_space_tag_t, \ 264void kasan_bus_space_write_region_stream_##bytes(bus_space_tag_t, \
261 bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t); 265 bus_space_handle_t, bus_size_t, const uint##bits##_t *, bus_size_t);
262#define bus_space_write_multi_1 kasan_bus_space_write_multi_1 266#define bus_space_write_multi_1 kasan_bus_space_write_multi_1
263#define bus_space_write_multi_2 kasan_bus_space_write_multi_2 267#define bus_space_write_multi_2 kasan_bus_space_write_multi_2
@@ -340,81 +344,93 @@ void bus_space_write_region_stream_##byt @@ -340,81 +344,93 @@ void bus_space_write_region_stream_##byt
340#endif 344#endif
341 345
342BUS_SPACE_WRITE_MEM_PROTOS(1, 8) 346BUS_SPACE_WRITE_MEM_PROTOS(1, 8)
343BUS_SPACE_WRITE_MEM_PROTOS(2, 16) 347BUS_SPACE_WRITE_MEM_PROTOS(2, 16)
344BUS_SPACE_WRITE_MEM_PROTOS(4, 32) 348BUS_SPACE_WRITE_MEM_PROTOS(4, 32)
345BUS_SPACE_WRITE_MEM_PROTOS(8, 64) 349BUS_SPACE_WRITE_MEM_PROTOS(8, 64)
346 350
347void bus_space_set_multi_1(bus_space_tag_t, bus_space_handle_t, 351void bus_space_set_multi_1(bus_space_tag_t, bus_space_handle_t,
348 bus_size_t, u_int8_t, bus_size_t); 352 bus_size_t, u_int8_t, bus_size_t);
349void bus_space_set_multi_2(bus_space_tag_t, bus_space_handle_t, 353void bus_space_set_multi_2(bus_space_tag_t, bus_space_handle_t,
350 bus_size_t, u_int16_t, bus_size_t); 354 bus_size_t, u_int16_t, bus_size_t);
351void bus_space_set_multi_4(bus_space_tag_t, bus_space_handle_t, 355void bus_space_set_multi_4(bus_space_tag_t, bus_space_handle_t,
352 bus_size_t, u_int32_t, bus_size_t); 356 bus_size_t, u_int32_t, bus_size_t);
 357#ifdef __HAVE_BUS_SPACE_8
353void bus_space_set_multi_8(bus_space_tag_t, bus_space_handle_t, 358void bus_space_set_multi_8(bus_space_tag_t, bus_space_handle_t,
354 bus_size_t, u_int64_t, bus_size_t); 359 bus_size_t, u_int64_t, bus_size_t);
 360#endif
355 361
356void bus_space_set_multi_stream_1(bus_space_tag_t, bus_space_handle_t, 362void bus_space_set_multi_stream_1(bus_space_tag_t, bus_space_handle_t,
357 bus_size_t, u_int8_t, bus_size_t); 363 bus_size_t, u_int8_t, bus_size_t);
358void bus_space_set_multi_stream_2(bus_space_tag_t, bus_space_handle_t, 364void bus_space_set_multi_stream_2(bus_space_tag_t, bus_space_handle_t,
359 bus_size_t, u_int16_t, bus_size_t); 365 bus_size_t, u_int16_t, bus_size_t);
360void bus_space_set_multi_stream_4(bus_space_tag_t, bus_space_handle_t, 366void bus_space_set_multi_stream_4(bus_space_tag_t, bus_space_handle_t,
361 bus_size_t, u_int32_t, bus_size_t); 367 bus_size_t, u_int32_t, bus_size_t);
 368#ifdef __HAVE_BUS_SPACE_8
362void bus_space_set_multi_stream_8(bus_space_tag_t, bus_space_handle_t, 369void bus_space_set_multi_stream_8(bus_space_tag_t, bus_space_handle_t,
363 bus_size_t, u_int64_t, bus_size_t); 370 bus_size_t, u_int64_t, bus_size_t);
 371#endif
364 372
365void bus_space_set_region_1(bus_space_tag_t, bus_space_handle_t, 373void bus_space_set_region_1(bus_space_tag_t, bus_space_handle_t,
366 bus_size_t, u_int8_t, bus_size_t); 374 bus_size_t, u_int8_t, bus_size_t);
367void bus_space_set_region_2(bus_space_tag_t, bus_space_handle_t, 375void bus_space_set_region_2(bus_space_tag_t, bus_space_handle_t,
368 bus_size_t, u_int16_t, bus_size_t); 376 bus_size_t, u_int16_t, bus_size_t);
369void bus_space_set_region_4(bus_space_tag_t, bus_space_handle_t, 377void bus_space_set_region_4(bus_space_tag_t, bus_space_handle_t,
370 bus_size_t, u_int32_t, bus_size_t); 378 bus_size_t, u_int32_t, bus_size_t);
 379#ifdef __HAVE_BUS_SPACE_8
371void bus_space_set_region_8(bus_space_tag_t, bus_space_handle_t, 380void bus_space_set_region_8(bus_space_tag_t, bus_space_handle_t,
372 bus_size_t, u_int64_t, bus_size_t); 381 bus_size_t, u_int64_t, bus_size_t);
 382#endif
373 383
374void bus_space_set_region_stream_1(bus_space_tag_t, bus_space_handle_t, 384void bus_space_set_region_stream_1(bus_space_tag_t, bus_space_handle_t,
375 bus_size_t, u_int8_t, bus_size_t); 385 bus_size_t, u_int8_t, bus_size_t);
376void bus_space_set_region_stream_2(bus_space_tag_t, bus_space_handle_t, 386void bus_space_set_region_stream_2(bus_space_tag_t, bus_space_handle_t,
377 bus_size_t, u_int16_t, bus_size_t); 387 bus_size_t, u_int16_t, bus_size_t);
378void bus_space_set_region_stream_4(bus_space_tag_t, bus_space_handle_t, 388void bus_space_set_region_stream_4(bus_space_tag_t, bus_space_handle_t,
379 bus_size_t, u_int32_t, bus_size_t); 389 bus_size_t, u_int32_t, bus_size_t);
 390#ifdef __HAVE_BUS_SPACE_8
380void bus_space_set_region_stream_8(bus_space_tag_t, bus_space_handle_t, 391void bus_space_set_region_stream_8(bus_space_tag_t, bus_space_handle_t,
381 bus_size_t, u_int64_t, bus_size_t); 392 bus_size_t, u_int64_t, bus_size_t);
 393#endif
382 394
383void bus_space_copy_region_1(bus_space_tag_t, bus_space_handle_t, 395void bus_space_copy_region_1(bus_space_tag_t, bus_space_handle_t,
384 bus_size_t, bus_space_handle_t, 396 bus_size_t, bus_space_handle_t,
385 bus_size_t, bus_size_t); 397 bus_size_t, bus_size_t);
386void bus_space_copy_region_2(bus_space_tag_t, bus_space_handle_t, 398void bus_space_copy_region_2(bus_space_tag_t, bus_space_handle_t,
387 bus_size_t, bus_space_handle_t, 399 bus_size_t, bus_space_handle_t,
388 bus_size_t, bus_size_t); 400 bus_size_t, bus_size_t);
389void bus_space_copy_region_4(bus_space_tag_t, bus_space_handle_t, 401void bus_space_copy_region_4(bus_space_tag_t, bus_space_handle_t,
390 bus_size_t, bus_space_handle_t, 402 bus_size_t, bus_space_handle_t,
391 bus_size_t, bus_size_t); 403 bus_size_t, bus_size_t);
 404#ifdef __HAVE_BUS_SPACE_8
392void bus_space_copy_region_8(bus_space_tag_t, bus_space_handle_t, 405void bus_space_copy_region_8(bus_space_tag_t, bus_space_handle_t,
393 bus_size_t, bus_space_handle_t, 406 bus_size_t, bus_space_handle_t,
394 bus_size_t, bus_size_t); 407 bus_size_t, bus_size_t);
 408#endif
395 409
396void bus_space_copy_region_stream_1(bus_space_tag_t, bus_space_handle_t, 410void bus_space_copy_region_stream_1(bus_space_tag_t, bus_space_handle_t,
397 bus_size_t, bus_space_handle_t, 411 bus_size_t, bus_space_handle_t,
398 bus_size_t, bus_size_t); 412 bus_size_t, bus_size_t);
399void bus_space_copy_region_stream_2(bus_space_tag_t, bus_space_handle_t, 413void bus_space_copy_region_stream_2(bus_space_tag_t, bus_space_handle_t,
400 bus_size_t, bus_space_handle_t, 414 bus_size_t, bus_space_handle_t,
401 bus_size_t, bus_size_t); 415 bus_size_t, bus_size_t);
402void bus_space_copy_region_stream_4(bus_space_tag_t, bus_space_handle_t, 416void bus_space_copy_region_stream_4(bus_space_tag_t, bus_space_handle_t,
403 bus_size_t, bus_space_handle_t, 417 bus_size_t, bus_space_handle_t,
404 bus_size_t, bus_size_t); 418 bus_size_t, bus_size_t);
 419#ifdef __HAVE_BUS_SPACE_8
405void bus_space_copy_region_stream_8(bus_space_tag_t, bus_space_handle_t, 420void bus_space_copy_region_stream_8(bus_space_tag_t, bus_space_handle_t,
406 bus_size_t, bus_space_handle_t, 421 bus_size_t, bus_space_handle_t,
407 bus_size_t, bus_size_t); 422 bus_size_t, bus_size_t);
 423#endif
408 424
409bool bus_space_is_equal(bus_space_tag_t, bus_space_tag_t); 425bool bus_space_is_equal(bus_space_tag_t, bus_space_tag_t);
410bool bus_space_handle_is_equal(bus_space_tag_t, bus_space_handle_t, 426bool bus_space_handle_is_equal(bus_space_tag_t, bus_space_handle_t,
411 bus_space_handle_t); 427 bus_space_handle_t);
412 428
413/* 429/*
414 * bus_dma(9) 430 * bus_dma(9)
415 */ 431 */
416 432
417/* Flags used in various bus DMA methods. */ 433/* Flags used in various bus DMA methods. */
418#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */ 434#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
419#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */ 435#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
420#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */ 436#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */