From alex@big.endian.de  Wed May 31 04:10:19 2000
Return-Path: <alex@big.endian.de>
Received: from mail.surf1.de (mail.surf1.de [194.25.165.21])
	by hub.freebsd.org (Postfix) with ESMTP id 015AC37B58D
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 31 May 2000 04:10:17 -0700 (PDT)
	(envelope-from alex@big.endian.de)
Received: from cichlids.com (p3E9D38C6.dip0.t-ipconnect.de [62.157.56.198])
	by mail.surf1.de (8.9.3/8.9.3) with ESMTP id NAA31158
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 31 May 2000 13:10:39 +0200
Received: from cichlids.cichlids.com (cichlids.cichlids.com [192.168.0.10])
	by cichlids.com (Postfix) with ESMTP id 09B60AC30
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 31 May 2000 13:10:39 +0200 (CEST)
Received: by cichlids.cichlids.com (Postfix, from userid 1001)
	id CB72E14AA3; Wed, 31 May 2000 13:10:12 +0200 (CEST)
Message-Id: <20000531111012.CB72E14AA3@cichlids.cichlids.com>
Date: Wed, 31 May 2000 13:10:12 +0200 (CEST)
From: alex@big.endian.de
Reply-To: alex@big.endian.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: add bus_alloc_resource.9 and bus_release_resource.9
X-Send-Pr-Version: 3.2

>Number:         18918
>Category:       docs
>Synopsis:       add bus_alloc_resource.9 and bus_release_resource.9
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    alex
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 31 04:20:01 PDT 2000
>Closed-Date:    Thu Jun 8 13:41:40 PDT 2000
>Last-Modified:  Thu Jun 08 14:04:06 PDT 2000
>Originator:     Alexander Langer
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
none
>Environment:


>Description:

Add these manpages.
No complaints from -hackers, to I guess they are ok.

>How-To-Repeat:


>Fix:

.\" -*- nroff -*-
.\"
.\" Copyright (c) 2000 Alexander Langer
.\"
.\" All rights reserved.
.\"
.\" This program is free software.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/bus_generic_map_intr.9,v 1.3 1999/08/28 00:21:19 peter Exp $
.\"
.Dd May 18, 2000
.Dt BUS_ALLOC_RESOURCE 9
.Os FreeBSD
.Sh NAME
.Nm bus_alloc_resource
.Nd alloc resources on a bus
.Sh SYNOPSIS
.Fd #include <sys/param.h>
.Fd #include <sys/bus.h>
.Fd #include <sys/rman.h>
.Fd #include <sys/resource.h>
.Ft struct resource *
.Fn bus_alloc_resource "device_t dev" "int type" "int *rid" "u_long start" "u_long end" "u_long count" "u_int flags"
.Sh DESCRIPTION
.Pp
This is an easy interface to the resource-management functions. It hides
the indirection through the parent's method table. 
This function generally should be called in attach, but (except in some
race cases) never earlier.
.Pp
Its arguments are as follows:
.Bl -item
.It
.Fa dev
is the device that requests ownership of the resource. Before allocation,
the device is owned by the parent bus.
.It
.Fa type
is the type of resource you want to allocate. It is one of:
.Bl -tag -width SYS_RES_MEMORY
.It Dv SYS_RES_IRQ
for IRQs
.It Dv SYS_RES_DRQ
for ISA DMA lines
.It Dv SYS_RES_IOPORT
for I/O ports
.It Dv SYS_RES_MEMORY
for I/O memory
.El
.It
.Fa rid
points to a bus specific handle that identifies the resource being allocated.
For ISA this is an index into an array of resources that have been setup
for this device by either the PnP mechanism, or via the hints mechanism.
For PCCARD, similar things are used as of writing, but that may change
in the future with newcard.  For PCI it just happens to be the offset
into pci config space which has a word that describes the resource.
The bus methods are free to change the RIDs that are passed to it -
that's why it is a pointer.
.It
.Fa start
and
.Fa end
are the start/end addresses of the resource.
If you specify values of
.Dv 0
for start and
.Dv ~0
for end, the default values for the bus are calculated.
.It
.Fa count
is the size of the resource, e.g. the size of an I/O port (often
.Dv 1
on PCI and device-dependent on ISA and PCCARD). If you specified the default
values for
.Fa start
and
.Fa end ,
then the default value of the bus is used if 
.Fa count
is smaller than the default value and
.Fa count
is used, if it is bigger as the default value.
.It
.Fa flags
sets the flags for the resource. You can set one or more of these flags:
.Bl -tag -width RF_SHAREABLE
.It Dv RF_ALLOCATED
resource has been reserved. Resource still needs to be activated with
.Xr rman_activate_resource 9 .
.It Dv RF_ACTIVE
activate resource atomically.
.It Dv RF_SHAREABLE
resource permits contemporaneous sharing. Should always be set unless you
know, that the resource cannot be shared. It is the bus-code's task to
filter out the flag if the bus doesn't support sharing, which is, for example,
case for pccard/cardbus, which can or can not share devices, depending on
the bus.
.It Dv RF_TIMESHARE
resource permits time-division sharing.
.El
.El
.Sh RETURN VALUES
A pointer to
.Va struct res
is returned on success, a null pointer otherwise.
.Sh EXAMPLES
This is some example code. The values of
.Va portid
and
.Va irqid
should be saved in the softc of the device after these calls.
.Bd -literal
	struct resource *portres, irqres;
	int portid, irqid;

	portid = 0;
	irqid = 0;
	portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &portid, 
			0ul, ~0ul, 32, RF_ACTIVE);
	irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &irqid, 
			0ul, ~0ul, 1, RF_ACTIVE | RF_SHAREABLE);
