be_bus.c revision 1.2
1/* $NetBSD: be_bus.c,v 1.2 1998/04/23 09:17:44 leo Exp $ */ 2 3/*- 4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Leo Weppelman. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 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 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 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 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 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38#include <sys/types.h> 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/malloc.h> 42#include <machine/cpu.h> 43#include <machine/bus.h> 44 45/* 46 * This file contains the common functions for using a big endian (linear) 47 * bus on a big endian atari. 48 */ 49 50 /* Autoconf detection stuff */ 51static int beb_bus_space_peek_1 __P((bus_space_tag_t, 52 bus_space_handle_t, bus_size_t)); 53static int beb_bus_space_peek_2 __P((bus_space_tag_t, 54 bus_space_handle_t, bus_size_t)); 55static int beb_bus_space_peek_4 __P((bus_space_tag_t, 56 bus_space_handle_t, bus_size_t)); 57static int beb_bus_space_peek_8 __P((bus_space_tag_t, 58 bus_space_handle_t, bus_size_t)); 59 60 /* read (single) */ 61static u_int8_t beb_bus_space_read_1 __P((bus_space_tag_t, 62 bus_space_handle_t, bus_size_t)); 63static u_int16_t beb_bus_space_read_2 __P((bus_space_tag_t, 64 bus_space_handle_t, bus_size_t)); 65static u_int32_t beb_bus_space_read_4 __P((bus_space_tag_t, 66 bus_space_handle_t, bus_size_t)); 67static u_int64_t beb_bus_space_read_8 __P((bus_space_tag_t, 68 bus_space_handle_t, bus_size_t)); 69 70 /* write (single) */ 71static void beb_bus_space_write_1 __P((bus_space_tag_t, 72 bus_space_handle_t, bus_size_t, u_int8_t)); 73static void beb_bus_space_write_2 __P((bus_space_tag_t, 74 bus_space_handle_t, bus_size_t, u_int16_t)); 75static void beb_bus_space_write_4 __P((bus_space_tag_t, 76 bus_space_handle_t, bus_size_t, u_int32_t)); 77static void beb_bus_space_write_8 __P((bus_space_tag_t, 78 bus_space_handle_t, bus_size_t, u_int64_t)); 79 80 /* read multiple */ 81static void beb_bus_space_read_multi_1 __P((bus_space_tag_t, 82 bus_space_handle_t, bus_size_t, u_int8_t *, 83 bus_size_t)); 84static void beb_bus_space_read_multi_2 __P((bus_space_tag_t, 85 bus_space_handle_t, bus_size_t, u_int16_t *, 86 bus_size_t)); 87static void beb_bus_space_read_multi_4 __P((bus_space_tag_t, 88 bus_space_handle_t, bus_size_t, u_int32_t *, 89 bus_size_t)); 90static void beb_bus_space_read_multi_8 __P((bus_space_tag_t, 91 bus_space_handle_t, bus_size_t, u_int64_t *, 92 bus_size_t)); 93 94 /* write multiple */ 95static void beb_bus_space_write_multi_1 __P((bus_space_tag_t, 96 bus_space_handle_t, bus_size_t, 97 const u_int8_t *, bus_size_t)); 98static void beb_bus_space_write_multi_2 __P((bus_space_tag_t, 99 bus_space_handle_t, bus_size_t, 100 const u_int16_t *, bus_size_t)); 101static void beb_bus_space_write_multi_4 __P((bus_space_tag_t, 102 bus_space_handle_t, bus_size_t, 103 const u_int32_t *, bus_size_t)); 104static void beb_bus_space_write_multi_8 __P((bus_space_tag_t, 105 bus_space_handle_t, bus_size_t, 106 const u_int64_t *, bus_size_t)); 107 108 /* read region */ 109static void beb_bus_space_read_region_1 __P((bus_space_tag_t, 110 bus_space_handle_t, bus_size_t, u_int8_t *, 111 bus_size_t)); 112static void beb_bus_space_read_region_2 __P((bus_space_tag_t, 113 bus_space_handle_t, bus_size_t, u_int16_t *, 114 bus_size_t)); 115static void beb_bus_space_read_region_4 __P((bus_space_tag_t, 116 bus_space_handle_t, bus_size_t, u_int32_t *, 117 bus_size_t)); 118static void beb_bus_space_read_region_8 __P((bus_space_tag_t, 119 bus_space_handle_t, bus_size_t, u_int64_t *, 120 bus_size_t)); 121 122 /* read region */ 123static void beb_bus_space_write_region_1 __P((bus_space_tag_t, 124 bus_space_handle_t, bus_size_t, 125 const u_int8_t *, bus_size_t)); 126static void beb_bus_space_write_region_2 __P((bus_space_tag_t, 127 bus_space_handle_t, bus_size_t, 128 const u_int16_t *, bus_size_t)); 129static void beb_bus_space_write_region_4 __P((bus_space_tag_t, 130 bus_space_handle_t, bus_size_t, 131 const u_int32_t *, bus_size_t)); 132static void beb_bus_space_write_region_8 __P((bus_space_tag_t, 133 bus_space_handle_t, bus_size_t, 134 const u_int64_t *, bus_size_t)); 135 136 /* set multi */ 137static void beb_bus_space_set_multi_1 __P((bus_space_tag_t, 138 bus_space_handle_t, bus_size_t, u_int8_t, 139 bus_size_t)); 140static void beb_bus_space_set_multi_2 __P((bus_space_tag_t, 141 bus_space_handle_t, bus_size_t, u_int16_t, 142 bus_size_t)); 143static void beb_bus_space_set_multi_4 __P((bus_space_tag_t, 144 bus_space_handle_t, bus_size_t, u_int32_t, 145 bus_size_t)); 146static void beb_bus_space_set_multi_8 __P((bus_space_tag_t, 147 bus_space_handle_t, bus_size_t, u_int64_t, 148 bus_size_t)); 149 150 /* set region */ 151static void beb_bus_space_set_region_1 __P((bus_space_tag_t, 152 bus_space_handle_t, bus_size_t, u_int8_t, 153 bus_size_t)); 154static void beb_bus_space_set_region_2 __P((bus_space_tag_t, 155 bus_space_handle_t, bus_size_t, u_int16_t, 156 bus_size_t)); 157static void beb_bus_space_set_region_4 __P((bus_space_tag_t, 158 bus_space_handle_t, bus_size_t, u_int32_t, 159 bus_size_t)); 160static void beb_bus_space_set_region_8 __P((bus_space_tag_t, 161 bus_space_handle_t, bus_size_t, u_int64_t, 162 bus_size_t)); 163 164bus_space_tag_t beb_alloc_bus_space_tag __P((void)); 165 166/* 167 * Don't force a function call overhead on these primitives... 168 */ 169#define __read_1(h, o) *((u_int8_t *)((h) + (o))) 170#define __read_2(h, o) *((u_int16_t *)((h) + (o))) 171#define __read_4(h, o) *((u_int32_t *)((h) + (o))) 172#define __read_8(h, o) *((u_int64_t *)((h) + (o))) 173 174#define __write_1(h, o, v) *((u_int8_t *)((h) + (o))) = (v) 175#define __write_2(h, o, v) *((u_int16_t *)((h) + (o))) = (v) 176#define __write_4(h, o, v) *((u_int32_t *)((h) + (o))) = (v) 177#define __write_8(h, o, v) *((u_int64_t *)((h) + (o))) = (v) 178 179bus_space_tag_t 180beb_alloc_bus_space_tag() 181{ 182 bus_space_tag_t beb_t; 183 184 if ((beb_t = malloc(sizeof(*beb_t), M_TEMP, M_NOWAIT)) == NULL) 185 return(NULL); 186 bzero(beb_t, sizeof(*beb_t)); 187 188 beb_t->abs_p_1 = beb_bus_space_peek_1; 189 beb_t->abs_p_2 = beb_bus_space_peek_2; 190 beb_t->abs_p_4 = beb_bus_space_peek_4; 191 beb_t->abs_p_8 = beb_bus_space_peek_8; 192 beb_t->abs_r_1 = beb_bus_space_read_1; 193 beb_t->abs_r_2 = beb_bus_space_read_2; 194 beb_t->abs_r_4 = beb_bus_space_read_4; 195 beb_t->abs_r_8 = beb_bus_space_read_8; 196 beb_t->abs_rs_1 = beb_bus_space_read_1; 197 beb_t->abs_rs_2 = beb_bus_space_read_2; 198 beb_t->abs_rs_4 = beb_bus_space_read_4; 199 beb_t->abs_rs_8 = beb_bus_space_read_8; 200 beb_t->abs_rm_1 = beb_bus_space_read_multi_1; 201 beb_t->abs_rm_2 = beb_bus_space_read_multi_2; 202 beb_t->abs_rm_4 = beb_bus_space_read_multi_4; 203 beb_t->abs_rm_8 = beb_bus_space_read_multi_8; 204 beb_t->abs_rms_1 = beb_bus_space_read_multi_1; 205 beb_t->abs_rms_2 = beb_bus_space_read_multi_2; 206 beb_t->abs_rms_4 = beb_bus_space_read_multi_4; 207 beb_t->abs_rms_8 = beb_bus_space_read_multi_8; 208 beb_t->abs_rr_1 = beb_bus_space_read_region_1; 209 beb_t->abs_rr_2 = beb_bus_space_read_region_2; 210 beb_t->abs_rr_4 = beb_bus_space_read_region_4; 211 beb_t->abs_rr_8 = beb_bus_space_read_region_8; 212 beb_t->abs_w_1 = beb_bus_space_write_1; 213 beb_t->abs_w_2 = beb_bus_space_write_2; 214 beb_t->abs_w_4 = beb_bus_space_write_4; 215 beb_t->abs_w_8 = beb_bus_space_write_8; 216 beb_t->abs_ws_1 = beb_bus_space_write_1; 217 beb_t->abs_ws_2 = beb_bus_space_write_2; 218 beb_t->abs_ws_4 = beb_bus_space_write_4; 219 beb_t->abs_ws_8 = beb_bus_space_write_8; 220 beb_t->abs_wm_1 = beb_bus_space_write_multi_1; 221 beb_t->abs_wm_2 = beb_bus_space_write_multi_2; 222 beb_t->abs_wm_4 = beb_bus_space_write_multi_4; 223 beb_t->abs_wm_8 = beb_bus_space_write_multi_8; 224 beb_t->abs_wms_1 = beb_bus_space_write_multi_1; 225 beb_t->abs_wms_2 = beb_bus_space_write_multi_2; 226 beb_t->abs_wms_4 = beb_bus_space_write_multi_4; 227 beb_t->abs_wms_8 = beb_bus_space_write_multi_8; 228 beb_t->abs_wr_1 = beb_bus_space_write_region_1; 229 beb_t->abs_wr_2 = beb_bus_space_write_region_2; 230 beb_t->abs_wr_4 = beb_bus_space_write_region_4; 231 beb_t->abs_wr_8 = beb_bus_space_write_region_8; 232 beb_t->abs_sm_1 = beb_bus_space_set_multi_1; 233 beb_t->abs_sm_2 = beb_bus_space_set_multi_2; 234 beb_t->abs_sm_4 = beb_bus_space_set_multi_4; 235 beb_t->abs_sm_8 = beb_bus_space_set_multi_8; 236 beb_t->abs_sr_1 = beb_bus_space_set_region_1; 237 beb_t->abs_sr_2 = beb_bus_space_set_region_2; 238 beb_t->abs_sr_4 = beb_bus_space_set_region_4; 239 beb_t->abs_sr_8 = beb_bus_space_set_region_8; 240 241 return(beb_t); 242} 243 244 245/* 246 * The various access functions 247 */ 248 249/* 250 * int bus_space_peek_N __P((bus_space_tag_t tag, 251 * bus_space_handle_t sh, bus_size_t offset)); 252 * 253 * Check if the address is suitable for reading N-byte quantities. 254 */ 255static int 256beb_bus_space_peek_1(t, h, o) 257 bus_space_tag_t t; 258 bus_space_handle_t h; 259 bus_size_t o; 260{ 261 return(!badbaddr((caddr_t)(h + o), 1)); 262} 263 264static int 265beb_bus_space_peek_2(t, h, o) 266 bus_space_tag_t t; 267 bus_space_handle_t h; 268 bus_size_t o; 269{ 270 return(!badbaddr((caddr_t)(h + o), 2)); 271} 272 273static int 274beb_bus_space_peek_4(t, h, o) 275 bus_space_tag_t t; 276 bus_space_handle_t h; 277 bus_size_t o; 278{ 279 return(!badbaddr((caddr_t)(h + o), 4)); 280} 281 282static int 283beb_bus_space_peek_8(t, h, o) 284 bus_space_tag_t t; 285 bus_space_handle_t h; 286 bus_size_t o; 287{ 288 return(!badbaddr((caddr_t)(h + o), 8)); 289} 290 291/* 292 * u_intX_t bus_space_read_N __P((bus_space_tag_t tag, 293 * bus_space_handle_t bsh, bus_size_t offset)); 294 * 295 * Return an 1, 2, 4, or 8 byte value read from the bus_space described 296 * by tag/handle at `offset'. The value is converted to host-endian. 297 */ 298static u_int8_t 299beb_bus_space_read_1(t, h, o) 300 bus_space_tag_t t; 301 bus_space_handle_t h; 302 bus_size_t o; 303{ 304 return(__read_1(h, o)); 305} 306 307static u_int16_t 308beb_bus_space_read_2(t, h, o) 309 bus_space_tag_t t; 310 bus_space_handle_t h; 311 bus_size_t o; 312{ 313 return(__read_2(h, o)); 314} 315 316static u_int32_t 317beb_bus_space_read_4(t, h, o) 318 bus_space_tag_t t; 319 bus_space_handle_t h; 320 bus_size_t o; 321{ 322 return(__read_4(h, o)); 323} 324 325static u_int64_t 326beb_bus_space_read_8(t, h, o) 327 bus_space_tag_t t; 328 bus_space_handle_t h; 329 bus_size_t o; 330{ 331 return(__read_8(h, o)); 332} 333 334/* 335 * u_intX_t bus_space_write_N __P((bus_space_tag_t tag, 336 * bus_space_handle_t bsh, bus_size_t offset, u_intX_t val)); 337 * 338 * Write an 1, 2, 4, or 8 byte value to the bus_space described by tag/handle 339 * at `offset'. The value `val' is converted from host to bus endianness 340 * before being written. 341 */ 342static void 343beb_bus_space_write_1(t, h, o, v) 344 bus_space_tag_t t; 345 bus_space_handle_t h; 346 bus_size_t o; 347 u_int8_t v; 348{ 349 __write_1(h, o, v); 350} 351 352static void 353beb_bus_space_write_2(t, h, o, v) 354 bus_space_tag_t t; 355 bus_space_handle_t h; 356 bus_size_t o; 357 u_int16_t v; 358{ 359 __write_2(h, o, v); 360} 361 362static void 363beb_bus_space_write_4(t, h, o, v) 364 bus_space_tag_t t; 365 bus_space_handle_t h; 366 bus_size_t o; 367 u_int32_t v; 368{ 369 __write_4(h, o, v); 370} 371 372static void 373beb_bus_space_write_8(t, h, o, v) 374 bus_space_tag_t t; 375 bus_space_handle_t h; 376 bus_size_t o; 377 u_int64_t v; 378{ 379 __write_8(h, o, v); 380} 381 382/* 383 * void bus_space_read_multi_N __P((bus_space_tag_t tag, 384 * bus_space_handle_t bsh, bus_size_t offset, u_intX_t *address, 385 * bus_size_t count)); 386 * 387 * Read 'count' 1, 2, 4, or 8 byte values from the bus_space described by 388 * tag/handle at `offset' and store them in the address range starting at 389 * 'address'. The values are converted to cpu endian order before being 390 * being stored. 391 */ 392static void 393beb_bus_space_read_multi_1(t, h, o, a, c) 394 bus_space_tag_t t; 395 bus_space_handle_t h; 396 bus_size_t o, c; 397 u_int8_t *a; 398{ 399 for (; c; a++, c--) 400 *a = __read_1(h, o); 401} 402static void 403beb_bus_space_read_multi_2(t, h, o, a, c) 404 bus_space_tag_t t; 405 bus_space_handle_t h; 406 bus_size_t o, c; 407 u_int16_t *a; 408{ 409 for (; c; a++, c--) 410 *a = __read_2(h, o); 411} 412 413static void 414beb_bus_space_read_multi_4(t, h, o, a, c) 415 bus_space_tag_t t; 416 bus_space_handle_t h; 417 bus_size_t o, c; 418 u_int32_t *a; 419{ 420 for (; c; a++, c--) 421 *a = __read_4(h, o); 422} 423 424static void 425beb_bus_space_read_multi_8(t, h, o, a, c) 426 bus_space_tag_t t; 427 bus_space_handle_t h; 428 bus_size_t o, c; 429 u_int64_t *a; 430{ 431 for (; c; a++, c--) 432 *a = __read_8(h, o); 433} 434 435/* 436 * void bus_space_write_multi_N __P((bus_space_tag_t tag, 437 * bus_space_handle_t bsh, bus_size_t offset, 438 * const u_intX_t *address, bus_size_t count)); 439 * 440 * Write 'count' 1, 2, 4, or 8 byte values from the address range starting 441 * at 'address' to the bus_space described by tag/handle at `offset'. 442 * The values are converted to bus endian order before being written to 443 * the bus. 444 */ 445static void 446beb_bus_space_write_multi_1(t, h, o, a, c) 447 bus_space_tag_t t; 448 bus_space_handle_t h; 449 bus_size_t o, c; 450 const u_int8_t *a; 451{ 452 for (; c; a++, c--) 453 __write_1(h, o, *a); 454} 455 456static void 457beb_bus_space_write_multi_2(t, h, o, a, c) 458 bus_space_tag_t t; 459 bus_space_handle_t h; 460 bus_size_t o, c; 461 const u_int16_t *a; 462{ 463 for (; c; a++, c--) 464 __write_2(h, o, *a); 465} 466 467static void 468beb_bus_space_write_multi_4(t, h, o, a, c) 469 bus_space_tag_t t; 470 bus_space_handle_t h; 471 bus_size_t o, c; 472 const u_int32_t *a; 473{ 474 for (; c; a++, c--) 475 __write_4(h, o, *a); 476} 477 478static void 479beb_bus_space_write_multi_8(t, h, o, a, c) 480 bus_space_tag_t t; 481 bus_space_handle_t h; 482 bus_size_t o, c; 483 const u_int64_t *a; 484{ 485 for (; c; a++, c--) 486 __write_8(h, o, *a); 487} 488 489/* 490 * void bus_space_read_region_N __P((bus_space_tag_t tag, 491 * bus_space_handle_t bsh, bus_size_t offset, 492 * u_intN_t *addr, bus_size_t count)); 493 * 494 * Read `count' 1, 2, 4, or 8 byte quantities from bus space 495 * described by tag/handle and starting at `offset' and copy into 496 * buffer provided. 497 */ 498static void 499beb_bus_space_read_region_1(t, h, o, a, c) 500 bus_space_tag_t t; 501 bus_space_handle_t h; 502 bus_size_t o, c; 503 u_int8_t *a; 504{ 505 for (; c; a++, o++, c--) 506 *a = __read_1(h, o); 507} 508 509static void 510beb_bus_space_read_region_2(t, h, o, a, c) 511 bus_space_tag_t t; 512 bus_space_handle_t h; 513 bus_size_t o, c; 514 u_int16_t *a; 515{ 516 for (; c; a++, o += 2, c--) 517 *a = __read_2(h, o); 518} 519 520static void 521beb_bus_space_read_region_4(t, h, o, a, c) 522 bus_space_tag_t t; 523 bus_space_handle_t h; 524 bus_size_t o, c; 525 u_int32_t *a; 526{ 527 for (; c; a++, o += 4, c--) 528 *a = __read_4(h, o); 529} 530 531static void 532beb_bus_space_read_region_8(t, h, o, a, c) 533 bus_space_tag_t t; 534 bus_space_handle_t h; 535 bus_size_t o, c; 536 u_int64_t *a; 537{ 538 for (; c; a++, o += 8, c--) 539 *a = __read_8(h, o); 540} 541 542/* 543 * void bus_space_write_region_N __P((bus_space_tag_t tag, 544 * bus_space_handle_t bsh, bus_size_t offset, 545 * u_intN_t *addr, bus_size_t count)); 546 * 547 * Copy `count' 1, 2, 4, or 8 byte quantities from the buffer provided 548 * into the bus space described by tag/handle and starting at `offset'. 549 */ 550static void 551beb_bus_space_write_region_1(t, h, o, a, c) 552 bus_space_tag_t t; 553 bus_space_handle_t h; 554 bus_size_t o, c; 555 const u_int8_t *a; 556{ 557 for (; c; a++, o++, c--) 558 __write_1(h, o, *a); 559} 560 561static void 562beb_bus_space_write_region_2(t, h, o, a, c) 563 bus_space_tag_t t; 564 bus_space_handle_t h; 565 bus_size_t o, c; 566 const u_int16_t *a; 567{ 568 for (; c; a++, o += 2, c--) 569 __write_2(h, o, *a); 570} 571 572static void 573beb_bus_space_write_region_4(t, h, o, a, c) 574 bus_space_tag_t t; 575 bus_space_handle_t h; 576 bus_size_t o, c; 577 const u_int32_t *a; 578{ 579 for (; c; a++, o += 4, c--) 580 __write_4(h, o, *a); 581} 582 583static void 584beb_bus_space_write_region_8(t, h, o, a, c) 585 bus_space_tag_t t; 586 bus_space_handle_t h; 587 bus_size_t o, c; 588 const u_int64_t *a; 589{ 590 for (; c; a++, o += 8, c--) 591 __write_8(h, o, *a); 592} 593 594/* 595 * void bus_space_set_multi_N __P((bus_space_tag_t tag, 596 * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, 597 * bus_size_t count)); 598 * 599 * Write the 1, 2, 4, or 8 byte value `val' to bus space described 600 * by tag/handle/offset `count' times. 601 */ 602 603static void 604beb_bus_space_set_multi_1(t, h, o, v, c) 605 bus_space_tag_t t; 606 bus_space_handle_t h; 607 bus_size_t o, c; 608 u_int8_t v; 609{ 610 for (; c; c--) 611 __write_1(h, o, v); 612} 613 614static void 615beb_bus_space_set_multi_2(t, h, o, v, c) 616 bus_space_tag_t t; 617 bus_space_handle_t h; 618 bus_size_t o, c; 619 u_int16_t v; 620{ 621 for (; c; c--) 622 __write_2(h, o, v); 623} 624 625static void 626beb_bus_space_set_multi_4(t, h, o, v, c) 627 bus_space_tag_t t; 628 bus_space_handle_t h; 629 bus_size_t o, c; 630 u_int32_t v; 631{ 632 for (; c; c--) 633 __write_4(h, o, v); 634} 635 636static void 637beb_bus_space_set_multi_8(t, h, o, v, c) 638 bus_space_tag_t t; 639 bus_space_handle_t h; 640 bus_size_t o, c; 641 u_int64_t v; 642{ 643 for (; c; c--) 644 __write_8(h, o, v); 645} 646 647/* 648 * void bus_space_set_region_N __P((bus_space_tag_t tag, 649 * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, 650 * bus_size_t count)); 651 * 652 * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described 653 * by tag/handle starting at `offset'. 654 */ 655static void 656beb_bus_space_set_region_1(t, h, o, v, c) 657 bus_space_tag_t t; 658 bus_space_handle_t h; 659 bus_size_t o, c; 660 u_int8_t v; 661{ 662 for (; c; o++, c--) 663 __write_1(h, o, v); 664} 665 666static void 667beb_bus_space_set_region_2(t, h, o, v, c) 668 bus_space_tag_t t; 669 bus_space_handle_t h; 670 bus_size_t o, c; 671 u_int16_t v; 672{ 673 for (; c; o += 2, c--) 674 __write_2(h, o, v); 675} 676 677static void 678beb_bus_space_set_region_4(t, h, o, v, c) 679 bus_space_tag_t t; 680 bus_space_handle_t h; 681 bus_size_t o, c; 682 u_int32_t v; 683{ 684 for (; c; o += 4, c--) 685 __write_4(h, o, v); 686} 687 688static void 689beb_bus_space_set_region_8(t, h, o, v, c) 690 bus_space_tag_t t; 691 bus_space_handle_t h; 692 bus_size_t o, c; 693 u_int64_t v; 694{ 695 for (; c; o += 8, c--) 696 __write_8(h, o, v); 697} 698