Lines Matching full:ent
190 "ent[%d] %s val[%02x] sreg[%02x] seqreg[%02x] " in esp_dump_cmd_log()
404 static dma_addr_t esp_cur_dma_addr(struct esp_cmd_entry *ent, in esp_cur_dma_addr() argument
409 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_cur_dma_addr()
410 return ent->sense_dma + in esp_cur_dma_addr()
411 (ent->sense_ptr - cmd->sense_buffer); in esp_cur_dma_addr()
419 static unsigned int esp_cur_dma_len(struct esp_cmd_entry *ent, in esp_cur_dma_len() argument
424 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_cur_dma_len()
426 (ent->sense_ptr - cmd->sense_buffer); in esp_cur_dma_len()
431 static void esp_advance_dma(struct esp *esp, struct esp_cmd_entry *ent, in esp_advance_dma() argument
436 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_advance_dma()
437 ent->sense_ptr += len; in esp_advance_dma()
465 static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent) in esp_save_pointers() argument
467 struct scsi_cmnd *cmd = ent->cmd; in esp_save_pointers()
470 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_save_pointers()
471 ent->saved_sense_ptr = ent->sense_ptr; in esp_save_pointers()
474 ent->saved_cur_residue = spriv->cur_residue; in esp_save_pointers()
475 ent->saved_prv_sg = spriv->prv_sg; in esp_save_pointers()
476 ent->saved_cur_sg = spriv->cur_sg; in esp_save_pointers()
477 ent->saved_tot_residue = spriv->tot_residue; in esp_save_pointers()
480 static void esp_restore_pointers(struct esp *esp, struct esp_cmd_entry *ent) in esp_restore_pointers() argument
482 struct scsi_cmnd *cmd = ent->cmd; in esp_restore_pointers()
485 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_restore_pointers()
486 ent->sense_ptr = ent->saved_sense_ptr; in esp_restore_pointers()
489 spriv->cur_residue = ent->saved_cur_residue; in esp_restore_pointers()
490 spriv->prv_sg = ent->saved_prv_sg; in esp_restore_pointers()
491 spriv->cur_sg = ent->saved_cur_sg; in esp_restore_pointers()
492 spriv->tot_residue = ent->saved_tot_residue; in esp_restore_pointers()
574 static int esp_alloc_lun_tag(struct esp_cmd_entry *ent, in esp_alloc_lun_tag() argument
577 if (!ent->orig_tag[0]) { in esp_alloc_lun_tag()
601 lp->non_tagged_cmd = ent; in esp_alloc_lun_tag()
609 BUG_ON(lp->tagged_cmds[ent->orig_tag[1]]); in esp_alloc_lun_tag()
611 lp->tagged_cmds[ent->orig_tag[1]] = ent; in esp_alloc_lun_tag()
617 static void esp_free_lun_tag(struct esp_cmd_entry *ent, in esp_free_lun_tag() argument
620 if (ent->orig_tag[0]) { in esp_free_lun_tag()
621 BUG_ON(lp->tagged_cmds[ent->orig_tag[1]] != ent); in esp_free_lun_tag()
622 lp->tagged_cmds[ent->orig_tag[1]] = NULL; in esp_free_lun_tag()
625 BUG_ON(lp->non_tagged_cmd != ent); in esp_free_lun_tag()
630 static void esp_map_sense(struct esp *esp, struct esp_cmd_entry *ent) in esp_map_sense() argument
632 ent->sense_ptr = ent->cmd->sense_buffer; in esp_map_sense()
634 ent->sense_dma = (uintptr_t)ent->sense_ptr; in esp_map_sense()
638 ent->sense_dma = dma_map_single(esp->dev, ent->sense_ptr, in esp_map_sense()
642 static void esp_unmap_sense(struct esp *esp, struct esp_cmd_entry *ent) in esp_unmap_sense() argument
645 dma_unmap_single(esp->dev, ent->sense_dma, in esp_unmap_sense()
647 ent->sense_ptr = NULL; in esp_unmap_sense()
657 static void esp_autosense(struct esp *esp, struct esp_cmd_entry *ent) in esp_autosense() argument
659 struct scsi_cmnd *cmd = ent->cmd; in esp_autosense()
668 if (!ent->sense_ptr) { in esp_autosense()
671 esp_map_sense(esp, ent); in esp_autosense()
673 ent->saved_sense_ptr = ent->sense_ptr; in esp_autosense()
675 esp->active_cmd = ent; in esp_autosense()
706 struct esp_cmd_entry *ent; in find_and_prep_issuable_command() local
708 list_for_each_entry(ent, &esp->queued_cmds, list) { in find_and_prep_issuable_command()
709 struct scsi_cmnd *cmd = ent->cmd; in find_and_prep_issuable_command()
713 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in find_and_prep_issuable_command()
714 ent->tag[0] = 0; in find_and_prep_issuable_command()
715 ent->tag[1] = 0; in find_and_prep_issuable_command()
716 return ent; in find_and_prep_issuable_command()
719 if (!spi_populate_tag_msg(&ent->tag[0], cmd)) { in find_and_prep_issuable_command()
720 ent->tag[0] = 0; in find_and_prep_issuable_command()
721 ent->tag[1] = 0; in find_and_prep_issuable_command()
723 ent->orig_tag[0] = ent->tag[0]; in find_and_prep_issuable_command()
724 ent->orig_tag[1] = ent->tag[1]; in find_and_prep_issuable_command()
726 if (esp_alloc_lun_tag(ent, lp) < 0) in find_and_prep_issuable_command()
729 return ent; in find_and_prep_issuable_command()
740 struct esp_cmd_entry *ent; in esp_maybe_execute_command() local
750 ent = find_and_prep_issuable_command(esp); in esp_maybe_execute_command()
751 if (!ent) in esp_maybe_execute_command()
754 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_maybe_execute_command()
755 esp_autosense(esp, ent); in esp_maybe_execute_command()
759 cmd = ent->cmd; in esp_maybe_execute_command()
765 list_move(&ent->list, &esp->active_cmds); in esp_maybe_execute_command()
767 esp->active_cmd = ent; in esp_maybe_execute_command()
770 esp_save_pointers(esp, ent); in esp_maybe_execute_command()
822 if (ent->tag[0] && esp->rev == ESP100) { in esp_maybe_execute_command()
833 if (ent->tag[0]) { in esp_maybe_execute_command()
837 esp->msg_out[0] = ent->tag[0]; in esp_maybe_execute_command()
838 esp->msg_out[1] = ent->tag[1]; in esp_maybe_execute_command()
846 if (ent->tag[0]) { in esp_maybe_execute_command()
847 *p++ = ent->tag[0]; in esp_maybe_execute_command()
848 *p++ = ent->tag[1]; in esp_maybe_execute_command()
893 static void esp_put_ent(struct esp *esp, struct esp_cmd_entry *ent) in esp_put_ent() argument
895 list_add(&ent->list, &esp->esp_cmd_pool); in esp_put_ent()
898 static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent, in esp_cmd_is_done() argument
907 esp_free_lun_tag(ent, dev->hostdata); in esp_cmd_is_done()
910 if (ent->eh_done) { in esp_cmd_is_done()
911 complete(ent->eh_done); in esp_cmd_is_done()
912 ent->eh_done = NULL; in esp_cmd_is_done()
915 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_cmd_is_done()
916 esp_unmap_sense(esp, ent); in esp_cmd_is_done()
927 ent->flags &= ~ESP_CMD_FLAG_AUTOSENSE; in esp_cmd_is_done()
941 list_del(&ent->list); in esp_cmd_is_done()
942 esp_put_ent(esp, ent); in esp_cmd_is_done()
953 static void esp_event_queue_full(struct esp *esp, struct esp_cmd_entry *ent) in esp_event_queue_full() argument
955 struct scsi_device *dev = ent->cmd->device; in esp_event_queue_full()
966 struct esp_cmd_entry *ent; in esp_queuecommand_lck() local
968 ent = esp_get_ent(esp); in esp_queuecommand_lck()
969 if (!ent) in esp_queuecommand_lck()
972 ent->cmd = cmd; in esp_queuecommand_lck()
979 list_add_tail(&ent->list, &esp->queued_cmds); in esp_queuecommand_lck()
1057 struct esp_cmd_entry *ent; in esp_reconnect_with_tag() local
1134 ent = lp->tagged_cmds[esp->command_block[1]]; in esp_reconnect_with_tag()
1135 if (!ent) { in esp_reconnect_with_tag()
1142 return ent; in esp_reconnect_with_tag()
1147 struct esp_cmd_entry *ent; in esp_reconnect() local
1211 ent = lp->non_tagged_cmd; in esp_reconnect()
1212 if (!ent) { in esp_reconnect()
1213 ent = esp_reconnect_with_tag(esp, lp); in esp_reconnect()
1214 if (!ent) in esp_reconnect()
1218 esp->active_cmd = ent; in esp_reconnect()
1221 esp_restore_pointers(esp, ent); in esp_reconnect()
1232 struct esp_cmd_entry *ent; in esp_finish_select() local
1239 ent = esp->active_cmd; in esp_finish_select()
1240 cmd = ent->cmd; in esp_finish_select()
1247 esp_cmd_is_done(esp, ent, cmd, (DID_ERROR << 16)); in esp_finish_select()
1260 if (!(ent->flags & ESP_CMD_FLAG_AUTOSENSE)) { in esp_finish_select()
1262 esp_free_lun_tag(ent, cmd->device->hostdata); in esp_finish_select()
1267 esp_unmap_sense(esp, ent); in esp_finish_select()
1273 list_move(&ent->list, &esp->queued_cmds); in esp_finish_select()
1292 esp_cmd_is_done(esp, ent, cmd, (DID_BAD_TARGET << 16)); in esp_finish_select()
1324 static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent, in esp_data_bytes_sent() argument
1355 if (fifo_cnt == 1 && ent->flags & ESP_CMD_FLAG_RESIDUAL) { in esp_data_bytes_sent()
1360 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) in esp_data_bytes_sent()
1361 ent->sense_ptr[bytes_sent] = bval; in esp_data_bytes_sent()
1374 ent->flags &= ~ESP_CMD_FLAG_RESIDUAL; in esp_data_bytes_sent()
1376 if (!(ent->flags & ESP_CMD_FLAG_WRITE)) in esp_data_bytes_sent()
1408 if (!(ent->flags & ESP_CMD_FLAG_WRITE)) in esp_data_bytes_sent()
1459 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_reject() local
1460 struct scsi_cmnd *cmd = ent->cmd; in esp_msgin_reject()
1599 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_extended() local
1600 struct scsi_cmnd *cmd = ent->cmd; in esp_msgin_extended()
1647 struct esp_cmd_entry *ent; in esp_msgin_process() local
1655 ent = esp->active_cmd; in esp_msgin_process()
1656 spriv = ESP_CMD_PRIV(ent->cmd); in esp_msgin_process()
1677 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_process() local
1679 ent->message = msg0; in esp_msgin_process()
1747 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event() local
1748 struct scsi_cmnd *cmd = ent->cmd; in esp_process_event()
1749 dma_addr_t dma_addr = esp_cur_dma_addr(ent, cmd); in esp_process_event()
1750 unsigned int dma_len = esp_cur_dma_len(ent, cmd); in esp_process_event()
1756 ent->flags |= ESP_CMD_FLAG_WRITE; in esp_process_event()
1758 ent->flags &= ~ESP_CMD_FLAG_WRITE; in esp_process_event()
1773 (unsigned long long)esp_cur_dma_addr(ent, cmd), in esp_process_event()
1774 esp_cur_dma_len(ent, cmd)); in esp_process_event()
1788 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event() local
1789 struct scsi_cmnd *cmd = ent->cmd; in esp_process_event()
1799 if (ent->flags & ESP_CMD_FLAG_WRITE) { in esp_process_event()
1816 bytes_sent = esp_data_bytes_sent(esp, ent, cmd); in esp_process_event()
1819 ent->flags, bytes_sent); in esp_process_event()
1827 esp_advance_dma(esp, ent, cmd, bytes_sent); in esp_process_event()
1833 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event() local
1836 ent->status = esp_read8(ESP_FDATA); in esp_process_event()
1837 ent->message = esp_read8(ESP_FDATA); in esp_process_event()
1840 ent->status = esp_read8(ESP_FDATA); in esp_process_event()
1841 ent->message = 0xff; in esp_process_event()
1846 if (ent->message != COMMAND_COMPLETE) { in esp_process_event()
1849 ent->message); in esp_process_event()
1859 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event() local
1860 struct scsi_cmnd *cmd = ent->cmd; in esp_process_event()
1862 if (ent->message == COMMAND_COMPLETE || in esp_process_event()
1863 ent->message == DISCONNECT) in esp_process_event()
1866 if (ent->message == COMMAND_COMPLETE) { in esp_process_event()
1868 ent->status, ent->message); in esp_process_event()
1869 if (ent->status == SAM_STAT_TASK_SET_FULL) in esp_process_event()
1870 esp_event_queue_full(esp, ent); in esp_process_event()
1872 if (ent->status == SAM_STAT_CHECK_CONDITION && in esp_process_event()
1873 !(ent->flags & ESP_CMD_FLAG_AUTOSENSE)) { in esp_process_event()
1874 ent->flags |= ESP_CMD_FLAG_AUTOSENSE; in esp_process_event()
1875 esp_autosense(esp, ent); in esp_process_event()
1877 esp_cmd_is_done(esp, ent, cmd, in esp_process_event()
1878 compose_result(ent->status, in esp_process_event()
1879 ent->message, in esp_process_event()
1882 } else if (ent->message == DISCONNECT) { in esp_process_event()
1885 ent->tag[0], ent->tag[1]); in esp_process_event()
1892 ent->message); in esp_process_event()
2039 static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent) in esp_reset_cleanup_one() argument
2041 struct scsi_cmnd *cmd = ent->cmd; in esp_reset_cleanup_one()
2044 esp_free_lun_tag(ent, cmd->device->hostdata); in esp_reset_cleanup_one()
2047 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) in esp_reset_cleanup_one()
2048 esp_unmap_sense(esp, ent); in esp_reset_cleanup_one()
2051 list_del(&ent->list); in esp_reset_cleanup_one()
2052 esp_put_ent(esp, ent); in esp_reset_cleanup_one()
2065 struct esp_cmd_entry *ent, *tmp; in esp_reset_cleanup() local
2068 list_for_each_entry_safe(ent, tmp, &esp->queued_cmds, list) { in esp_reset_cleanup()
2069 struct scsi_cmnd *cmd = ent->cmd; in esp_reset_cleanup()
2071 list_del(&ent->list); in esp_reset_cleanup()
2074 esp_put_ent(esp, ent); in esp_reset_cleanup()
2077 list_for_each_entry_safe(ent, tmp, &esp->active_cmds, list) { in esp_reset_cleanup()
2078 if (ent == esp->active_cmd) in esp_reset_cleanup()
2080 esp_reset_cleanup_one(esp, ent); in esp_reset_cleanup()
2504 struct esp_cmd_entry *ent, *tmp; in esp_eh_abort_handler() local
2514 ent = esp->active_cmd; in esp_eh_abort_handler()
2515 if (ent) in esp_eh_abort_handler()
2518 ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2519 list_for_each_entry(ent, &esp->queued_cmds, list) { in esp_eh_abort_handler()
2521 ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2523 list_for_each_entry(ent, &esp->active_cmds, list) { in esp_eh_abort_handler()
2525 ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2532 ent = NULL; in esp_eh_abort_handler()
2535 ent = tmp; in esp_eh_abort_handler()
2540 if (ent) { in esp_eh_abort_handler()
2544 list_del(&ent->list); in esp_eh_abort_handler()
2549 esp_put_ent(esp, ent); in esp_eh_abort_handler()
2556 ent = esp->active_cmd; in esp_eh_abort_handler()
2557 if (ent && ent->cmd == cmd) { in esp_eh_abort_handler()
2570 ent->eh_done = &eh_done; in esp_eh_abort_handler()
2597 ent->eh_done = NULL; in esp_eh_abort_handler()