.Ed
.Sh SEE ALSO
.Xr driver 9 ,
.Xr device 9 ,
.Xr bus_release_resource 9
.Sh AUTHORS
This man page was written by
.An Alexander Langer Aq alex@big.endian.de
with parts by
.An Warner Losh Aq imp@FreeBSD.ORG .



.\" -*- nroff -*-
.\"
.\" Copyright (c) 2000 Alexander Langer
.\"
.\" All rights reserved.
.\"
.\" This program is free software.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/bus_generic_map_intr.9,v 1.3 1999/08/28 00:21:19 peter Exp $
.\"
.Dd May 18, 2000
.Dt BUS_RELEASE_RESOURCE 9
.Os FreeBSD
.Sh NAME
.Nm bus_release_resource
.Nd release resources on a bus
.Sh SYNOPSIS
.Fd #include <sys/param.h>
.Fd #include <sys/bus.h>
.Fd #include <sys/rman.h>
.Fd #include <sys/resource.h>
.Ft int
.Fn bus_release_resource "device_t dev" "int type" "int rid" "struct resource *r"
.Sh DESCRIPTION
.Pp
Free a resource allocated by
.Xr bus_alloc_resource 9 .
The resource must not be in use on release, i.e. call an appropriate function
before (e.g.
.Xr bus_teardown_intr 9
for IRQs).
.Bl -item
.It
.Fa dev
is the device that owns the resource.
.It
.Fa type
is the type of resource that is released. It must be of the same type
you allocated it as before. See
.Xr bus_alloc_resource 9
for valid types.
.It
.Fa rid
is the resource ID of the resource. The
.Fa rid
value must be the same as the one returned by
.Xr bus_alloc_resource 9 .
.It
.Fa r
is the pointer to
.Va struct res ,
i.e. the resource itself,
returned by
.Xr bus_alloc_resource 9 .
.El
.Sh RETURN VALUES
.Dv EINVAL
is returned, if the device
.Fa dev
has no parent,
.Dv 0
otherwise. The kernel will panic, if it can't release the
resource.
.Sh EXAMPLES
.Bd -literal
	/* deactivate IRQ */
	bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid);  

	/* release IRQ resource */
	bus_release_resource(dev, SYS_RES_IRQ, foosoftc->irqid,
		foosoftc->irqres);

	/* release I/O port resource */
	bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid,
		foosoftc->portres);
