xxinit and xxinit2
SCSI peripheral drivers support two
initialization entry point routines:
init(D2osdi)
(may be called before the SCSI host adapter driver's
init( )
routine has run)
and
init2( )
(called only after all SCSI host adapter driver
init( )
routines have been called.
Most SCSI peripheral driver initialization tasks
are handled by the host adapter driver;
the peripheral driver's
init( )
and
init2( )
routines should be used
only for buffer management, initialization,
data structure initialization, and device registration.
In the Sflp sample driver code,
Sflpinit( )
calls
Sdevregister(D3osdi)
to mark the driver as ready for registration.
Sflpinit2( )
sets up and initializes the data structures
required by the driver,
although this could have been done in the
Sflpinit( )
routine.
WARNING:
Never attempt to talk to any SCSI peripheral device
in the
init( )
routine. The driver for the SCSI host adapter
to which the SCSI peripheral device is attached
may not have run its
init( )
routine.
To initialize the SCSI peripheral device/driver,
call the
Sdevregister(D3osdi)
function in the peripheral driver's
init( )
routine.
The SDEVREG_EX structure
that is used as an argument to the
Sdevregister( )
routine includes a function pointer
for the SCSI peripheral driver's
init2( )
function.
This routine can be coded to do any
driver initialization required
for the SCSI peripheral driver.
Any peripheral hardware initialization
must be done the first time the peripheral driver's
open( )
routine is called
because interrupts are required
and they are not enabled when the peripheral driver's
init2( )
routine executes.
© 2005 The SCO Group, Inc. All rights reserved.