FreeBSD kernel kern code
bus - KObj methods for drivers of devices with children

A set of methods required device drivers that support child devices. More...

Variables

INTERFACE bus
 
 CODE
 
METHOD int print_child
 Print a description of a child device. More...
 
device_t _child
 
DEFAULT bus_generic_print_child
 
METHOD void probe_nomatch
 Print a notification about an unprobed child device. More...
 
METHOD int read_ivar
 Read the value of a bus-specific attribute of a device. More...
 
int _index
 
uintptr_t * _result
 
METHOD int write_ivar
 Write the value of a bus-specific attribute of a device. More...
 
int _indx
 
uintptr_t _value
 
METHOD void child_deleted
 Notify a bus that a child was deleted. More...
 
METHOD void child_detached
 Notify a bus that a child was detached. More...
 
METHOD void driver_added
 Notify a bus that a new driver was added. More...
 
driver_t * _driver
 
DEFAULT bus_generic_driver_added
 
METHOD device_t add_child
 Create a new child device. More...
 
u_int _order
 
const char * _name
 
int _unit
 
DEFAULT null_add_child
 
METHOD int rescan
 Rescan the bus. More...
 
METHOD struct resource * alloc_resource
 Allocate a system resource. More...
 
int _type
 
int * _rid
 
rman_res_t _start
 
rman_res_t _end
 
rman_res_t _count
 
u_int _flags
 
DEFAULT null_alloc_resource
 
METHOD int activate_resource
 Activate a resource. More...
 
struct resource * _r
 
METHOD int map_resource
 Map a resource. More...
 
struct resource_map_request * _args
 
struct resource_map * _map
 
DEFAULT bus_generic_map_resource
 
METHOD int unmap_resource
 Unmap a resource. More...
 
DEFAULT bus_generic_unmap_resource
 
METHOD int deactivate_resource
 Deactivate a resource. More...
 
METHOD int adjust_resource
 Adjust a resource. More...
 
struct resource * _res
 
METHOD int translate_resource
 translate a resource value More...
 
rman_res_t * _newstart
 
DEFAULT bus_generic_translate_resource
 
METHOD int release_resource
 Release a resource. More...
 
METHOD int setup_intr
 Install an interrupt handler. More...
 
struct resource * _irq
 
driver_filter_t * _filter
 
driver_intr_t * _intr
 
void * _arg
 
void ** _cookiep
 
METHOD int teardown_intr
 Uninstall an interrupt handler. More...
 
void * _cookie
 
METHOD int suspend_intr
 Suspend an interrupt handler. More...
 
DEFAULT bus_generic_suspend_intr
 
METHOD int resume_intr
 Resume an interrupt handler. More...
 
DEFAULT bus_generic_resume_intr
 
METHOD int set_resource
 Define a resource which can be allocated with BUS_ALLOC_RESOURCE(). More...
 
METHOD int get_resource
 Describe a resource. More...
 
rman_res_t * _startp
 
rman_res_t * _countp
 
METHOD void delete_resource
 Delete a resource. More...
 
METHOD struct resource_list * get_resource_list
 Return a struct resource_list. More...
 
DEFAULT bus_generic_get_resource_list
 
METHOD int child_present
 Is the hardware described by _child still attached to the system? More...
 
DEFAULT bus_generic_child_present
 
METHOD int child_pnpinfo
 Returns the pnp info for this device. More...
 
struct sbuf * _sb
 
DEFAULT bus_generic_child_pnpinfo
 
METHOD int child_location
 Returns the location for this device. More...
 
DEFAULT bus_generic_child_location
 
METHOD int bind_intr
 Allow drivers to request that an interrupt be bound to a specific CPU. More...
 
int _cpu
 
DEFAULT bus_generic_bind_intr
 
METHOD int config_intr
 Allow (bus) drivers to specify the trigger mode and polarity of the specified interrupt. More...
 
enum intr_trigger _trig
 
enum intr_polarity _pol
 
DEFAULT bus_generic_config_intr
 
METHOD int describe_intr
 Allow drivers to associate a description with an active interrupt handler. More...
 
const char * _descr
 
DEFAULT bus_generic_describe_intr
 
METHOD void hinted_child
 Notify a (bus) driver about a child that the hints mechanism believes it has discovered. More...
 
const char * _dname
 
int _dunit
 
METHOD bus_dma_tag_t get_dma_tag
 Returns bus_dma_tag_t for use w/ devices on the bus. More...
 
DEFAULT bus_generic_get_dma_tag
 
METHOD bus_space_tag_t get_bus_tag
 Returns bus_space_tag_t for use w/ devices on the bus. More...
 
