Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
14.  SCSI Target Drivers Building and Transporting a Command Auto-Request Sense Mode  Previous   Contents   Next 
   
 

The target driver's callback routine should verify that sense data is available by checking the STATE_ARQ_DONE bit in pkt_state, which implies that a check condition has occurred and a request sense has been performed. If auto-request-sense has been temporarily disabled in a packet, there is no guarantee that the sense data can be retrieved at a later time.

The target driver should then verify whether the auto request sense command completed successfully and decode the sense data.

Dump Handling

The dump(9E) entry point is used to copy a portion of virtual address space directly to the specified device in the case of system failure or checkpoint operation. See the cpr(7) and dump(9E) man pages. The dump(9E) entry point must be capable of performing this operation without the use of interrupts.

The arguments for dump() are as follows. dev is the device number of the dump device, addr is the kernel virtual address at which to start the dump, blkno is the first destination block on the device, and nblk is the number of blocks to dump.


Example 14-7 dump(9E) Routine

static int
xxdump(dev_t dev, caddr_t addr, daddr_t blkno, int nblk)
{
    struct xxstate    *xsp;
    struct buf    *bp;
    struct scsi_pkt    *pkt;
    int        rval;
    int        instance;

    instance = getminor(dev);
    xsp = ddi_get_soft_state(statep, instance);

    if (tgt->suspended) {
        (void) ddi_dev_is_needed(DEVINFO(tgt), 0, 1);
    }

    bp = getrbuf(KM_NOSLEEP);
    if (bp == NULL) {
        return (EIO);
    }

Calculate block number relative to partition
    
bp->b_un.b_addr = addr;
    bp->b_edev = dev;
    bp->b_bcount = nblk * DEV_BSIZE;
    bp->b_flags = B_WRITE | B_BUSY;
    bp->b_blkno = blkno;

    pkt = scsi_init_pkt(ROUTE(tgt), NULL, bp, CDB_GROUP1,
        sizeof (struct scsi_arq_status),
        sizeof (struct bst_pkt_private), 0, NULL_FUNC, NULL);
    if (pkt == NULL) {
        freerbuf(bp);
        return (EIO);
    }
    (void) scsi_setup_cdb((union scsi_cdb *)pkt->pkt_cdbp,
            SCMD_WRITE_G1, blkno, nblk, 0);

    /*
     * while dumping in polled mode, other cmds might complete
     * and these should not be resubmitted. we set the
     * dumping flag here which prevents requeueing cmds.
     */
    tgt->dumping = 1;
    rval = scsi_poll(pkt);
    tgt->dumping = 0;

    scsi_destroy_pkt(pkt);
    freerbuf(bp);

    if (rval != DDI_SUCCESS) {
        rval = EIO;
    }

    return (rval);
}
    

SCSI Options

SCSA defines a global variable, scsi_options, which can be used for debug and control. The defined bits in scsi_options can be found in the file <sys/scsi/conf/autoconf.h>. The following table describes the use of these bits.

Table 14-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: 10 Mbytes/sec transfers, as opposed to 5 Mbytes/sec

SCSI_OPTIONS_FAST20

Enables global FAST20 SCSI support: 20 Mbytes/sec transfers

SCSI_OPTIONS_FAST40

Enables global FAST40 SCSI support: 40 Mbytes/sec transfers

SCSI_OPTIONS_FAST80

Enables global FAST80 SCSI support: 80 Mbytes/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 the scsi_hba_attach(9F) man page for information on controlling these options for a particular host adapter.


 
 
 
  Previous   Contents   Next