1*e82c4d9bSandvar.\" $NetBSD: config.samples.5,v 1.8 2022/04/04 19:33:46 andvar Exp $ 28a5d15c7Scube.\" 38a5d15c7Scube.\" Copyright (c) 2006 The NetBSD Foundation. 48a5d15c7Scube.\" All rights reserved. 58a5d15c7Scube.\" 68a5d15c7Scube.\" Redistribution and use in source and binary forms, with or without 78a5d15c7Scube.\" modification, are permitted provided that the following conditions 88a5d15c7Scube.\" are met: 98a5d15c7Scube.\" 1. Redistributions of source code must retain the above copyright 108a5d15c7Scube.\" notice, this list of conditions and the following disclaimer. 118a5d15c7Scube.\" 2. Redistributions in binary form must reproduce the above copyright 128a5d15c7Scube.\" notice, this list of conditions and the following disclaimer in the 138a5d15c7Scube.\" documentation and/or other materials provided with the distribution. 148a5d15c7Scube.\" 158a5d15c7Scube.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 168a5d15c7Scube.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 178a5d15c7Scube.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 188a5d15c7Scube.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 198a5d15c7Scube.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 208a5d15c7Scube.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 218a5d15c7Scube.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 228a5d15c7Scube.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 238a5d15c7Scube.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 248a5d15c7Scube.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 258a5d15c7Scube.\" POSSIBILITY OF SUCH DAMAGE. 268a5d15c7Scube.\" 273bde459bScube.Dd June 4, 2006 288a5d15c7Scube.Dt CONFIG.SAMPLES 5 298a5d15c7Scube.Os 308a5d15c7Scube.Sh NAME 318a5d15c7Scube.Nm config.samples 328a5d15c7Scube.Nd kernel configuration file syntax examples 338a5d15c7Scube.Sh DESCRIPTION 348a5d15c7Scube.Ss Devices, drivers and instances 358a5d15c7ScubeFor a given device, at most one driver will attach. 368a5d15c7ScubeIn order for a driver to attach, the kernel configuration file must include a 378a5d15c7Scubecompatible instance of the driver for the location of the device. 388a5d15c7ScubeThe following lines from the 398a5d15c7Scube.Pa GENERIC 408a5d15c7Scubekernel configuration file of 418a5d15c7Scube.Nx Ns / Ns i386 428a5d15c7Scubeare examples of instances of drivers: 43eef82c75Suwe.Bd -literal -offset indent 448a5d15c7Scubepchb* at pci? dev ? function ? # PCI-Host bridges 458a5d15c7Scubepcib* at pci? dev ? function ? # PCI-ISA bridges 468a5d15c7Scubeppb* at pci? dev ? function ? # PCI-PCI bridges 478a5d15c7Scube 488a5d15c7Scubesiop* at pci? dev ? function ? # Symbios 53c8xx SCSI 498a5d15c7Scubeesiop* at pci? dev ? function ? # Symbios 53c875 SCSI and newer 508a5d15c7Scube 518a5d15c7Scubeix0 at isa? port 0x300 irq 10 # EtherExpress/16 528a5d15c7Scube.Ed 538a5d15c7Scube.Pp 548a5d15c7ScubeThe first three instances allow three different drivers to attach to all the 55eef82c75Suwematching devices found on any 56eef82c75Suwe.Tn PCI 57eef82c75Suwebus. 588a5d15c7ScubeThis is the most generic case. 598a5d15c7Scube.Pp 608a5d15c7ScubeThe next two lines allow two distinct drivers to attach to any matching device 61eef82c75Suwefound on any 62eef82c75Suwe.Tn PCI 63eef82c75Suwebus, but those two drivers are special because they both 648a5d15c7Scubesupport some of the same devices. 658a5d15c7ScubeEach of the driver has a matching function that returns their score for the 668a5d15c7Scubedevice that is being considered. 678a5d15c7Scube.Xr autoconf 9 688a5d15c7Scubedecides at run-time which driver will attach. 698a5d15c7ScubeOf course, it is deterministic so if the user wants to change the driver that 708a5d15c7Scubeattaches to the device, the instance of the other driver will have to be 718a5d15c7Scuberemoved, e.g. by commenting it out. 728a5d15c7Scube.Pp 73eef82c75SuweThe last line configures an instance of an 74eef82c75Suwe.Tn ISA 75eef82c75Suwedevice. 76eef82c75SuweUnlike the 77eef82c75Suwe.Tn PCI 78eef82c75Suwebus, the 79eef82c75Suwe.Tn ISA 80eef82c75Suwebus cannot discover the devices that are present on the bus. 818a5d15c7ScubeThe driver has to try accessing the device in order to discover it. 828a5d15c7ScubeThat implies locators must be specified to some extent: a driver would 83eef82c75Suweusually need the base address of the device, some need the 84eef82c75Suwe.Tn IRQ 85eef82c75Suweline that the 8626dba06cSwizdevice is configured to use, though some others would just try a set of known 878a5d15c7Scubevalues, at the risk of badly interacting with other devices on the bus. 888a5d15c7Scube.Ss Hard-wiring kernel configuration 898a5d15c7ScubeThis technique consists in specifying exactly the location of the devices on a 908a5d15c7Scubegiven system. 918a5d15c7ScubeIn the general case it has very little use, because it does not change the size 928a5d15c7Scubeof the kernel, and it will prevent it from finding devices in case the hardware 938a5d15c7Scubechanges, even slightly. 948a5d15c7Scube.Pp 958a5d15c7ScubeLet's consider the following excerpt of 968a5d15c7Scube.Xr dmesg 8 978a5d15c7Scubeoutput: 98eef82c75Suwe.Bd -literal -offset indent 998a5d15c7Scubeauich0 at pci0 dev 31 function 5: i82801DB/DBM (ICH4/ICH4M) AC-97 Audio 1008a5d15c7Scube.Ed 1018a5d15c7Scube.Pp 1028a5d15c7ScubeThe 1038a5d15c7Scube.Xr auich 4 1048a5d15c7Scubedriver (which controls Intel's AC-97 audio chips) attached there because of the 1058a5d15c7Scubefollowing instance of 1068a5d15c7Scube.Pa GENERIC : 107eef82c75Suwe.Bd -literal -offset indent 1088a5d15c7Scubeauich* at pci? dev ? function ? 1098a5d15c7Scube.Ed 1108a5d15c7Scube.Pp 1118a5d15c7ScubeHard-wiring that instance means re-writing it to the following: 112eef82c75Suwe.Bd -literal -offset indent 1138a5d15c7Scubeauich0 at pci0 dev 31 function 5 1148a5d15c7Scube.Ed 1158a5d15c7Scube.Pp 1168a5d15c7Scubeand that way, 117eef82c75Suwe.Li auich0 1188a5d15c7Scubewill attach to that specific location, or will not attach. 1198a5d15c7Scube.Ss Removing options and drivers 1208a5d15c7ScubeWhen two kernel configurations differ by a very small number of changes, it is 1218a5d15c7Scubeeasier to manage them by having one include the other, and add or remove the 1228a5d15c7Scubedifferences. 1238a5d15c7ScubeRemoving options and drivers is also useful in the situation of a user who 1248a5d15c7Scubewants to follow the development of 1258a5d15c7Scube.Nx : 1268a5d15c7Scubedrivers and options get added to the configuration files found in the source 1278a5d15c7Scubetree, such as 1288a5d15c7Scube.Pa GENERIC , 1298a5d15c7Scubeso one can include it and remove all options and drivers that are not relevant 1308a5d15c7Scubeto the considered system. 1318a5d15c7ScubeAdditions to 1328a5d15c7Scube.Pa GENERIC 1338a5d15c7Scubewill then automatically be followed and used in case they are relevant. 1348a5d15c7Scube.Pp 135eef82c75SuweWhile negating an 136eef82c75Suwe.Ic options 137eef82c75Suwewith 138eef82c75Suwe.Ic no options 1398a5d15c7Scubeis unambiguous, it is not as clear for devices instances. 1408a5d15c7Scube.Pp 1418a5d15c7ScubeThe 142eef82c75Suwe.Ic no Ar instance-definition 1438a5d15c7Scubestatements of 144eef82c75Suwe.Xr config 5 1458a5d15c7Scubesyntax only apply on the current state of the configuration file, not on the 1468a5d15c7Scuberesulting kernel binary. 1478a5d15c7Scube.Xr autoconf 9 1488a5d15c7Scubehas no knowledge of instance negation, thus it is currently impossible to 1498a5d15c7Scubeexpress the following in a kernel configuration file: 1508a5d15c7Scube.Bd -ragged -offset indent 1518a5d15c7Scube.Do I want support for 1528a5d15c7Scube.Xr ath 4 1538a5d15c7Scubeattaching at 1548a5d15c7Scube.Xr pci 4 , 1558a5d15c7Scubebut I do not want any instance of 1568a5d15c7Scube.Xr ath 4 1578a5d15c7Scubeattaching at 158eef82c75Suwe.Li pci3 . 1598a5d15c7Scube.Dc 1608a5d15c7Scube.Ed 1618a5d15c7Scube.Pp 1628a5d15c7ScubeFor a real-world use of 1638a5d15c7Scube.Ic no device at Ar instance 1648a5d15c7Scubeconsider the following, taken from 1658a5d15c7Scube.Nx Ns / Ns i386 : 1668a5d15c7Scube.Bd -literal -offset indent 1678a5d15c7Scubeinclude "arch/i386/conf/GENERIC" 1688a5d15c7Scube 1698a5d15c7Scubeacpi0 at mainbus? 1708a5d15c7Scube 1718a5d15c7Scubecom* at acpi? 1728a5d15c7Scube[... more instances of legacy devices attaching at acpi? ...] 1738a5d15c7Scube 1748a5d15c7Scubeno device at isa0 1758a5d15c7Scube.Ed 1768a5d15c7Scube.Pp 1778a5d15c7ScubeOne could actually live without the 178eef82c75Suwe.Li isa0 1798a5d15c7Scubeinstance, as all the legacy devices are attached at 180eef82c75Suwe.Li acpi0 . 1818a5d15c7ScubeBut unfortunately, dependencies on the 182eef82c75Suwe.Li isa 1838a5d15c7Scubeattribute are not well registered all through the source tree, so an instance 1848a5d15c7Scubeof the 1858a5d15c7Scube.Xr isa 4 1868a5d15c7Scubedriver is required to compile a kernel. 1878a5d15c7ScubeSo while: 1888a5d15c7Scube.Bd -literal -offset indent 1898a5d15c7Scubeno isa* 1908a5d15c7Scube.Ed 1918a5d15c7Scube.Pp 1928a5d15c7Scubeis what is intended, the 1938a5d15c7Scube.Xr isa 4 1948a5d15c7Scubeinstance itself must be kept, and that is precisely the difference made by: 1958a5d15c7Scube.Bd -literal -offset indent 1968a5d15c7Scubeno device at isa0 1978a5d15c7Scube.Ed 1988a5d15c7Scube.Ss Interface attributes 1998a5d15c7Scube.Em Interface attributes 20026dba06cSwizare a subtlety of 201eef82c75Suwe.Xr config 5 2028a5d15c7Scubeand 2038a5d15c7Scube.Xr autoconf 9 , 2048a5d15c7Scubewhich often confuses users and utilities that parse 2058a5d15c7Scube.Xr dmesg 8 2068a5d15c7Scubeoutput to manipulate kernel configuration files. 2078a5d15c7ScubeWhat they are is best shown by the following example. 2088a5d15c7Scube.Pp 2098a5d15c7ScubeThe 2108a5d15c7Scube.Xr dmesg 8 2118a5d15c7Scubeoutput look like this: 2128a5d15c7Scube.Bd -literal -offset indent 2138a5d15c7Scubeauvia0 at pci0 dev 17 function 5: VIA Technologies VT8235 AC'97 Audio (rev 0x50) 2148a5d15c7Scubeaudio0 at auvia0: full duplex, mmap, independent 2158a5d15c7Scube.Ed 2168a5d15c7Scube.Pp 2178a5d15c7Scubewhile the kernel configuration look like this: 218eef82c75Suwe.Bd -literal -offset indent 2198a5d15c7Scubeauvia* at pci? dev ? function ? 2208a5d15c7Scubeaudio* at audiobus? 2218a5d15c7Scube.Ed 2228a5d15c7Scube.Pp 2238a5d15c7ScubeIt is not obvious from the kernel configuration file that an 2248a5d15c7Scube.Xr audio 4 2258a5d15c7Scubedevice can attach at an 2268a5d15c7Scube.Xr auvia 4 2278a5d15c7Scubedevice. 228eef82c75Suwe.Li audiobus 2298a5d15c7Scubeis an 2308a5d15c7Scube.Em interface attribute , 2318a5d15c7Scubeexposed by 232eef82c75Suwe.Li auvia . 2338a5d15c7Scube.Pp 2348a5d15c7ScubeOf course, it is possible to specify 2358a5d15c7Scube.Bd -literal -offset indent 2368a5d15c7Scubeaudio* at auvia? 2378a5d15c7Scube.Ed 238eef82c75Suwe.Pp 239da030fc8Sriastradhin the kernel configuration file, but then one instance per audio controller 2408a5d15c7Scubewould be needed. 2418a5d15c7Scube.Em Interface attributes 2428a5d15c7Scubereflect the fact there is a standard way to attach a device to its parent, no 2438a5d15c7Scubematter what the latter is precisely. 244*e82c4d9bSandvarIt also means lower maintenance of the kernel configuration files because 245da030fc8Sriastradhdrivers for audio controllers are added more easily. 2468a5d15c7Scube.Pp 2478a5d15c7ScubeMost attachments are done through 2488a5d15c7Scube.Em interface attributes , 2498a5d15c7Scubealthough only a few of them are specified that way in the configuration files 2508a5d15c7Scubefound in the tree. 2518a5d15c7ScubeAnother example of such an attribute is 252eef82c75Suwe.Li ata : 2538a5d15c7Scube.Bd -literal -offset indent 2548a5d15c7Scubeviaide0 at pci0 dev 17 function 1 2558a5d15c7Scubeatabus0 at viaide0 channel 0 2568a5d15c7Scube 2578a5d15c7Scubeviaide* at pci? dev ? function ? 2588a5d15c7Scubeatabus* at ata? 2598a5d15c7Scube.Ed 2608a5d15c7Scube.\" Suggested section, maybe for later: 2618a5d15c7Scube.\" .Ss Using a third-party driver 2628a5d15c7Scube.Sh SEE ALSO 2638a5d15c7Scube.Xr config 1 , 2648a5d15c7Scube.Xr options 4 , 2658a5d15c7Scube.Xr config 5 , 2668a5d15c7Scube.Xr dmesg 8 267