.Ed
.Sh SEE ALSO
.Xr driver 9 ,
.Xr device 9 ,
.Xr bus_alloc_resource 9
.Sh AUTHORS
This man page was written by
.An Alexander Langer Aq alex@big.endian.de .

>Release-Note:
>Audit-Trail:

From: Alexey Zelkin <phantom@cris.crimea.ua>
To: alex@big.endian.de
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Wed, 31 May 2000 15:27:50 +0300

 hi,
 
 Small comments.
 
 On Wed, May 31, 2000 at 01:10:12PM +0200, alex@big.endian.de wrote:
  
 > >Number:         18918
 > >Category:       docs
 > >Synopsis:       add bus_alloc_resource.9 and bus_release_resource.9
 
 > .\" $FreeBSD: src/share/man/man9/bus_generic_map_intr.9,v 1.3 1999/08/28 00:21:19 peter Exp $
 
 Should be just $FreeBSD$ 
 
 > .Sh DESCRIPTION
 > .Pp
 
 Redundant `.Pp'
  
 > .Sh RETURN VALUES
 > .Dv EINVAL
   ^^^^^^^^^^
 
 Should be `.Er EINVAL'
   
 -- 
 /* Alexey Zelkin                       && phantom@cris.net    */
 /* Tavric National University          && phantom@crimea.edu  */
 /* http://www.ccssu.crimea.ua/~phantom && phantom@FreeBSD.org */
 

From: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To: alex@big.endian.de
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Wed, 31 May 2000 10:14:29 -0400

 > For PCCARD, similar things are used as of writing, but that may change
 > in the future with newcard.  For PCI it just happens to be the offset
 
 It's preferrable that newlines be sprinkled liberally into manpages.
 
 This makes it easier to make it easier on the translators when minor
 changes are made.  It makes it easier to read future diffs.
 
 It's best done before importing the new manpage.
 
 Optimal places for newlines include after commas separating clauses
 and after periods.
 
 
 -- 
 Signature withheld by request of author.
 

From: Alexander Langer <alex@big.endian.de>
To: Alexey Zelkin <phantom@cris.crimea.ua>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Wed, 31 May 2000 16:42:00 +0200

 Thus spake Alexey Zelkin (phantom@cris.crimea.ua):
 
 > > .\" $FreeBSD: src/share/man/man9/bus_generic_map_intr.9,v 1.3 1999/08/28 00:21:19 peter Exp $
 > Should be just $FreeBSD$ 
 
 Uuupz, now you know where I got the template from :-P
 
 Hmm. Shall I redo the manpages, or can the commiter who commits it do
 that?
 
 Alex
 
 -- 
 I need a new ~/.sig.
 

From: Alexander Langer <alex@big.endian.de>
To: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Wed, 31 May 2000 16:43:43 +0200

 Thus spake Tim Vanderhoek (vanderh@ecf.utoronto.ca):
 
 > Optimal places for newlines include after commas separating clauses
 > and after periods.
 
 Ah. Didn't know that. Thanks.
 
 I'll redo the manpages, also with the merges from Alexey.
 
 Alex
 
 -- 
 I need a new ~/.sig.
 

From: Alexey Zelkin <phantom@cris.crimea.ua>
To: Alexander Langer <alex@big.endian.de>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Wed, 31 May 2000 17:59:27 +0300

 hi,
 
 On Wed, May 31, 2000 at 04:42:00PM +0200, Alexander Langer wrote:
  
 > Hmm. Shall I redo the manpages, or can the commiter who commits it do
 > that?
 
 IMHO best way is to apply suggested changes, place updated manpages somethere
 on the web and submit URL as followup to this PR.
 
 -- 
 /* Alexey Zelkin                       && phantom@cris.net    */
 /* Tavric National University          && phantom@crimea.edu  */
 /* http://www.ccssu.crimea.ua/~phantom && phantom@FreeBSD.org */
 

