Lines Matching defs:cmd

516 static void __unmap_scsi_data(struct device *dev, struct scsi_cmnd *cmd)
518 switch(cmd->__data_mapped) {
520 scsi_dma_unmap(cmd);
523 cmd->__data_mapped = 0;
526 static int __map_scsi_sg_data(struct device *dev, struct scsi_cmnd *cmd)
530 use_sg = scsi_dma_map(cmd);
534 cmd->__data_mapped = 2;
535 cmd->__data_mapping = use_sg;
540 #define unmap_scsi_data(np, cmd) __unmap_scsi_data(np->dev, cmd)
541 #define map_scsi_sg_data(np, cmd) __map_scsi_sg_data(np->dev, cmd)
1129 u_long cmd;
1488 struct scr_tblmove cmd ;
1540 struct scsi_cmnd *cmd; /* SCSI command */
1917 static struct ccb *ncr_get_ccb (struct ncb *np, struct scsi_cmnd *cmd);
1931 static int ncr_scatter (struct ncb *np, struct ccb *cp, struct scsi_cmnd *cmd);
1943 static void insert_into_waiting_list(struct ncb *np, struct scsi_cmnd *cmd);
1944 static struct scsi_cmnd *retrieve_from_waiting_list(int to_remove, struct ncb *np, struct scsi_cmnd *cmd);
1947 #define remove_from_waiting_list(np, cmd) \
1948 retrieve_from_waiting_list(1, (np), (cmd))
2179 offsetof (struct dsb, cmd),
3665 #define PRINT_ADDR(cmd, arg...) dev_info(&cmd->device->sdev_gendev , ## arg)
3669 PRINT_ADDR(cp->cmd, "%s: ", label);
4019 static inline void ncr_queue_done_cmd(struct ncb *np, struct scsi_cmnd *cmd)
4021 unmap_scsi_data(np, cmd);
4022 cmd->host_scribble = (char *) np->done_list;
4023 np->done_list = cmd;
4028 struct scsi_cmnd *cmd;
4031 cmd = lcmd;
4032 lcmd = (struct scsi_cmnd *) cmd->host_scribble;
4033 cmd->scsi_done(cmd);
4110 static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd)
4112 struct scsi_device *sdev = cmd->device;
4144 if ((cmd->cmnd[0] == 0 || cmd->cmnd[0] == 0x12) &&
4151 PRINT_ADDR(cmd, "CMD=%x ", cmd->cmnd[0]);
4156 ** Assign a ccb / bind cmd.
4160 ** insert cmd into the waiting list.
4164 if (np->settle_time && cmd->request->timeout >= HZ) {
4165 u_long tlimit = jiffies + cmd->request->timeout - HZ;
4170 if (np->settle_time || !(cp=ncr_get_ccb (np, cmd))) {
4171 insert_into_waiting_list(np, cmd);
4174 cp->cmd = cmd;
4204 PRINT_ADDR(cmd,
4216 switch (cmd->cmnd[0]) {
4242 direction = cmd->sc_data_direction;
4244 segments = ncr_scatter(np, cp, cp->cmd);
4365 memcpy(cp->cdb_buf, cmd->cmnd, min_t(int, cmd->cmd_len, sizeof(cp->cdb_buf)));
4366 cp->phys.cmd.addr = cpu_to_scr(CCB_PHYS (cp, cdb_buf[0]));
4367 cp->phys.cmd.size = cpu_to_scr(cmd->cmd_len);
4553 static int ncr_reset_bus (struct ncb *np, struct scsi_cmnd *cmd, int sync_reset)
4555 /* struct scsi_device *device = cmd->device; */
4580 if (cp->cmd == cmd) {
4588 if (!found && retrieve_from_waiting_list(0, np, cmd))
4604 if (!found && sync_reset && !retrieve_from_waiting_list(0, np, cmd)) {
4605 cmd->result = DID_RESET << 16;
4606 ncr_queue_done_cmd(np, cmd);
4622 static int ncr_abort_command (struct ncb *np, struct scsi_cmnd *cmd)
4624 /* struct scsi_device *device = cmd->device; */
4632 if (remove_from_waiting_list(np, cmd)) {
4633 cmd->result = ScsiResult(DID_ABORT, 0);
4634 ncr_queue_done_cmd(np, cmd);
4646 if (cp->cmd == cmd) {
4809 struct scsi_cmnd *cmd;
4817 if (!cp || cp->magic != CCB_MAGIC || !cp->cmd)
4832 cmd = cp->cmd;
4833 cp->cmd = NULL;
4834 tp = &np->target[cmd->device->id];
4835 lp = tp->lp[cmd->device->lun];
4870 PRINT_ADDR(cmd, "%d parity error(s).\n",cp->parity_status);
4880 PRINT_ADDR(cmd, "extraneous data discarded.\n");
4883 PRINT_ADDR(cmd, "invalid scsi phase (4/5).\n");
4886 PRINT_ADDR(cmd, "extended error %d.\n",
4899 PRINT_ADDR(cmd, "ERROR: cmd=%x host_status=%x "
4900 "scsi_status=%x\n", cmd->cmnd[0],
4916 cmd->result = ScsiResult(DID_OK, cp->scsi_status);
4929 ncr_alloc_lcb (np, cmd->device->id, cmd->device->lun);
4943 ncr_setup_tags (np, cmd->device);
4951 cmd->result = DID_OK << 16 | S_CHECK_COND;
4956 memcpy(cmd->sense_buffer, cp->sense_buf,
4961 u_char *p = cmd->sense_buffer;
4963 PRINT_ADDR(cmd, "sense data:");
4972 cmd->result = DID_OK << 16 | S_CONFLICT;
4981 cmd->result = ScsiResult(DID_OK, cp->scsi_status);
4989 cmd->result = ScsiResult(DID_TIME_OUT, cp->scsi_status);
4996 cmd->result = ScsiResult(DID_RESET, cp->scsi_status);
5003 cmd->result = ScsiResult(DID_ABORT, cp->scsi_status);
5010 PRINT_ADDR(cmd, "COMMAND FAILED (%x %x) @%p.\n",
5013 cmd->result = ScsiResult(DID_ERROR, cp->scsi_status);
5023 PRINT_ADDR(cmd, " CMD:");
5024 p = (u_char*) &cmd->cmnd[0];
5025 for (i=0; i<cmd->cmd_len; i++) printk (" %x", *p++);
5034 p = (u_char*) &cmd->sense_buffer;
5067 ncr_queue_done_cmd(np, cmd);
5503 if (!cp->cmd) continue;
5504 if (scmd_id(cp->cmd) != target) continue;
5523 struct scsi_cmnd *cmd = cp->cmd;
5528 BUG_ON(target != (scmd_id(cmd) & 0xf));
5580 struct scsi_cmnd *cmd = cp->cmd;
5586 BUG_ON(target != (scmd_id(cmd) & 0xf));
5605 dev_info(&cmd->device->sdev_target->dev, "WIDE SCSI %sabled.\n",
5852 printk ("%s: script cmd = %08x\n", ncr_name(np),
6246 u_char cmd, sbcl;
6253 cmd = dbc >> 24;
6261 if ((cmd & 1) == 0) {
6289 printk ("P%x%x RL=%d D=%d SS0=%x ", cmd&7, sbcl&7,
6294 printk ("P%x%x RL=%d ", cmd&7, sbcl&7, rest);
6309 if (!(cmd & 6)) {
6354 (unsigned)nxtdsp, vdsp, cmd);
6376 if (cmd & 0x10) { /* Table indirect */
6394 ** check cmd against assumed interrupted script command.
6397 if (cmd != (scr_to_cpu(vdsp[0]) >> 24)) {
6398 PRINT_ADDR(cp->cmd, "internal error: cmd=%02x != %02x=(vdsp[0] "
6399 ">> 24)\n", cmd, scr_to_cpu(vdsp[0]) >> 24);
6420 if (cmd & 0x06) {
6421 PRINT_ADDR(cp->cmd, "phase change %x-%x %d@%08x resid=%d.\n",
6422 cmd&7, sbcl&7, (unsigned)olen,
6443 newcmd[0] = cpu_to_scr(((cmd & 0x0f) << 24) | rest);
6449 PRINT_ADDR(cp->cmd, "newcmd[%d] %x %x %x %x.\n",
6495 switch (cmd & 7) {
6534 struct scsi_cmnd *cmd = cp->cmd;
6535 struct tcb *tp = &np->target[cmd->device->id];
6536 struct lcb *lp = tp->lp[cmd->device->lun];
6575 PRINT_ADDR(cmd, "QUEUE FULL! %d busy, %d disconnected "
6581 ncr_setup_tags (np, cmd->device);
6613 cp->scsi_smsg2[0] = IDENTIFY(0, cmd->device->lun);
6620 cp->phys.cmd.addr = cpu_to_scr(CCB_PHYS (cp, sensecmd));
6621 cp->phys.cmd.size = cpu_to_scr(6);
6627 cp->sensecmd[1] = (cmd->device->lun & 0x7) << 5;
6658 if (cmd->device->select_no_atn)
6840 PRINT_ADDR(cp->cmd, "negotiation failed sir=%x "
6916 PRINT_ADDR(cp->cmd, "sync: per=%d scntl3=0x%x ofs=%d "
7003 PRINT_ADDR(cp->cmd, "wide: wide=%d chg=%d.\n", wide,
7069 PRINT_ADDR(cp->cmd, "MESSAGE_REJECT received (%x:%x).\n",
7100 PRINT_ADDR(cp->cmd, "IGNORE_WIDE_RESIDUE received, but not yet "
7113 PRINT_ADDR(cp->cmd, "DISCONNECT received, but datapointer "
7135 static struct ccb *ncr_get_ccb(struct ncb *np, struct scsi_cmnd *cmd)
7137 u_char tn = cmd->device->id;
7138 u_char ln = cmd->device->lun;
7168 PRINT_ADDR(cmd, "ccb free list corrupted "
7231 PRINT_ADDR(cmd, "ccb @%p using tag %d.\n", cp, tag);
7252 PRINT_ADDR(cp->cmd, "ccb @%p freeing tag %d.\n", cp, cp->tag);
7639 static int ncr_scatter(struct ncb *np, struct ccb *cp, struct scsi_cmnd *cmd)
7642 int use_sg = scsi_sg_count(cmd);
7646 use_sg = map_scsi_sg_data(np, cmd);
7652 unmap_scsi_data(np, cmd);
7658 scsi_for_each_sg(cmd, sg, use_sg, segment) {
8020 static int ncr53c8xx_queue_command_lck (struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
8022 struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
8030 cmd->scsi_done = done;
8031 cmd->host_scribble = NULL;
8032 cmd->__data_mapped = 0;
8033 cmd->__data_mapping = 0;
8037 if ((sts = ncr_queue_command(np, cmd)) != DID_OK) {
8038 cmd->result = sts << 16;
8051 unmap_scsi_data(np, cmd);
8052 done(cmd);
8104 static int ncr53c8xx_bus_reset(struct scsi_cmnd *cmd)
8106 struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
8119 sts = ncr_reset_bus(np, cmd, 1);
8131 static int ncr53c8xx_abort(struct scsi_cmnd *cmd)
8133 struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
8142 sts = ncr_abort_command(np, cmd);
8170 static void insert_into_waiting_list(struct ncb *np, struct scsi_cmnd *cmd)
8175 printk("%s: cmd %lx inserted into waiting list\n", ncr_name(np), (u_long) cmd);
8177 cmd->next_wcmd = NULL;
8178 if (!(wcmd = np->waiting_list)) np->waiting_list = cmd;
8182 wcmd->next_wcmd = (char *) cmd;
8186 static struct scsi_cmnd *retrieve_from_waiting_list(int to_remove, struct ncb *np, struct scsi_cmnd *cmd)
8191 if (cmd == *pcmd) {
8193 *pcmd = (struct scsi_cmnd *) cmd->next_wcmd;
8194 cmd->next_wcmd = NULL;
8197 printk("%s: cmd %lx retrieved from waiting list\n", ncr_name(np), (u_long) cmd);
8199 return cmd;
8221 printk("%s: cmd %lx trying to requeue\n", ncr_name(np), (u_long) wcmd);
8227 printk("%s: cmd %lx done forced sts=%d\n", ncr_name(np), (u_long) wcmd, sts);