I'm very pleased to announce the release of our new website and documentation using the new toolchain with Hugo and AsciiDoctor. To get more information about the new toolchain please read the FreeBSD Documentation Project Primer[1], Hugo docs[2] and AsciiDoctor docs[3]. Acknowledgment: Benedict Reuschling <bcr@> Glen Barber <gjb@> Hiroki Sato <hrs@> Li-Wen Hsu <lwhsu@> Sean Chittenden <seanc@> The FreeBSD Foundation [1] https://docs.FreeBSD.org/en/books/fdp-primer/ [2] https://gohugo.io/documentation/ [3] https://docs.asciidoctor.org/home/ Approved by: doceng, core
94 lines
3.3 KiB
Groff
94 lines
3.3 KiB
Groff
.\" -*- nroff -*-
|
|
.\"
|
|
.\" Copyright (c) 2001 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/DEVICE_IDENTIFY.9,v 1.12 2004/07/03 18:29:23 ru Exp %
|
|
.\" $FreeBSD$
|
|
.Dd May 13, 2004
|
|
.Dt DEVICE_IDENTIFY 9
|
|
.Os
|
|
.Sh 名称
|
|
.Nm DEVICE_IDENTIFY
|
|
.Nd デバイスの識別とその登録
|
|
.Sh 書式
|
|
.In sys/param.h
|
|
.In sys/bus.h
|
|
.Ft void
|
|
.Fn DEVICE_IDENTIFY "driver_t *driver" "device_t parent"
|
|
.Sh 解説
|
|
デバイスのための識別関数は、例えば ISA バスなどの、子デバイスを独立して
|
|
識別できないバス上のデバイスのためにだけ必要とされます。
|
|
これはデバイスを認識 (大抵はハードウェアの不明瞭でないレジスタに
|
|
アクセスすることによって行われます) し、
|
|
そのデバイスに関してカーネルに通知し、
|
|
新しいデバイスの実体を作成するために、使用されます。
|
|
.Pp
|
|
.Xr BUS_ADD_CHILD 9
|
|
はバスの子デバイスとして、デバイスを登録するために使用されます。
|
|
そのデバイスの (IRQ や I/O ポートのような) リソースは、個々のリソースのために
|
|
.Fn bus_set_resource
|
|
(詳細は
|
|
.Xr bus_set_resource 9
|
|
を参照)
|
|
を呼び出すことによってカーネルに登録されます。
|
|
.Pp
|
|
デバイスツリーおよびデバイスドライバツリーが解体されるため、
|
|
.Fn DEVICE_IDENTIFY
|
|
ルーチンはこれを考慮に入れる必要があります。
|
|
識別ルーチンを持っているデバイスドライバをロードおよびアンロードする場合には、
|
|
この可能性を排除するための特別の手段がとられない限りは、
|
|
その子ノードは同じノードを何度も追加する能力を持っています。
|
|
.Sh 使用例
|
|
以下の疑似コードは、ハードウェアの一部をプローブし、デバイスと
|
|
そのリソース (I/O ポート) をカーネルに登録する関数の例を示しています。
|
|
.Bd -literal
|
|
void
|
|
foo_identify(driver_t *driver, device_t parent)
|
|
{
|
|
device_t child;
|
|
|
|
デバイス情報の取り出し;
|
|
if (サポートするデバイスうちの 1 つがマッチする &&
|
|
デバイスツリーに未だ存在しない) {
|
|
child = BUS_ADD_CHILD(parent, 0, "foo", -1);
|
|
bus_set_resource(child, SYS_RES_IOPORT, 0, FOO_IOADDR, 1);
|
|
}
|
|
}
|
|
.Ed
|
|
.Sh 関連項目
|
|
.Xr BUS_ADD_CHILD 9 ,
|
|
.Xr bus_set_resource 9 ,
|
|
.Xr device 9 ,
|
|
.Xr device_add_child 9 ,
|
|
.Xr DEVICE_ATTACH 9 ,
|
|
.Xr DEVICE_DETACH 9 ,
|
|
.Xr DEVICE_PROBE 9 ,
|
|
.Xr DEVICE_SHUTDOWN 9
|
|
.Sh 作者
|
|
このマニュアルページは
|
|
.An Alexander Langer Aq alex@FreeBSD.org
|
|
が書きました。
|