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.Dd April 23, 2016 29.Dt BUS_ADJUST_RESOURCE 9 30.Os 31.Sh NAME 32.Nm bus_adjust_resource 33.Nd adjust resource allocated from a parent bus 34.Sh SYNOPSIS 35.In sys/param.h 36.In sys/bus.h 37.Pp 38.In machine/bus.h 39.In sys/rman.h 40.In machine/resource.h 41.Ft int 42.Fo bus_adjust_resource 43.Fa "device_t dev" "int type" "struct resource *r" 44.Fa "rman_res_t start" "rman_res_t end" 45.Fc 46.Sh DESCRIPTION 47This function is used to ask the parent bus to adjust the resource range 48assigned to an allocated resource. 49The resource 50.Fa r 51should have been allocated by a previous call to 52.Xr bus_alloc_resource 9 . 53The new resource range must overlap the existing range of 54.Fa r . 55The 56.Fa type 57argument should match the 58.Fa type 59argument passed to 60.Xr bus_alloc_resource 9 61when the resource was initially allocated. 62.Pp 63Note that none of the constraints of the original allocation request such 64as alignment or boundary restrictions are checked by 65.Fn bus_adjust_resource . 66It is the caller's responsibility to enforce any such requirements. 67.Sh RETURN VALUES 68The 69.Fn bus_adjust_resource 70method returns zero on success or an error code on failure. 71.Sh EXAMPLES 72Grow 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 82will fail if: 83.Bl -tag -width Er 84.It Bq Er EINVAL 85The 86.Fa dev 87device does not have a parent device. 88.It Bq Er EINVAL 89The 90.Fa r 91resource is a shared resource. 92.It Bq Er EINVAL 93The new address range does not overlap with the existing address range of 94.Fa r . 95.It Bq Er EBUSY 96The 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 103