458678300a054a8d4c9ac688b1e1d5a3f4d78bcf
[dragonfly.git] / share / man / man9 / bus_set_resource.9
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
45 The
46 .Fn bus_set_resource
47 function
48 sets the
49 .Fa start
50 address of the resource
51 .Fa type , rid
52 pair to be
53 .Fa count
54 long.
55 Typically, client drivers do not use this interface.
56 Bus drivers, however, often use it to set up the resources a client driver
57 uses.
58 .Pp
59 The arguments are as follows:
60 .Bl -tag -width ".Fa start"
61 .It Fa dev
62 The device to set the resource on.
63 .It Fa type
64 The type of resource you want to allocate.
65 It is one of:
66 .Pp
67 .Bl -tag -width ".Dv SYS_RES_MEMORY" -compact
68 .It Dv SYS_RES_IRQ
69 for IRQs
70 .It Dv SYS_RES_DRQ
71 for ISA DMA lines
72 .It Dv SYS_RES_MEMORY
73 for I/O memory
74 .It Dv SYS_RES_IOPORT
75 for I/O ports
76 .El
77 .It Fa rid
78 A bus-specific handle that identifies the resource being allocated.
79 .It Fa start
80 The start address of this resource.
81 .It Fa count
82 The length of the resource.
83 For example, the size of the memory in bytes.
84 .It Fa cpuid
85 Owner CPU for interrupt resources. Other resource types, e.g.
86 IOPORT, MEMORY and DRQ, are shared across CPUs, so this parameter
87 has to be set to -1
88 .El
89 .Sh RETURN VALUES
90 Zero 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
97 This manual page was written by
98 .An Warner Losh Aq imp@FreeBSD.org .