From: Alexander Langer <alex@big.endian.de>
To: FreeBSD-GNATS-submit@freebsd.org
Cc: freebsd-doc@FreeBSD.ORG
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Thu, 1 Jun 2000 14:47:03 +0200

 Too keep the new versions in the GNATS-db, here they are:
 
 .\" -*- nroff -*-
 .\"
 .\" Copyright (c) 2000 Alexander Langer
 .\"
 .\" All rights reserved.
 .\"
 .\" This program is free software.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1. Redistributions of source code must retain the above copyright
 .\"    notice, this list of conditions and the following disclaimer.
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
 .\"
 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
 .\"
 .Dd May 18, 2000
 .Dt BUS_ALLOC_RESOURCE 9
 .Os FreeBSD
 .Sh NAME
 .Nm bus_alloc_resource
 .Nd alloc resources on a bus
 .Sh SYNOPSIS
 .Fd #include <sys/param.h>
 .Fd #include <sys/bus.h>
 .Fd #include <sys/rman.h>
 .Fd #include <sys/resource.h>
 .Ft struct resource *
 .Fn bus_alloc_resource "device_t dev" "int type" "int *rid" "u_long start" "u_long end" "u_long count" "u_int flags"
 .Sh DESCRIPTION
 .Pp
 This is an easy interface to the resource-management functions.
 It hides the indirection through the parent's method table. 
 This function generally should be called in attach, but (except in some
 race cases) never earlier.
 .Pp
 Its arguments are as follows:
 .Bl -item
 .It
 .Fa dev
 is the device that requests ownership of the resource.
 Before allocation, the device is owned by the parent bus.
 .It
 .Fa type
 is the type of resource you want to allocate.
 It is one of:
 .Bl -tag -width SYS_RES_MEMORY
 .It Dv SYS_RES_IRQ
 for IRQs
 .It Dv SYS_RES_DRQ
 for ISA DMA lines
 .It Dv SYS_RES_IOPORT
 for I/O ports
 .It Dv SYS_RES_MEMORY
 for I/O memory
 .El
 .It
 .Fa rid
 points to a bus specific handle that identifies the resource being allocated.
 For ISA this is an index into an array of resources that have been setup
 for this device by either the PnP mechanism, or via the hints mechanism.
 For PCCARD, similar things are used as of writing,
 but that may change in the future with newcard.
 For PCI it just happens to be the offset into pci config space which has
 a word that describes the resource.
 The bus methods are free to change the RIDs that are passed to it -
 that's why it is a pointer.
 You must not depend on the value you gave it earlier.
 .It
 .Fa start
 and
 .Fa end
 are the start/end addresses of the resource.
 If you specify values of
 .Dv 0
 for start and
 .Dv ~0
 for end, the default values for the bus are calculated.
 .It
 .Fa count
 is the size of the resource, e.g. the size of an I/O port (often
 .Dv 1
 on PCI and device-dependent on ISA and PCCARD). If you specified the default
 values for
 .Fa start
 and
 .Fa end ,
 then the default value of the bus is used if 
 .Fa count
 is smaller than the default value and
 .Fa count
 is used, if it is bigger as the default value.
 .It
 .Fa flags
 sets the flags for the resource. You can set one or more of these flags:
 .Bl -tag -width RF_SHAREABLE
 .It Dv RF_ALLOCATED
 resource has been reserved.
 Resource still needs to be activated with
 .Xr rman_activate_resource 9 .
 .It Dv RF_ACTIVE
 activate resource atomically.
 .It Dv RF_SHAREABLE
 resource permits contemporaneous sharing.
 Should always be set unless you know, that the resource cannot be shared.
 It is the bus-code's task to filter out the flag if the bus doesn't
 support sharing, which is, for example, the case for pccard/cardbus,
 which can or can not share devices, depending on the bus.
 .It Dv RF_TIMESHARE
 resource permits time-division sharing.
 .El
 .El
 .Sh RETURN VALUES
 A pointer to
 .Va struct res
 is returned on success, a null pointer otherwise.
 .Sh EXAMPLES
 This is some example code. The values of
 .Va portid
 and
 .Va irqid
 should be saved in the softc of the device after these calls.
 .Bd -literal
 	struct resource *portres, irqres;
 	int portid, irqid;
 
 	portid = 0;
 	irqid = 0;
 	portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &portid, 
 			0ul, ~0ul, 32, RF_ACTIVE);
 	irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &irqid, 
 			0ul, ~0ul, 1, RF_ACTIVE | RF_SHAREABLE);
 .Ed
 .Sh SEE ALSO
 .Xr driver 9 ,
 .Xr device 9 ,
 .Xr bus_release_resource 9
 .Sh AUTHORS
 This man page was written by
 .An Alexander Langer Aq alex@big.endian.de
 with parts by
 .An Warner Losh Aq imp@FreeBSD.ORG .
 
 
 
 
 .\" -*- nroff -*-
 .\"
 .\" Copyright (c) 2000 Alexander Langer
 .\"
 .\" All rights reserved.
 .\"
 .\" This program is free software.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1. Redistributions of source code must retain the above copyright
 .\"    notice, this list of conditions and the following disclaimer.
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
 .\"
 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
 .\"
 .Dd May 18, 2000
 .Dt BUS_RELEASE_RESOURCE 9
 .Os FreeBSD
 .Sh NAME
 .Nm bus_release_resource
 .Nd release resources on a bus
 .Sh SYNOPSIS
 .Fd #include <sys/param.h>
 .Fd #include <sys/bus.h>
 .Fd #include <sys/rman.h>
 .Fd #include <sys/resource.h>
 .Ft int
 .Fn bus_release_resource "device_t dev" "int type" "int rid" "struct resource *r"
 .Sh DESCRIPTION
 Free a resource allocated by
 .Xr bus_alloc_resource 9 .
 The resource must not be in use on release, i.e. call an appropriate function
 before (e.g.
 .Xr bus_teardown_intr 9
 for IRQs).
 .Bl -item
 .It
 .Fa dev
 is the device that owns the resource.
 .It
 .Fa type
 is the type of resource that is released.
 It must be of the same type you allocated it as before.
 See
 .Xr bus_alloc_resource 9
 for valid types.
 .It
 .Fa rid
 is the resource ID of the resource.
 The
 .Fa rid
 value must be the same as the one returned by
 .Xr bus_alloc_resource 9 .
 .It
 .Fa r
 is the pointer to
 .Va struct res ,
 i.e. the resource itself,
 returned by
 .Xr bus_alloc_resource 9 .
 .El
 .Sh RETURN VALUES
 .Er EINVAL
 is returned, if the device
 .Fa dev
 has no parent,
 .Dv 0
 otherwise.
 The kernel will panic, if it can't release the resource.
 .Sh EXAMPLES
 .Bd -literal
 	/* deactivate IRQ */
 	bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid);  
 
 	/* release IRQ resource */
 	bus_release_resource(dev, SYS_RES_IRQ, foosoftc->irqid,
 		foosoftc->irqres);
 
 	/* release I/O port resource */
 	bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid,
 		foosoftc->portres);
 .Ed
 .Sh SEE ALSO
 .Xr driver 9 ,
 .Xr device 9 ,
 .Xr bus_alloc_resource 9
 .Sh AUTHORS
 This man page was written by
 .An Alexander Langer Aq alex@big.endian.de .
 

