Lines Matching defs:cmd

255 static int hpsa_ioctl(struct scsi_device *dev, unsigned int cmd,
263 static int hpsa_compat_ioctl(struct scsi_device *dev, unsigned int cmd,
272 static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
279 static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
2345 struct scsi_cmnd *cmd,
2357 if (cmd)
2358 cmd->result = 0;
2361 cmd->result |= SAM_STAT_CHECK_CONDITION;
2364 memset(cmd->sense_buffer, 0,
2375 memcpy(cmd->sense_buffer,
2404 cmd->result = (DID_OK << 16); /* host byte */
2407 scsi_set_resid(cmd, ioaccel2_resid);
2421 cmd->result = DID_NO_CONNECT << 16;
2486 struct CommandList *c, struct scsi_cmnd *cmd)
2489 if (cmd)
2490 scsi_done(cmd);
2500 struct CommandList *c, struct scsi_cmnd *cmd,
2508 cmd->result = 0;
2509 return hpsa_cmd_free_and_done(h, c, cmd);
2526 cmd->result = DID_RESET << 16;
2527 return hpsa_cmd_free_and_done(h, c, cmd);
2533 if (handle_ioaccel_mode2_error(h, c, cmd, c2, dev))
2536 return hpsa_cmd_free_and_done(h, c, cmd);
2569 struct scsi_cmnd *cmd;
2581 cmd = cp->scsi_cmd;
2584 if (!cmd->device) {
2585 cmd->result = DID_NO_CONNECT << 16;
2586 return hpsa_cmd_free_and_done(h, cp, cmd);
2589 dev = cmd->device->hostdata;
2591 cmd->result = DID_NO_CONNECT << 16;
2592 return hpsa_cmd_free_and_done(h, cp, cmd);
2596 scsi_dma_unmap(cmd); /* undo the DMA mappings */
2605 cmd->result = (DID_OK << 16); /* host byte */
2616 cmd->result = DID_NO_CONNECT << 16;
2617 return hpsa_cmd_free_and_done(h, cp, cmd);
2630 cmd->result = DID_NO_CONNECT << 16;
2631 return hpsa_cmd_free_and_done(h, cp, cmd);
2635 return process_ioaccel2_completion(h, cp, cmd, dev);
2637 scsi_set_resid(cmd, ei->ResidualCnt);
2639 return hpsa_cmd_free_and_done(h, cp, cmd);
2646 cp->Header.SGList = scsi_sg_count(cmd);
2669 cmd->result |= ei->ScsiStatus;
2677 memcpy(cmd->sense_buffer, ei->SenseInfo, sense_data_size);
2684 cmd->result |= DID_SOFT_ERROR << 16;
2693 cmd->result = DID_NO_CONNECT << 16;
2708 cmd->result);
2725 cmd->result = DID_NO_CONNECT << 16;
2744 cmd->result = DID_NO_CONNECT << 16;
2748 cmd->result = DID_ERROR << 16;
2753 cmd->result = DID_ERROR << 16;
2758 cmd->result = DID_ERROR << 16;
2763 cmd->result = DID_ABORT << 16;
2766 cmd->result = DID_ERROR << 16;
2771 cmd->result = DID_SOFT_ERROR << 16; /* retry the command */
2776 cmd->result = DID_TIME_OUT << 16;
2781 cmd->result = DID_ERROR << 16;
2786 cmd->result = DID_ERROR << 16;
2792 cmd->result = DID_SOFT_ERROR << 16;
2797 cmd->result = DID_ERROR << 16;
2802 return hpsa_cmd_free_and_done(h, cp, cmd);
2840 cp->Header.SGList = 1; /* no. SGs contig in this cmd */
2841 cp->Header.SGTotal = cpu_to_le16(1); /* total sgs in cmd list */
4336 * physical luns and report logical luns cmd, and adjust
4571 * hpsa_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
4577 struct scsi_cmnd *cmd)
4583 BUG_ON(scsi_sg_count(cmd) > h->maxsgentries);
4585 use_sg = scsi_dma_map(cmd);
4602 scsi_for_each_sg(cmd, sg, sg_limit, i) {
4632 scsi_dma_unmap(cmd);
4640 cp->Header.SGList = (u8) use_sg; /* no. SGs contig in this cmd */
4641 cp->Header.SGTotal = cpu_to_le16(use_sg); /* total sgs in cmd list */
4735 struct scsi_cmnd *cmd = c->scsi_cmd;
4746 if (scsi_sg_count(cmd) > h->ioaccel_maxsg) {
4751 BUG_ON(cmd->cmd_len > IOACCEL1_IOFLAGS_CDBLEN_MAX);
4771 use_sg = scsi_dma_map(cmd);
4779 scsi_for_each_sg(cmd, sg, use_sg, i) {
4790 switch (cmd->sc_data_direction) {
4802 cmd->sc_data_direction);
4831 struct scsi_cmnd *cmd = c->scsi_cmd;
4832 struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
4843 cmd->cmnd, cmd->cmd_len, dev->scsi3addr, dev);
4852 struct scsi_cmnd *cmd = c->scsi_cmd;
4853 struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
4870 switch (cmd->cmnd[0]) {
4874 first_block = (((cmd->cmnd[1] & 0x1F) << 16) |
4875 (cmd->cmnd[2] << 8) |
4876 cmd->cmnd[3]);
4883 first_block = get_unaligned_be32(&cmd->cmnd[2]);
4887 first_block = get_unaligned_be64(&cmd->cmnd[2]);
4892 __func__, cmd->cmnd[0]);
4909 struct scsi_cmnd *cmd = c->scsi_cmd;
4918 if (!cmd->device)
4921 if (!cmd->device->hostdata)
4924 BUG_ON(scsi_sg_count(cmd) > h->maxsgentries);
4946 use_sg = scsi_dma_map(cmd);
4966 scsi_for_each_sg(cmd, sg, use_sg, i) {
4984 switch (cmd->sc_data_direction) {
4999 cmd->sc_data_direction);
5026 scsi_dma_unmap(cmd);
5033 cmd->result = DID_RESET << 16;
5105 struct scsi_cmnd *cmd = c->scsi_cmd;
5106 struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
5144 switch (cmd->cmnd[0]) {
5149 first_block = (((cmd->cmnd[1] & 0x1F) << 16) |
5150 (cmd->cmnd[2] << 8) |
5151 cmd->cmnd[3]);
5152 block_cnt = cmd->cmnd[4];
5161 (((u64) cmd->cmnd[2]) << 24) |
5162 (((u64) cmd->cmnd[3]) << 16) |
5163 (((u64) cmd->cmnd[4]) << 8) |
5164 cmd->cmnd[5];
5166 (((u32) cmd->cmnd[7]) << 8) |
5167 cmd->cmnd[8];
5174 (((u64) cmd->cmnd[2]) << 24) |
5175 (((u64) cmd->cmnd[3]) << 16) |
5176 (((u64) cmd->cmnd[4]) << 8) |
5177 cmd->cmnd[5];
5179 (((u32) cmd->cmnd[6]) << 24) |
5180 (((u32) cmd->cmnd[7]) << 16) |
5181 (((u32) cmd->cmnd[8]) << 8) |
5182 cmd->cmnd[9];
5189 (((u64) cmd->cmnd[2]) << 56) |
5190 (((u64) cmd->cmnd[3]) << 48) |
5191 (((u64) cmd->cmnd[4]) << 40) |
5192 (((u64) cmd->cmnd[5]) << 32) |
5193 (((u64) cmd->cmnd[6]) << 24) |
5194 (((u64) cmd->cmnd[7]) << 16) |
5195 (((u64) cmd->cmnd[8]) << 8) |
5196 cmd->cmnd[9];
5198 (((u32) cmd->cmnd[10]) << 24) |
5199 (((u32) cmd->cmnd[11]) << 16) |
5200 (((u32) cmd->cmnd[12]) << 8) |
5201 cmd->cmnd[13];
5457 struct CommandList *c, struct scsi_cmnd *cmd,
5460 cmd->host_scribble = (unsigned char *) c;
5462 c->scsi_cmd = cmd;
5470 BUG_ON(cmd->cmd_len > sizeof(c->Request.CDB));
5471 c->Request.CDBLen = cmd->cmd_len;
5472 memcpy(c->Request.CDB, cmd->cmnd, cmd->cmd_len);
5473 switch (cmd->sc_data_direction) {
5506 cmd->sc_data_direction);
5511 if (hpsa_scatter_gather(h, c, cmd) < 0) { /* Fill SG list */
5524 /* the cmd'll come back via intr handler in complete_scsi_command() */
5574 struct CommandList *c, struct scsi_cmnd *cmd,
5577 struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
5589 cmd->host_scribble = (unsigned char *) c;
5594 c->scsi_cmd = cmd;
5604 c->scsi_cmd = cmd;
5617 struct scsi_cmnd *cmd;
5621 cmd = c->scsi_cmd;
5622 dev = cmd->device->hostdata;
5624 cmd->result = DID_NO_CONNECT << 16;
5625 return hpsa_cmd_free_and_done(c->h, c, cmd);
5629 cmd->result = DID_RESET << 16;
5630 return hpsa_cmd_free_and_done(c->h, c, cmd);
5641 rc = hpsa_ioaccel_submit(h, c, cmd, true);
5650 cmd->result = DID_IMM_RETRY << 16;
5651 return hpsa_cmd_free_and_done(h, c, cmd);
5666 if (hpsa_ciss_submit(c->h, c, cmd, dev)) {
5675 cmd->result = DID_IMM_RETRY << 16;
5676 scsi_done(cmd);
5681 static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
5688 /* Get the ptr to our adapter structure out of cmd->host. */
5689 h = sdev_to_hba(cmd->device);
5691 BUG_ON(scsi_cmd_to_rq(cmd)->tag < 0);
5693 dev = cmd->device->hostdata;
5695 cmd->result = DID_NO_CONNECT << 16;
5696 scsi_done(cmd);
5701 cmd->result = DID_NO_CONNECT << 16;
5702 scsi_done(cmd);
5707 cmd->result = DID_NO_CONNECT << 16;
5708 scsi_done(cmd);
5715 c = cmd_tagged_alloc(h, cmd);
5723 cmd->result = 0;
5728 * Note: If cmd->retries is non-zero, then this is a SML
5733 if (likely(cmd->retries == 0 &&
5734 !blk_rq_is_passthrough(scsi_cmd_to_rq(cmd)) &&
5737 rc = hpsa_ioaccel_submit(h, c, cmd, false);
5745 return hpsa_ciss_submit(h, c, cmd, dev);
6063 "cmd %d RESET FAILED, lockup detected",
6073 "cmd %d RESET FAILED, new lockup detected",
6269 static int hpsa_ioctl32_passthru(struct scsi_device *dev, unsigned int cmd,
6301 unsigned int cmd, void __user *arg)
6331 static int hpsa_compat_ioctl(struct scsi_device *dev, unsigned int cmd,
6334 switch (cmd) {
6350 return hpsa_ioctl(dev, cmd, arg);
6353 return hpsa_ioctl32_passthru(dev, cmd, arg);
6355 return hpsa_ioctl32_big_passthru(dev, cmd, arg);
6627 static int hpsa_ioctl(struct scsi_device *dev, unsigned int cmd,
6633 switch (cmd) {
6696 static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
6715 switch (cmd) {
6734 c->Request.CDB[0] = cmd;
6749 c->Request.CDB[0] = cmd;
6796 c->Request.CDB[1] = cmd;
6859 dev_warn(&h->pdev->dev, "unknown command 0x%c\n", cmd);
6863 switch (cmd) {
6885 c->Request.CDB[0] = cmd;
6896 cmd);
7096 struct Command *cmd;
7097 static const size_t cmd_sz = sizeof(*cmd) +
7098 sizeof(cmd->ErrorDescriptor);
7119 cmd = dma_alloc_coherent(&pdev->dev, cmd_sz, &paddr64, GFP_KERNEL);
7120 if (cmd == NULL) {
7131 cmd->CommandHeader.ReplyQueue = 0;
7132 cmd->CommandHeader.SGList = 0;
7133 cmd->CommandHeader.SGTotal = cpu_to_le16(0);
7134 cmd->CommandHeader.tag = cpu_to_le64(paddr64);
7135 memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8);
7137 cmd->Request.CDBLen = 16;
7138 cmd->Request.type_attr_dir =
7140 cmd->Request.Timeout = 0; /* Don't time out */
7141 cmd->Request.CDB[0] = opcode;
7142 cmd->Request.CDB[1] = type;
7143 memset(&cmd->Request.CDB[2], 0, 14); /* rest of the CDB is reserved */
7144 cmd->ErrorDescriptor.Addr =
7145 cpu_to_le64((le32_to_cpu(paddr32) + sizeof(*cmd)));
7146 cmd->ErrorDescriptor.Len = cpu_to_le32(sizeof(struct ErrorInfo));
7168 dma_free_coherent(&pdev->dev, cmd_sz, cmd, paddr64);
8759 goto clean5; /* cmd, irq, shost, pci, lu, aer/h */
8772 goto clean6; /* sg, cmd, irq, shost, pci, lu, aer/h */
8879 goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
8894 clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
8896 clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
8899 clean6: /* sg, cmd, irq, pci, lockup, wq/aer/h */
8901 clean5: /* cmd, irq, shost, pci, lu, aer/h */