_verify(D2) _verify(D2)
NAME
_verify - verify that driver supports a particular device
SYNOPSIS
#include <sys/confmgr.h>
#include <sys/ddi.h>
int prefix_verify(rm_key_t key);
Arguments
key resource manager key used to refer to device instance
DESCRIPTION
Autoconfigurable drivers can supply an optional _verify entry
point. The _verify routine can be invoked by the user when
running the DCU to check whether a specific set of
configuration parameters are correct for a specific board.
It is also possible for the driver writer to specify that the
_verify routine should be invoked automatically by the DCU to
verify configuration parameters before DCU does its
board/driver mapping. To specify that the _verify routine
should be invoked automatically by the DCU, a V must appear in
the verify field of the drivers drvmap file. If a V appears
in the verify field, the board/driver mapping is only done if
the _verify routine returns 0. The V is not intended for
every driver and its use should be limited to very special
cases. The following example illustrates why some drivers may
need to use the V flag.
The Adaptec 1740 SCSI board can operate in either of two
modes, standard or enhanced. A different driver is needed
depending on the mode of the board. DCU does its board/driver
mapping based on the board's id. Since this board has a
single id, it is impossible for DCU to assign the correct
driver to this board without knowing the mode of the board.
By supplying _verify routines and specifying V in the verify
field of their drvmap files, DCU will invoke each of these
driver's _verify routine and correctly assign a driver based
on the return values.
Not all drivers require a _verify routine. Support for
_verify routines is provided primarily for drivers that
control ISA devices. By providing a ``verify'' interface
through the DCU for drivers that control ISA boards, the user
can try different configuration parameters and get instant
feedback. This allows the user to determine the correct
Copyright 1994 Novell, Inc. Page 1
_verify(D2) _verify(D2)
configuration parameters for a board without rebuilding the
kernel.
Beyond support for ISA configuration and other ``special
cases'' there are no other reasons to provide verify routines
for drivers. For a driver that only supports EISA, MCA, or
PCI cards and has no ``special cases'' that must be dealt
with, there is no need for a _verify routine.
Return Values
The _verify routine should return 0 if the configuration
parameters are correct and the driver can support the board,
otherwise it should return ENODEV.
USAGE
This routine is optional and is only valid for loadable
autoconfigurable drivers.
The _verify routine is called with a Resource Manager key that
the driver uses to retrieve hardware parameters using the
configuration manager interfaces. For PDI drivers, the
_verify routine should call sdi_hba_getconf(D3I) to get the
hardware parameters for a particular board (this differs from
using sdi_hba_autoconf(D3I) which will retrieve the hardware
parameters for all boards supported by the driver).
Since the _verify routine is sometimes called to test
uncertain hardware parameters (for instance, to check user-
supplied hardware parameters), it is important that _verify
routines are do their checking very carefully. Thus, it is
best to not write to any I/O address unless absolutely
necessary and only after all other possible read checks have
been performed. For instance, a driver could read all of its
readable I/O addresses first. If any are missing or contain
unexpected values, it should fail. Then, it should perform
any necessary tests that require writing to I/O addresses.
The _verify routine should not add new parameters to the
Resource Manager database or change the value of existing
parameters.
Synchronization Constraints
The _verify routine has user context and can sleep.
Copyright 1994 Novell, Inc. Page 2
_verify(D2) _verify(D2)
REFERENCES
dcu(1M), cm_getval(D3), Drvmap(4), cm_params(D5), errnos(D5)
NOTICES
Portability
All processors
Applicability
ddi: 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 3