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