]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/bus_adjust_resource.9
accept_filter(9): Fix a mandoc related error
[FreeBSD/FreeBSD.git] / share / man / man9 / bus_adjust_resource.9
1 .\" -*- nroff -*-
2 .\"
3 .\" Copyright (c) 2011 Hudson River Trading LLC
4 .\" Written by: John H. Baldwin <jhb@FreeBSD.org>
5 .\" All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"
30 .Dd April 23, 2016
31 .Dt BUS_ADJUST_RESOURCE 9
32 .Os
33 .Sh NAME
34 .Nm bus_adjust_resource
35 .Nd adjust resource allocated from a parent bus
36 .Sh SYNOPSIS
37 .In sys/param.h
38 .In sys/bus.h
39 .Pp
40 .In machine/bus.h
41 .In sys/rman.h
42 .In machine/resource.h
43 .Ft int
44 .Fo bus_adjust_resource
45 .Fa "device_t dev" "int type" "struct resource *r"
46 .Fa "rman_res_t start" "rman_res_t end"
47 .Fc
48 .Sh DESCRIPTION
49 This function is used to ask the parent bus to adjust the resource range
50 assigned to an allocated resource.
51 The resource
52 .Fa r
53 should have been allocated by a previous call to
54 .Xr bus_alloc_resource 9 .
55 The new resource range must overlap the existing range of
56 .Fa r .
57 The
58 .Fa type
59 argument should match the
60 .Fa type
61 argument passed to
62 .Xr bus_alloc_resource 9
63 when the resource was initially allocated.
64 .Pp
65 Note that none of the constraints of the original allocation request such
66 as alignment or boundary restrictions are checked by
67 .Fn bus_adjust_resource .
68 It is the caller's responsibility to enforce any such requirements.
69 .Sh RETURN VALUES
70 The
71 .Fn bus_adjust_resource
72 method returns zero on success or an error code on failure.
73 .Sh EXAMPLES
74 Grow an existing memory resource by 4096 bytes.
75 .Bd -literal
76         struct resource *res;
77         int error;
78
79         error = bus_adjust_resource(dev, SYS_RES_MEMORY, res,
80             rman_get_start(res), rman_get_end(res) + 0x1000);
81 .Ed
82 .Sh ERRORS
83 .Fn bus_adjust_resource
84 will fail if:
85 .Bl -tag -width Er
86 .It Bq Er EINVAL
87 The
88 .Fa dev
89 device does not have a parent device.
90 .It Bq Er EINVAL
91 The
92 .Fa r
93 resource is a shared resource.
94 .It Bq Er EINVAL
95 The new address range does not overlap with the existing address range of
96 .Fa r .
97 .It Bq Er EBUSY
98 The new address range conflicts with another allocated resource.
99 .El
100 .Sh SEE ALSO
101 .Xr bus_alloc_resource 9 ,
102 .Xr bus_release_resource 9 ,
103 .Xr device 9 ,
104 .Xr driver 9