xref: /dragonfly/share/man/man9/bus_set_resource.9 (revision 0ca59c34)
1.\"
2.\" Copyright (c) 2003 M. Warner Losh
3.\"
4.\" All rights reserved.
5.\"
6.\" This program is free software.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.\" $FreeBSD: src/share/man/man9/bus_set_resource.9,v 1.5 2005/06/28 20:15:18 hmp Exp $
29.\"
30.Dd October 4, 2011
31.Dt BUS_SET_RESOURCE 9
32.Os
33.Sh NAME
34.Nm bus_set_resource
35.Nd "associate a definite resource with a given resource ID"
36.Sh SYNOPSIS
37.In sys/param.h
38.In sys/bus.h
39.In sys/rman.h
40.Ft int
41.Fo bus_set_resource
42.Fa "device_t dev" "int type" "int rid" "u_long start" "u_long count" "int cpuid"
43.Fc
44.Sh DESCRIPTION
45The
46.Fn bus_set_resource
47function
48sets the
49.Fa start
50address of the resource
51.Fa type , rid
52pair to be
53.Fa count
54long.
55Typically, client drivers do not use this interface.
56Bus drivers, however, often use it to set up the resources a client driver
57uses.
58.Pp
59The arguments are as follows:
60.Bl -tag -width ".Fa start"
61.It Fa dev
62The device to set the resource on.
63.It Fa type
64The type of resource you want to allocate.
65It is one of:
66.Pp
67.Bl -tag -width ".Dv SYS_RES_MEMORY" -compact
68.It Dv SYS_RES_IRQ
69for IRQs
70.It Dv SYS_RES_DRQ
71for ISA DMA lines
72.It Dv SYS_RES_MEMORY
73for I/O memory
74.It Dv SYS_RES_IOPORT
75for I/O ports
76.El
77.It Fa rid
78A bus-specific handle that identifies the resource being allocated.
79.It Fa start
80The start address of this resource.
81.It Fa count
82The length of the resource.
83For example, the size of the memory in bytes.
84.It Fa cpuid
85Owner CPU for interrupt resources. Other resource types, e.g.
86IOPORT, MEMORY and DRQ, are shared across CPUs, so this parameter
87has to be set to -1
88.El
89.Sh RETURN VALUES
90Zero is returned on success, otherwise an error is returned.
91.Sh SEE ALSO
92.Xr bus_alloc_resource 9 ,
93.Xr bus_get_resource 9 ,
94.Xr device 9 ,
95.Xr driver 9
96.Sh AUTHORS
97This manual page was written by
98.An Warner Losh Aq Mt imp@FreeBSD.org .
99