Lines Matching defs:cmd
256 static int hpsa_ioctl(struct scsi_device *dev, unsigned int cmd,
264 static int hpsa_compat_ioctl(struct scsi_device *dev, unsigned int cmd,
273 static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
280 static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
2339 struct scsi_cmnd *cmd,
2351 if (cmd)
2352 cmd->result = 0;
2355 cmd->result |= SAM_STAT_CHECK_CONDITION;
2358 memset(cmd->sense_buffer, 0,
2369 memcpy(cmd->sense_buffer,
2398 cmd->result = (DID_OK << 16); /* host byte */
2399 cmd->result |= (COMMAND_COMPLETE << 8); /* msg byte */
2402 scsi_set_resid(cmd, ioaccel2_resid);
2416 cmd->result = DID_NO_CONNECT << 16;
2481 struct CommandList *c, struct scsi_cmnd *cmd)
2484 if (cmd && cmd->scsi_done)
2485 cmd->scsi_done(cmd);
2495 struct CommandList *c, struct scsi_cmnd *cmd,
2503 cmd->result = 0;
2504 return hpsa_cmd_free_and_done(h, c, cmd);
2521 cmd->result = DID_RESET << 16;
2522 return hpsa_cmd_free_and_done(h, c, cmd);
2528 if (handle_ioaccel_mode2_error(h, c, cmd, c2, dev))
2531 return hpsa_cmd_free_and_done(h, c, cmd);
2564 struct scsi_cmnd *cmd;
2576 cmd = cp->scsi_cmd;
2579 if (!cmd->device) {
2580 cmd->result = DID_NO_CONNECT << 16;
2581 return hpsa_cmd_free_and_done(h, cp, cmd);
2584 dev = cmd->device->hostdata;
2586 cmd->result = DID_NO_CONNECT << 16;
2587 return hpsa_cmd_free_and_done(h, cp, cmd);
2591 scsi_dma_unmap(cmd); /* undo the DMA mappings */
2600 cmd->result = (DID_OK << 16); /* host byte */
2601 cmd->result |= (COMMAND_COMPLETE << 8); /* msg byte */
2612 cmd->result = DID_NO_CONNECT << 16;
2613 return hpsa_cmd_free_and_done(h, cp, cmd);
2626 cmd->result = DID_NO_CONNECT << 16;
2627 return hpsa_cmd_free_and_done(h, cp, cmd);
2631 return process_ioaccel2_completion(h, cp, cmd, dev);
2633 scsi_set_resid(cmd, ei->ResidualCnt);
2635 return hpsa_cmd_free_and_done(h, cp, cmd);
2642 cp->Header.SGList = scsi_sg_count(cmd);
2665 cmd->result |= ei->ScsiStatus;
2673 memcpy(cmd->sense_buffer, ei->SenseInfo, sense_data_size);
2680 cmd->result |= DID_SOFT_ERROR << 16;
2689 cmd->result = DID_NO_CONNECT << 16;
2704 cmd->result);
2721 cmd->result = DID_NO_CONNECT << 16;
2740 cmd->result = DID_NO_CONNECT << 16;
2744 cmd->result = DID_ERROR << 16;
2749 cmd->result = DID_ERROR << 16;
2754 cmd->result = DID_ERROR << 16;
2759 cmd->result = DID_ABORT << 16;
2762 cmd->result = DID_ERROR << 16;
2767 cmd->result = DID_SOFT_ERROR << 16; /* retry the command */
2772 cmd->result = DID_TIME_OUT << 16;
2777 cmd->result = DID_ERROR << 16;
2782 cmd->result = DID_ERROR << 16;
2788 cmd->result = DID_SOFT_ERROR << 16;
2793 cmd->result = DID_ERROR << 16;
2798 return hpsa_cmd_free_and_done(h, cp, cmd);
2836 cp->Header.SGList = 1; /* no. SGs contig in this cmd */
2837 cp->Header.SGTotal = cpu_to_le16(1); /* total sgs in cmd list */
4336 * physical luns and report logical luns cmd, and adjust
4574 * hpsa_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
4580 struct scsi_cmnd *cmd)
4586 BUG_ON(scsi_sg_count(cmd) > h->maxsgentries);
4588 use_sg = scsi_dma_map(cmd);
4605 last_sg = scsi_sg_count(cmd) - 1;
4606 scsi_for_each_sg(cmd, sg, sg_limit, i) {
4636 scsi_dma_unmap(cmd);
4644 cp->Header.SGList = (u8) use_sg; /* no. SGs contig in this cmd */
4645 cp->Header.SGTotal = cpu_to_le16(use_sg); /* total sgs in cmd list */
4739 struct scsi_cmnd *cmd = c->scsi_cmd;
4750 if (scsi_sg_count(cmd) > h->ioaccel_maxsg) {
4755 BUG_ON(cmd->cmd_len > IOACCEL1_IOFLAGS_CDBLEN_MAX);
4775 use_sg = scsi_dma_map(cmd);
4783 scsi_for_each_sg(cmd, sg, use_sg, i) {
4794 switch (cmd->sc_data_direction) {
4806 cmd->sc_data_direction);
4835 struct scsi_cmnd *cmd = c->scsi_cmd;
4836 struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
4847 cmd->cmnd, cmd->cmd_len, dev->scsi3addr, dev);
4856 struct scsi_cmnd *cmd = c->scsi_cmd;
4857 struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
4874 switch (cmd->cmnd[0]) {
4878 first_block = (((cmd->cmnd[1] & 0x1F) << 16) |
4879 (cmd->cmnd[2] << 8) |
4880 cmd->cmnd[3]);
4887 first_block = get_unaligned_be32(&cmd->cmnd[2]);
4891 first_block = get_unaligned_be64(&cmd->cmnd[2]);
4896 __func__, cmd->cmnd[0]);
4913 struct scsi_cmnd *cmd = c->scsi_cmd;
4922 if (!cmd->device)
4925 if (!cmd->device->hostdata)
4928 BUG_ON(scsi_sg_count(cmd) > h->maxsgentries);
4950 use_sg = scsi_dma_map(cmd);
4970 scsi_for_each_sg(cmd, sg, use_sg, i) {
4988 switch (cmd->sc_data_direction) {
5003 cmd->sc_data_direction);
5030 scsi_dma_unmap(cmd);
5037 cmd->result = DID_RESET << 16;
5109 struct scsi_cmnd *cmd = c->scsi_cmd;
5110 struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
5148 switch (cmd->cmnd[0]) {
5153 first_block = (((cmd->cmnd[1] & 0x1F) << 16) |
5154 (cmd->cmnd[2] << 8) |
5155 cmd->cmnd[3]);
5156 block_cnt = cmd->cmnd[4];
5165 (((u64) cmd->cmnd[2]) << 24) |
5166 (((u64) cmd->cmnd[3]) << 16) |
5167 (((u64) cmd->cmnd[4]) << 8) |
5168 cmd->cmnd[5];
5170 (((u32) cmd->cmnd[7]) << 8) |
5171 cmd->cmnd[8];
5178 (((u64) cmd->cmnd[2]) << 24) |
5179 (((u64) cmd->cmnd[3]) << 16) |
5180 (((u64) cmd->cmnd[4]) << 8) |
5181 cmd->cmnd[5];
5183 (((u32) cmd->cmnd[6]) << 24) |
5184 (((u32) cmd->cmnd[7]) << 16) |
5185 (((u32) cmd->cmnd[8]) << 8) |
5186 cmd->cmnd[9];
5193 (((u64) cmd->cmnd[2]) << 56) |
5194 (((u64) cmd->cmnd[3]) << 48) |
5195 (((u64) cmd->cmnd[4]) << 40) |
5196 (((u64) cmd->cmnd[5]) << 32) |
5197 (((u64) cmd->cmnd[6]) << 24) |
5198 (((u64) cmd->cmnd[7]) << 16) |
5199 (((u64) cmd->cmnd[8]) << 8) |
5200 cmd->cmnd[9];
5202 (((u32) cmd->cmnd[10]) << 24) |
5203 (((u32) cmd->cmnd[11]) << 16) |
5204 (((u32) cmd->cmnd[12]) << 8) |
5205 cmd->cmnd[13];
5461 struct CommandList *c, struct scsi_cmnd *cmd,
5464 cmd->host_scribble = (unsigned char *) c;
5466 c->scsi_cmd = cmd;
5474 BUG_ON(cmd->cmd_len > sizeof(c->Request.CDB));
5475 c->Request.CDBLen = cmd->cmd_len;
5476 memcpy(c->Request.CDB, cmd->cmnd, cmd->cmd_len);
5477 switch (cmd->sc_data_direction) {
5510 cmd->sc_data_direction);
5515 if (hpsa_scatter_gather(h, c, cmd) < 0) { /* Fill SG list */
5528 /* the cmd'll come back via intr handler in complete_scsi_command() */
5578 struct CommandList *c, struct scsi_cmnd *cmd)
5580 struct hpsa_scsi_dev_t *dev = cmd->device->hostdata;
5592 cmd->host_scribble = (unsigned char *) c;
5597 c->scsi_cmd = cmd;
5605 c->scsi_cmd = cmd;
5616 struct scsi_cmnd *cmd;
5620 cmd = c->scsi_cmd;
5621 dev = cmd->device->hostdata;
5623 cmd->result = DID_NO_CONNECT << 16;
5624 return hpsa_cmd_free_and_done(c->h, c, cmd);
5628 cmd->result = DID_RESET << 16;
5629 return hpsa_cmd_free_and_done(c->h, c, cmd);
5639 rc = hpsa_ioaccel_submit(h, c, cmd);
5648 cmd->result = DID_IMM_RETRY << 16;
5649 return hpsa_cmd_free_and_done(h, c, cmd);
5655 if (hpsa_ciss_submit(c->h, c, cmd, dev)) {
5664 cmd->result = DID_IMM_RETRY << 16;
5665 cmd->scsi_done(cmd);
5670 static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
5677 /* Get the ptr to our adapter structure out of cmd->host. */
5678 h = sdev_to_hba(cmd->device);
5680 BUG_ON(cmd->request->tag < 0);
5682 dev = cmd->device->hostdata;
5684 cmd->result = DID_NO_CONNECT << 16;
5685 cmd->scsi_done(cmd);
5690 cmd->result = DID_NO_CONNECT << 16;
5691 cmd->scsi_done(cmd);
5696 cmd->result = DID_NO_CONNECT << 16;
5697 cmd->scsi_done(cmd);
5704 c = cmd_tagged_alloc(h, cmd);
5712 cmd->result = 0;
5718 if (likely(cmd->retries == 0 &&
5719 !blk_rq_is_passthrough(cmd->request) &&
5721 rc = hpsa_ioaccel_submit(h, c, cmd);
5729 return hpsa_ciss_submit(h, c, cmd, dev);
6047 "cmd %d RESET FAILED, lockup detected",
6057 "cmd %d RESET FAILED, new lockup detected",
6241 static int hpsa_ioctl32_passthru(struct scsi_device *dev, unsigned int cmd,
6273 unsigned int cmd, void __user *arg)
6303 static int hpsa_compat_ioctl(struct scsi_device *dev, unsigned int cmd,
6306 switch (cmd) {
6322 return hpsa_ioctl(dev, cmd, arg);
6325 return hpsa_ioctl32_passthru(dev, cmd, arg);
6327 return hpsa_ioctl32_big_passthru(dev, cmd, arg);
6599 static int hpsa_ioctl(struct scsi_device *dev, unsigned int cmd,
6605 switch (cmd) {
6668 static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
6687 switch (cmd) {
6706 c->Request.CDB[0] = cmd;
6721 c->Request.CDB[0] = cmd;
6768 c->Request.CDB[1] = cmd;
6831 dev_warn(&h->pdev->dev, "unknown command 0x%c\n", cmd);
6835 switch (cmd) {
6857 c->Request.CDB[0] = cmd;
6868 cmd);
7068 struct Command *cmd;
7069 static const size_t cmd_sz = sizeof(*cmd) +
7070 sizeof(cmd->ErrorDescriptor);
7091 cmd = dma_alloc_coherent(&pdev->dev, cmd_sz, &paddr64, GFP_KERNEL);
7092 if (cmd == NULL) {
7103 cmd->CommandHeader.ReplyQueue = 0;
7104 cmd->CommandHeader.SGList = 0;
7105 cmd->CommandHeader.SGTotal = cpu_to_le16(0);
7106 cmd->CommandHeader.tag = cpu_to_le64(paddr64);
7107 memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8);
7109 cmd->Request.CDBLen = 16;
7110 cmd->Request.type_attr_dir =
7112 cmd->Request.Timeout = 0; /* Don't time out */
7113 cmd->Request.CDB[0] = opcode;
7114 cmd->Request.CDB[1] = type;
7115 memset(&cmd->Request.CDB[2], 0, 14); /* rest of the CDB is reserved */
7116 cmd->ErrorDescriptor.Addr =
7117 cpu_to_le64((le32_to_cpu(paddr32) + sizeof(*cmd)));
7118 cmd->ErrorDescriptor.Len = cpu_to_le32(sizeof(struct ErrorInfo));
7140 dma_free_coherent(&pdev->dev, cmd_sz, cmd, paddr64);
8738 goto clean5; /* cmd, irq, shost, pci, lu, aer/h */
8751 goto clean6; /* sg, cmd, irq, shost, pci, lu, aer/h */
8858 goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
8873 clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
8875 clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
8878 clean6: /* sg, cmd, irq, pci, lockup, wq/aer/h */
8880 clean5: /* cmd, irq, shost, pci, lu, aer/h */