g2bus_bus_mem.c revision 1.7 1 1.7 tsutsui /* $NetBSD: g2bus_bus_mem.c,v 1.7 2003/03/02 04:23:16 tsutsui Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*-
4 1.1 thorpej * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.1 thorpej * by Jason R. Thorpe.
9 1.1 thorpej *
10 1.1 thorpej * Redistribution and use in source and binary forms, with or without
11 1.1 thorpej * modification, are permitted provided that the following conditions
12 1.1 thorpej * are met:
13 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.1 thorpej * notice, this list of conditions and the following disclaimer.
15 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.1 thorpej * documentation and/or other materials provided with the distribution.
18 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.1 thorpej * must display the following acknowledgement:
20 1.1 thorpej * This product includes software developed by the NetBSD
21 1.1 thorpej * Foundation, Inc. and its contributors.
22 1.1 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 thorpej * contributors may be used to endorse or promote products derived
24 1.1 thorpej * from this software without specific prior written permission.
25 1.1 thorpej *
26 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
37 1.1 thorpej */
38 1.1 thorpej
39 1.1 thorpej /*
40 1.1 thorpej * Bus space implementation for the SEGA G2 bus.
41 1.1 thorpej *
42 1.1 thorpej * NOTE: We only implement a small subset of what the bus_space(9)
43 1.1 thorpej * API specifies. Right now, the GAPS PCI bridge is only used for
44 1.1 thorpej * the Dreamcast Broadband Adatper, so we only provide what the
45 1.1 thorpej * pci(4) and rtk(4) drivers need.
46 1.1 thorpej */
47 1.1 thorpej
48 1.1 thorpej #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
49 1.1 thorpej
50 1.1 thorpej #include <sys/param.h>
51 1.1 thorpej #include <sys/systm.h>
52 1.1 thorpej #include <sys/device.h>
53 1.1 thorpej
54 1.1 thorpej #include <machine/cpu.h>
55 1.1 thorpej #include <machine/bus.h>
56 1.1 thorpej
57 1.1 thorpej #include <dreamcast/dev/g2/g2busvar.h>
58 1.1 thorpej
59 1.1 thorpej int g2bus_bus_mem_map(void *, bus_addr_t, bus_size_t, int,
60 1.1 thorpej bus_space_handle_t *);
61 1.1 thorpej void g2bus_bus_mem_unmap(void *, bus_space_handle_t, bus_size_t);
62 1.1 thorpej
63 1.1 thorpej u_int8_t g2bus_bus_mem_read_1(void *, bus_space_handle_t, bus_size_t);
64 1.1 thorpej u_int16_t g2bus_bus_mem_read_2(void *, bus_space_handle_t, bus_size_t);
65 1.1 thorpej u_int32_t g2bus_bus_mem_read_4(void *, bus_space_handle_t, bus_size_t);
66 1.1 thorpej
67 1.1 thorpej void g2bus_bus_mem_write_1(void *, bus_space_handle_t, bus_size_t,
68 1.1 thorpej u_int8_t);
69 1.1 thorpej void g2bus_bus_mem_write_2(void *, bus_space_handle_t, bus_size_t,
70 1.1 thorpej u_int16_t);
71 1.1 thorpej void g2bus_bus_mem_write_4(void *, bus_space_handle_t, bus_size_t,
72 1.1 thorpej u_int32_t);
73 1.1 thorpej
74 1.3 thorpej void g2bus_bus_mem_read_region_1(void *, bus_space_handle_t, bus_size_t,
75 1.3 thorpej u_int8_t *, bus_size_t);
76 1.3 thorpej
77 1.3 thorpej void g2bus_bus_mem_write_region_1(void *, bus_space_handle_t, bus_size_t,
78 1.3 thorpej const u_int8_t *, bus_size_t);
79 1.3 thorpej
80 1.6 tsutsui u_int8_t g2bus_sparse_bus_mem_read_1(void *, bus_space_handle_t, bus_size_t);
81 1.6 tsutsui u_int16_t g2bus_sparse_bus_mem_read_2(void *, bus_space_handle_t, bus_size_t);
82 1.6 tsutsui u_int32_t g2bus_sparse_bus_mem_read_4(void *, bus_space_handle_t, bus_size_t);
83 1.6 tsutsui
84 1.6 tsutsui void g2bus_sparse_bus_mem_write_1(void *, bus_space_handle_t, bus_size_t,
85 1.6 tsutsui u_int8_t);
86 1.6 tsutsui void g2bus_sparse_bus_mem_write_2(void *, bus_space_handle_t, bus_size_t,
87 1.6 tsutsui u_int16_t);
88 1.6 tsutsui void g2bus_sparse_bus_mem_write_4(void *, bus_space_handle_t, bus_size_t,
89 1.6 tsutsui u_int32_t);
90 1.6 tsutsui
91 1.6 tsutsui void g2bus_sparse_bus_mem_read_region_1(void *, bus_space_handle_t,
92 1.6 tsutsui bus_size_t, u_int8_t *, bus_size_t);
93 1.6 tsutsui
94 1.6 tsutsui void g2bus_sparse_bus_mem_write_region_1(void *, bus_space_handle_t,
95 1.6 tsutsui bus_size_t, const u_int8_t *, bus_size_t);
96 1.6 tsutsui
97 1.6 tsutsui void g2bus_sparse_bus_mem_read_multi_1(void *, bus_space_handle_t,
98 1.6 tsutsui bus_size_t, u_int8_t *, bus_size_t);
99 1.6 tsutsui
100 1.6 tsutsui void g2bus_sparse_bus_mem_write_multi_1(void *, bus_space_handle_t,
101 1.6 tsutsui bus_size_t, const u_int8_t *, bus_size_t);
102 1.6 tsutsui
103 1.1 thorpej void
104 1.1 thorpej g2bus_bus_mem_init(struct g2bus_softc *sc)
105 1.1 thorpej {
106 1.1 thorpej bus_space_tag_t t = &sc->sc_memt;
107 1.1 thorpej
108 1.1 thorpej memset(t, 0, sizeof(*t));
109 1.1 thorpej
110 1.1 thorpej t->dbs_map = g2bus_bus_mem_map;
111 1.1 thorpej t->dbs_unmap = g2bus_bus_mem_unmap;
112 1.1 thorpej
113 1.1 thorpej t->dbs_r_1 = g2bus_bus_mem_read_1;
114 1.1 thorpej t->dbs_r_2 = g2bus_bus_mem_read_2;
115 1.1 thorpej t->dbs_r_4 = g2bus_bus_mem_read_4;
116 1.1 thorpej
117 1.1 thorpej t->dbs_w_1 = g2bus_bus_mem_write_1;
118 1.1 thorpej t->dbs_w_2 = g2bus_bus_mem_write_2;
119 1.1 thorpej t->dbs_w_4 = g2bus_bus_mem_write_4;
120 1.3 thorpej
121 1.3 thorpej t->dbs_rr_1 = g2bus_bus_mem_read_region_1;
122 1.3 thorpej
123 1.3 thorpej t->dbs_wr_1 = g2bus_bus_mem_write_region_1;
124 1.1 thorpej }
125 1.1 thorpej
126 1.1 thorpej int
127 1.1 thorpej g2bus_bus_mem_map(void *v, bus_addr_t addr, bus_size_t size, int flags,
128 1.1 thorpej bus_space_handle_t *shp)
129 1.1 thorpej {
130 1.1 thorpej
131 1.1 thorpej KASSERT((addr & SH3_PHYS_MASK) == addr);
132 1.1 thorpej *shp = SH3_PHYS_TO_P2SEG(addr);
133 1.1 thorpej
134 1.1 thorpej return (0);
135 1.1 thorpej }
136 1.1 thorpej
137 1.1 thorpej void
138 1.1 thorpej g2bus_bus_mem_unmap(void *v, bus_space_handle_t sh, bus_size_t size)
139 1.1 thorpej {
140 1.1 thorpej
141 1.1 thorpej KASSERT(sh >= SH3_P2SEG_BASE && sh <= SH3_P2SEG_END);
142 1.1 thorpej /* Nothing to do. */
143 1.1 thorpej }
144 1.1 thorpej
145 1.1 thorpej /*
146 1.2 marcus * G2 bus cycles must not be interrupted by IRQs or G2 DMA.
147 1.2 marcus * The following paired macros will take the necessary precautions.
148 1.1 thorpej */
149 1.1 thorpej
150 1.7 tsutsui #define G2LOCK_DECL \
151 1.7 tsutsui int __s
152 1.7 tsutsui
153 1.7 tsutsui #define G2_LOCK() \
154 1.2 marcus do { \
155 1.7 tsutsui __s = _cpu_intr_suspend(); \
156 1.2 marcus /* suspend any G2 DMA here... */ \
157 1.7 tsutsui while ((*(__volatile u_int32_t *)0xa05f688c) & 0x20) \
158 1.7 tsutsui ; \
159 1.7 tsutsui } while (/*CONSTCOND*/0)
160 1.2 marcus
161 1.7 tsutsui #define G2_UNLOCK() \
162 1.2 marcus do { \
163 1.2 marcus /* resume any G2 DMA here... */ \
164 1.7 tsutsui _cpu_intr_resume(__s); \
165 1.7 tsutsui } while (/*CONSTCOND*/0)
166 1.2 marcus
167 1.1 thorpej u_int8_t
168 1.1 thorpej g2bus_bus_mem_read_1(void *v, bus_space_handle_t sh, bus_size_t off)
169 1.1 thorpej {
170 1.7 tsutsui G2LOCK_DECL;
171 1.1 thorpej u_int8_t rv;
172 1.1 thorpej
173 1.7 tsutsui G2_LOCK();
174 1.2 marcus
175 1.3 thorpej rv = *(__volatile u_int8_t *)(sh + off);
176 1.1 thorpej
177 1.7 tsutsui G2_UNLOCK();
178 1.2 marcus
179 1.1 thorpej return (rv);
180 1.1 thorpej }
181 1.1 thorpej
182 1.1 thorpej u_int16_t
183 1.1 thorpej g2bus_bus_mem_read_2(void *v, bus_space_handle_t sh, bus_size_t off)
184 1.1 thorpej {
185 1.7 tsutsui G2LOCK_DECL;
186 1.1 thorpej u_int16_t rv;
187 1.1 thorpej
188 1.7 tsutsui G2_LOCK();
189 1.2 marcus
190 1.3 thorpej rv = *(__volatile u_int16_t *)(sh + off);
191 1.1 thorpej
192 1.7 tsutsui G2_UNLOCK();
193 1.2 marcus
194 1.1 thorpej return (rv);
195 1.1 thorpej }
196 1.1 thorpej
197 1.1 thorpej u_int32_t
198 1.1 thorpej g2bus_bus_mem_read_4(void *v, bus_space_handle_t sh, bus_size_t off)
199 1.1 thorpej {
200 1.7 tsutsui G2LOCK_DECL;
201 1.1 thorpej u_int32_t rv;
202 1.1 thorpej
203 1.7 tsutsui G2_LOCK();
204 1.2 marcus
205 1.3 thorpej rv = *(__volatile u_int32_t *)(sh + off);
206 1.1 thorpej
207 1.7 tsutsui G2_UNLOCK();
208 1.2 marcus
209 1.1 thorpej return (rv);
210 1.1 thorpej }
211 1.1 thorpej
212 1.1 thorpej void
213 1.1 thorpej g2bus_bus_mem_write_1(void *v, bus_space_handle_t sh, bus_size_t off,
214 1.1 thorpej u_int8_t val)
215 1.1 thorpej {
216 1.7 tsutsui G2LOCK_DECL;
217 1.1 thorpej
218 1.7 tsutsui G2_LOCK();
219 1.2 marcus
220 1.3 thorpej *(__volatile u_int8_t *)(sh + off) = val;
221 1.2 marcus
222 1.7 tsutsui G2_UNLOCK();
223 1.1 thorpej }
224 1.1 thorpej
225 1.1 thorpej void
226 1.1 thorpej g2bus_bus_mem_write_2(void *v, bus_space_handle_t sh, bus_size_t off,
227 1.1 thorpej u_int16_t val)
228 1.1 thorpej {
229 1.7 tsutsui G2LOCK_DECL;
230 1.1 thorpej
231 1.7 tsutsui G2_LOCK();
232 1.2 marcus
233 1.3 thorpej *(__volatile u_int16_t *)(sh + off) = val;
234 1.2 marcus
235 1.7 tsutsui G2_UNLOCK();
236 1.1 thorpej }
237 1.1 thorpej
238 1.1 thorpej void
239 1.1 thorpej g2bus_bus_mem_write_4(void *v, bus_space_handle_t sh, bus_size_t off,
240 1.1 thorpej u_int32_t val)
241 1.1 thorpej {
242 1.7 tsutsui G2LOCK_DECL;
243 1.1 thorpej
244 1.7 tsutsui G2_LOCK();
245 1.2 marcus
246 1.3 thorpej *(__volatile u_int32_t *)(sh + off) = val;
247 1.3 thorpej
248 1.7 tsutsui G2_UNLOCK();
249 1.3 thorpej }
250 1.3 thorpej
251 1.3 thorpej void
252 1.3 thorpej g2bus_bus_mem_read_region_1(void *v, bus_space_handle_t sh, bus_size_t off,
253 1.3 thorpej u_int8_t *addr, bus_size_t len)
254 1.3 thorpej {
255 1.7 tsutsui G2LOCK_DECL;
256 1.3 thorpej __volatile const u_int8_t *baddr = (u_int8_t *)(sh + off);
257 1.3 thorpej
258 1.7 tsutsui G2_LOCK();
259 1.3 thorpej
260 1.3 thorpej while (len--)
261 1.3 thorpej *addr++ = *baddr++;
262 1.3 thorpej
263 1.7 tsutsui G2_UNLOCK();
264 1.3 thorpej }
265 1.3 thorpej
266 1.3 thorpej void
267 1.3 thorpej g2bus_bus_mem_write_region_1(void *v, bus_space_handle_t sh, bus_size_t off,
268 1.3 thorpej const u_int8_t *addr, bus_size_t len)
269 1.3 thorpej {
270 1.7 tsutsui G2LOCK_DECL;
271 1.3 thorpej __volatile u_int8_t *baddr = (u_int8_t *)(sh + off);
272 1.3 thorpej
273 1.7 tsutsui G2_LOCK();
274 1.3 thorpej
275 1.3 thorpej while (len--)
276 1.3 thorpej *baddr++ = *addr++;
277 1.6 tsutsui
278 1.7 tsutsui G2_UNLOCK();
279 1.6 tsutsui }
280 1.6 tsutsui
281 1.6 tsutsui void
282 1.6 tsutsui g2bus_set_bus_mem_sparse(bus_space_tag_t memt)
283 1.6 tsutsui {
284 1.6 tsutsui
285 1.6 tsutsui memt->dbs_r_1 = g2bus_sparse_bus_mem_read_1;
286 1.6 tsutsui memt->dbs_r_2 = g2bus_sparse_bus_mem_read_2;
287 1.6 tsutsui memt->dbs_r_4 = g2bus_sparse_bus_mem_read_4;
288 1.6 tsutsui
289 1.6 tsutsui memt->dbs_w_1 = g2bus_sparse_bus_mem_write_1;
290 1.6 tsutsui memt->dbs_w_2 = g2bus_sparse_bus_mem_write_2;
291 1.6 tsutsui memt->dbs_w_4 = g2bus_sparse_bus_mem_write_4;
292 1.6 tsutsui
293 1.6 tsutsui memt->dbs_rr_1 = g2bus_sparse_bus_mem_read_region_1;
294 1.6 tsutsui
295 1.6 tsutsui memt->dbs_wr_1 = g2bus_sparse_bus_mem_write_region_1;
296 1.6 tsutsui
297 1.6 tsutsui memt->dbs_rm_1 = g2bus_sparse_bus_mem_read_multi_1;
298 1.6 tsutsui
299 1.6 tsutsui memt->dbs_wm_1 = g2bus_sparse_bus_mem_write_multi_1;
300 1.6 tsutsui }
301 1.6 tsutsui
302 1.6 tsutsui u_int8_t
303 1.6 tsutsui g2bus_sparse_bus_mem_read_1(void *v, bus_space_handle_t sh, bus_size_t off)
304 1.6 tsutsui {
305 1.7 tsutsui G2LOCK_DECL;
306 1.6 tsutsui u_int8_t rv;
307 1.6 tsutsui
308 1.7 tsutsui G2_LOCK();
309 1.6 tsutsui
310 1.6 tsutsui rv = *(__volatile u_int8_t *)(sh + (off * 4));
311 1.6 tsutsui
312 1.7 tsutsui G2_UNLOCK();
313 1.6 tsutsui
314 1.6 tsutsui return (rv);
315 1.6 tsutsui }
316 1.6 tsutsui
317 1.6 tsutsui u_int16_t
318 1.6 tsutsui g2bus_sparse_bus_mem_read_2(void *v, bus_space_handle_t sh, bus_size_t off)
319 1.6 tsutsui {
320 1.7 tsutsui G2LOCK_DECL;
321 1.6 tsutsui u_int16_t rv;
322 1.6 tsutsui
323 1.7 tsutsui G2_LOCK();
324 1.6 tsutsui
325 1.6 tsutsui rv = *(__volatile u_int16_t *)(sh + (off * 4));
326 1.6 tsutsui
327 1.7 tsutsui G2_UNLOCK();
328 1.6 tsutsui
329 1.6 tsutsui return (rv);
330 1.6 tsutsui }
331 1.6 tsutsui
332 1.6 tsutsui u_int32_t
333 1.6 tsutsui g2bus_sparse_bus_mem_read_4(void *v, bus_space_handle_t sh, bus_size_t off)
334 1.6 tsutsui {
335 1.7 tsutsui G2LOCK_DECL;
336 1.6 tsutsui u_int32_t rv;
337 1.6 tsutsui
338 1.7 tsutsui G2_LOCK();
339 1.6 tsutsui
340 1.6 tsutsui rv = *(__volatile u_int32_t *)(sh + (off * 4));
341 1.6 tsutsui
342 1.7 tsutsui G2_UNLOCK();
343 1.6 tsutsui
344 1.6 tsutsui return (rv);
345 1.6 tsutsui }
346 1.6 tsutsui
347 1.6 tsutsui void
348 1.6 tsutsui g2bus_sparse_bus_mem_write_1(void *v, bus_space_handle_t sh, bus_size_t off,
349 1.6 tsutsui u_int8_t val)
350 1.6 tsutsui {
351 1.7 tsutsui G2LOCK_DECL;
352 1.6 tsutsui
353 1.7 tsutsui G2_LOCK();
354 1.6 tsutsui
355 1.6 tsutsui *(__volatile u_int8_t *)(sh + (off * 4)) = val;
356 1.6 tsutsui
357 1.7 tsutsui G2_UNLOCK();
358 1.6 tsutsui }
359 1.6 tsutsui
360 1.6 tsutsui void
361 1.6 tsutsui g2bus_sparse_bus_mem_write_2(void *v, bus_space_handle_t sh, bus_size_t off,
362 1.6 tsutsui u_int16_t val)
363 1.6 tsutsui {
364 1.7 tsutsui G2LOCK_DECL;
365 1.6 tsutsui
366 1.7 tsutsui G2_LOCK();
367 1.6 tsutsui
368 1.6 tsutsui *(__volatile u_int16_t *)(sh + (off * 4)) = val;
369 1.6 tsutsui
370 1.7 tsutsui G2_UNLOCK();
371 1.6 tsutsui }
372 1.6 tsutsui
373 1.6 tsutsui void
374 1.6 tsutsui g2bus_sparse_bus_mem_write_4(void *v, bus_space_handle_t sh, bus_size_t off,
375 1.6 tsutsui u_int32_t val)
376 1.6 tsutsui {
377 1.7 tsutsui G2LOCK_DECL;
378 1.6 tsutsui
379 1.7 tsutsui G2_LOCK();
380 1.6 tsutsui
381 1.6 tsutsui *(__volatile u_int32_t *)(sh + (off * 4)) = val;
382 1.6 tsutsui
383 1.7 tsutsui G2_UNLOCK();
384 1.6 tsutsui }
385 1.6 tsutsui
386 1.6 tsutsui void
387 1.6 tsutsui g2bus_sparse_bus_mem_read_region_1(void *v, bus_space_handle_t sh,
388 1.6 tsutsui bus_size_t off, u_int8_t *addr, bus_size_t len)
389 1.6 tsutsui {
390 1.7 tsutsui G2LOCK_DECL;
391 1.6 tsutsui __volatile const u_int8_t *baddr = (u_int8_t *)(sh + (off * 4));
392 1.6 tsutsui
393 1.7 tsutsui G2_LOCK();
394 1.6 tsutsui
395 1.6 tsutsui while (len--) {
396 1.6 tsutsui *addr++ = *baddr;
397 1.6 tsutsui baddr += 4;
398 1.6 tsutsui }
399 1.6 tsutsui
400 1.7 tsutsui G2_UNLOCK();
401 1.6 tsutsui }
402 1.6 tsutsui
403 1.6 tsutsui void
404 1.6 tsutsui g2bus_sparse_bus_mem_write_region_1(void *v, bus_space_handle_t sh,
405 1.6 tsutsui bus_size_t off, const u_int8_t *addr, bus_size_t len)
406 1.6 tsutsui {
407 1.7 tsutsui G2LOCK_DECL;
408 1.6 tsutsui __volatile u_int8_t *baddr = (u_int8_t *)(sh + (off * 4));
409 1.6 tsutsui
410 1.7 tsutsui G2_LOCK();
411 1.6 tsutsui
412 1.6 tsutsui while (len--) {
413 1.6 tsutsui *baddr = *addr++;
414 1.6 tsutsui baddr += 4;
415 1.6 tsutsui }
416 1.6 tsutsui
417 1.7 tsutsui G2_UNLOCK();
418 1.6 tsutsui }
419 1.6 tsutsui
420 1.6 tsutsui void
421 1.6 tsutsui g2bus_sparse_bus_mem_read_multi_1(void *v, bus_space_handle_t sh,
422 1.6 tsutsui bus_size_t off, u_int8_t *addr, bus_size_t len)
423 1.6 tsutsui {
424 1.7 tsutsui G2LOCK_DECL;
425 1.6 tsutsui __volatile const u_int8_t *baddr = (u_int8_t *)(sh + (off * 4));
426 1.6 tsutsui
427 1.7 tsutsui G2_LOCK();
428 1.6 tsutsui
429 1.6 tsutsui while (len--)
430 1.6 tsutsui *addr++ = *baddr;
431 1.6 tsutsui
432 1.7 tsutsui G2_UNLOCK();
433 1.6 tsutsui }
434 1.6 tsutsui
435 1.6 tsutsui void
436 1.6 tsutsui g2bus_sparse_bus_mem_write_multi_1(void *v, bus_space_handle_t sh,
437 1.6 tsutsui bus_size_t off, const u_int8_t *addr, bus_size_t len)
438 1.6 tsutsui {
439 1.7 tsutsui G2LOCK_DECL;
440 1.6 tsutsui __volatile u_int8_t *baddr = (u_int8_t *)(sh + (off * 4));
441 1.6 tsutsui
442 1.7 tsutsui G2_LOCK();
443 1.6 tsutsui
444 1.6 tsutsui while (len--)
445 1.6 tsutsui *baddr = *addr++;
446 1.2 marcus
447 1.7 tsutsui G2_UNLOCK();
448 1.1 thorpej }
449