1 /* $NetBSD: bus.h,v 1.15 2009/07/24 06:57:53 skrll Exp $ */
3 /* $OpenBSD: bus.h,v 1.13 2001/07/30 14:15:59 art Exp $ */
6 * Copyright (c) 1998-2004 Michael Shalayeff
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _MACHINE_BUS_H_
33 #define _MACHINE_BUS_H_
35 #include <machine/cpufunc.h>
38 * Bus address and size types.
40 typedef u_long bus_addr_t
;
41 typedef u_long bus_size_t
;
42 typedef u_long bus_space_handle_t
;
44 struct hppa_bus_space_tag
{
47 int (*hbt_map
)(void *v
, bus_addr_t addr
, bus_size_t size
,
48 int flags
, bus_space_handle_t
*bshp
);
49 void (*hbt_unmap
)(void *v
, bus_space_handle_t bsh
,
51 int (*hbt_subregion
)(void *v
, bus_space_handle_t bsh
,
52 bus_size_t offset
, bus_size_t size
,
53 bus_space_handle_t
*nbshp
);
54 int (*hbt_alloc
)(void *v
, bus_addr_t rstart
, bus_addr_t rend
,
55 bus_size_t size
, bus_size_t align
,
56 bus_size_t boundary
, int flags
,
57 bus_addr_t
*addrp
, bus_space_handle_t
*bshp
);
58 void (*hbt_free
)(void *, bus_space_handle_t
, bus_size_t
);
59 void (*hbt_barrier
)(void *v
, bus_space_handle_t h
,
60 bus_size_t o
, bus_size_t l
, int op
);
61 void *(*hbt_vaddr
)(void *, bus_space_handle_t
);
62 paddr_t (*hbt_mmap
)(void *, bus_addr_t
, off_t
, int, int);
64 uint8_t (*hbt_r1
)(void *, bus_space_handle_t
, bus_size_t
);
65 uint16_t (*hbt_r2
)(void *, bus_space_handle_t
, bus_size_t
);
66 uint32_t (*hbt_r4
)(void *, bus_space_handle_t
, bus_size_t
);
67 uint64_t (*hbt_r8
)(void *, bus_space_handle_t
, bus_size_t
);
69 void (*hbt_w1
)(void *, bus_space_handle_t
, bus_size_t
, uint8_t);
70 void (*hbt_w2
)(void *, bus_space_handle_t
, bus_size_t
, uint16_t);
71 void (*hbt_w4
)(void *, bus_space_handle_t
, bus_size_t
, uint32_t);
72 void (*hbt_w8
)(void *, bus_space_handle_t
, bus_size_t
, uint64_t);
74 void (*hbt_rm_1
)(void *v
, bus_space_handle_t h
,
75 bus_size_t o
, uint8_t *a
, bus_size_t c
);
76 void (*hbt_rm_2
)(void *v
, bus_space_handle_t h
,
77 bus_size_t o
, uint16_t *a
, bus_size_t c
);
78 void (*hbt_rm_4
)(void *v
, bus_space_handle_t h
,
79 bus_size_t o
, uint32_t *a
, bus_size_t c
);
80 void (*hbt_rm_8
)(void *v
, bus_space_handle_t h
,
81 bus_size_t o
, uint64_t *a
, bus_size_t c
);
83 void (*hbt_wm_1
)(void *v
, bus_space_handle_t h
, bus_size_t o
,
84 const uint8_t *a
, bus_size_t c
);
85 void (*hbt_wm_2
)(void *v
, bus_space_handle_t h
, bus_size_t o
,
86 const uint16_t *a
, bus_size_t c
);
87 void (*hbt_wm_4
)(void *v
, bus_space_handle_t h
, bus_size_t o
,
88 const uint32_t *a
, bus_size_t c
);
89 void (*hbt_wm_8
)(void *v
, bus_space_handle_t h
, bus_size_t o
,
90 const uint64_t *a
, bus_size_t c
);
92 void (*hbt_sm_1
)(void *v
, bus_space_handle_t h
, bus_size_t o
,
93 uint8_t vv
, bus_size_t c
);
94 void (*hbt_sm_2
)(void *v
, bus_space_handle_t h
, bus_size_t o
,
95 uint16_t vv
, bus_size_t c
);
96 void (*hbt_sm_4
)(void *v
, bus_space_handle_t h
, bus_size_t o
,
97 uint32_t vv
, bus_size_t c
);
98 void (*hbt_sm_8
)(void *v
, bus_space_handle_t h
, bus_size_t o
,
99 uint64_t vv
, bus_size_t c
);
101 void (*hbt_rrm_2
)(void *v
, bus_space_handle_t h
,
102 bus_size_t o
, uint16_t *a
, bus_size_t c
);
103 void (*hbt_rrm_4
)(void *v
, bus_space_handle_t h
,
104 bus_size_t o
, uint32_t *a
, bus_size_t c
);
105 void (*hbt_rrm_8
)(void *v
, bus_space_handle_t h
,
106 bus_size_t o
, uint64_t *a
, bus_size_t c
);
108 void (*hbt_wrm_2
)(void *v
, bus_space_handle_t h
,
109 bus_size_t o
, const uint16_t *a
, bus_size_t c
);
110 void (*hbt_wrm_4
)(void *v
, bus_space_handle_t h
,
111 bus_size_t o
, const uint32_t *a
, bus_size_t c
);
112 void (*hbt_wrm_8
)(void *v
, bus_space_handle_t h
,
113 bus_size_t o
, const uint64_t *a
, bus_size_t c
);
115 void (*hbt_rr_1
)(void *v
, bus_space_handle_t h
,
116 bus_size_t o
, uint8_t *a
, bus_size_t c
);
117 void (*hbt_rr_2
)(void *v
, bus_space_handle_t h
,
118 bus_size_t o
, uint16_t *a
, bus_size_t c
);
119 void (*hbt_rr_4
)(void *v
, bus_space_handle_t h
,
120 bus_size_t o
, uint32_t *a
, bus_size_t c
);
121 void (*hbt_rr_8
)(void *v
, bus_space_handle_t h
,
122 bus_size_t o
, uint64_t *a
, bus_size_t c
);
124 void (*hbt_wr_1
)(void *v
, bus_space_handle_t h
,
125 bus_size_t o
, const uint8_t *a
, bus_size_t c
);
126 void (*hbt_wr_2
)(void *v
, bus_space_handle_t h
,
127 bus_size_t o
, const uint16_t *a
, bus_size_t c
);
128 void (*hbt_wr_4
)(void *v
, bus_space_handle_t h
,
129 bus_size_t o
, const uint32_t *a
, bus_size_t c
);
130 void (*hbt_wr_8
)(void *v
, bus_space_handle_t h
,
131 bus_size_t o
, const uint64_t *a
, bus_size_t c
);
133 void (*hbt_rrr_2
)(void *v
, bus_space_handle_t h
,
134 bus_size_t o
, uint16_t *a
, bus_size_t c
);
135 void (*hbt_rrr_4
)(void *v
, bus_space_handle_t h
,
136 bus_size_t o
, uint32_t *a
, bus_size_t c
);
137 void (*hbt_rrr_8
)(void *v
, bus_space_handle_t h
,
138 bus_size_t o
, uint64_t *a
, bus_size_t c
);
140 void (*hbt_wrr_2
)(void *v
, bus_space_handle_t h
,
141 bus_size_t o
, const uint16_t *a
, bus_size_t c
);
142 void (*hbt_wrr_4
)(void *v
, bus_space_handle_t h
,
143 bus_size_t o
, const uint32_t *a
, bus_size_t c
);
144 void (*hbt_wrr_8
)(void *v
, bus_space_handle_t h
,
145 bus_size_t o
, const uint64_t *a
, bus_size_t c
);
147 void (*hbt_sr_1
)(void *v
, bus_space_handle_t h
,
148 bus_size_t o
, uint8_t vv
, bus_size_t c
);
149 void (*hbt_sr_2
)(void *v
, bus_space_handle_t h
,
150 bus_size_t o
, uint16_t vv
, bus_size_t c
);
151 void (*hbt_sr_4
)(void *v
, bus_space_handle_t h
,
152 bus_size_t o
, uint32_t vv
, bus_size_t c
);
153 void (*hbt_sr_8
)(void *v
, bus_space_handle_t h
,
154 bus_size_t o
, uint64_t vv
, bus_size_t c
);
156 void (*hbt_cp_1
)(void *v
, bus_space_handle_t h1
, bus_size_t o1
,
157 bus_space_handle_t h2
, bus_size_t o2
, bus_size_t c
);
158 void (*hbt_cp_2
)(void *v
, bus_space_handle_t h1
, bus_size_t o1
,
159 bus_space_handle_t h2
, bus_size_t o2
, bus_size_t c
);
160 void (*hbt_cp_4
)(void *v
, bus_space_handle_t h1
, bus_size_t o1
,
161 bus_space_handle_t h2
, bus_size_t o2
, bus_size_t c
);
162 void (*hbt_cp_8
)(void *v
, bus_space_handle_t h1
, bus_size_t o1
,
163 bus_space_handle_t h2
, bus_size_t o2
, bus_size_t c
);
165 typedef const struct hppa_bus_space_tag
*bus_space_tag_t
;
166 extern const struct hppa_bus_space_tag hppa_bustag
;
168 /* flags for bus space map functions */
169 #define BUS_SPACE_MAP_CACHEABLE 0x0001
170 #define BUS_SPACE_MAP_LINEAR 0x0002
171 #define BUS_SPACE_MAP_READONLY 0x0004
172 #define BUS_SPACE_MAP_PREFETCHABLE 0x0008
173 #define BUS_SPACE_MAP_NOEXTENT 0x8000 /* no extent ops */
174 #define BUS_SPACE_BARRIER_READ 0x0000
175 #define BUS_SPACE_BARRIER_WRITE 0x0001
178 /* bus access routines */
179 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
181 #define bus_space_map(t,a,c,ca,hp) \
182 (((t)->hbt_map)((t)->hbt_cookie,(a),(c),(ca),(hp)))
183 #define bus_space_unmap(t,h,c) \
184 (((t)->hbt_unmap)((t)->hbt_cookie,(h),(c)))
185 #define bus_space_subregion(t,h,o,c,hp) \
186 (((t)->hbt_subregion)((t)->hbt_cookie,(h),(o),(c),(hp)))
187 #define bus_space_alloc(t,b,e,c,al,bn,ca,ap,hp) \
188 (((t)->hbt_alloc)((t)->hbt_cookie,(b),(e),(c),(al),(bn),(ca),(ap),(hp)))
189 #define bus_space_free(t,h,c) \
190 (((t)->hbt_free)((t)->hbt_cookie,(h),(c)))
191 #define bus_space_barrier(t,h,o,l,op) \
192 ((t)->hbt_barrier((t)->hbt_cookie, (h), (o), (l), (op)))
193 #define bus_space_vaddr(t,h) \
194 (((t)->hbt_vaddr)((t)->hbt_cookie,(h)))
195 #define bus_space_mmap(t, a, o, p, f) \
196 (*(t)->hbt_mmap)((t)->hbt_cookie, (a), (o), (p), (f))
198 #define bus_space_read_1(t,h,o) (((t)->hbt_r1)((t)->hbt_cookie,(h),(o)))
199 #define bus_space_read_2(t,h,o) (((t)->hbt_r2)((t)->hbt_cookie,(h),(o)))
200 #define bus_space_read_4(t,h,o) (((t)->hbt_r4)((t)->hbt_cookie,(h),(o)))
201 #define bus_space_read_8(t,h,o) (((t)->hbt_r8)((t)->hbt_cookie,(h),(o)))
203 #define bus_space_write_1(t,h,o,v) (((t)->hbt_w1)((t)->hbt_cookie,(h),(o),(v)))
204 #define bus_space_write_2(t,h,o,v) (((t)->hbt_w2)((t)->hbt_cookie,(h),(o),(v)))
205 #define bus_space_write_4(t,h,o,v) (((t)->hbt_w4)((t)->hbt_cookie,(h),(o),(v)))
206 #define bus_space_write_8(t,h,o,v) (((t)->hbt_w8)((t)->hbt_cookie,(h),(o),(v)))
209 #define __BUS_SPACE_HAS_STREAM_METHODS
210 #define bus_space_read_stream_2 bus_space_read_2
211 #define bus_space_read_stream_4 bus_space_read_4
212 #define bus_space_read_stream_8 bus_space_read_8
214 #define bus_space_write_stream_2 bus_space_write_2
215 #define bus_space_write_stream_4 bus_space_write_4
216 #define bus_space_write_stream_8 bus_space_write_8
218 #define bus_space_read_multi_1(t,h,o,a,c) \
219 (((t)->hbt_rm_1)((t)->hbt_cookie, (h), (o), (a), (c)))
220 #define bus_space_read_multi_2(t,h,o,a,c) \
221 (((t)->hbt_rm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
222 #define bus_space_read_multi_4(t,h,o,a,c) \
223 (((t)->hbt_rm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
224 #define bus_space_read_multi_8(t,h,o,a,c) \
225 (((t)->hbt_rm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
227 #define bus_space_write_multi_1(t,h,o,a,c) \
228 (((t)->hbt_wm_1)((t)->hbt_cookie, (h), (o), (a), (c)))
229 #define bus_space_write_multi_2(t,h,o,a,c) \
230 (((t)->hbt_wm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
231 #define bus_space_write_multi_4(t,h,o,a,c) \
232 (((t)->hbt_wm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
233 #define bus_space_write_multi_8(t,h,o,a,c) \
234 (((t)->hbt_wm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
236 #define bus_space_set_multi_1(t,h,o,v,c) \
237 (((t)->hbt_sm_1)((t)->hbt_cookie, (h), (o), (v), (c)))
238 #define bus_space_set_multi_2(t,h,o,v,c) \
239 (((t)->hbt_sm_2)((t)->hbt_cookie, (h), (o), (v), (c)))
240 #define bus_space_set_multi_4(t,h,o,v,c) \
241 (((t)->hbt_sm_4)((t)->hbt_cookie, (h), (o), (v), (c)))
242 #define bus_space_set_multi_8(t,h,o,v,c) \
243 (((t)->hbt_sm_8)((t)->hbt_cookie, (h), (o), (v), (c)))
245 #define bus_space_read_multi_stream_2(t, h, o, a, c) \
246 (((t)->hbt_rrm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
247 #define bus_space_read_multi_stream_4(t, h, o, a, c) \
248 (((t)->hbt_rrm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
249 #define bus_space_read_multi_stream_8(t, h, o, a, c) \
250 (((t)->hbt_rrm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
252 #define bus_space_write_multi_stream_2(t, h, o, a, c) \
253 (((t)->hbt_wrm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
254 #define bus_space_write_multi_stream_4(t, h, o, a, c) \
255 (((t)->hbt_wrm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
256 #define bus_space_write_multi_stream_8(t, h, o, a, c) \
257 (((t)->hbt_wrm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
259 #define bus_space_read_region_1(t, h, o, a, c) \
260 (((t)->hbt_rr_1)((t)->hbt_cookie, (h), (o), (a), (c)))
261 #define bus_space_read_region_2(t, h, o, a, c) \
262 (((t)->hbt_rr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
263 #define bus_space_read_region_4(t, h, o, a, c) \
264 (((t)->hbt_rr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
265 #define bus_space_read_region_8(t, h, o, a, c) \
266 (((t)->hbt_rr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
268 #define bus_space_write_region_1(t, h, o, a, c) \
269 (((t)->hbt_wr_1)((t)->hbt_cookie, (h), (o), (a), (c)))
270 #define bus_space_write_region_2(t, h, o, a, c) \
271 (((t)->hbt_wr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
272 #define bus_space_write_region_4(t, h, o, a, c) \
273 (((t)->hbt_wr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
274 #define bus_space_write_region_8(t, h, o, a, c) \
275 (((t)->hbt_wr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
277 #define bus_space_read_region_stream_2(t, h, o, a, c) \
278 (((t)->hbt_rrr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
279 #define bus_space_read_region_stream_4(t, h, o, a, c) \
280 (((t)->hbt_rrr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
281 #define bus_space_read_region_stream_8(t, h, o, a, c) \
282 (((t)->hbt_rrr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
284 #define bus_space_write_region_stream_2(t, h, o, a, c) \
285 (((t)->hbt_wrr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
286 #define bus_space_write_region_stream_4(t, h, o, a, c) \
287 (((t)->hbt_wrr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
288 #define bus_space_write_region_stream_8(t, h, o, a, c) \
289 (((t)->hbt_wrr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
291 #define bus_space_set_region_1(t, h, o, v, c) \
292 (((t)->hbt_sr_1)((t)->hbt_cookie, (h), (o), (v), (c)))
293 #define bus_space_set_region_2(t, h, o, v, c) \
294 (((t)->hbt_sr_2)((t)->hbt_cookie, (h), (o), (v), (c)))
295 #define bus_space_set_region_4(t, h, o, v, c) \
296 (((t)->hbt_sr_4)((t)->hbt_cookie, (h), (o), (v), (c)))
297 #define bus_space_set_region_8(t, h, o, v, c) \
298 (((t)->hbt_sr_8)((t)->hbt_cookie, (h), (o), (v), (c)))
300 #define bus_space_copy_1(t, h1, o1, h2, o2, c) \
301 (((t)->hbt_cp_1)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
302 #define bus_space_copy_2(t, h1, o1, h2, o2, c) \
303 (((t)->hbt_cp_2)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
304 #define bus_space_copy_4(t, h1, o1, h2, o2, c) \
305 (((t)->hbt_cp_4)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
306 #define bus_space_copy_8(t, h1, o1, h2, o2, c) \
307 (((t)->hbt_cp_8)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
309 #define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
310 #define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
311 #define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */
312 #define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */
313 #define BUS_DMA_STREAMING 0x008 /* hint: sequential, unidirectional */
314 #define BUS_DMA_BUS1 0x010 /* placeholders for bus functions... */
315 #define BUS_DMA_BUS2 0x020
316 #define BUS_DMA_BUS3 0x040
317 #define BUS_DMA_BUS4 0x080
318 #define BUS_DMA_READ 0x100 /* mapping is device -> memory only */
319 #define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */
320 #define BUS_DMA_NOCACHE 0x400 /* hint: map non-cached memory */
322 /* For devices that have a 24-bit address space */
323 #define BUS_DMA_24BIT BUS_DMA_BUS1
325 /* Forwards needed by prototypes below. */
330 #define BUS_DMASYNC_POSTREAD 0x01
331 #define BUS_DMASYNC_POSTWRITE 0x02
332 #define BUS_DMASYNC_PREREAD 0x04
333 #define BUS_DMASYNC_PREWRITE 0x08
335 typedef const struct hppa_bus_dma_tag
*bus_dma_tag_t
;
336 typedef struct hppa_bus_dmamap
*bus_dmamap_t
;
338 #define BUS_DMA_TAG_VALID(t) ((t) != (bus_dma_tag_t)0)
343 * Describes a single contiguous DMA transaction. Values
344 * are suitable for programming into DMA registers.
346 struct hppa_bus_dma_segment
{
347 bus_addr_t ds_addr
; /* DMA address */
348 bus_size_t ds_len
; /* length of transfer */
349 void *_ds_mlist
; /* page list when dmamem_alloc'ed */
350 vaddr_t _ds_va
; /* VA when dmamem_map'ed */
352 typedef struct hppa_bus_dma_segment bus_dma_segment_t
;
357 * A machine-dependent opaque type describing the implementation of
358 * DMA for a given bus.
361 struct hppa_bus_dma_tag
{
362 void *_cookie
; /* cookie used in the guts */
365 * DMA mapping methods.
367 int (*_dmamap_create
)(void *, bus_size_t
, int,
368 bus_size_t
, bus_size_t
, int, bus_dmamap_t
*);
369 void (*_dmamap_destroy
)(void *, bus_dmamap_t
);
370 int (*_dmamap_load
)(void *, bus_dmamap_t
, void *,
371 bus_size_t
, struct proc
*, int);
372 int (*_dmamap_load_mbuf
)(void *, bus_dmamap_t
,
374 int (*_dmamap_load_uio
)(void *, bus_dmamap_t
,
376 int (*_dmamap_load_raw
)(void *, bus_dmamap_t
,
377 bus_dma_segment_t
*, int, bus_size_t
, int);
378 void (*_dmamap_unload
)(void *, bus_dmamap_t
);
379 void (*_dmamap_sync
)(void *, bus_dmamap_t
, bus_addr_t
, bus_size_t
, int);
382 * DMA memory utility functions.
384 int (*_dmamem_alloc
)(void *, bus_size_t
, bus_size_t
,
385 bus_size_t
, bus_dma_segment_t
*, int, int *, int);
386 void (*_dmamem_free
)(void *, bus_dma_segment_t
*, int);
387 int (*_dmamem_map
)(void *, bus_dma_segment_t
*,
388 int, size_t, void **, int);
389 void (*_dmamem_unmap
)(void *, void *, size_t);
390 paddr_t (*_dmamem_mmap
)(void *, bus_dma_segment_t
*,
391 int, off_t
, int, int);
394 #define bus_dmamap_create(t, s, n, m, b, f, p) \
395 (*(t)->_dmamap_create)((t)->_cookie, (s), (n), (m), (b), (f), (p))
396 #define bus_dmamap_destroy(t, p) \
397 (*(t)->_dmamap_destroy)((t)->_cookie, (p))
398 #define bus_dmamap_load(t, m, b, s, p, f) \
399 (*(t)->_dmamap_load)((t)->_cookie, (m), (b), (s), (p), (f))
400 #define bus_dmamap_load_mbuf(t, m, b, f) \
401 (*(t)->_dmamap_load_mbuf)((t)->_cookie, (m), (b), (f))
402 #define bus_dmamap_load_uio(t, m, u, f) \
403 (*(t)->_dmamap_load_uio)((t)->_cookie, (m), (u), (f))
404 #define bus_dmamap_load_raw(t, m, sg, n, s, f) \
405 (*(t)->_dmamap_load_raw)((t)->_cookie, (m), (sg), (n), (s), (f))
406 #define bus_dmamap_unload(t, p) \
407 (*(t)->_dmamap_unload)((t)->_cookie, (p))
408 #define bus_dmamap_sync(t, p, o, l, ops) \
409 (void)((t)->_dmamap_sync ? \
410 (*(t)->_dmamap_sync)((t)->_cookie, (p), (o), (l), (ops)) : (void)0)
412 #define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \
413 (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f))
414 #define bus_dmamem_free(t, sg, n) \
415 (*(t)->_dmamem_free)((t)->_cookie, (sg), (n))
416 #define bus_dmamem_map(t, sg, n, s, k, f) \
417 (*(t)->_dmamem_map)((t)->_cookie, (sg), (n), (s), (k), (f))
418 #define bus_dmamem_unmap(t, k, s) \
419 (*(t)->_dmamem_unmap)((t)->_cookie, (k), (s))
420 #define bus_dmamem_mmap(t, sg, n, o, p, f) \
421 (*(t)->_dmamem_mmap)((t)->_cookie, (sg), (n), (o), (p), (f))
423 #define bus_dmatag_subregion(t, mna, mxa, nt, f) EOPNOTSUPP
424 #define bus_dmatag_destroy(t)
429 * Describes a DMA mapping.
431 struct hppa_bus_dmamap
{
433 * PRIVATE MEMBERS: not for use by machine-independent code.
435 bus_size_t _dm_size
; /* largest DMA transfer mappable */
436 int _dm_segcnt
; /* number of segs this map can map */
437 bus_size_t _dm_maxsegsz
; /* fixed largest possible segment */
438 bus_size_t _dm_boundary
; /* don't cross this */
439 int _dm_flags
; /* misc. flags */
441 void *_dm_cookie
; /* cookie for bus-specific functions */
444 * PUBLIC MEMBERS: these are used by machine-independent code.
446 bus_size_t dm_maxsegsz
; /* largest possible segment */
447 bus_size_t dm_mapsize
; /* size of the mapping */
448 int dm_nsegs
; /* # valid segments in mapping */
449 bus_dma_segment_t dm_segs
[1]; /* segments; variable length */
452 #endif /* _MACHINE_BUS_H_ */