1#- 2# Copyright (c) 2015 Landon Fuller <landon@landonf.org> 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# 14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 23# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24# 25# $FreeBSD$ 26 27#include <sys/types.h> 28#include <sys/bus.h> 29#include <sys/rman.h> 30 31#include <dev/bhnd/bhnd_types.h> 32 33INTERFACE bhnd_bus; 34 35# 36# bhnd(4) bus interface 37# 38 39HEADER { 40 /* forward declarations */ 41 struct bhnd_board_info; 42 struct bhnd_core_info; 43 struct bhnd_chipid; 44 struct bhnd_devinfo; 45 struct bhnd_resource; 46} 47 48CODE { 49 #include <sys/systm.h> 50 51 #include <dev/bhnd/bhndvar.h> 52 53 static struct bhnd_chipid * 54 bhnd_bus_null_get_chipid(device_t dev, device_t child) 55 { 56 panic("bhnd_bus_get_chipid unimplemented"); 57 } 58 59 static bhnd_attach_type 60 bhnd_bus_null_get_attach_type(device_t dev, device_t child) 61 { 62 panic("bhnd_bus_get_attach_type unimplemented"); 63 } 64 65 static int 66 bhnd_bus_null_read_board_info(device_t dev, device_t child, 67 struct bhnd_board_info *info) 68 { 69 panic("bhnd_bus_read_boardinfo unimplemented"); 70 } 71 72 static void 73 bhnd_bus_null_child_added(device_t dev, device_t child) 74 { 75 } 76 77 static device_t 78 bhnd_bus_null_find_hostb_device(device_t dev) 79 { 80 panic("bhnd_bus_find_hostb_device unimplemented"); 81 } 82 83 static bool 84 bhnd_bus_null_is_hw_disabled(device_t dev, device_t child) 85 { 86 panic("bhnd_bus_is_hw_disabled unimplemented"); 87 } 88 89 static int 90 bhnd_bus_null_get_probe_order(device_t dev, device_t child) 91 { 92 panic("bhnd_bus_get_probe_order unimplemented"); 93 } 94 95 static int 96 bhnd_bus_null_get_port_rid(device_t dev, device_t child, 97 bhnd_port_type port_type, u_int port, u_int region) 98 { 99 return (-1); 100 } 101 102 static int 103 bhnd_bus_null_decode_port_rid(device_t dev, device_t child, int type, 104 int rid, bhnd_port_type *port_type, u_int *port, u_int *region) 105 { 106 return (ENOENT); 107 } 108 109 static int 110 bhnd_bus_null_get_region_addr(device_t dev, device_t child, 111 bhnd_port_type type, u_int port, u_int region, bhnd_addr_t *addr, 112 bhnd_size_t *size) 113 { 114 return (ENOENT); 115 } 116 117 static int 118 bhnd_bus_null_get_nvram_var(device_t dev, device_t child, 119 const char *name, void *buf, size_t *size, bhnd_nvram_type type) 120 { 121 return (ENODEV); 122 } 123 124} 125 126/** 127 * Return the active host bridge core for the bhnd bus, if any. 128 * 129 * @param dev The bhnd bus device. 130 * 131 * @retval device_t if a hostb device exists 132 * @retval NULL if no hostb device is found. 133 */ 134METHOD device_t find_hostb_device { 135 device_t dev; 136} DEFAULT bhnd_bus_null_find_hostb_device; 137 138/** 139 * Return true if the hardware components required by @p child are unpopulated 140 * or otherwise unusable. 141 * 142 * In some cases, enumerated devices may have pins that are left floating, or 143 * the hardware may otherwise be non-functional; this method allows a parent 144 * device to explicitly specify if a successfully enumerated @p child should 145 * be disabled. 146 * 147 * @param dev The device whose child is being examined. 148 * @param child The child device. 149 */ 150METHOD bool is_hw_disabled { 151 device_t dev; 152 device_t child; 153} DEFAULT bhnd_bus_null_is_hw_disabled; 154 155/** 156 * Return the probe (and attach) order for @p child. 157 * 158 * All devices on the bhnd(4) bus will be probed, attached, or resumed in 159 * ascending order; they will be suspended, shutdown, and detached in 160 * descending order. 161 * 162 * The following device methods will be dispatched in ascending probe order 163 * by the bus: 164 * 165 * - DEVICE_PROBE() 166 * - DEVICE_ATTACH() 167 * - DEVICE_RESUME() 168 * 169 * The following device methods will be dispatched in descending probe order 170 * by the bus: 171 * 172 * - DEVICE_SHUTDOWN() 173 * - DEVICE_DETACH() 174 * - DEVICE_SUSPEND() 175 * 176 * @param dev The device whose child is being examined. 177 * @param child The child device. 178 * 179 * Refer to BHND_PROBE_* and BHND_PROBE_ORDER_* for the standard set of 180 * priorities. 181 */ 182METHOD int get_probe_order { 183 device_t dev; 184 device_t child; 185} DEFAULT bhnd_bus_null_get_probe_order; 186 187/** 188 * Return the BHND chip identification for the parent bus. 189 * 190 * @param dev The device whose child is being examined. 191 * @param child The child device. 192 */ 193METHOD const struct bhnd_chipid * get_chipid { 194 device_t dev; 195 device_t child; 196} DEFAULT bhnd_bus_null_get_chipid; 197 198/** 199 * Return the BHND attachment type of the parent bus. 200 * 201 * @param dev The device whose child is being examined. 202 * @param child The child device. 203 * 204 * @retval BHND_ATTACH_ADAPTER if the bus is resident on a bridged adapter, 205 * such as a WiFi chipset. 206 * @retval BHND_ATTACH_NATIVE if the bus provides hardware services (clock, 207 * CPU, etc) to a directly attached native host. 208 */ 209METHOD bhnd_attach_type get_attach_type { 210 device_t dev; 211 device_t child; 212} DEFAULT bhnd_bus_null_get_attach_type; 213 214/** 215 * Attempt to read the BHND board identification from the parent bus. 216 * 217 * This relies on NVRAM access, and will fail if a valid NVRAM device cannot 218 * be found, or is not yet attached. 219 * 220 * @param dev The parent of @p child. 221 * @param child The bhnd device requesting board info. 222 * @param[out] info On success, will be populated with the bhnd(4) device's 223 * board information. 224 * 225 * @retval 0 success 226 * @retval ENODEV No valid NVRAM source could be found. 227 * @retval non-zero If reading @p name otherwise fails, a regular unix 228 * error code will be returned. 229 */ 230METHOD int read_board_info { 231 device_t dev; 232 device_t child; 233 struct bhnd_board_info *info; 234} DEFAULT bhnd_bus_null_read_board_info; 235 236/** 237 * Allocate and zero-initialize a buffer suitably sized and aligned for a 238 * bhnd_devinfo structure. 239 * 240 * @param dev The bhnd bus device. 241 * 242 * @retval non-NULL success 243 * @retval NULL allocation failed 244 */ 245METHOD struct bhnd_devinfo * alloc_devinfo { 246 device_t dev; 247}; 248 249/** 250 * Release memory previously allocated for @p devinfo. 251 * 252 * @param dev The bhnd bus device. 253 * @param dinfo A devinfo buffer previously allocated via 254 * BHND_BUS_ALLOC_DEVINFO(). 255 */ 256METHOD void free_devinfo { 257 device_t dev; 258 struct bhnd_devinfo *dinfo; 259}; 260 261/** 262 * Notify a bhnd bus that a child was added. 263 * 264 * Called at the end of BUS_ADD_CHILD() to allow the concrete bhnd(4) 265 * driver instance to initialize any additional driver-specific state for the 266 * child. 267 * 268 * @param dev The bhnd bus whose child is being added. 269 * @param child The child added to @p dev. 270 */ 271METHOD void child_added { 272 device_t dev; 273 device_t child; 274} DEFAULT bhnd_bus_null_child_added; 275 276/** 277 * Reset the device's hardware core. 278 * 279 * @param dev The parent of @p child. 280 * @param child The device to be reset. 281 * @param flags Device-specific core flags to be supplied on reset. 282 * 283 * @retval 0 success 284 * @retval non-zero error 285 */ 286METHOD int reset_core { 287 device_t dev; 288 device_t child; 289 uint16_t flags; 290} 291 292/** 293 * Suspend a device hardware core. 294 * 295 * @param dev The parent of @p child. 296 * @param child The device to be reset. 297 * 298 * @retval 0 success 299 * @retval non-zero error 300 */ 301METHOD int suspend_core { 302 device_t dev; 303 device_t child; 304} 305 306/** 307 * Allocate a bhnd resource. 308 * 309 * This method's semantics are functionally identical to the bus API of the same 310 * name; refer to BUS_ALLOC_RESOURCE for complete documentation. 311 */ 312METHOD struct bhnd_resource * alloc_resource { 313 device_t dev; 314 device_t child; 315 int type; 316 int *rid; 317 rman_res_t start; 318 rman_res_t end; 319 rman_res_t count; 320 u_int flags; 321} DEFAULT bhnd_bus_generic_alloc_resource; 322 323/** 324 * Release a bhnd resource. 325 * 326 * This method's semantics are functionally identical to the bus API of the same 327 * name; refer to BUS_RELEASE_RESOURCE for complete documentation. 328 */ 329METHOD int release_resource { 330 device_t dev; 331 device_t child; 332 int type; 333 int rid; 334 struct bhnd_resource *res; 335} DEFAULT bhnd_bus_generic_release_resource; 336 337/** 338 * Activate a bhnd resource. 339 * 340 * This method's semantics are functionally identical to the bus API of the same 341 * name; refer to BUS_ACTIVATE_RESOURCE for complete documentation. 342 */ 343METHOD int activate_resource { 344 device_t dev; 345 device_t child; 346 int type; 347 int rid; 348 struct bhnd_resource *r; 349} DEFAULT bhnd_bus_generic_activate_resource; 350 351/** 352 * Deactivate a bhnd resource. 353 * 354 * This method's semantics are functionally identical to the bus API of the same 355 * name; refer to BUS_DEACTIVATE_RESOURCE for complete documentation. 356 */ 357METHOD int deactivate_resource { 358 device_t dev; 359 device_t child; 360 int type; 361 int rid; 362 struct bhnd_resource *r; 363} DEFAULT bhnd_bus_generic_deactivate_resource; 364 365/** 366 * Return true if @p region_num is a valid region on @p port_num of 367 * @p type attached to @p child. 368 * 369 * @param dev The device whose child is being examined. 370 * @param child The child device. 371 * @param type The port type being queried. 372 * @param port_num The port number being queried. 373 * @param region_num The region number being queried. 374 */ 375METHOD bool is_region_valid { 376 device_t dev; 377 device_t child; 378 bhnd_port_type type; 379 u_int port_num; 380 u_int region_num; 381}; 382 383/** 384 * Return the number of ports of type @p type attached to @p child. 385 * 386 * @param dev The device whose child is being examined. 387 * @param child The child device. 388 * @param type The port type being queried. 389 */ 390METHOD u_int get_port_count { 391 device_t dev; 392 device_t child; 393 bhnd_port_type type; 394}; 395 396/** 397 * Return the number of memory regions mapped to @p child @p port of 398 * type @p type. 399 * 400 * @param dev The device whose child is being examined. 401 * @param child The child device. 402 * @param port The port number being queried. 403 * @param type The port type being queried. 404 */ 405METHOD u_int get_region_count { 406 device_t dev; 407 device_t child; 408 bhnd_port_type type; 409 u_int port; 410}; 411 412/** 413 * Return the SYS_RES_MEMORY resource-ID for a port/region pair attached to 414 * @p child. 415 * 416 * @param dev The bus device. 417 * @param child The bhnd child. 418 * @param port_type The port type. 419 * @param port_num The index of the child interconnect port. 420 * @param region_num The index of the port-mapped address region. 421 * 422 * @retval -1 No such port/region found. 423 */ 424METHOD int get_port_rid { 425 device_t dev; 426 device_t child; 427 bhnd_port_type port_type; 428 u_int port_num; 429 u_int region_num; 430} DEFAULT bhnd_bus_null_get_port_rid; 431 432 433/** 434 * Decode a port / region pair on @p child defined by @p type and @p rid. 435 * 436 * @param dev The bus device. 437 * @param child The bhnd child. 438 * @param type The resource type. 439 * @param rid The resource ID. 440 * @param[out] port_type The port's type. 441 * @param[out] port The port identifier. 442 * @param[out] region The identifier of the memory region on @p port. 443 * 444 * @retval 0 success 445 * @retval non-zero No matching type/rid found. 446 */ 447METHOD int decode_port_rid { 448 device_t dev; 449 device_t child; 450 int type; 451 int rid; 452 bhnd_port_type *port_type; 453 u_int *port; 454 u_int *region; 455} DEFAULT bhnd_bus_null_decode_port_rid; 456 457/** 458 * Get the address and size of @p region on @p port. 459 * 460 * @param dev The bus device. 461 * @param child The bhnd child. 462 * @param port_type The port type. 463 * @param port The port identifier. 464 * @param region The identifier of the memory region on @p port. 465 * @param[out] region_addr The region's base address. 466 * @param[out] region_size The region's size. 467 * 468 * @retval 0 success 469 * @retval non-zero No matching port/region found. 470 */ 471METHOD int get_region_addr { 472 device_t dev; 473 device_t child; 474 bhnd_port_type port_type; 475 u_int port; 476 u_int region; 477 bhnd_addr_t *region_addr; 478 bhnd_size_t *region_size; 479} DEFAULT bhnd_bus_null_get_region_addr; 480 481/** 482 * Read an NVRAM variable. 483 * 484 * It is the responsibility of the bus to delegate this request to 485 * the appropriate NVRAM child device, or to a parent bus implementation. 486 * 487 * @param dev The bus device. 488 * @param child The requesting device. 489 * @param name The NVRAM variable name. 490 * @param[out] buf On success, the requested value will be written 491 * to this buffer. This argment may be NULL if 492 * the value is not desired. 493 * @param[in,out] size The capacity of @p buf. On success, will be set 494 * to the actual size of the requested value. 495 * @param type The data type to be written to @p buf. 496 * 497 * @retval 0 success 498 * @retval ENOENT The requested variable was not found. 499 * @retval ENOMEM If @p buf is non-NULL and a buffer of @p size is too 500 * small to hold the requested value. 501 * @retval ENODEV No valid NVRAM source could be found. 502 * @retval EFTYPE If the @p name's data type cannot be coerced to @p type. 503 * @retval ERANGE If value coercion would overflow @p type. 504 * @retval non-zero If reading @p name otherwise fails, a regular unix 505 * error code will be returned. 506 */ 507METHOD int get_nvram_var { 508 device_t dev; 509 device_t child; 510 const char *name; 511 void *buf; 512 size_t *size; 513 bhnd_nvram_type type; 514} DEFAULT bhnd_bus_null_get_nvram_var; 515 516 517/** An implementation of bus_read_1() compatible with bhnd_resource */ 518METHOD uint8_t read_1 { 519 device_t dev; 520 device_t child; 521 struct bhnd_resource *r; 522 bus_size_t offset; 523} 524 525/** An implementation of bus_read_2() compatible with bhnd_resource */ 526METHOD uint16_t read_2 { 527 device_t dev; 528 device_t child; 529 struct bhnd_resource *r; 530 bus_size_t offset; 531} 532 533/** An implementation of bus_read_4() compatible with bhnd_resource */ 534METHOD uint32_t read_4 { 535 device_t dev; 536 device_t child; 537 struct bhnd_resource *r; 538 bus_size_t offset; 539} 540 541/** An implementation of bus_write_1() compatible with bhnd_resource */ 542METHOD void write_1 { 543 device_t dev; 544 device_t child; 545 struct bhnd_resource *r; 546 bus_size_t offset; 547 uint8_t value; 548} 549 550/** An implementation of bus_write_2() compatible with bhnd_resource */ 551METHOD void write_2 { 552 device_t dev; 553 device_t child; 554 struct bhnd_resource *r; 555 bus_size_t offset; 556 uint16_t value; 557} 558 559/** An implementation of bus_write_4() compatible with bhnd_resource */ 560METHOD void write_4 { 561 device_t dev; 562 device_t child; 563 struct bhnd_resource *r; 564 bus_size_t offset; 565 uint32_t value; 566} 567 568/** An implementation of bus_read_stream_1() compatible with bhnd_resource */ 569METHOD uint8_t read_stream_1 { 570 device_t dev; 571 device_t child; 572 struct bhnd_resource *r; 573 bus_size_t offset; 574} 575 576/** An implementation of bus_read_stream_2() compatible with bhnd_resource */ 577METHOD uint16_t read_stream_2 { 578 device_t dev; 579 device_t child; 580 struct bhnd_resource *r; 581 bus_size_t offset; 582} 583 584/** An implementation of bus_read_stream_4() compatible with bhnd_resource */ 585METHOD uint32_t read_stream_4 { 586 device_t dev; 587 device_t child; 588 struct bhnd_resource *r; 589 bus_size_t offset; 590} 591 592/** An implementation of bus_write_stream_1() compatible with bhnd_resource */ 593METHOD void write_stream_1 { 594 device_t dev; 595 device_t child; 596 struct bhnd_resource *r; 597 bus_size_t offset; 598 uint8_t value; 599} 600 601/** An implementation of bus_write_stream_2() compatible with bhnd_resource */ 602METHOD void write_stream_2 { 603 device_t dev; 604 device_t child; 605 struct bhnd_resource *r; 606 bus_size_t offset; 607 uint16_t value; 608} 609 610/** An implementation of bus_write_stream_4() compatible with bhnd_resource */ 611METHOD void write_stream_4 { 612 device_t dev; 613 device_t child; 614 struct bhnd_resource *r; 615 bus_size_t offset; 616 uint32_t value; 617} 618 619/** An implementation of bus_read_multi_1() compatible with bhnd_resource */ 620METHOD void read_multi_1 { 621 device_t dev; 622 device_t child; 623 struct bhnd_resource *r; 624 bus_size_t offset; 625 uint8_t *datap; 626 bus_size_t count; 627} 628 629/** An implementation of bus_read_multi_2() compatible with bhnd_resource */ 630METHOD void read_multi_2 { 631 device_t dev; 632 device_t child; 633 struct bhnd_resource *r; 634 bus_size_t offset; 635 uint16_t *datap; 636 bus_size_t count; 637} 638 639/** An implementation of bus_read_multi_4() compatible with bhnd_resource */ 640METHOD void read_multi_4 { 641 device_t dev; 642 device_t child; 643 struct bhnd_resource *r; 644 bus_size_t offset; 645 uint32_t *datap; 646 bus_size_t count; 647} 648 649/** An implementation of bus_write_multi_1() compatible with bhnd_resource */ 650METHOD void write_multi_1 { 651 device_t dev; 652 device_t child; 653 struct bhnd_resource *r; 654 bus_size_t offset; 655 uint8_t *datap; 656 bus_size_t count; 657} 658 659/** An implementation of bus_write_multi_2() compatible with bhnd_resource */ 660METHOD void write_multi_2 { 661 device_t dev; 662 device_t child; 663 struct bhnd_resource *r; 664 bus_size_t offset; 665 uint16_t *datap; 666 bus_size_t count; 667} 668 669/** An implementation of bus_write_multi_4() compatible with bhnd_resource */ 670METHOD void write_multi_4 { 671 device_t dev; 672 device_t child; 673 struct bhnd_resource *r; 674 bus_size_t offset; 675 uint32_t *datap; 676 bus_size_t count; 677} 678 679/** An implementation of bus_read_multi_stream_1() compatible 680 * bhnd_resource */ 681METHOD void read_multi_stream_1 { 682 device_t dev; 683 device_t child; 684 struct bhnd_resource *r; 685 bus_size_t offset; 686 uint8_t *datap; 687 bus_size_t count; 688} 689 690/** An implementation of bus_read_multi_stream_2() compatible 691 * bhnd_resource */ 692METHOD void read_multi_stream_2 { 693 device_t dev; 694 device_t child; 695 struct bhnd_resource *r; 696 bus_size_t offset; 697 uint16_t *datap; 698 bus_size_t count; 699} 700 701/** An implementation of bus_read_multi_stream_4() compatible 702 * bhnd_resource */ 703METHOD void read_multi_stream_4 { 704 device_t dev; 705 device_t child; 706 struct bhnd_resource *r; 707 bus_size_t offset; 708 uint32_t *datap; 709 bus_size_t count; 710} 711 712/** An implementation of bus_write_multi_stream_1() compatible 713 * bhnd_resource */ 714METHOD void write_multi_stream_1 { 715 device_t dev; 716 device_t child; 717 struct bhnd_resource *r; 718 bus_size_t offset; 719 uint8_t *datap; 720 bus_size_t count; 721} 722 723/** An implementation of bus_write_multi_stream_2() compatible with 724 * bhnd_resource */ 725METHOD void write_multi_stream_2 { 726 device_t dev; 727 device_t child; 728 struct bhnd_resource *r; 729 bus_size_t offset; 730 uint16_t *datap; 731 bus_size_t count; 732} 733 734/** An implementation of bus_write_multi_stream_4() compatible with 735 * bhnd_resource */ 736METHOD void write_multi_stream_4 { 737 device_t dev; 738 device_t child; 739 struct bhnd_resource *r; 740 bus_size_t offset; 741 uint32_t *datap; 742 bus_size_t count; 743} 744 745/** An implementation of bus_set_multi_1() compatible with bhnd_resource */ 746METHOD void set_multi_1 { 747 device_t dev; 748 device_t child; 749 struct bhnd_resource *r; 750 bus_size_t offset; 751 uint8_t value; 752 bus_size_t count; 753} 754 755/** An implementation of bus_set_multi_2() compatible with bhnd_resource */ 756METHOD void set_multi_2 { 757 device_t dev; 758 device_t child; 759 struct bhnd_resource *r; 760 bus_size_t offset; 761 uint16_t value; 762 bus_size_t count; 763} 764 765/** An implementation of bus_set_multi_4() compatible with bhnd_resource */ 766METHOD void set_multi_4 { 767 device_t dev; 768 device_t child; 769 struct bhnd_resource *r; 770 bus_size_t offset; 771 uint32_t value; 772 bus_size_t count; 773} 774 775/** An implementation of bus_set_region_1() compatible with bhnd_resource */ 776METHOD void set_region_1 { 777 device_t dev; 778 device_t child; 779 struct bhnd_resource *r; 780 bus_size_t offset; 781 uint8_t value; 782 bus_size_t count; 783} 784 785/** An implementation of bus_set_region_2() compatible with bhnd_resource */ 786METHOD void set_region_2 { 787 device_t dev; 788 device_t child; 789 struct bhnd_resource *r; 790 bus_size_t offset; 791 uint16_t value; 792 bus_size_t count; 793} 794 795/** An implementation of bus_set_region_4() compatible with bhnd_resource */ 796METHOD void set_region_4 { 797 device_t dev; 798 device_t child; 799 struct bhnd_resource *r; 800 bus_size_t offset; 801 uint32_t value; 802 bus_size_t count; 803} 804 805/** An implementation of bus_read_region_1() compatible with bhnd_resource */ 806METHOD void read_region_1 { 807 device_t dev; 808 device_t child; 809 struct bhnd_resource *r; 810 bus_size_t offset; 811 uint8_t *datap; 812 bus_size_t count; 813} 814 815/** An implementation of bus_read_region_2() compatible with bhnd_resource */ 816METHOD void read_region_2 { 817 device_t dev; 818 device_t child; 819 struct bhnd_resource *r; 820 bus_size_t offset; 821 uint16_t *datap; 822 bus_size_t count; 823} 824 825/** An implementation of bus_read_region_4() compatible with bhnd_resource */ 826METHOD void read_region_4 { 827 device_t dev; 828 device_t child; 829 struct bhnd_resource *r; 830 bus_size_t offset; 831 uint32_t *datap; 832 bus_size_t count; 833} 834 835/** An implementation of bus_read_region_stream_1() compatible with 836 * bhnd_resource */ 837METHOD void read_region_stream_1 { 838 device_t dev; 839 device_t child; 840 struct bhnd_resource *r; 841 bus_size_t offset; 842 uint8_t *datap; 843 bus_size_t count; 844} 845 846/** An implementation of bus_read_region_stream_2() compatible with 847 * bhnd_resource */ 848METHOD void read_region_stream_2 { 849 device_t dev; 850 device_t child; 851 struct bhnd_resource *r; 852 bus_size_t offset; 853 uint16_t *datap; 854 bus_size_t count; 855} 856 857/** An implementation of bus_read_region_stream_4() compatible with 858 * bhnd_resource */ 859METHOD void read_region_stream_4 { 860 device_t dev; 861 device_t child; 862 struct bhnd_resource *r; 863 bus_size_t offset; 864 uint32_t *datap; 865 bus_size_t count; 866} 867 868/** An implementation of bus_write_region_1() compatible with bhnd_resource */ 869METHOD void write_region_1 { 870 device_t dev; 871 device_t child; 872 struct bhnd_resource *r; 873 bus_size_t offset; 874 uint8_t *datap; 875 bus_size_t count; 876} 877 878/** An implementation of bus_write_region_2() compatible with bhnd_resource */ 879METHOD void write_region_2 { 880 device_t dev; 881 device_t child; 882 struct bhnd_resource *r; 883 bus_size_t offset; 884 uint16_t *datap; 885 bus_size_t count; 886} 887 888/** An implementation of bus_write_region_4() compatible with bhnd_resource */ 889METHOD void write_region_4 { 890 device_t dev; 891 device_t child; 892 struct bhnd_resource *r; 893 bus_size_t offset; 894 uint32_t *datap; 895 bus_size_t count; 896} 897 898/** An implementation of bus_write_region_stream_1() compatible with 899 * bhnd_resource */ 900METHOD void write_region_stream_1 { 901 device_t dev; 902 device_t child; 903 struct bhnd_resource *r; 904 bus_size_t offset; 905 uint8_t *datap; 906 bus_size_t count; 907} 908 909/** An implementation of bus_write_region_stream_2() compatible with 910 * bhnd_resource */ 911METHOD void write_region_stream_2 { 912 device_t dev; 913 device_t child; 914 struct bhnd_resource *r; 915 bus_size_t offset; 916 uint16_t *datap; 917 bus_size_t count; 918} 919 920/** An implementation of bus_write_region_stream_4() compatible with 921 * bhnd_resource */ 922METHOD void write_region_stream_4 { 923 device_t dev; 924 device_t child; 925 struct bhnd_resource *r; 926 bus_size_t offset; 927 uint32_t *datap; 928 bus_size_t count; 929} 930 931/** An implementation of bus_barrier() compatible with bhnd_resource */ 932METHOD void barrier { 933 device_t dev; 934 device_t child; 935 struct bhnd_resource *r; 936 bus_size_t offset; 937 bus_size_t length; 938 int flags; 939} 940