示例#1
0
static void nsp_message_in(Scsi_Cmnd *SCpnt)
{
    unsigned int  base = SCpnt->device->host->io_port;
    nsp_hw_data  *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
    unsigned char data_reg, control_reg;
    int           ret, len;

    /*
     * XXX: NSP QUIRK
     * NSP invoke interrupts only in the case of scsi phase changes,
     * therefore we should poll the scsi phase here to catch
     * the next "msg in" if exists (no scsi phase changes).
     */
    ret = 16;
    len = 0;

    nsp_dbg(NSP_DEBUG_MSGINOCCUR, "msgin loop");
    do {
        /* read data */
        data_reg = nsp_index_read(base, SCSIDATAIN);

        /* assert ACK */
        control_reg = nsp_index_read(base, SCSIBUSCTRL);
        control_reg |= SCSI_ACK;
        nsp_index_write(base, SCSIBUSCTRL, control_reg);
        nsp_negate_signal(SCpnt, BUSMON_REQ, "msgin<REQ>");

        data->MsgBuffer[len] = data_reg;
        len++;

        /* deassert ACK */
        control_reg =  nsp_index_read(base, SCSIBUSCTRL);
        control_reg &= ~SCSI_ACK;
        nsp_index_write(base, SCSIBUSCTRL, control_reg);

        /* catch a next signal */
        ret = nsp_expect_signal(SCpnt, BUSPHASE_MESSAGE_IN, BUSMON_REQ);
    } while (ret > 0 && MSGBUF_SIZE > len);

    data->MsgLen = len;

}
static void nsp_message_in(struct scsi_cmnd *SCpnt)
{
	unsigned int  base = SCpnt->device->host->io_port;
	nsp_hw_data  *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
	unsigned char data_reg, control_reg;
	int           ret, len;

	/*
                  
                                                                 
                                                          
                                                        
  */
	ret = 16;
	len = 0;

	nsp_dbg(NSP_DEBUG_MSGINOCCUR, "msgin loop");
	do {
		/*           */
		data_reg = nsp_index_read(base, SCSIDATAIN);

		/*            */
		control_reg = nsp_index_read(base, SCSIBUSCTRL);
		control_reg |= SCSI_ACK;
		nsp_index_write(base, SCSIBUSCTRL, control_reg);
		nsp_negate_signal(SCpnt, BUSMON_REQ, "msgin<REQ>");

		data->MsgBuffer[len] = data_reg; len++;

		/*              */
		control_reg =  nsp_index_read(base, SCSIBUSCTRL);
		control_reg &= ~SCSI_ACK;
		nsp_index_write(base, SCSIBUSCTRL, control_reg);

		/*                     */
		ret = nsp_expect_signal(SCpnt, BUSPHASE_MESSAGE_IN, BUSMON_REQ);
	} while (ret > 0 && MSGBUF_SIZE > len);

	data->MsgLen = len;

}