2003-04-06 22:22:56 +04:00
|
|
|
.\" $NetBSD: config.9,v 1.13 2003/04/06 18:22:56 wiz Exp $
|
2001-07-01 08:11:13 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Gregory McGarry.
|
|
|
|
.\"
|
|
|
|
.\" 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.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
2001-09-04 06:51:15 +04:00
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
2001-07-01 08:11:13 +04:00
|
|
|
.\" 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.
|
|
|
|
.\"
|
2002-09-06 19:44:45 +04:00
|
|
|
.Dd September 6, 2002
|
2001-07-01 08:11:13 +04:00
|
|
|
.Dt CONFIG 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm config
|
|
|
|
.Nd the autoconfiguration framework
|
|
|
|
.Do
|
|
|
|
device definition
|
|
|
|
.Dc
|
|
|
|
language
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
In
|
|
|
|
.Nx ,
|
|
|
|
the
|
|
|
|
.Xr config 8
|
|
|
|
program reads and verifies a machine description file specifying the
|
2002-10-14 17:43:14 +04:00
|
|
|
devices to include in the kernel.
|
|
|
|
A table is produced by
|
2001-07-01 08:11:13 +04:00
|
|
|
.Xr config 8
|
|
|
|
which is used by the kernel during autoconfiguration (see
|
|
|
|
.Xr autoconf 9 )
|
|
|
|
giving needed hints and details on matching hardware devices with
|
|
|
|
device drivers.
|
|
|
|
.Pp
|
|
|
|
Each device in the machine description file has:
|
|
|
|
.Bl -tag -width xxxxxx
|
|
|
|
.It A Name
|
|
|
|
The name is simply an alphanumeric string that ends in a unit number
|
2002-10-14 17:43:14 +04:00
|
|
|
(e.g., "sd0", "sd1", and so forth).
|
|
|
|
These unit numbers identify particular instances of a base device name;
|
|
|
|
the base name in turn maps directly to a device driver.
|
|
|
|
Device unit numbers are independent of hardware features.
|
2001-07-01 08:11:13 +04:00
|
|
|
.It A Parent
|
2002-10-14 17:43:14 +04:00
|
|
|
Every device must have a parent.
|
|
|
|
The pairing is denoted by "child at parent".
|
|
|
|
These pairings form the links in a directed graph.
|
|
|
|
The root device is the only exception, as it does not have a parent.
|
2001-07-01 08:11:13 +04:00
|
|
|
.It Locators
|
|
|
|
Locators are used to augment the parent/child pairings the locate
|
2002-10-14 17:43:14 +04:00
|
|
|
specific devices.
|
|
|
|
Each locator value is simply an integer that represents some sort of
|
|
|
|
device address on the parent bus or controller.
|
|
|
|
This can be a memory address, and I/O port, a driver number, or any
|
|
|
|
other value.
|
|
|
|
Locators can sometimes be wildcarded on devices that support direct
|
|
|
|
connection.
|
2001-07-01 08:11:13 +04:00
|
|
|
.It Attributes
|
|
|
|
An attribute describes the device's relationship with the code; it
|
2002-10-14 17:43:14 +04:00
|
|
|
then serves to constrain the device graph.
|
|
|
|
A
|
2001-07-01 08:11:13 +04:00
|
|
|
.Em plain attribute
|
2002-10-14 17:43:14 +04:00
|
|
|
describes some attribute of a device.
|
|
|
|
An
|
2001-07-01 08:11:13 +04:00
|
|
|
.Em interface attribute
|
|
|
|
describes a kind of
|
|
|
|
.Do
|
|
|
|
software interface
|
|
|
|
.Dc
|
2003-04-06 22:22:56 +04:00
|
|
|
and declares the device's ability to support other devices that use
|
2002-10-14 17:43:14 +04:00
|
|
|
that interface.
|
|
|
|
In addition, an interface attribute usually identifies additional locators.
|
2001-07-01 08:11:13 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
During autoconfiguration, the directed graph is turned into a tree by
|
|
|
|
nominating one device as the root node and matching drivers with
|
2002-03-24 01:36:45 +03:00
|
|
|
devices by doing a depth-first traversal through the graph starting at
|
2001-07-01 08:11:13 +04:00
|
|
|
this root node.
|
|
|
|
.Pp
|
|
|
|
However, there must be constraints on the parent/child pairings that
|
2002-10-14 17:43:14 +04:00
|
|
|
are possible.
|
|
|
|
These constraints are embedded in the
|
2001-07-01 08:11:13 +04:00
|
|
|
.Do
|
|
|
|
device definition
|
|
|
|
.Dc
|
2002-10-14 17:43:14 +04:00
|
|
|
files.
|
|
|
|
The remainder of this page describes the
|
2001-07-01 08:11:13 +04:00
|
|
|
.Do
|
|
|
|
device definition
|
|
|
|
.Dc
|
|
|
|
language and how to use this language to add new functionality to the
|
|
|
|
.Nx
|
|
|
|
kernel.
|
|
|
|
.Sh DEVICE DEFINITION FILES
|
|
|
|
The device definition files are separated into machine-dependent and
|
2002-10-14 17:43:14 +04:00
|
|
|
machine-independent files.
|
|
|
|
The machine-dependent file is located in
|
2002-02-13 11:17:26 +03:00
|
|
|
.Pa sys/arch/\*[Lt]arch\*[Gt]/conf/files.\*[Lt]arch\*[Gt] ,
|
|
|
|
where \*[Lt]arch\*[Gt] is the name of
|
2001-07-01 08:11:13 +04:00
|
|
|
.Nx
|
2002-10-14 17:43:14 +04:00
|
|
|
architecture.
|
|
|
|
The machine-independent file is located in
|
2001-07-01 08:11:13 +04:00
|
|
|
.Pa sys/conf/files .
|
|
|
|
It in turn includes files for the machine-independent drivers located
|
|
|
|
in
|
2002-02-13 11:17:26 +03:00
|
|
|
.Pa sys/dev/\*[Lt]bus\*[Gt]/files.\*[Lt]bus\*[Gt] ,
|
|
|
|
where \*[Lt]bus\*[Gt] is the name of the machine-independent bus.
|
2001-07-01 08:11:13 +04:00
|
|
|
.Pp
|
2002-10-14 17:43:14 +04:00
|
|
|
These files define all legal devices and pseudo-devices.
|
|
|
|
They also define all attributes and interfaces, establishing the rules that
|
2001-07-01 08:11:13 +04:00
|
|
|
determine allowable machine descriptions, and list the source files
|
|
|
|
that make up the kernel.
|
|
|
|
.Pp
|
|
|
|
Each device definition file consists of a list of statements,
|
2002-10-14 17:43:14 +04:00
|
|
|
typically one per line.
|
|
|
|
Comments may be inserted anywhere using the
|
2001-07-01 08:11:13 +04:00
|
|
|
.Do
|
|
|
|
#
|
|
|
|
.Dc
|
|
|
|
character, and any line that begins with white space continues the
|
2002-10-14 17:43:14 +04:00
|
|
|
previous line.
|
|
|
|
Valid statements are:
|
2001-07-01 08:11:13 +04:00
|
|
|
.Bl -tag -width xxxxxx
|
2001-12-13 22:26:50 +03:00
|
|
|
.It defflag [filename] {options}
|
|
|
|
The space-separated list of pre-processor macros
|
|
|
|
.Em options
|
|
|
|
are defined in file
|
|
|
|
.Em filename .
|
|
|
|
This statement permits ``options FOO'' for FOO (i.e, without a value)
|
|
|
|
in the machine description file.
|
|
|
|
.Xr config 8
|
2002-10-14 17:43:14 +04:00
|
|
|
will generate an error if a value is given.
|
|
|
|
If the filename field is not specified, the options are defined on
|
2003-03-30 21:09:37 +04:00
|
|
|
the command line invocation of
|
2001-12-13 22:26:50 +03:00
|
|
|
.Xr make 1 .
|
|
|
|
The
|
|
|
|
.Em option
|
|
|
|
is case-sensitive.
|
|
|
|
.It defparam [filename] {options}
|
|
|
|
The space-separated list of pre-processor macros
|
|
|
|
.Em options
|
|
|
|
are defined in file
|
|
|
|
.Em filename .
|
|
|
|
This statement permits ``options FOO=bar'' or ``option FOO="\\"com\\""''
|
|
|
|
in the machine description file.
|
|
|
|
.Xr config 8
|
2002-10-14 17:43:14 +04:00
|
|
|
will generate an error if a value is not given.
|
|
|
|
If the filename field is not specified, the options are defined on
|
2003-03-30 21:09:37 +04:00
|
|
|
the command line invocation of
|
2001-12-13 22:26:50 +03:00
|
|
|
.Xr make 1 .
|
|
|
|
The
|
|
|
|
.Em option
|
|
|
|
is case-sensitive.
|
2001-07-01 08:11:13 +04:00
|
|
|
.It defopt [filename] {options}
|
|
|
|
The space-separated list of pre-processor macros
|
|
|
|
.Em options
|
|
|
|
are defined in file
|
|
|
|
.Em filename .
|
2001-12-13 22:26:50 +03:00
|
|
|
This statement permits the syntax of either the defflag and defparam
|
|
|
|
statements and
|
|
|
|
.Xr config 8
|
|
|
|
does not perform any checking of whether ``options FOO'' takes a
|
2002-10-14 17:43:14 +04:00
|
|
|
value.
|
|
|
|
Therefore, the use of the defopt statement is deprecated in
|
|
|
|
favour of the defflag and defparam statements.
|
|
|
|
If the filename field is not specified, the options are defined on
|
2003-03-30 21:09:37 +04:00
|
|
|
the command line invocation of
|
2001-12-13 22:26:50 +03:00
|
|
|
.Xr make 1 .
|
2001-07-01 08:11:13 +04:00
|
|
|
The
|
|
|
|
.Em option
|
|
|
|
is case-sensitive.
|
|
|
|
.It deffs [filename] name
|
|
|
|
Define a filesystem
|
|
|
|
.Em name .
|
|
|
|
.It devclass name
|
|
|
|
Define a device class
|
|
|
|
.Em name .
|
|
|
|
A device class is similar to an attribute.
|
|
|
|
.It define name [{locators}]
|
|
|
|
The attribute
|
|
|
|
.Em name
|
2002-10-14 17:43:14 +04:00
|
|
|
is defined and device definitions can then refer to it.
|
|
|
|
If the attribute is an interface attribute and defines optional
|
2001-07-01 08:11:13 +04:00
|
|
|
.Em locators ,
|
|
|
|
device attributes that refer to
|
|
|
|
.Em name
|
|
|
|
are assumed to share the interface and require the same locators.
|
|
|
|
.It device name [{locators}]: [attributes]
|
|
|
|
The device
|
|
|
|
.Em name
|
|
|
|
is defined and requires the optional comma-separated list of locators
|
|
|
|
.Em locators .
|
|
|
|
The optional
|
|
|
|
.Em attributes
|
|
|
|
define attribute dependencies.
|
|
|
|
.It attach name at interface [with ifname]: [attributes]
|
|
|
|
The device
|
|
|
|
.Em name
|
|
|
|
is defined and supports the interface
|
|
|
|
.Em interface .
|
|
|
|
If
|
|
|
|
.Em ifname
|
|
|
|
is specified, it is used to specify the interface to the driver for
|
|
|
|
device
|
|
|
|
.Em name
|
|
|
|
(see
|
|
|
|
.Xr driver 9
|
|
|
|
for details).
|
|
|
|
The optional
|
|
|
|
.Em attributes
|
|
|
|
define attribute dependencies.
|
|
|
|
.It defpseudo name: [{locators}]
|
|
|
|
The pseudo-device
|
|
|
|
.Em name
|
2002-10-14 17:43:14 +04:00
|
|
|
is defined.
|
|
|
|
The optional
|
2001-07-01 08:11:13 +04:00
|
|
|
.Em locators
|
|
|
|
may be defined, but are largely pointless since no device can attach
|
|
|
|
to a pseudo-device.
|
|
|
|
.It file pathname [attributes [flags]] [rule]
|
|
|
|
The file
|
|
|
|
.Em pathname
|
2002-10-14 17:43:14 +04:00
|
|
|
is added to the list of files used to build the kernel.
|
|
|
|
If no attributes are specified, the file is always added to the kernel
|
|
|
|
compilation.
|
|
|
|
If any of the attributes are specified by other devices in the machine
|
2003-04-06 19:50:17 +04:00
|
|
|
description file, then the file is included in compilation, otherwise it
|
2002-10-14 17:43:14 +04:00
|
|
|
is omitted.
|
|
|
|
Valid values for the optional flags are:
|
2001-07-01 08:11:13 +04:00
|
|
|
.Bl -tag -width xxxxxx
|
|
|
|
.It needs-count
|
|
|
|
Specify that config should generate a file for each of the attributes
|
|
|
|
notifying the driver how many of some particular device or set of
|
2002-10-14 17:43:14 +04:00
|
|
|
devices are configured in the kernel.
|
|
|
|
This flag allows drivers to make calculations of driver used at compile time.
|
2001-07-01 08:11:13 +04:00
|
|
|
This option prevents autoconfiguration cloning.
|
|
|
|
.It needs-flag
|
2002-03-24 01:36:45 +03:00
|
|
|
This flag performs the same operation as
|
2001-07-01 08:11:13 +04:00
|
|
|
.Em needs-count
|
2002-10-14 17:43:14 +04:00
|
|
|
but only records if the number is nonzero.
|
|
|
|
Since the count is not exact,
|
2001-07-01 08:11:13 +04:00
|
|
|
.Em needs-flag
|
|
|
|
does not prevent autoconfiguration cloning.
|
|
|
|
.El
|
2002-09-06 18:13:48 +04:00
|
|
|
.It device-major name char [block] [attributes]
|
|
|
|
The character device switch
|
|
|
|
.Em name
|
|
|
|
associated with a character major device number is added to the list of
|
2002-10-14 17:43:14 +04:00
|
|
|
device switches used to build the kernel.
|
|
|
|
If
|
2002-09-06 18:13:48 +04:00
|
|
|
.Em block
|
|
|
|
is specified, the block device switch associated with a block major device
|
2002-10-14 17:43:14 +04:00
|
|
|
number is also added.
|
|
|
|
If all of attributes are specified by devices in the machine description
|
|
|
|
files, then device switches are added into the device switches' table of
|
|
|
|
the kernel in compilation, otherwise they are omitted.
|
2001-07-01 08:11:13 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
To allow locators to be wildcarded in the machine description file,
|
2002-10-14 17:43:14 +04:00
|
|
|
their default value must be defined in the attribute definition.
|
|
|
|
To allow locators to be omitted entirely in the machine description file,
|
|
|
|
enclose the locator in square brackets.
|
|
|
|
This can be used when some locators do not make sense for some devices,
|
|
|
|
but the software interface requires them.
|
2001-07-01 08:11:13 +04:00
|
|
|
.Sh CODE REFERENCES
|
|
|
|
This section describes places within the
|
|
|
|
.Nx
|
2003-02-05 01:38:15 +03:00
|
|
|
source tree where actual code implementing or using the
|
2002-10-14 17:43:14 +04:00
|
|
|
autoconfiguration framework can be found.
|
|
|
|
All pathnames are relative to
|
2001-07-01 08:11:13 +04:00
|
|
|
.Pa /usr/src .
|
|
|
|
.Pp
|
|
|
|
The device definition files are in
|
|
|
|
.Pa sys/conf/files ,
|
2002-02-13 11:17:26 +03:00
|
|
|
.Pa sys/arch/\*[Lt]arch\*[Gt]/conf/files.\*[Lt]arch\*[Gt] ,
|
2001-07-01 08:11:13 +04:00
|
|
|
and
|
2002-02-13 11:17:26 +03:00
|
|
|
.Pa sys/dev/\*[Lt]bus\*[Gt]/files.\*[Lt]bus\*[Gt] .
|
2001-07-01 08:11:13 +04:00
|
|
|
.Pp
|
|
|
|
The grammar for machine description files can be found in
|
|
|
|
.Xr config 8 ,
|
|
|
|
in
|
|
|
|
.Pa usr.sbin/config/gram.y .
|
|
|
|
.Sh SEE ALSO
|
2001-12-26 03:16:30 +03:00
|
|
|
.Xr config 8 ,
|
|
|
|
.Xr autoconf 9 ,
|
|
|
|
.Xr driver 9
|
2001-07-01 08:11:13 +04:00
|
|
|
.Rs
|
|
|
|
.%T "Building 4.4 BSD Systems with Config"
|
|
|
|
.Re
|
|
|
|
.Rs
|
|
|
|
.%A Chris Torek
|
|
|
|
.%T "Device Configuration in 4.4BSD"
|
|
|
|
.%D 1992
|
|
|
|
.Re
|
|
|
|
.Sh HISTORY
|
|
|
|
Autoconfiguration first appeared in
|
|
|
|
.Bx 4.1 .
|
|
|
|
The autoconfiguration framework was completely revised in
|
|
|
|
.Bx 4.4 .
|
|
|
|
It has been modified within
|
|
|
|
.Nx
|
|
|
|
to support bus-independent drivers and bus-dependent attachments.
|