DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SCO OpenServer

init(D2osdi)


init, init2 -- initialize a SCSI host adapter during system initialization

Synopsis

   prefixinit();
   

prefixinit2();

Description

The init( ) entry point routine is executed when the system is initialized, before system services are available. It is used to do any required device initialization as well as to dynamically register the driver. The init2( ) entry point routine is used in SCSI peripheral drivers to do initialization tasks that require that the SCSI host adapter already be initialized.

Arguments

None.

Return values

None.

Usage

SCSI host adapter drivers

The host adapter driver may have an initialization routine to determine the adapters on the system and configure them. In this routine the driver writer must build the adapter-specific command blocks with information garnered from the SCSI request block. This is done with a large switch statement that includes a case statement populated for each SCSI command that is documented on the scsi_io_req(D4osdi) manual page plus other commands as required. These command blocks, or whatever data structure is appropriate (maybe just bytes, or words), are then sent to the host adapter hardware.

Most SCSI peripheral device drivers do not queue their I/O requests. It is up to the SCSI host adapter driver writer to handle these requests as they come in, and perhaps to internally queue the requests. Each SCSI host adapter driver should be coded to handle 5 outstanding requests per configured target on the SCSI bus. The host adapter driver makes use of this fact to send requests as quickly as possible to the host adapter. The number of outstanding requests per configured target is configurable.

For optimal throughput, SCSI host adapter drivers should be coded to support scatter/gather operations.

SCSI peripheral drivers

SCSI peripheral drivers support two initialization entry point routines: init( ) (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.

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(D2osdi) routine is called because interrupts are required and they are not enabled when the peripheral driver's init2( ) routine executes.

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.

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.

Context and synchronization

Initialization context

Hardware applicability

All

Version applicability

osdi: 1, 2, 3, 4, 5 SCSI host adapter drivers.

Differences between versions

External dependencies

References

add_intr_handler(D3oddi), scsi_distributed(D3osdi), printcfg(D3oddi), Sdevregister(D3osdi), Sharegister(D3osdi), start(D2osdi)

``OSDI SCSI driver interface version for SCO OpenServer 5'' in HDK Technical Reference


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005