Lines Matching refs:cmd

361 static __inline__ void initialize_SCp(Scsi_Cmnd * cmd);
374 static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd, unsigned char msg);
375 static void AM53C974_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag);
840 static __inline__ void initialize_SCp(Scsi_Cmnd * cmd) in initialize_SCp() argument
842 if (cmd->use_sg) { in initialize_SCp()
843 cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; in initialize_SCp()
844 cmd->SCp.buffers_residual = cmd->use_sg - 1; in initialize_SCp()
845 cmd->SCp.ptr = (char *) cmd->SCp.buffer->address; in initialize_SCp()
846 cmd->SCp.this_residual = cmd->SCp.buffer->length; in initialize_SCp()
848 cmd->SCp.buffer = NULL; in initialize_SCp()
849 cmd->SCp.buffers_residual = 0; in initialize_SCp()
850 cmd->SCp.ptr = (char *) cmd->request_buffer; in initialize_SCp()
851 cmd->SCp.this_residual = cmd->request_bufflen; in initialize_SCp()
897 static int AM53C974_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) in AM53C974_queue_command() argument
900 struct Scsi_Host *instance = cmd->host; in AM53C974_queue_command()
909 cmd->cmnd[0], cmd->target, cmd->lun, cmd->request_bufflen, cmd->use_sg)); in AM53C974_queue_command()
912 cmd->host_scribble = NULL; in AM53C974_queue_command()
913 cmd->scsi_done = done; in AM53C974_queue_command()
914 cmd->result = 0; in AM53C974_queue_command()
915 cmd->device->disconnect = 0; in AM53C974_queue_command()
921 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) { in AM53C974_queue_command()
922 LIST(cmd, hostdata->issue_queue); in AM53C974_queue_command()
923 cmd->host_scribble = (unsigned char *) hostdata->issue_queue; in AM53C974_queue_command()
924 hostdata->issue_queue = cmd; in AM53C974_queue_command()
928 LIST(cmd, tmp); in AM53C974_queue_command()
929 tmp->host_scribble = (unsigned char *) cmd; in AM53C974_queue_command()
933 (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail")); in AM53C974_queue_command()
1373 Scsi_Cmnd *cmd; in AM53C974_intr_disconnect() local
1378 cmd = (Scsi_Cmnd *) hostdata->sel_cmd; in AM53C974_intr_disconnect()
1380 cmd->result = DID_BAD_TARGET << 16; in AM53C974_intr_disconnect()
1391 cmd = (Scsi_Cmnd *) hostdata->connected; in AM53C974_intr_disconnect()
1392 AM53C974_set_async(instance, cmd->target); in AM53C974_intr_disconnect()
1394 instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun)); in AM53C974_intr_disconnect()
1395 if (cmd->device->disconnect) { in AM53C974_intr_disconnect()
1398 LIST(cmd, hostdata->disconnected_queue); in AM53C974_intr_disconnect()
1399 cmd->host_scribble = (unsigned char *) hostdata->disconnected_queue; in AM53C974_intr_disconnect()
1400 hostdata->disconnected_queue = cmd; in AM53C974_intr_disconnect()
1402 " the disconnected_queue\n", instance->host_no, cmd->target, in AM53C974_intr_disconnect()
1403 cmd->lun, hostdata->disconnected_queue->SCp.this_residual)); in AM53C974_intr_disconnect()
1409 if (cmd->cmnd[0] == REQUEST_SENSE) { in AM53C974_intr_disconnect()
1412 for (i = 0; i < cmd->request_bufflen; i++) { in AM53C974_intr_disconnect()
1413 printk("%02x ", *((char *) (cmd->request_buffer) + i)); in AM53C974_intr_disconnect()
1424 cmd = (Scsi_Cmnd *) hostdata->connected; in AM53C974_intr_disconnect()
1425 if (cmd) { in AM53C974_intr_disconnect()
1429 AM53C974_set_async(instance, cmd->target); in AM53C974_intr_disconnect()
1431 … instance->host_no, cmd->SCp.phase, cmd->target, cmd->SCp.this_residual, cmd->SCp.buffers_residual, in AM53C974_intr_disconnect()
1432 cmd->SCp.Message); in AM53C974_intr_disconnect()
1440 hostdata->sync_off[cmd->target] = 0; in AM53C974_intr_disconnect()
1443 cmd->result = DID_ABORT << 16; in AM53C974_intr_disconnect()
1445 cmd->result = DID_ERROR << 16; in AM53C974_intr_disconnect()
1456 hostdata->busy[cmd->target] &= ~(1 << cmd->lun); in AM53C974_intr_disconnect()
1460 cmd->scsi_done(cmd); in AM53C974_intr_disconnect()
1463 AM53C974_set_async(instance, cmd->target); in AM53C974_intr_disconnect()
1479 AM53C974_set_async(instance, cmd->target); in AM53C974_intr_disconnect()
1563 Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected; in AM53C974_information_transfer() local
1571 …(long) hostdata->connected, (long) hostdata->sel_cmd, cmd->SCp.this_residual, cmd->SCp.buffers_res… in AM53C974_information_transfer()
1572 cmd->SCp.phase = PHASE_DATAOUT; in AM53C974_information_transfer()
1577 …(long) hostdata->connected, (long) hostdata->sel_cmd, cmd->SCp.this_residual, cmd->SCp.buffers_res… in AM53C974_information_transfer()
1578 cmd->SCp.phase = PHASE_DATAIN; in AM53C974_information_transfer()
1586 if ((!cmd->SCp.this_residual) && cmd->SCp.buffers_residual) { in AM53C974_information_transfer()
1587 cmd->SCp.buffer++; in AM53C974_information_transfer()
1588 cmd->SCp.buffers_residual--; in AM53C974_information_transfer()
1589 cmd->SCp.ptr = (unsigned char *) cmd->SCp.buffer->address; in AM53C974_information_transfer()
1590 cmd->SCp.this_residual = cmd->SCp.buffer->length; in AM53C974_information_transfer()
1592 if (cmd->SCp.this_residual) { in AM53C974_information_transfer()
1596 (unsigned long) cmd->SCp.this_residual, in AM53C974_information_transfer()
1597 cmd->SCp.ptr); in AM53C974_information_transfer()
1606 AM53C974_set_async(instance, cmd->target); in AM53C974_information_transfer()
1607 if (cmd->SCp.phase == PHASE_DATAIN) in AM53C974_information_transfer()
1609 if ((cmd->SCp.phase == PHASE_DATAOUT) && (AM53C974_read_8(DMACMD) & DMACMD_START)) { in AM53C974_information_transfer()
1613 cmd->SCp.ptr += cmd->SCp.this_residual - residual; in AM53C974_information_transfer()
1614 cmd->SCp.this_residual = residual; in AM53C974_information_transfer()
1620 if (cmd->SCp.phase == PHASE_STATIN) { in AM53C974_information_transfer()
1622 cmd->SCp.Status = AM53C974_read_8(FFREG); in AM53C974_information_transfer()
1623 cmd->SCp.Message = AM53C974_read_8(FFREG); in AM53C974_information_transfer()
1625 cmd->SCp.Status, cmd->SCp.Message)); in AM53C974_information_transfer()
1626 ret = AM53C974_message(instance, cmd, cmd->SCp.Message); in AM53C974_information_transfer()
1631 cmd->SCp.Message = AM53C974_read_8(FFREG); in AM53C974_information_transfer()
1633 ret = AM53C974_message(instance, cmd, cmd->SCp.Message); in AM53C974_information_transfer()
1635 cmd->SCp.phase = PHASE_MSGIN; in AM53C974_information_transfer()
1636 AM53C974_set_sync(instance, cmd->target); in AM53C974_information_transfer()
1642 AM53C974_set_async(instance, cmd->target); in AM53C974_information_transfer()
1666 cmd->SCp.phase = PHASE_MSGOUT; in AM53C974_information_transfer()
1668 AM53C974_set_sync(instance, cmd->target); in AM53C974_information_transfer()
1673 AM53C974_set_async(instance, cmd->target); in AM53C974_information_transfer()
1674 for (i = 0; i < cmd->cmd_len; i++) in AM53C974_information_transfer()
1675 AM53C974_write_8(FFREG, cmd->cmnd[i]); in AM53C974_information_transfer()
1677 cmd->SCp.phase = PHASE_CMDOUT; in AM53C974_information_transfer()
1678 AM53C974_set_sync(instance, cmd->target); in AM53C974_information_transfer()
1683 if (cmd->SCp.phase == PHASE_DATAIN) in AM53C974_information_transfer()
1685 AM53C974_set_async(instance, cmd->target); in AM53C974_information_transfer()
1686 if (cmd->SCp.phase == PHASE_DATAOUT) { in AM53C974_information_transfer()
1693 cmd->SCp.ptr += cmd->SCp.this_residual - residual; in AM53C974_information_transfer()
1694 cmd->SCp.this_residual = residual; in AM53C974_information_transfer()
1701 cmd->SCp.phase = PHASE_STATIN; in AM53C974_information_transfer()
1728 static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd, in AM53C974_message() argument
1757 instance->host_no, cmd->target, cmd->lun)); in AM53C974_message()
1760 if (!cmd->next_link) { in AM53C974_message()
1762 instance->host_no, cmd->target, cmd->lun); in AM53C974_message()
1770 "LINKED_FLG_CMD_COMPLETE message\n", cmd->cmnd[0])); in AM53C974_message()
1775 initialize_SCp(cmd->next_link); in AM53C974_message()
1777 cmd->next_link->tag = cmd->tag; in AM53C974_message()
1778 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in AM53C974_message()
1780 instance->host_no, cmd->target, cmd->lun)); in AM53C974_message()
1781 cmd->scsi_done(cmd); in AM53C974_message()
1782 cmd = hostdata->connected; in AM53C974_message()
1790 instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun)); in AM53C974_message()
1792 cmd->device->disconnect = 0; in AM53C974_message()
1806 if (cmd->cmnd[0] != REQUEST_SENSE) in AM53C974_message()
1807 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); in AM53C974_message()
1808 else if (cmd->SCp.Status != GOOD) in AM53C974_message()
1809 cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); in AM53C974_message()
1814 "COMMAND_COMPLETE message\n", cmd->cmnd[0])); in AM53C974_message()
1817 if ((cmd->cmnd[0] != REQUEST_SENSE) && (cmd->SCp.Status == CHECK_CONDITION)) { in AM53C974_message()
1819 cmd->cmnd[0] = REQUEST_SENSE; in AM53C974_message()
1820 cmd->cmnd[1] &= 0xe0; in AM53C974_message()
1821 cmd->cmnd[2] = 0; in AM53C974_message()
1822 cmd->cmnd[3] = 0; in AM53C974_message()
1823 cmd->cmnd[4] = sizeof(cmd->sense_buffer); in AM53C974_message()
1824 cmd->cmnd[5] = 0; in AM53C974_message()
1825 cmd->SCp.buffer = NULL; in AM53C974_message()
1826 cmd->SCp.buffers_residual = 0; in AM53C974_message()
1827 cmd->SCp.ptr = (char *) cmd->sense_buffer; in AM53C974_message()
1828 cmd->SCp.this_residual = sizeof(cmd->sense_buffer); in AM53C974_message()
1829 LIST(cmd, hostdata->issue_queue); in AM53C974_message()
1830 cmd->host_scribble = (unsigned char *) hostdata->issue_queue; in AM53C974_message()
1831 hostdata->issue_queue = (Scsi_Cmnd *) cmd; in AM53C974_message()
1840 instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun)); in AM53C974_message()
1846 cmd->target, DEF_CLK / DEF_STP); in AM53C974_message()
1847 hostdata->sync_off[cmd->target] = 0; in AM53C974_message()
1848 hostdata->sync_per[cmd->target] = DEF_STP; in AM53C974_message()
1854 cmd->device->tagged_queue = 0; in AM53C974_message()
1855 hostdata->busy[cmd->target] |= (1 << cmd->lun); in AM53C974_message()
1867 instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun)); in AM53C974_message()
1868 cmd->device->disconnect = 1; in AM53C974_message()
1876 instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun)); in AM53C974_message()
1887 cmd->cmnd[0])); in AM53C974_message()
1895 instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun)); in AM53C974_message()
1940 ret = AM53C974_sync_neg(instance, cmd->target, extended_msg); in AM53C974_message()
1981 static void AM53C974_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag) in AM53C974_select() argument
1986 unsigned int i, len, cmd_size = COMMAND_SIZE(cmd->cmnd[0]); in AM53C974_select()
1995 tmp[0] = IDENTIFY(0, cmd->lun); in AM53C974_select()
1997 tmp[0] = IDENTIFY(1, cmd->lun); in AM53C974_select()
2001 if (cmd->device->tagged_queue && (tag != TAG_NONE)) { in AM53C974_select()
2005 if (cmd->device->current_tag == 0) in AM53C974_select()
2006 cmd->device->current_tag = 1; in AM53C974_select()
2007 cmd->tag = cmd->device->current_tag; in AM53C974_select()
2008 cmd->device->current_tag++; in AM53C974_select()
2010 cmd->tag = (unsigned char) tag; in AM53C974_select()
2011 tmp[2] = cmd->tag; in AM53C974_select()
2022 cmd->tag = 0; in AM53C974_select()
2027 if (((cmd->cmnd[0] == INQUIRY) || (cmd->cmnd[0] == REQUEST_SENSE)) && in AM53C974_select()
2028 !(hostdata->sync_neg[cmd->target]) && hostdata->sync_en[cmd->target]) { in AM53C974_select()
2029 hostdata->sync_neg[cmd->target] = 1; in AM53C974_select()
2033 hostdata->msgout[3] = 250 / (int) hostdata->max_rate[cmd->target]; in AM53C974_select()
2034 hostdata->msgout[4] = hostdata->max_offset[cmd->target]; in AM53C974_select()
2037 AM53C974_write_8(SDIDREG, SDIREG_MASK & cmd->target); /* setup dest. id */ in AM53C974_select()
2042 AM53C974_write_8(FFREG, cmd->cmnd[i]); in AM53C974_select()
2048 AM53C974_write_8(FFREG, cmd->cmnd[i]); in AM53C974_select()
2277 static int AM53C974_abort(Scsi_Cmnd * cmd) in AM53C974_abort() argument
2281 struct Scsi_Host *instance = cmd->host; in AM53C974_abort()
2300 if ((hostdata->connected == cmd) || (hostdata->sel_cmd == cmd)) { in AM53C974_abort()
2313 if (cmd == tmp) { in AM53C974_abort()
2350 if (cmd == tmp) { in AM53C974_abort()
2385 static int AM53C974_reset(Scsi_Cmnd * cmd, unsigned int reset_flags) in AM53C974_reset() argument
2390 struct Scsi_Host *instance = cmd->host; in AM53C974_reset()
2430 cmd->result = DID_RESET << 16; in AM53C974_reset()
2431 cmd->scsi_done(cmd); in AM53C974_reset()