DEFAULT bus_generic_get_bus_tag
 
METHOD void hint_device_unit
 Allow the bus to determine the unit number of a device. More...
 
int * _unitp
 
METHOD void new_pass
 Notify a bus that the bus pass level has been changed. More...
 
DEFAULT bus_generic_new_pass
 
METHOD int remap_intr
 Notify a bus that specified child's IRQ should be remapped. More...
 
DEFAULT null_remap_intr
 
METHOD int suspend_child
 Suspend a given child. More...
 
DEFAULT bus_generic_suspend_child
 
METHOD int resume_child
 Resume a given child. More...
 
DEFAULT bus_generic_resume_child
 
METHOD int get_domain
 Get the VM domain handle for the given bus and child. More...
 
int * _domain
 
DEFAULT bus_generic_get_domain
 
METHOD int get_cpus
 Request a set of CPUs. More...
 
enum cpu_sets _op
 
size_t _setsize
 
struct _cpuset * _cpuset
 
DEFAULT bus_generic_get_cpus
 
METHOD int reset_prepare
 Prepares the given child of the bus for reset. More...
 
DEFAULT null_reset_prepare
 
METHOD int reset_post
 Restores the child operations after the reset. More...
 
DEFAULT null_reset_post
 
METHOD int reset_child
 Performs reset of the child. More...
 
METHOD ssize_t get_property
 Gets child's specific property. More...
 
const char * _propname
 
void * _propvalue
 
size_t _size
 
device_property_type_t type
 
DEFAULT bus_generic_get_property
 
METHOD int get_device_path
 Gets a child's full path to the device. More...
 
const char * _locator
 
DEFAULT bus_generic_get_device_path
 

Detailed Description

A set of methods required device drivers that support child devices.

Variable Documentation

◆ _arg

void* _arg

Definition at line 480 of file bus_if.m.

◆ _args

struct resource_map_request* _args

Definition at line 339 of file bus_if.m.

◆ _child

device_t _child

Definition at line 98 of file bus_if.m.

◆ _cookie

void * _cookie

Definition at line 501 of file bus_if.m.

◆ _cookiep

void** _cookiep

Definition at line 481 of file bus_if.m.

◆ _count

rman_res_t _count

Definition at line 293 of file bus_if.m.

◆ _countp

rman_res_t* _countp

Definition at line 589 of file bus_if.m.

◆ _cpu

int _cpu

Definition at line 702 of file bus_if.m.

◆ _cpuset

struct _cpuset* _cpuset

Definition at line 871 of file bus_if.m.

◆ _descr

const char* _descr

Definition at line 737 of file bus_if.m.

◆ _dname

const char* _dname

Definition at line 758 of file bus_if.m.

◆ _domain

int* _domain

Definition at line 853 of file bus_if.m.

◆ _driver

driver_t* _driver

Definition at line 214 of file bus_if.m.

◆ _dunit

int _dunit

Definition at line 759 of file bus_if.m.

◆ _end

rman_res_t _end

Definition at line 292 of file bus_if.m.

◆ _filter

driver_filter_t* _filter

Definition at line 478 of file bus_if.m.

◆ _flags

int _flags

Definition at line 294 of file bus_if.m.

Referenced by umtx_copyin_umtx_timei386().

◆ _index

int _index

Definition at line 145 of file bus_if.m.

◆ _indx

int _indx

Definition at line 169 of file bus_if.m.

◆ _intr

driver_intr_t* _intr

Definition at line 479 of file bus_if.m.

◆ _irq

u_int _irq

Definition at line 476 of file bus_if.m.

◆ _locator

const char* _locator

Definition at line 959 of file bus_if.m.

◆ _map

struct resource_map * _map

Definition at line 340 of file bus_if.m.

◆ _name

const char * _name

Definition at line 241 of file bus_if.m.

◆ _newstart

rman_res_t* _newstart

Definition at line 426 of file bus_if.m.

◆ _op

enum cpu_sets _op

Definition at line 869 of file bus_if.m.

◆ _order

u_int _order

Definition at line 240 of file bus_if.m.

◆ _pol

enum intr_polarity _pol

Definition at line 718 of file bus_if.m.

◆ _propname

const char* _propname

Definition at line 938 of file bus_if.m.

◆ _propvalue

void* _propvalue

Definition at line 939 of file bus_if.m.

◆ _r

struct resource * _r

Definition at line 316 of file bus_if.m.

◆ _res

struct resource * _res

Definition at line 405 of file bus_if.m.

◆ _result

uintptr_t* _result

