mdevice(F) 06 January 1993 mdevice(F) Name mdevice - device driver module description file Format xnamex funcs chars prefix bmajor cmajor minu maxu dma Description /etc/conf/cf.d/mdevice is a one-line description of each device driver and configurable software module in the system (except for file system types, see mfsys(FP)). Each line in mdevice represents the Master file component from a Driver Software Package (DSP) which is either delivered with the base system or installed later via idinstall(ADM). See ``Specifying STREAMS modules and devices'' later in this section for details of how to specify STREAMS device drivers and line discipline modules. Each line of mdevice contains nine fields (xnamex-dma). Each field must contain an entry. The entry for fields funcs and chars may be ``-'' (dash) if no value is being supplied. Fields must be separated by spaces or tabs. The fields are described below: xnamex Device name: The internal name of the device or module; this may be up to 8 characters long. The first character of the name must be an alphabetic character; the others may be letters, digits, or underscores. When created using configure(ADM), this field defaults to being the same as the handler prefix (prefix) unless overridden using the -h option. funcs Function list: A string of characters that identifies the driver functions that are present. Using one of the characters below requires the driver to have an entry point (function) of the type indicated. When the kernel is relinked an entry is made in the kernel switch tables for each function in the list. If no func- tions in the following list are supplied, the field should con- tain a dash. Most drivers use some or all of the following func- tions: c close function. Called whenever the last open connection to a device node associated with this driver is closed. i ioctl function. I/O control function called to issue control commands to the driver. Used by character devices only. I init function. Called by the system during the system boot sequence to initialize the driver or module for use. Inter- rupts are not enabled when this function is called. o open function. Called whenever a device node associated with this driver is opened. r read function. Called to read data from a device controlled by this driver. Used by character devices only. w write function. Called to write data to a device controlled by this driver. Used by character devices only. The remaining functions in this list are likely to be used only by drivers with special requirements: e exec function. Called when a process with an open (or previ- ously open) connection to this device, using this driver, issues an exec(S) system call. Provided for devices which must perform specific actions when this situation arises. E kenter function. Called by the system whenever kernel mode is entered. Provided for drivers which have specific actions to carry out whenever this happens. h halt function. Called during system shutdown. This might be provided if, for instance, the driver needs to reset hardware in preparation for a warm boot. p poll function. Called once every system clock-tick. This might be required (for instance) for a device which loses interrupts and needs to be re-primed periodically. P pminit function. Pre-main initialization function called by the system very early in the system initialization process. Provided for drivers which need to be initialized early. Nor- mally this function is used by a kernel debugger so that it is available to the user as early as possible. s start function. Secondary initialization function called by the system late in the system boot sequence. Provided for drivers which have initialization functions which must be deferred until after system interrupts have been enabled. S swtch function. Called by the system whenever a process con- text switch occurs. This is provided for drivers which have specific actions to carry out whenever a context switch occurs. x exit function. Called when a process with a previously open connection to this device exits. Provided for devices which must perform specific actions when this situation arises. X kexit function. Called on exit from kernel mode to user mode. Provided for drivers which have specific actions to carry out when this happens. No characters are used to represent the strategy and print rou- tines of a ``block'' type device driver (see field chars below). Such a driver must include these routines in any case. chars Characteristics of driver: A set of characters that indicates the characteristics of the driver. If none of the characters below apply, the field should contain a dash. The legal charac- ters for this field are: a The driver is installed automatically. b The device is a ``block'' device. c The device is a ``character'' device. C The device is a scatter/gather device which performs cluster I/O requests. (Block devices only.) d The device can accept 32-bit addresses for DMA transfer, but cannot directly access addresses above 16Mb (see ``x'' below). D This option indicates that the device driver can share its DMA channel. G The interrupt handler specified in the sdevice(F) entry is not installed, but is checked for conflicts with other de- vices. This is used when you wish to associate a device with a specific device group. h The device is a SCSI host adapter. H This device driver controls hardware. This option distin- guishes drivers that support hardware from those that are entirely software (pseudo-devices). i The device driver is installable. I Ignore pack.d directory. This option prevents the system from looking for driver components when relinking the kernel. This option is used when the functions associated with this driver name are actually included in another driver. k Instruct idmknod(ADM) to leave device nodes (special files) of the same type (``character'' or ``block'') and with the same major number as this device in the /dev directory, even if the device is configured out of the kernel. M This driver defines a range of extended minor device numbers for a driver already defined in a preceding entry. This also causes the Minimum and Maximum fields to be interpreted dif- ferently. (See fields minu and maxu below.) n The driver is not installable. N No Driver.o or space.c file. o This device may have only one sdevice(F) entry. O This option indicates that the IOA range (sdevice(F) columns 7 and 8) of this device may overlap that of another device, which must also have the 'O' characteristic. p The device is a SCSI peripheral. r This device is required in all configurations of the kernel. This option is intended for drivers delivered with the base system only. Device nodes (special files in the /dev direc- tory), once made for this device, are never removed. See idmknod(ADM). s Suppress device count field. S This device driver is a STREAMS module. t The device is a ttym and has a _tty table. x The device can perform DMA to addresses above 16Mb without the need for memory windowing support from dedicated hardware and the kernel. This is only valid if the ``d'' characteris- tic is also set. Z This driver may have multiple entries in the mdevice file, with different major numbers. prefix Handler prefix: A character string used as a prefix for all the externally-known handler routines associated with this driver. The string may be up to 4 characters long. bmajor Block major device number: This is set to zero in a DSP Master file. If the device is a ``block'' type device, a value is assigned by idinstall during installation. cmajor Character major device number: This is set to zero in a DSP Mas- ter file. If the device is a ``character'' type device (or STREAMS type), a value is assigned by idinstall during installa- tion. minu Minimum units: An integer specifying the minimum number of de- vices that can be attached to the controller. The actual number is specified in the sdevice(F) file. If ``M'' appears in the characteristics field chars, the value in this field is the base major number of the driver to which the extended minor numbers apply (BASE major). maxu Maximum units: An integer specifying the maximum number of de- vices that can be attached to the controller. The actual number is specified in the sdevice(F) file. If ``M'' appears in the characteristics field chars, the value in this field is the offset at which the range of the extended minor numbers begin (OFFSET) and must be a multiple of 256. dma DMA channel: An integer that specifies the DMA channel to be used by this device. If the device does not use DMA, place a ``-1'' in this field. Note that more than one device can share a DMA channel provided that each sharing device sets the ``D'' characteristic in field chars. Specifying STREAMS modules and devices STREAMS modules and devices are treated in a slightly different way from other drivers in all UNIX systems, and their configuration reflects this difference. To specify a STREAMS device driver, its mdevice entry should contain both an ``S'' and a ``c'' in the characteristics field chars. This indicates that it is a STREAMS device and that it requires an entry in the UNIX kernel's cdevsw table, where STREAMS devices are normally configured into the system. A STREAMS module that is not a device driver, such as a line discipline module, requires an ``S'' in the characteristics field of its mdevice file entry, but should not include a ``c'', as a device driver does. Files /etc/conf/cf.d directory containing configuration files for linking the kernel /etc/conf/cf.d/mdevice description for all device driver modules /etc/conf/cf.d/sdevice specific characteristics for all devices /etc/conf/pack.d/device/Driver.o device driver object module for device /etc/conf/sdevice.d/device specific characteristics for device See also configure(ADM), idbuild(ADM), idinstall(ADM), mfsys(FP), sdevice(F) Device Driver Writer's Guide