Annotation of sys/arch/hp300/hp300/bus_space.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: bus_space.c,v 1.5 2007/01/06 20:11:01 miod Exp $ */
2: /* $NetBSD: bus_space.c,v 1.6 2002/09/27 15:36:02 provos Exp $ */
3:
4: /*-
5: * Copyright (c) 1998 The NetBSD Foundation, Inc.
6: * All rights reserved.
7: *
8: * This code is derived from software contributed to The NetBSD Foundation
9: * by Jason R. Thorpe.
10: *
11: * Redistribution and use in source and binary forms, with or without
12: * modification, are permitted provided that the following conditions
13: * are met:
14: * 1. Redistributions of source code must retain the above copyright
15: * notice, this list of conditions and the following disclaimer.
16: * 2. Redistributions in binary form must reproduce the above copyright
17: * notice, this list of conditions and the following disclaimer in the
18: * documentation and/or other materials provided with the distribution.
19: * 3. All advertising materials mentioning features or use of this software
20: * must display the following acknowledgement:
21: * This product includes software developed by the NetBSD
22: * Foundation, Inc. and its contributors.
23: * 4. Neither the name of The NetBSD Foundation nor the names of its
24: * contributors may be used to endorse or promote products derived
25: * from this software without specific prior written permission.
26: *
27: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37: * POSSIBILITY OF SUCH DAMAGE.
38: */
39:
40: /*
41: * Implementation of bus_space mapping for the hp300.
42: */
43:
44: #include <sys/param.h>
45: #include <sys/systm.h>
46: #include <sys/extent.h>
47:
48: #include <machine/autoconf.h>
49: #include <machine/bus.h>
50:
51: #include <uvm/uvm_extern.h>
52:
53: #ifdef DIAGNOSTIC
54: extern char *extiobase;
55: #endif
56: extern struct extent *extio;
57:
58: /*
59: * Memory mapped devices (intio, dio and sgc)
60: */
61:
62: int hp300_mem_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
63: void hp300_mem_unmap(bus_space_handle_t, bus_size_t);
64: int hp300_mem_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
65: bus_space_handle_t *);
66: void * hp300_mem_vaddr(bus_space_handle_t);
67:
68: u_int8_t hp300_mem_bsr1(bus_space_handle_t, bus_size_t);
69: u_int16_t hp300_mem_bsr2(bus_space_handle_t, bus_size_t);
70: u_int32_t hp300_mem_bsr4(bus_space_handle_t, bus_size_t);
71: void hp300_mem_bsrm1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
72: void hp300_mem_bsrm2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
73: void hp300_mem_bsrm4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
74: void hp300_mem_bsrrm2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
75: void hp300_mem_bsrrm4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
76: void hp300_mem_bsrr1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
77: void hp300_mem_bsrr2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
78: void hp300_mem_bsrr4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
79: void hp300_mem_bsrrr2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
80: void hp300_mem_bsrrr4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
81: void hp300_mem_bsw1(bus_space_handle_t, bus_size_t, u_int8_t);
82: void hp300_mem_bsw2(bus_space_handle_t, bus_size_t, u_int16_t);
83: void hp300_mem_bsw4(bus_space_handle_t, bus_size_t, u_int32_t);
84: void hp300_mem_bswm1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
85: void hp300_mem_bswm2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
86: void hp300_mem_bswm4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
87: void hp300_mem_bswrm2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
88: void hp300_mem_bswrm4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
89: void hp300_mem_bswr1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
90: void hp300_mem_bswr2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
91: void hp300_mem_bswr4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
92: void hp300_mem_bswrr2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
93: void hp300_mem_bswrr4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
94: void hp300_mem_bssm1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
95: void hp300_mem_bssm2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
96: void hp300_mem_bssm4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
97: void hp300_mem_bssr1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
98: void hp300_mem_bssr2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
99: void hp300_mem_bssr4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
100:
101: struct hp300_bus_space_tag hp300_mem_tag = {
102: hp300_mem_map,
103: hp300_mem_unmap,
104: hp300_mem_subregion,
105: hp300_mem_vaddr,
106:
107: hp300_mem_bsr1,
108: hp300_mem_bsr2,
109: hp300_mem_bsr4,
110: hp300_mem_bsrm1,
111: hp300_mem_bsrm2,
112: hp300_mem_bsrm4,
113: hp300_mem_bsrrm2,
114: hp300_mem_bsrrm4,
115: hp300_mem_bsrr1,
116: hp300_mem_bsrr2,
117: hp300_mem_bsrr4,
118: hp300_mem_bsrrr2,
119: hp300_mem_bsrrr4,
120: hp300_mem_bsw1,
121: hp300_mem_bsw2,
122: hp300_mem_bsw4,
123: hp300_mem_bswm1,
124: hp300_mem_bswm2,
125: hp300_mem_bswm4,
126: hp300_mem_bswrm2,
127: hp300_mem_bswrm4,
128: hp300_mem_bswr1,
129: hp300_mem_bswr2,
130: hp300_mem_bswr4,
131: hp300_mem_bswrr2,
132: hp300_mem_bswrr4,
133: hp300_mem_bssm1,
134: hp300_mem_bssm2,
135: hp300_mem_bssm4,
136: hp300_mem_bssr1,
137: hp300_mem_bssr2,
138: hp300_mem_bssr4
139: };
140:
141: int
142: hp300_mem_map(bus_addr_t bpa, bus_size_t size, int flags,
143: bus_space_handle_t *bshp)
144: {
145: u_long kva;
146: pt_entry_t template;
147: int error;
148:
149: /*
150: * intio space is direct-mapped in pmap_bootstrap(); just do the
151: * translation in this case.
152: */
153: if (bpa >= INTIOBASE && bpa < INTIOTOP) {
154: *bshp = IIOV(bpa);
155: return (0);
156: }
157:
158: /*
159: * Allocate virtual address space from the extio extent map.
160: */
161: size = round_page(bpa + size) - trunc_page(bpa);
162: error = extent_alloc(extio, size, PAGE_SIZE, 0, EX_NOBOUNDARY,
163: EX_NOWAIT | EX_MALLOCOK, &kva);
164: if (error)
165: return (error);
166:
167: *bshp = (bus_space_handle_t)kva + (bpa & PAGE_MASK);
168: bpa = trunc_page(bpa);
169:
170: /*
171: * Map the range.
172: */
173: if (flags & BUS_SPACE_MAP_CACHEABLE)
174: template = PG_RW;
175: else
176: template = PG_RW | PG_CI;
177: while (size != 0) {
178: pmap_kenter_cache(kva, bpa, template);
179: size -= PAGE_SIZE;
180: kva += PAGE_SIZE;
181: bpa += PAGE_SIZE;
182: }
183: pmap_update(pmap_kernel());
184:
185: /*
186: * All done.
187: */
188: return (0);
189: }
190:
191: void
192: hp300_mem_unmap(bus_space_handle_t bsh, bus_size_t size)
193: {
194: #ifdef DIAGNOSTIC
195: extern int eiomapsize;
196: #endif
197: int error;
198:
199: /*
200: * intio space is direct-mapped in pmap_bootstrap(); nothing
201: * to do.
202: */
203: if (IIOP(bsh) >= INTIOBASE && IIOP(bsh) < INTIOTOP)
204: return;
205:
206: #ifdef DIAGNOSTIC
207: if ((caddr_t)bsh < extiobase ||
208: (caddr_t)bsh >= extiobase + ptoa(eiomapsize)) {
209: printf("bus_space_unmap: bad bus space handle %x\n", bsh);
210: return;
211: }
212: #endif
213:
214: size = round_page(bsh + size) - trunc_page(bsh);
215: bsh = trunc_page(bsh);
216:
217: /*
218: * Unmap the range.
219: */
220: pmap_kremove(bsh, size);
221: pmap_update(pmap_kernel());
222:
223: /*
224: * Free it from the extio extent map.
225: */
226: error = extent_free(extio, (u_long)bsh, size, EX_NOWAIT | EX_MALLOCOK);
227: #ifdef DIAGNOSTIC
228: if (error != 0) {
229: printf("bus_space_unmap: kva 0x%lx size 0x%lx: "
230: "can't free region (%d)\n", (vaddr_t)bsh, size, error);
231: }
232: #endif
233: }
234:
235: /* ARGSUSED */
236: int
237: hp300_mem_subregion(bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
238: bus_space_handle_t *nbshp)
239: {
240: *nbshp = bsh + offset;
241: return (0);
242: }
243:
244: #if 0
245: /* ARGSUSED */
246: paddr_t
247: hp300_mem_mmap(bus_addr_t addr, off_t offset, int prot, int flags)
248: {
249: return (((paddr_t)addr + offset) >> PAGE_SHIFT);
250: }
251: #endif
252:
253: void *
254: hp300_mem_vaddr(bus_space_handle_t h)
255: {
256: return ((void *)h);
257: }
258:
259: u_int8_t
260: hp300_mem_bsr1(bus_space_handle_t bsh, bus_size_t offset)
261: {
262: return (*(volatile u_int8_t *) (bsh + offset));
263: }
264:
265: u_int16_t
266: hp300_mem_bsr2(bus_space_handle_t bsh, bus_size_t offset)
267: {
268: return (*(volatile u_int16_t *) (bsh + offset));
269: }
270:
271: u_int32_t
272: hp300_mem_bsr4(bus_space_handle_t bsh, bus_size_t offset)
273: {
274: return (*(volatile u_int32_t *) (bsh + offset));
275: }
276:
277: void
278: hp300_mem_bsrm1(bus_space_handle_t h, bus_size_t offset,
279: u_int8_t *a, size_t c)
280: {
281: __asm __volatile (
282: " movl %0,a0 ;"
283: " movl %1,a1 ;"
284: " movl %2,d0 ;"
285: "1: movb a0@,a1@+ ;"
286: " subql #1,d0 ;"
287: " jne 1b" :
288: :
289: "r" (h + offset), "g" (a), "g" (c) :
290: "a0","a1","d0");
291: }
292:
293: void
294: hp300_mem_bsrm2(bus_space_handle_t h, bus_size_t offset,
295: u_int16_t *a, size_t c)
296: {
297: __asm __volatile (
298: " movl %0,a0 ;"
299: " movl %1,a1 ;"
300: " movl %2,d0 ;"
301: "1: movw a0@,a1@+ ;"
302: " subql #1,d0 ;"
303: " jne 1b" :
304: :
305: "r" (h + offset), "g" (a), "g" (c) :
306: "a0","a1","d0");
307: }
308:
309: void
310: hp300_mem_bsrm4(bus_space_handle_t h, bus_size_t offset,
311: u_int32_t *a, size_t c)
312: {
313: __asm __volatile (
314: " movl %0,a0 ;"
315: " movl %1,a1 ;"
316: " movl %2,%d0 ;"
317: "1: movl a0@,a1@+ ;"
318: " subql #1,d0 ;"
319: " jne 1b" :
320: :
321: "r" (h + offset), "g" (a), "g" (c) :
322: "a0","a1","d0");
323: }
324:
325: void
326: hp300_mem_bsrrm2(bus_space_handle_t h, bus_size_t offset,
327: u_int8_t *a, size_t c)
328: {
329: __asm __volatile (
330: " movl %0,a0 ;"
331: " movl %1,a1 ;"
332: " movl %2,d0 ;"
333: "1: movw a0@,a1@+ ;"
334: " subql #1,d0 ;"
335: " jne 1b" :
336: :
337: "r" (h + offset), "g" (a), "g" (c) :
338: "a0","a1","d0");
339: }
340:
341: void
342: hp300_mem_bsrrm4(bus_space_handle_t h, bus_size_t offset,
343: u_int8_t *a, size_t c)
344: {
345: __asm __volatile (
346: " movl %0,a0 ;"
347: " movl %1,a1 ;"
348: " movl %2,%d0 ;"
349: "1: movl a0@,a1@+ ;"
350: " subql #1,d0 ;"
351: " jne 1b" :
352: :
353: "r" (h + offset), "g" (a), "g" (c) :
354: "a0","a1","d0");
355: }
356:
357: void
358: hp300_mem_bsrr1(bus_space_handle_t h, bus_size_t offset,
359: u_int8_t *a, size_t c)
360: {
361: __asm __volatile (
362: " movl %0,a0 ;"
363: " movl %1,a1 ;"
364: " movl %2,d0 ;"
365: "1: movb a0@+,a1@+ ;"
366: " subql #1,d0 ;"
367: " jne 1b" :
368: :
369: "r" (h + offset), "g" (a), "g" (c) :
370: "a0","a1","d0");
371: }
372:
373: void
374: hp300_mem_bsrr2(bus_space_handle_t h, bus_size_t offset,
375: u_int16_t *a, size_t c)
376: {
377: __asm __volatile (
378: " movl %0,a0 ;"
379: " movl %1,a1 ;"
380: " movl %2,d0 ;"
381: "1: movw a0@+,a1@+ ;"
382: " subql #1,d0 ;"
383: " jne 1b" :
384: :
385: "r" (h + offset), "g" (a), "g" (c) :
386: "a0","a1","d0");
387: }
388:
389: void
390: hp300_mem_bsrr4(bus_space_handle_t h, bus_size_t offset,
391: u_int32_t *a, size_t c)
392: {
393: __asm __volatile (
394: " movl %0,a0 ;"
395: " movl %1,a1 ;"
396: " movl %2,d0 ;"
397: "1: movl a0@+,a1@+ ;"
398: " subql #1,d0 ;"
399: " jne 1b" :
400: :
401: "r" (h + offset), "g" (a), "g" (c) :
402: "a0","a1","d0");
403: }
404:
405: void
406: hp300_mem_bsrrr2(bus_space_handle_t h, bus_size_t offset,
407: u_int8_t *a, size_t c)
408: {
409: __asm __volatile (
410: " movl %0,a0 ;"
411: " movl %1,a1 ;"
412: " movl %2,d0 ;"
413: "1: movw a0@+,a1@+ ;"
414: " subql #1,d0 ;"
415: " jne 1b" :
416: :
417: "r" (h + offset), "g" (a), "g" (c / 2) :
418: "a0","a1","d0");
419: }
420:
421: void
422: hp300_mem_bsrrr4(bus_space_handle_t h, bus_size_t offset,
423: u_int8_t *a, size_t c)
424: {
425: __asm __volatile (
426: " movl %0,a0 ;"
427: " movl %1,a1 ;"
428: " movl %2,d0 ;"
429: "1: movl a0@+,a1@+ ;"
430: " subql #1,d0 ;"
431: " jne 1b" :
432: :
433: "r" (h + offset), "g" (a), "g" (c / 4) :
434: "a0","a1","d0");
435: }
436:
437: void
438: hp300_mem_bsw1(bus_space_handle_t h, bus_size_t offset,
439: u_int8_t v)
440: {
441: (*(volatile u_int8_t *)(h + offset)) = v;
442: }
443:
444: void
445: hp300_mem_bsw2(bus_space_handle_t h, bus_size_t offset,
446: u_int16_t v)
447: {
448: (*(volatile u_int16_t *)(h + offset)) = v;
449: }
450:
451: void
452: hp300_mem_bsw4(bus_space_handle_t h, bus_size_t offset,
453: u_int32_t v)
454: {
455: (*(volatile u_int32_t *)(h + offset)) = v;
456: }
457:
458: void
459: hp300_mem_bswm1(bus_space_handle_t h, bus_size_t offset,
460: const u_int8_t *a, size_t c)
461: {
462: __asm __volatile (
463: " movl %0,a0 ;"
464: " movl %1,a1 ;"
465: " movl %2,d0 ;"
466: "1: movb a1@+,a0@ ;"
467: " subql #1,d0 ;"
468: " jne 1b" :
469: :
470: "r" (h + offset), "g" (a), "g" (c) :
471: "a0","a1","d0");
472: }
473:
474: void
475: hp300_mem_bswm2(bus_space_handle_t h, bus_size_t offset,
476: const u_int16_t *a, size_t c)
477: {
478: __asm __volatile (
479: " movl %0,a0 ;"
480: " movl %1,a1 ;"
481: " movl %2,d0 ;"
482: "1: movw a1@+,a0@ ;"
483: " subql #1,d0 ;"
484: " jne 1b" :
485: :
486: "r" (h + offset), "g" (a), "g" (c) :
487: "a0","a1","d0");
488: }
489:
490: void
491: hp300_mem_bswm4(bus_space_handle_t h, bus_size_t offset,
492: const u_int32_t *a, size_t c)
493: {
494: __asm __volatile (
495: " movl %0,a0 ;"
496: " movl %1,a1 ;"
497: " movl %2,d0 ;"
498: "1: movl a1@+,a0@ ;"
499: " subql #1,d0 ;"
500: " jne 1b" :
501: :
502: "r" (h + offset), "g" (a), "g" (c) :
503: "a0","a1","d0");
504: }
505:
506: void
507: hp300_mem_bswrm2(bus_space_handle_t h, bus_size_t offset,
508: const u_int8_t *a, size_t c)
509: {
510: __asm __volatile (
511: " movl %0,a0 ;"
512: " movl %1,a1 ;"
513: " movl %2,d0 ;"
514: "1: movw a1@+,a0@ ;"
515: " subql #1,d0 ;"
516: " jne 1b" :
517: :
518: "r" (h + offset), "g" (a), "g" (c) :
519: "a0","a1","d0");
520: }
521:
522: void
523: hp300_mem_bswrm4(bus_space_handle_t h, bus_size_t offset,
524: const u_int8_t *a, size_t c)
525: {
526: __asm __volatile (
527: " movl %0,a0 ;"
528: " movl %1,a1 ;"
529: " movl %2,d0 ;"
530: "1: movl a1@+,a0@ ;"
531: " subql #1,d0 ;"
532: " jne 1b" :
533: :
534: "r" (h + offset), "g" (a), "g" (c) :
535: "a0","a1","d0");
536: }
537:
538: void
539: hp300_mem_bswr1(bus_space_handle_t h, bus_size_t offset,
540: const u_int8_t *a, size_t c)
541: {
542: __asm __volatile (
543: " movl %0,a0 ;"
544: " movl %1,a1 ;"
545: " movl %2,d0 ;"
546: "1: movb a1@+,a0@+ ;"
547: " subql #1,d0 ;"
548: " jne 1b" :
549: :
550: "r" (h + offset), "g" (a), "g" (c) :
551: "a0","a1","d0");
552: }
553:
554: void
555: hp300_mem_bswr2(bus_space_handle_t h, bus_size_t offset,
556: const u_int16_t *a, size_t c)
557: {
558: __asm __volatile (
559: " movl %0,a0 ;"
560: " movl %1,a1 ;"
561: " movl %2,d0 ;"
562: "1: movw a1@+,a0@+ ;"
563: " subql #1,d0 ;"
564: " jne 1b" :
565: :
566: "r" (h + offset), "g" (a), "g" (c) :
567: "a0","a1","d0");
568: }
569:
570: void
571: hp300_mem_bswr4(bus_space_handle_t h, bus_size_t offset,
572: const u_int32_t *a, size_t c)
573: {
574: __asm __volatile (
575: " movl %0,a0 ;"
576: " movl %1,a1 ;"
577: " movl %2,d0 ;"
578: "1: movl a1@+,a0@+ ;"
579: " subql #1,d0 ;"
580: " jne 1b" :
581: :
582: "r" (h + offset), "g" (a), "g" (c) :
583: "a0","a1","d0");
584: }
585:
586: void
587: hp300_mem_bswrr2(bus_space_handle_t h, bus_size_t offset,
588: const u_int8_t *a, size_t c)
589: {
590: __asm __volatile (
591: " movl %0,a0 ;"
592: " movl %1,a1 ;"
593: " movl %2,d0 ;"
594: "1: movw a1@+,a0@+ ;"
595: " subql #1,d0 ;"
596: " jne 1b" :
597: :
598: "r" (h + offset), "g" (a), "g" (c / 2) :
599: "a0","a1","d0");
600: }
601:
602: void
603: hp300_mem_bswrr4(bus_space_handle_t h, bus_size_t offset,
604: const u_int8_t *a, size_t c)
605: {
606: __asm __volatile (
607: " movl %0,a0 ;"
608: " movl %1,a1 ;"
609: " movl %2,d0 ;"
610: "1: movl a1@+,a0@+ ;"
611: " subql #1,d0 ;"
612: " jne 1b" :
613: :
614: "r" (h + offset), "g" (a), "g" (c / 4) :
615: "a0","a1","d0");
616: }
617:
618: void
619: hp300_mem_bssm1(bus_space_handle_t h, bus_size_t offset,
620: u_int8_t v, size_t c)
621: {
622: __asm __volatile (
623: " movl %0,a0 ;"
624: " movl %1,d1 ;"
625: " movl %2,d0 ;"
626: "1: movb d1,a0@ ;"
627: " subql #1,d0 ;"
628: " jne 1b" :
629: :
630: "r" (h + offset), "g" ((u_long)v), "g" (c) :
631: "a0","d0","d1");
632: }
633:
634: void
635: hp300_mem_bssm2(bus_space_handle_t h, bus_size_t offset,
636: u_int16_t v, size_t c)
637: {
638: __asm __volatile (
639: " movl %0,a0 ;"
640: " movl %1,d1 ;"
641: " movl %2,d0 ;"
642: "1: movw d1,a0@ ;"
643: " subql #1,d0 ;"
644: " jne 1b" :
645: :
646: "r" (h + offset), "g" ((u_long)v), "g" (c) :
647: "a0","d0","d1");
648: }
649:
650: void
651: hp300_mem_bssm4(bus_space_handle_t h, bus_size_t offset,
652: u_int32_t v, size_t c)
653: {
654: __asm __volatile (
655: " movl %0,a0 ;"
656: " movl %1,d1 ;"
657: " movl %2,d0 ;"
658: "1: movl d1,a0@ ;"
659: " subql #1,d0 ;"
660: " jne 1b" :
661: :
662: "r" (h + offset), "g" ((u_long)v), "g" (c) :
663: "a0","d0","d1");
664: }
665:
666: void
667: hp300_mem_bssr1(bus_space_handle_t h, bus_size_t offset,
668: u_int8_t v, size_t c)
669: {
670: __asm __volatile (
671: " movl %0,a0 ;"
672: " movl %1,d1 ;"
673: " movl %2,d0 ;"
674: "1: movb d1,a0@+ ;"
675: " subql #1,d0 ;"
676: " jne 1b" :
677: :
678: "r" (h + offset), "g" ((u_long)v), "g" (c) :
679: "a0","d0","d1");
680: }
681:
682: void
683: hp300_mem_bssr2(bus_space_handle_t h, bus_size_t offset,
684: u_int16_t v, size_t c)
685: {
686: __asm __volatile (
687: " movl %0,a0 ;"
688: " movl %1,d1 ;"
689: " movl %2,d0 ;"
690: "1: movw d1,a0@+ ;"
691: " subql #1,d0 ;"
692: " jne 1b" :
693: :
694: "r" (h + offset), "g" ((u_long)v), "g" (c) :
695: "a0","d0","d1");
696: }
697:
698: void
699: hp300_mem_bssr4(bus_space_handle_t h, bus_size_t offset,
700: u_int32_t v, size_t c)
701: {
702: __asm __volatile (
703: " movl %0,a0 ;"
704: " movl %1,d1 ;"
705: " movl %2,d0 ;"
706: "1: movl d1,a0@+ ;"
707: " subql #1,d0 ;"
708: " jne 1b" :
709: :
710: "r" (h + offset), "g" ((u_long)v), "g" (c) :
711: "a0","d0","d1");
712: }
713:
714: #if 0
715: paddr_t
716: bus_space_mmap(bus_space_tag_t t, bus_addr_t addr, off_t offset, int prot,
717: int flags)
718: {
719: return (((paddr_t)addr + offset) >> PAGE_SHIFT);
720: }
721: #endif
CVSweb