From: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To: Alexander Langer <alex@big.endian.de>
Cc: FreeBSD-GNATS-submit@freebsd.org, freebsd-doc@freebsd.org
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Thu, 1 Jun 2000 20:16:46 -0400

 On Thu, Jun 01, 2000 at 02:47:03PM +0200, Alexander Langer wrote:
 > 
 > The bus methods are free to change the RIDs that are passed to it -
 > that's why it is a pointer.
 
 grammar gnit: I think your subject(s) might be having trouble deciding whether
               it's plural or singular here.
 
 
 > on PCI and device-dependent on ISA and PCCARD). If you specified the default
 
 Either add a newline after the period or use two spaces after the
 period.  Preferrably the former.  :)
 
 
 > sets the flags for the resource. You can set one or more of these flags:
 
 [...]  same comment
 
 > .Bl -tag -width RF_SHAREABLE
 > .It Dv RF_ALLOCATED
 > resource has been reserved.
 > Resource still needs to be activated with
 
 I think that capitalising ``Resource'' here might be confusing.
 
 You've chosen to avoid capitalisation when referring to identifiers,
 which, although it breaks BSD tradition, is ok since it has entered
 into vogue in the last couple years.  Here, although ``resource''
 isn't formally an identifier, you've turned it almost into one by
 saying "resource has been reserved."
 
 > This is some example code. The values of
 
 [...] spacing
 
 Have you had sheldonh@FreeBSD.org review the manpage for its mdoc
 formatting?  I seem to remember he had a standing offer to review all
 manpages, and a promise to write a list of "common mdoc do's and
 dont's" which I have yet to see fulfilled.  :-)
 
 
 -- 
 Signature withheld by request of author.
 

