device_configuration(3K) DG/UX R4.11MU05 device_configuration(3K)
NAME
deviceconfiguration - set up, configure, and deconfigure a device
DESCRIPTION
This manual page lists the steps that must be performed by a device
driver's configuration routine, driverconfigure. The system build
process creates a list of devices to be configured from the entries
in the system file. At boot time, the system initialization code
scans this list and invokes the driverconfigure routine for each
device of the driver's type in that list. The initialization code
passes driverconfigure a pointer to the device's device name and
major number. At a minimum, the configuration routine should: verify
that the device name it receives is valid; test for the device's
existence; and, if successful, register the device with various parts
of the kernel. The subsections that follow give a very brief
overview of each step, and include references to the detailed manual
pages that document the individual routines that should be called.
Device Name Parsing
The driver must first verify that the device name identifies a device
of its type. It does this by parsing the name using
dnparsedevicename, which verifies that the device name meets the
required format for that particular driver, and (if successful)
extracts the various components of the name (such as numeric
parameters or nested device names). See the devicenames(3K) manual
page for more details.
Device Probing
Once the device name has been verified, the driver must verify that
the device is attached and working. The
iodofirstlongboardaccess or iodofirstshortboardaccess
routines can be used to read the device's memory-mapped control
registers in a safe and graceful way that will not generate a system
panic or hang if the device is not present. See the
deviceprobing(3K) manual page for more details.
Address Reservation
Assuming that the probe is successful, the driver can use
iocheckdevicespec to guard against another device using the same
combination of address and interrupt resources. If this step
succeeds, the device has an exclusive claim on these resources that
no other device can claim until they are released by calling
ioforgetdevicespec. See the deviceaddressing(3K) manual page for
more details.
Interrupts
If the device generates interrupts, the driver must register its
interrupt service routine with the kernel by calling
ioregisterdeviceinfo. Once this step is complete, any interrupt
generated by the device will cause the driver's interrupt service
routine to be invoked. Thus, it is important that the driver not
register the device until the driver is ready to handle interrupts.
See the deviceinterrupts(3K) manual page for more details.
Device Number Assignment
The system passes driverconfigure a major number that identifies the
driver's position in the kernel's driver lookup table. To specify
the particular device's location in the kernel's device tables, the
driver must then allocate a minor device number by calling
ioallocatedevicenumber. See the devicenumbers(3K) manual page
for more details.
Disk Autoregistration
Physical disk drivers may also call ioaddtoregisterlist to add
the specified device to the list of physical disks that will be
implicitly registered with the Virtual Disk Manager (VDM) during
system initialization. Any virtual disks on the physical disks will
become available for use as file systems, paging areas, etc. See the
deviceregistration(3K) manual page for more details.
Device Nodes
The driver should create device nodes in or below the /dev directory
dynamically during device configuration by calling
fssubmitdevpathnamerequest. See the devicenodes(3K) manual page
for more details.
Cleanup
Most of the registration routines described above have a
corresponding deallocation or deregistration routine that should be
used during the driverdeconfigure routine or, if the device fails,
any portion of the configuration process. Examples are:
iodeallocatedevicenumber, ioderegisterdeviceinfo, and
ioforgetdevicespec.
SEE ALSO
deviceaddressing(3K), deviceinterrupts(3K), devicenames(3K),
devicenodes(3K), devicenumbers(3K), deviceprobing(3K),
deviceregistration(3K).
Programming in the DG/UX Kernel Environment.
Licensed material--property of copyright holder(s)