Lines Matching full:scb

23  * 1. SCSI command is transformed to SCB (Spider Control Block) by the
25 * 2. The address of the SCB is stored in a list to be able to access it, if
27 * 3. The address of the SCB is written to the Controller, which loads the SCB
189 static void wd719x_finish_cmd(struct wd719x_scb *scb, int result) in wd719x_finish_cmd() argument
191 struct scsi_cmnd *cmd = scb->cmd; in wd719x_finish_cmd()
194 list_del(&scb->list); in wd719x_finish_cmd()
196 dma_unmap_single(&wd->pdev->dev, scb->phys, in wd719x_finish_cmd()
199 dma_unmap_single(&wd->pdev->dev, scb->dma_handle, in wd719x_finish_cmd()
206 /* Build a SCB and send it to the card */
211 struct wd719x_scb *scb = scsi_cmd_priv(cmd); in wd719x_queuecommand() local
214 scb->cmd = cmd; in wd719x_queuecommand()
216 scb->CDB_tag = 0; /* Tagged queueing not supported yet */ in wd719x_queuecommand()
217 scb->devid = cmd->device->id; in wd719x_queuecommand()
218 scb->lun = cmd->device->lun; in wd719x_queuecommand()
221 memcpy(scb->CDB, cmd->cmnd, cmd->cmd_len); in wd719x_queuecommand()
223 /* map SCB */ in wd719x_queuecommand()
224 scb->phys = dma_map_single(&wd->pdev->dev, scb, sizeof(*scb), in wd719x_queuecommand()
227 if (dma_mapping_error(&wd->pdev->dev, scb->phys)) in wd719x_queuecommand()
231 scb->sense_buf_length = SCSI_SENSE_BUFFERSIZE; in wd719x_queuecommand()
232 scb->dma_handle = dma_map_single(&wd->pdev->dev, cmd->sense_buffer, in wd719x_queuecommand()
234 if (dma_mapping_error(&wd->pdev->dev, scb->dma_handle)) in wd719x_queuecommand()
236 scb->sense_buf = cpu_to_le32(scb->dma_handle); in wd719x_queuecommand()
239 scb->SCB_options |= WD719X_SCB_FLAGS_AUTO_REQUEST_SENSE; in wd719x_queuecommand()
243 scb->SCB_options |= WD719X_SCB_FLAGS_CHECK_DIRECTION in wd719x_queuecommand()
246 scb->SCB_options |= WD719X_SCB_FLAGS_CHECK_DIRECTION; in wd719x_queuecommand()
257 scb->data_length = cpu_to_le32(count_sg * in wd719x_queuecommand()
259 scb->data_p = cpu_to_le32(scb->phys + in wd719x_queuecommand()
263 scb->sg_list[i].ptr = cpu_to_le32(sg_dma_address(sg)); in wd719x_queuecommand()
264 scb->sg_list[i].length = cpu_to_le32(sg_dma_len(sg)); in wd719x_queuecommand()
266 scb->SCB_options |= WD719X_SCB_FLAGS_DO_SCATTER_GATHER; in wd719x_queuecommand()
268 scb->data_length = 0; in wd719x_queuecommand()
269 scb->data_p = 0; in wd719x_queuecommand()
280 list_add(&scb->list, &wd->active_scbs); in wd719x_queuecommand()
283 wd719x_writel(wd, WD719X_AMR_SCB_IN, scb->phys); in wd719x_queuecommand()
284 /* send SCB opcode */ in wd719x_queuecommand()
291 dma_unmap_single(&wd->pdev->dev, scb->dma_handle, in wd719x_queuecommand()
294 dma_unmap_single(&wd->pdev->dev, scb->phys, sizeof(*scb), in wd719x_queuecommand()
467 struct wd719x_scb *scb = scsi_cmd_priv(cmd); in wd719x_abort() local
478 scb->phys, 0); in wd719x_abort()
479 wd719x_finish_cmd(scb, DID_ABORT); in wd719x_abort()
492 struct wd719x_scb *scb, *tmp; in wd719x_reset() local
501 list_for_each_entry_safe(scb, tmp, &wd->active_scbs, list) { in wd719x_reset()
503 scb->cmd->device->id == device) in wd719x_reset()
504 wd719x_finish_cmd(scb, DID_RESET); in wd719x_reset()
526 struct wd719x_scb *scb, *tmp; in wd719x_host_reset() local
539 list_for_each_entry_safe(scb, tmp, &wd->active_scbs, list) in wd719x_host_reset()
540 wd719x_finish_cmd(scb, DID_RESET); in wd719x_host_reset()
562 /* process a SCB-completion interrupt */
565 struct wd719x_scb *scb) in wd719x_interrupt_SCB() argument
579 dev_err(&wd->pdev->dev, "SCB queue is full\n"); in wd719x_interrupt_SCB()
583 dev_dbg(&wd->pdev->dev, "SCB terminated by direct command\n"); in wd719x_interrupt_SCB()
633 scb->cmd->device->id); in wd719x_interrupt_SCB()
655 wd719x_finish_cmd(scb, result); in wd719x_interrupt_SCB()
666 /* read SCB pointer back from card */ in wd719x_interrupt()
685 /* was the cmd completed a direct or SCB command? */ in wd719x_interrupt()
687 struct wd719x_scb *scb; in wd719x_interrupt() local
688 list_for_each_entry(scb, &wd->active_scbs, list) in wd719x_interrupt()
689 if (SCB_out == scb->phys) in wd719x_interrupt()
691 if (SCB_out == scb->phys) in wd719x_interrupt()
692 wd719x_interrupt_SCB(wd, regs, scb); in wd719x_interrupt()
694 dev_err(&wd->pdev->dev, "card returned invalid SCB pointer\n"); in wd719x_interrupt()