xref: /freebsd/sys/kern/bus_if.m (revision db4fcadf52c891afffded7fc72b9d9298bc39e77)
19454b2d8SWarner Losh#-
29f7f340aSWarner Losh# Copyright (c) 1998-2004 Doug Rabson
3b1bf6610SDoug Rabson# All rights reserved.
4b1bf6610SDoug Rabson#
5b1bf6610SDoug Rabson# Redistribution and use in source and binary forms, with or without
6b1bf6610SDoug Rabson# modification, are permitted provided that the following conditions
7b1bf6610SDoug Rabson# are met:
8b1bf6610SDoug Rabson# 1. Redistributions of source code must retain the above copyright
9b1bf6610SDoug Rabson#    notice, this list of conditions and the following disclaimer.
10b1bf6610SDoug Rabson# 2. Redistributions in binary form must reproduce the above copyright
11b1bf6610SDoug Rabson#    notice, this list of conditions and the following disclaimer in the
12b1bf6610SDoug Rabson#    documentation and/or other materials provided with the distribution.
13b1bf6610SDoug Rabson#
14b1bf6610SDoug Rabson# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15b1bf6610SDoug Rabson# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16b1bf6610SDoug Rabson# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17b1bf6610SDoug Rabson# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18b1bf6610SDoug Rabson# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19b1bf6610SDoug Rabson# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20b1bf6610SDoug Rabson# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21b1bf6610SDoug Rabson# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22b1bf6610SDoug Rabson# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23b1bf6610SDoug Rabson# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24b1bf6610SDoug Rabson# SUCH DAMAGE.
25b1bf6610SDoug Rabson#
26c3aac50fSPeter Wemm# $FreeBSD$
27b1bf6610SDoug Rabson#
28b1bf6610SDoug Rabson
29b7d28b2eSAndriy Gapon#include <sys/types.h>
30b7d28b2eSAndriy Gapon#include <sys/systm.h>
31f7b77691SDoug Rabson#include <sys/bus.h>
32f7b77691SDoug Rabson
334c4392e7SDoug Rabson/**
344c4392e7SDoug Rabson * @defgroup BUS bus - KObj methods for drivers of devices with children
354c4392e7SDoug Rabson * @brief A set of methods required device drivers that support
364c4392e7SDoug Rabson * child devices.
374c4392e7SDoug Rabson * @{
384c4392e7SDoug Rabson */
3931a7daaeSNicolas SouchuINTERFACE bus;
40b1bf6610SDoug Rabson
41b1bf6610SDoug Rabson#
428b2970bbSDoug Rabson# Default implementations of some methods.
438b2970bbSDoug Rabson#
448b2970bbSDoug RabsonCODE {
458b2970bbSDoug Rabson	static struct resource *
468b2970bbSDoug Rabson	null_alloc_resource(device_t dev, device_t child,
472dd1bdf1SJustin Hibbits	    int type, int *rid, rman_res_t start, rman_res_t end,
482dd1bdf1SJustin Hibbits	    rman_res_t count, u_int flags)
498b2970bbSDoug Rabson	{
505878eb3fSWarner Losh	    return (0);
518b2970bbSDoug Rabson	}
5293fc07b4SAlexander Motin
5393fc07b4SAlexander Motin	static int
5493fc07b4SAlexander Motin	null_remap_intr(device_t bus, device_t dev, u_int irq)
5593fc07b4SAlexander Motin	{
5693fc07b4SAlexander Motin
5793fc07b4SAlexander Motin		if (dev != NULL)
5893fc07b4SAlexander Motin			return (BUS_REMAP_INTR(dev, NULL, irq));
5993fc07b4SAlexander Motin		return (ENXIO);
6093fc07b4SAlexander Motin	}
61b7d28b2eSAndriy Gapon
62b7d28b2eSAndriy Gapon	static device_t
63b7d28b2eSAndriy Gapon	null_add_child(device_t bus, int order, const char *name,
64b7d28b2eSAndriy Gapon	    int unit)
65b7d28b2eSAndriy Gapon	{
66b7d28b2eSAndriy Gapon
67b7d28b2eSAndriy Gapon		panic("bus_add_child is not implemented");
68b7d28b2eSAndriy Gapon	}
698b2970bbSDoug Rabson};
708b2970bbSDoug Rabson
714c4392e7SDoug Rabson/**
724c4392e7SDoug Rabson * @brief Print a description of a child device
734c4392e7SDoug Rabson *
744c4392e7SDoug Rabson * This is called from system code which prints out a description of a
754c4392e7SDoug Rabson * device. It should describe the attachment that the child has with
764c4392e7SDoug Rabson * the parent. For instance the TurboLaser bus prints which node the
774c4392e7SDoug Rabson * device is attached to. See bus_generic_print_child() for more
784c4392e7SDoug Rabson * information.
794c4392e7SDoug Rabson *
804c4392e7SDoug Rabson * @param _dev		the device whose child is being printed
814c4392e7SDoug Rabson * @param _child	the child device to describe
824c4392e7SDoug Rabson *
834c4392e7SDoug Rabson * @returns		the number of characters output.
844c4392e7SDoug Rabson */
8515317dd8SMatthew N. DoddMETHOD int print_child {
864c4392e7SDoug Rabson	device_t _dev;
874c4392e7SDoug Rabson	device_t _child;
88c8440669SMatthew N. Dodd} DEFAULT bus_generic_print_child;
89b1bf6610SDoug Rabson
904c4392e7SDoug Rabson/**
914c4392e7SDoug Rabson * @brief Print a notification about an unprobed child device.
924c4392e7SDoug Rabson *
934c4392e7SDoug Rabson * Called for each child device that did not succeed in probing for a
944c4392e7SDoug Rabson * driver.
954c4392e7SDoug Rabson *
964c4392e7SDoug Rabson * @param _dev		the device whose child was being probed
974c4392e7SDoug Rabson * @param _child	the child device which failed to probe
984c4392e7SDoug Rabson */
99ca7036d8SDoug RabsonMETHOD void probe_nomatch {
1004c4392e7SDoug Rabson        device_t _dev;
1014c4392e7SDoug Rabson        device_t _child;
102ca7036d8SDoug Rabson};
103ca7036d8SDoug Rabson
1044c4392e7SDoug Rabson/**
1054c4392e7SDoug Rabson * @brief Read the value of a bus-specific attribute of a device
1064c4392e7SDoug Rabson *
1074c4392e7SDoug Rabson * This method, along with BUS_WRITE_IVAR() manages a bus-specific set
1084c4392e7SDoug Rabson * of instance variables of a child device.  The intention is that
1094c4392e7SDoug Rabson * each different type of bus defines a set of appropriate instance
1104c4392e7SDoug Rabson * variables (such as ports and irqs for ISA bus etc.)
1114c4392e7SDoug Rabson *
1124c4392e7SDoug Rabson * This information could be given to the child device as a struct but
1134c4392e7SDoug Rabson * that makes it hard for a bus to add or remove variables without
1144c4392e7SDoug Rabson * forcing an edit and recompile for all drivers which may not be
1154c4392e7SDoug Rabson * possible for vendor supplied binary drivers.
1164c4392e7SDoug Rabson *
1174c4392e7SDoug Rabson * This method copies the value of an instance variable to the
1184c4392e7SDoug Rabson * location specified by @p *_result.
1194c4392e7SDoug Rabson *
1204c4392e7SDoug Rabson * @param _dev		the device whose child was being examined
1214c4392e7SDoug Rabson * @param _child	the child device whose instance variable is
1224c4392e7SDoug Rabson *			being read
1234c4392e7SDoug Rabson * @param _index	the instance variable to read
124e3043798SPedro F. Giffuni * @param _result	a location to receive the instance variable
1254c4392e7SDoug Rabson *			value
1264c4392e7SDoug Rabson *
1274c4392e7SDoug Rabson * @retval 0		success
1284c4392e7SDoug Rabson * @retval ENOENT	no such instance variable is supported by @p
1294c4392e7SDoug Rabson *			_dev
1304c4392e7SDoug Rabson */
131b1bf6610SDoug RabsonMETHOD int read_ivar {
132bd418641SMark Murray	device_t _dev;
133bd418641SMark Murray	device_t _child;
1344c4392e7SDoug Rabson	int _index;
135bd418641SMark Murray	uintptr_t *_result;
136b1bf6610SDoug Rabson};
137b1bf6610SDoug Rabson
1384c4392e7SDoug Rabson/**
1394c4392e7SDoug Rabson * @brief Write the value of a bus-specific attribute of a device
1404c4392e7SDoug Rabson *
1414c4392e7SDoug Rabson * This method sets the value of an instance variable to @p _value.
1424c4392e7SDoug Rabson *
1434c4392e7SDoug Rabson * @param _dev		the device whose child was being updated
1444c4392e7SDoug Rabson * @param _child	the child device whose instance variable is
1454c4392e7SDoug Rabson *			being written
1464c4392e7SDoug Rabson * @param _index	the instance variable to write
1474c4392e7SDoug Rabson * @param _value	the value to write to that instance variable
1484c4392e7SDoug Rabson *
1494c4392e7SDoug Rabson * @retval 0		success
1504c4392e7SDoug Rabson * @retval ENOENT	no such instance variable is supported by @p
1514c4392e7SDoug Rabson *			_dev
1524c4392e7SDoug Rabson * @retval EINVAL	the instance variable was recognised but
1534c4392e7SDoug Rabson *			contains a read-only value
1544c4392e7SDoug Rabson */
155b1bf6610SDoug RabsonMETHOD int write_ivar {
156bd418641SMark Murray	device_t _dev;
157bd418641SMark Murray	device_t _child;
158bd418641SMark Murray	int _indx;
159bd418641SMark Murray	uintptr_t _value;
160b1bf6610SDoug Rabson};
161b1bf6610SDoug Rabson
1624c4392e7SDoug Rabson/**
1636f7d0018SJohn Baldwin * @brief Notify a bus that a child was deleted
1646f7d0018SJohn Baldwin *
1656f7d0018SJohn Baldwin * Called at the beginning of device_delete_child() to allow the parent
1666f7d0018SJohn Baldwin * to teardown any bus-specific state for the child.
1676f7d0018SJohn Baldwin *
1686f7d0018SJohn Baldwin * @param _dev		the device whose child is being deleted
1696f7d0018SJohn Baldwin * @param _child	the child device which is being deleted
1706f7d0018SJohn Baldwin */
1716f7d0018SJohn BaldwinMETHOD void child_deleted {
1726f7d0018SJohn Baldwin	device_t _dev;
1736f7d0018SJohn Baldwin	device_t _child;
1746f7d0018SJohn Baldwin};
1756f7d0018SJohn Baldwin
1766f7d0018SJohn Baldwin/**
1774c4392e7SDoug Rabson * @brief Notify a bus that a child was detached
1784c4392e7SDoug Rabson *
1794c4392e7SDoug Rabson * Called after the child's DEVICE_DETACH() method to allow the parent
1804c4392e7SDoug Rabson * to reclaim any resources allocated on behalf of the child.
1814c4392e7SDoug Rabson *
1824c4392e7SDoug Rabson * @param _dev		the device whose child changed state
1834c4392e7SDoug Rabson * @param _child	the child device which changed state
1844c4392e7SDoug Rabson */
1856350e58aSDoug RabsonMETHOD void child_detached {
186bd418641SMark Murray	device_t _dev;
187bd418641SMark Murray	device_t _child;
1886350e58aSDoug Rabson};
1896350e58aSDoug Rabson
1904c4392e7SDoug Rabson/**
1914c4392e7SDoug Rabson * @brief Notify a bus that a new driver was added
1924c4392e7SDoug Rabson *
1934c4392e7SDoug Rabson * Called when a new driver is added to the devclass which owns this
1944c4392e7SDoug Rabson * bus. The generic implementation of this method attempts to probe and
1954c4392e7SDoug Rabson * attach any un-matched children of the bus.
1964c4392e7SDoug Rabson *
1974c4392e7SDoug Rabson * @param _dev		the device whose devclass had a new driver
1984c4392e7SDoug Rabson *			added to it
1994c4392e7SDoug Rabson * @param _driver	the new driver which was added
2004c4392e7SDoug Rabson */
2016182fdbdSPeter WemmMETHOD void driver_added {
202bd418641SMark Murray	device_t _dev;
203bd418641SMark Murray	driver_t *_driver;
2046d4d0ac9SWarner Losh} DEFAULT bus_generic_driver_added;
2056182fdbdSPeter Wemm
2064c4392e7SDoug Rabson/**
2074c4392e7SDoug Rabson * @brief Create a new child device
2084c4392e7SDoug Rabson *
209*db4fcadfSConrad Meyer * For buses which use use drivers supporting DEVICE_IDENTIFY() to
2104c4392e7SDoug Rabson * enumerate their devices, this method is used to create new
2114c4392e7SDoug Rabson * device instances. The new device will be added after the last
21283a283cfSWarner Losh * existing child with the same order. Implementations of bus_add_child
21383a283cfSWarner Losh * call device_add_child_ordered to add the child and often add
21483a283cfSWarner Losh * a suitable ivar to the device specific to that bus.
2154c4392e7SDoug Rabson *
2164c4392e7SDoug Rabson * @param _dev		the bus device which will be the parent of the
2174c4392e7SDoug Rabson *			new child device
2184c4392e7SDoug Rabson * @param _order	a value which is used to partially sort the
2194c4392e7SDoug Rabson *			children of @p _dev - devices created using
2204c4392e7SDoug Rabson *			lower values of @p _order appear first in @p
2214c4392e7SDoug Rabson *			_dev's list of children
2224c4392e7SDoug Rabson * @param _name		devclass name for new device or @c NULL if not
2234c4392e7SDoug Rabson *			specified
2244c4392e7SDoug Rabson * @param _unit		unit number for new device or @c -1 if not
2254c4392e7SDoug Rabson *			specified
2264c4392e7SDoug Rabson */
2276c2e3ddeSDoug RabsonMETHOD device_t add_child {
228bd418641SMark Murray	device_t _dev;
2293d844eddSAndriy Gapon	u_int _order;
230bd418641SMark Murray	const char *_name;
231bd418641SMark Murray	int _unit;
232b7d28b2eSAndriy Gapon} DEFAULT null_add_child;
2336c2e3ddeSDoug Rabson
2344c4392e7SDoug Rabson/**
235a907c691SJohn Baldwin * @brief Rescan the bus
236a907c691SJohn Baldwin *
237a907c691SJohn Baldwin * This method is called by a parent bridge or devctl to trigger a bus
238a907c691SJohn Baldwin * rescan.  The rescan should delete devices no longer present and
239a907c691SJohn Baldwin * enumerate devices that have newly arrived.
240a907c691SJohn Baldwin *
241a907c691SJohn Baldwin * @param _dev		the bus device
242a907c691SJohn Baldwin */
243a907c691SJohn BaldwinMETHOD int rescan {
244a907c691SJohn Baldwin	device_t _dev;
245a907c691SJohn Baldwin}
246a907c691SJohn Baldwin
247a907c691SJohn Baldwin/**
2484c4392e7SDoug Rabson * @brief Allocate a system resource
2494c4392e7SDoug Rabson *
2504c4392e7SDoug Rabson * This method is called by child devices of a bus to allocate resources.
2514c4392e7SDoug Rabson * The types are defined in <machine/resource.h>; the meaning of the
2524c4392e7SDoug Rabson * resource-ID field varies from bus to bus (but @p *rid == 0 is always
2534c4392e7SDoug Rabson * valid if the resource type is). If a resource was allocated and the
2544c4392e7SDoug Rabson * caller did not use the RF_ACTIVE to specify that it should be
2554c4392e7SDoug Rabson * activated immediately, the caller is responsible for calling
2564c4392e7SDoug Rabson * BUS_ACTIVATE_RESOURCE() when it actually uses the resource.
2574c4392e7SDoug Rabson *
2584c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
2594c4392e7SDoug Rabson * @param _child	the device which is requesting an allocation
2604c4392e7SDoug Rabson * @param _type		the type of resource to allocate
2614c4392e7SDoug Rabson * @param _rid		a pointer to the resource identifier
2624c4392e7SDoug Rabson * @param _start	hint at the start of the resource range - pass
263534ccd7bSJustin Hibbits *			@c 0 for any start address
2644c4392e7SDoug Rabson * @param _end		hint at the end of the resource range - pass
265534ccd7bSJustin Hibbits *			@c ~0 for any end address
2664c4392e7SDoug Rabson * @param _count	hint at the size of range required - pass @c 1
2674c4392e7SDoug Rabson *			for any size
2684c4392e7SDoug Rabson * @param _flags	any extra flags to control the resource
2694c4392e7SDoug Rabson *			allocation - see @c RF_XXX flags in
2704c4392e7SDoug Rabson *			<sys/rman.h> for details
2714c4392e7SDoug Rabson *
2724c4392e7SDoug Rabson * @returns		the resource which was allocated or @c NULL if no
2734c4392e7SDoug Rabson *			resource could be allocated
2744c4392e7SDoug Rabson */
27514177d72SGarrett WollmanMETHOD struct resource * alloc_resource {
276bd418641SMark Murray	device_t	_dev;
277bd418641SMark Murray	device_t	_child;
278bd418641SMark Murray	int		_type;
279bd418641SMark Murray	int	       *_rid;
2802dd1bdf1SJustin Hibbits	rman_res_t	_start;
2812dd1bdf1SJustin Hibbits	rman_res_t	_end;
2822dd1bdf1SJustin Hibbits	rman_res_t	_count;
283bd418641SMark Murray	u_int		_flags;
2848b2970bbSDoug Rabson} DEFAULT null_alloc_resource;
28514177d72SGarrett Wollman
2864c4392e7SDoug Rabson/**
2874c4392e7SDoug Rabson * @brief Activate a resource
2884c4392e7SDoug Rabson *
2894c4392e7SDoug Rabson * Activate a resource previously allocated with
290cc981af2SJohn Baldwin * BUS_ALLOC_RESOURCE().  This may enable decoding of this resource in a
291cc981af2SJohn Baldwin * device for instance.  It will also establish a mapping for the resource
292cc981af2SJohn Baldwin * unless RF_UNMAPPED was set when allocating the resource.
2934c4392e7SDoug Rabson *
2944c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
2954c4392e7SDoug Rabson * @param _child	the device which allocated the resource
2964c4392e7SDoug Rabson * @param _type		the type of resource
2974c4392e7SDoug Rabson * @param _rid		the resource identifier
2984c4392e7SDoug Rabson * @param _r		the resource to activate
2994c4392e7SDoug Rabson */
30014177d72SGarrett WollmanMETHOD int activate_resource {
301bd418641SMark Murray	device_t	_dev;
302bd418641SMark Murray	device_t	_child;
303bd418641SMark Murray	int		_type;
304bd418641SMark Murray	int		_rid;
305bd418641SMark Murray	struct resource *_r;
30614177d72SGarrett Wollman};
30714177d72SGarrett Wollman
308cc981af2SJohn Baldwin
309cc981af2SJohn Baldwin/**
310cc981af2SJohn Baldwin * @brief Map a resource
311cc981af2SJohn Baldwin *
312cc981af2SJohn Baldwin * Allocate a mapping for a range of an active resource.  The mapping
313cc981af2SJohn Baldwin * is described by a struct resource_map object.  This may for instance
314cc981af2SJohn Baldwin * map a memory region into the kernel's virtual address space.
315cc981af2SJohn Baldwin *
316cc981af2SJohn Baldwin * @param _dev		the parent device of @p _child
317cc981af2SJohn Baldwin * @param _child	the device which allocated the resource
318cc981af2SJohn Baldwin * @param _type		the type of resource
319cc981af2SJohn Baldwin * @param _r		the resource to map
320cc981af2SJohn Baldwin * @param _args		optional attributes of the mapping
321cc981af2SJohn Baldwin * @param _map		the mapping
322cc981af2SJohn Baldwin */
323cc981af2SJohn BaldwinMETHOD int map_resource {
324cc981af2SJohn Baldwin	device_t	_dev;
325cc981af2SJohn Baldwin	device_t	_child;
326cc981af2SJohn Baldwin	int		_type;
327cc981af2SJohn Baldwin	struct resource *_r;
328cc981af2SJohn Baldwin	struct resource_map_request *_args;
329cc981af2SJohn Baldwin	struct resource_map *_map;
330cc981af2SJohn Baldwin} DEFAULT bus_generic_map_resource;
331cc981af2SJohn Baldwin
332cc981af2SJohn Baldwin
333cc981af2SJohn Baldwin/**
334cc981af2SJohn Baldwin * @brief Unmap a resource
335cc981af2SJohn Baldwin *
336cc981af2SJohn Baldwin * Release a mapping previously allocated with
337cc981af2SJohn Baldwin * BUS_MAP_RESOURCE(). This may for instance unmap a memory region
338cc981af2SJohn Baldwin * from the kernel's virtual address space.
339cc981af2SJohn Baldwin *
340cc981af2SJohn Baldwin * @param _dev		the parent device of @p _child
341cc981af2SJohn Baldwin * @param _child	the device which allocated the resource
342cc981af2SJohn Baldwin * @param _type		the type of resource
343cc981af2SJohn Baldwin * @param _r		the resource
344cc981af2SJohn Baldwin * @param _map		the mapping to release
345cc981af2SJohn Baldwin */
346cc981af2SJohn BaldwinMETHOD int unmap_resource {
347cc981af2SJohn Baldwin	device_t	_dev;
348cc981af2SJohn Baldwin	device_t	_child;
349cc981af2SJohn Baldwin	int		_type;
350cc981af2SJohn Baldwin	struct resource *_r;
351cc981af2SJohn Baldwin	struct resource_map *_map;
352cc981af2SJohn Baldwin} DEFAULT bus_generic_unmap_resource;
353cc981af2SJohn Baldwin
354cc981af2SJohn Baldwin
3554c4392e7SDoug Rabson/**
3564c4392e7SDoug Rabson * @brief Deactivate a resource
3574c4392e7SDoug Rabson *
3584c4392e7SDoug Rabson * Deactivate a resource previously allocated with
359cc981af2SJohn Baldwin * BUS_ALLOC_RESOURCE().
3604c4392e7SDoug Rabson *
3614c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
3624c4392e7SDoug Rabson * @param _child	the device which allocated the resource
3634c4392e7SDoug Rabson * @param _type		the type of resource
3644c4392e7SDoug Rabson * @param _rid		the resource identifier
3654c4392e7SDoug Rabson * @param _r		the resource to deactivate
3664c4392e7SDoug Rabson */
36714177d72SGarrett WollmanMETHOD int deactivate_resource {
368bd418641SMark Murray	device_t	_dev;
369bd418641SMark Murray	device_t	_child;
370bd418641SMark Murray	int		_type;
371bd418641SMark Murray	int		_rid;
372bd418641SMark Murray	struct resource *_r;
373b1bf6610SDoug Rabson};
37445c95fa1SDoug Rabson
3754c4392e7SDoug Rabson/**
37685ee63c9SJohn Baldwin * @brief Adjust a resource
37785ee63c9SJohn Baldwin *
37885ee63c9SJohn Baldwin * Adjust the start and/or end of a resource allocated by
37985ee63c9SJohn Baldwin * BUS_ALLOC_RESOURCE.  At least part of the new address range must overlap
38085ee63c9SJohn Baldwin * with the existing address range.  If the successful, the resource's range
38185ee63c9SJohn Baldwin * will be adjusted to [start, end] on return.
38285ee63c9SJohn Baldwin *
38385ee63c9SJohn Baldwin * @param _dev		the parent device of @p _child
38485ee63c9SJohn Baldwin * @param _child	the device which allocated the resource
38585ee63c9SJohn Baldwin * @param _type		the type of resource
38685ee63c9SJohn Baldwin * @param _res		the resource to adjust
38785ee63c9SJohn Baldwin * @param _start	the new starting address of the resource range
38885ee63c9SJohn Baldwin * @param _end		the new ending address of the resource range
38985ee63c9SJohn Baldwin */
39085ee63c9SJohn BaldwinMETHOD int adjust_resource {
39185ee63c9SJohn Baldwin	device_t	_dev;
39285ee63c9SJohn Baldwin	device_t	_child;
39385ee63c9SJohn Baldwin	int		_type;
39485ee63c9SJohn Baldwin	struct resource *_res;
3952dd1bdf1SJustin Hibbits	rman_res_t	_start;
3962dd1bdf1SJustin Hibbits	rman_res_t	_end;
39785ee63c9SJohn Baldwin};
39885ee63c9SJohn Baldwin
39985ee63c9SJohn Baldwin/**
4004c4392e7SDoug Rabson * @brief Release a resource
4014c4392e7SDoug Rabson *
4024c4392e7SDoug Rabson * Free a resource allocated by the BUS_ALLOC_RESOURCE.  The @p _rid
4034c4392e7SDoug Rabson * value must be the same as the one returned by BUS_ALLOC_RESOURCE()
4044c4392e7SDoug Rabson * (which is not necessarily the same as the one the client passed).
4054c4392e7SDoug Rabson *
4064c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
4074c4392e7SDoug Rabson * @param _child	the device which allocated the resource
4084c4392e7SDoug Rabson * @param _type		the type of resource
4094c4392e7SDoug Rabson * @param _rid		the resource identifier
4104c4392e7SDoug Rabson * @param _r		the resource to release
4114c4392e7SDoug Rabson */
41214177d72SGarrett WollmanMETHOD int release_resource {
413bd418641SMark Murray	device_t	_dev;
414bd418641SMark Murray	device_t	_child;
415bd418641SMark Murray	int		_type;
416bd418641SMark Murray	int		_rid;
417bd418641SMark Murray	struct resource *_res;
41814177d72SGarrett Wollman};
41914177d72SGarrett Wollman
4204c4392e7SDoug Rabson/**
4214c4392e7SDoug Rabson * @brief Install an interrupt handler
4224c4392e7SDoug Rabson *
4234c4392e7SDoug Rabson * This method is used to associate an interrupt handler function with
4244c4392e7SDoug Rabson * an irq resource. When the interrupt triggers, the function @p _intr
4254c4392e7SDoug Rabson * will be called with the value of @p _arg as its single
4264c4392e7SDoug Rabson * argument. The value returned in @p *_cookiep is used to cancel the
4274c4392e7SDoug Rabson * interrupt handler - the caller should save this value to use in a
4284c4392e7SDoug Rabson * future call to BUS_TEARDOWN_INTR().
4294c4392e7SDoug Rabson *
4304c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
4314c4392e7SDoug Rabson * @param _child	the device which allocated the resource
4324c4392e7SDoug Rabson * @param _irq		the resource representing the interrupt
4334c4392e7SDoug Rabson * @param _flags	a set of bits from enum intr_type specifying
4344c4392e7SDoug Rabson *			the class of interrupt
4354c4392e7SDoug Rabson * @param _intr		the function to call when the interrupt
4364c4392e7SDoug Rabson *			triggers
4374c4392e7SDoug Rabson * @param _arg		a value to use as the single argument in calls
4384c4392e7SDoug Rabson *			to @p _intr
439e3043798SPedro F. Giffuni * @param _cookiep	a pointer to a location to receive a cookie
4404c4392e7SDoug Rabson *			value that may be used to remove the interrupt
4414c4392e7SDoug Rabson *			handler
4424c4392e7SDoug Rabson */
44314177d72SGarrett WollmanMETHOD int setup_intr {
444bd418641SMark Murray	device_t	_dev;
445bd418641SMark Murray	device_t	_child;
446bd418641SMark Murray	struct resource *_irq;
447bd418641SMark Murray	int		_flags;
448ef544f63SPaolo Pisati	driver_filter_t	*_filter;
449bd418641SMark Murray	driver_intr_t	*_intr;
450bd418641SMark Murray	void		*_arg;
451bd418641SMark Murray	void		**_cookiep;
45214177d72SGarrett Wollman};
45314177d72SGarrett Wollman
4544c4392e7SDoug Rabson/**
4554c4392e7SDoug Rabson * @brief Uninstall an interrupt handler
4564c4392e7SDoug Rabson *
4574c4392e7SDoug Rabson * This method is used to disassociate an interrupt handler function
4584c4392e7SDoug Rabson * with an irq resource. The value of @p _cookie must be the value
4594c4392e7SDoug Rabson * returned from a previous call to BUS_SETUP_INTR().
4604c4392e7SDoug Rabson *
4614c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
4624c4392e7SDoug Rabson * @param _child	the device which allocated the resource
4634c4392e7SDoug Rabson * @param _irq		the resource representing the interrupt
4644c4392e7SDoug Rabson * @param _cookie	the cookie value returned when the interrupt
4654c4392e7SDoug Rabson *			was originally registered
4664c4392e7SDoug Rabson */
46714177d72SGarrett WollmanMETHOD int teardown_intr {
468bd418641SMark Murray	device_t	_dev;
469bd418641SMark Murray	device_t	_child;
470bd418641SMark Murray	struct resource	*_irq;
471bd418641SMark Murray	void		*_cookie;
47245c95fa1SDoug Rabson};
47325afb89bSDoug Rabson
4744c4392e7SDoug Rabson/**
4754c4392e7SDoug Rabson * @brief Define a resource which can be allocated with
4764c4392e7SDoug Rabson * BUS_ALLOC_RESOURCE().
4774c4392e7SDoug Rabson *
478*db4fcadfSConrad Meyer * This method is used by some buses (typically ISA) to allow a
4794c4392e7SDoug Rabson * driver to describe a resource range that it would like to
4804c4392e7SDoug Rabson * allocate. The resource defined by @p _type and @p _rid is defined
4814c4392e7SDoug Rabson * to start at @p _start and to include @p _count indices in its
4824c4392e7SDoug Rabson * range.
4834c4392e7SDoug Rabson *
4844c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
4854c4392e7SDoug Rabson * @param _child	the device which owns the resource
4864c4392e7SDoug Rabson * @param _type		the type of resource
4874c4392e7SDoug Rabson * @param _rid		the resource identifier
4884c4392e7SDoug Rabson * @param _start	the start of the resource range
4894c4392e7SDoug Rabson * @param _count	the size of the resource range
4904c4392e7SDoug Rabson */
49125afb89bSDoug RabsonMETHOD int set_resource {
492bd418641SMark Murray	device_t	_dev;
493bd418641SMark Murray	device_t	_child;
494bd418641SMark Murray	int		_type;
495bd418641SMark Murray	int		_rid;
4962dd1bdf1SJustin Hibbits	rman_res_t	_start;
4972dd1bdf1SJustin Hibbits	rman_res_t	_count;
49825afb89bSDoug Rabson};
49925afb89bSDoug Rabson
5004c4392e7SDoug Rabson/**
5014c4392e7SDoug Rabson * @brief Describe a resource
5024c4392e7SDoug Rabson *
5034c4392e7SDoug Rabson * This method allows a driver to examine the range used for a given
5044c4392e7SDoug Rabson * resource without actually allocating it.
5054c4392e7SDoug Rabson *
5064c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
5074c4392e7SDoug Rabson * @param _child	the device which owns the resource
5084c4392e7SDoug Rabson * @param _type		the type of resource
5094c4392e7SDoug Rabson * @param _rid		the resource identifier
510e3043798SPedro F. Giffuni * @param _start	the address of a location to receive the start
5114c4392e7SDoug Rabson *			index of the resource range
512e3043798SPedro F. Giffuni * @param _count	the address of a location to receive the size
5134c4392e7SDoug Rabson *			of the resource range
5144c4392e7SDoug Rabson */
51525afb89bSDoug RabsonMETHOD int get_resource {
516bd418641SMark Murray	device_t	_dev;
517bd418641SMark Murray	device_t	_child;
518bd418641SMark Murray	int		_type;
519bd418641SMark Murray	int		_rid;
5202dd1bdf1SJustin Hibbits	rman_res_t	*_startp;
5212dd1bdf1SJustin Hibbits	rman_res_t	*_countp;
52225afb89bSDoug Rabson};
52325afb89bSDoug Rabson
5244c4392e7SDoug Rabson/**
5254c4392e7SDoug Rabson * @brief Delete a resource.
5264c4392e7SDoug Rabson *
5274c4392e7SDoug Rabson * Use this to delete a resource (possibly one previously added with
5284c4392e7SDoug Rabson * BUS_SET_RESOURCE()).
5294c4392e7SDoug Rabson *
5304c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
5314c4392e7SDoug Rabson * @param _child	the device which owns the resource
5324c4392e7SDoug Rabson * @param _type		the type of resource
5334c4392e7SDoug Rabson * @param _rid		the resource identifier
5344c4392e7SDoug Rabson */
53525afb89bSDoug RabsonMETHOD void delete_resource {
536bd418641SMark Murray	device_t	_dev;
537bd418641SMark Murray	device_t	_child;
538bd418641SMark Murray	int		_type;
539bd418641SMark Murray	int		_rid;
54025afb89bSDoug Rabson};
5410cb53e24SMatthew N. Dodd
5424c4392e7SDoug Rabson/**
5434c4392e7SDoug Rabson * @brief Return a struct resource_list.
5444c4392e7SDoug Rabson *
5454c4392e7SDoug Rabson * Used by drivers which use bus_generic_rl_alloc_resource() etc. to
5464c4392e7SDoug Rabson * implement their resource handling. It should return the resource
5474c4392e7SDoug Rabson * list of the given child device.
5484c4392e7SDoug Rabson *
5494c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
5504c4392e7SDoug Rabson * @param _child	the device which owns the resource list
5514c4392e7SDoug Rabson */
55246aa504eSMatthew N. DoddMETHOD struct resource_list * get_resource_list {
553bd418641SMark Murray	device_t	_dev;
554bd418641SMark Murray	device_t	_child;
5550cb53e24SMatthew N. Dodd} DEFAULT bus_generic_get_resource_list;
5565878eb3fSWarner Losh
5574c4392e7SDoug Rabson/**
5584c4392e7SDoug Rabson * @brief Is the hardware described by @p _child still attached to the
5594c4392e7SDoug Rabson * system?
5604c4392e7SDoug Rabson *
5619f7f340aSWarner Losh * This method should return 0 if the device is not present.  It
5629f7f340aSWarner Losh * should return -1 if it is present.  Any errors in determining
5639f7f340aSWarner Losh * should be returned as a normal errno value.  Client drivers are to
5649f7f340aSWarner Losh * assume that the device is present, even if there is an error
565*db4fcadfSConrad Meyer * determining if it is there.  Buses are to try to avoid returning
5669f7f340aSWarner Losh * errors, but newcard will return an error if the device fails to
5679f7f340aSWarner Losh * implement this method.
5684c4392e7SDoug Rabson *
5694c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
5704c4392e7SDoug Rabson * @param _child	the device which is being examined
5714c4392e7SDoug Rabson */
5725878eb3fSWarner LoshMETHOD int child_present {
5735878eb3fSWarner Losh	device_t	_dev;
5745878eb3fSWarner Losh	device_t	_child;
5755878eb3fSWarner Losh} DEFAULT bus_generic_child_present;
5763d9841b4SWarner Losh
5774c4392e7SDoug Rabson/**
5784c4392e7SDoug Rabson * @brief Returns the pnp info for this device.
5794c4392e7SDoug Rabson *
58008907ec3SRavi Pokala * Return it as a string.  If the storage is insufficient for the
58108907ec3SRavi Pokala * string, then return EOVERFLOW.
5824c4392e7SDoug Rabson *
583ed7ed7f0SJohn Baldwin * The string must be formatted as a space-separated list of
584ed7ed7f0SJohn Baldwin * name=value pairs.  Names may only contain alphanumeric characters,
585ed7ed7f0SJohn Baldwin * underscores ('_') and hyphens ('-').  Values can contain any
586ed7ed7f0SJohn Baldwin * non-whitespace characters.  Values containing whitespace can be
587ed7ed7f0SJohn Baldwin * quoted with double quotes ('"').  Double quotes and backslashes in
588ed7ed7f0SJohn Baldwin * quoted values can be escaped with backslashes ('\').
589ed7ed7f0SJohn Baldwin *
5904c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
5914c4392e7SDoug Rabson * @param _child	the device which is being examined
5924c4392e7SDoug Rabson * @param _buf		the address of a buffer to receive the pnp
5934c4392e7SDoug Rabson *			string
5944c4392e7SDoug Rabson * @param _buflen	the size of the buffer pointed to by @p _buf
5954c4392e7SDoug Rabson */
5963d9841b4SWarner LoshMETHOD int child_pnpinfo_str {
5973d9841b4SWarner Losh	device_t	_dev;
5983d9841b4SWarner Losh	device_t	_child;
5993d9841b4SWarner Losh	char		*_buf;
6003d9841b4SWarner Losh	size_t		_buflen;
6013d9841b4SWarner Losh};
6023d9841b4SWarner Losh
6034c4392e7SDoug Rabson/**
6044c4392e7SDoug Rabson * @brief Returns the location for this device.
6054c4392e7SDoug Rabson *
60608907ec3SRavi Pokala * Return it as a string.  If the storage is insufficient for the
60708907ec3SRavi Pokala * string, then return EOVERFLOW.
6084c4392e7SDoug Rabson *
609ed7ed7f0SJohn Baldwin * The string must be formatted as a space-separated list of
610ed7ed7f0SJohn Baldwin * name=value pairs.  Names may only contain alphanumeric characters,
611ed7ed7f0SJohn Baldwin * underscores ('_') and hyphens ('-').  Values can contain any
612ed7ed7f0SJohn Baldwin * non-whitespace characters.  Values containing whitespace can be
613ed7ed7f0SJohn Baldwin * quoted with double quotes ('"').  Double quotes and backslashes in
614ed7ed7f0SJohn Baldwin * quoted values can be escaped with backslashes ('\').
615ed7ed7f0SJohn Baldwin *
6164c4392e7SDoug Rabson * @param _dev		the parent device of @p _child
6174c4392e7SDoug Rabson * @param _child	the device which is being examined
6184c4392e7SDoug Rabson * @param _buf		the address of a buffer to receive the location
6194c4392e7SDoug Rabson *			string
6204c4392e7SDoug Rabson * @param _buflen	the size of the buffer pointed to by @p _buf
6214c4392e7SDoug Rabson */
6223d9841b4SWarner LoshMETHOD int child_location_str {
6233d9841b4SWarner Losh	device_t	_dev;
6243d9841b4SWarner Losh	device_t	_child;
6253d9841b4SWarner Losh	char		*_buf;
6263d9841b4SWarner Losh	size_t		_buflen;
6273d9841b4SWarner Losh};
628da13b8f9SMarcel Moolenaar
6294c4392e7SDoug Rabson/**
630dcc81068SJohn Baldwin * @brief Allow drivers to request that an interrupt be bound to a specific
631dcc81068SJohn Baldwin * CPU.
632dcc81068SJohn Baldwin *
633dcc81068SJohn Baldwin * @param _dev		the parent device of @p _child
634dcc81068SJohn Baldwin * @param _child	the device which allocated the resource
635dcc81068SJohn Baldwin * @param _irq		the resource representing the interrupt
636dcc81068SJohn Baldwin * @param _cpu		the CPU to bind the interrupt to
637dcc81068SJohn Baldwin */
638dcc81068SJohn BaldwinMETHOD int bind_intr {
639dcc81068SJohn Baldwin	device_t	_dev;
640dcc81068SJohn Baldwin	device_t	_child;
641dcc81068SJohn Baldwin	struct resource *_irq;
642dcc81068SJohn Baldwin	int		_cpu;
643dcc81068SJohn Baldwin} DEFAULT bus_generic_bind_intr;
644dcc81068SJohn Baldwin
645dcc81068SJohn Baldwin/**
6464c4392e7SDoug Rabson * @brief Allow (bus) drivers to specify the trigger mode and polarity
6474c4392e7SDoug Rabson * of the specified interrupt.
6484c4392e7SDoug Rabson *
6494c4392e7SDoug Rabson * @param _dev		the bus device
6504c4392e7SDoug Rabson * @param _irq		the interrupt number to modify
6514c4392e7SDoug Rabson * @param _trig		the trigger mode required
6524c4392e7SDoug Rabson * @param _pol		the interrupt polarity required
6534c4392e7SDoug Rabson */
654da13b8f9SMarcel MoolenaarMETHOD int config_intr {
655da13b8f9SMarcel Moolenaar	device_t	_dev;
656da13b8f9SMarcel Moolenaar	int		_irq;
657da13b8f9SMarcel Moolenaar	enum intr_trigger _trig;
658da13b8f9SMarcel Moolenaar	enum intr_polarity _pol;
659da13b8f9SMarcel Moolenaar} DEFAULT bus_generic_config_intr;
660db2bc1bbSWarner Losh
661db2bc1bbSWarner Losh/**
66237b8ef16SJohn Baldwin * @brief Allow drivers to associate a description with an active
66337b8ef16SJohn Baldwin * interrupt handler.
66437b8ef16SJohn Baldwin *
66537b8ef16SJohn Baldwin * @param _dev		the parent device of @p _child
66637b8ef16SJohn Baldwin * @param _child	the device which allocated the resource
66737b8ef16SJohn Baldwin * @param _irq		the resource representing the interrupt
66837b8ef16SJohn Baldwin * @param _cookie	the cookie value returned when the interrupt
66937b8ef16SJohn Baldwin *			was originally registered
67037b8ef16SJohn Baldwin * @param _descr	the description to associate with the interrupt
67137b8ef16SJohn Baldwin */
67237b8ef16SJohn BaldwinMETHOD int describe_intr {
67337b8ef16SJohn Baldwin	device_t	_dev;
67437b8ef16SJohn Baldwin	device_t	_child;
67537b8ef16SJohn Baldwin	struct resource *_irq;
67637b8ef16SJohn Baldwin	void		*_cookie;
67737b8ef16SJohn Baldwin	const char	*_descr;
67837b8ef16SJohn Baldwin} DEFAULT bus_generic_describe_intr;
67937b8ef16SJohn Baldwin
68037b8ef16SJohn Baldwin/**
681db2bc1bbSWarner Losh * @brief Notify a (bus) driver about a child that the hints mechanism
682db2bc1bbSWarner Losh * believes it has discovered.
683db2bc1bbSWarner Losh *
684db2bc1bbSWarner Losh * The bus is responsible for then adding the child in the right order
685db2bc1bbSWarner Losh * and discovering other things about the child.  The bus driver is
686db2bc1bbSWarner Losh * free to ignore this hint, to do special things, etc.  It is all up
687db2bc1bbSWarner Losh * to the bus driver to interpret.
688db2bc1bbSWarner Losh *
689db2bc1bbSWarner Losh * This method is only called in response to the parent bus asking for
690db2bc1bbSWarner Losh * hinted devices to be enumerated.
691db2bc1bbSWarner Losh *
692db2bc1bbSWarner Losh * @param _dev		the bus device
693db2bc1bbSWarner Losh * @param _dname	the name of the device w/o unit numbers
694db2bc1bbSWarner Losh * @param _dunit	the unit number of the device
695db2bc1bbSWarner Losh */
696db2bc1bbSWarner LoshMETHOD void hinted_child {
697db2bc1bbSWarner Losh	device_t	_dev;
698db2bc1bbSWarner Losh	const char	*_dname;
699db2bc1bbSWarner Losh	int		_dunit;
700db2bc1bbSWarner Losh};
701378f231eSJohn-Mark Gurney
702378f231eSJohn-Mark Gurney/**
703378f231eSJohn-Mark Gurney * @brief Returns bus_dma_tag_t for use w/ devices on the bus.
704378f231eSJohn-Mark Gurney *
705378f231eSJohn-Mark Gurney * @param _dev		the parent device of @p _child
706378f231eSJohn-Mark Gurney * @param _child	the device to which the tag will belong
707378f231eSJohn-Mark Gurney */
708378f231eSJohn-Mark GurneyMETHOD bus_dma_tag_t get_dma_tag {
709378f231eSJohn-Mark Gurney	device_t	_dev;
710378f231eSJohn-Mark Gurney	device_t	_child;
711378f231eSJohn-Mark Gurney} DEFAULT bus_generic_get_dma_tag;
7120d484d24SJohn Baldwin
7130d484d24SJohn Baldwin/**
714b998c965SZbigniew Bodek * @brief Returns bus_space_tag_t for use w/ devices on the bus.
715b998c965SZbigniew Bodek *
716b998c965SZbigniew Bodek * @param _dev		the parent device of @p _child
717b998c965SZbigniew Bodek * @param _child	the device to which the tag will belong
718b998c965SZbigniew Bodek */
719b998c965SZbigniew BodekMETHOD bus_space_tag_t get_bus_tag {
720b998c965SZbigniew Bodek	device_t	_dev;
721b998c965SZbigniew Bodek	device_t	_child;
722b998c965SZbigniew Bodek} DEFAULT bus_generic_get_bus_tag;
723b998c965SZbigniew Bodek
724b998c965SZbigniew Bodek/**
7250d484d24SJohn Baldwin * @brief Allow the bus to determine the unit number of a device.
7260d484d24SJohn Baldwin *
7270d484d24SJohn Baldwin * @param _dev		the parent device of @p _child
7280d484d24SJohn Baldwin * @param _child	the device whose unit is to be wired
7290d484d24SJohn Baldwin * @param _name		the name of the device's new devclass
7300d484d24SJohn Baldwin * @param _unitp	a pointer to the device's new unit value
7310d484d24SJohn Baldwin */
7320d484d24SJohn BaldwinMETHOD void hint_device_unit {
7330d484d24SJohn Baldwin	device_t	_dev;
7340d484d24SJohn Baldwin	device_t	_child;
7350d484d24SJohn Baldwin	const char	*_name;
7360d484d24SJohn Baldwin	int		*_unitp;
7370d484d24SJohn Baldwin};
7380d484d24SJohn Baldwin
7394ef60d26SJohn Baldwin/**
7404ef60d26SJohn Baldwin * @brief Notify a bus that the bus pass level has been changed
7414ef60d26SJohn Baldwin *
7424ef60d26SJohn Baldwin * @param _dev		the bus device
7434ef60d26SJohn Baldwin */
7444ef60d26SJohn BaldwinMETHOD void new_pass {
7454ef60d26SJohn Baldwin	device_t	_dev;
7464ef60d26SJohn Baldwin} DEFAULT bus_generic_new_pass;
74793fc07b4SAlexander Motin
74893fc07b4SAlexander Motin/**
74993fc07b4SAlexander Motin * @brief Notify a bus that specified child's IRQ should be remapped.
75093fc07b4SAlexander Motin *
75193fc07b4SAlexander Motin * @param _dev		the bus device
75293fc07b4SAlexander Motin * @param _child	the child device
75393fc07b4SAlexander Motin * @param _irq		the irq number
75493fc07b4SAlexander Motin */
75593fc07b4SAlexander MotinMETHOD int remap_intr {
75693fc07b4SAlexander Motin	device_t	_dev;
75793fc07b4SAlexander Motin	device_t	_child;
75893fc07b4SAlexander Motin	u_int		_irq;
75993fc07b4SAlexander Motin} DEFAULT null_remap_intr;
760a1c16348SJustin Hibbits
761a1c16348SJustin Hibbits/**
762a1c16348SJustin Hibbits * @brief Suspend a given child
763a1c16348SJustin Hibbits *
764a1c16348SJustin Hibbits * @param _dev		the parent device of @p _child
765a1c16348SJustin Hibbits * @param _child	the device to suspend
766a1c16348SJustin Hibbits */
767a1c16348SJustin HibbitsMETHOD int suspend_child {
768a1c16348SJustin Hibbits	device_t	_dev;
769a1c16348SJustin Hibbits	device_t	_child;
770a1c16348SJustin Hibbits} DEFAULT bus_generic_suspend_child;
771a1c16348SJustin Hibbits
772a1c16348SJustin Hibbits/**
773a1c16348SJustin Hibbits * @brief Resume a given child
774a1c16348SJustin Hibbits *
775a1c16348SJustin Hibbits * @param _dev		the parent device of @p _child
776a1c16348SJustin Hibbits * @param _child	the device to resume
777a1c16348SJustin Hibbits */
778a1c16348SJustin HibbitsMETHOD int resume_child {
779a1c16348SJustin Hibbits	device_t	_dev;
780a1c16348SJustin Hibbits	device_t	_child;
781a1c16348SJustin Hibbits} DEFAULT bus_generic_resume_child;
782ffcf962dSAdrian Chadd
783ffcf962dSAdrian Chadd/**
784ffcf962dSAdrian Chadd * @brief Get the VM domain handle for the given bus and child.
785ffcf962dSAdrian Chadd *
786ffcf962dSAdrian Chadd * @param _dev		the bus device
787ffcf962dSAdrian Chadd * @param _child	the child device
788ffcf962dSAdrian Chadd * @param _domain	a pointer to the bus's domain handle identifier
789ffcf962dSAdrian Chadd */
790ffcf962dSAdrian ChaddMETHOD int get_domain {
791ffcf962dSAdrian Chadd	device_t	_dev;
792ffcf962dSAdrian Chadd	device_t	_child;
793ffcf962dSAdrian Chadd	int		*_domain;
794ffcf962dSAdrian Chadd} DEFAULT bus_generic_get_domain;
7958d791e5aSJohn Baldwin
7968d791e5aSJohn Baldwin/**
7978d791e5aSJohn Baldwin * @brief Request a set of CPUs
7988d791e5aSJohn Baldwin *
7998d791e5aSJohn Baldwin * @param _dev		the bus device
8008d791e5aSJohn Baldwin * @param _child	the child device
8018d791e5aSJohn Baldwin * @param _op		type of CPUs to request
8028d791e5aSJohn Baldwin * @param _setsize	the size of the set passed in _cpuset
8038d791e5aSJohn Baldwin * @param _cpuset	a pointer to a cpuset to receive the requested
8048d791e5aSJohn Baldwin *			set of CPUs
8058d791e5aSJohn Baldwin */
8068d791e5aSJohn BaldwinMETHOD int get_cpus {
8078d791e5aSJohn Baldwin	device_t	_dev;
8088d791e5aSJohn Baldwin	device_t	_child;
8098d791e5aSJohn Baldwin	enum cpu_sets	_op;
8108d791e5aSJohn Baldwin	size_t		_setsize;
8118d791e5aSJohn Baldwin	cpuset_t	*_cpuset;
8128d791e5aSJohn Baldwin} DEFAULT bus_generic_get_cpus;
813