Writing Device Drivers

SCSA

Global Data Definitions

The following is information for debugging, useful when a driver experiences bus-wide problems. One global data variable has been defined for the SCSA implementation: scsi_options. This variable is a SCSA configuration longword used for debug and control. The defined bits in the scsi_options longword can be found in the file <sys/scsi/conf/autoconf.h>. Table G-2 shows their meanings when set.

Table G-2 SCSA Options

Option 

Description 

SCSI_OPTIONS_DR

Enables global disconnect/reconnect. 

SCSI_OPTIONS_SYNC

Enables global synchronous transfer capability. 

SCSI_OPTIONS_LINK

Enables global link support. 

SCSI_OPTIONS_PARITY

Enables global parity support. 

SCSI_OPTIONS_TAG

Enables global tagged queuing support. 

SCSI_OPTIONS_FAST

Enables global FAST SCSI support: 10MB/sec transfers, as opposed to 5 MB/sec. 

SCSI_OPTIONS_FAST20

Enables global FAST20 SCSI support: 20MB/sec transfers. 

SCSI_OPTIONS_FAST40

Enables global FAST40 SCSI support: 40MB/sec transfers. 

SCSI_OPTIONS_FAST80

Enables global FAST80 SCSI support: 80MB/sec transfers. 

SCSI_OPTIONS_WIDE

Enables global WIDE SCSI. 


Note -

The setting of scsi_options affects all host adapter and target drivers present on the system (as opposed to scsi_ifsetcap(9F)). Refer to scsi_hba_attach(9F) in the Solaris 2.6 Reference Manual for information on controlling these options for a particular host adapter.


The default setting for scsi_options has these values set:

Tagged Queuing

For a definition of tagged queuing refer to the SCSI-2 specification. To support tagged queuing, first check the scsi_options flag SCSI_OPTIONS_TAG to see if tagged queuing is enabled globally. Next, check to see if the target is a SCSI-2 device and whether it has tagged queuing enabled. If this is all true, attempt to enable tagged queuing by using scsi_ifsetcap(9F). Example G-1 shows an example of supporting tagged queuing.


Example G-1 Supporting SCSI Tagged Queuing

#define ROUTE &sdp->sd_address
	...
	/*
	 * If SCSI-2 tagged queueing is supported by the disk drive and
	 * by the host adapter then we will enable it.
	 */ 
	xsp->tagflags = 0;
	if ((scsi_options & SCSI_OPTIONS_TAG) &&
		(devp->sd_inq->inq_rdf == RDF_SCSI2) &&
		(devp->sd_inq->inq_cmdque)) {
		if (scsi_ifsetcap(ROUTE, "tagged-qing", 1, 1) == 1) {
			xsp->tagflags = FLAG_STAG;
			xsp->throttle = 256;
		} else if (scsi_ifgetcap(ROUTE, "untagged-qing", 0) == 1) {
			xsp->dp->options |= XX_QUEUEING;
			xsp->throttle = 3;
		} else {
			xsp->dp->options &= ~XX_QUEUEING;
			xsp->throttle = 1;
		}
}

Untagged Queueing

If tagged queueing fails, you can attempt to set untagged queuing. In this mode, you submit as many commands as you think necessary or optimal to the host adapter driver. Then, the host adapter queues the commands to the target one at a time (as opposed to tagged queueing, where the host adapter submits as many commands as it can until the target indicates that the queue is full).