1 /* $NetBSD: bus.h,v 1.6 2001/12/02 01:20:33 gmcgarry Exp $ */ 2 3 /*- 4 * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 9 * NASA Ames Research Center. 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 * Copyright (C) 1997 Scott Reynolds. All rights reserved. 42 * 43 * Redistribution and use in source and binary forms, with or without 44 * modification, are permitted provided that the following conditions 45 * are met: 46 * 1. Redistributions of source code must retain the above copyright 47 * notice, this list of conditions and the following disclaimer. 48 * 2. Redistributions in binary form must reproduce the above copyright 49 * notice, this list of conditions and the following disclaimer in the 50 * documentation and/or other materials provided with the distribution. 51 * 3. The name of the author may not be used to endorse or promote products 52 * derived from this software without specific prior written permission 53 * 54 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 55 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 56 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 57 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 58 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 59 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 60 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 61 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 62 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 63 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 64 */ 65 66 #ifndef _HP300_BUS_H_ 67 #define _HP300_BUS_H_ 68 69 /* 70 * Values for the hp300 bus space tag, not to be used directly by MI code. 71 */ 72 #define HP300_BUS_SPACE_INTIO 0 /* space is intio space */ 73 #define HP300_BUS_SPACE_DIO 1 /* space is dio space */ 74 75 /* 76 * Bus address and size types 77 */ 78 typedef u_long bus_addr_t; 79 typedef u_long bus_size_t; 80 81 /* 82 * Access methods for bus resources and address space. 83 */ 84 typedef int bus_space_tag_t; 85 typedef u_long bus_space_handle_t; 86 87 /* 88 * int bus_space_map __P((bus_space_tag_t t, bus_addr_t addr, 89 * bus_size_t size, int flags, bus_space_handle_t *bshp)); 90 * 91 * Map a region of bus space. 92 */ 93 94 #define BUS_SPACE_MAP_CACHEABLE 0x01 95 #define BUS_SPACE_MAP_LINEAR 0x02 96 #define BUS_SPACE_MAP_PREFETCHABLE 0x04 97 98 int bus_space_map __P((bus_space_tag_t, bus_addr_t, bus_size_t, 99 int, bus_space_handle_t *)); 100 101 /* 102 * void bus_space_unmap __P((bus_space_tag_t t, 103 * bus_space_handle_t bsh, bus_size_t size)); 104 * 105 * Unmap a region of bus space. 106 */ 107 108 void bus_space_unmap __P((bus_space_tag_t, bus_space_handle_t, bus_size_t)); 109 110 /* 111 * int bus_space_subregion __P((bus_space_tag_t t, 112 * bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, 113 * bus_space_handle_t *nbshp)); 114 * 115 * Get a new handle for a subregion of an already-mapped area of bus space. 116 */ 117 118 int bus_space_subregion __P((bus_space_tag_t t, bus_space_handle_t bsh, 119 bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp)); 120 121 /* 122 * int bus_space_alloc __P((bus_space_tag_t t, bus_addr_t, rstart, 123 * bus_addr_t rend, bus_size_t size, bus_size_t align, 124 * bus_size_t boundary, int flags, bus_addr_t *addrp, 125 * bus_space_handle_t *bshp)); 126 * 127 * Allocate a region of bus space. 128 */ 129 130 int bus_space_alloc __P((bus_space_tag_t t, bus_addr_t rstart, 131 bus_addr_t rend, bus_size_t size, bus_size_t align, 132 bus_size_t boundary, int cacheable, bus_addr_t *addrp, 133 bus_space_handle_t *bshp)); 134 135 /* 136 * int bus_space_free __P((bus_space_tag_t t, 137 * bus_space_handle_t bsh, bus_size_t size)); 138 * 139 * Free a region of bus space. 140 */ 141 142 void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh, 143 bus_size_t size)); 144 145 /* 146 * void *bus_space_vaddr __P((bus_space_tag_t, bus_space_handle_t)); 147 * 148 * Get the kernel virtual address for the mapped bus space. 149 * Only allowed for regions mapped with BUS_SPACE_MAP_LINEAR. 150 * (XXX not enforced) 151 */ 152 #define bus_space_vaddr(t, h) (void *)(h) 153 154 /* 155 * int hp300_bus_space_probe __P((bus_space_tag_t t, 156 * bus_space_handle_t bsh, bus_size_t offset, int sz)); 157 * 158 * Probe the bus at t/bsh/offset, using sz as the size of the load. 159 * 160 * This is a machine-dependent extension, and is not to be used by 161 * machine-independent code. 162 */ 163 164 int hp300_bus_space_probe __P((bus_space_tag_t t, 165 bus_space_handle_t bsh, bus_size_t offset, int sz)); 166 167 /* 168 * u_intN_t bus_space_read_N __P((bus_space_tag_t tag, 169 * bus_space_handle_t bsh, bus_size_t offset)); 170 * 171 * Read a 1, 2, 4, or 8 byte quantity from bus space 172 * described by tag/handle/offset. 173 */ 174 175 #define bus_space_read_1(t, h, o) \ 176 ((void) t, (*(volatile u_int8_t *)((h) + (o)))) 177 178 #define bus_space_read_2(t, h, o) \ 179 ((void) t, (*(volatile u_int16_t *)((h) + (o)))) 180 181 #define bus_space_read_4(t, h, o) \ 182 ((void) t, (*(volatile u_int32_t *)((h) + (o)))) 183 184 #if 0 /* Cause a link error for bus_space_read_8 */ 185 #define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!! 186 #endif 187 188 /* 189 * void bus_space_read_multi_N __P((bus_space_tag_t tag, 190 * bus_space_handle_t bsh, bus_size_t offset, 191 * u_intN_t *addr, size_t count)); 192 * 193 * Read `count' 1, 2, 4, or 8 byte quantities from bus space 194 * described by tag/handle/offset and copy into buffer provided. 195 */ 196 197 #define bus_space_read_multi_1(t, h, o, a, c) do { \ 198 (void) t; \ 199 __asm __volatile (" \ 200 movl %0,%%a0 ; \ 201 movl %1,%%a1 ; \ 202 movl %2,%%d0 ; \ 203 1: movb %%a0@,%%a1@+ ; \ 204 subql #1,%%d0 ; \ 205 jne 1b" : \ 206 : \ 207 "r" ((h) + (o)), "g" (a), "g" (c) : \ 208 "%a0","%a1","%d0"); \ 209 } while (0) 210 211 #define bus_space_read_multi_2(t, h, o, a, c) do { \ 212 (void) t; \ 213 __asm __volatile (" \ 214 movl %0,%%a0 ; \ 215 movl %1,%%a1 ; \ 216 movl %2,%%d0 ; \ 217 1: movw %%a0@,%%a1@+ ; \ 218 subql #1,%%d0 ; \ 219 jne 1b" : \ 220 : \ 221 "r" ((h) + (o)), "g" (a), "g" (c) : \ 222 "%a0","%a1","%d0"); \ 223 } while (0) 224 225 #define bus_space_read_multi_4(t, h, o, a, c) do { \ 226 (void) t; \ 227 __asm __volatile (" \ 228 movl %0,%%a0 ; \ 229 movl %1,%%a1 ; \ 230 movl %2,%%d0 ; \ 231 1: movl %%a0@,%%a1@+ ; \ 232 subql #1,%%d0 ; \ 233 jne 1b" : \ 234 : \ 235 "r" ((h) + (o)), "g" (a), "g" (c) : \ 236 "%a0","%a1","%d0"); \ 237 } while (0) 238 239 #if 0 /* Cause a link error for bus_space_read_multi_8 */ 240 #define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!! 241 #endif 242 243 /* 244 * void bus_space_read_region_N __P((bus_space_tag_t tag, 245 * bus_space_handle_t bsh, bus_size_t offset, 246 * u_intN_t *addr, size_t count)); 247 * 248 * Read `count' 1, 2, 4, or 8 byte quantities from bus space 249 * described by tag/handle and starting at `offset' and copy into 250 * buffer provided. 251 */ 252 253 #define bus_space_read_region_1(t, h, o, a, c) do { \ 254 (void) t; \ 255 __asm __volatile (" \ 256 movl %0,%%a0 ; \ 257 movl %1,%%a1 ; \ 258 movl %2,%%d0 ; \ 259 1: movb %%a0@+,%%a1@+ ; \ 260 subql #1,%%d0 ; \ 261 jne 1b" : \ 262 : \ 263 "r" ((h) + (o)), "g" (a), "g" (c) : \ 264 "%a0","%a1","%d0"); \ 265 } while (0) 266 267 #define bus_space_read_region_2(t, h, o, a, c) do { \ 268 (void) t; \ 269 __asm __volatile (" \ 270 movl %0,%%a0 ; \ 271 movl %1,%%a1 ; \ 272 movl %2,%%d0 ; \ 273 1: movw %%a0@+,%%a1@+ ; \ 274 subql #1,%%d0 ; \ 275 jne 1b" : \ 276 : \ 277 "r" ((h) + (o)), "g" (a), "g" (c) : \ 278 "%a0","%a1","%d0"); \ 279 } while (0) 280 281 #define bus_space_read_region_4(t, h, o, a, c) do { \ 282 (void) t; \ 283 __asm __volatile (" \ 284 movl %0,%%a0 ; \ 285 movl %1,%%a1 ; \ 286 movl %2,%%d0 ; \ 287 1: movl %%a0@+,%%a1@+ ; \ 288 subql #1,%%d0 ; \ 289 jne 1b" : \ 290 : \ 291 "r" ((h) + (o)), "g" (a), "g" (c) : \ 292 "%a0","%a1","%d0"); \ 293 } while (0) 294 295 #if 0 /* Cause a link error for bus_space_read_region_8 */ 296 #define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!! 297 #endif 298 299 /* 300 * void bus_space_write_N __P((bus_space_tag_t tag, 301 * bus_space_handle_t bsh, bus_size_t offset, 302 * u_intN_t value)); 303 * 304 * Write the 1, 2, 4, or 8 byte value `value' to bus space 305 * described by tag/handle/offset. 306 */ 307 308 #define bus_space_write_1(t, h, o, v) \ 309 ((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v)))) 310 311 #define bus_space_write_2(t, h, o, v) \ 312 ((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v)))) 313 314 #define bus_space_write_4(t, h, o, v) \ 315 ((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v)))) 316 317 #if 0 /* Cause a link error for bus_space_write_8 */ 318 #define bus_space_write_8 !!! bus_space_write_8 not implemented !!! 319 #endif 320 321 /* 322 * void bus_space_write_multi_N __P((bus_space_tag_t tag, 323 * bus_space_handle_t bsh, bus_size_t offset, 324 * const u_intN_t *addr, size_t count)); 325 * 326 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer 327 * provided to bus space described by tag/handle/offset. 328 */ 329 330 #define bus_space_write_multi_1(t, h, o, a, c) do { \ 331 (void) t; \ 332 __asm __volatile (" \ 333 movl %0,%%a0 ; \ 334 movl %1,%%a1 ; \ 335 movl %2,%%d0 ; \ 336 1: movb %%a1@+,%%a0@ ; \ 337 subql #1,%%d0 ; \ 338 jne 1b" : \ 339 : \ 340 "r" ((h) + (o)), "g" (a), "g" (c) : \ 341 "%a0","%a1","%d0"); \ 342 } while (0) 343 344 #define bus_space_write_multi_2(t, h, o, a, c) do { \ 345 (void) t; \ 346 __asm __volatile (" \ 347 movl %0,%%a0 ; \ 348 movl %1,%%a1 ; \ 349 movl %2,%%d0 ; \ 350 1: movw %%a1@+,%%a0@ ; \ 351 subql #1,%%d0 ; \ 352 jne 1b" : \ 353 : \ 354 "r" ((h) + (o)), "g" (a), "g" (c) : \ 355 "%a0","%a1","%d0"); \ 356 } while (0) 357 358 #define bus_space_write_multi_4(t, h, o, a, c) do { \ 359 (void) t; \ 360 __asm __volatile (" \ 361 movl %0,%%a0 ; \ 362 movl %1,%%a1 ; \ 363 movl %2,%%d0 ; \ 364 1: movl %%a1@+,%%a0@ ; \ 365 subql #1,%%d0 ; \ 366 jne 1b" : \ 367 : \ 368 "r" ((h) + (o)), "g" (a), "g" (c) : \ 369 "%a0","%a1","%d0"); \ 370 } while (0) 371 372 #if 0 /* Cause a link error for bus_space_write_8 */ 373 #define bus_space_write_multi_8(t, h, o, a, c) \ 374 !!! bus_space_write_multi_8 unimplimented !!! 375 #endif 376 377 /* 378 * void bus_space_write_region_N __P((bus_space_tag_t tag, 379 * bus_space_handle_t bsh, bus_size_t offset, 380 * const u_intN_t *addr, size_t count)); 381 * 382 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided 383 * to bus space described by tag/handle starting at `offset'. 384 */ 385 386 #define bus_space_write_region_1(t, h, o, a, c) do { \ 387 (void) t; \ 388 __asm __volatile (" \ 389 movl %0,%%a0 ; \ 390 movl %1,%%a1 ; \ 391 movl %2,%%d0 ; \ 392 1: movb %%a1@+,%%a0@+ ; \ 393 subql #1,%%d0 ; \ 394 jne 1b" : \ 395 : \ 396 "r" ((h) + (o)), "g" (a), "g" (c) : \ 397 "%a0","%a1","%d0"); \ 398 } while (0) 399 400 #define bus_space_write_region_2(t, h, o, a, c) do { \ 401 (void) t; \ 402 __asm __volatile (" \ 403 movl %0,%%a0 ; \ 404 movl %1,%%a1 ; \ 405 movl %2,%%d0 ; \ 406 1: movw %%a1@+,%%a0@+ ; \ 407 subql #1,%%d0 ; \ 408 jne 1b" : \ 409 : \ 410 "r" ((h) + (o)), "g" (a), "g" (c) : \ 411 "%a0","%a1","%d0"); \ 412 } while (0) 413 414 #define bus_space_write_region_4(t, h, o, a, c) do { \ 415 (void) t; \ 416 __asm __volatile (" \ 417 movl %0,%%a0 ; \ 418 movl %1,%%a1 ; \ 419 movl %2,%%d0 ; \ 420 1: movl %%a1@+,%%a0@+ ; \ 421 subql #1,%%d0 ; \ 422 jne 1b" : \ 423 : \ 424 "r" ((h) + (o)), "g" (a), "g" (c) : \ 425 "%a0","%a1","%d0"); \ 426 } while (0) 427 428 #if 0 /* Cause a link error for bus_space_write_region_8 */ 429 #define bus_space_write_region_8 \ 430 !!! bus_space_write_region_8 unimplemented !!! 431 #endif 432 433 /* 434 * void bus_space_set_multi_N __P((bus_space_tag_t tag, 435 * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, 436 * size_t count)); 437 * 438 * Write the 1, 2, 4, or 8 byte value `val' to bus space described 439 * by tag/handle/offset `count' times. 440 */ 441 442 #define bus_space_set_multi_1(t, h, o, val, c) do { \ 443 (void) t; \ 444 __asm __volatile (" \ 445 movl %0,%%a0 ; \ 446 movl %1,%%d1 ; \ 447 movl %2,%%d0 ; \ 448 1: movb %%d1,%%a0@ ; \ 449 subql #1,%%d0 ; \ 450 jne 1b" : \ 451 : \ 452 "r" ((h) + (o)), "g" (val), "g" (c) : \ 453 "%a0","%d0","%d1"); \ 454 } while (0) 455 456 #define bus_space_set_multi_2(t, h, o, val, c) do { \ 457 (void) t; \ 458 __asm __volatile (" \ 459 movl %0,%%a0 ; \ 460 movl %1,%%d1 ; \ 461 movl %2,%%d0 ; \ 462 1: movw %%d1,%%a0@ ; \ 463 subql #1,%%d0 ; \ 464 jne 1b" : \ 465 : \ 466 "r" ((h) + (o)), "g" (val), "g" (c) : \ 467 "%a0","%d0","%d1"); \ 468 } while (0) 469 470 #define bus_space_set_multi_4(t, h, o, val, c) do { \ 471 (void) t; \ 472 __asm __volatile (" \ 473 movl %0,%%a0 ; \ 474 movl %1,%%d1 ; \ 475 movl %2,%%d0 ; \ 476 1: movl %%d1,%%a0@ ; \ 477 subql #1,%%d0 ; \ 478 jne 1b" : \ 479 : \ 480 "r" ((h) + (o)), "g" (val), "g" (c) : \ 481 "%a0","%d0","%d1"); \ 482 } while (0) 483 484 #if 0 /* Cause a link error for bus_space_set_multi_8 */ 485 #define bus_space_set_multi_8 \ 486 !!! bus_space_set_multi_8 unimplemented !!! 487 #endif 488 489 /* 490 * void bus_space_set_region_N __P((bus_space_tag_t tag, 491 * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, 492 * size_t count)); 493 * 494 * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described 495 * by tag/handle starting at `offset'. 496 */ 497 498 #define bus_space_set_region_1(t, h, o, val, c) do { \ 499 (void) t; \ 500 __asm __volatile (" \ 501 movl %0,%%a0 ; \ 502 movl %1,%%d1 ; \ 503 movl %2,%%d0 ; \ 504 1: movb %%d1,%%a0@+ ; \ 505 subql #1,%%d0 ; \ 506 jne 1b" : \ 507 : \ 508 "r" ((h) + (o)), "g" (val), "g" (c) : \ 509 "%a0","%d0","%d1"); \ 510 } while (0) 511 512 #define bus_space_set_region_2(t, h, o, val, c) do { \ 513 (void) t; \ 514 __asm __volatile (" \ 515 movl %0,%%a0 ; \ 516 movl %1,%%d1 ; \ 517 movl %2,%%d0 ; \ 518 1: movw %%d1,%%a0@+ ; \ 519 subql #1,%%d0 ; \ 520 jne 1b" : \ 521 : \ 522 "r" ((h) + (o)), "g" (val), "g" (c) : \ 523 "%a0","%d0","%d1"); \ 524 } while (0) 525 526 #define bus_space_set_region_4(t, h, o, val, c) do { \ 527 (void) t; \ 528 __asm __volatile (" \ 529 movl %0,%%a0 ; \ 530 movl %1,%%d1 ; \ 531 movl %2,%%d0 ; \ 532 1: movl %%d1,%%a0@+ ; \ 533 subql #1,%%d0 ; \ 534 jne 1b" : \ 535 : \ 536 "r" ((h) + (o)), "g" (val), "g" (c) : \ 537 "%a0","%d0","%d1"); \ 538 } while (0) 539 540 #if 0 /* Cause a link error for bus_space_set_region_8 */ 541 #define bus_space_set_region_8 \ 542 !!! bus_space_set_region_8 unimplemented !!! 543 #endif 544 545 /* 546 * void bus_space_copy_region_N __P((bus_space_tag_t tag, 547 * bus_space_handle_t bsh1, bus_size_t off1, 548 * bus_space_handle_t bsh2, bus_size_t off2, 549 * bus_size_t count)); 550 * 551 * Copy `count' 1, 2, 4, or 8 byte values from bus space starting 552 * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2. 553 */ 554 555 #define __HP300_copy_region_N(BYTES) \ 556 static __inline void __CONCAT(bus_space_copy_region_,BYTES) \ 557 __P((bus_space_tag_t, \ 558 bus_space_handle_t bsh1, bus_size_t off1, \ 559 bus_space_handle_t bsh2, bus_size_t off2, \ 560 bus_size_t count)); \ 561 \ 562 static __inline void \ 563 __CONCAT(bus_space_copy_region_,BYTES)(t, h1, o1, h2, o2, c) \ 564 bus_space_tag_t t; \ 565 bus_space_handle_t h1, h2; \ 566 bus_size_t o1, o2, c; \ 567 { \ 568 bus_size_t o; \ 569 \ 570 if ((h1 + o1) >= (h2 + o2)) { \ 571 /* src after dest: copy forward */ \ 572 for (o = 0; c != 0; c--, o += BYTES) \ 573 __CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o, \ 574 __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \ 575 } else { \ 576 /* dest after src: copy backwards */ \ 577 for (o = (c - 1) * BYTES; c != 0; c--, o -= BYTES) \ 578 __CONCAT(bus_space_write_,BYTES)(t, h2, o2 + o, \ 579 __CONCAT(bus_space_read_,BYTES)(t, h1, o1 + o)); \ 580 } \ 581 } 582 __HP300_copy_region_N(1) 583 __HP300_copy_region_N(2) 584 __HP300_copy_region_N(4) 585 #if 0 /* Cause a link error for bus_space_copy_region_8 */ 586 #define bus_space_copy_region_8 \ 587 !!! bus_space_copy_region_8 unimplemented !!! 588 #endif 589 590 #undef __HP300_copy_region_N 591 592 /* 593 * Bus read/write barrier methods. 594 * 595 * void bus_space_barrier __P((bus_space_tag_t tag, 596 * bus_space_handle_t bsh, bus_size_t offset, 597 * bus_size_t len, int flags)); 598 * 599 * Note: the 680x0 does not currently require barriers, but we must 600 * provide the flags to MI code. 601 */ 602 #define bus_space_barrier(t, h, o, l, f) \ 603 ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f))) 604 #define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ 605 #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ 606 607 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t) 608 609 #endif /* _HP300_BUS_H_ */ 610