1#- 2# Copyright (c) 2015-2016 Landon Fuller <landonf@FreeBSD.org> 3# Copyright (c) 2017 The FreeBSD Foundation 4# All rights reserved. 5# 6# Portions of this software were developed by Landon Fuller 7# under sponsorship from the FreeBSD Foundation. 8# 9# Redistribution and use in source and binary forms, with or without 10# modification, are permitted provided that the following conditions 11# are met: 12# 1. Redistributions of source code must retain the above copyright 13# notice, this list of conditions and the following disclaimer. 14# 2. Redistributions in binary form must reproduce the above copyright 15# notice, this list of conditions and the following disclaimer in the 16# documentation and/or other materials provided with the distribution. 17# 18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 27# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28# 29# $FreeBSD$ 30 31#include <sys/types.h> 32#include <sys/bus.h> 33#include <sys/rman.h> 34 35#include <dev/bhnd/bhnd_types.h> 36#include <dev/bhnd/bhnd_erom_types.h> 37 38INTERFACE bhnd_bus; 39 40# 41# bhnd(4) bus interface 42# 43 44HEADER { 45 /* forward declarations */ 46 struct bhnd_board_info; 47 struct bhnd_core_info; 48 struct bhnd_chipid; 49 struct bhnd_devinfo; 50 struct bhnd_resource; 51} 52 53CODE { 54 #include <sys/systm.h> 55 56 #include <dev/bhnd/bhndvar.h> 57 58 static bhnd_erom_class_t * 59 bhnd_bus_null_get_erom_class(driver_t *driver) 60 { 61 return (NULL); 62 } 63 64 static struct bhnd_chipid * 65 bhnd_bus_null_get_chipid(device_t dev, device_t child) 66 { 67 panic("bhnd_bus_get_chipid unimplemented"); 68 } 69 70 static int 71 bhnd_bus_null_read_ioctl(device_t dev, device_t child, uint16_t *ioctl) 72 { 73 panic("bhnd_bus_read_ioctl unimplemented"); 74 } 75 76 77 static int 78 bhnd_bus_null_write_ioctl(device_t dev, device_t child, uint16_t value, 79 uint16_t mask) 80 { 81 panic("bhnd_bus_write_ioctl unimplemented"); 82 } 83 84 85 static int 86 bhnd_bus_null_read_iost(device_t dev, device_t child, uint16_t *iost) 87 { 88 panic("bhnd_bus_read_iost unimplemented"); 89 } 90 91 static bool 92 bhnd_bus_null_is_hw_suspended(device_t dev, device_t child) 93 { 94 panic("bhnd_bus_is_hw_suspended unimplemented"); 95 } 96 97 static int 98 bhnd_bus_null_reset_hw(device_t dev, device_t child, uint16_t ioctl) 99 { 100 panic("bhnd_bus_reset_hw unimplemented"); 101 } 102 103 104 static int 105 bhnd_bus_null_suspend_hw(device_t dev, device_t child) 106 { 107 panic("bhnd_bus_suspend_hw unimplemented"); 108 } 109 110 static bhnd_attach_type 111 bhnd_bus_null_get_attach_type(device_t dev, device_t child) 112 { 113 panic("bhnd_bus_get_attach_type unimplemented"); 114 } 115 116 static bhnd_clksrc 117 bhnd_bus_null_pwrctl_get_clksrc(device_t dev, device_t child, 118 bhnd_clock clock) 119 { 120 return (BHND_CLKSRC_UNKNOWN); 121 } 122 123 static int 124 bhnd_bus_null_pwrctl_gate_clock(device_t dev, device_t child, 125 bhnd_clock clock) 126 { 127 return (ENODEV); 128 } 129 130 static int 131 bhnd_bus_null_pwrctl_ungate_clock(device_t dev, device_t child, 132 bhnd_clock clock) 133 { 134 return (ENODEV); 135 } 136 137 static int 138 bhnd_bus_null_read_board_info(device_t dev, device_t child, 139 struct bhnd_board_info *info) 140 { 141 panic("bhnd_bus_read_boardinfo unimplemented"); 142 } 143 144 static int 145 bhnd_bus_null_get_intr_count(device_t dev, device_t child) 146 { 147 panic("bhnd_bus_get_intr_count unimplemented"); 148 } 149 150 static int 151 bhnd_bus_null_assign_intr(device_t dev, device_t child, int rid) 152 { 153 panic("bhnd_bus_assign_intr unimplemented"); 154 } 155 156 static int 157 bhnd_bus_null_get_core_ivec(device_t dev, device_t child, u_int intr, 158 uint32_t *ivec) 159 { 160 panic("bhnd_bus_get_core_ivec unimplemented"); 161 } 162 163 static void 164 bhnd_bus_null_child_added(device_t dev, device_t child) 165 { 166 } 167 168 static int 169 bhnd_bus_null_alloc_pmu(device_t dev, device_t child) 170 { 171 panic("bhnd_bus_alloc_pmu unimplemented"); 172 } 173 174 static int 175 bhnd_bus_null_release_pmu(device_t dev, device_t child) 176 { 177 panic("bhnd_bus_release_pmu unimplemented"); 178 } 179 180 static int 181 bhnd_bus_null_request_clock(device_t dev, device_t child, 182 bhnd_clock clock) 183 { 184 panic("bhnd_bus_request_clock unimplemented"); 185 } 186 187 static int 188 bhnd_bus_null_enable_clocks(device_t dev, device_t child, 189 uint32_t clocks) 190 { 191 panic("bhnd_bus_enable_clocks unimplemented"); 192 } 193 194 static int 195 bhnd_bus_null_request_ext_rsrc(device_t dev, device_t child, 196 u_int rsrc) 197 { 198 panic("bhnd_bus_request_ext_rsrc unimplemented"); 199 } 200 201 static int 202 bhnd_bus_null_release_ext_rsrc(device_t dev, device_t child, 203 u_int rsrc) 204 { 205 panic("bhnd_bus_release_ext_rsrc unimplemented"); 206 } 207 208 static int 209 bhnd_bus_null_read_config(device_t dev, device_t child, 210 bus_size_t offset, void *value, u_int width) 211 { 212 panic("bhnd_bus_null_read_config unimplemented"); 213 } 214 215 static void 216 bhnd_bus_null_write_config(device_t dev, device_t child, 217 bus_size_t offset, void *value, u_int width) 218 { 219 panic("bhnd_bus_null_write_config unimplemented"); 220 } 221 222 static device_t 223 bhnd_bus_null_find_hostb_device(device_t dev) 224 { 225 return (NULL); 226 } 227 228 static struct bhnd_service_registry * 229 bhnd_bus_null_get_service_registry(device_t dev) 230 { 231 panic("bhnd_bus_get_service_registry unimplemented"); 232 } 233 234 static bool 235 bhnd_bus_null_is_hw_disabled(device_t dev, device_t child) 236 { 237 panic("bhnd_bus_is_hw_disabled unimplemented"); 238 } 239 240 static int 241 bhnd_bus_null_get_probe_order(device_t dev, device_t child) 242 { 243 panic("bhnd_bus_get_probe_order unimplemented"); 244 } 245 246 static int 247 bhnd_bus_null_get_port_rid(device_t dev, device_t child, 248 bhnd_port_type port_type, u_int port, u_int region) 249 { 250 return (-1); 251 } 252 253 static int 254 bhnd_bus_null_decode_port_rid(device_t dev, device_t child, int type, 255 int rid, bhnd_port_type *port_type, u_int *port, u_int *region) 256 { 257 return (ENOENT); 258 } 259 260 static int 261 bhnd_bus_null_get_region_addr(device_t dev, device_t child, 262 bhnd_port_type type, u_int port, u_int region, bhnd_addr_t *addr, 263 bhnd_size_t *size) 264 { 265 return (ENOENT); 266 } 267 268 static int 269 bhnd_bus_null_get_nvram_var(device_t dev, device_t child, 270 const char *name, void *buf, size_t *size, bhnd_nvram_type type) 271 { 272 return (ENODEV); 273 } 274 275} 276 277/** 278 * Return the bhnd(4) bus driver's device enumeration parser class. 279 * 280 * @param driver The bhnd bus driver instance. 281 */ 282STATICMETHOD bhnd_erom_class_t * get_erom_class { 283 driver_t *driver; 284} DEFAULT bhnd_bus_null_get_erom_class; 285 286/** 287 * Register a shared bus @p provider for a given @p service. 288 * 289 * @param dev The parent of @p child. 290 * @param child The requesting child device. 291 * @param provider The service provider to register. 292 * @param service The service for which @p provider will be registered. 293 * 294 * @retval 0 success 295 * @retval EEXIST if an entry for @p service already exists. 296 * @retval non-zero if registering @p provider otherwise fails, a regular 297 * unix error code will be returned. 298 */ 299METHOD int register_provider { 300 device_t dev; 301 device_t child; 302 device_t provider; 303 bhnd_service_t service; 304} DEFAULT bhnd_bus_generic_register_provider; 305 306 /** 307 * Attempt to remove the @p service provider registration for @p provider. 308 * 309 * @param dev The parent of @p child. 310 * @param child The requesting child device. 311 * @param provider The service provider to be deregistered. 312 * @param service The service for which @p provider will be deregistered, 313 * or BHND_SERVICE_INVALID to remove all service 314 * registrations for @p provider. 315 * 316 * @retval 0 success 317 * @retval EBUSY if active references to @p provider exist; @see 318 * BHND_BUS_RETAIN_PROVIDER() and 319 * BHND_BUS_RELEASE_PROVIDER(). 320 */ 321METHOD int deregister_provider { 322 device_t dev; 323 device_t child; 324 device_t provider; 325 bhnd_service_t service; 326} DEFAULT bhnd_bus_generic_deregister_provider; 327 328/** 329 * Retain and return a reference to the registered @p service provider, if any. 330 * 331 * @param dev The parent of @p child. 332 * @param child The requesting child device. 333 * @param service The service for which a provider should be returned. 334 * 335 * On success, the caller assumes ownership the returned provider, and 336 * is responsible for releasing this reference via 337 * BHND_BUS_RELEASE_PROVIDER(). 338 * 339 * @retval device_t success 340 * @retval NULL if no provider is registered for @p service. 341 */ 342METHOD device_t retain_provider { 343 device_t dev; 344 device_t child; 345 bhnd_service_t service; 346} DEFAULT bhnd_bus_generic_retain_provider; 347 348 /** 349 * Release a reference to a service provider previously returned by 350 * BHND_BUS_RETAIN_PROVIDER(). 351 * 352 * @param dev The parent of @p child. 353 * @param child The requesting child device. 354 * @param provider The provider to be released. 355 * @param service The service for which @p provider was previously 356 * retained. 357 */ 358METHOD void release_provider { 359 device_t dev; 360 device_t child; 361 device_t provider; 362 bhnd_service_t service; 363} DEFAULT bhnd_bus_generic_release_provider; 364 365/** 366 * Return a struct bhnd_service_registry. 367 * 368 * Used by drivers which use bhnd_bus_generic_sr_register_provider() etc. 369 * to implement service provider registration. It should return a service 370 * registry that may be used to resolve provider requests from @p child. 371 * 372 * @param dev The parent of @p child. 373 * @param child The requesting child device. 374 */ 375METHOD struct bhnd_service_registry * get_service_registry { 376 device_t dev; 377 device_t child; 378} DEFAULT bhnd_bus_null_get_service_registry; 379 380/** 381 * Return the active host bridge core for the bhnd bus, if any. 382 * 383 * @param dev The bhnd bus device. 384 * 385 * @retval device_t if a hostb device exists 386 * @retval NULL if no hostb device is found. 387 */ 388METHOD device_t find_hostb_device { 389 device_t dev; 390} DEFAULT bhnd_bus_null_find_hostb_device; 391 392/** 393 * Return true if the hardware components required by @p child are unpopulated 394 * or otherwise unusable. 395 * 396 * In some cases, enumerated devices may have pins that are left floating, or 397 * the hardware may otherwise be non-functional; this method allows a parent 398 * device to explicitly specify if a successfully enumerated @p child should 399 * be disabled. 400 * 401 * @param dev The device whose child is being examined. 402 * @param child The child device. 403 */ 404METHOD bool is_hw_disabled { 405 device_t dev; 406 device_t child; 407} DEFAULT bhnd_bus_null_is_hw_disabled; 408 409/** 410 * Return the probe (and attach) order for @p child. 411 * 412 * All devices on the bhnd(4) bus will be probed, attached, or resumed in 413 * ascending order; they will be suspended, shutdown, and detached in 414 * descending order. 415 * 416 * The following device methods will be dispatched in ascending probe order 417 * by the bus: 418 * 419 * - DEVICE_PROBE() 420 * - DEVICE_ATTACH() 421 * - DEVICE_RESUME() 422 * 423 * The following device methods will be dispatched in descending probe order 424 * by the bus: 425 * 426 * - DEVICE_SHUTDOWN() 427 * - DEVICE_DETACH() 428 * - DEVICE_SUSPEND() 429 * 430 * @param dev The device whose child is being examined. 431 * @param child The child device. 432 * 433 * Refer to BHND_PROBE_* and BHND_PROBE_ORDER_* for the standard set of 434 * priorities. 435 */ 436METHOD int get_probe_order { 437 device_t dev; 438 device_t child; 439} DEFAULT bhnd_bus_null_get_probe_order; 440 441/** 442 * Return the BHND chip identification for the parent bus. 443 * 444 * @param dev The device whose child is being examined. 445 * @param child The child device. 446 */ 447METHOD const struct bhnd_chipid * get_chipid { 448 device_t dev; 449 device_t child; 450} DEFAULT bhnd_bus_null_get_chipid; 451 452/** 453 * Return the BHND attachment type of the parent bus. 454 * 455 * @param dev The device whose child is being examined. 456 * @param child The child device. 457 * 458 * @retval BHND_ATTACH_ADAPTER if the bus is resident on a bridged adapter, 459 * such as a WiFi chipset. 460 * @retval BHND_ATTACH_NATIVE if the bus provides hardware services (clock, 461 * CPU, etc) to a directly attached native host. 462 */ 463METHOD bhnd_attach_type get_attach_type { 464 device_t dev; 465 device_t child; 466} DEFAULT bhnd_bus_null_get_attach_type; 467 468/** 469 * Attempt to read the BHND board identification from the parent bus. 470 * 471 * This relies on NVRAM access, and will fail if a valid NVRAM device cannot 472 * be found, or is not yet attached. 473 * 474 * @param dev The parent of @p child. 475 * @param child The bhnd device requesting board info. 476 * @param[out] info On success, will be populated with the bhnd(4) device's 477 * board information. 478 * 479 * @retval 0 success 480 * @retval ENODEV No valid NVRAM source could be found. 481 * @retval non-zero If reading @p name otherwise fails, a regular unix 482 * error code will be returned. 483 */ 484METHOD int read_board_info { 485 device_t dev; 486 device_t child; 487 struct bhnd_board_info *info; 488} DEFAULT bhnd_bus_null_read_board_info; 489 490/** 491 * Return the number of interrupts to be assigned to @p child via 492 * BHND_BUS_ASSIGN_INTR(). 493 * 494 * @param dev The bhnd bus parent of @p child. 495 * @param child The bhnd device for which a count should be returned. 496 * 497 * @retval 0 If no interrupts should be assigned. 498 * @retval non-zero The count of interrupt resource IDs to be 499 * assigned, starting at rid 0. 500 */ 501METHOD int get_intr_count { 502 device_t dev; 503 device_t child; 504} DEFAULT bhnd_bus_null_get_intr_count; 505 506/** 507 * Assign an interrupt to @p child via bus_set_resource(). 508 * 509 * The default bus implementation of this method should assign backplane 510 * interrupt values to @p child. 511 * 512 * Bridge-attached bus implementations may instead override standard 513 * interconnect IRQ assignment, providing IRQs inherited from the parent bus. 514 * 515 * TODO: Once we can depend on INTRNG, investigate replacing this with a 516 * bridge-level interrupt controller. 517 * 518 * @param dev The bhnd bus parent of @p child. 519 * @param child The bhnd device to which an interrupt should be assigned. 520 * @param rid The interrupt resource ID to be assigned. 521 * 522 * @retval 0 If an interrupt was assigned. 523 * @retval non-zero If assigning an interrupt otherwise fails, a regular 524 * unix error code will be returned. 525 */ 526METHOD int assign_intr { 527 device_t dev; 528 device_t child; 529 int rid; 530} DEFAULT bhnd_bus_null_assign_intr; 531 532/** 533 * Return the backplane interrupt vector corresponding to @p child's given 534 * @p intr number. 535 * 536 * @param dev The bhnd bus parent of @p child. 537 * @param child The bhnd device for which the assigned interrupt vector should 538 * be queried. 539 * @param intr The interrupt number being queried. This is equivalent to the 540 * bus resource ID for the interrupt. 541 * @param[out] ivec On success, the assigned hardware interrupt vector be 542 * written to this pointer. 543 * 544 * On bcma(4) devices, this returns the OOB bus line assigned to the 545 * interrupt. 546 * 547 * On siba(4) devices, this returns the target OCP slave flag number assigned 548 * to the interrupt. 549 * 550 * @retval 0 success 551 * @retval ENXIO If @p intr exceeds the number of interrupts available 552 * to @p child. 553 */ 554METHOD int get_core_ivec { 555 device_t dev; 556 device_t child; 557 u_int intr; 558 uint32_t *ivec; 559} DEFAULT bhnd_bus_null_get_core_ivec; 560 561/** 562 * Notify a bhnd bus that a child was added. 563 * 564 * This method must be called by concrete bhnd(4) driver impementations 565 * after @p child's bus state is fully initialized. 566 * 567 * @param dev The bhnd bus whose child is being added. 568 * @param child The child added to @p dev. 569 */ 570METHOD void child_added { 571 device_t dev; 572 device_t child; 573} DEFAULT bhnd_bus_null_child_added; 574 575/** 576 * Read the current value of @p child's I/O control register. 577 * 578 * @param dev The bhnd bus parent of @p child. 579 * @param child The bhnd device for which the I/O control register should be 580 * read. 581 * @param[out] ioctl On success, the I/O control register value. 582 * 583 * @retval 0 success 584 * @retval EINVAL If @p child is not a direct child of @p dev. 585 * @retval ENODEV If agent/config space for @p child is unavailable. 586 * @retval non-zero If reading the IOCTL register otherwise fails, a regular 587 * unix error code will be returned. 588 */ 589METHOD int read_ioctl { 590 device_t dev; 591 device_t child; 592 uint16_t *ioctl; 593} DEFAULT bhnd_bus_null_read_ioctl; 594 595/** 596 * Write @p value with @p mask to @p child's I/O control register. 597 * 598 * @param dev The bhnd bus parent of @p child. 599 * @param child The bhnd device for which the I/O control register should 600 * be updated. 601 * @param value The value to be written (see also BHND_IOCTL_*). 602 * @param mask Only the bits defined by @p mask will be updated from @p value. 603 * 604 * @retval 0 success 605 * @retval EINVAL If @p child is not a direct child of @p dev. 606 * @retval ENODEV If agent/config space for @p child is unavailable. 607 * @retval non-zero If writing the IOCTL register otherwise fails, a regular 608 * unix error code will be returned. 609 */ 610METHOD int write_ioctl { 611 device_t dev; 612 device_t child; 613 uint16_t value; 614 uint16_t mask; 615} DEFAULT bhnd_bus_null_write_ioctl; 616 617/** 618 * Read the current value of @p child's I/O status register. 619 * 620 * @param dev The bhnd bus parent of @p child. 621 * @param child The bhnd device for which the I/O status register should be 622 * read. 623 * @param[out] iost On success, the I/O status register value. 624 * 625 * @retval 0 success 626 * @retval EINVAL If @p child is not a direct child of @p dev. 627 * @retval ENODEV If agent/config space for @p child is unavailable. 628 * @retval non-zero If reading the IOST register otherwise fails, a regular 629 * unix error code will be returned. 630 */ 631METHOD int read_iost { 632 device_t dev; 633 device_t child; 634 uint16_t *iost; 635} DEFAULT bhnd_bus_null_read_iost; 636 637 638/** 639 * Return true if the given bhnd device's hardware is currently held 640 * in a RESET state or otherwise not clocked (BHND_IOCTL_CLK_EN). 641 * 642 * @param dev The bhnd bus parent of @p child. 643 * @param child The device to query. 644 * 645 * @retval true If @p child is held in RESET or not clocked (BHND_IOCTL_CLK_EN), 646 * or an error occured determining @p child's hardware state. 647 * @retval false If @p child is clocked and is not held in RESET. 648 */ 649METHOD bool is_hw_suspended { 650 device_t dev; 651 device_t child; 652} DEFAULT bhnd_bus_null_is_hw_suspended; 653 654/** 655 * Place the bhnd(4) device's hardware into a reset state, and then bring the 656 * hardware out of reset with BHND_IOCTL_CLK_EN and @p ioctl flags set. 657 * 658 * Any clock or resource PMU requests previously made by @p child will be 659 * invalidated. 660 * 661 * @param dev The bhnd bus parent of @p child. 662 * @param child The device to be reset. 663 * @param ioctl Device-specific core ioctl flags to be supplied on reset 664 * (see BHND_IOCTL_*). 665 * 666 * @retval 0 success 667 * @retval non-zero error 668 */ 669METHOD int reset_hw { 670 device_t dev; 671 device_t child; 672 uint16_t ioctl; 673} DEFAULT bhnd_bus_null_reset_hw; 674 675/** 676 * Suspend @p child's hardware in a low-power reset state. 677 * 678 * Any clock or resource PMU requests previously made by @p dev will be 679 * invalidated. 680 * 681 * The hardware may be brought out of reset via bhnd_reset_hw(). 682 * 683 * @param dev The bhnd bus parent of @P child. 684 * @param dev The device to be suspended. 685 * 686 * @retval 0 success 687 * @retval non-zero error 688 */ 689METHOD int suspend_hw { 690 device_t dev; 691 device_t child; 692} DEFAULT bhnd_bus_null_suspend_hw; 693 694/** 695 * If supported by the chipset, return the clock source for the given clock. 696 * 697 * This function is only supported on early PWRCTL-equipped chipsets 698 * that expose clock management via their host bridge interface. Currently, 699 * this includes PCI (not PCIe) devices, with ChipCommon core revisions 0-9. 700 * 701 * @param dev The parent of @p child. 702 * @param child The bhnd device requesting a clock source. 703 * @param clock The clock for which a clock source will be returned. 704 * 705 * @retval bhnd_clksrc The clock source for @p clock. 706 * @retval BHND_CLKSRC_UNKNOWN If @p clock is unsupported, or its 707 * clock source is not known to the bus. 708 */ 709METHOD bhnd_clksrc pwrctl_get_clksrc { 710 device_t dev; 711 device_t child; 712 bhnd_clock clock; 713} DEFAULT bhnd_bus_null_pwrctl_get_clksrc; 714 715/** 716 * If supported by the chipset, gate the clock source for @p clock 717 * 718 * This function is only supported on early PWRCTL-equipped chipsets 719 * that expose clock management via their host bridge interface. Currently, 720 * this includes PCI (not PCIe) devices, with ChipCommon core revisions 0-9. 721 * 722 * @param dev The parent of @p child. 723 * @param child The bhnd device requesting clock gating. 724 * @param clock The clock to be disabled. 725 * 726 * @retval 0 success 727 * @retval ENODEV If bus-level clock source management is not supported. 728 * @retval ENXIO If bus-level management of @p clock is not supported. 729 */ 730METHOD int pwrctl_gate_clock { 731 device_t dev; 732 device_t child; 733 bhnd_clock clock; 734} DEFAULT bhnd_bus_null_pwrctl_gate_clock; 735 736/** 737 * If supported by the chipset, ungate the clock source for @p clock 738 * 739 * This function is only supported on early PWRCTL-equipped chipsets 740 * that expose clock management via their host bridge interface. Currently, 741 * this includes PCI (not PCIe) devices, with ChipCommon core revisions 0-9. 742 * 743 * @param dev The parent of @p child. 744 * @param child The bhnd device requesting clock gating. 745 * @param clock The clock to be enabled. 746 * 747 * @retval 0 success 748 * @retval ENODEV If bus-level clock source management is not supported. 749 * @retval ENXIO If bus-level management of @p clock is not supported. 750 */ 751METHOD int pwrctl_ungate_clock { 752 device_t dev; 753 device_t child; 754 bhnd_clock clock; 755} DEFAULT bhnd_bus_null_pwrctl_ungate_clock; 756 757/** 758 * Allocate and enable per-core PMU request handling for @p child. 759 * 760 * The region containing the core's PMU register block (if any) must be 761 * allocated via bus_alloc_resource(9) (or bhnd_alloc_resource) before 762 * calling BHND_BUS_ALLOC_PMU(), and must not be released until after 763 * calling BHND_BUS_RELEASE_PMU(). 764 * 765 * @param dev The parent of @p child. 766 * @param child The requesting bhnd device. 767 */ 768METHOD int alloc_pmu { 769 device_t dev; 770 device_t child; 771} DEFAULT bhnd_bus_null_alloc_pmu; 772 773/** 774 * Release per-core PMU resources allocated for @p child. Any 775 * outstanding PMU requests are discarded. 776 * 777 * @param dev The parent of @p child. 778 * @param child The requesting bhnd device. 779 */ 780METHOD int release_pmu { 781 device_t dev; 782 device_t child; 783} DEFAULT bhnd_bus_null_release_pmu; 784 785/** 786 * Request that @p clock (or faster) be routed to @p child. 787 * 788 * @note A driver must ask the bhnd bus to allocate PMU request state 789 * via BHND_BUS_ALLOC_PMU() before it can request clock resources. 790 * 791 * @note Any outstanding PMU clock requests will be discarded upon calling 792 * BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). 793 * 794 * @param dev The parent of @p child. 795 * @param child The bhnd device requesting @p clock. 796 * @param clock The requested clock source. 797 * 798 * @retval 0 success 799 * @retval ENODEV If an unsupported clock was requested. 800 * @retval ENXIO If the PMU has not been initialized or is otherwise unvailable. 801 */ 802METHOD int request_clock { 803 device_t dev; 804 device_t child; 805 bhnd_clock clock; 806} DEFAULT bhnd_bus_null_request_clock; 807 808/** 809 * Request that @p clocks be powered on behalf of @p child. 810 * 811 * This will power on clock sources (e.g. XTAL, PLL, etc) required for 812 * @p clocks and wait until they are ready, discarding any previous 813 * requests by @p child. 814 * 815 * @note A driver must ask the bhnd bus to allocate PMU request state 816 * via BHND_BUS_ALLOC_PMU() before it can request clock resources. 817 * 818 * @note Any outstanding PMU clock requests will be discarded upon calling 819 * BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). 820 * 821 * @param dev The parent of @p child. 822 * @param child The bhnd device requesting @p clock. 823 * @param clock The requested clock source. 824 * 825 * @retval 0 success 826 * @retval ENODEV If an unsupported clock was requested. 827 * @retval ENXIO If the PMU has not been initialized or is otherwise unvailable. 828 */ 829METHOD int enable_clocks { 830 device_t dev; 831 device_t child; 832 uint32_t clocks; 833} DEFAULT bhnd_bus_null_enable_clocks; 834 835/** 836 * Power up an external PMU-managed resource assigned to @p child. 837 * 838 * @note A driver must ask the bhnd bus to allocate PMU request state 839 * via BHND_BUS_ALLOC_PMU() before it can request PMU resources. 840 * 841 * @note Any outstanding PMU resource requests will be released upon calling 842 * BHND_BUS_RESET_HW() or BHND_BUS_SUSPEND_HW(). 843 * 844 * @param dev The parent of @p child. 845 * @param child The bhnd device requesting @p rsrc. 846 * @param rsrc The core-specific external resource identifier. 847 * 848 * @retval 0 success 849 * @retval ENODEV If the PMU does not support @p rsrc. 850 * @retval ENXIO If the PMU has not been initialized or is otherwise unvailable. 851 */ 852METHOD int request_ext_rsrc { 853 device_t dev; 854 device_t child; 855 u_int rsrc; 856} DEFAULT bhnd_bus_null_request_ext_rsrc; 857 858/** 859 * Power down an external PMU-managed resource assigned to @p child. 860 * 861 * @note A driver must ask the bhnd bus to allocate PMU request state 862 * via BHND_BUS_ALLOC_PMU() before it can request PMU resources. 863 * 864 * @param dev The parent of @p child. 865 * @param child The bhnd device requesting @p rsrc. 866 * @param rsrc The core-specific external resource number. 867 * 868 * @retval 0 success 869 * @retval ENODEV If the PMU does not support @p rsrc. 870 * @retval ENXIO If the PMU has not been initialized or is otherwise unvailable. 871 */ 872METHOD int release_ext_rsrc { 873 device_t dev; 874 device_t child; 875 u_int rsrc; 876} DEFAULT bhnd_bus_null_release_ext_rsrc; 877 878/** 879 * Read @p width bytes at @p offset from the bus-specific agent/config 880 * space of @p child. 881 * 882 * @param dev The parent of @p child. 883 * @param child The bhnd device for which @p offset should be read. 884 * @param offset The offset to be read. 885 * @param[out] value On success, the bytes read at @p offset. 886 * @param width The size of the access. Must be 1, 2 or 4 bytes. 887 * 888 * The exact behavior of this method is bus-specific. On a bcma(4) bus, this 889 * method provides access to the first agent port of @p child; on a siba(4) bus, 890 * this method provides access to the core's CFG0 register block. 891 * 892 * @note Device drivers should only use this API for functionality 893 * that is not available via another bhnd(4) function. 894 * 895 * @retval 0 success 896 * @retval EINVAL If @p child is not a direct child of @p dev. 897 * @retval EINVAL If @p width is not one of 1, 2, or 4 bytes. 898 * @retval ENODEV If accessing agent/config space for @p child is unsupported. 899 * @retval EFAULT If reading @p width at @p offset exceeds the bounds of 900 * the mapped agent/config space for @p child. 901 */ 902METHOD int read_config { 903 device_t dev; 904 device_t child; 905 bus_size_t offset; 906 void *value; 907 u_int width; 908} DEFAULT bhnd_bus_null_read_config; 909 910/** 911 * Read @p width bytes at @p offset from the bus-specific agent/config 912 * space of @p child. 913 * 914 * @param dev The parent of @p child. 915 * @param child The bhnd device for which @p offset should be read. 916 * @param offset The offset to be written. 917 * @param value A pointer to the value to be written. 918 * @param width The size of @p value. Must be 1, 2 or 4 bytes. 919 * 920 * The exact behavior of this method is bus-specific. In the case of 921 * bcma(4), this method provides access to the first agent port of @p child. 922 * 923 * @note Device drivers should only use this API for functionality 924 * that is not available via another bhnd(4) function. 925 * 926 * @retval 0 success 927 * @retval EINVAL If @p child is not a direct child of @p dev. 928 * @retval EINVAL If @p width is not one of 1, 2, or 4 bytes. 929 * @retval ENODEV If accessing agent/config space for @p child is unsupported. 930 * @retval EFAULT If reading @p width at @p offset exceeds the bounds of 931 * the mapped agent/config space for @p child. 932 */ 933METHOD int write_config { 934 device_t dev; 935 device_t child; 936 bus_size_t offset; 937 const void *value; 938 u_int width; 939} DEFAULT bhnd_bus_null_write_config; 940 941/** 942 * Allocate a bhnd resource. 943 * 944 * This method's semantics are functionally identical to the bus API of the same 945 * name; refer to BUS_ALLOC_RESOURCE for complete documentation. 946 */ 947METHOD struct bhnd_resource * alloc_resource { 948 device_t dev; 949 device_t child; 950 int type; 951 int *rid; 952 rman_res_t start; 953 rman_res_t end; 954 rman_res_t count; 955 u_int flags; 956} DEFAULT bhnd_bus_generic_alloc_resource; 957 958/** 959 * Release a bhnd resource. 960 * 961 * This method's semantics are functionally identical to the bus API of the same 962 * name; refer to BUS_RELEASE_RESOURCE for complete documentation. 963 */ 964METHOD int release_resource { 965 device_t dev; 966 device_t child; 967 int type; 968 int rid; 969 struct bhnd_resource *res; 970} DEFAULT bhnd_bus_generic_release_resource; 971 972/** 973 * Activate a bhnd resource. 974 * 975 * This method's semantics are functionally identical to the bus API of the same 976 * name; refer to BUS_ACTIVATE_RESOURCE for complete documentation. 977 */ 978METHOD int activate_resource { 979 device_t dev; 980 device_t child; 981 int type; 982 int rid; 983 struct bhnd_resource *r; 984} DEFAULT bhnd_bus_generic_activate_resource; 985 986/** 987 * Deactivate a bhnd resource. 988 * 989 * This method's semantics are functionally identical to the bus API of the same 990 * name; refer to BUS_DEACTIVATE_RESOURCE for complete documentation. 991 */ 992METHOD int deactivate_resource { 993 device_t dev; 994 device_t child; 995 int type; 996 int rid; 997 struct bhnd_resource *r; 998} DEFAULT bhnd_bus_generic_deactivate_resource; 999 1000/** 1001 * Return true if @p region_num is a valid region on @p port_num of 1002 * @p type attached to @p child. 1003 * 1004 * @param dev The device whose child is being examined. 1005 * @param child The child device. 1006 * @param type The port type being queried. 1007 * @param port_num The port number being queried. 1008 * @param region_num The region number being queried. 1009 */ 1010METHOD bool is_region_valid { 1011 device_t dev; 1012 device_t child; 1013 bhnd_port_type type; 1014 u_int port_num; 1015 u_int region_num; 1016}; 1017 1018/** 1019 * Return the number of ports of type @p type attached to @p child. 1020 * 1021 * @param dev The device whose child is being examined. 1022 * @param child The child device. 1023 * @param type The port type being queried. 1024 */ 1025METHOD u_int get_port_count { 1026 device_t dev; 1027 device_t child; 1028 bhnd_port_type type; 1029}; 1030 1031/** 1032 * Return the number of memory regions mapped to @p child @p port of 1033 * type @p type. 1034 * 1035 * @param dev The device whose child is being examined. 1036 * @param child The child device. 1037 * @param port The port number being queried. 1038 * @param type The port type being queried. 1039 */ 1040METHOD u_int get_region_count { 1041 device_t dev; 1042 device_t child; 1043 bhnd_port_type type; 1044 u_int port; 1045}; 1046 1047/** 1048 * Return the SYS_RES_MEMORY resource-ID for a port/region pair attached to 1049 * @p child. 1050 * 1051 * @param dev The bus device. 1052 * @param child The bhnd child. 1053 * @param port_type The port type. 1054 * @param port_num The index of the child interconnect port. 1055 * @param region_num The index of the port-mapped address region. 1056 * 1057 * @retval -1 No such port/region found. 1058 */ 1059METHOD int get_port_rid { 1060 device_t dev; 1061 device_t child; 1062 bhnd_port_type port_type; 1063 u_int port_num; 1064 u_int region_num; 1065} DEFAULT bhnd_bus_null_get_port_rid; 1066 1067 1068/** 1069 * Decode a port / region pair on @p child defined by @p type and @p rid. 1070 * 1071 * @param dev The bus device. 1072 * @param child The bhnd child. 1073 * @param type The resource type. 1074 * @param rid The resource ID. 1075 * @param[out] port_type The port's type. 1076 * @param[out] port The port identifier. 1077 * @param[out] region The identifier of the memory region on @p port. 1078 * 1079 * @retval 0 success 1080 * @retval non-zero No matching type/rid found. 1081 */ 1082METHOD int decode_port_rid { 1083 device_t dev; 1084 device_t child; 1085 int type; 1086 int rid; 1087 bhnd_port_type *port_type; 1088 u_int *port; 1089 u_int *region; 1090} DEFAULT bhnd_bus_null_decode_port_rid; 1091 1092/** 1093 * Get the address and size of @p region on @p port. 1094 * 1095 * @param dev The bus device. 1096 * @param child The bhnd child. 1097 * @param port_type The port type. 1098 * @param port The port identifier. 1099 * @param region The identifier of the memory region on @p port. 1100 * @param[out] region_addr The region's base address. 1101 * @param[out] region_size The region's size. 1102 * 1103 * @retval 0 success 1104 * @retval non-zero No matching port/region found. 1105 */ 1106METHOD int get_region_addr { 1107 device_t dev; 1108 device_t child; 1109 bhnd_port_type port_type; 1110 u_int port; 1111 u_int region; 1112 bhnd_addr_t *region_addr; 1113 bhnd_size_t *region_size; 1114} DEFAULT bhnd_bus_null_get_region_addr; 1115 1116/** 1117 * Read an NVRAM variable. 1118 * 1119 * It is the responsibility of the bus to delegate this request to 1120 * the appropriate NVRAM child device, or to a parent bus implementation. 1121 * 1122 * @param dev The bus device. 1123 * @param child The requesting device. 1124 * @param name The NVRAM variable name. 1125 * @param[out] buf On success, the requested value will be written 1126 * to this buffer. This argment may be NULL if 1127 * the value is not desired. 1128 * @param[in,out] size The capacity of @p buf. On success, will be set 1129 * to the actual size of the requested value. 1130 * @param type The data type to be written to @p buf. 1131 * 1132 * @retval 0 success 1133 * @retval ENOENT The requested variable was not found. 1134 * @retval ENOMEM If @p buf is non-NULL and a buffer of @p size is too 1135 * small to hold the requested value. 1136 * @retval ENODEV No valid NVRAM source could be found. 1137 * @retval EFTYPE If the @p name's data type cannot be coerced to @p type. 1138 * @retval ERANGE If value coercion would overflow @p type. 1139 * @retval non-zero If reading @p name otherwise fails, a regular unix 1140 * error code will be returned. 1141 */ 1142METHOD int get_nvram_var { 1143 device_t dev; 1144 device_t child; 1145 const char *name; 1146 void *buf; 1147 size_t *size; 1148 bhnd_nvram_type type; 1149} DEFAULT bhnd_bus_null_get_nvram_var; 1150 1151 1152/** An implementation of bus_read_1() compatible with bhnd_resource */ 1153METHOD uint8_t read_1 { 1154 device_t dev; 1155 device_t child; 1156 struct bhnd_resource *r; 1157 bus_size_t offset; 1158} 1159 1160/** An implementation of bus_read_2() compatible with bhnd_resource */ 1161METHOD uint16_t read_2 { 1162 device_t dev; 1163 device_t child; 1164 struct bhnd_resource *r; 1165 bus_size_t offset; 1166} 1167 1168/** An implementation of bus_read_4() compatible with bhnd_resource */ 1169METHOD uint32_t read_4 { 1170 device_t dev; 1171 device_t child; 1172 struct bhnd_resource *r; 1173 bus_size_t offset; 1174} 1175 1176/** An implementation of bus_write_1() compatible with bhnd_resource */ 1177METHOD void write_1 { 1178 device_t dev; 1179 device_t child; 1180 struct bhnd_resource *r; 1181 bus_size_t offset; 1182 uint8_t value; 1183} 1184 1185/** An implementation of bus_write_2() compatible with bhnd_resource */ 1186METHOD void write_2 { 1187 device_t dev; 1188 device_t child; 1189 struct bhnd_resource *r; 1190 bus_size_t offset; 1191 uint16_t value; 1192} 1193 1194/** An implementation of bus_write_4() compatible with bhnd_resource */ 1195METHOD void write_4 { 1196 device_t dev; 1197 device_t child; 1198 struct bhnd_resource *r; 1199 bus_size_t offset; 1200 uint32_t value; 1201} 1202 1203/** An implementation of bus_read_stream_1() compatible with bhnd_resource */ 1204METHOD uint8_t read_stream_1 { 1205 device_t dev; 1206 device_t child; 1207 struct bhnd_resource *r; 1208 bus_size_t offset; 1209} 1210 1211/** An implementation of bus_read_stream_2() compatible with bhnd_resource */ 1212METHOD uint16_t read_stream_2 { 1213 device_t dev; 1214 device_t child; 1215 struct bhnd_resource *r; 1216 bus_size_t offset; 1217} 1218 1219/** An implementation of bus_read_stream_4() compatible with bhnd_resource */ 1220METHOD uint32_t read_stream_4 { 1221 device_t dev; 1222 device_t child; 1223 struct bhnd_resource *r; 1224 bus_size_t offset; 1225} 1226 1227/** An implementation of bus_write_stream_1() compatible with bhnd_resource */ 1228METHOD void write_stream_1 { 1229 device_t dev; 1230 device_t child; 1231 struct bhnd_resource *r; 1232 bus_size_t offset; 1233 uint8_t value; 1234} 1235 1236/** An implementation of bus_write_stream_2() compatible with bhnd_resource */ 1237METHOD void write_stream_2 { 1238 device_t dev; 1239 device_t child; 1240 struct bhnd_resource *r; 1241 bus_size_t offset; 1242 uint16_t value; 1243} 1244 1245/** An implementation of bus_write_stream_4() compatible with bhnd_resource */ 1246METHOD void write_stream_4 { 1247 device_t dev; 1248 device_t child; 1249 struct bhnd_resource *r; 1250 bus_size_t offset; 1251 uint32_t value; 1252} 1253 1254/** An implementation of bus_read_multi_1() compatible with bhnd_resource */ 1255METHOD void read_multi_1 { 1256 device_t dev; 1257 device_t child; 1258 struct bhnd_resource *r; 1259 bus_size_t offset; 1260 uint8_t *datap; 1261 bus_size_t count; 1262} 1263 1264/** An implementation of bus_read_multi_2() compatible with bhnd_resource */ 1265METHOD void read_multi_2 { 1266 device_t dev; 1267 device_t child; 1268 struct bhnd_resource *r; 1269 bus_size_t offset; 1270 uint16_t *datap; 1271 bus_size_t count; 1272} 1273 1274/** An implementation of bus_read_multi_4() compatible with bhnd_resource */ 1275METHOD void read_multi_4 { 1276 device_t dev; 1277 device_t child; 1278 struct bhnd_resource *r; 1279 bus_size_t offset; 1280 uint32_t *datap; 1281 bus_size_t count; 1282} 1283 1284/** An implementation of bus_write_multi_1() compatible with bhnd_resource */ 1285METHOD void write_multi_1 { 1286 device_t dev; 1287 device_t child; 1288 struct bhnd_resource *r; 1289 bus_size_t offset; 1290 uint8_t *datap; 1291 bus_size_t count; 1292} 1293 1294/** An implementation of bus_write_multi_2() compatible with bhnd_resource */ 1295METHOD void write_multi_2 { 1296 device_t dev; 1297 device_t child; 1298 struct bhnd_resource *r; 1299 bus_size_t offset; 1300 uint16_t *datap; 1301 bus_size_t count; 1302} 1303 1304/** An implementation of bus_write_multi_4() compatible with bhnd_resource */ 1305METHOD void write_multi_4 { 1306 device_t dev; 1307 device_t child; 1308 struct bhnd_resource *r; 1309 bus_size_t offset; 1310 uint32_t *datap; 1311 bus_size_t count; 1312} 1313 1314/** An implementation of bus_read_multi_stream_1() compatible 1315 * bhnd_resource */ 1316METHOD void read_multi_stream_1 { 1317 device_t dev; 1318 device_t child; 1319 struct bhnd_resource *r; 1320 bus_size_t offset; 1321 uint8_t *datap; 1322 bus_size_t count; 1323} 1324 1325/** An implementation of bus_read_multi_stream_2() compatible 1326 * bhnd_resource */ 1327METHOD void read_multi_stream_2 { 1328 device_t dev; 1329 device_t child; 1330 struct bhnd_resource *r; 1331 bus_size_t offset; 1332 uint16_t *datap; 1333 bus_size_t count; 1334} 1335 1336/** An implementation of bus_read_multi_stream_4() compatible 1337 * bhnd_resource */ 1338METHOD void read_multi_stream_4 { 1339 device_t dev; 1340 device_t child; 1341 struct bhnd_resource *r; 1342 bus_size_t offset; 1343 uint32_t *datap; 1344 bus_size_t count; 1345} 1346 1347/** An implementation of bus_write_multi_stream_1() compatible 1348 * bhnd_resource */ 1349METHOD void write_multi_stream_1 { 1350 device_t dev; 1351 device_t child; 1352 struct bhnd_resource *r; 1353 bus_size_t offset; 1354 uint8_t *datap; 1355 bus_size_t count; 1356} 1357 1358/** An implementation of bus_write_multi_stream_2() compatible with 1359 * bhnd_resource */ 1360METHOD void write_multi_stream_2 { 1361 device_t dev; 1362 device_t child; 1363 struct bhnd_resource *r; 1364 bus_size_t offset; 1365 uint16_t *datap; 1366 bus_size_t count; 1367} 1368 1369/** An implementation of bus_write_multi_stream_4() compatible with 1370 * bhnd_resource */ 1371METHOD void write_multi_stream_4 { 1372 device_t dev; 1373 device_t child; 1374 struct bhnd_resource *r; 1375 bus_size_t offset; 1376 uint32_t *datap; 1377 bus_size_t count; 1378} 1379 1380/** An implementation of bus_set_multi_1() compatible with bhnd_resource */ 1381METHOD void set_multi_1 { 1382 device_t dev; 1383 device_t child; 1384 struct bhnd_resource *r; 1385 bus_size_t offset; 1386 uint8_t value; 1387 bus_size_t count; 1388} 1389 1390/** An implementation of bus_set_multi_2() compatible with bhnd_resource */ 1391METHOD void set_multi_2 { 1392 device_t dev; 1393 device_t child; 1394 struct bhnd_resource *r; 1395 bus_size_t offset; 1396 uint16_t value; 1397 bus_size_t count; 1398} 1399 1400/** An implementation of bus_set_multi_4() compatible with bhnd_resource */ 1401METHOD void set_multi_4 { 1402 device_t dev; 1403 device_t child; 1404 struct bhnd_resource *r; 1405 bus_size_t offset; 1406 uint32_t value; 1407 bus_size_t count; 1408} 1409 1410/** An implementation of bus_set_region_1() compatible with bhnd_resource */ 1411METHOD void set_region_1 { 1412 device_t dev; 1413 device_t child; 1414 struct bhnd_resource *r; 1415 bus_size_t offset; 1416 uint8_t value; 1417 bus_size_t count; 1418} 1419 1420/** An implementation of bus_set_region_2() compatible with bhnd_resource */ 1421METHOD void set_region_2 { 1422 device_t dev; 1423 device_t child; 1424 struct bhnd_resource *r; 1425 bus_size_t offset; 1426 uint16_t value; 1427 bus_size_t count; 1428} 1429 1430/** An implementation of bus_set_region_4() compatible with bhnd_resource */ 1431METHOD void set_region_4 { 1432 device_t dev; 1433 device_t child; 1434 struct bhnd_resource *r; 1435 bus_size_t offset; 1436 uint32_t value; 1437 bus_size_t count; 1438} 1439 1440/** An implementation of bus_read_region_1() compatible with bhnd_resource */ 1441METHOD void read_region_1 { 1442 device_t dev; 1443 device_t child; 1444 struct bhnd_resource *r; 1445 bus_size_t offset; 1446 uint8_t *datap; 1447 bus_size_t count; 1448} 1449 1450/** An implementation of bus_read_region_2() compatible with bhnd_resource */ 1451METHOD void read_region_2 { 1452 device_t dev; 1453 device_t child; 1454 struct bhnd_resource *r; 1455 bus_size_t offset; 1456 uint16_t *datap; 1457 bus_size_t count; 1458} 1459 1460/** An implementation of bus_read_region_4() compatible with bhnd_resource */ 1461METHOD void read_region_4 { 1462 device_t dev; 1463 device_t child; 1464 struct bhnd_resource *r; 1465 bus_size_t offset; 1466 uint32_t *datap; 1467 bus_size_t count; 1468} 1469 1470/** An implementation of bus_read_region_stream_1() compatible with 1471 * bhnd_resource */ 1472METHOD void read_region_stream_1 { 1473 device_t dev; 1474 device_t child; 1475 struct bhnd_resource *r; 1476 bus_size_t offset; 1477 uint8_t *datap; 1478 bus_size_t count; 1479} 1480 1481/** An implementation of bus_read_region_stream_2() compatible with 1482 * bhnd_resource */ 1483METHOD void read_region_stream_2 { 1484 device_t dev; 1485 device_t child; 1486 struct bhnd_resource *r; 1487 bus_size_t offset; 1488 uint16_t *datap; 1489 bus_size_t count; 1490} 1491 1492/** An implementation of bus_read_region_stream_4() compatible with 1493 * bhnd_resource */ 1494METHOD void read_region_stream_4 { 1495 device_t dev; 1496 device_t child; 1497 struct bhnd_resource *r; 1498 bus_size_t offset; 1499 uint32_t *datap; 1500 bus_size_t count; 1501} 1502 1503/** An implementation of bus_write_region_1() compatible with bhnd_resource */ 1504METHOD void write_region_1 { 1505 device_t dev; 1506 device_t child; 1507 struct bhnd_resource *r; 1508 bus_size_t offset; 1509 uint8_t *datap; 1510 bus_size_t count; 1511} 1512 1513/** An implementation of bus_write_region_2() compatible with bhnd_resource */ 1514METHOD void write_region_2 { 1515 device_t dev; 1516 device_t child; 1517 struct bhnd_resource *r; 1518 bus_size_t offset; 1519 uint16_t *datap; 1520 bus_size_t count; 1521} 1522 1523/** An implementation of bus_write_region_4() compatible with bhnd_resource */ 1524METHOD void write_region_4 { 1525 device_t dev; 1526 device_t child; 1527 struct bhnd_resource *r; 1528 bus_size_t offset; 1529 uint32_t *datap; 1530 bus_size_t count; 1531} 1532 1533/** An implementation of bus_write_region_stream_1() compatible with 1534 * bhnd_resource */ 1535METHOD void write_region_stream_1 { 1536 device_t dev; 1537 device_t child; 1538 struct bhnd_resource *r; 1539 bus_size_t offset; 1540 uint8_t *datap; 1541 bus_size_t count; 1542} 1543 1544/** An implementation of bus_write_region_stream_2() compatible with 1545 * bhnd_resource */ 1546METHOD void write_region_stream_2 { 1547 device_t dev; 1548 device_t child; 1549 struct bhnd_resource *r; 1550 bus_size_t offset; 1551 uint16_t *datap; 1552 bus_size_t count; 1553} 1554 1555/** An implementation of bus_write_region_stream_4() compatible with 1556 * bhnd_resource */ 1557METHOD void write_region_stream_4 { 1558 device_t dev; 1559 device_t child; 1560 struct bhnd_resource *r; 1561 bus_size_t offset; 1562 uint32_t *datap; 1563 bus_size_t count; 1564} 1565 1566/** An implementation of bus_barrier() compatible with bhnd_resource */ 1567METHOD void barrier { 1568 device_t dev; 1569 device_t child; 1570 struct bhnd_resource *r; 1571 bus_size_t offset; 1572 bus_size_t length; 1573 int flags; 1574} 1575