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