Pull up revisions: 1.10 src/sys/arch/atari/atari/be_bus.c 1.14 src/sys/arch/atari/atari/le_bus.c 1.8 src/sys/arch/atari/atari/mainbus.c 1.33 src/sys/arch/atari/dev/wdc_mb.c (requested by tsutsui in ticket #1252). Sprinkle volatile to bus_space(9) access functions.diff -r1.7 -r1.7.24.1 src/sys/arch/atari/atari/be_bus.c
(jdc)
--- src/sys/arch/atari/atari/be_bus.c 2005/12/11 12:16:54 1.7
+++ src/sys/arch/atari/atari/be_bus.c 2009/01/02 12:26:06 1.7.24.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: be_bus.c,v 1.7 2005/12/11 12:16:54 christos Exp $ */ | 1 | /* $NetBSD: be_bus.c,v 1.7.24.1 2009/01/02 12:26:06 jdc Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998 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 Leo Weppelman. | 8 | * by Leo Weppelman. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
36 | * POSSIBILITY OF SUCH DAMAGE. | 36 | * POSSIBILITY OF SUCH DAMAGE. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.7 2005/12/11 12:16:54 christos Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.7.24.1 2009/01/02 12:26:06 jdc Exp $"); | |
41 | 41 | |||
42 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/malloc.h> | 45 | #include <sys/malloc.h> | |
46 | #include <machine/cpu.h> | 46 | #include <machine/cpu.h> | |
47 | #include <machine/bus.h> | 47 | #include <machine/bus.h> | |
48 | 48 | |||
49 | /* | 49 | /* | |
50 | * This file contains the common functions for using a big endian (linear) | 50 | * This file contains the common functions for using a big endian (linear) | |
51 | * bus on a big endian atari. | 51 | * bus on a big endian atari. | |
52 | */ | 52 | */ | |
53 | 53 | |||
@@ -158,35 +158,35 @@ static void beb_bus_space_set_region_1 | @@ -158,35 +158,35 @@ static void beb_bus_space_set_region_1 | |||
158 | static void beb_bus_space_set_region_2 __P((bus_space_tag_t, | 158 | static void beb_bus_space_set_region_2 __P((bus_space_tag_t, | |
159 | bus_space_handle_t, bus_size_t, u_int16_t, | 159 | bus_space_handle_t, bus_size_t, u_int16_t, | |
160 | bus_size_t)); | 160 | bus_size_t)); | |
161 | static void beb_bus_space_set_region_4 __P((bus_space_tag_t, | 161 | static void beb_bus_space_set_region_4 __P((bus_space_tag_t, | |
162 | bus_space_handle_t, bus_size_t, u_int32_t, | 162 | bus_space_handle_t, bus_size_t, u_int32_t, | |
163 | bus_size_t)); | 163 | bus_size_t)); | |
164 | static void beb_bus_space_set_region_8 __P((bus_space_tag_t, | 164 | static void beb_bus_space_set_region_8 __P((bus_space_tag_t, | |
165 | bus_space_handle_t, bus_size_t, u_int64_t, | 165 | bus_space_handle_t, bus_size_t, u_int64_t, | |
166 | bus_size_t)); | 166 | bus_size_t)); | |
167 | 167 | |||
168 | /* | 168 | /* | |
169 | * Don't force a function call overhead on these primitives... | 169 | * Don't force a function call overhead on these primitives... | |
170 | */ | 170 | */ | |
171 | #define __read_1(h, o) *((u_int8_t *)((h) + (o))) | 171 | #define __read_1(h, o) *((volatile u_int8_t *)((h) + (o))) | |
172 | #define __read_2(h, o) *((u_int16_t *)((h) + (o))) | 172 | #define __read_2(h, o) *((volatile u_int16_t *)((h) + (o))) | |
173 | #define __read_4(h, o) *((u_int32_t *)((h) + (o))) | 173 | #define __read_4(h, o) *((volatile u_int32_t *)((h) + (o))) | |
174 | #define __read_8(h, o) *((u_int64_t *)((h) + (o))) | 174 | #define __read_8(h, o) *((volatile u_int64_t *)((h) + (o))) | |
175 | 175 | |||
176 | #define __write_1(h, o, v) *((u_int8_t *)((h) + (o))) = (v) | 176 | #define __write_1(h, o, v) *((volatile u_int8_t *)((h) + (o))) = (v) | |
177 | #define __write_2(h, o, v) *((u_int16_t *)((h) + (o))) = (v) | 177 | #define __write_2(h, o, v) *((volatile u_int16_t *)((h) + (o))) = (v) | |
178 | #define __write_4(h, o, v) *((u_int32_t *)((h) + (o))) = (v) | 178 | #define __write_4(h, o, v) *((volatile u_int32_t *)((h) + (o))) = (v) | |
179 | #define __write_8(h, o, v) *((u_int64_t *)((h) + (o))) = (v) | 179 | #define __write_8(h, o, v) *((volatile u_int64_t *)((h) + (o))) = (v) | |
180 | 180 | |||
181 | bus_space_tag_t | 181 | bus_space_tag_t | |
182 | beb_alloc_bus_space_tag(storage) | 182 | beb_alloc_bus_space_tag(storage) | |
183 | bus_space_tag_t storage; | 183 | bus_space_tag_t storage; | |
184 | { | 184 | { | |
185 | bus_space_tag_t beb_t; | 185 | bus_space_tag_t beb_t; | |
186 | 186 | |||
187 | /* | 187 | /* | |
188 | * Allow the caller to specify storage space for the tag. This | 188 | * Allow the caller to specify storage space for the tag. This | |
189 | * is used during console config (when malloc() can't be used). | 189 | * is used during console config (when malloc() can't be used). | |
190 | */ | 190 | */ | |
191 | if (storage != NULL) | 191 | if (storage != NULL) | |
192 | beb_t = storage; | 192 | beb_t = storage; |
--- src/sys/arch/atari/atari/le_bus.c 2006/01/29 21:42:41 1.11
+++ src/sys/arch/atari/atari/le_bus.c 2009/01/02 12:26:06 1.11.22.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: le_bus.c,v 1.11 2006/01/29 21:42:41 dsl Exp $ */ | 1 | /* $NetBSD: le_bus.c,v 1.11.22.1 2009/01/02 12:26:06 jdc Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998 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 Leo Weppelman. | 8 | * by Leo Weppelman. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
36 | * POSSIBILITY OF SUCH DAMAGE. | 36 | * POSSIBILITY OF SUCH DAMAGE. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.11 2006/01/29 21:42:41 dsl Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.11.22.1 2009/01/02 12:26:06 jdc Exp $"); | |
41 | 41 | |||
42 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/malloc.h> | 45 | #include <sys/malloc.h> | |
46 | #include <sys/bswap.h> | 46 | #include <sys/bswap.h> | |
47 | #include <machine/cpu.h> | 47 | #include <machine/cpu.h> | |
48 | #include <machine/bus.h> | 48 | #include <machine/bus.h> | |
49 | 49 | |||
50 | /* | 50 | /* | |
51 | * This file contains the common functions for using a litte endian (linear) | 51 | * This file contains the common functions for using a litte endian (linear) | |
52 | * bus on a big endian atari. | 52 | * bus on a big endian atari. | |
53 | */ | 53 | */ | |
@@ -240,35 +240,35 @@ static inline u_int16_t swap16(u_int16_t | @@ -240,35 +240,35 @@ static inline u_int16_t swap16(u_int16_t | |||
240 | } | 240 | } | |
241 | 241 | |||
242 | static inline u_int32_t swap32(u_int32_t v) | 242 | static inline u_int32_t swap32(u_int32_t v) | |
243 | { | 243 | { | |
244 | __asm volatile (" rolw #8, %0 \n" | 244 | __asm volatile (" rolw #8, %0 \n" | |
245 | " swap %0 \n" | 245 | " swap %0 \n" | |
246 | " rolw #8, %0" : "=d"(v) : "0"(v)); | 246 | " rolw #8, %0" : "=d"(v) : "0"(v)); | |
247 | return(v); | 247 | return(v); | |
248 | } | 248 | } | |
249 | 249 | |||
250 | /* | 250 | /* | |
251 | * Don't force a function call overhead on these primitives... | 251 | * Don't force a function call overhead on these primitives... | |
252 | */ | 252 | */ | |
253 | #define __read_1(h, o) *((u_int8_t *)((h) + (o))) | 253 | #define __read_1(h, o) *((volatile u_int8_t *)((h) + (o))) | |
254 | #define __read_2(h, o) swap16(*((u_int16_t *)((h) + (o)))) | 254 | #define __read_2(h, o) swap16(*((volatile u_int16_t *)((h) + (o)))) | |
255 | #define __read_4(h, o) swap32(*((u_int32_t *)((h) + (o)))) | 255 | #define __read_4(h, o) swap32(*((volatile u_int32_t *)((h) + (o)))) | |
256 | #define __read_8(h, o) bswap64(*((u_int64_t *)((h) + (o)))) | 256 | #define __read_8(h, o) bswap64(*((volatile u_int64_t *)((h) + (o)))) | |
257 | 257 | |||
258 | #define __write_1(h, o, v) *((u_int8_t *)((h) + (o))) = (v) | 258 | #define __write_1(h, o, v) *((volatile u_int8_t *)((h) + (o))) = (v) | |
259 | #define __write_2(h, o, v) *((u_int16_t *)((h) + (o))) = swap16(v) | 259 | #define __write_2(h, o, v) *((volatile u_int16_t *)((h) + (o))) = swap16(v) | |
260 | #define __write_4(h, o, v) *((u_int32_t *)((h) + (o))) = swap32(v) | 260 | #define __write_4(h, o, v) *((volatile u_int32_t *)((h) + (o))) = swap32(v) | |
261 | #define __write_8(h, o, v) *((u_int64_t *)((h) + (o))) = bswap64(v) | 261 | #define __write_8(h, o, v) *((volatile u_int64_t *)((h) + (o))) = bswap64(v) | |
262 | 262 | |||
263 | bus_space_tag_t | 263 | bus_space_tag_t | |
264 | leb_alloc_bus_space_tag(storage) | 264 | leb_alloc_bus_space_tag(storage) | |
265 | bus_space_tag_t storage; | 265 | bus_space_tag_t storage; | |
266 | { | 266 | { | |
267 | bus_space_tag_t leb_t; | 267 | bus_space_tag_t leb_t; | |
268 | 268 | |||
269 | /* | 269 | /* | |
270 | * Allow the caller to specify storage space for the tag. This | 270 | * Allow the caller to specify storage space for the tag. This | |
271 | * is used during console config (when malloc() can't be used). | 271 | * is used during console config (when malloc() can't be used). | |
272 | */ | 272 | */ | |
273 | if (storage != NULL) | 273 | if (storage != NULL) | |
274 | leb_t = storage; | 274 | leb_t = storage; | |
@@ -483,82 +483,82 @@ leb_bus_space_write_8(t, h, o, v) | @@ -483,82 +483,82 @@ leb_bus_space_write_8(t, h, o, v) | |||
483 | /* | 483 | /* | |
484 | * u_intX_t bus_space_read_stream_N __P((bus_space_tag_t tag, | 484 | * u_intX_t bus_space_read_stream_N __P((bus_space_tag_t tag, | |
485 | * bus_space_handle_t bsh, bus_size_t offset)); | 485 | * bus_space_handle_t bsh, bus_size_t offset)); | |
486 | * | 486 | * | |
487 | * Return an 1, 2, 4, or 8 byte value read from the bus_space described | 487 | * Return an 1, 2, 4, or 8 byte value read from the bus_space described | |
488 | * by tag/handle at `offset'. No endian conversion is done. | 488 | * by tag/handle at `offset'. No endian conversion is done. | |
489 | */ | 489 | */ | |
490 | static u_int16_t | 490 | static u_int16_t | |
491 | leb_bus_space_read_stream_2(t, h, o) | 491 | leb_bus_space_read_stream_2(t, h, o) | |
492 | bus_space_tag_t t; | 492 | bus_space_tag_t t; | |
493 | bus_space_handle_t h; | 493 | bus_space_handle_t h; | |
494 | bus_size_t o; | 494 | bus_size_t o; | |
495 | { | 495 | { | |
496 | return(*((u_int16_t *)(h + o))); | 496 | return(*((volatile u_int16_t *)(h + o))); | |
497 | } | 497 | } | |
498 | 498 | |||
499 | static u_int32_t | 499 | static u_int32_t | |
500 | leb_bus_space_read_stream_4(t, h, o) | 500 | leb_bus_space_read_stream_4(t, h, o) | |
501 | bus_space_tag_t t; | 501 | bus_space_tag_t t; | |
502 | bus_space_handle_t h; | 502 | bus_space_handle_t h; | |
503 | bus_size_t o; | 503 | bus_size_t o; | |
504 | { | 504 | { | |
505 | return(*((u_int32_t *)(h + o))); | 505 | return(*((volatile u_int32_t *)(h + o))); | |
506 | } | 506 | } | |
507 | 507 | |||
508 | static u_int64_t | 508 | static u_int64_t | |
509 | leb_bus_space_read_stream_8(t, h, o) | 509 | leb_bus_space_read_stream_8(t, h, o) | |
510 | bus_space_tag_t t; | 510 | bus_space_tag_t t; | |
511 | bus_space_handle_t h; | 511 | bus_space_handle_t h; | |
512 | bus_size_t o; | 512 | bus_size_t o; | |
513 | { | 513 | { | |
514 | return(*((u_int64_t *)(h + o))); | 514 | return(*((volatile u_int64_t *)(h + o))); | |
515 | } | 515 | } | |
516 | 516 | |||
517 | /* | 517 | /* | |
518 | * u_intX_t bus_space_write_stream_N __P((bus_space_tag_t tag, | 518 | * u_intX_t bus_space_write_stream_N __P((bus_space_tag_t tag, | |
519 | * bus_space_handle_t bsh, bus_size_t offset, u_intX_t val)); | 519 | * bus_space_handle_t bsh, bus_size_t offset, u_intX_t val)); | |
520 | * | 520 | * | |
521 | * Write an 1, 2, 4, or 8 byte value to the bus_space described by tag/handle | 521 | * Write an 1, 2, 4, or 8 byte value to the bus_space described by tag/handle | |
522 | * at `offset'. No endian conversion is done. | 522 | * at `offset'. No endian conversion is done. | |
523 | */ | 523 | */ | |
524 | static void | 524 | static void | |
525 | leb_bus_space_write_stream_2(t, h, o, v) | 525 | leb_bus_space_write_stream_2(t, h, o, v) | |
526 | bus_space_tag_t t; | 526 | bus_space_tag_t t; | |
527 | bus_space_handle_t h; | 527 | bus_space_handle_t h; | |
528 | bus_size_t o; | 528 | bus_size_t o; | |
529 | u_int16_t v; | 529 | u_int16_t v; | |
530 | { | 530 | { | |
531 | *((u_int16_t *)(h + o)) = v; | 531 | *((volatile u_int16_t *)(h + o)) = v; | |
532 | } | 532 | } | |
533 | 533 | |||
534 | static void | 534 | static void | |
535 | leb_bus_space_write_stream_4(t, h, o, v) | 535 | leb_bus_space_write_stream_4(t, h, o, v) | |
536 | bus_space_tag_t t; | 536 | bus_space_tag_t t; | |
537 | bus_space_handle_t h; | 537 | bus_space_handle_t h; | |
538 | bus_size_t o; | 538 | bus_size_t o; | |
539 | u_int32_t v; | 539 | u_int32_t v; | |
540 | { | 540 | { | |
541 | *((u_int32_t *)(h + o)) = v; | 541 | *((volatile u_int32_t *)(h + o)) = v; | |
542 | } | 542 | } | |
543 | 543 | |||
544 | static void | 544 | static void | |
545 | leb_bus_space_write_stream_8(t, h, o, v) | 545 | leb_bus_space_write_stream_8(t, h, o, v) | |
546 | bus_space_tag_t t; | 546 | bus_space_tag_t t; | |
547 | bus_space_handle_t h; | 547 | bus_space_handle_t h; | |
548 | bus_size_t o; | 548 | bus_size_t o; | |
549 | u_int64_t v; | 549 | u_int64_t v; | |
550 | { | 550 | { | |
551 | *((u_int64_t *)(h + o)) = v; | 551 | *((volatile u_int64_t *)(h + o)) = v; | |
552 | } | 552 | } | |
553 | 553 | |||
554 | /* | 554 | /* | |
555 | * void bus_space_read_multi_N __P((bus_space_tag_t tag, | 555 | * void bus_space_read_multi_N __P((bus_space_tag_t tag, | |
556 | * bus_space_handle_t bsh, bus_size_t offset, u_intX_t *address, | 556 | * bus_space_handle_t bsh, bus_size_t offset, u_intX_t *address, | |
557 | * bus_size_t count)); | 557 | * bus_size_t count)); | |
558 | * | 558 | * | |
559 | * Read 'count' 1, 2, 4, or 8 byte values from the bus_space described by | 559 | * Read 'count' 1, 2, 4, or 8 byte values from the bus_space described by | |
560 | * tag/handle at `offset' and store them in the address range starting at | 560 | * tag/handle at `offset' and store them in the address range starting at | |
561 | * 'address'. The values are converted to CPU endian order before being | 561 | * 'address'. The values are converted to CPU endian order before being | |
562 | * being stored. | 562 | * being stored. | |
563 | */ | 563 | */ | |
564 | static void | 564 | static void | |
@@ -665,91 +665,91 @@ leb_bus_space_write_multi_8(t, h, o, a, | @@ -665,91 +665,91 @@ leb_bus_space_write_multi_8(t, h, o, a, | |||
665 | * | 665 | * | |
666 | * Read 'count' 1, 2, 4, or 8 byte values from the bus_space described by | 666 | * Read 'count' 1, 2, 4, or 8 byte values from the bus_space described by | |
667 | * tag/handle at `offset' and store them in the address range starting at | 667 | * tag/handle at `offset' and store them in the address range starting at | |
668 | * 'address'. No endian conversion is being done. | 668 | * 'address'. No endian conversion is being done. | |
669 | */ | 669 | */ | |
670 | static void | 670 | static void | |
671 | leb_bus_space_read_multi_stream_2(t, h, o, a, c) | 671 | leb_bus_space_read_multi_stream_2(t, h, o, a, c) | |
672 | bus_space_tag_t t; | 672 | bus_space_tag_t t; | |
673 | bus_space_handle_t h; | 673 | bus_space_handle_t h; | |
674 | bus_size_t o, c; | 674 | bus_size_t o, c; | |
675 | u_int16_t *a; | 675 | u_int16_t *a; | |
676 | { | 676 | { | |
677 | for (; c; a++, c--) | 677 | for (; c; a++, c--) | |
678 | *a = *((u_int16_t *)(h + o)); | 678 | *a = *((volatile u_int16_t *)(h + o)); | |
679 | } | 679 | } | |
680 | 680 | |||
681 | static void | 681 | static void | |
682 | leb_bus_space_read_multi_stream_4(t, h, o, a, c) | 682 | leb_bus_space_read_multi_stream_4(t, h, o, a, c) | |
683 | bus_space_tag_t t; | 683 | bus_space_tag_t t; | |
684 | bus_space_handle_t h; | 684 | bus_space_handle_t h; | |
685 | bus_size_t o, c; | 685 | bus_size_t o, c; | |
686 | u_int32_t *a; | 686 | u_int32_t *a; | |
687 | { | 687 | { | |
688 | for (; c; a++, c--) | 688 | for (; c; a++, c--) | |
689 | *a = *((u_int32_t *)(h + o)); | 689 | *a = *((volatile u_int32_t *)(h + o)); | |
690 | } | 690 | } | |
691 | 691 | |||
692 | static void | 692 | static void | |
693 | leb_bus_space_read_multi_stream_8(t, h, o, a, c) | 693 | leb_bus_space_read_multi_stream_8(t, h, o, a, c) | |
694 | bus_space_tag_t t; | 694 | bus_space_tag_t t; | |
695 | bus_space_handle_t h; | 695 | bus_space_handle_t h; | |
696 | bus_size_t o, c; | 696 | bus_size_t o, c; | |
697 | u_int64_t *a; | 697 | u_int64_t *a; | |
698 | { | 698 | { | |
699 | for (; c; a++, c--) | 699 | for (; c; a++, c--) | |
700 | *a = *((u_int64_t *)(h + o)); | 700 | *a = *((volatile u_int64_t *)(h + o)); | |
701 | } | 701 | } | |
702 | 702 | |||
703 | /* | 703 | /* | |
704 | * void bus_space_write_multi_stream_N __P((bus_space_tag_t tag, | 704 | * void bus_space_write_multi_stream_N __P((bus_space_tag_t tag, | |
705 | * bus_space_handle_t bsh, bus_size_t offset, | 705 | * bus_space_handle_t bsh, bus_size_t offset, | |
706 | * const u_intX_t *address, bus_size_t count)); | 706 | * const u_intX_t *address, bus_size_t count)); | |
707 | * | 707 | * | |
708 | * Write 'count' 1, 2, 4, or 8 byte values from the address range starting | 708 | * Write 'count' 1, 2, 4, or 8 byte values from the address range starting | |
709 | * at 'address' to the bus_space described by tag/handle at `offset'. | 709 | * at 'address' to the bus_space described by tag/handle at `offset'. | |
710 | * No endian conversion is being done. | 710 | * No endian conversion is being done. | |
711 | */ | 711 | */ | |
712 | static void | 712 | static void | |
713 | leb_bus_space_write_multi_stream_2(t, h, o, a, c) | 713 | leb_bus_space_write_multi_stream_2(t, h, o, a, c) | |
714 | bus_space_tag_t t; | 714 | bus_space_tag_t t; | |
715 | bus_space_handle_t h; | 715 | bus_space_handle_t h; | |
716 | bus_size_t o, c; | 716 | bus_size_t o, c; | |
717 | const u_int16_t *a; | 717 | const u_int16_t *a; | |
718 | { | 718 | { | |
719 | for (; c; a++, c--) | 719 | for (; c; a++, c--) | |
720 | *((u_int16_t *)(h + o)) = *a; | 720 | *((volatile u_int16_t *)(h + o)) = *a; | |
721 | } | 721 | } | |
722 | 722 | |||
723 | static void | 723 | static void | |
724 | leb_bus_space_write_multi_stream_4(t, h, o, a, c) | 724 | leb_bus_space_write_multi_stream_4(t, h, o, a, c) | |
725 | bus_space_tag_t t; | 725 | bus_space_tag_t t; | |
726 | bus_space_handle_t h; | 726 | bus_space_handle_t h; | |
727 | bus_size_t o, c; | 727 | bus_size_t o, c; | |
728 | const u_int32_t *a; | 728 | const u_int32_t *a; | |
729 | { | 729 | { | |
730 | for (; c; a++, c--) | 730 | for (; c; a++, c--) | |
731 | *((u_int32_t *)(h + o)) = *a; | 731 | *((volatile u_int32_t *)(h + o)) = *a; | |
732 | } | 732 | } | |
733 | 733 | |||
734 | static void | 734 | static void | |
735 | leb_bus_space_write_multi_stream_8(t, h, o, a, c) | 735 | leb_bus_space_write_multi_stream_8(t, h, o, a, c) | |
736 | bus_space_tag_t t; | 736 | bus_space_tag_t t; | |
737 | bus_space_handle_t h; | 737 | bus_space_handle_t h; | |
738 | bus_size_t o, c; | 738 | bus_size_t o, c; | |
739 | const u_int64_t *a; | 739 | const u_int64_t *a; | |
740 | { | 740 | { | |
741 | for (; c; a++, c--) | 741 | for (; c; a++, c--) | |
742 | *((u_int64_t *)(h + o)) = *a; | 742 | *((volatile u_int64_t *)(h + o)) = *a; | |
743 | } | 743 | } | |
744 | 744 | |||
745 | /* | 745 | /* | |
746 | * void bus_space_read_region_N __P((bus_space_tag_t tag, | 746 | * void bus_space_read_region_N __P((bus_space_tag_t tag, | |
747 | * bus_space_handle_t bsh, bus_size_t offset, | 747 | * bus_space_handle_t bsh, bus_size_t offset, | |
748 | * u_intN_t *addr, bus_size_t count)); | 748 | * u_intN_t *addr, bus_size_t count)); | |
749 | * | 749 | * | |
750 | * Read `count' 1, 2, 4, or 8 byte quantities from bus space | 750 | * Read `count' 1, 2, 4, or 8 byte quantities from bus space | |
751 | * described by tag/handle and starting at `offset' and copy into | 751 | * described by tag/handle and starting at `offset' and copy into | |
752 | * buffer provided. | 752 | * buffer provided. | |
753 | */ | 753 | */ | |
754 | static void | 754 | static void | |
755 | leb_bus_space_read_region_1(t, h, o, a, c) | 755 | leb_bus_space_read_region_1(t, h, o, a, c) | |
@@ -855,91 +855,91 @@ leb_bus_space_write_region_8(t, h, o, a, | @@ -855,91 +855,91 @@ leb_bus_space_write_region_8(t, h, o, a, | |||
855 | * Read `count' 1, 2, 4, or 8 byte quantities from bus space | 855 | * Read `count' 1, 2, 4, or 8 byte quantities from bus space | |
856 | * described by tag/handle and starting at `offset' and copy into | 856 | * described by tag/handle and starting at `offset' and copy into | |
857 | * buffer provided. | 857 | * buffer provided. | |
858 | * No endian conversion is being done. | 858 | * No endian conversion is being done. | |
859 | */ | 859 | */ | |
860 | static void | 860 | static void | |
861 | leb_bus_space_read_region_stream_2(t, h, o, a, c) | 861 | leb_bus_space_read_region_stream_2(t, h, o, a, c) | |
862 | bus_space_tag_t t; | 862 | bus_space_tag_t t; | |
863 | bus_space_handle_t h; | 863 | bus_space_handle_t h; | |
864 | bus_size_t o, c; | 864 | bus_size_t o, c; | |
865 | u_int16_t *a; | 865 | u_int16_t *a; | |
866 | { | 866 | { | |
867 | for (; c; a++, o += 2, c--) | 867 | for (; c; a++, o += 2, c--) | |
868 | *a = *(u_int16_t *)(h + o); | 868 | *a = *(volatile u_int16_t *)(h + o); | |
869 | } | 869 | } | |
870 | 870 | |||
871 | static void | 871 | static void | |
872 | leb_bus_space_read_region_stream_4(t, h, o, a, c) | 872 | leb_bus_space_read_region_stream_4(t, h, o, a, c) | |
873 | bus_space_tag_t t; | 873 | bus_space_tag_t t; | |
874 | bus_space_handle_t h; | 874 | bus_space_handle_t h; | |
875 | bus_size_t o, c; | 875 | bus_size_t o, c; | |
876 | u_int32_t *a; | 876 | u_int32_t *a; | |
877 | { | 877 | { | |
878 | for (; c; a++, o += 4, c--) | 878 | for (; c; a++, o += 4, c--) | |
879 | *a = *(u_int32_t *)(h + o); | 879 | *a = *(volatile u_int32_t *)(h + o); | |
880 | } | 880 | } | |
881 | 881 | |||
882 | static void | 882 | static void | |
883 | leb_bus_space_read_region_stream_8(t, h, o, a, c) | 883 | leb_bus_space_read_region_stream_8(t, h, o, a, c) | |
884 | bus_space_tag_t t; | 884 | bus_space_tag_t t; | |
885 | bus_space_handle_t h; | 885 | bus_space_handle_t h; | |
886 | bus_size_t o, c; | 886 | bus_size_t o, c; | |
887 | u_int64_t *a; | 887 | u_int64_t *a; | |
888 | { | 888 | { | |
889 | for (; c; a++, o += 8, c--) | 889 | for (; c; a++, o += 8, c--) | |
890 | *a = *(u_int64_t *)(h + o); | 890 | *a = *(volatile u_int64_t *)(h + o); | |
891 | } | 891 | } | |
892 | 892 | |||
893 | /* | 893 | /* | |
894 | * void bus_space_write_region_stream_N __P((bus_space_tag_t tag, | 894 | * void bus_space_write_region_stream_N __P((bus_space_tag_t tag, | |
895 | * bus_space_handle_t bsh, bus_size_t offset, | 895 | * bus_space_handle_t bsh, bus_size_t offset, | |
896 | * u_intN_t *addr, bus_size_t count)); | 896 | * u_intN_t *addr, bus_size_t count)); | |
897 | * | 897 | * | |
898 | * Copy `count' 1, 2, 4, or 8 byte quantities from the buffer provided | 898 | * Copy `count' 1, 2, 4, or 8 byte quantities from the buffer provided | |
899 | * into the bus space described by tag/handle and starting at `offset'. | 899 | * into the bus space described by tag/handle and starting at `offset'. | |
900 | * No endian conversion is being done. | 900 | * No endian conversion is being done. | |
901 | */ | 901 | */ | |
902 | static void | 902 | static void | |
903 | leb_bus_space_write_region_stream_2(t, h, o, a, c) | 903 | leb_bus_space_write_region_stream_2(t, h, o, a, c) | |
904 | bus_space_tag_t t; | 904 | bus_space_tag_t t; | |
905 | bus_space_handle_t h; | 905 | bus_space_handle_t h; | |
906 | bus_size_t o, c; | 906 | bus_size_t o, c; | |
907 | const u_int16_t *a; | 907 | const u_int16_t *a; | |
908 | { | 908 | { | |
909 | for (; c; a++, o += 2, c--) | 909 | for (; c; a++, o += 2, c--) | |
910 | *((u_int16_t *)(h + o)) = *a; | 910 | *((volatile u_int16_t *)(h + o)) = *a; | |
911 | } | 911 | } | |
912 | 912 | |||
913 | static void | 913 | static void | |
914 | leb_bus_space_write_region_stream_4(t, h, o, a, c) | 914 | leb_bus_space_write_region_stream_4(t, h, o, a, c) | |
915 | bus_space_tag_t t; | 915 | bus_space_tag_t t; | |
916 | bus_space_handle_t h; | 916 | bus_space_handle_t h; | |
917 | bus_size_t o, c; | 917 | bus_size_t o, c; | |
918 | const u_int32_t *a; | 918 | const u_int32_t *a; | |
919 | { | 919 | { | |
920 | for (; c; a++, o += 4, c--) | 920 | for (; c; a++, o += 4, c--) | |
921 | *((u_int32_t *)(h + o)) = *a; | 921 | *((volatile u_int32_t *)(h + o)) = *a; | |
922 | } | 922 | } | |
923 | 923 | |||
924 | static void | 924 | static void | |
925 | leb_bus_space_write_region_stream_8(t, h, o, a, c) | 925 | leb_bus_space_write_region_stream_8(t, h, o, a, c) | |
926 | bus_space_tag_t t; | 926 | bus_space_tag_t t; | |
927 | bus_space_handle_t h; | 927 | bus_space_handle_t h; | |
928 | bus_size_t o, c; | 928 | bus_size_t o, c; | |
929 | const u_int64_t *a; | 929 | const u_int64_t *a; | |
930 | { | 930 | { | |
931 | for (; c; a++, o += 8, c--) | 931 | for (; c; a++, o += 8, c--) | |
932 | *((u_int64_t *)(h + o)) = *a; | 932 | *((volatile u_int64_t *)(h + o)) = *a; | |
933 | } | 933 | } | |
934 | 934 | |||
935 | /* | 935 | /* | |
936 | * void bus_space_set_multi_N __P((bus_space_tag_t tag, | 936 | * void bus_space_set_multi_N __P((bus_space_tag_t tag, | |
937 | * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, | 937 | * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, | |
938 | * bus_size_t count)); | 938 | * bus_size_t count)); | |
939 | * | 939 | * | |
940 | * Write the 1, 2, 4, or 8 byte value `val' to bus space described | 940 | * Write the 1, 2, 4, or 8 byte value `val' to bus space described | |
941 | * by tag/handle/offset `count' times. | 941 | * by tag/handle/offset `count' times. | |
942 | */ | 942 | */ | |
943 | 943 | |||
944 | static void | 944 | static void | |
945 | leb_bus_space_set_multi_1(t, h, o, v, c) | 945 | leb_bus_space_set_multi_1(t, h, o, v, c) | |
@@ -951,51 +951,51 @@ leb_bus_space_set_multi_1(t, h, o, v, c) | @@ -951,51 +951,51 @@ leb_bus_space_set_multi_1(t, h, o, v, c) | |||
951 | for (; c; c--) | 951 | for (; c; c--) | |
952 | __write_1(h, o, v); | 952 | __write_1(h, o, v); | |
953 | } | 953 | } | |
954 | 954 | |||
955 | static void | 955 | static void | |
956 | leb_bus_space_set_multi_2(t, h, o, v, c) | 956 | leb_bus_space_set_multi_2(t, h, o, v, c) | |
957 | bus_space_tag_t t; | 957 | bus_space_tag_t t; | |
958 | bus_space_handle_t h; | 958 | bus_space_handle_t h; | |
959 | bus_size_t o, c; | 959 | bus_size_t o, c; | |
960 | u_int16_t v; | 960 | u_int16_t v; | |
961 | { | 961 | { | |
962 | v = swap16(v); | 962 | v = swap16(v); | |
963 | for (; c; c--) | 963 | for (; c; c--) | |
964 | *((u_int16_t *)(h + o)) = v; | 964 | *((volatile u_int16_t *)(h + o)) = v; | |
965 | } | 965 | } | |
966 | 966 | |||
967 | static void | 967 | static void | |
968 | leb_bus_space_set_multi_4(t, h, o, v, c) | 968 | leb_bus_space_set_multi_4(t, h, o, v, c) | |
969 | bus_space_tag_t t; | 969 | bus_space_tag_t t; | |
970 | bus_space_handle_t h; | 970 | bus_space_handle_t h; | |
971 | bus_size_t o, c; | 971 | bus_size_t o, c; | |
972 | u_int32_t v; | 972 | u_int32_t v; | |
973 | { | 973 | { | |
974 | v = swap32(v); | 974 | v = swap32(v); | |
975 | for (; c; c--) | 975 | for (; c; c--) | |
976 | *((u_int32_t *)(h + o)) = v; | 976 | *((volatile u_int32_t *)(h + o)) = v; | |
977 | } | 977 | } | |
978 | 978 | |||
979 | static void | 979 | static void | |
980 | leb_bus_space_set_multi_8(t, h, o, v, c) | 980 | leb_bus_space_set_multi_8(t, h, o, v, c) | |
981 | bus_space_tag_t t; | 981 | bus_space_tag_t t; | |
982 | bus_space_handle_t h; | 982 | bus_space_handle_t h; | |
983 | bus_size_t o, c; | 983 | bus_size_t o, c; | |
984 | u_int64_t v; | 984 | u_int64_t v; | |
985 | { | 985 | { | |
986 | v = bswap64(v); | 986 | v = bswap64(v); | |
987 | for (; c; c--) | 987 | for (; c; c--) | |
988 | *((u_int64_t *)(h + o)) = v; | 988 | *((volatile u_int64_t *)(h + o)) = v; | |
989 | } | 989 | } | |
990 | 990 | |||
991 | /* | 991 | /* | |
992 | * void bus_space_set_region_N __P((bus_space_tag_t tag, | 992 | * void bus_space_set_region_N __P((bus_space_tag_t tag, | |
993 | * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, | 993 | * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, | |
994 | * bus_size_t count)); | 994 | * bus_size_t count)); | |
995 | * | 995 | * | |
996 | * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described | 996 | * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described | |
997 | * by tag/handle starting at `offset'. | 997 | * by tag/handle starting at `offset'. | |
998 | */ | 998 | */ | |
999 | static void | 999 | static void | |
1000 | leb_bus_space_set_region_1(t, h, o, v, c) | 1000 | leb_bus_space_set_region_1(t, h, o, v, c) | |
1001 | bus_space_tag_t t; | 1001 | bus_space_tag_t t; | |
@@ -1006,39 +1006,39 @@ leb_bus_space_set_region_1(t, h, o, v, c | @@ -1006,39 +1006,39 @@ leb_bus_space_set_region_1(t, h, o, v, c | |||
1006 | for (; c; o++, c--) | 1006 | for (; c; o++, c--) | |
1007 | __write_1(h, o, v); | 1007 | __write_1(h, o, v); | |
1008 | } | 1008 | } | |
1009 | 1009 | |||
1010 | static void | 1010 | static void | |
1011 | leb_bus_space_set_region_2(t, h, o, v, c) | 1011 | leb_bus_space_set_region_2(t, h, o, v, c) | |
1012 | bus_space_tag_t t; | 1012 | bus_space_tag_t t; | |
1013 | bus_space_handle_t h; | 1013 | bus_space_handle_t h; | |
1014 | bus_size_t o, c; | 1014 | bus_size_t o, c; | |
1015 | u_int16_t v; | 1015 | u_int16_t v; | |
1016 | { | 1016 | { | |
1017 | v = swap16(v); | 1017 | v = swap16(v); | |
1018 | for (; c; o += 2, c--) | 1018 | for (; c; o += 2, c--) | |
1019 | *((u_int16_t *)(h + o)) = v; | 1019 | *((volatile u_int16_t *)(h + o)) = v; | |
1020 | } | 1020 | } | |
1021 | 1021 | |||
1022 | static void | 1022 | static void | |
1023 | leb_bus_space_set_region_4(t, h, o, v, c) | 1023 | leb_bus_space_set_region_4(t, h, o, v, c) | |
1024 | bus_space_tag_t t; | 1024 | bus_space_tag_t t; | |
1025 | bus_space_handle_t h; | 1025 | bus_space_handle_t h; | |
1026 | bus_size_t o, c; | 1026 | bus_size_t o, c; | |
1027 | u_int32_t v; | 1027 | u_int32_t v; | |
1028 | { | 1028 | { | |
1029 | v = swap32(v); | 1029 | v = swap32(v); | |
1030 | for (; c; o += 4, c--) | 1030 | for (; c; o += 4, c--) | |
1031 | *((u_int32_t *)(h + o)) = v; | 1031 | *((volatile u_int32_t *)(h + o)) = v; | |
1032 | } | 1032 | } | |
1033 | 1033 | |||
1034 | static void | 1034 | static void | |
1035 | leb_bus_space_set_region_8(t, h, o, v, c) | 1035 | leb_bus_space_set_region_8(t, h, o, v, c) | |
1036 | bus_space_tag_t t; | 1036 | bus_space_tag_t t; | |
1037 | bus_space_handle_t h; | 1037 | bus_space_handle_t h; | |
1038 | bus_size_t o, c; | 1038 | bus_size_t o, c; | |
1039 | u_int64_t v; | 1039 | u_int64_t v; | |
1040 | { | 1040 | { | |
1041 | v = bswap64(v); | 1041 | v = bswap64(v); | |
1042 | for (; c; o += 8, c--) | 1042 | for (; c; o += 8, c--) | |
1043 | *((u_int64_t *)(h + o)) = v; | 1043 | *((volatile u_int64_t *)(h + o)) = v; | |
1044 | } | 1044 | } |
--- src/sys/arch/atari/atari/mainbus.c 2005/12/11 12:16:54 1.4
+++ src/sys/arch/atari/atari/mainbus.c 2009/01/02 12:26:06 1.4.24.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.4 2005/12/11 12:16:54 christos Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.4.24.1 2009/01/02 12:26:06 jdc Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998 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 Leo Weppelman. | 8 | * by Leo Weppelman. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
36 | * POSSIBILITY OF SUCH DAMAGE. | 36 | * POSSIBILITY OF SUCH DAMAGE. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4 2005/12/11 12:16:54 christos Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4.24.1 2009/01/02 12:26:06 jdc Exp $"); | |
41 | 41 | |||
42 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/malloc.h> | 45 | #include <sys/malloc.h> | |
46 | #include <machine/cpu.h> | 46 | #include <machine/cpu.h> | |
47 | #include <machine/bus.h> | 47 | #include <machine/bus.h> | |
48 | 48 | |||
49 | static int mb_bus_space_peek_1 __P((bus_space_tag_t, | 49 | static int mb_bus_space_peek_1 __P((bus_space_tag_t, | |
50 | bus_space_handle_t, bus_size_t)); | 50 | bus_space_handle_t, bus_size_t)); | |
51 | static int mb_bus_space_peek_2 __P((bus_space_tag_t, | 51 | static int mb_bus_space_peek_2 __P((bus_space_tag_t, | |
52 | bus_space_handle_t, bus_size_t)); | 52 | bus_space_handle_t, bus_size_t)); | |
53 | static int mb_bus_space_peek_4 __P((bus_space_tag_t, | 53 | static int mb_bus_space_peek_4 __P((bus_space_tag_t, | |
@@ -139,45 +139,45 @@ static void mb_bus_space_set_region_2 _ | @@ -139,45 +139,45 @@ static void mb_bus_space_set_region_2 _ | |||
139 | static void mb_bus_space_set_region_4 __P((bus_space_tag_t, | 139 | static void mb_bus_space_set_region_4 __P((bus_space_tag_t, | |
140 | bus_space_handle_t, bus_size_t, u_int32_t, | 140 | bus_space_handle_t, bus_size_t, u_int32_t, | |
141 | bus_size_t)); | 141 | bus_size_t)); | |
142 | static void mb_bus_space_set_region_8 __P((bus_space_tag_t, | 142 | static void mb_bus_space_set_region_8 __P((bus_space_tag_t, | |
143 | bus_space_handle_t, bus_size_t, u_int64_t, | 143 | bus_space_handle_t, bus_size_t, u_int64_t, | |
144 | bus_size_t)); | 144 | bus_size_t)); | |
145 | /* | 145 | /* | |
146 | * Calculate offset on the mainbus given a stride_shift and width_offset | 146 | * Calculate offset on the mainbus given a stride_shift and width_offset | |
147 | */ | 147 | */ | |
148 | #define calc_addr(base, off, stride, wm) \ | 148 | #define calc_addr(base, off, stride, wm) \ | |
149 | ((u_long)(base) + ((off) << (stride)) + (wm)) | 149 | ((u_long)(base) + ((off) << (stride)) + (wm)) | |
150 | 150 | |||
151 | #define __read_1(t, h, o) \ | 151 | #define __read_1(t, h, o) \ | |
152 | (*((u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1)))) | 152 | (*((volatile u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1)))) | |
153 | #define __read_2(t, h, o) \ | 153 | #define __read_2(t, h, o) \ | |
154 | (*((u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2)))) | 154 | (*((volatile u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2)))) | |
155 | #define __read_4(t, h, o) \ | 155 | #define __read_4(t, h, o) \ | |
156 | (*((u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4)))) | 156 | (*((volatile u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4)))) | |
157 | #define __read_8(t, h, o) \ | 157 | #define __read_8(t, h, o) \ | |
158 | (*((u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8)))) | 158 | (*((volatile u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8)))) | |
159 | 159 | |||
160 | #define __write_1(t, h, o, v) \ | 160 | #define __write_1(t, h, o, v) \ | |
161 | *((u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))) = v | 161 | *((volatile u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))) = v | |
162 | 162 | |||
163 | #define __write_2(t, h, o, v) \ | 163 | #define __write_2(t, h, o, v) \ | |
164 | *((u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))) = v | 164 | *((volatile u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))) = v | |
165 | 165 | |||
166 | #define __write_4(t, h, o, v) \ | 166 | #define __write_4(t, h, o, v) \ | |
167 | *((u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))) = v | 167 | *((volatile u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))) = v | |
168 | 168 | |||
169 | #define __write_8(t, h, o, v) \ | 169 | #define __write_8(t, h, o, v) \ | |
170 | *((u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))) = v | 170 | *((volatile u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))) = v | |
171 | 171 | |||
172 | bus_space_tag_t | 172 | bus_space_tag_t | |
173 | mb_alloc_bus_space_tag() | 173 | mb_alloc_bus_space_tag() | |
174 | { | 174 | { | |
175 | bus_space_tag_t mb_t; | 175 | bus_space_tag_t mb_t; | |
176 | 176 | |||
177 | /* Not really M_TEMP, is it.. */ | 177 | /* Not really M_TEMP, is it.. */ | |
178 | if ((mb_t = malloc(sizeof(*mb_t), M_TEMP, M_NOWAIT)) == NULL) | 178 | if ((mb_t = malloc(sizeof(*mb_t), M_TEMP, M_NOWAIT)) == NULL) | |
179 | return(NULL); | 179 | return(NULL); | |
180 | bzero(mb_t, sizeof(*mb_t)); | 180 | bzero(mb_t, sizeof(*mb_t)); | |
181 | 181 | |||
182 | mb_t->abs_p_1 = mb_bus_space_peek_1; | 182 | mb_t->abs_p_1 = mb_bus_space_peek_1; | |
183 | mb_t->abs_p_2 = mb_bus_space_peek_2; | 183 | mb_t->abs_p_2 = mb_bus_space_peek_2; | |
@@ -361,127 +361,127 @@ mb_bus_space_write_8(t, h, o, v) | @@ -361,127 +361,127 @@ mb_bus_space_write_8(t, h, o, v) | |||
361 | u_int64_t v; | 361 | u_int64_t v; | |
362 | { | 362 | { | |
363 | __write_8(t, h, o, v); | 363 | __write_8(t, h, o, v); | |
364 | } | 364 | } | |
365 | 365 | |||
366 | 366 | |||
367 | static void | 367 | static void | |
368 | mb_bus_space_read_multi_1(t, h, o, a, c) | 368 | mb_bus_space_read_multi_1(t, h, o, a, c) | |
369 | bus_space_tag_t t; | 369 | bus_space_tag_t t; | |
370 | bus_space_handle_t h; | 370 | bus_space_handle_t h; | |
371 | bus_size_t o, c; | 371 | bus_size_t o, c; | |
372 | u_int8_t *a; | 372 | u_int8_t *a; | |
373 | { | 373 | { | |
374 | u_int8_t *ba; | 374 | volatile u_int8_t *ba; | |
375 | 375 | |||
376 | ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1); | 376 | ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1); | |
377 | for (; c; a++, c--) | 377 | for (; c; a++, c--) | |
378 | *a = *ba; | 378 | *a = *ba; | |
379 | } | 379 | } | |
380 | 380 | |||
381 | static void | 381 | static void | |
382 | mb_bus_space_read_multi_2(t, h, o, a, c) | 382 | mb_bus_space_read_multi_2(t, h, o, a, c) | |
383 | bus_space_tag_t t; | 383 | bus_space_tag_t t; | |
384 | bus_space_handle_t h; | 384 | bus_space_handle_t h; | |
385 | bus_size_t o, c; | 385 | bus_size_t o, c; | |
386 | u_int16_t *a; | 386 | u_int16_t *a; | |
387 | { | 387 | { | |
388 | u_int16_t *ba; | 388 | volatile u_int16_t *ba; | |
389 | 389 | |||
390 | ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | 390 | ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | |
391 | for (; c; a++, c--) | 391 | for (; c; a++, c--) | |
392 | *a = *ba; | 392 | *a = *ba; | |
393 | } | 393 | } | |
394 | 394 | |||
395 | static void | 395 | static void | |
396 | mb_bus_space_read_multi_4(t, h, o, a, c) | 396 | mb_bus_space_read_multi_4(t, h, o, a, c) | |
397 | bus_space_tag_t t; | 397 | bus_space_tag_t t; | |
398 | bus_space_handle_t h; | 398 | bus_space_handle_t h; | |
399 | bus_size_t o, c; | 399 | bus_size_t o, c; | |
400 | u_int32_t *a; | 400 | u_int32_t *a; | |
401 | { | 401 | { | |
402 | u_int32_t *ba; | 402 | volatile u_int32_t *ba; | |
403 | 403 | |||
404 | ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4); | 404 | ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4); | |
405 | for (; c; a++, c--) | 405 | for (; c; a++, c--) | |
406 | *a = *ba; | 406 | *a = *ba; | |
407 | } | 407 | } | |
408 | 408 | |||
409 | static void | 409 | static void | |
410 | mb_bus_space_read_multi_8(t, h, o, a, c) | 410 | mb_bus_space_read_multi_8(t, h, o, a, c) | |
411 | bus_space_tag_t t; | 411 | bus_space_tag_t t; | |
412 | bus_space_handle_t h; | 412 | bus_space_handle_t h; | |
413 | bus_size_t o, c; | 413 | bus_size_t o, c; | |
414 | u_int64_t *a; | 414 | u_int64_t *a; | |
415 | { | 415 | { | |
416 | u_int64_t *ba; | 416 | volatile u_int64_t *ba; | |
417 | 417 | |||
418 | ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8); | 418 | ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8); | |
419 | for (; c; a++, c--) | 419 | for (; c; a++, c--) | |
420 | *a = *ba; | 420 | *a = *ba; | |
421 | } | 421 | } | |
422 | 422 | |||
423 | static void | 423 | static void | |
424 | mb_bus_space_write_multi_1(t, h, o, a, c) | 424 | mb_bus_space_write_multi_1(t, h, o, a, c) | |
425 | bus_space_tag_t t; | 425 | bus_space_tag_t t; | |
426 | bus_space_handle_t h; | 426 | bus_space_handle_t h; | |
427 | bus_size_t o, c; | 427 | bus_size_t o, c; | |
428 | const u_int8_t *a; | 428 | const u_int8_t *a; | |
429 | { | 429 | { | |
430 | u_int8_t *ba; | 430 | volatile u_int8_t *ba; | |
431 | 431 | |||
432 | ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1); | 432 | ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1); | |
433 | for (; c; a++, c--) | 433 | for (; c; a++, c--) | |
434 | *ba = *a; | 434 | *ba = *a; | |
435 | } | 435 | } | |
436 | 436 | |||
437 | static void | 437 | static void | |
438 | mb_bus_space_write_multi_2(t, h, o, a, c) | 438 | mb_bus_space_write_multi_2(t, h, o, a, c) | |
439 | bus_space_tag_t t; | 439 | bus_space_tag_t t; | |
440 | bus_space_handle_t h; | 440 | bus_space_handle_t h; | |
441 | bus_size_t o, c; | 441 | bus_size_t o, c; | |
442 | const u_int16_t *a; | 442 | const u_int16_t *a; | |
443 | { | 443 | { | |
444 | u_int16_t *ba; | 444 | volatile u_int16_t *ba; | |
445 | 445 | |||
446 | ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | 446 | ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | |
447 | for (; c; a++, c--) | 447 | for (; c; a++, c--) | |
448 | *ba = *a; | 448 | *ba = *a; | |
449 | } | 449 | } | |
450 | 450 | |||
451 | static void | 451 | static void | |
452 | mb_bus_space_write_multi_4(t, h, o, a, c) | 452 | mb_bus_space_write_multi_4(t, h, o, a, c) | |
453 | bus_space_tag_t t; | 453 | bus_space_tag_t t; | |
454 | bus_space_handle_t h; | 454 | bus_space_handle_t h; | |
455 | bus_size_t o, c; | 455 | bus_size_t o, c; | |
456 | const u_int32_t *a; | 456 | const u_int32_t *a; | |
457 | { | 457 | { | |
458 | u_int32_t *ba; | 458 | volatile u_int32_t *ba; | |
459 | 459 | |||
460 | ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4); | 460 | ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4); | |
461 | for (; c; a++, c--) | 461 | for (; c; a++, c--) | |
462 | *ba = *a; | 462 | *ba = *a; | |
463 | } | 463 | } | |
464 | 464 | |||
465 | static void | 465 | static void | |
466 | mb_bus_space_write_multi_8(t, h, o, a, c) | 466 | mb_bus_space_write_multi_8(t, h, o, a, c) | |
467 | bus_space_tag_t t; | 467 | bus_space_tag_t t; | |
468 | bus_space_handle_t h; | 468 | bus_space_handle_t h; | |
469 | bus_size_t o, c; | 469 | bus_size_t o, c; | |
470 | const u_int64_t *a; | 470 | const u_int64_t *a; | |
471 | { | 471 | { | |
472 | u_int64_t *ba; | 472 | volatile u_int64_t *ba; | |
473 | 473 | |||
474 | ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8); | 474 | ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8); | |
475 | for (; c; a++, c--) | 475 | for (; c; a++, c--) | |
476 | *ba = *a; | 476 | *ba = *a; | |
477 | } | 477 | } | |
478 | 478 | |||
479 | /* | 479 | /* | |
480 | * void bus_space_read_region_N __P((bus_space_tag_t tag, | 480 | * void bus_space_read_region_N __P((bus_space_tag_t tag, | |
481 | * bus_space_handle_t bsh, bus_size_t offset, | 481 | * bus_space_handle_t bsh, bus_size_t offset, | |
482 | * u_intN_t *addr, size_t count)); | 482 | * u_intN_t *addr, size_t count)); | |
483 | * | 483 | * | |
484 | * Read `count' 1, 2, 4, or 8 byte quantities from bus space | 484 | * Read `count' 1, 2, 4, or 8 byte quantities from bus space | |
485 | * described by tag/handle and starting at `offset' and copy into | 485 | * described by tag/handle and starting at `offset' and copy into | |
486 | * buffer provided. | 486 | * buffer provided. | |
487 | */ | 487 | */ | |
@@ -587,71 +587,71 @@ mb_bus_space_write_region_8(t, h, o, a, | @@ -587,71 +587,71 @@ mb_bus_space_write_region_8(t, h, o, a, | |||
587 | * size_t count)); | 587 | * size_t count)); | |
588 | * | 588 | * | |
589 | * Write the 1, 2, 4, or 8 byte value `val' to bus space described | 589 | * Write the 1, 2, 4, or 8 byte value `val' to bus space described | |
590 | * by tag/handle/offset `count' times. | 590 | * by tag/handle/offset `count' times. | |
591 | */ | 591 | */ | |
592 | 592 | |||
593 | static void | 593 | static void | |
594 | mb_bus_space_set_multi_1(t, h, o, v, c) | 594 | mb_bus_space_set_multi_1(t, h, o, v, c) | |
595 | bus_space_tag_t t; | 595 | bus_space_tag_t t; | |
596 | bus_space_handle_t h; | 596 | bus_space_handle_t h; | |
597 | bus_size_t o, c; | 597 | bus_size_t o, c; | |
598 | u_int8_t v; | 598 | u_int8_t v; | |
599 | { | 599 | { | |
600 | u_int8_t *ba; | 600 | volatile u_int8_t *ba; | |
601 | 601 | |||
602 | ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1); | 602 | ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1); | |
603 | for (; c; c--) | 603 | for (; c; c--) | |
604 | *ba = v; | 604 | *ba = v; | |
605 | } | 605 | } | |
606 | 606 | |||
607 | static void | 607 | static void | |
608 | mb_bus_space_set_multi_2(t, h, o, v, c) | 608 | mb_bus_space_set_multi_2(t, h, o, v, c) | |
609 | bus_space_tag_t t; | 609 | bus_space_tag_t t; | |
610 | bus_space_handle_t h; | 610 | bus_space_handle_t h; | |
611 | bus_size_t o, c; | 611 | bus_size_t o, c; | |
612 | u_int16_t v; | 612 | u_int16_t v; | |
613 | { | 613 | { | |
614 | u_int16_t *ba; | 614 | volatile u_int16_t *ba; | |
615 | 615 | |||
616 | ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | 616 | ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | |
617 | for (; c; c--) | 617 | for (; c; c--) | |
618 | *ba = v; | 618 | *ba = v; | |
619 | } | 619 | } | |
620 | 620 | |||
621 | static void | 621 | static void | |
622 | mb_bus_space_set_multi_4(t, h, o, v, c) | 622 | mb_bus_space_set_multi_4(t, h, o, v, c) | |
623 | bus_space_tag_t t; | 623 | bus_space_tag_t t; | |
624 | bus_space_handle_t h; | 624 | bus_space_handle_t h; | |
625 | bus_size_t o, c; | 625 | bus_size_t o, c; | |
626 | u_int32_t v; | 626 | u_int32_t v; | |
627 | { | 627 | { | |
628 | u_int32_t *ba; | 628 | volatile u_int32_t *ba; | |
629 | 629 | |||
630 | ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4); | 630 | ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4); | |
631 | for (; c; c--) | 631 | for (; c; c--) | |
632 | *ba = v; | 632 | *ba = v; | |
633 | } | 633 | } | |
634 | 634 | |||
635 | static void | 635 | static void | |
636 | mb_bus_space_set_multi_8(t, h, o, v, c) | 636 | mb_bus_space_set_multi_8(t, h, o, v, c) | |
637 | bus_space_tag_t t; | 637 | bus_space_tag_t t; | |
638 | bus_space_handle_t h; | 638 | bus_space_handle_t h; | |
639 | bus_size_t o, c; | 639 | bus_size_t o, c; | |
640 | u_int64_t v; | 640 | u_int64_t v; | |
641 | { | 641 | { | |
642 | u_int64_t *ba; | 642 | volatile u_int64_t *ba; | |
643 | 643 | |||
644 | ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8); | 644 | ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8); | |
645 | for (; c; c--) | 645 | for (; c; c--) | |
646 | *ba = v; | 646 | *ba = v; | |
647 | } | 647 | } | |
648 | 648 | |||
649 | /* | 649 | /* | |
650 | * void bus_space_set_region_N __P((bus_space_tag_t tag, | 650 | * void bus_space_set_region_N __P((bus_space_tag_t tag, | |
651 | * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, | 651 | * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, | |
652 | * size_t count)); | 652 | * size_t count)); | |
653 | * | 653 | * | |
654 | * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described | 654 | * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described | |
655 | * by tag/handle starting at `offset'. | 655 | * by tag/handle starting at `offset'. | |
656 | */ | 656 | */ | |
657 | static void | 657 | static void |
--- src/sys/arch/atari/dev/wdc_mb.c 2008/02/02 03:34:04 1.28.22.1
+++ src/sys/arch/atari/dev/wdc_mb.c 2009/01/02 12:26:07 1.28.22.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: wdc_mb.c,v 1.28.22.1 2008/02/02 03:34:04 riz Exp $ */ | 1 | /* $NetBSD: wdc_mb.c,v 1.28.22.2 2009/01/02 12:26:07 jdc Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2003 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 Charles M. Hannum and by Onno van der Linden. | 8 | * by Charles M. Hannum and by Onno van der Linden. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
36 | * POSSIBILITY OF SUCH DAMAGE. | 36 | * POSSIBILITY OF SUCH DAMAGE. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.28.22.1 2008/02/02 03:34:04 riz Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.28.22.2 2009/01/02 12:26:07 jdc Exp $"); | |
41 | 41 | |||
42 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/malloc.h> | 45 | #include <sys/malloc.h> | |
46 | #include <sys/device.h> | 46 | #include <sys/device.h> | |
47 | 47 | |||
48 | #include <sys/bswap.h> | 48 | #include <sys/bswap.h> | |
49 | #include <machine/cpu.h> | 49 | #include <machine/cpu.h> | |
50 | #include <machine/bus.h> | 50 | #include <machine/bus.h> | |
51 | #include <machine/iomap.h> | 51 | #include <machine/iomap.h> | |
52 | #include <machine/mfp.h> | 52 | #include <machine/mfp.h> | |
53 | #include <machine/dma.h> | 53 | #include <machine/dma.h> | |
@@ -280,33 +280,33 @@ struct ata_channel *chp; | @@ -280,33 +280,33 @@ struct ata_channel *chp; | |||
280 | * the data-register are swapped on the atari. This works OK for an IDE | 280 | * the data-register are swapped on the atari. This works OK for an IDE | |
281 | * disk, but turns into a nightmare when used on atapi devices. | 281 | * disk, but turns into a nightmare when used on atapi devices. | |
282 | */ | 282 | */ | |
283 | #define calc_addr(base, off, stride, wm) \ | 283 | #define calc_addr(base, off, stride, wm) \ | |
284 | ((u_long)(base) + ((off) << (stride)) + (wm)) | 284 | ((u_long)(base) + ((off) << (stride)) + (wm)) | |
285 | 285 | |||
286 | static void | 286 | static void | |
287 | read_multi_2_swap(t, h, o, a, c) | 287 | read_multi_2_swap(t, h, o, a, c) | |
288 | bus_space_tag_t t; | 288 | bus_space_tag_t t; | |
289 | bus_space_handle_t h; | 289 | bus_space_handle_t h; | |
290 | bus_size_t o, c; | 290 | bus_size_t o, c; | |
291 | u_int16_t *a; | 291 | u_int16_t *a; | |
292 | { | 292 | { | |
293 | u_int16_t *ba; | 293 | volatile u_int16_t *ba; | |
294 | 294 | |||
295 | ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | 295 | ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | |
296 | for (; c; a++, c--) | 296 | for (; c; a++, c--) | |
297 | *a = bswap16(*ba); | 297 | *a = bswap16(*ba); | |
298 | } | 298 | } | |
299 | 299 | |||
300 | static void | 300 | static void | |
301 | write_multi_2_swap(t, h, o, a, c) | 301 | write_multi_2_swap(t, h, o, a, c) | |
302 | bus_space_tag_t t; | 302 | bus_space_tag_t t; | |
303 | bus_space_handle_t h; | 303 | bus_space_handle_t h; | |
304 | bus_size_t o, c; | 304 | bus_size_t o, c; | |
305 | const u_int16_t *a; | 305 | const u_int16_t *a; | |
306 | { | 306 | { | |
307 | u_int16_t *ba; | 307 | volatile u_int16_t *ba; | |
308 | 308 | |||
309 | ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | 309 | ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2); | |
310 | for (; c; a++, c--) | 310 | for (; c; a++, c--) | |
311 | *ba = bswap16(*a); | 311 | *ba = bswap16(*a); | |
312 | } | 312 | } |