1 .\" $NetBSD: config.samples.5,v 1.3 2007/09/10 10:54:21 cube Exp $
3 .\" Copyright (c) 2006 The NetBSD Foundation.
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 .\" POSSIBILITY OF SUCH DAMAGE.
32 .Nd kernel configuration file syntax examples
34 .Ss Devices, drivers and instances
35 For a given device, at most one driver will attach.
36 In order for a driver to attach, the kernel configuration file must include a
37 compatible instance of the driver for the location of the device.
38 The following lines from the
40 kernel configuration file of
42 are examples of instances of drivers:
44 pchb* at pci? dev ? function ? # PCI-Host bridges
45 pcib* at pci? dev ? function ? # PCI-ISA bridges
46 ppb* at pci? dev ? function ? # PCI-PCI bridges
48 siop* at pci? dev ? function ? # Symbios 53c8xx SCSI
49 esiop* at pci? dev ? function ? # Symbios 53c875 SCSI and newer
51 ix0 at isa? port 0x300 irq 10 # EtherExpress/16
54 The first three instances allow three different drivers to attach to all the
55 matching devices found on any PCI bus.
56 This is the most generic case.
58 The next two lines allow two distinct drivers to attach to any matching device
59 found on any PCI bus, but those two drivers are special because they both
60 support some of the same devices.
61 Each of the driver has a matching function that returns their score for the
62 device that is being considered.
64 decides at run-time which driver will attach.
65 Of course, it is deterministic so if the user wants to change the driver that
66 attaches to the device, the instance of the other driver will have to be
67 removed, e.g. by commenting it out.
69 The last line configures an instance of an ISA device.
70 Unlike the PCI bus, the ISA bus cannot discover the devices that are present on
72 The driver has to try accessing the device in order to discover it.
73 That implies locators must be specified to some extent: a driver would
74 usually need the base address of the device, some need the IRQ line that the
75 device is configured to use, thoug some others would just try a set of known
76 values, at the risk of badly interacting with other devices on the bus.
77 .Ss Hard-wiring kernel configuration
78 This technique consists in specifying exactly the location of the devices on a
80 In the general case it has very little use, because it does not change the size
81 of the kernel, and it will prevent it from finding devices in case the hardware
82 changes, even slightly.
84 Let's consider the following excerpt of
88 auich0 at pci0 dev 31 function 5: i82801DB/DBM (ICH4/ICH4M) AC-97 Audio
93 driver (which controls Intel's AC-97 audio chips) attached there because of the
97 auich* at pci? dev ? function ?
100 Hard-wiring that instance means re-writing it to the following:
102 auich0 at pci0 dev 31 function 5
107 will attach to that specific location, or will not attach.
108 .Ss Removing options and drivers
109 When two kernel configurations differ by a very small number of changes, it is
110 easier to manage them by having one include the other, and add or remove the
112 Removing options and drivers is also useful in the situation of a user who
113 wants to follow the development of
115 drivers and options get added to the configuration files found in the source
118 so one can include it and remove all options and drivers that are not relevant
119 to the considered system.
122 will then automatically be followed and used in case they are relevant.
124 While negating an options (with
126 is unambiguous, it is not as clear for devices instances.
129 .Ic no Ar instance definition
132 syntax only apply on the current state of the configuration file, not on the
133 resulting kernel binary.
135 has no knowledge of instance negation, thus it is currently impossible to
136 express the following in a kernel configuration file:
137 .Bd -ragged -offset indent
138 .Do I want support for
142 but I do not want any instance of
149 For a real-world use of
150 .Ic no device at Ar instance
151 consider the following, taken from
153 .Bd -literal -offset indent
154 include "arch/i386/conf/GENERIC"
159 [... more instances of legacy devices attaching at acpi? ...]
164 One could actually live without the
166 instance, as all the legacy devices are attached at
168 But unfortunately, dependencies on the
170 attribute are not well registered all through the source tree, so an instance
173 driver is required to compile a kernel.
175 .Bd -literal -offset indent
179 is what is intended, the
181 instance itself must be kept, and that is precisely the difference made by:
182 .Bd -literal -offset indent
185 .Ss Interface attributes
186 .Em Interface attributes
191 which often confuses users and utilities that parse
193 output to manipulate kernel configuration files.
194 What they are is best shown by the following example.
198 output look like this:
199 .Bd -literal -offset indent
200 auvia0 at pci0 dev 17 function 5: VIA Technologies VT8235 AC'97 Audio (rev 0x50)
201 audio0 at auvia0: full duplex, mmap, independent
204 while the kernel configuration look like this:
206 auvia* at pci? dev ? function ?
210 It is not obvious from the kernel configuration file that an
212 device can attach at an
217 .Em interface attribute ,
221 Of course, it is possible to specify
222 .Bd -literal -offset indent
225 in the kernel configuration file, but then one instance per audio controler
227 .Em Interface attributes
228 reflect the fact there is a standard way to attach a device to its parent, no
229 matter what the latter is precisely.
230 It also means lower maintainance of the kernel configuration files because
231 drivers for audio controlers are added more easily.
233 Most attachments are done through
234 .Em interface attributes ,
235 although only a few of them are specified that way in the configuration files
237 Another example of such an attribute is
239 .Bd -literal -offset indent
240 viaide0 at pci0 dev 17 function 1
241 atabus0 at viaide0 channel 0
243 viaide* at pci? dev ? function ?
246 .\" Suggested section, maybe for later:
247 .\" .Ss Using a third-party driver