blob: b3ec2d7b3183031a91035431c7e4893d3706a1ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
<table class="head">
<tr>
<td class="head-ltitle">BUS_ADJUST_RESOURCE(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">BUS_ADJUST_RESOURCE(9)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">bus_adjust_resource</code> —
<span class="Nd">adjust resource allocated from a parent bus</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">sys/param.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/bus.h</a>></code></p>
<p class="Pp">
<br/>
<code class="In">#include <<a class="In">machine/bus.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/rman.h</a>></code>
<br/>
<code class="In">#include
<<a class="In">machine/resource.h</a>></code></p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">bus_adjust_resource</code>(<var class="Fa">device_t
dev</var>, <var class="Fa">struct resource *r</var>,
<var class="Fa">rman_res_t start</var>, <var class="Fa">rman_res_t
end</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">This function is used to ask the parent bus to adjust the resource
range assigned to an allocated resource. The resource
<var class="Fa">r</var> should have been allocated by a previous call to
<a class="Xr">bus_alloc_resource(9)</a>. The new resource range must overlap
the existing range of <var class="Fa">r</var>.</p>
<p class="Pp" id="bus_adjust_resource">Note that none of the constraints of the
original allocation request such as alignment or boundary restrictions are
checked by
<a class="permalink" href="#bus_adjust_resource"><code class="Fn">bus_adjust_resource</code></a>().
It is the caller's responsibility to enforce any such requirements.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<p class="Pp">The <code class="Fn">bus_adjust_resource</code>() method returns
zero on success or an error code on failure.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
<p class="Pp">Grow an existing memory resource by 4096 bytes.</p>
<div class="Bd Pp Li">
<pre> struct resource *res;
int error;
error = bus_adjust_resource(dev, res, rman_get_start(res),
rman_get_end(res) + 0x1000);</pre>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp"><code class="Fn">bus_adjust_resource</code>() will fail if:</p>
<dl class="Bl-tag">
<dt id="EINVAL">[<a class="permalink" href="#EINVAL"><code class="Er">EINVAL</code></a>]</dt>
<dd>The <var class="Fa">dev</var> device does not have a parent device.</dd>
<dt id="EINVAL~2">[<a class="permalink" href="#EINVAL~2"><code class="Er">EINVAL</code></a>]</dt>
<dd>The <var class="Fa">r</var> resource is a shared resource.</dd>
<dt id="EINVAL~3">[<a class="permalink" href="#EINVAL~3"><code class="Er">EINVAL</code></a>]</dt>
<dd>The new address range does not overlap with the existing address range of
<var class="Fa">r</var>.</dd>
<dt id="EBUSY">[<a class="permalink" href="#EBUSY"><code class="Er">EBUSY</code></a>]</dt>
<dd>The new address range conflicts with another allocated resource.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">bus_alloc_resource(9)</a>,
<a class="Xr">bus_release_resource(9)</a>, <a class="Xr">device(9)</a>,
<a class="Xr">driver(9)</a></p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">March 13, 2024</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|