bus_if.m revision 185059
1139804Simp#- 2133588Simp# Copyright (c) 1998-2004 Doug Rabson 336973Sdfr# All rights reserved. 436973Sdfr# 536973Sdfr# Redistribution and use in source and binary forms, with or without 636973Sdfr# modification, are permitted provided that the following conditions 736973Sdfr# are met: 836973Sdfr# 1. Redistributions of source code must retain the above copyright 936973Sdfr# notice, this list of conditions and the following disclaimer. 1036973Sdfr# 2. Redistributions in binary form must reproduce the above copyright 1136973Sdfr# notice, this list of conditions and the following disclaimer in the 1236973Sdfr# documentation and/or other materials provided with the distribution. 1336973Sdfr# 1436973Sdfr# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1536973Sdfr# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1636973Sdfr# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1736973Sdfr# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1836973Sdfr# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1936973Sdfr# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2036973Sdfr# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2136973Sdfr# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2236973Sdfr# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2336973Sdfr# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2436973Sdfr# SUCH DAMAGE. 2536973Sdfr# 2650477Speter# $FreeBSD: head/sys/kern/bus_if.m 185059 2008-11-18 21:01:54Z jhb $ 2736973Sdfr# 2836973Sdfr 2959093Sdfr#include <sys/bus.h> 3059093Sdfr 31132354Sdfr/** 32132354Sdfr * @defgroup BUS bus - KObj methods for drivers of devices with children 33132354Sdfr * @brief A set of methods required device drivers that support 34132354Sdfr * child devices. 35132354Sdfr * @{ 36132354Sdfr */ 3741017SnsouchINTERFACE bus; 3836973Sdfr 3936973Sdfr# 4046913Sdfr# Default implementations of some methods. 4146913Sdfr# 4246913SdfrCODE { 4346913Sdfr static struct resource * 4446913Sdfr null_alloc_resource(device_t dev, device_t child, 45100421Simp int type, int *rid, u_long start, u_long end, 46100421Simp u_long count, u_int flags) 4746913Sdfr { 48100421Simp return (0); 4946913Sdfr } 5046913Sdfr}; 5146913Sdfr 52132354Sdfr/** 53132354Sdfr * @brief Print a description of a child device 54132354Sdfr * 55132354Sdfr * This is called from system code which prints out a description of a 56132354Sdfr * device. It should describe the attachment that the child has with 57132354Sdfr * the parent. For instance the TurboLaser bus prints which node the 58132354Sdfr * device is attached to. See bus_generic_print_child() for more 59132354Sdfr * information. 60132354Sdfr * 61132354Sdfr * @param _dev the device whose child is being printed 62132354Sdfr * @param _child the child device to describe 63132354Sdfr * 64132354Sdfr * @returns the number of characters output. 65132354Sdfr */ 6649195SmdoddMETHOD int print_child { 67132354Sdfr device_t _dev; 68132354Sdfr device_t _child; 69112588Smdodd} DEFAULT bus_generic_print_child; 7036973Sdfr 71132354Sdfr/** 72132354Sdfr * @brief Print a notification about an unprobed child device. 73132354Sdfr * 74132354Sdfr * Called for each child device that did not succeed in probing for a 75132354Sdfr * driver. 76132354Sdfr * 77132354Sdfr * @param _dev the device whose child was being probed 78132354Sdfr * @param _child the child device which failed to probe 79132354Sdfr */ 8048754SdfrMETHOD void probe_nomatch { 81132354Sdfr device_t _dev; 82132354Sdfr device_t _child; 8348754Sdfr}; 8448754Sdfr 85132354Sdfr/** 86132354Sdfr * @brief Read the value of a bus-specific attribute of a device 87132354Sdfr * 88132354Sdfr * This method, along with BUS_WRITE_IVAR() manages a bus-specific set 89132354Sdfr * of instance variables of a child device. The intention is that 90132354Sdfr * each different type of bus defines a set of appropriate instance 91132354Sdfr * variables (such as ports and irqs for ISA bus etc.) 92132354Sdfr * 93132354Sdfr * This information could be given to the child device as a struct but 94132354Sdfr * that makes it hard for a bus to add or remove variables without 95132354Sdfr * forcing an edit and recompile for all drivers which may not be 96132354Sdfr * possible for vendor supplied binary drivers. 97132354Sdfr * 98132354Sdfr * This method copies the value of an instance variable to the 99132354Sdfr * location specified by @p *_result. 100132354Sdfr * 101132354Sdfr * @param _dev the device whose child was being examined 102132354Sdfr * @param _child the child device whose instance variable is 103132354Sdfr * being read 104132354Sdfr * @param _index the instance variable to read 105132354Sdfr * @param _result a loction to recieve the instance variable 106132354Sdfr * value 107132354Sdfr * 108132354Sdfr * @retval 0 success 109132354Sdfr * @retval ENOENT no such instance variable is supported by @p 110132354Sdfr * _dev 111132354Sdfr */ 11236973SdfrMETHOD int read_ivar { 11395201Smarkm device_t _dev; 11495201Smarkm device_t _child; 115132354Sdfr int _index; 11695201Smarkm uintptr_t *_result; 11736973Sdfr}; 11836973Sdfr 119132354Sdfr/** 120132354Sdfr * @brief Write the value of a bus-specific attribute of a device 121132354Sdfr * 122132354Sdfr * This method sets the value of an instance variable to @p _value. 123132354Sdfr * 124132354Sdfr * @param _dev the device whose child was being updated 125132354Sdfr * @param _child the child device whose instance variable is 126132354Sdfr * being written 127132354Sdfr * @param _index the instance variable to write 128132354Sdfr * @param _value the value to write to that instance variable 129132354Sdfr * 130132354Sdfr * @retval 0 success 131132354Sdfr * @retval ENOENT no such instance variable is supported by @p 132132354Sdfr * _dev 133132354Sdfr * @retval EINVAL the instance variable was recognised but 134132354Sdfr * contains a read-only value 135132354Sdfr */ 13636973SdfrMETHOD int write_ivar { 13795201Smarkm device_t _dev; 13895201Smarkm device_t _child; 13995201Smarkm int _indx; 14095201Smarkm uintptr_t _value; 14136973Sdfr}; 14236973Sdfr 143132354Sdfr/** 144132354Sdfr * @brief Notify a bus that a child was detached 145132354Sdfr * 146132354Sdfr * Called after the child's DEVICE_DETACH() method to allow the parent 147132354Sdfr * to reclaim any resources allocated on behalf of the child. 148132354Sdfr * 149132354Sdfr * @param _dev the device whose child changed state 150132354Sdfr * @param _child the child device which changed state 151132354Sdfr */ 15245107SdfrMETHOD void child_detached { 15395201Smarkm device_t _dev; 15495201Smarkm device_t _child; 15545107Sdfr}; 15645107Sdfr 157132354Sdfr/** 158132354Sdfr * @brief Notify a bus that a new driver was added 159132354Sdfr * 160132354Sdfr * Called when a new driver is added to the devclass which owns this 161132354Sdfr * bus. The generic implementation of this method attempts to probe and 162132354Sdfr * attach any un-matched children of the bus. 163132354Sdfr * 164132354Sdfr * @param _dev the device whose devclass had a new driver 165132354Sdfr * added to it 166132354Sdfr * @param _driver the new driver which was added 167132354Sdfr */ 16845720SpeterMETHOD void driver_added { 16995201Smarkm device_t _dev; 17095201Smarkm driver_t *_driver; 17152045Simp} DEFAULT bus_generic_driver_added; 17245720Speter 173132354Sdfr/** 174132354Sdfr * @brief Create a new child device 175132354Sdfr * 176132354Sdfr * For busses which use use drivers supporting DEVICE_IDENTIFY() to 177132354Sdfr * enumerate their devices, this method is used to create new 178132354Sdfr * device instances. The new device will be added after the last 179132354Sdfr * existing child with the same order. 180132354Sdfr * 181132354Sdfr * @param _dev the bus device which will be the parent of the 182132354Sdfr * new child device 183132354Sdfr * @param _order a value which is used to partially sort the 184132354Sdfr * children of @p _dev - devices created using 185132354Sdfr * lower values of @p _order appear first in @p 186132354Sdfr * _dev's list of children 187132354Sdfr * @param _name devclass name for new device or @c NULL if not 188132354Sdfr * specified 189132354Sdfr * @param _unit unit number for new device or @c -1 if not 190132354Sdfr * specified 191132354Sdfr */ 19247178SdfrMETHOD device_t add_child { 19395201Smarkm device_t _dev; 19495201Smarkm int _order; 19595201Smarkm const char *_name; 19695201Smarkm int _unit; 197162237Sjhb}; 19847178Sdfr 199132354Sdfr/** 200132354Sdfr * @brief Allocate a system resource 201132354Sdfr * 202132354Sdfr * This method is called by child devices of a bus to allocate resources. 203132354Sdfr * The types are defined in <machine/resource.h>; the meaning of the 204132354Sdfr * resource-ID field varies from bus to bus (but @p *rid == 0 is always 205132354Sdfr * valid if the resource type is). If a resource was allocated and the 206132354Sdfr * caller did not use the RF_ACTIVE to specify that it should be 207132354Sdfr * activated immediately, the caller is responsible for calling 208132354Sdfr * BUS_ACTIVATE_RESOURCE() when it actually uses the resource. 209132354Sdfr * 210132354Sdfr * @param _dev the parent device of @p _child 211132354Sdfr * @param _child the device which is requesting an allocation 212132354Sdfr * @param _type the type of resource to allocate 213132354Sdfr * @param _rid a pointer to the resource identifier 214132354Sdfr * @param _start hint at the start of the resource range - pass 215132354Sdfr * @c 0UL for any start address 216132354Sdfr * @param _end hint at the end of the resource range - pass 217132354Sdfr * @c ~0UL for any end address 218132354Sdfr * @param _count hint at the size of range required - pass @c 1 219132354Sdfr * for any size 220132354Sdfr * @param _flags any extra flags to control the resource 221132354Sdfr * allocation - see @c RF_XXX flags in 222132354Sdfr * <sys/rman.h> for details 223132354Sdfr * 224132354Sdfr * @returns the resource which was allocated or @c NULL if no 225132354Sdfr * resource could be allocated 226132354Sdfr */ 22741153SwollmanMETHOD struct resource * alloc_resource { 22895201Smarkm device_t _dev; 22995201Smarkm device_t _child; 23095201Smarkm int _type; 23195201Smarkm int *_rid; 23295201Smarkm u_long _start; 23395201Smarkm u_long _end; 23495201Smarkm u_long _count; 23595201Smarkm u_int _flags; 23646913Sdfr} DEFAULT null_alloc_resource; 23737592Sdfr 238132354Sdfr/** 239132354Sdfr * @brief Activate a resource 240132354Sdfr * 241132354Sdfr * Activate a resource previously allocated with 242132354Sdfr * BUS_ALLOC_RESOURCE(). This may for instance map a memory region 243132354Sdfr * into the kernel's virtual address space. 244132354Sdfr * 245132354Sdfr * @param _dev the parent device of @p _child 246132354Sdfr * @param _child the device which allocated the resource 247132354Sdfr * @param _type the type of resource 248132354Sdfr * @param _rid the resource identifier 249132354Sdfr * @param _r the resource to activate 250132354Sdfr */ 25141153SwollmanMETHOD int activate_resource { 25295201Smarkm device_t _dev; 25395201Smarkm device_t _child; 25495201Smarkm int _type; 25595201Smarkm int _rid; 25695201Smarkm struct resource *_r; 25741153Swollman}; 25841153Swollman 259132354Sdfr/** 260132354Sdfr * @brief Deactivate a resource 261132354Sdfr * 262132354Sdfr * Deactivate a resource previously allocated with 263132354Sdfr * BUS_ALLOC_RESOURCE(). This may for instance unmap a memory region 264132354Sdfr * from the kernel's virtual address space. 265132354Sdfr * 266132354Sdfr * @param _dev the parent device of @p _child 267132354Sdfr * @param _child the device which allocated the resource 268132354Sdfr * @param _type the type of resource 269132354Sdfr * @param _rid the resource identifier 270132354Sdfr * @param _r the resource to deactivate 271132354Sdfr */ 27241153SwollmanMETHOD int deactivate_resource { 27395201Smarkm device_t _dev; 27495201Smarkm device_t _child; 27595201Smarkm int _type; 27695201Smarkm int _rid; 27795201Smarkm struct resource *_r; 27841153Swollman}; 27941153Swollman 280132354Sdfr/** 281132354Sdfr * @brief Release a resource 282132354Sdfr * 283132354Sdfr * Free a resource allocated by the BUS_ALLOC_RESOURCE. The @p _rid 284132354Sdfr * value must be the same as the one returned by BUS_ALLOC_RESOURCE() 285132354Sdfr * (which is not necessarily the same as the one the client passed). 286132354Sdfr * 287132354Sdfr * @param _dev the parent device of @p _child 288132354Sdfr * @param _child the device which allocated the resource 289132354Sdfr * @param _type the type of resource 290132354Sdfr * @param _rid the resource identifier 291132354Sdfr * @param _r the resource to release 292132354Sdfr */ 29341153SwollmanMETHOD int release_resource { 29495201Smarkm device_t _dev; 29595201Smarkm device_t _child; 29695201Smarkm int _type; 29795201Smarkm int _rid; 29895201Smarkm struct resource *_res; 29937592Sdfr}; 30041153Swollman 301132354Sdfr/** 302132354Sdfr * @brief Install an interrupt handler 303132354Sdfr * 304132354Sdfr * This method is used to associate an interrupt handler function with 305132354Sdfr * an irq resource. When the interrupt triggers, the function @p _intr 306132354Sdfr * will be called with the value of @p _arg as its single 307132354Sdfr * argument. The value returned in @p *_cookiep is used to cancel the 308132354Sdfr * interrupt handler - the caller should save this value to use in a 309132354Sdfr * future call to BUS_TEARDOWN_INTR(). 310132354Sdfr * 311132354Sdfr * @param _dev the parent device of @p _child 312132354Sdfr * @param _child the device which allocated the resource 313132354Sdfr * @param _irq the resource representing the interrupt 314132354Sdfr * @param _flags a set of bits from enum intr_type specifying 315132354Sdfr * the class of interrupt 316132354Sdfr * @param _intr the function to call when the interrupt 317132354Sdfr * triggers 318132354Sdfr * @param _arg a value to use as the single argument in calls 319132354Sdfr * to @p _intr 320132354Sdfr * @param _cookiep a pointer to a location to recieve a cookie 321132354Sdfr * value that may be used to remove the interrupt 322132354Sdfr * handler 323132354Sdfr */ 32441153SwollmanMETHOD int setup_intr { 32595201Smarkm device_t _dev; 32695201Smarkm device_t _child; 32795201Smarkm struct resource *_irq; 32895201Smarkm int _flags; 329166901Spiso driver_filter_t *_filter; 33095201Smarkm driver_intr_t *_intr; 33195201Smarkm void *_arg; 33295201Smarkm void **_cookiep; 33341153Swollman}; 33441153Swollman 335132354Sdfr/** 336132354Sdfr * @brief Uninstall an interrupt handler 337132354Sdfr * 338132354Sdfr * This method is used to disassociate an interrupt handler function 339132354Sdfr * with an irq resource. The value of @p _cookie must be the value 340132354Sdfr * returned from a previous call to BUS_SETUP_INTR(). 341132354Sdfr * 342132354Sdfr * @param _dev the parent device of @p _child 343132354Sdfr * @param _child the device which allocated the resource 344132354Sdfr * @param _irq the resource representing the interrupt 345132354Sdfr * @param _cookie the cookie value returned when the interrupt 346132354Sdfr * was originally registered 347132354Sdfr */ 34841153SwollmanMETHOD int teardown_intr { 34995201Smarkm device_t _dev; 35095201Smarkm device_t _child; 35195201Smarkm struct resource *_irq; 35295201Smarkm void *_cookie; 35341153Swollman}; 35452174Sdfr 355132354Sdfr/** 356132354Sdfr * @brief Define a resource which can be allocated with 357132354Sdfr * BUS_ALLOC_RESOURCE(). 358132354Sdfr * 359132354Sdfr * This method is used by some busses (typically ISA) to allow a 360132354Sdfr * driver to describe a resource range that it would like to 361132354Sdfr * allocate. The resource defined by @p _type and @p _rid is defined 362132354Sdfr * to start at @p _start and to include @p _count indices in its 363132354Sdfr * range. 364132354Sdfr * 365132354Sdfr * @param _dev the parent device of @p _child 366132354Sdfr * @param _child the device which owns the resource 367132354Sdfr * @param _type the type of resource 368132354Sdfr * @param _rid the resource identifier 369132354Sdfr * @param _start the start of the resource range 370132354Sdfr * @param _count the size of the resource range 371132354Sdfr */ 37252174SdfrMETHOD int set_resource { 37395201Smarkm device_t _dev; 37495201Smarkm device_t _child; 37595201Smarkm int _type; 37695201Smarkm int _rid; 37795201Smarkm u_long _start; 37895201Smarkm u_long _count; 37952174Sdfr}; 38052174Sdfr 381132354Sdfr/** 382132354Sdfr * @brief Describe a resource 383132354Sdfr * 384132354Sdfr * This method allows a driver to examine the range used for a given 385132354Sdfr * resource without actually allocating it. 386132354Sdfr * 387132354Sdfr * @param _dev the parent device of @p _child 388132354Sdfr * @param _child the device which owns the resource 389132354Sdfr * @param _type the type of resource 390132354Sdfr * @param _rid the resource identifier 391132354Sdfr * @param _start the address of a location to recieve the start 392132354Sdfr * index of the resource range 393132354Sdfr * @param _count the address of a location to recieve the size 394132354Sdfr * of the resource range 395132354Sdfr */ 39652174SdfrMETHOD int get_resource { 39795201Smarkm device_t _dev; 39895201Smarkm device_t _child; 39995201Smarkm int _type; 40095201Smarkm int _rid; 40195201Smarkm u_long *_startp; 40295201Smarkm u_long *_countp; 40352174Sdfr}; 40452174Sdfr 405132354Sdfr/** 406132354Sdfr * @brief Delete a resource. 407132354Sdfr * 408132354Sdfr * Use this to delete a resource (possibly one previously added with 409132354Sdfr * BUS_SET_RESOURCE()). 410132354Sdfr * 411132354Sdfr * @param _dev the parent device of @p _child 412132354Sdfr * @param _child the device which owns the resource 413132354Sdfr * @param _type the type of resource 414132354Sdfr * @param _rid the resource identifier 415132354Sdfr */ 41652174SdfrMETHOD void delete_resource { 41795201Smarkm device_t _dev; 41895201Smarkm device_t _child; 41995201Smarkm int _type; 42095201Smarkm int _rid; 42152174Sdfr}; 42267278Smdodd 423132354Sdfr/** 424132354Sdfr * @brief Return a struct resource_list. 425132354Sdfr * 426132354Sdfr * Used by drivers which use bus_generic_rl_alloc_resource() etc. to 427132354Sdfr * implement their resource handling. It should return the resource 428132354Sdfr * list of the given child device. 429132354Sdfr * 430132354Sdfr * @param _dev the parent device of @p _child 431132354Sdfr * @param _child the device which owns the resource list 432132354Sdfr */ 43369294SmdoddMETHOD struct resource_list * get_resource_list { 43495201Smarkm device_t _dev; 43595201Smarkm device_t _child; 43667278Smdodd} DEFAULT bus_generic_get_resource_list; 437100421Simp 438132354Sdfr/** 439132354Sdfr * @brief Is the hardware described by @p _child still attached to the 440132354Sdfr * system? 441132354Sdfr * 442133588Simp * This method should return 0 if the device is not present. It 443133588Simp * should return -1 if it is present. Any errors in determining 444133588Simp * should be returned as a normal errno value. Client drivers are to 445133588Simp * assume that the device is present, even if there is an error 446133588Simp * determining if it is there. Busses are to try to avoid returning 447133588Simp * errors, but newcard will return an error if the device fails to 448133588Simp * implement this method. 449132354Sdfr * 450132354Sdfr * @param _dev the parent device of @p _child 451132354Sdfr * @param _child the device which is being examined 452132354Sdfr */ 453100421SimpMETHOD int child_present { 454100421Simp device_t _dev; 455100421Simp device_t _child; 456100421Simp} DEFAULT bus_generic_child_present; 457104597Simp 458132354Sdfr/** 459132354Sdfr * @brief Returns the pnp info for this device. 460132354Sdfr * 461132354Sdfr * Return it as a string. If the string is insufficient for the 462132354Sdfr * storage, then return EOVERFLOW. 463132354Sdfr * 464132354Sdfr * @param _dev the parent device of @p _child 465132354Sdfr * @param _child the device which is being examined 466132354Sdfr * @param _buf the address of a buffer to receive the pnp 467132354Sdfr * string 468132354Sdfr * @param _buflen the size of the buffer pointed to by @p _buf 469132354Sdfr */ 470104597SimpMETHOD int child_pnpinfo_str { 471104597Simp device_t _dev; 472104597Simp device_t _child; 473104597Simp char *_buf; 474104597Simp size_t _buflen; 475104597Simp}; 476104597Simp 477132354Sdfr/** 478132354Sdfr * @brief Returns the location for this device. 479132354Sdfr * 480132354Sdfr * Return it as a string. If the string is insufficient for the 481132354Sdfr * storage, then return EOVERFLOW. 482132354Sdfr * 483132354Sdfr * @param _dev the parent device of @p _child 484132354Sdfr * @param _child the device which is being examined 485132354Sdfr * @param _buf the address of a buffer to receive the location 486132354Sdfr * string 487132354Sdfr * @param _buflen the size of the buffer pointed to by @p _buf 488132354Sdfr */ 489104597SimpMETHOD int child_location_str { 490104597Simp device_t _dev; 491104597Simp device_t _child; 492104597Simp char *_buf; 493104597Simp size_t _buflen; 494104597Simp}; 495119967Smarcel 496132354Sdfr/** 497177467Sjhb * @brief Allow drivers to request that an interrupt be bound to a specific 498177467Sjhb * CPU. 499177467Sjhb * 500177467Sjhb * @param _dev the parent device of @p _child 501177467Sjhb * @param _child the device which allocated the resource 502177467Sjhb * @param _irq the resource representing the interrupt 503177467Sjhb * @param _cpu the CPU to bind the interrupt to 504177467Sjhb */ 505177467SjhbMETHOD int bind_intr { 506177467Sjhb device_t _dev; 507177467Sjhb device_t _child; 508177467Sjhb struct resource *_irq; 509177467Sjhb int _cpu; 510177467Sjhb} DEFAULT bus_generic_bind_intr; 511177467Sjhb 512177467Sjhb 513177467Sjhb/** 514132354Sdfr * @brief Allow (bus) drivers to specify the trigger mode and polarity 515132354Sdfr * of the specified interrupt. 516132354Sdfr * 517132354Sdfr * @param _dev the bus device 518132354Sdfr * @param _irq the interrupt number to modify 519132354Sdfr * @param _trig the trigger mode required 520132354Sdfr * @param _pol the interrupt polarity required 521132354Sdfr */ 522119967SmarcelMETHOD int config_intr { 523119967Smarcel device_t _dev; 524119967Smarcel int _irq; 525119967Smarcel enum intr_trigger _trig; 526119967Smarcel enum intr_polarity _pol; 527119967Smarcel} DEFAULT bus_generic_config_intr; 528160186Simp 529160186Simp/** 530160186Simp * @brief Notify a (bus) driver about a child that the hints mechanism 531160186Simp * believes it has discovered. 532160186Simp * 533160186Simp * The bus is responsible for then adding the child in the right order 534160186Simp * and discovering other things about the child. The bus driver is 535160186Simp * free to ignore this hint, to do special things, etc. It is all up 536160186Simp * to the bus driver to interpret. 537160186Simp * 538160186Simp * This method is only called in response to the parent bus asking for 539160186Simp * hinted devices to be enumerated. 540160186Simp * 541160186Simp * @param _dev the bus device 542160186Simp * @param _dname the name of the device w/o unit numbers 543160186Simp * @param _dunit the unit number of the device 544160186Simp */ 545160186SimpMETHOD void hinted_child { 546160186Simp device_t _dev; 547185059Sjhb const char *_dname; 548160186Simp int _dunit; 549160186Simp}; 550161928Sjmg 551161928Sjmg/** 552161928Sjmg * @brief Returns bus_dma_tag_t for use w/ devices on the bus. 553161928Sjmg * 554161928Sjmg * @param _dev the parent device of @p _child 555161928Sjmg * @param _child the device to which the tag will belong 556161928Sjmg */ 557161928SjmgMETHOD bus_dma_tag_t get_dma_tag { 558161928Sjmg device_t _dev; 559161928Sjmg device_t _child; 560161928Sjmg} DEFAULT bus_generic_get_dma_tag; 561185059Sjhb 562185059Sjhb/** 563185059Sjhb * @brief Allow the bus to determine the unit number of a device. 564185059Sjhb * 565185059Sjhb * @param _dev the parent device of @p _child 566185059Sjhb * @param _child the device whose unit is to be wired 567185059Sjhb * @param _name the name of the device's new devclass 568185059Sjhb * @param _unitp a pointer to the device's new unit value 569185059Sjhb */ 570185059SjhbMETHOD void hint_device_unit { 571185059Sjhb device_t _dev; 572185059Sjhb device_t _child; 573185059Sjhb const char *_name; 574185059Sjhb int *_unitp; 575185059Sjhb}; 576185059Sjhb 577