• Home
  • Raw
  • Download

Lines Matching refs:ent

346 static dma_addr_t esp_cur_dma_addr(struct esp_cmd_entry *ent,  in esp_cur_dma_addr()  argument
351 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_cur_dma_addr()
352 return ent->sense_dma + in esp_cur_dma_addr()
353 (ent->sense_ptr - cmd->sense_buffer); in esp_cur_dma_addr()
361 static unsigned int esp_cur_dma_len(struct esp_cmd_entry *ent, in esp_cur_dma_len() argument
366 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_cur_dma_len()
368 (ent->sense_ptr - cmd->sense_buffer); in esp_cur_dma_len()
373 static void esp_advance_dma(struct esp *esp, struct esp_cmd_entry *ent, in esp_advance_dma() argument
378 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_advance_dma()
379 ent->sense_ptr += len; in esp_advance_dma()
412 static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent) in esp_save_pointers() argument
414 struct scsi_cmnd *cmd = ent->cmd; in esp_save_pointers()
417 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_save_pointers()
418 ent->saved_sense_ptr = ent->sense_ptr; in esp_save_pointers()
421 ent->saved_cur_residue = spriv->cur_residue; in esp_save_pointers()
422 ent->saved_cur_sg = spriv->cur_sg; in esp_save_pointers()
423 ent->saved_tot_residue = spriv->tot_residue; in esp_save_pointers()
426 static void esp_restore_pointers(struct esp *esp, struct esp_cmd_entry *ent) in esp_restore_pointers() argument
428 struct scsi_cmnd *cmd = ent->cmd; in esp_restore_pointers()
431 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_restore_pointers()
432 ent->sense_ptr = ent->saved_sense_ptr; in esp_restore_pointers()
435 spriv->cur_residue = ent->saved_cur_residue; in esp_restore_pointers()
436 spriv->cur_sg = ent->saved_cur_sg; in esp_restore_pointers()
437 spriv->tot_residue = ent->saved_tot_residue; in esp_restore_pointers()
530 static int esp_alloc_lun_tag(struct esp_cmd_entry *ent, in esp_alloc_lun_tag() argument
533 if (!ent->tag[0]) { in esp_alloc_lun_tag()
557 lp->non_tagged_cmd = ent; in esp_alloc_lun_tag()
567 BUG_ON(lp->tagged_cmds[ent->tag[1]]); in esp_alloc_lun_tag()
569 lp->tagged_cmds[ent->tag[1]] = ent; in esp_alloc_lun_tag()
575 static void esp_free_lun_tag(struct esp_cmd_entry *ent, in esp_free_lun_tag() argument
578 if (ent->tag[0]) { in esp_free_lun_tag()
579 BUG_ON(lp->tagged_cmds[ent->tag[1]] != ent); in esp_free_lun_tag()
580 lp->tagged_cmds[ent->tag[1]] = NULL; in esp_free_lun_tag()
583 BUG_ON(lp->non_tagged_cmd != ent); in esp_free_lun_tag()
595 static void esp_autosense(struct esp *esp, struct esp_cmd_entry *ent) in esp_autosense() argument
597 struct scsi_cmnd *cmd = ent->cmd; in esp_autosense()
606 if (!ent->sense_ptr) { in esp_autosense()
611 ent->sense_ptr = cmd->sense_buffer; in esp_autosense()
612 ent->sense_dma = esp->ops->map_single(esp, in esp_autosense()
613 ent->sense_ptr, in esp_autosense()
617 ent->saved_sense_ptr = ent->sense_ptr; in esp_autosense()
619 esp->active_cmd = ent; in esp_autosense()
653 struct esp_cmd_entry *ent; in find_and_prep_issuable_command() local
655 list_for_each_entry(ent, &esp->queued_cmds, list) { in find_and_prep_issuable_command()
656 struct scsi_cmnd *cmd = ent->cmd; in find_and_prep_issuable_command()
660 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in find_and_prep_issuable_command()
661 ent->tag[0] = 0; in find_and_prep_issuable_command()
662 ent->tag[1] = 0; in find_and_prep_issuable_command()
663 return ent; in find_and_prep_issuable_command()
666 if (!scsi_populate_tag_msg(cmd, &ent->tag[0])) { in find_and_prep_issuable_command()
667 ent->tag[0] = 0; in find_and_prep_issuable_command()
668 ent->tag[1] = 0; in find_and_prep_issuable_command()
671 if (esp_alloc_lun_tag(ent, lp) < 0) in find_and_prep_issuable_command()
674 return ent; in find_and_prep_issuable_command()
686 struct esp_cmd_entry *ent; in esp_maybe_execute_command() local
695 ent = find_and_prep_issuable_command(esp); in esp_maybe_execute_command()
696 if (!ent) in esp_maybe_execute_command()
699 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_maybe_execute_command()
700 esp_autosense(esp, ent); in esp_maybe_execute_command()
704 cmd = ent->cmd; in esp_maybe_execute_command()
711 list_move(&ent->list, &esp->active_cmds); in esp_maybe_execute_command()
713 esp->active_cmd = ent; in esp_maybe_execute_command()
716 esp_save_pointers(esp, ent); in esp_maybe_execute_command()
769 if (lp && (tp->flags & ESP_TGT_DISCONNECT) && ent->tag[0]) in esp_maybe_execute_command()
774 if (ent->tag[0] && esp->rev == ESP100) { in esp_maybe_execute_command()
783 if (ent->tag[0]) { in esp_maybe_execute_command()
784 *p++ = ent->tag[0]; in esp_maybe_execute_command()
785 *p++ = ent->tag[1]; in esp_maybe_execute_command()
798 if (ent->tag[0]) { in esp_maybe_execute_command()
802 esp->msg_out[0] = ent->tag[0]; in esp_maybe_execute_command()
803 esp->msg_out[1] = ent->tag[1]; in esp_maybe_execute_command()
848 static void esp_put_ent(struct esp *esp, struct esp_cmd_entry *ent) in esp_put_ent() argument
850 list_add(&ent->list, &esp->esp_cmd_pool); in esp_put_ent()
853 static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent, in esp_cmd_is_done() argument
862 esp_free_lun_tag(ent, dev->hostdata); in esp_cmd_is_done()
865 if (ent->eh_done) { in esp_cmd_is_done()
866 complete(ent->eh_done); in esp_cmd_is_done()
867 ent->eh_done = NULL; in esp_cmd_is_done()
870 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_cmd_is_done()
871 esp->ops->unmap_single(esp, ent->sense_dma, in esp_cmd_is_done()
873 ent->sense_ptr = NULL; in esp_cmd_is_done()
884 ent->flags &= ~ESP_CMD_FLAG_AUTOSENSE; in esp_cmd_is_done()
898 list_del(&ent->list); in esp_cmd_is_done()
899 esp_put_ent(esp, ent); in esp_cmd_is_done()
910 static void esp_event_queue_full(struct esp *esp, struct esp_cmd_entry *ent) in esp_event_queue_full() argument
912 struct scsi_device *dev = ent->cmd->device; in esp_event_queue_full()
923 struct esp_cmd_entry *ent; in esp_queuecommand_lck() local
925 ent = esp_get_ent(esp); in esp_queuecommand_lck()
926 if (!ent) in esp_queuecommand_lck()
929 ent->cmd = cmd; in esp_queuecommand_lck()
936 list_add_tail(&ent->list, &esp->queued_cmds); in esp_queuecommand_lck()
1016 struct esp_cmd_entry *ent; in esp_reconnect_with_tag() local
1094 ent = lp->tagged_cmds[esp->command_block[1]]; in esp_reconnect_with_tag()
1095 if (!ent) { in esp_reconnect_with_tag()
1102 return ent; in esp_reconnect_with_tag()
1107 struct esp_cmd_entry *ent; in esp_reconnect() local
1171 ent = lp->non_tagged_cmd; in esp_reconnect()
1172 if (!ent) { in esp_reconnect()
1173 ent = esp_reconnect_with_tag(esp, lp); in esp_reconnect()
1174 if (!ent) in esp_reconnect()
1178 esp->active_cmd = ent; in esp_reconnect()
1180 if (ent->flags & ESP_CMD_FLAG_ABORT) { in esp_reconnect()
1187 esp_restore_pointers(esp, ent); in esp_reconnect()
1198 struct esp_cmd_entry *ent; in esp_finish_select() local
1208 ent = esp->active_cmd; in esp_finish_select()
1209 cmd = ent->cmd; in esp_finish_select()
1216 esp_cmd_is_done(esp, ent, cmd, (DID_ERROR << 16)); in esp_finish_select()
1229 if (!(ent->flags & ESP_CMD_FLAG_AUTOSENSE)) { in esp_finish_select()
1231 esp_free_lun_tag(ent, cmd->device->hostdata); in esp_finish_select()
1237 esp->ops->unmap_single(esp, ent->sense_dma, in esp_finish_select()
1240 ent->sense_ptr = NULL; in esp_finish_select()
1246 list_move(&ent->list, &esp->queued_cmds); in esp_finish_select()
1265 esp_cmd_is_done(esp, ent, cmd, (DID_BAD_TARGET << 16)); in esp_finish_select()
1298 static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent, in esp_data_bytes_sent() argument
1318 if (!(ent->flags & ESP_CMD_FLAG_WRITE)) in esp_data_bytes_sent()
1350 if (!(ent->flags & ESP_CMD_FLAG_WRITE)) in esp_data_bytes_sent()
1401 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_reject() local
1402 struct scsi_cmnd *cmd = ent->cmd; in esp_msgin_reject()
1542 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_extended() local
1543 struct scsi_cmnd *cmd = ent->cmd; in esp_msgin_extended()
1589 struct esp_cmd_entry *ent; in esp_msgin_process() local
1597 ent = esp->active_cmd; in esp_msgin_process()
1598 spriv = ESP_CMD_PRIV(ent->cmd); in esp_msgin_process()
1619 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_process() local
1621 ent->message = msg0; in esp_msgin_process()
1687 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event() local
1688 struct scsi_cmnd *cmd = ent->cmd; in esp_process_event()
1689 dma_addr_t dma_addr = esp_cur_dma_addr(ent, cmd); in esp_process_event()
1690 unsigned int dma_len = esp_cur_dma_len(ent, cmd); in esp_process_event()
1696 ent->flags |= ESP_CMD_FLAG_WRITE; in esp_process_event()
1698 ent->flags &= ~ESP_CMD_FLAG_WRITE; in esp_process_event()
1713 (unsigned long long)esp_cur_dma_addr(ent, cmd), in esp_process_event()
1714 esp_cur_dma_len(ent, cmd)); in esp_process_event()
1729 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event() local
1730 struct scsi_cmnd *cmd = ent->cmd; in esp_process_event()
1739 if (ent->flags & ESP_CMD_FLAG_WRITE) { in esp_process_event()
1755 bytes_sent = esp_data_bytes_sent(esp, ent, cmd); in esp_process_event()
1758 ent->flags, bytes_sent); in esp_process_event()
1766 esp_advance_dma(esp, ent, cmd, bytes_sent); in esp_process_event()
1772 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event() local
1775 ent->status = esp_read8(ESP_FDATA); in esp_process_event()
1776 ent->message = esp_read8(ESP_FDATA); in esp_process_event()
1779 ent->status = esp_read8(ESP_FDATA); in esp_process_event()
1780 ent->message = 0xff; in esp_process_event()
1785 if (ent->message != COMMAND_COMPLETE) { in esp_process_event()
1787 ent->message); in esp_process_event()
1797 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event() local
1798 struct scsi_cmnd *cmd = ent->cmd; in esp_process_event()
1800 if (ent->message == COMMAND_COMPLETE || in esp_process_event()
1801 ent->message == DISCONNECT) in esp_process_event()
1804 if (ent->message == COMMAND_COMPLETE) { in esp_process_event()
1807 ent->status, ent->message); in esp_process_event()
1808 if (ent->status == SAM_STAT_TASK_SET_FULL) in esp_process_event()
1809 esp_event_queue_full(esp, ent); in esp_process_event()
1811 if (ent->status == SAM_STAT_CHECK_CONDITION && in esp_process_event()
1812 !(ent->flags & ESP_CMD_FLAG_AUTOSENSE)) { in esp_process_event()
1813 ent->flags |= ESP_CMD_FLAG_AUTOSENSE; in esp_process_event()
1814 esp_autosense(esp, ent); in esp_process_event()
1816 esp_cmd_is_done(esp, ent, cmd, in esp_process_event()
1817 compose_result(ent->status, in esp_process_event()
1818 ent->message, in esp_process_event()
1821 } else if (ent->message == DISCONNECT) { in esp_process_event()
1825 ent->tag[0], ent->tag[1]); in esp_process_event()
1831 ent->message); in esp_process_event()
1971 static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent) in esp_reset_cleanup_one() argument
1973 struct scsi_cmnd *cmd = ent->cmd; in esp_reset_cleanup_one()
1976 esp_free_lun_tag(ent, cmd->device->hostdata); in esp_reset_cleanup_one()
1979 if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) { in esp_reset_cleanup_one()
1980 esp->ops->unmap_single(esp, ent->sense_dma, in esp_reset_cleanup_one()
1982 ent->sense_ptr = NULL; in esp_reset_cleanup_one()
1986 list_del(&ent->list); in esp_reset_cleanup_one()
1987 esp_put_ent(esp, ent); in esp_reset_cleanup_one()
2000 struct esp_cmd_entry *ent, *tmp; in esp_reset_cleanup() local
2003 list_for_each_entry_safe(ent, tmp, &esp->queued_cmds, list) { in esp_reset_cleanup()
2004 struct scsi_cmnd *cmd = ent->cmd; in esp_reset_cleanup()
2006 list_del(&ent->list); in esp_reset_cleanup()
2009 esp_put_ent(esp, ent); in esp_reset_cleanup()
2012 list_for_each_entry_safe(ent, tmp, &esp->active_cmds, list) { in esp_reset_cleanup()
2013 if (ent == esp->active_cmd) in esp_reset_cleanup()
2015 esp_reset_cleanup_one(esp, ent); in esp_reset_cleanup()
2444 struct esp_cmd_entry *ent, *tmp; in esp_eh_abort_handler() local
2454 ent = esp->active_cmd; in esp_eh_abort_handler()
2455 if (ent) in esp_eh_abort_handler()
2457 esp->host->unique_id, ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2458 list_for_each_entry(ent, &esp->queued_cmds, list) { in esp_eh_abort_handler()
2460 esp->host->unique_id, ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2462 list_for_each_entry(ent, &esp->active_cmds, list) { in esp_eh_abort_handler()
2464 esp->host->unique_id, ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2471 ent = NULL; in esp_eh_abort_handler()
2474 ent = tmp; in esp_eh_abort_handler()
2479 if (ent) { in esp_eh_abort_handler()
2483 list_del(&ent->list); in esp_eh_abort_handler()
2488 esp_put_ent(esp, ent); in esp_eh_abort_handler()
2495 ent = esp->active_cmd; in esp_eh_abort_handler()
2496 if (ent && ent->cmd == cmd) { in esp_eh_abort_handler()
2509 ent->eh_done = &eh_done; in esp_eh_abort_handler()
2536 ent->eh_done = NULL; in esp_eh_abort_handler()