Autoconfiguration in the EROS KernelThis note describes the autoconfiguration mechanism of the EROS kernel. Unlike most kernels, EROS performs a minimal kernel configuration, and leaves it to user level code to configure the remainder of the system. This simplifies the addition of new hardware by minimizing the opportunities for resource conflicts, and reduces the number of cards that the kernel must know about. The autoconfiguration process must accomplish several tasks:
1 How Configuration WorksConfiguring an EROS system involves both compile-time and run-time decision making. At compile time, the person building the kernel decides which kernel modules are to be included in the kernel. Kernel modules include
The kernel module list determines what devices will be recognized by the EROS kernel. In a typical configuration, there will be more drivers than actual devices. The presence of a driver does not necessarily imply the presence of the corresponding device. If the device driver is configured, the device can be recognized and manipulated if it is actually present. Because different systems have radically different device configurations, the initially installed kernel configuration includes device drivers for many different types of disk controllers. Just one or two of these drivers will actually be used on most systems. To decide what devices are actually present and configure the kernel properly, the kernel makes two passes through the list of kernel modules. The first pass is the probe pass. During this pass, the module should perform several actions:
Once the kernel knows what modules are to be configured, it makes a second pass to actually attach the modules. During this pass, the module is responsible for performing any necessary subsidiary configuration. Disk controllers, for example, should probe for and attach any drives that are present. The probe pass and the attach pass are separated for two reasons:
2 The Module ListThe master module list for a kernel is found in an architecture specific subdirectory (we're about to change where it lives, and I'll update this when it settles). This list names the set of modules that are to be configured into the kernel. The Entries in this file take the form:
The name field indicates what kernel symbol name can be used to locate the module. The entry: Entries in this file take the form:
AutoConf structure whose name is AutoConfModule. In the corresponding module source file, there should be a source line that reads:
Modules that require no interrupt, address space, DMA, or I/O port resources can specify 2.1 The Probe RoutineThe basic job of the
If any of these steps cannot be successfully performed, the probe routine should relinquish any allocated resources and should not mark the device as present. This very important. The IDE driver, for example, checks for the presence of IDE drives and an IDE-managed floppy disk. If these are present, it allocates the associated port space and binds the FD and HD device keys. In this event, the HD and FD drivers must not be configured. If no IDE controller is present, the HD and FD device drivers will find the corresponding ports unbound, and should proceed with configuration. While it may be necessary to temporarily enable interrupts for the device during the probe phase, interrupts for the associated device should be disabled at the end of this phase. In principle, the device is not prepared to handle interrupts until it's Modules that are unconditionally configured can avoid the cost of providing individual probe routines by using the A few modules provide support for motherboard components or exception handlers that must be present early in the system's configuration phase for error handling. These modules violate the rule about interrupt enabling. For example, the PageFault handler is a module that is fully ocnfigured and installed by it's probe phase, and supplies no 2.2 The Attach RoutineThe Modules that provide low-level motherboard support, or that require no data structure initialization, can provide a NULL attach routine. Copyright 1998 by Jonathan Shapiro. All rights reserved. For terms of redistribution, see the GNU General Public License |