Definition at line 146 of file bus_if.m.

◆ _rid

int _rid

Definition at line 290 of file bus_if.m.

◆ _sb

struct sbuf * _sb

Definition at line 664 of file bus_if.m.

◆ _setsize

size_t _setsize

Definition at line 870 of file bus_if.m.

◆ _size

size_t _size

Definition at line 940 of file bus_if.m.

◆ _start

rman_res_t _start

Definition at line 291 of file bus_if.m.

◆ _startp

rman_res_t* _startp

Definition at line 588 of file bus_if.m.

◆ _trig

enum intr_trigger _trig

Definition at line 717 of file bus_if.m.

◆ _type

int _type

Definition at line 289 of file bus_if.m.

◆ _unit

int _unit

Definition at line 242 of file bus_if.m.

◆ _unitp

int* _unitp

Definition at line 796 of file bus_if.m.

◆ _value

uintptr_t _value

Definition at line 170 of file bus_if.m.

◆ activate_resource

METHOD int activate_resource
Initial value:
{
device_t _dev

Activate a resource.

Activate a resource previously allocated with BUS_ALLOC_RESOURCE(). This may enable decoding of this resource in a device for instance. It will also establish a mapping for the resource unless RF_UNMAPPED was set when allocating the resource.

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_typethe type of resource
_ridthe resource identifier
_rthe resource to activate

Definition at line 311 of file bus_if.m.

◆ add_child

METHOD device_t add_child
Initial value:
{
device_t _dev

Create a new child device.

For buses which use use drivers supporting DEVICE_IDENTIFY() to enumerate their devices, this method is used to create new device instances. The new device will be added after the last existing child with the same order. Implementations of bus_add_child call device_add_child_ordered to add the child and often add a suitable ivar to the device specific to that bus.

Parameters
_devthe bus device which will be the parent of the new child device
_ordera value which is used to partially sort the children of _dev - devices created using lower values of _order appear first in _dev's list of children
_namedevclass name for new device or NULL if not specified
_unitunit number for new device or -1 if not specified

Definition at line 238 of file bus_if.m.

◆ adjust_resource

METHOD int adjust_resource
Initial value:
{
device_t _dev

Adjust a resource.

Adjust the start and/or end of a resource allocated by BUS_ALLOC_RESOURCE. At least part of the new address range must overlap with the existing address range. If the successful, the resource's range will be adjusted to [start, end] on return.

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_typethe type of resource
_resthe resource to adjust
_startthe new starting address of the resource range
_endthe new ending address of the resource range

Definition at line 401 of file bus_if.m.

◆ alloc_resource

METHOD struct resource* alloc_resource
Initial value:
{
device_t _dev

Allocate a system resource.

This method is called by child devices of a bus to allocate resources. The types are defined in <machine/resource.h>; the meaning of the resource-ID field varies from bus to bus (but *rid == 0 is always valid if the resource type is). If a resource was allocated and the caller did not use the RF_ACTIVE to specify that it should be activated immediately, the caller is responsible for calling BUS_ACTIVATE_RESOURCE() when it actually uses the resource.

Parameters
_devthe parent device of _child
_childthe device which is requesting an allocation
_typethe type of resource to allocate
_rida pointer to the resource identifier
_starthint at the start of the resource range - pass 0 for any start address
_endhint at the end of the resource range - pass ~0 for any end address
_counthint at the size of range required - pass 1 for any size
_flagsany extra flags to control the resource allocation - see RF_XXX flags in <sys/rman.h> for details
Returns
the resource which was allocated or NULL if no resource could be allocated

Definition at line 286 of file bus_if.m.

◆ bind_intr

METHOD int bind_intr
Initial value:
{
device_t _dev

Allow drivers to request that an interrupt be bound to a specific CPU.

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_irqthe resource representing the interrupt
_cputhe CPU to bind the interrupt to

Definition at line 698 of file bus_if.m.

◆ bus

◆ bus_generic_bind_intr

DEFAULT bus_generic_bind_intr

Definition at line 703 of file bus_if.m.

◆ bus_generic_child_location

DEFAULT bus_generic_child_location

Definition at line 687 of file bus_if.m.

◆ bus_generic_child_pnpinfo

DEFAULT bus_generic_child_pnpinfo

Definition at line 665 of file bus_if.m.

◆ bus_generic_child_present

DEFAULT bus_generic_child_present

Definition at line 643 of file bus_if.m.

◆ bus_generic_config_intr

DEFAULT bus_generic_config_intr

Definition at line 719 of file bus_if.m.

◆ bus_generic_describe_intr

DEFAULT bus_generic_describe_intr

Definition at line 738 of file bus_if.m.

◆ bus_generic_driver_added

DEFAULT bus_generic_driver_added

Definition at line 215 of file bus_if.m.

◆ bus_generic_get_bus_tag

DEFAULT bus_generic_get_bus_tag

Definition at line 782 of file bus_if.m.

◆ bus_generic_get_cpus

DEFAULT bus_generic_get_cpus

Definition at line 872 of file bus_if.m.

◆ bus_generic_get_device_path

DEFAULT bus_generic_get_device_path

Definition at line 961 of file bus_if.m.

◆ bus_generic_get_dma_tag

DEFAULT bus_generic_get_dma_tag

Definition at line 771 of file bus_if.m.

◆ bus_generic_get_domain

DEFAULT bus_generic_get_domain

Definition at line 854 of file bus_if.m.

◆ bus_generic_get_property

DEFAULT bus_generic_get_property

Definition at line 942 of file bus_if.m.

◆ bus_generic_get_resource_list

DEFAULT bus_generic_get_resource_list

Definition at line 623 of file bus_if.m.

◆ bus_generic_map_resource

DEFAULT bus_generic_map_resource

Definition at line 341 of file bus_if.m.

◆ bus_generic_new_pass

DEFAULT bus_generic_new_pass

Definition at line 806 of file bus_if.m.

◆ bus_generic_print_child

DEFAULT bus_generic_print_child

Definition at line 99 of file bus_if.m.

◆ bus_generic_resume_child

DEFAULT bus_generic_resume_child

Definition at line 841 of file bus_if.m.

◆ bus_generic_resume_intr

DEFAULT bus_generic_resume_intr

Definition at line 540 of file bus_if.m.

◆ bus_generic_suspend_child

DEFAULT bus_generic_suspend_child

Definition at line 830 of file bus_if.m.

◆ bus_generic_suspend_intr

DEFAULT bus_generic_suspend_intr

Definition at line 521 of file bus_if.m.

◆ bus_generic_translate_resource

DEFAULT bus_generic_translate_resource

Definition at line 427 of file bus_if.m.

◆ bus_generic_unmap_resource

DEFAULT bus_generic_unmap_resource

Definition at line 363 of file bus_if.m.

◆ child_deleted

METHOD void child_deleted
Initial value:
{
device_t _dev

Notify a bus that a child was deleted.

Called at the beginning of device_delete_child() to allow the parent to teardown any bus-specific state for the child.

Parameters
_devthe device whose child is being deleted
_childthe child device which is being deleted

Definition at line 182 of file bus_if.m.

◆ child_detached

METHOD void child_detached
Initial value:
{
device_t _dev

Notify a bus that a child was detached.

Called after the child's DEVICE_DETACH() method to allow the parent to reclaim any resources allocated on behalf of the child.

Parameters
_devthe device whose child changed state
_childthe child device which changed state

Definition at line 196 of file bus_if.m.

◆ child_location

METHOD int child_location
Initial value:
{
device_t _dev

Returns the location for this device.

Return it as a string, appended to _sb

The string must be formatted as a space-separated list of name=value pairs. Names may only contain alphanumeric characters, underscores ('_') and hyphens ('-'). Values can contain any non-whitespace characters. Values containing whitespace can be quoted with double quotes ('"'). Double quotes and backslashes in quoted values can be escaped with backslashes ('\').

Parameters
_devthe parent device of _child
_childthe device which is being examined
_sbsbuf for results string

Definition at line 683 of file bus_if.m.

◆ child_pnpinfo

METHOD int child_pnpinfo
Initial value:
{
device_t _dev

Returns the pnp info for this device.

Return it as a string, appended to _sb

The string must be formatted as a space-separated list of name=value pairs. Names may only contain alphanumeric characters, underscores ('_') and hyphens ('-'). Values can contain any non-whitespace characters. Values containing whitespace can be quoted with double quotes ('"'). Double quotes and backslashes in quoted values can be escaped with backslashes ('\').

Parameters
_devthe parent device of _child
_childthe device which is being examined
_sbsbuf for results string

Definition at line 661 of file bus_if.m.

◆ child_present

METHOD int child_present
Initial value:
{
device_t _dev

Is the hardware described by _child still attached to the system?

This method should return 0 if the device is not present. It should return -1 if it is present. Any errors in determining should be returned as a normal errno value. Client drivers are to assume that the device is present, even if there is an error determining if it is there. Buses are to try to avoid returning errors, but newcard will return an error if the device fails to implement this method.

Parameters
_devthe parent device of _child
_childthe device which is being examined

Definition at line 640 of file bus_if.m.

◆ CODE

CODE

Definition at line 44 of file bus_if.m.

◆ config_intr

METHOD int config_intr
Initial value:
{
device_t _dev

Allow (bus) drivers to specify the trigger mode and polarity of the specified interrupt.

Parameters
_devthe bus device
_irqthe interrupt number to modify
_trigthe trigger mode required
_polthe interrupt polarity required

Definition at line 714 of file bus_if.m.

◆ deactivate_resource

METHOD int deactivate_resource
Initial value:
{
device_t _dev

Deactivate a resource.

Deactivate a resource previously allocated with BUS_ALLOC_RESOURCE().

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_typethe type of resource
_ridthe resource identifier
_rthe resource to deactivate

Definition at line 378 of file bus_if.m.

◆ delete_resource

METHOD void delete_resource
Initial value:
{
device_t _dev

Delete a resource.

Use this to delete a resource (possibly one previously added with BUS_SET_RESOURCE()).

Parameters
_devthe parent device of _child
_childthe device which owns the resource
_typethe type of resource
_ridthe resource identifier

Definition at line 603 of file bus_if.m.

◆ describe_intr

METHOD int describe_intr
Initial value:
{
device_t _dev

Allow drivers to associate a description with an active interrupt handler.

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_irqthe resource representing the interrupt
_cookiethe cookie value returned when the interrupt was originally registered
_descrthe description to associate with the interrupt

Definition at line 732 of file bus_if.m.

◆ driver_added

METHOD void driver_added
Initial value:
{
device_t _dev

Notify a bus that a new driver was added.

Called when a new driver is added to the devclass which owns this bus. The generic implementation of this method attempts to probe and attach any un-matched children of the bus.

Parameters
_devthe device whose devclass had a new driver added to it
_driverthe new driver which was added

Definition at line 212 of file bus_if.m.

◆ get_bus_tag

METHOD bus_space_tag_t get_bus_tag
Initial value:
{
device_t _dev

Returns bus_space_tag_t for use w/ devices on the bus.

Parameters
_devthe parent device of _child
_childthe device to which the tag will belong

Definition at line 779 of file bus_if.m.

◆ get_cpus

METHOD int get_cpus
Initial value:
{
device_t _dev

Request a set of CPUs.

Parameters
_devthe bus device
_childthe child device
_optype of CPUs to request
_setsizethe size of the set passed in _cpuset
_cpuseta pointer to a cpuset to receive the requested set of CPUs

Definition at line 866 of file bus_if.m.

◆ get_device_path

METHOD int get_device_path
Initial value:
{
device_t _bus

Gets a child's full path to the device.

The get_device_path method retrieves a device's full path to the device using one of several locators present in the system.

Parameters
_busthe bus device
_childthe child device
_locatorlocator name
_sbbuffer loaction string

Definition at line 956 of file bus_if.m.

◆ get_dma_tag

METHOD bus_dma_tag_t get_dma_tag
Initial value:
{
device_t _dev

Returns bus_dma_tag_t for use w/ devices on the bus.

Parameters
_devthe parent device of _child
_childthe device to which the tag will belong

Definition at line 768 of file bus_if.m.

◆ get_domain

METHOD int get_domain
Initial value:
{
device_t _dev

Get the VM domain handle for the given bus and child.

Parameters
_devthe bus device
_childthe child device
_domaina pointer to the bus's domain handle identifier

Definition at line 850 of file bus_if.m.

◆ get_property

METHOD ssize_t get_property
Initial value:
{
device_t _dev

Gets child's specific property.

The bus_get_property can be used to access device specific properties stored on the bus. If _propvalue is NULL or _size is 0, then method only returns size of the property.

Parameters
_devthe bus device
_childthe child device
_propnameproperty name
_propvalueproperty value destination
_sizeproperty value size
Returns
size of property if successful otherwise -1

Definition at line 935 of file bus_if.m.

◆ get_resource

METHOD int get_resource
Initial value:
{
device_t _dev

Describe a resource.

This method allows a driver to examine the range used for a given resource without actually allocating it.

Parameters
_devthe parent device of _child
_childthe device which owns the resource
_typethe type of resource
_ridthe resource identifier
_startthe address of a location to receive the start index of the resource range
_countthe address of a location to receive the size of the resource range

Definition at line 583 of file bus_if.m.

◆ get_resource_list

METHOD struct resource_list* get_resource_list
Initial value:
{
device_t _dev

Return a struct resource_list.

Used by drivers which use bus_generic_rl_alloc_resource() etc. to implement their resource handling. It should return the resource list of the given child device.

Parameters
_devthe parent device of _child
_childthe device which owns the resource list

Definition at line 620 of file bus_if.m.

◆ hint_device_unit

METHOD void hint_device_unit
Initial value:
{
device_t _dev

Allow the bus to determine the unit number of a device.

Parameters
_devthe parent device of _child
_childthe device whose unit is to be wired
_namethe name of the device's new devclass
_unitpa pointer to the device's new unit value

Definition at line 792 of file bus_if.m.

◆ hinted_child

METHOD void hinted_child
Initial value:
{
device_t _dev

Notify a (bus) driver about a child that the hints mechanism believes it has discovered.

The bus is responsible for then adding the child in the right order and discovering other things about the child. The bus driver is free to ignore this hint, to do special things, etc. It is all up to the bus driver to interpret.

This method is only called in response to the parent bus asking for hinted devices to be enumerated.

Parameters
_devthe bus device
_dnamethe name of the device w/o unit numbers
_dunitthe unit number of the device

Definition at line 756 of file bus_if.m.

◆ map_resource

METHOD int map_resource
Initial value:
{
device_t _dev

Map a resource.

Allocate a mapping for a range of an active resource. The mapping is described by a struct resource_map object. This may for instance map a memory region into the kernel's virtual address space.

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_typethe type of resource
_rthe resource to map
_argsoptional attributes of the mapping
_mapthe mapping

Definition at line 334 of file bus_if.m.

◆ new_pass

METHOD void new_pass
Initial value:
{
device_t _dev

Notify a bus that the bus pass level has been changed.

Parameters
_devthe bus device

Definition at line 804 of file bus_if.m.

◆ null_add_child

DEFAULT null_add_child

Definition at line 243 of file bus_if.m.

◆ null_alloc_resource

DEFAULT null_alloc_resource

Definition at line 295 of file bus_if.m.

◆ null_remap_intr

DEFAULT null_remap_intr

Definition at line 819 of file bus_if.m.

◆ null_reset_post

DEFAULT null_reset_post

Definition at line 904 of file bus_if.m.

◆ null_reset_prepare

DEFAULT null_reset_prepare

Definition at line 890 of file bus_if.m.

◆ print_child

METHOD int print_child
Initial value:
{
device_t _dev

Print a description of a child device.

This is called from system code which prints out a description of a device. It should describe the attachment that the child has with the parent. For instance the TurboLaser bus prints which node the device is attached to. See bus_generic_print_child() for more information.

Parameters
_devthe device whose child is being printed
_childthe child device to describe
Returns
the number of characters output.

Definition at line 96 of file bus_if.m.

◆ probe_nomatch

METHOD void probe_nomatch
Initial value:
{
device_t _dev

Print a notification about an unprobed child device.

Called for each child device that did not succeed in probing for a driver.

Parameters
_devthe device whose child was being probed
_childthe child device which failed to probe

Definition at line 110 of file bus_if.m.

◆ read_ivar

METHOD int read_ivar
Initial value:
{
device_t _dev

Read the value of a bus-specific attribute of a device.

This method, along with BUS_WRITE_IVAR() manages a bus-specific set of instance variables of a child device. The intention is that each different type of bus defines a set of appropriate instance variables (such as ports and irqs for ISA bus etc.)

This information could be given to the child device as a struct but that makes it hard for a bus to add or remove variables without forcing an edit and recompile for all drivers which may not be possible for vendor supplied binary drivers.

This method copies the value of an instance variable to the location specified by *_result.

Parameters
_devthe device whose child was being examined
_childthe child device whose instance variable is being read
_indexthe instance variable to read
_resulta location to receive the instance variable value
Return values
0success
ENOENTno such instance variable is supported by _dev

Definition at line 142 of file bus_if.m.

◆ release_resource

METHOD int release_resource
Initial value:
{
device_t _dev

Release a resource.

Free a resource allocated by the BUS_ALLOC_RESOURCE. The _rid value must be the same as the one returned by BUS_ALLOC_RESOURCE() (which is not necessarily the same as the one the client passed).

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_typethe type of resource
_ridthe resource identifier
_rthe resource to release

Definition at line 442 of file bus_if.m.

◆ remap_intr

METHOD int remap_intr
Initial value:
{
device_t _dev

Notify a bus that specified child's IRQ should be remapped.

Parameters
_devthe bus device
_childthe child device
_irqthe irq number

Definition at line 815 of file bus_if.m.

◆ rescan

METHOD int rescan
Initial value:
{
device_t _dev

Rescan the bus.

This method is called by a parent bridge or devctl to trigger a bus rescan. The rescan should delete devices no longer present and enumerate devices that have newly arrived.

Parameters
_devthe bus device

Definition at line 254 of file bus_if.m.

◆ reset_child

METHOD int reset_child
Initial value:
{
device_t _dev

Performs reset of the child.

Parameters
_devthe bus device
_childthe child device
_flagsDEVF_RESET_ flags

Definition at line 913 of file bus_if.m.

◆ reset_post

METHOD int reset_post
Initial value:
{
device_t _dev

Restores the child operations after the reset.

The bus_helper_reset_post() helper is provided to ease implementing bus reset methods.

Parameters
_devthe bus device
_childthe child device

Definition at line 901 of file bus_if.m.

◆ reset_prepare

METHOD int reset_prepare
Initial value:
{
device_t _dev

Prepares the given child of the bus for reset.

Typically bus detaches or suspends children' drivers, and then calls this method to save bus-specific information, for instance, PCI config space, which is damaged by reset.

The bus_helper_reset_prepare() helper is provided to ease implementing bus reset methods.

Parameters
_devthe bus device
_childthe child device

Definition at line 887 of file bus_if.m.

◆ resume_child

METHOD int resume_child
Initial value:
{
device_t _dev

Resume a given child.

Parameters
_devthe parent device of _child
_childthe device to resume

Definition at line 838 of file bus_if.m.

◆ resume_intr

METHOD int resume_intr
Initial value:
{
device_t _dev

Resume an interrupt handler.

This method is used to clear suspended state of a handler when the associated device is powered up and can be an interrupt source again. The value of _irq must be the interrupt resource passed to a previous call to BUS_SETUP_INTR().

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_irqthe resource representing the interrupt

Definition at line 536 of file bus_if.m.

◆ set_resource

METHOD int set_resource
Initial value:
{
device_t _dev

Define a resource which can be allocated with BUS_ALLOC_RESOURCE().

This method is used by some buses (typically ISA) to allow a driver to describe a resource range that it would like to allocate. The resource defined by _type and _rid is defined to start at _start and to include _count indices in its range.

Parameters
_devthe parent device of _child
_childthe device which owns the resource
_typethe type of resource
_ridthe resource identifier
_startthe start of the resource range
_countthe size of the resource range

Definition at line 559 of file bus_if.m.

◆ setup_intr

METHOD int setup_intr
Initial value:
{
device_t _dev

Install an interrupt handler.

This method is used to associate an interrupt handler function with an irq resource. When the interrupt triggers, the function _intr will be called with the value of _arg as its single argument. The value returned in *_cookiep is used to cancel the interrupt handler - the caller should save this value to use in a future call to BUS_TEARDOWN_INTR().

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_irqthe resource representing the interrupt
_flagsa set of bits from enum intr_type specifying the class of interrupt
_intrthe function to call when the interrupt triggers
_arga value to use as the single argument in calls to _intr
_cookiepa pointer to a location to receive a cookie value that may be used to remove the interrupt handler

Definition at line 473 of file bus_if.m.

◆ suspend_child

METHOD int suspend_child
Initial value:
{
device_t _dev

Suspend a given child.

Parameters
_devthe parent device of _child
_childthe device to suspend

Definition at line 827 of file bus_if.m.

◆ suspend_intr

METHOD int suspend_intr
Initial value:
{
device_t _dev

Suspend an interrupt handler.

This method is used to mark a handler as suspended in the case that the associated device is powered down and cannot be a source for the, typically shared, interrupt. The value of _irq must be the interrupt resource passed to a previous call to BUS_SETUP_INTR().

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_irqthe resource representing the interrupt

Definition at line 517 of file bus_if.m.

◆ teardown_intr

METHOD int teardown_intr
Initial value:
{
device_t _dev

Uninstall an interrupt handler.

This method is used to disassociate an interrupt handler function with an irq resource. The value of _cookie must be the value returned from a previous call to BUS_SETUP_INTR().

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_irqthe resource representing the interrupt
_cookiethe cookie value returned when the interrupt was originally registered

Definition at line 497 of file bus_if.m.

◆ translate_resource

METHOD int translate_resource
Initial value:
{
device_t _dev

translate a resource value

Give a bus driver the opportunity to translate resource ranges. If successful, the host's view of the resource starting at _start is returned in _newstart, otherwise an error is returned.

Parameters
_devthe device associated with the resource
_typethe type of resource
_startthe starting address of the resource range
_newstartthe new starting address of the resource range

Definition at line 422 of file bus_if.m.

◆ type

device_property_type_t type

Definition at line 941 of file bus_if.m.

Referenced by __sanitizer_cov_trace_switch(), _mtx_init(), acl_copyin(), acl_copyout(), acl_type_unold(), aio_aqueue(), aiocb_copyin(), buf_ring_alloc(), buf_ring_free(), bus_activate_resource(), bus_adjust_resource(), bus_alloc_resource(), bus_alloc_resources(), bus_deactivate_resource(), bus_delete_resource(), bus_free_resource(), bus_generic_activate_resource(), bus_generic_adjust_resource(), bus_generic_alloc_resource(), bus_generic_deactivate_resource(), bus_generic_get_property(), bus_generic_map_resource(), bus_generic_release_resource(), bus_generic_rl_alloc_resource(), bus_generic_rl_delete_resource(), bus_generic_rl_get_resource(), bus_generic_rl_release_resource(), bus_generic_rl_set_resource(), bus_generic_translate_resource(), bus_generic_unmap_resource(), bus_get_resource(), bus_get_resource_count(), bus_get_resource_start(), bus_map_resource(), bus_release_resource(), bus_release_resources(), bus_set_resource(), bus_translate_resource(), bus_unmap_resource(), cf_get_method(), contigfree(), contigmalloc(), contigmalloc_domainset(), cpufreq_add_levels(), devaddq(), devctl_notify(), device_get_property(), do_osd_del(), do_wake2_umutex(), filt_timertouch(), filt_usertouch(), finit(), firmware_modevent(), get_proc_vector(), get_ps_strings(), hashdestroy(), hashinit(), hashinit_flags(), intr_alloc_map_data(), kdb_trap(), kern___acl_aclcheck_path(), kern___acl_delete_path(), kern___acl_get_path(), kern___acl_set_path(), kern_socket(), kern_socketpair(), kern_specialfd(), kmsan_orig(), kmsan_orig_name(), kmsan_report_hook(), kmsan_report_inline(), lf_findoverlap(), link_elf_link_preload(), linker_lookup_file(), lock_init(), m_extadd(), m_get2(), m_get3(), m_getjcl(), m_getm2(), m_tag_alloc(), m_tag_locate(), malloc_aligned(), mallocarray(), mallocarray_domainset(), mb_ctor_mbuf(), mb_ctor_pack(), mb_put_mem(), md_get_mem(), mount_devctl_event(), osd_call(), osd_del(), osd_deregister(), osd_exit(), osd_get(), osd_register(), osd_set(), osd_set_reserved(), parse_type(), pf_proto_unregister(), pffindproto(), pffindtype(), phashinit(), phashinit_flags(), populate_note(), preload_dump_internal(), preload_modinfo_type(), preload_modinfo_value(), preload_search_by_type(), preload_search_info(), proc_id_clear(), proc_id_set(), proc_id_set_cond(), register_note(), resource_list_add(), resource_list_add_next(), resource_list_alloc(), resource_list_busy(), resource_list_delete(), resource_list_find(), resource_list_print_type(), resource_list_release(), resource_list_release_active(), resource_list_reserve(), resource_list_reserved(), resource_list_unreserve(), sbcreatecontrol(), sbcreatecontrol_how(), sleepq_type(), sockargs(), socreate(), soreceive_generic(), sysctl_debug_tslog(), trace_cmp(), tslog(), umtx_key_get(), vaccess(), vaccess_acl_nfs4(), vaccess_acl_posix1e(), vacl_aclcheck(), vacl_delete(), vacl_get_acl(), vacl_set_acl(), vfs_modevent(), vmem_add1(), vn_fullpath_hardlink(), vn_open_vnode_advlock(), and witness_init().

◆ unmap_resource

METHOD int unmap_resource
Initial value:
{
device_t _dev

Unmap a resource.

Release a mapping previously allocated with BUS_MAP_RESOURCE(). This may for instance unmap a memory region from the kernel's virtual address space.

Parameters
_devthe parent device of _child
_childthe device which allocated the resource
_typethe type of resource
_rthe resource
_mapthe mapping to release

Definition at line 357 of file bus_if.m.

◆ write_ivar

METHOD int write_ivar
Initial value:
{
device_t _dev

Write the value of a bus-specific attribute of a device.

This method sets the value of an instance variable to _value.

Parameters
_devthe device whose child was being updated
_childthe child device whose instance variable is being written
_indexthe instance variable to write
_valuethe value to write to that instance variable
Return values
0success
ENOENTno such instance variable is supported by _dev
EINVALthe instance variable was recognised but contains a read-only value

Definition at line 166 of file bus_if.m.