xref: /freebsd/share/man/man9/rman.9 (revision 037946dc9b07f7e0085e71798f5b397c5d9597db)
15f616912SHiten Pandya.\"
25f616912SHiten Pandya.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
35f616912SHiten Pandya.\" All rights reserved.
45f616912SHiten Pandya.\"
55f616912SHiten Pandya.\" Redistribution and use in source and binary forms, with or without
65f616912SHiten Pandya.\" modification, are permitted provided that the following conditions
75f616912SHiten Pandya.\" are met:
85f616912SHiten Pandya.\" 1. Redistributions of source code must retain the above copyright
95f616912SHiten Pandya.\"    notice, this list of conditions and the following disclaimer.
105f616912SHiten Pandya.\" 2. Redistributions in binary form must reproduce the above copyright
115f616912SHiten Pandya.\"    notice, this list of conditions and the following disclaimer in the
125f616912SHiten Pandya.\"    documentation and/or other materials provided with the distribution.
135f616912SHiten Pandya.\"
145f616912SHiten Pandya.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
155f616912SHiten Pandya.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
165f616912SHiten Pandya.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
175f616912SHiten Pandya.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
185f616912SHiten Pandya.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
195f616912SHiten Pandya.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
205f616912SHiten Pandya.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
215f616912SHiten Pandya.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
225f616912SHiten Pandya.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
235f616912SHiten Pandya.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
245f616912SHiten Pandya.\" SUCH DAMAGE.
255f616912SHiten Pandya.\"
26b30a80b6SJohn Baldwin.Dd March 13, 2024
275f616912SHiten Pandya.Dt RMAN 9
285f616912SHiten Pandya.Os
295f616912SHiten Pandya.Sh NAME
305f616912SHiten Pandya.Nm rman ,
315f616912SHiten Pandya.Nm rman_activate_resource ,
32bb82622cSJohn Baldwin.Nm rman_adjust_resource ,
335f616912SHiten Pandya.Nm rman_deactivate_resource ,
345f616912SHiten Pandya.Nm rman_fini ,
355f616912SHiten Pandya.Nm rman_init ,
36bb82622cSJohn Baldwin.Nm rman_init_from_resource ,
37bb82622cSJohn Baldwin.Nm rman_is_region_manager ,
385f616912SHiten Pandya.Nm rman_manage_region ,
39bb82622cSJohn Baldwin.Nm rman_first_free_region ,
40bb82622cSJohn Baldwin.Nm rman_last_free_region ,
415f616912SHiten Pandya.Nm rman_release_resource ,
425f616912SHiten Pandya.Nm rman_reserve_resource ,
435f616912SHiten Pandya.Nm rman_make_alignment_flags ,
445f616912SHiten Pandya.Nm rman_get_start ,
455f616912SHiten Pandya.Nm rman_get_end ,
4611053af5SHiten Pandya.Nm rman_get_device ,
475f616912SHiten Pandya.Nm rman_get_size ,
485f616912SHiten Pandya.Nm rman_get_flags ,
49cc981af2SJohn Baldwin.Nm rman_set_mapping ,
50cc981af2SJohn Baldwin.Nm rman_get_mapping ,
515f616912SHiten Pandya.Nm rman_set_virtual ,
525f616912SHiten Pandya.Nm rman_get_virtual ,
535f616912SHiten Pandya.Nm rman_set_bustag ,
545f616912SHiten Pandya.Nm rman_get_bustag ,
555f616912SHiten Pandya.Nm rman_set_bushandle ,
565f616912SHiten Pandya.Nm rman_get_bushandle ,
575f616912SHiten Pandya.Nm rman_set_rid ,
58b30a80b6SJohn Baldwin.Nm rman_get_rid ,
59b30a80b6SJohn Baldwin.Nm rman_set_type ,
60b30a80b6SJohn Baldwin.Nm rman_get_type
615f616912SHiten Pandya.Nd resource management functions
625f616912SHiten Pandya.Sh SYNOPSIS
639f6985c4SWarner Losh.In sys/types.h
645f616912SHiten Pandya.In sys/rman.h
655f616912SHiten Pandya.Ft int
665f616912SHiten Pandya.Fn rman_activate_resource "struct resource *r"
675f616912SHiten Pandya.Ft int
682dd1bdf1SJustin Hibbits.Fn rman_adjust_resource "struct resource *r" "rman_res_t start" "rman_res_t end"
69bb82622cSJohn Baldwin.Ft int
705f616912SHiten Pandya.Fn rman_deactivate_resource "struct resource *r"
715f616912SHiten Pandya.Ft int
725f616912SHiten Pandya.Fn rman_fini "struct rman *rm"
735f616912SHiten Pandya.Ft int
745f616912SHiten Pandya.Fn rman_init "struct rman *rm"
755f616912SHiten Pandya.Ft int
76bb82622cSJohn Baldwin.Fn rman_init_from_resource "struct rman *rm" "struct resource *r"
77bb82622cSJohn Baldwin.Ft int
78bb82622cSJohn Baldwin.Fn rman_is_region_manager "struct resource *r" "struct rman *rm"
79bb82622cSJohn Baldwin.Ft int
802dd1bdf1SJustin Hibbits.Fn rman_manage_region "struct rman *rm" "rman_res_t start" "rman_res_t end"
815f616912SHiten Pandya.Ft int
822dd1bdf1SJustin Hibbits.Fn rman_first_free_region "struct rman *rm" "rman_res_t *start" "rman_res_t *end"
83bb82622cSJohn Baldwin.Ft int
842dd1bdf1SJustin Hibbits.Fn rman_last_free_region "struct rman *rm" "rman_res_t *start" "rman_res_t *end"
85bb82622cSJohn Baldwin.Ft int
865f616912SHiten Pandya.Fn rman_release_resource "struct resource *r"
873e1cee04SRuslan Ermilov.Ft "struct resource *"
883e1cee04SRuslan Ermilov.Fo rman_reserve_resource
892dd1bdf1SJustin Hibbits.Fa "struct rman *rm" "rman_res_t start" "rman_res_t end" "rman_res_t count"
90dfff3776SMark Johnston.Fa "u_int flags" "device_t dev"
913e1cee04SRuslan Ermilov.Fc
925f616912SHiten Pandya.Ft uint32_t
935f616912SHiten Pandya.Fn rman_make_alignment_flags "uint32_t size"
942dd1bdf1SJustin Hibbits.Ft rman_res_t
953e1cee04SRuslan Ermilov.Fn rman_get_start "struct resource *r"
962dd1bdf1SJustin Hibbits.Ft rman_res_t
973e1cee04SRuslan Ermilov.Fn rman_get_end "struct resource *r"
98dfff3776SMark Johnston.Ft "device_t"
9911053af5SHiten Pandya.Fn rman_get_device "struct resource *r"
1002dd1bdf1SJustin Hibbits.Ft rman_res_t
1013e1cee04SRuslan Ermilov.Fn rman_get_size "struct resource *r"
1025f616912SHiten Pandya.Ft u_int
1033e1cee04SRuslan Ermilov.Fn rman_get_flags "struct resource *r"
1045f616912SHiten Pandya.Ft void
105cc981af2SJohn Baldwin.Fn rman_set_mapping "struct resource *r" "struct resource_map *map"
106cc981af2SJohn Baldwin.Ft void
107cc981af2SJohn Baldwin.Fn rman_get_mapping "struct resource *r" "struct resource_map *map"
108cc981af2SJohn Baldwin.Ft void
1093e1cee04SRuslan Ermilov.Fn rman_set_virtual "struct resource *r" "void *v"
1103e1cee04SRuslan Ermilov.Ft "void *"
1113e1cee04SRuslan Ermilov.Fn rman_get_virtual "struct resource *r"
1125f616912SHiten Pandya.Ft void
1133e1cee04SRuslan Ermilov.Fn rman_set_bustag "struct resource *r" "bus_space_tag_t t"
1145f616912SHiten Pandya.Ft bus_space_tag_t
1153e1cee04SRuslan Ermilov.Fn rman_get_bustag "struct resource *r"
1165f616912SHiten Pandya.Ft void
1173e1cee04SRuslan Ermilov.Fn rman_set_bushandle "struct resource *r" "bus_space_handle_t h"
1185f616912SHiten Pandya.Ft bus_space_handle_t
1193e1cee04SRuslan Ermilov.Fn rman_get_bushandle "struct resource *r"
1205f616912SHiten Pandya.Ft void
1213e1cee04SRuslan Ermilov.Fn rman_set_rid "struct resource *r" "int rid"
1225f616912SHiten Pandya.Ft int
1233e1cee04SRuslan Ermilov.Fn rman_get_rid "struct resource *r"
124b30a80b6SJohn Baldwin.Ft void
125b30a80b6SJohn Baldwin.Fn rman_set_type "struct resource *r" "int type"
126b30a80b6SJohn Baldwin.Ft int
127b30a80b6SJohn Baldwin.Fn rman_get_type "struct resource *r"
1285f616912SHiten Pandya.Sh DESCRIPTION
1295f616912SHiten PandyaThe
1305f616912SHiten Pandya.Nm
1315f616912SHiten Pandyaset of functions provides a flexible resource management abstraction.
1325f616912SHiten PandyaIt is used extensively by the bus management code.
1335f616912SHiten PandyaIt implements the abstractions of region and resource.
1345f616912SHiten PandyaA region descriptor is used to manage a region; this could be memory or
1355f616912SHiten Pandyasome other form of bus space.
1365f616912SHiten Pandya.Pp
1375f616912SHiten PandyaEach region has a set of bounds.
1385f616912SHiten PandyaWithin these bounds, allocated segments may reside.
1395f616912SHiten PandyaEach segment, termed a resource, has several properties which are
1405f616912SHiten Pandyarepresented by a 16-bit flag register, as follows.
1415f616912SHiten Pandya.Bd -literal
1425f616912SHiten Pandya#define RF_ALLOCATED    0x0001 /* resource has been reserved */
1435f616912SHiten Pandya#define RF_ACTIVE       0x0002 /* resource allocation has been activated */
1445f616912SHiten Pandya#define RF_SHAREABLE    0x0004 /* resource permits contemporaneous sharing */
1455f616912SHiten Pandya#define RF_FIRSTSHARE   0x0020 /* first in sharing list */
1465f616912SHiten Pandya#define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */
147cc981af2SJohn Baldwin#define RF_UNMAPPED     0x0100 /* don't map resource when activating */
1485f616912SHiten Pandya.Ed
1495f616912SHiten Pandya.Pp
150d3a68794SDon LewisBits 15:10  of the flag register are used to represent the desired alignment
1515f616912SHiten Pandyaof the resource within the region.
1525f616912SHiten Pandya.Pp
1535f616912SHiten PandyaThe
1545f616912SHiten Pandya.Fn rman_init
1555f616912SHiten Pandyafunction initializes the region descriptor, pointed to by the
1565f616912SHiten Pandya.Fa rm
1575f616912SHiten Pandyaargument, for use with the resource management functions.
158bc956811SJohn-Mark GurneyIt is required that the fields
159bc956811SJohn-Mark Gurney.Va rm_type
160bc956811SJohn-Mark Gurneyand
161bc956811SJohn-Mark Gurney.Va rm_descr
162bc956811SJohn-Mark Gurneyof
163bc956811SJohn-Mark Gurney.Vt "struct rman"
164bc956811SJohn-Mark Gurneybe set before calling
165bc956811SJohn-Mark Gurney.Fn rman_init .
166bc956811SJohn-Mark GurneyThe field
167bc956811SJohn-Mark Gurney.Va rm_type
168bc956811SJohn-Mark Gurneyshall be set to
169bc956811SJohn-Mark Gurney.Dv RMAN_ARRAY .
170bc956811SJohn-Mark GurneyThe field
171bc956811SJohn-Mark Gurney.Va rm_descr
172bc956811SJohn-Mark Gurneyshall be set to a string that describes the resource to be managed.
173bb82622cSJohn BaldwinThe
174bb82622cSJohn Baldwin.Va rm_start
175bb82622cSJohn Baldwinand
176bb82622cSJohn Baldwin.Va rm_end
177bb82622cSJohn Baldwinfields may be set to limit the range of acceptable resource addresses.
178bb82622cSJohn BaldwinIf these fields are not set,
179bb82622cSJohn Baldwin.Fn rman_init
180bb82622cSJohn Baldwinwill initialize them to allow the entire range of resource addresses.
1815f616912SHiten PandyaIt also initializes any mutexes associated with the structure.
182ebf750a9SJohn-Mark GurneyIf
183ebf750a9SJohn-Mark Gurney.Fn rman_init
184f6ac2391SJoel Dahlfails to initialize the mutex, it will return
185ebf750a9SJohn-Mark Gurney.Er ENOMEM ; otherwise it will return 0 and
186ebf750a9SJohn-Mark Gurney.Fa rm
187f6ac2391SJoel Dahlwill be initialized.
1885f616912SHiten Pandya.Pp
1895f616912SHiten PandyaThe
1905f616912SHiten Pandya.Fn rman_fini
1915f616912SHiten Pandyafunction frees any structures associated with the structure
1925f616912SHiten Pandyapointed to by the
1935f616912SHiten Pandya.Fa rm
1943e1cee04SRuslan Ermilovargument.
1953e1cee04SRuslan ErmilovIf any of the resources within the managed region have the
1965f616912SHiten Pandya.Dv RF_ALLOCATED
1975f616912SHiten Pandyaflag set, it will return
1985f616912SHiten Pandya.Er EBUSY ;
1995f616912SHiten Pandyaotherwise, any mutexes associated with the structure will be released
2005f616912SHiten Pandyaand destroyed, and the function will return 0.
2015f616912SHiten Pandya.Pp
2025f616912SHiten PandyaThe
2035f616912SHiten Pandya.Fn rman_manage_region
2045f616912SHiten Pandyafunction establishes the concept of a region which is under
2055f616912SHiten Pandya.Nm
2065f616912SHiten Pandyacontrol.
2075f616912SHiten PandyaThe
2085f616912SHiten Pandya.Fa rman
2095f616912SHiten Pandyaargument points to the region descriptor.
2103e1cee04SRuslan ErmilovThe
2113e1cee04SRuslan Ermilov.Fa start
2123e1cee04SRuslan Ermilovand
2133e1cee04SRuslan Ermilov.Fa end
2143e1cee04SRuslan Ermilovarguments specify the bounds of the region.
215ebf750a9SJohn-Mark GurneyIf successful,
216ebf750a9SJohn-Mark Gurney.Fn rman_manage_region
217ebf750a9SJohn-Mark Gurneywill return 0.
218ebf750a9SJohn-Mark GurneyIf the region overlaps with an existing region, it will return
219ebf750a9SJohn-Mark Gurney.Er EBUSY .
220bb82622cSJohn BaldwinIf any part of the region falls outside of the valid address range for
221bb82622cSJohn Baldwin.Fa rm ,
222bb82622cSJohn Baldwinit will return
223bb82622cSJohn Baldwin.Er EINVAL .
224ebf750a9SJohn-Mark Gurney.Er ENOMEM
225bb82622cSJohn Baldwinwill be returned when
226ebf750a9SJohn-Mark Gurney.Fn rman_manage_region
227ebf750a9SJohn-Mark Gurneyfailed to allocate memory for the region.
2285f616912SHiten Pandya.Pp
2295f616912SHiten PandyaThe
230bb82622cSJohn Baldwin.Fn rman_init_from_resource
231bb82622cSJohn Baldwinfunction is a wrapper routine to create a resource manager backed by an
232bb82622cSJohn Baldwinexisting resource.
233bb82622cSJohn BaldwinIt initializes
234bb82622cSJohn Baldwin.Fa rm
235bb82622cSJohn Baldwinusing
236bb82622cSJohn Baldwin.Fn rman_init
237bb82622cSJohn Baldwinand then adds a region to
238bb82622cSJohn Baldwin.Fa rm
239bb82622cSJohn Baldwincorresponding to the address range allocated to
240bb82622cSJohn Baldwin.Fa r
241bb82622cSJohn Baldwinvia
242bb82622cSJohn Baldwin.Fn rman_manage_region .
243bb82622cSJohn Baldwin.Pp
244bb82622cSJohn BaldwinThe
245bb82622cSJohn Baldwin.Fn rman_first_free_region
246bb82622cSJohn Baldwinand
247bb82622cSJohn Baldwin.Fn rman_last_free_region
248bb82622cSJohn Baldwinfunctions can be used to query a resource manager for its first
249bb82622cSJohn Baldwin.Pq or last
250bb82622cSJohn Baldwinunallocated region.
251bb82622cSJohn BaldwinIf
252bb82622cSJohn Baldwin.Fa rm
253bb82622cSJohn Baldwincontains no free region,
254bb82622cSJohn Baldwinthese functions will return
255bb82622cSJohn Baldwin.Er ENOENT .
256bb82622cSJohn BaldwinOtherwise,
257bb82622cSJohn Baldwin.Fa *start
258bb82622cSJohn Baldwinand
259bb82622cSJohn Baldwin.Fa *end
260bb82622cSJohn Baldwinare set to the bounds of the free region and zero is returned.
261bb82622cSJohn Baldwin.Pp
262bb82622cSJohn BaldwinThe
263*037946dcSElliott Mitchell.Fn rman_reserve_resource
2645f616912SHiten Pandyafunction is where the bulk of the
2653e1cee04SRuslan Ermilov.Nm
2663e1cee04SRuslan Ermilovlogic is located.
2675f616912SHiten PandyaIt attempts to reserve a contiguous range in the specified region
2685f616912SHiten Pandya.Fa rm
2695f616912SHiten Pandyafor the use of the device
2705f616912SHiten Pandya.Fa dev .
2713e1cee04SRuslan ErmilovThe caller can specify the
2723e1cee04SRuslan Ermilov.Fa start
2733e1cee04SRuslan Ermilovand
2743e1cee04SRuslan Ermilov.Fa end
275bb82622cSJohn Baldwinof an acceptable range,
276*037946dcSElliott Mitchellrequired alignment,
277bb82622cSJohn Baldwinand the code will attempt to find a free segment which fits.
278f3011a7cSWarner LoshThe
279f3011a7cSWarner Losh.Fa start
280f3011a7cSWarner Loshargument is the lowest acceptable starting value of the resource.
281f3011a7cSWarner LoshThe
282f3011a7cSWarner Losh.Fa end
283f3011a7cSWarner Loshargument is the highest acceptable ending value of the resource.
284f3011a7cSWarner LoshTherefore,
2854f068961SRuslan Ermilov.Fa start No + Fa count No \- 1
2864f068961SRuslan Ermilovmust be \[<=]
287f3011a7cSWarner Losh.Fa end
288f3011a7cSWarner Loshfor any allocation to happen.
289a1581cd7SGordon BerglingThe alignment requirement
290bb82622cSJohn Baldwin.Pq if any
291bb82622cSJohn Baldwinis specified in
292bb82622cSJohn Baldwin.Fa flags .
293*037946dcSElliott MitchellOften the
294*037946dcSElliott Mitchell.Dv RF_ALIGNMENT_LOG2
295*037946dcSElliott Mitchellmacro is used to specify alignment to a power-of-2 size, or
296*037946dcSElliott Mitchell.Fn rman_make_alignment_flags
297*037946dcSElliott Mitchellcan be used to compute the
298*037946dcSElliott Mitchell.Fa flags
299*037946dcSElliott Mitchellvalue at runtime.
300d3a68794SDon LewisA shared segment will be allocated if the
3015f616912SHiten Pandya.Dv RF_SHAREABLE
302d3a68794SDon Lewisflag is set, otherwise an exclusive segment will be allocated.
3035f616912SHiten PandyaIf this shared segment already exists, the caller has its device
3045f616912SHiten Pandyaadded to the list of consumers.
3055f616912SHiten Pandya.Pp
3065f616912SHiten PandyaThe
3075f616912SHiten Pandya.Fn rman_make_alignment_flags
3085f616912SHiten Pandyafunction returns the flag mask corresponding to the desired alignment
3095f616912SHiten Pandya.Fa size .
3105f616912SHiten PandyaThis should be used when calling
3115f616912SHiten Pandya.Fn rman_reserve_resource_bound .
3125f616912SHiten Pandya.Pp
3135f616912SHiten PandyaThe
314bb82622cSJohn Baldwin.Fn rman_is_region_manager
315bb82622cSJohn Baldwinfunction returns true if the allocated resource
316bb82622cSJohn Baldwin.Fa r
317bb82622cSJohn Baldwinwas allocated from
318bb82622cSJohn Baldwin.Fa rm .
319bb82622cSJohn BaldwinOtherwise,
320bb82622cSJohn Baldwinit returns false.
321bb82622cSJohn Baldwin.Pp
322bb82622cSJohn BaldwinThe
323bb82622cSJohn Baldwin.Fn rman_adjust_resource
324bb82622cSJohn Baldwinfunction is used to adjust the reserved address range of an allocated resource
325bb82622cSJohn Baldwinto reserve
326bb82622cSJohn Baldwin.Fa start
327bb82622cSJohn Baldwinthrough
328bb82622cSJohn Baldwin.Fa end .
329bb82622cSJohn BaldwinIt can be used to grow or shrink one or both ends of the resource range.
330bb82622cSJohn BaldwinThe current implementation does not support entirely relocating the resource
331bb82622cSJohn Baldwinand will fail with
332bb82622cSJohn Baldwin.Er EINVAL
333bb82622cSJohn Baldwinif the new resource range does not overlap the old resource range.
334bb82622cSJohn BaldwinIf either end of the resource range grows and the new resource range would
335bb82622cSJohn Baldwinconflict with another allocated resource,
336bb82622cSJohn Baldwinthe function will fail with
337bb82622cSJohn Baldwin.Er EBUSY .
338bb82622cSJohn BaldwinThe
339bb82622cSJohn Baldwin.Fn rman_adjust_resource
340bb82622cSJohn Baldwinfunction does not support adjusting the resource range for shared resources
341bb82622cSJohn Baldwinand will fail such attempts with
342bb82622cSJohn Baldwin.Er EINVAL .
343bb82622cSJohn BaldwinUpon success,
344bb82622cSJohn Baldwinthe resource
345bb82622cSJohn Baldwin.Fa r
346bb82622cSJohn Baldwinwill have a start address of
347bb82622cSJohn Baldwin.Fa start
348bb82622cSJohn Baldwinand an end address of
349bb82622cSJohn Baldwin.Fa end
350bb82622cSJohn Baldwinand the function will return zero.
351bb82622cSJohn BaldwinNote that none of the constraints of the original allocation request such
352bb82622cSJohn Baldwinas alignment or boundary restrictions are checked by
353bb82622cSJohn Baldwin.Fn rman_adjust_resource .
354bb82622cSJohn BaldwinIt is the caller's responsibility to enforce any such requirements.
355bb82622cSJohn Baldwin.Pp
356bb82622cSJohn BaldwinThe
3575f616912SHiten Pandya.Fn rman_release_resource
3585f616912SHiten Pandyafunction releases the reserved resource
3595f616912SHiten Pandya.Fa r .
3605f616912SHiten PandyaIt may attempt to merge adjacent free resources.
3615f616912SHiten Pandya.Pp
3625f616912SHiten PandyaThe
3635f616912SHiten Pandya.Fn rman_activate_resource
3645f616912SHiten Pandyafunction marks a resource as active, by setting the
3655f616912SHiten Pandya.Dv RF_ACTIVE
3665f616912SHiten Pandyaflag.
3675f616912SHiten PandyaIf this is a time shared resource, and the caller has not yet acquired
3685f616912SHiten Pandyathe resource, the function returns
3695f616912SHiten Pandya.Er EBUSY .
3705f616912SHiten Pandya.Pp
3715f616912SHiten PandyaThe
3725f616912SHiten Pandya.Fn rman_deactivate_resource
3735f616912SHiten Pandyafunction marks a resource
3745f616912SHiten Pandya.Fa r
3755f616912SHiten Pandyaas inactive, by clearing the
3765f616912SHiten Pandya.Dv RF_ACTIVE
3775f616912SHiten Pandyaflag.
3785f616912SHiten PandyaIf other consumers are waiting for this range, it will wakeup their threads.
3795f616912SHiten Pandya.Pp
3805f616912SHiten PandyaThe
3815f616912SHiten Pandya.Fn rman_get_start ,
3825f616912SHiten Pandya.Fn rman_get_end ,
3833e1cee04SRuslan Ermilov.Fn rman_get_size ,
3843e1cee04SRuslan Ermilovand
3855f616912SHiten Pandya.Fn rman_get_flags
3865f616912SHiten Pandyafunctions return the bounds, size and flags of the previously reserved
3875f616912SHiten Pandyaresource
3885f616912SHiten Pandya.Fa r .
3895f616912SHiten Pandya.Pp
3905f616912SHiten PandyaThe
3915f616912SHiten Pandya.Fn rman_set_bustag
3923e1cee04SRuslan Ermilovfunction associates a
3933e1cee04SRuslan Ermilov.Vt bus_space_tag_t
3945f616912SHiten Pandya.Fa t
3955f616912SHiten Pandyawith the resource
3965f616912SHiten Pandya.Fa r .
3975f616912SHiten PandyaThe
3985f616912SHiten Pandya.Fn rman_get_bustag
3995f616912SHiten Pandyafunction is used to retrieve this tag once set.
4005f616912SHiten Pandya.Pp
4015f616912SHiten PandyaThe
4025f616912SHiten Pandya.Fn rman_set_bushandle
4033e1cee04SRuslan Ermilovfunction associates a
4043e1cee04SRuslan Ermilov.Vt bus_space_handle_t
4055f616912SHiten Pandya.Fa h
4065f616912SHiten Pandyawith the resource
4075f616912SHiten Pandya.Fa r .
4085f616912SHiten PandyaThe
4095f616912SHiten Pandya.Fn rman_get_bushandle
4105f616912SHiten Pandyafunction is used to retrieve this handle once set.
4115f616912SHiten Pandya.Pp
4125f616912SHiten PandyaThe
4135f616912SHiten Pandya.Fn rman_set_virtual
4145f616912SHiten Pandyafunction is used to associate a kernel virtual address with a resource
4155f616912SHiten Pandya.Fa r .
4165f616912SHiten PandyaThe
4175f616912SHiten Pandya.Fn rman_get_virtual
4185f616912SHiten Pandyafunction can be used to retrieve the KVA once set.
4195f616912SHiten Pandya.Pp
4205f616912SHiten PandyaThe
421cc981af2SJohn Baldwin.Fn rman_set_mapping
422cc981af2SJohn Baldwinfunction is used to associate a resource mapping with a resource
423cc981af2SJohn Baldwin.Fa r .
424cc981af2SJohn BaldwinThe mapping must cover the entire resource.
425cc981af2SJohn BaldwinSetting a mapping sets the associated
426cc981af2SJohn Baldwin.Xr bus_space 9
427cc981af2SJohn Baldwinhandle and tag for
428cc981af2SJohn Baldwin.Fa r
429cc981af2SJohn Baldwinas well as the kernel virtual address if the mapping contains one.
430cc981af2SJohn BaldwinThese individual values can be retrieved via
431cc981af2SJohn Baldwin.Fn rman_get_bushandle ,
432cc981af2SJohn Baldwin.Fn rman_get_bustag ,
433cc981af2SJohn Baldwinand
434cc981af2SJohn Baldwin.Fn rman_get_virtual .
435cc981af2SJohn Baldwin.Pp
436cc981af2SJohn BaldwinThe
437cc981af2SJohn Baldwin.Fn rman_get_mapping
438cc981af2SJohn Baldwinfunction can be used to retrieve the associated resource mapping once set.
439cc981af2SJohn Baldwin.Pp
440cc981af2SJohn BaldwinThe
4415f616912SHiten Pandya.Fn rman_set_rid
4425f616912SHiten Pandyafunction associates a resource identifier with a resource
4435f616912SHiten Pandya.Fa r .
4443e1cee04SRuslan ErmilovThe
4453e1cee04SRuslan Ermilov.Fn rman_get_rid
4463e1cee04SRuslan Ermilovfunction retrieves this RID.
4475f616912SHiten Pandya.Pp
4485f616912SHiten PandyaThe
449b30a80b6SJohn Baldwin.Fn rman_set_type
450b30a80b6SJohn Baldwinfunction associates a resource type with a resource
451b30a80b6SJohn Baldwin.Fa r .
452b30a80b6SJohn BaldwinThe
453b30a80b6SJohn Baldwin.Fn rman_get_type
454b30a80b6SJohn Baldwinfunction retrieves this type.
455b30a80b6SJohn Baldwin.Pp
456b30a80b6SJohn BaldwinThe
4575f616912SHiten Pandya.Fn rman_get_device
4585f616912SHiten Pandyafunction returns a pointer to the device which reserved the resource
4595f616912SHiten Pandya.Fa r .
4605f616912SHiten Pandya.Sh SEE ALSO
4615f616912SHiten Pandya.Xr bus_activate_resource 9 ,
46285ee63c9SJohn Baldwin.Xr bus_adjust_resource 9 ,
4635f616912SHiten Pandya.Xr bus_alloc_resource 9 ,
464cc981af2SJohn Baldwin.Xr bus_map_resource 9 ,
4655f616912SHiten Pandya.Xr bus_release_resource 9 ,
4665f616912SHiten Pandya.Xr bus_set_resource 9 ,
467c85d7166SChristian Brueffer.Xr bus_space 9 ,
4685f616912SHiten Pandya.Xr mutex 9
4695f616912SHiten Pandya.Sh AUTHORS
470571dba6eSHiten PandyaThis manual page was written by
4718a7314fcSBaptiste Daroussin.An Bruce M Simpson Aq Mt bms@spc.org .
472