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