.\" -*- 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_alloc_resource.9,v 1.19.2.1 2005/03/14 07:19:03 jmg Exp %
.\"
.\" $FreeBSD$
.Dd May 18, 2000
.Dt BUS_ALLOC_RESOURCE 9
.Os
.Sh ̾��
.Nm bus_alloc_resource ,
.Nm bus_alloc_resource_any
.Nd �ƤΥХ�����λ񸻤γ������
.Sh ��
.In sys/param.h
.In sys/bus.h
.Pp
.In machine/bus.h
.In sys/rman.h
.In machine/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"
.Ft struct resource *
.Fn bus_alloc_resource_any "device_t dev" "int type" "int *rid" "u_int flags"
.Sh ����
����ϻ񸻴����ؿ����ؤδ�ñ�ʥ��󥿥ե������Ǥ���
�ƤΥ᥽�åɥơ��֥���̤����Ū����ˡ���ä��ޤ���
���δؿ��ϡ�����Ū�˥����å����˸ƤӽФ����٤��Ǥ�����
(���Ĥ��ε��ʾ��������) �褷�Ƥ������˸ƤӽФ��ƤϤʤ�ޤ���
.Pp
.Fn bus_alloc_resource_any
�ؿ���
.Fn bus_alloc_resource
�Τ���δ�ñ�ʥ�åѤǤ���
�����
.Fa start ,
.Fa end
�����
.Fa count
���ͤȤ��ƥǥե���ȤΥ꥽���� (������
.Fa start
�β���򻲾Ȥ��Ƥ�������) �����ꤷ�ޤ���
.Pp
�����ϰʲ����̤�Ǥ���
.Bl -item
.It
.Fa dev
�ϡ��񸻤ν�ͭ���׵᤹��ǥХ����Ǥ���
����������ϡ��񸻤ϿƤΥХ��ˤ�äƽ�ͭ����Ƥ��ޤ���
.It
.Fa type
�ϡ�������Ƥ����񸻤η��Ǥ���
�ʲ������ 1 �ĤǤ���
.Bl -tag -width SYS_RES_MEMORY
.It Dv SYS_RES_IRQ
IRQ �ѡ�
.It Dv SYS_RES_DRQ
ISA DMA �饤���ѡ�
.It Dv SYS_RES_IOPORT
�����ϥݡ����ѡ�
.It Dv SYS_RES_MEMORY
�����ϥ����ѡ�
.El
.It
.Fa rid
�ϡ�������ƤƤ���񸻤��̤��롢�Х���ͭ�Υϥ�ɥ��ؤ��ޤ���
ISA �Ǥϡ�PnP �λ��Ȥߤޤ��� hints �λ��Ȥߤ��̤��ơ��ǥХ����Τ����
���åȥ��åפ���Ƥ���񸻤�����ؤΥ���ǥå����Ǥ���
PCCARD �Ǥϡ�����ʸ�Ϥ�񤤤Ƥ��븽�����Ǥ�Ʊ�ͤǤ�����
����� newcard �Ǥ��Ѥ�뤫�⤷��ޤ���
PCI �Ǥϡ�pci ����ե������֤ˤ����ơ�
�񸻤򵭽Ҥ����ɤؤΥ��ե��åȤˤʤäƤ��ޤ���
�Х��Υ᥽�åɤϡ������Ȥ���Ϳ�����Ƥ��� RID ��̵���¤��ѹ����ޤ���
������Ϳ���������ͤ˰�¸���ƤϤʤ�ޤ���
.It
.Fa start
�����
.Fa end
�ϻ񸻤γ���/��λ���ɥ쥹�Ǥ���
.Fa start
�� 0ul ��
.Fa end
�� ~0ul ��
.Fa count
�� 1 ����ꤷ�����ˤϡ��Х��Τ���Υǥե�����ͤ��׻�����ޤ���
.It
.Fa count
�ϻ񸻤��礭���Ǥ���
�㤨�С������ϥݡ��Ȥ��礭�����̾� 1 �Х��ȤǤ� (��������
���Ĥ��ΥǥХ����Ϥ�����񤭤��ޤ�)��
.Fa start
�����
.Fa end
�˥ǥե�����ͤ���ꤷ����硢
.Fa count
���ǥե�����ͤ��⾮�����ʤ�Хǥե�����ͤ����Ѥ��졢
.Fa count
���ǥե�����Ͱʾ�ʤ�� count �����Ѥ���ޤ���
.It
.Fa flags
�ϻ񸻤Τ���Υե饰�����ꤷ�ޤ���
�ʲ��Υե饰�� 1 �İʾ�����Ǥ��ޤ���
.Bl -tag -width RF_SHAREABLE
.It Dv RF_ALLOCATED
�񸻤ϴ���ͽ�󤵤�Ƥ��ޤ���
�񸻤ϰ�³��
.Xr bus_activate_resource 9
�dz����������ɬ�פ�����ޤ���
.It Dv RF_ACTIVE
�Բ�ʬ�ˡ��񸻤���������ޤ���
.It Dv RF_SHAREABLE
�񸻤�Ʊ����ͭ����Ĥ��ޤ���
���λ񸻤���ͭ�ԲĤǤ��뤳�Ȥ��Τ�ʤ���硢������ꤵ���٤��Ǥ���
���ΥХ�����ͭ�򥵥ݡ��Ȥ��Ƥ��ʤ���硢
���Υե饰��������ΤϥХ��ɥ饤�ФλŻ��Ǥ���
�㤨�С�
.Xr pccard 4
�� IRQ ��ͭ�Ǥ��ޤ��󤬡�����
.Xr cardbus 4
�϶�ͭ�Ǥ��ޤ���
.It Dv RF_TIMESHARE
�񸻤ϻ�ʬ�䶦ͭ����Ĥ��ޤ���
.El
.El
.Sh �����
�������ˤ�
.Va struct resource
��¤�ΤؤΥݥ��󥿤��֤��졢�����Ǥʤ����ˤϥ̥�ݥ��󥿤��֤���ޤ���
.Sh ������
����� 32 �Х��Ȥ� I/O �ݡ����ϰϤ� IRQ �������Ƥ륵��ץ�Υ����ɤǤ���
.Va portid
�����
.Va irqid
���ͤϤ����θƤӽФ��θ�ǡ��ǥХ����� softc �������¸�����Ϥ��Ǥ���
.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_any(dev, SYS_RES_IRQ, &irqid,
			RF_ACTIVE | RF_SHAREABLE);
.Ed
.Sh ��Ϣ����
.Xr bus_activate_resource 9 ,
.Xr bus_release_resource 9 ,
.Xr device 9 ,
.Xr driver 9
.Sh ���
.An -nosplit
���Υޥ˥奢��ڡ�����
.An Alexander Langer Aq alex@big.endian.de
�ˤ�äƽ񤫤졢��ʬŪ��
.An Warner Losh Aq imp@FreeBSD.org
�ˤ�äƽ񤫤�ޤ�����