]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/bus_adjust_resource.9
Merge ^/head r294777 through r294960.
[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 29, 2011
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" "rman_res_t start" "rman_res_t end"
46 .Sh DESCRIPTION
47 This function is used to ask the parent bus to adjust the resource range
48 assigned to an allocated resource.
49 The resource
50 .Fa r
51 should have been allocated by a previous call to
52 .Xr bus_alloc_resource 9 .
53 The new resource range must overlap the existing range of
54 .Fa r .
55 The
56 .Fa type
57 argument should match the
58 .Fa type
59 argument passed to
60 .Xr bus_alloc_resource 9
61 when the resource was initially allocated.
62 .Pp
63 Note that none of the constraints of the original allocation request such
64 as alignment or boundary restrictions are checked by
65 .Fn bus_adjust_resource .
66 It is the caller's responsibility to enforce any such requirements.
67 .Sh RETURN VALUES
68 The
69 .Fn bus_adjust_resource
70 method returns zero on success or an error code on failure.
71 .Sh EXAMPLES
72 Grow an existing memory resource by 4096 bytes.
73 .Bd -literal
74         struct resource *res;
75         int error;
76
77         error = bus_adjust_resource(dev, SYS_RES_MEMORY, res,
78             rman_get_start(res), rman_get_end(res) + 0x1000);
79 .Ed
80 .Sh ERRORS
81 .Fn bus_adjust_resource
82 will fail if:
83 .Bl -tag -width Er
84 .It Bq Er EINVAL
85 The
86 .Fa dev
87 device does not have a parent device.
88 .It Bq Er EINVAL
89 The
90 .Fa r
91 resource is a shared resource.
92 .It Bq Er EINVAL
93 The new address range does not overlap with the existing address range of
94 .Fa r .
95 .It Bq Er EBUSY
96 The new address range conflicts with another allocated resource.
97 .El
98 .Sh SEE ALSO
99 .Xr bus_alloc_resource 9 ,
100 .Xr bus_release_resource 9 ,
101 .Xr device 9 ,
102 .Xr driver 9