From: Jeroen Ruigrok van der Werven <jruigrok@via-net-works.nl>
To: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
Cc: Alexander Langer <alex@big.endian.de>,
	FreeBSD-GNATS-submit@FreeBSD.ORG, freebsd-doc@FreeBSD.ORG
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Sat, 3 Jun 2000 16:31:56 +0200

 -On [20000602 02:18], Tim Vanderhoek (vanderh@ecf.utoronto.ca) wrote:
 >On Thu, Jun 01, 2000 at 02:47:03PM +0200, Alexander Langer wrote:
 >> 
 >> The bus methods are free to change the RIDs that are passed to it -
 >> that's why it is a pointer.
 >
 >grammar gnit: I think your subject(s) might be having trouble deciding
 >whether it's plural or singular here.
 
 This is definately an ambiguous sentence.
 
 Did you mean:
 
 The bus method pointer allows for easy changing of the RIDs passed to it.
 
 Or:
 
 The bus methods are free to change the RIDs that they are pointing to.
 
 >> on PCI and device-dependent on ISA and PCCARD). If you specified the
 >> default
 >
 >Either add a newline after the period or use two spaces after the
 >period.  Preferrably the former.  :)
 
 Definitely the former.
 
 -- 
 Jeroen Ruigrok van der Werven          Network- and systemadministrator
 <jruigrok@via-net-works.nl>            VIA Net.Works The Netherlands
 BSD: Technical excellence at its best  http://www.via-net-works.nl
 But touch my Tears, with your lips, touch my World, with your fingertips,
 and we can have forever...
 

From: Alexander Langer <alex@big.endian.de>
To: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
Cc: FreeBSD-GNATS-submit@FreeBSD.org, freebsd-doc@FreeBSD.org
Subject: Re: docs/18918: add bus_alloc_resource.9 and bus_release_resource.9
Date: Mon, 5 Jun 2000 11:51:39 +0200

 Thus spake Tim Vanderhoek (vanderh@ecf.utoronto.ca):
 
 [...] stuff modified
 
 > Have you had sheldonh@FreeBSD.org review the manpage for its mdoc
 > formatting?  I seem to remember he had a standing offer to review all
 
 Not yet.
 
 > manpages, and a promise to write a list of "common mdoc do's and
 > dont's" which I have yet to see fulfilled.  :-)
 
 He should use mine as dont's ;-)
 
 Alex
 
 -- 
 I need a new ~/.sig.
 
Responsible-Changed-From-To: freebsd-doc->asmodai 
Responsible-Changed-By: alex 
Responsible-Changed-When: Thu Jun 8 13:21:12 PDT 2000 
Responsible-Changed-Why:  
From his controlling position as my mentor, Jeroen _forced_ me 
to let himself commit these manpages. 

too bad... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18918 
State-Changed-From-To: open->closed 
State-Changed-By: alex 
State-Changed-When: Thu Jun 8 13:41:40 PDT 2000 
State-Changed-Why:  
I committed them. 


Responsible-Changed-From-To: asmodai->alex 
Responsible-Changed-By: alex 
Responsible-Changed-When: Thu Jun 8 13:41:40 PDT 2000 
Responsible-Changed-Why:  
Jeroen said, I confused him, and meant a different PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18918 
>Unformatted:
