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