• Home
  • Raw
  • Download

Lines Matching refs:esp

103 #define esp_read8(REG)		esp->ops->esp_read8(esp, REG)
104 #define esp_write8(VAL,REG) esp->ops->esp_write8(esp, VAL, REG)
106 static void esp_log_fill_regs(struct esp *esp, in esp_log_fill_regs() argument
109 p->sreg = esp->sreg; in esp_log_fill_regs()
110 p->seqreg = esp->seqreg; in esp_log_fill_regs()
111 p->sreg2 = esp->sreg2; in esp_log_fill_regs()
112 p->ireg = esp->ireg; in esp_log_fill_regs()
113 p->select_state = esp->select_state; in esp_log_fill_regs()
114 p->event = esp->event; in esp_log_fill_regs()
117 void scsi_esp_cmd(struct esp *esp, u8 val) in scsi_esp_cmd() argument
120 int idx = esp->esp_event_cur; in scsi_esp_cmd()
122 p = &esp->esp_event_log[idx]; in scsi_esp_cmd()
125 esp_log_fill_regs(esp, p); in scsi_esp_cmd()
127 esp->esp_event_cur = (idx + 1) & (ESP_EVENT_LOG_SZ - 1); in scsi_esp_cmd()
133 static void esp_event(struct esp *esp, u8 val) in esp_event() argument
136 int idx = esp->esp_event_cur; in esp_event()
138 p = &esp->esp_event_log[idx]; in esp_event()
141 esp_log_fill_regs(esp, p); in esp_event()
143 esp->esp_event_cur = (idx + 1) & (ESP_EVENT_LOG_SZ - 1); in esp_event()
145 esp->event = val; in esp_event()
148 static void esp_dump_cmd_log(struct esp *esp) in esp_dump_cmd_log() argument
150 int idx = esp->esp_event_cur; in esp_dump_cmd_log()
154 esp->host->unique_id); in esp_dump_cmd_log()
156 struct esp_event_ent *p = &esp->esp_event_log[idx]; in esp_dump_cmd_log()
159 esp->host->unique_id, idx, in esp_dump_cmd_log()
171 static void esp_flush_fifo(struct esp *esp) in esp_flush_fifo() argument
173 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_flush_fifo()
174 if (esp->rev == ESP236) { in esp_flush_fifo()
181 esp->host->unique_id); in esp_flush_fifo()
189 static void hme_read_fifo(struct esp *esp) in hme_read_fifo() argument
195 esp->fifo[idx++] = esp_read8(ESP_FDATA); in hme_read_fifo()
196 esp->fifo[idx++] = esp_read8(ESP_FDATA); in hme_read_fifo()
198 if (esp->sreg2 & ESP_STAT2_F1BYTE) { in hme_read_fifo()
200 esp->fifo[idx++] = esp_read8(ESP_FDATA); in hme_read_fifo()
201 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in hme_read_fifo()
203 esp->fifo_cnt = idx; in hme_read_fifo()
206 static void esp_set_all_config3(struct esp *esp, u8 val) in esp_set_all_config3() argument
211 esp->target[i].esp_config3 = val; in esp_set_all_config3()
215 static void esp_reset_esp(struct esp *esp) in esp_reset_esp() argument
220 scsi_esp_cmd(esp, ESP_CMD_RC); in esp_reset_esp()
221 scsi_esp_cmd(esp, ESP_CMD_NULL | ESP_CMD_DMA); in esp_reset_esp()
222 if (esp->rev == FAST) in esp_reset_esp()
224 scsi_esp_cmd(esp, ESP_CMD_NULL | ESP_CMD_DMA); in esp_reset_esp()
229 esp->max_period = ((35 * esp->ccycle) / 1000); in esp_reset_esp()
230 if (esp->rev == FAST) { in esp_reset_esp()
234 esp->rev = FAS236; in esp_reset_esp()
236 esp->rev = FASHME; /* Version is usually '5'. */ in esp_reset_esp()
238 esp->rev = FAS100A; in esp_reset_esp()
239 esp->min_period = ((4 * esp->ccycle) / 1000); in esp_reset_esp()
241 esp->min_period = ((5 * esp->ccycle) / 1000); in esp_reset_esp()
243 esp->max_period = (esp->max_period + 3)>>2; in esp_reset_esp()
244 esp->min_period = (esp->min_period + 3)>>2; in esp_reset_esp()
246 esp_write8(esp->config1, ESP_CFG1); in esp_reset_esp()
247 switch (esp->rev) { in esp_reset_esp()
253 esp_write8(esp->config2, ESP_CFG2); in esp_reset_esp()
258 esp_write8(esp->config2, ESP_CFG2); in esp_reset_esp()
259 esp->prev_cfg3 = esp->target[0].esp_config3; in esp_reset_esp()
260 esp_write8(esp->prev_cfg3, ESP_CFG3); in esp_reset_esp()
264 esp->config2 |= (ESP_CONFIG2_HME32 | ESP_CONFIG2_HMEFENAB); in esp_reset_esp()
269 esp_write8(esp->config2, ESP_CFG2); in esp_reset_esp()
270 if (esp->rev == FASHME) { in esp_reset_esp()
271 u8 cfg3 = esp->target[0].esp_config3; in esp_reset_esp()
274 if (esp->scsi_id >= 8) in esp_reset_esp()
276 esp_set_all_config3(esp, cfg3); in esp_reset_esp()
278 u32 cfg3 = esp->target[0].esp_config3; in esp_reset_esp()
281 esp_set_all_config3(esp, cfg3); in esp_reset_esp()
283 esp->prev_cfg3 = esp->target[0].esp_config3; in esp_reset_esp()
284 esp_write8(esp->prev_cfg3, ESP_CFG3); in esp_reset_esp()
285 if (esp->rev == FASHME) { in esp_reset_esp()
286 esp->radelay = 80; in esp_reset_esp()
288 if (esp->flags & ESP_FLAG_DIFFERENTIAL) in esp_reset_esp()
289 esp->radelay = 0; in esp_reset_esp()
291 esp->radelay = 96; in esp_reset_esp()
297 esp_write8(esp->config2, ESP_CFG2); in esp_reset_esp()
298 esp_set_all_config3(esp, in esp_reset_esp()
299 (esp->target[0].esp_config3 | in esp_reset_esp()
301 esp->prev_cfg3 = esp->target[0].esp_config3; in esp_reset_esp()
302 esp_write8(esp->prev_cfg3, ESP_CFG3); in esp_reset_esp()
303 esp->radelay = 32; in esp_reset_esp()
311 esp_write8(esp->cfact, ESP_CFACT); in esp_reset_esp()
313 esp->prev_stp = 0; in esp_reset_esp()
314 esp_write8(esp->prev_stp, ESP_STP); in esp_reset_esp()
316 esp->prev_soff = 0; in esp_reset_esp()
317 esp_write8(esp->prev_soff, ESP_SOFF); in esp_reset_esp()
319 esp_write8(esp->neg_defp, ESP_TIMEO); in esp_reset_esp()
326 static void esp_map_dma(struct esp *esp, struct scsi_cmnd *cmd) in esp_map_dma() argument
336 spriv->u.num_sg = esp->ops->map_sg(esp, sg, scsi_sg_count(cmd), dir); in esp_map_dma()
373 static void esp_advance_dma(struct esp *esp, struct esp_cmd_entry *ent, in esp_advance_dma() argument
387 esp->host->unique_id); in esp_advance_dma()
390 esp->host->unique_id, in esp_advance_dma()
401 static void esp_unmap_dma(struct esp *esp, struct scsi_cmnd *cmd) in esp_unmap_dma() argument
409 esp->ops->unmap_sg(esp, scsi_sglist(cmd), spriv->u.num_sg, dir); in esp_unmap_dma()
412 static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent) in esp_save_pointers() argument
426 static void esp_restore_pointers(struct esp *esp, struct esp_cmd_entry *ent) in esp_restore_pointers() argument
440 static void esp_check_command_len(struct esp *esp, struct scsi_cmnd *cmd) in esp_check_command_len() argument
445 esp->flags &= ~ESP_FLAG_DOING_SLOWCMD; in esp_check_command_len()
447 esp->flags |= ESP_FLAG_DOING_SLOWCMD; in esp_check_command_len()
451 static void esp_write_tgt_config3(struct esp *esp, int tgt) in esp_write_tgt_config3() argument
453 if (esp->rev > ESP100A) { in esp_write_tgt_config3()
454 u8 val = esp->target[tgt].esp_config3; in esp_write_tgt_config3()
456 if (val != esp->prev_cfg3) { in esp_write_tgt_config3()
457 esp->prev_cfg3 = val; in esp_write_tgt_config3()
463 static void esp_write_tgt_sync(struct esp *esp, int tgt) in esp_write_tgt_sync() argument
465 u8 off = esp->target[tgt].esp_offset; in esp_write_tgt_sync()
466 u8 per = esp->target[tgt].esp_period; in esp_write_tgt_sync()
468 if (off != esp->prev_soff) { in esp_write_tgt_sync()
469 esp->prev_soff = off; in esp_write_tgt_sync()
472 if (per != esp->prev_stp) { in esp_write_tgt_sync()
473 esp->prev_stp = per; in esp_write_tgt_sync()
478 static u32 esp_dma_length_limit(struct esp *esp, u32 dma_addr, u32 dma_len) in esp_dma_length_limit() argument
480 if (esp->rev == FASHME) { in esp_dma_length_limit()
595 static void esp_autosense(struct esp *esp, struct esp_cmd_entry *ent) in esp_autosense() argument
609 esp->host->unique_id, tgt, lun); in esp_autosense()
612 ent->sense_dma = esp->ops->map_single(esp, in esp_autosense()
619 esp->active_cmd = ent; in esp_autosense()
621 p = esp->command_block; in esp_autosense()
622 esp->msg_out_len = 0; in esp_autosense()
633 esp->select_state = ESP_SELECT_BASIC; in esp_autosense()
636 if (esp->rev == FASHME) in esp_autosense()
640 esp_write_tgt_sync(esp, tgt); in esp_autosense()
641 esp_write_tgt_config3(esp, tgt); in esp_autosense()
643 val = (p - esp->command_block); in esp_autosense()
645 if (esp->rev == FASHME) in esp_autosense()
646 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_autosense()
647 esp->ops->send_dma_cmd(esp, esp->command_block_dma, in esp_autosense()
651 static struct esp_cmd_entry *find_and_prep_issuable_command(struct esp *esp) in find_and_prep_issuable_command() argument
655 list_for_each_entry(ent, &esp->queued_cmds, list) { in find_and_prep_issuable_command()
682 static void esp_maybe_execute_command(struct esp *esp) in esp_maybe_execute_command() argument
693 if (esp->active_cmd || in esp_maybe_execute_command()
694 (esp->flags & ESP_FLAG_RESETTING)) in esp_maybe_execute_command()
697 ent = find_and_prep_issuable_command(esp); in esp_maybe_execute_command()
702 esp_autosense(esp, ent); in esp_maybe_execute_command()
710 tp = &esp->target[tgt]; in esp_maybe_execute_command()
713 list_move(&ent->list, &esp->active_cmds); in esp_maybe_execute_command()
715 esp->active_cmd = ent; in esp_maybe_execute_command()
717 esp_map_dma(esp, cmd); in esp_maybe_execute_command()
718 esp_save_pointers(esp, ent); in esp_maybe_execute_command()
720 esp_check_command_len(esp, cmd); in esp_maybe_execute_command()
722 p = esp->command_block; in esp_maybe_execute_command()
724 esp->msg_out_len = 0; in esp_maybe_execute_command()
745 if (esp->rev == FASHME && esp_need_to_nego_wide(tp)) { in esp_maybe_execute_command()
746 esp->msg_out_len = in esp_maybe_execute_command()
747 spi_populate_width_msg(&esp->msg_out[0], in esp_maybe_execute_command()
752 esp->msg_out_len = in esp_maybe_execute_command()
753 spi_populate_sync_msg(&esp->msg_out[0], in esp_maybe_execute_command()
763 esp->flags |= ESP_FLAG_DOING_SLOWCMD; in esp_maybe_execute_command()
776 if (ent->tag[0] && esp->rev == ESP100) { in esp_maybe_execute_command()
780 esp->flags |= ESP_FLAG_DOING_SLOWCMD; in esp_maybe_execute_command()
783 if (!(esp->flags & ESP_FLAG_DOING_SLOWCMD)) { in esp_maybe_execute_command()
795 esp->select_state = ESP_SELECT_BASIC; in esp_maybe_execute_command()
797 esp->cmd_bytes_left = cmd->cmd_len; in esp_maybe_execute_command()
798 esp->cmd_bytes_ptr = &cmd->cmnd[0]; in esp_maybe_execute_command()
801 for (i = esp->msg_out_len - 1; in esp_maybe_execute_command()
803 esp->msg_out[i + 2] = esp->msg_out[i]; in esp_maybe_execute_command()
804 esp->msg_out[0] = ent->tag[0]; in esp_maybe_execute_command()
805 esp->msg_out[1] = ent->tag[1]; in esp_maybe_execute_command()
806 esp->msg_out_len += 2; in esp_maybe_execute_command()
810 esp->select_state = ESP_SELECT_MSGOUT; in esp_maybe_execute_command()
813 if (esp->rev == FASHME) in esp_maybe_execute_command()
817 esp_write_tgt_sync(esp, tgt); in esp_maybe_execute_command()
818 esp_write_tgt_config3(esp, tgt); in esp_maybe_execute_command()
820 val = (p - esp->command_block); in esp_maybe_execute_command()
829 if (esp->rev == FASHME) in esp_maybe_execute_command()
830 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_maybe_execute_command()
831 esp->ops->send_dma_cmd(esp, esp->command_block_dma, in esp_maybe_execute_command()
835 static struct esp_cmd_entry *esp_get_ent(struct esp *esp) in esp_get_ent() argument
837 struct list_head *head = &esp->esp_cmd_pool; in esp_get_ent()
850 static void esp_put_ent(struct esp *esp, struct esp_cmd_entry *ent) in esp_put_ent() argument
852 list_add(&ent->list, &esp->esp_cmd_pool); in esp_put_ent()
855 static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent, in esp_cmd_is_done() argument
862 esp->active_cmd = NULL; in esp_cmd_is_done()
863 esp_unmap_dma(esp, cmd); in esp_cmd_is_done()
873 esp->ops->unmap_single(esp, ent->sense_dma, in esp_cmd_is_done()
891 esp->host->unique_id, tgt, lun); in esp_cmd_is_done()
901 esp_put_ent(esp, ent); in esp_cmd_is_done()
903 esp_maybe_execute_command(esp); in esp_cmd_is_done()
912 static void esp_event_queue_full(struct esp *esp, struct esp_cmd_entry *ent) in esp_event_queue_full() argument
923 struct esp *esp = shost_priv(dev->host); in esp_queuecommand_lck() local
927 ent = esp_get_ent(esp); in esp_queuecommand_lck()
938 list_add_tail(&ent->list, &esp->queued_cmds); in esp_queuecommand_lck()
940 esp_maybe_execute_command(esp); in esp_queuecommand_lck()
947 static int esp_check_gross_error(struct esp *esp) in DEF_SCSI_QCMD()
949 if (esp->sreg & ESP_STAT_SPAM) { in DEF_SCSI_QCMD()
957 esp->host->unique_id, esp->sreg); in DEF_SCSI_QCMD()
964 static int esp_check_spur_intr(struct esp *esp) in esp_check_spur_intr() argument
966 switch (esp->rev) { in esp_check_spur_intr()
972 esp->sreg &= ~ESP_STAT_INTR; in esp_check_spur_intr()
976 if (!(esp->sreg & ESP_STAT_INTR)) { in esp_check_spur_intr()
977 esp->ireg = esp_read8(ESP_INTRPT); in esp_check_spur_intr()
978 if (esp->ireg & ESP_INTR_SR) in esp_check_spur_intr()
984 if (!esp->ops->dma_error(esp)) { in esp_check_spur_intr()
987 esp->host->unique_id, esp->sreg); in esp_check_spur_intr()
992 esp->host->unique_id); in esp_check_spur_intr()
1003 static void esp_schedule_reset(struct esp *esp) in esp_schedule_reset() argument
1007 esp->flags |= ESP_FLAG_RESETTING; in esp_schedule_reset()
1008 esp_event(esp, ESP_EVENT_RESET); in esp_schedule_reset()
1015 static struct esp_cmd_entry *esp_reconnect_with_tag(struct esp *esp, in esp_reconnect_with_tag() argument
1023 esp->host->unique_id); in esp_reconnect_with_tag()
1030 if (esp->ops->irq_pending(esp)) in esp_reconnect_with_tag()
1035 esp->host->unique_id); in esp_reconnect_with_tag()
1039 esp->sreg = esp_read8(ESP_STATUS); in esp_reconnect_with_tag()
1040 esp->ireg = esp_read8(ESP_INTRPT); in esp_reconnect_with_tag()
1043 i, esp->ireg, esp->sreg); in esp_reconnect_with_tag()
1045 if (esp->ireg & ESP_INTR_DC) { in esp_reconnect_with_tag()
1047 esp->host->unique_id); in esp_reconnect_with_tag()
1051 if ((esp->sreg & ESP_STAT_PMASK) != ESP_MIP) { in esp_reconnect_with_tag()
1053 esp->host->unique_id, esp->sreg); in esp_reconnect_with_tag()
1058 esp->command_block[0] = 0xff; in esp_reconnect_with_tag()
1059 esp->command_block[1] = 0xff; in esp_reconnect_with_tag()
1060 esp->ops->send_dma_cmd(esp, esp->command_block_dma, in esp_reconnect_with_tag()
1064 scsi_esp_cmd(esp, ESP_CMD_MOK); in esp_reconnect_with_tag()
1067 if (esp->ops->irq_pending(esp)) { in esp_reconnect_with_tag()
1068 esp->sreg = esp_read8(ESP_STATUS); in esp_reconnect_with_tag()
1069 esp->ireg = esp_read8(ESP_INTRPT); in esp_reconnect_with_tag()
1070 if (esp->ireg & ESP_INTR_FDONE) in esp_reconnect_with_tag()
1077 esp->host->unique_id); in esp_reconnect_with_tag()
1080 esp->ops->dma_drain(esp); in esp_reconnect_with_tag()
1081 esp->ops->dma_invalidate(esp); in esp_reconnect_with_tag()
1084 i, esp->ireg, esp->sreg, in esp_reconnect_with_tag()
1085 esp->command_block[0], in esp_reconnect_with_tag()
1086 esp->command_block[1]); in esp_reconnect_with_tag()
1088 if (esp->command_block[0] < SIMPLE_QUEUE_TAG || in esp_reconnect_with_tag()
1089 esp->command_block[0] > ORDERED_QUEUE_TAG) { in esp_reconnect_with_tag()
1092 esp->host->unique_id, esp->command_block[0]); in esp_reconnect_with_tag()
1096 ent = lp->tagged_cmds[esp->command_block[1]]; in esp_reconnect_with_tag()
1100 esp->host->unique_id, esp->command_block[1]); in esp_reconnect_with_tag()
1107 static int esp_reconnect(struct esp *esp) in esp_reconnect() argument
1115 BUG_ON(esp->active_cmd); in esp_reconnect()
1116 if (esp->rev == FASHME) { in esp_reconnect()
1120 target = esp->fifo[0]; in esp_reconnect()
1121 lun = esp->fifo[1] & 0x7; in esp_reconnect()
1131 if (!(bits & esp->scsi_id_mask)) in esp_reconnect()
1133 bits &= ~esp->scsi_id_mask; in esp_reconnect()
1140 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_reconnect()
1141 if (esp->rev == ESP100) { in esp_reconnect()
1151 scsi_esp_cmd(esp, ESP_CMD_NULL); in esp_reconnect()
1154 esp_write_tgt_sync(esp, target); in esp_reconnect()
1155 esp_write_tgt_config3(esp, target); in esp_reconnect()
1157 scsi_esp_cmd(esp, ESP_CMD_MOK); in esp_reconnect()
1159 if (esp->rev == FASHME) in esp_reconnect()
1163 tp = &esp->target[target]; in esp_reconnect()
1168 esp->host->unique_id, target, lun); in esp_reconnect()
1175 ent = esp_reconnect_with_tag(esp, lp); in esp_reconnect()
1180 esp->active_cmd = ent; in esp_reconnect()
1183 esp->msg_out[0] = ABORT_TASK_SET; in esp_reconnect()
1184 esp->msg_out_len = 1; in esp_reconnect()
1185 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_reconnect()
1188 esp_event(esp, ESP_EVENT_CHECK_PHASE); in esp_reconnect()
1189 esp_restore_pointers(esp, ent); in esp_reconnect()
1190 esp->flags |= ESP_FLAG_QUICKIRQ_CHECK; in esp_reconnect()
1194 esp_schedule_reset(esp); in esp_reconnect()
1198 static int esp_finish_select(struct esp *esp) in esp_finish_select() argument
1204 orig_select_state = esp->select_state; in esp_finish_select()
1207 esp->select_state = ESP_SELECT_NONE; in esp_finish_select()
1209 esp->seqreg = esp_read8(ESP_SSTEP) & ESP_STEP_VBITS; in esp_finish_select()
1210 ent = esp->active_cmd; in esp_finish_select()
1213 if (esp->ops->dma_error(esp)) { in esp_finish_select()
1217 esp_schedule_reset(esp); in esp_finish_select()
1218 esp_cmd_is_done(esp, ent, cmd, (DID_ERROR << 16)); in esp_finish_select()
1222 esp->ops->dma_invalidate(esp); in esp_finish_select()
1224 if (esp->ireg == (ESP_INTR_RSEL | ESP_INTR_FDONE)) { in esp_finish_select()
1225 struct esp_target_data *tp = &esp->target[cmd->device->id]; in esp_finish_select()
1232 esp_unmap_dma(esp, cmd); in esp_finish_select()
1235 esp->flags &= ~ESP_FLAG_DOING_SLOWCMD; in esp_finish_select()
1236 esp->cmd_bytes_ptr = NULL; in esp_finish_select()
1237 esp->cmd_bytes_left = 0; in esp_finish_select()
1239 esp->ops->unmap_single(esp, ent->sense_dma, in esp_finish_select()
1248 list_move(&ent->list, &esp->queued_cmds); in esp_finish_select()
1249 esp->active_cmd = NULL; in esp_finish_select()
1257 if (esp->ireg == ESP_INTR_DC) { in esp_finish_select()
1264 esp->target[dev->id].flags |= ESP_TGT_CHECK_NEGO; in esp_finish_select()
1266 scsi_esp_cmd(esp, ESP_CMD_ESEL); in esp_finish_select()
1267 esp_cmd_is_done(esp, ent, cmd, (DID_BAD_TARGET << 16)); in esp_finish_select()
1271 if (esp->ireg == (ESP_INTR_FDONE | ESP_INTR_BSERV)) { in esp_finish_select()
1275 if (esp->rev <= ESP236) { in esp_finish_select()
1278 scsi_esp_cmd(esp, ESP_CMD_NULL); in esp_finish_select()
1281 (!esp->prev_soff || in esp_finish_select()
1282 ((esp->sreg & ESP_STAT_PMASK) != ESP_DIP))) in esp_finish_select()
1283 esp_flush_fifo(esp); in esp_finish_select()
1290 esp_event(esp, ESP_EVENT_CHECK_PHASE); in esp_finish_select()
1295 esp->ireg); in esp_finish_select()
1296 esp_schedule_reset(esp); in esp_finish_select()
1300 static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent, in esp_data_bytes_sent() argument
1306 if (esp->prev_cfg3 & ESP_CONFIG3_EWIDE) in esp_data_bytes_sent()
1310 if (!(esp->sreg & ESP_STAT_TCNT)) { in esp_data_bytes_sent()
1313 if (esp->rev == FASHME) in esp_data_bytes_sent()
1317 bytes_sent = esp->data_dma_len; in esp_data_bytes_sent()
1324 if (!esp->prev_soff) { in esp_data_bytes_sent()
1328 if (esp->rev == ESP100) { in esp_data_bytes_sent()
1342 esp->sreg = esp_read8(ESP_STATUS); in esp_data_bytes_sent()
1343 phase = esp->sreg & ESP_STAT_PMASK; in esp_data_bytes_sent()
1357 esp_flush_fifo(esp); in esp_data_bytes_sent()
1362 static void esp_setsync(struct esp *esp, struct esp_target_data *tp, in esp_setsync() argument
1372 esp_soff |= esp->radelay; in esp_setsync()
1373 if (esp->rev >= FAS236) { in esp_setsync()
1375 if (esp->rev >= FAS100A) in esp_setsync()
1379 if (esp->rev == FASHME) in esp_setsync()
1380 esp_soff &= ~esp->radelay; in esp_setsync()
1385 esp->prev_cfg3 = tp->esp_config3; in esp_setsync()
1386 esp_write8(esp->prev_cfg3, ESP_CFG3); in esp_setsync()
1390 tp->esp_period = esp->prev_stp = esp_stp; in esp_setsync()
1391 tp->esp_offset = esp->prev_soff = esp_soff; in esp_setsync()
1401 static void esp_msgin_reject(struct esp *esp) in esp_msgin_reject() argument
1403 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_reject()
1409 tp = &esp->target[tgt]; in esp_msgin_reject()
1416 scsi_esp_cmd(esp, ESP_CMD_RATN); in esp_msgin_reject()
1418 esp->msg_out_len = in esp_msgin_reject()
1419 spi_populate_sync_msg(&esp->msg_out[0], in esp_msgin_reject()
1423 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_msgin_reject()
1432 esp_setsync(esp, tp, 0, 0, 0, 0); in esp_msgin_reject()
1433 scsi_esp_cmd(esp, ESP_CMD_RATN); in esp_msgin_reject()
1437 esp->msg_out[0] = ABORT_TASK_SET; in esp_msgin_reject()
1438 esp->msg_out_len = 1; in esp_msgin_reject()
1439 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_msgin_reject()
1442 static void esp_msgin_sdtr(struct esp *esp, struct esp_target_data *tp) in esp_msgin_sdtr() argument
1444 u8 period = esp->msg_in[3]; in esp_msgin_sdtr()
1445 u8 offset = esp->msg_in[4]; in esp_msgin_sdtr()
1457 if (period > esp->max_period) { in esp_msgin_sdtr()
1461 if (period < esp->min_period) in esp_msgin_sdtr()
1464 one_clock = esp->ccycle / 1000; in esp_msgin_sdtr()
1466 if (stp && esp->rev >= FAS236) { in esp_msgin_sdtr()
1474 esp_setsync(esp, tp, period, offset, stp, offset); in esp_msgin_sdtr()
1478 esp->msg_out[0] = MESSAGE_REJECT; in esp_msgin_sdtr()
1479 esp->msg_out_len = 1; in esp_msgin_sdtr()
1480 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_msgin_sdtr()
1486 esp->msg_out_len = in esp_msgin_sdtr()
1487 spi_populate_sync_msg(&esp->msg_out[0], in esp_msgin_sdtr()
1490 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_msgin_sdtr()
1493 static void esp_msgin_wdtr(struct esp *esp, struct esp_target_data *tp) in esp_msgin_wdtr() argument
1495 int size = 8 << esp->msg_in[3]; in esp_msgin_wdtr()
1498 if (esp->rev != FASHME) in esp_msgin_wdtr()
1516 esp->prev_cfg3 = cfg3; in esp_msgin_wdtr()
1525 scsi_esp_cmd(esp, ESP_CMD_RATN); in esp_msgin_wdtr()
1527 esp->msg_out_len = in esp_msgin_wdtr()
1528 spi_populate_sync_msg(&esp->msg_out[0], in esp_msgin_wdtr()
1532 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_msgin_wdtr()
1537 esp->msg_out[0] = MESSAGE_REJECT; in esp_msgin_wdtr()
1538 esp->msg_out_len = 1; in esp_msgin_wdtr()
1539 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_msgin_wdtr()
1542 static void esp_msgin_extended(struct esp *esp) in esp_msgin_extended() argument
1544 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_extended()
1549 tp = &esp->target[tgt]; in esp_msgin_extended()
1550 if (esp->msg_in[2] == EXTENDED_SDTR) { in esp_msgin_extended()
1551 esp_msgin_sdtr(esp, tp); in esp_msgin_extended()
1554 if (esp->msg_in[2] == EXTENDED_WDTR) { in esp_msgin_extended()
1555 esp_msgin_wdtr(esp, tp); in esp_msgin_extended()
1560 esp->msg_in[2]); in esp_msgin_extended()
1562 esp->msg_out[0] = ABORT_TASK_SET; in esp_msgin_extended()
1563 esp->msg_out_len = 1; in esp_msgin_extended()
1564 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_msgin_extended()
1570 static int esp_msgin_process(struct esp *esp) in esp_msgin_process() argument
1572 u8 msg0 = esp->msg_in[0]; in esp_msgin_process()
1573 int len = esp->msg_in_len; in esp_msgin_process()
1585 if (len < esp->msg_in[1] + 2) in esp_msgin_process()
1587 esp_msgin_extended(esp); in esp_msgin_process()
1596 if (esp->msg_in[1] != 1) in esp_msgin_process()
1599 ent = esp->active_cmd; in esp_msgin_process()
1613 esp_restore_pointers(esp, esp->active_cmd); in esp_msgin_process()
1616 esp_save_pointers(esp, esp->active_cmd); in esp_msgin_process()
1621 struct esp_cmd_entry *ent = esp->active_cmd; in esp_msgin_process()
1624 esp_event(esp, ESP_EVENT_FREE_BUS); in esp_msgin_process()
1625 esp->flags |= ESP_FLAG_QUICKIRQ_CHECK; in esp_msgin_process()
1629 esp_msgin_reject(esp); in esp_msgin_process()
1634 esp->msg_out[0] = MESSAGE_REJECT; in esp_msgin_process()
1635 esp->msg_out_len = 1; in esp_msgin_process()
1636 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_msgin_process()
1641 static int esp_process_event(struct esp *esp) in esp_process_event() argument
1647 switch (esp->event) { in esp_process_event()
1649 switch (esp->sreg & ESP_STAT_PMASK) { in esp_process_event()
1651 esp_event(esp, ESP_EVENT_DATA_OUT); in esp_process_event()
1654 esp_event(esp, ESP_EVENT_DATA_IN); in esp_process_event()
1657 esp_flush_fifo(esp); in esp_process_event()
1658 scsi_esp_cmd(esp, ESP_CMD_ICCSEQ); in esp_process_event()
1659 esp_event(esp, ESP_EVENT_STATUS); in esp_process_event()
1660 esp->flags |= ESP_FLAG_QUICKIRQ_CHECK; in esp_process_event()
1664 esp_event(esp, ESP_EVENT_MSGOUT); in esp_process_event()
1668 esp_event(esp, ESP_EVENT_MSGIN); in esp_process_event()
1672 esp_event(esp, ESP_EVENT_CMD_START); in esp_process_event()
1677 esp->sreg); in esp_process_event()
1678 esp_schedule_reset(esp); in esp_process_event()
1689 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event()
1694 if (esp->rev == ESP100) in esp_process_event()
1695 scsi_esp_cmd(esp, ESP_CMD_NULL); in esp_process_event()
1702 if (esp->ops->dma_length_limit) in esp_process_event()
1703 dma_len = esp->ops->dma_length_limit(esp, dma_addr, in esp_process_event()
1706 dma_len = esp_dma_length_limit(esp, dma_addr, dma_len); in esp_process_event()
1708 esp->data_dma_len = dma_len; in esp_process_event()
1712 esp->host->unique_id); in esp_process_event()
1714 esp->host->unique_id, in esp_process_event()
1717 esp_schedule_reset(esp); in esp_process_event()
1725 esp->ops->send_dma_cmd(esp, dma_addr, dma_len, dma_len, in esp_process_event()
1727 esp_event(esp, ESP_EVENT_DATA_DONE); in esp_process_event()
1731 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event()
1735 if (esp->ops->dma_error(esp)) { in esp_process_event()
1737 esp_schedule_reset(esp); in esp_process_event()
1744 esp->ops->dma_drain(esp); in esp_process_event()
1746 esp->ops->dma_invalidate(esp); in esp_process_event()
1748 if (esp->ireg != ESP_INTR_BSERV) { in esp_process_event()
1753 esp_schedule_reset(esp); in esp_process_event()
1757 bytes_sent = esp_data_bytes_sent(esp, ent, cmd); in esp_process_event()
1764 esp_schedule_reset(esp); in esp_process_event()
1768 esp_advance_dma(esp, ent, cmd, bytes_sent); in esp_process_event()
1769 esp_event(esp, ESP_EVENT_CHECK_PHASE); in esp_process_event()
1774 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event()
1776 if (esp->ireg & ESP_INTR_FDONE) { in esp_process_event()
1779 scsi_esp_cmd(esp, ESP_CMD_MOK); in esp_process_event()
1780 } else if (esp->ireg == ESP_INTR_BSERV) { in esp_process_event()
1783 esp_event(esp, ESP_EVENT_MSGIN); in esp_process_event()
1790 esp_schedule_reset(esp); in esp_process_event()
1794 esp_event(esp, ESP_EVENT_FREE_BUS); in esp_process_event()
1795 esp->flags |= ESP_FLAG_QUICKIRQ_CHECK; in esp_process_event()
1799 struct esp_cmd_entry *ent = esp->active_cmd; in esp_process_event()
1804 scsi_esp_cmd(esp, ESP_CMD_ESEL); in esp_process_event()
1811 esp_event_queue_full(esp, ent); in esp_process_event()
1816 esp_autosense(esp, ent); in esp_process_event()
1818 esp_cmd_is_done(esp, ent, cmd, in esp_process_event()
1829 esp->active_cmd = NULL; in esp_process_event()
1830 esp_maybe_execute_command(esp); in esp_process_event()
1834 esp_schedule_reset(esp); in esp_process_event()
1837 if (esp->active_cmd) in esp_process_event()
1838 esp->flags |= ESP_FLAG_QUICKIRQ_CHECK; in esp_process_event()
1842 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_process_event()
1847 for (i = 0; i < esp->msg_out_len; i++) in esp_process_event()
1848 printk("%02x ", esp->msg_out[i]); in esp_process_event()
1852 if (esp->rev == FASHME) { in esp_process_event()
1856 for (i = 0; i < esp->msg_out_len; i++) { in esp_process_event()
1857 esp_write8(esp->msg_out[i], ESP_FDATA); in esp_process_event()
1860 scsi_esp_cmd(esp, ESP_CMD_TI); in esp_process_event()
1862 if (esp->msg_out_len == 1) { in esp_process_event()
1863 esp_write8(esp->msg_out[0], ESP_FDATA); in esp_process_event()
1864 scsi_esp_cmd(esp, ESP_CMD_TI); in esp_process_event()
1867 memcpy(esp->command_block, in esp_process_event()
1868 esp->msg_out, in esp_process_event()
1869 esp->msg_out_len); in esp_process_event()
1871 esp->ops->send_dma_cmd(esp, in esp_process_event()
1872 esp->command_block_dma, in esp_process_event()
1873 esp->msg_out_len, in esp_process_event()
1874 esp->msg_out_len, in esp_process_event()
1879 esp_event(esp, ESP_EVENT_MSGOUT_DONE); in esp_process_event()
1883 if (esp->rev == FASHME) { in esp_process_event()
1884 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_process_event()
1886 if (esp->msg_out_len > 1) in esp_process_event()
1887 esp->ops->dma_invalidate(esp); in esp_process_event()
1890 if (!(esp->ireg & ESP_INTR_DC)) { in esp_process_event()
1891 if (esp->rev != FASHME) in esp_process_event()
1892 scsi_esp_cmd(esp, ESP_CMD_NULL); in esp_process_event()
1894 esp_event(esp, ESP_EVENT_CHECK_PHASE); in esp_process_event()
1897 if (esp->ireg & ESP_INTR_BSERV) { in esp_process_event()
1898 if (esp->rev == FASHME) { in esp_process_event()
1901 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_process_event()
1903 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_process_event()
1904 if (esp->rev == ESP100) in esp_process_event()
1905 scsi_esp_cmd(esp, ESP_CMD_NULL); in esp_process_event()
1907 scsi_esp_cmd(esp, ESP_CMD_TI); in esp_process_event()
1908 esp->flags |= ESP_FLAG_QUICKIRQ_CHECK; in esp_process_event()
1911 if (esp->ireg & ESP_INTR_FDONE) { in esp_process_event()
1914 if (esp->rev == FASHME) in esp_process_event()
1915 val = esp->fifo[0]; in esp_process_event()
1918 esp->msg_in[esp->msg_in_len++] = val; in esp_process_event()
1922 if (!esp_msgin_process(esp)) in esp_process_event()
1923 esp->msg_in_len = 0; in esp_process_event()
1925 if (esp->rev == FASHME) in esp_process_event()
1926 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_process_event()
1928 scsi_esp_cmd(esp, ESP_CMD_MOK); in esp_process_event()
1930 if (esp->event != ESP_EVENT_FREE_BUS) in esp_process_event()
1931 esp_event(esp, ESP_EVENT_CHECK_PHASE); in esp_process_event()
1934 esp_schedule_reset(esp); in esp_process_event()
1939 memcpy(esp->command_block, esp->cmd_bytes_ptr, in esp_process_event()
1940 esp->cmd_bytes_left); in esp_process_event()
1941 if (esp->rev == FASHME) in esp_process_event()
1942 scsi_esp_cmd(esp, ESP_CMD_FLUSH); in esp_process_event()
1943 esp->ops->send_dma_cmd(esp, esp->command_block_dma, in esp_process_event()
1944 esp->cmd_bytes_left, 16, 0, in esp_process_event()
1946 esp_event(esp, ESP_EVENT_CMD_DONE); in esp_process_event()
1947 esp->flags |= ESP_FLAG_QUICKIRQ_CHECK; in esp_process_event()
1950 esp->ops->dma_invalidate(esp); in esp_process_event()
1951 if (esp->ireg & ESP_INTR_BSERV) { in esp_process_event()
1952 esp_event(esp, ESP_EVENT_CHECK_PHASE); in esp_process_event()
1955 esp_schedule_reset(esp); in esp_process_event()
1960 scsi_esp_cmd(esp, ESP_CMD_RS); in esp_process_event()
1965 esp->event); in esp_process_event()
1966 esp_schedule_reset(esp); in esp_process_event()
1973 static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent) in esp_reset_cleanup_one() argument
1977 esp_unmap_dma(esp, cmd); in esp_reset_cleanup_one()
1982 esp->ops->unmap_single(esp, ent->sense_dma, in esp_reset_cleanup_one()
1989 esp_put_ent(esp, ent); in esp_reset_cleanup_one()
2000 static void esp_reset_cleanup(struct esp *esp) in esp_reset_cleanup() argument
2005 list_for_each_entry_safe(ent, tmp, &esp->queued_cmds, list) { in esp_reset_cleanup()
2011 esp_put_ent(esp, ent); in esp_reset_cleanup()
2014 list_for_each_entry_safe(ent, tmp, &esp->active_cmds, list) { in esp_reset_cleanup()
2015 if (ent == esp->active_cmd) in esp_reset_cleanup()
2016 esp->active_cmd = NULL; in esp_reset_cleanup()
2017 esp_reset_cleanup_one(esp, ent); in esp_reset_cleanup()
2020 BUG_ON(esp->active_cmd != NULL); in esp_reset_cleanup()
2024 struct esp_target_data *tp = &esp->target[i]; in esp_reset_cleanup()
2038 esp->flags &= ~ESP_FLAG_RESETTING; in esp_reset_cleanup()
2042 static void __esp_interrupt(struct esp *esp) in __esp_interrupt() argument
2047 esp->sreg = esp_read8(ESP_STATUS); in __esp_interrupt()
2049 if (esp->flags & ESP_FLAG_RESETTING) { in __esp_interrupt()
2052 if (esp_check_gross_error(esp)) in __esp_interrupt()
2055 finish_reset = esp_check_spur_intr(esp); in __esp_interrupt()
2060 esp->ireg = esp_read8(ESP_INTRPT); in __esp_interrupt()
2062 if (esp->ireg & ESP_INTR_SR) in __esp_interrupt()
2066 esp_reset_cleanup(esp); in __esp_interrupt()
2067 if (esp->eh_reset) { in __esp_interrupt()
2068 complete(esp->eh_reset); in __esp_interrupt()
2069 esp->eh_reset = NULL; in __esp_interrupt()
2074 phase = (esp->sreg & ESP_STAT_PMASK); in __esp_interrupt()
2075 if (esp->rev == FASHME) { in __esp_interrupt()
2077 esp->select_state == ESP_SELECT_NONE && in __esp_interrupt()
2078 esp->event != ESP_EVENT_STATUS && in __esp_interrupt()
2079 esp->event != ESP_EVENT_DATA_DONE) || in __esp_interrupt()
2080 (esp->ireg & ESP_INTR_RSEL)) { in __esp_interrupt()
2081 esp->sreg2 = esp_read8(ESP_STATUS2); in __esp_interrupt()
2082 if (!(esp->sreg2 & ESP_STAT2_FEMPTY) || in __esp_interrupt()
2083 (esp->sreg2 & ESP_STAT2_F1BYTE)) in __esp_interrupt()
2084 hme_read_fifo(esp); in __esp_interrupt()
2090 esp->sreg, esp->seqreg, esp->sreg2, esp->ireg); in __esp_interrupt()
2094 if (esp->ireg & (ESP_INTR_S | ESP_INTR_SATN | ESP_INTR_IC)) { in __esp_interrupt()
2095 printk("ESP: unexpected IREG %02x\n", esp->ireg); in __esp_interrupt()
2096 if (esp->ireg & ESP_INTR_IC) in __esp_interrupt()
2097 esp_dump_cmd_log(esp); in __esp_interrupt()
2099 esp_schedule_reset(esp); in __esp_interrupt()
2101 if (!(esp->ireg & ESP_INTR_RSEL)) { in __esp_interrupt()
2103 if (esp->select_state != ESP_SELECT_NONE) in __esp_interrupt()
2104 intr_done = esp_finish_select(esp); in __esp_interrupt()
2105 } else if (esp->ireg & ESP_INTR_RSEL) { in __esp_interrupt()
2106 if (esp->active_cmd) in __esp_interrupt()
2107 (void) esp_finish_select(esp); in __esp_interrupt()
2108 intr_done = esp_reconnect(esp); in __esp_interrupt()
2112 intr_done = esp_process_event(esp); in __esp_interrupt()
2117 struct esp *esp = dev_id; in scsi_esp_intr() local
2121 spin_lock_irqsave(esp->host->host_lock, flags); in scsi_esp_intr()
2123 if (esp->ops->irq_pending(esp)) { in scsi_esp_intr()
2128 __esp_interrupt(esp); in scsi_esp_intr()
2129 if (!(esp->flags & ESP_FLAG_QUICKIRQ_CHECK)) in scsi_esp_intr()
2131 esp->flags &= ~ESP_FLAG_QUICKIRQ_CHECK; in scsi_esp_intr()
2134 if (esp->ops->irq_pending(esp)) in scsi_esp_intr()
2141 spin_unlock_irqrestore(esp->host->host_lock, flags); in scsi_esp_intr()
2147 static void esp_get_revision(struct esp *esp) in esp_get_revision() argument
2151 esp->config1 = (ESP_CONFIG1_PENABLE | (esp->scsi_id & 7)); in esp_get_revision()
2152 esp->config2 = (ESP_CONFIG2_SCSI2ENAB | ESP_CONFIG2_REGPARITY); in esp_get_revision()
2153 esp_write8(esp->config2, ESP_CFG2); in esp_get_revision()
2161 esp->rev = ESP100; in esp_get_revision()
2163 esp->config2 = 0; in esp_get_revision()
2164 esp_set_all_config3(esp, 5); in esp_get_revision()
2165 esp->prev_cfg3 = 5; in esp_get_revision()
2166 esp_write8(esp->config2, ESP_CFG2); in esp_get_revision()
2168 esp_write8(esp->prev_cfg3, ESP_CFG3); in esp_get_revision()
2175 esp->rev = ESP100A; in esp_get_revision()
2177 esp_set_all_config3(esp, 0); in esp_get_revision()
2178 esp->prev_cfg3 = 0; in esp_get_revision()
2179 esp_write8(esp->prev_cfg3, ESP_CFG3); in esp_get_revision()
2184 if (esp->cfact == 0 || esp->cfact > ESP_CCF_F5) { in esp_get_revision()
2185 esp->rev = FAST; in esp_get_revision()
2186 esp->sync_defp = SYNC_DEFP_FAST; in esp_get_revision()
2188 esp->rev = ESP236; in esp_get_revision()
2190 esp->config2 = 0; in esp_get_revision()
2191 esp_write8(esp->config2, ESP_CFG2); in esp_get_revision()
2196 static void esp_init_swstate(struct esp *esp) in esp_init_swstate() argument
2200 INIT_LIST_HEAD(&esp->queued_cmds); in esp_init_swstate()
2201 INIT_LIST_HEAD(&esp->active_cmds); in esp_init_swstate()
2202 INIT_LIST_HEAD(&esp->esp_cmd_pool); in esp_init_swstate()
2209 esp->target[i].flags = 0; in esp_init_swstate()
2210 esp->target[i].nego_goal_period = 0; in esp_init_swstate()
2211 esp->target[i].nego_goal_offset = 0; in esp_init_swstate()
2212 esp->target[i].nego_goal_width = 0; in esp_init_swstate()
2213 esp->target[i].nego_goal_tags = 0; in esp_init_swstate()
2218 static void esp_bootup_reset(struct esp *esp) in esp_bootup_reset() argument
2223 esp->ops->reset_dma(esp); in esp_bootup_reset()
2226 esp_reset_esp(esp); in esp_bootup_reset()
2233 scsi_esp_cmd(esp, ESP_CMD_RS); in esp_bootup_reset()
2236 esp_write8(esp->config1, ESP_CFG1); in esp_bootup_reset()
2242 static void esp_set_clock_params(struct esp *esp) in esp_set_clock_params() argument
2279 fhz = esp->cfreq; in esp_set_clock_params()
2295 esp->cfact = (ccf == 8 ? 0 : ccf); in esp_set_clock_params()
2296 esp->cfreq = fhz; in esp_set_clock_params()
2297 esp->ccycle = ESP_HZ_TO_CYCLE(fhz); in esp_set_clock_params()
2298 esp->ctick = ESP_TICK(ccf, esp->ccycle); in esp_set_clock_params()
2299 esp->neg_defp = ESP_NEG_DEFP(fhz, ccf); in esp_set_clock_params()
2300 esp->sync_defp = SYNC_DEFP_SLOW; in esp_set_clock_params()
2315 int scsi_esp_register(struct esp *esp, struct device *dev) in scsi_esp_register() argument
2320 esp->host->transportt = esp_transport_template; in scsi_esp_register()
2321 esp->host->max_lun = ESP_MAX_LUN; in scsi_esp_register()
2322 esp->host->cmd_per_lun = 2; in scsi_esp_register()
2323 esp->host->unique_id = instance; in scsi_esp_register()
2325 esp_set_clock_params(esp); in scsi_esp_register()
2327 esp_get_revision(esp); in scsi_esp_register()
2329 esp_init_swstate(esp); in scsi_esp_register()
2331 esp_bootup_reset(esp); in scsi_esp_register()
2334 esp->host->unique_id, esp->regs, esp->dma_regs, in scsi_esp_register()
2335 esp->host->irq); in scsi_esp_register()
2337 esp->host->unique_id, esp_chip_names[esp->rev], in scsi_esp_register()
2338 esp->cfreq / 1000000, esp->cfact, esp->scsi_id); in scsi_esp_register()
2343 err = scsi_add_host(esp->host, dev); in scsi_esp_register()
2349 scsi_scan_host(esp->host); in scsi_esp_register()
2355 void scsi_esp_unregister(struct esp *esp) in scsi_esp_unregister() argument
2357 scsi_remove_host(esp->host); in scsi_esp_unregister()
2363 struct esp *esp = shost_priv(dev_to_shost(&starget->dev)); in esp_target_alloc() local
2364 struct esp_target_data *tp = &esp->target[starget->id]; in esp_target_alloc()
2373 struct esp *esp = shost_priv(dev_to_shost(&starget->dev)); in esp_target_destroy() local
2374 struct esp_target_data *tp = &esp->target[starget->id]; in esp_target_destroy()
2381 struct esp *esp = shost_priv(dev->host); in esp_slave_alloc() local
2382 struct esp_target_data *tp = &esp->target[dev->id]; in esp_slave_alloc()
2390 spi_min_period(tp->starget) = esp->min_period; in esp_slave_alloc()
2393 if (esp->flags & ESP_FLAG_WIDE_CAPABLE) in esp_slave_alloc()
2403 struct esp *esp = shost_priv(dev->host); in esp_slave_configure() local
2404 struct esp_target_data *tp = &esp->target[dev->id]; in esp_slave_configure()
2445 struct esp *esp = shost_priv(cmd->device->host); in esp_eh_abort_handler() local
2453 spin_lock_irqsave(esp->host->host_lock, flags); in esp_eh_abort_handler()
2455 esp->host->unique_id, cmd, cmd->cmnd[0]); in esp_eh_abort_handler()
2456 ent = esp->active_cmd; in esp_eh_abort_handler()
2459 esp->host->unique_id, ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2460 list_for_each_entry(ent, &esp->queued_cmds, list) { in esp_eh_abort_handler()
2462 esp->host->unique_id, ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2464 list_for_each_entry(ent, &esp->active_cmds, list) { in esp_eh_abort_handler()
2466 esp->host->unique_id, ent->cmd, ent->cmd->cmnd[0]); in esp_eh_abort_handler()
2468 esp_dump_cmd_log(esp); in esp_eh_abort_handler()
2469 spin_unlock_irqrestore(esp->host->host_lock, flags); in esp_eh_abort_handler()
2471 spin_lock_irqsave(esp->host->host_lock, flags); in esp_eh_abort_handler()
2474 list_for_each_entry(tmp, &esp->queued_cmds, list) { in esp_eh_abort_handler()
2490 esp_put_ent(esp, ent); in esp_eh_abort_handler()
2497 ent = esp->active_cmd; in esp_eh_abort_handler()
2503 if (esp->msg_out_len) in esp_eh_abort_handler()
2509 esp->msg_out[0] = ABORT_TASK_SET; in esp_eh_abort_handler()
2510 esp->msg_out_len = 1; in esp_eh_abort_handler()
2513 scsi_esp_cmd(esp, ESP_CMD_SATN); in esp_eh_abort_handler()
2534 spin_unlock_irqrestore(esp->host->host_lock, flags); in esp_eh_abort_handler()
2537 spin_lock_irqsave(esp->host->host_lock, flags); in esp_eh_abort_handler()
2539 spin_unlock_irqrestore(esp->host->host_lock, flags); in esp_eh_abort_handler()
2547 spin_unlock_irqrestore(esp->host->host_lock, flags); in esp_eh_abort_handler()
2555 spin_unlock_irqrestore(esp->host->host_lock, flags); in esp_eh_abort_handler()
2561 struct esp *esp = shost_priv(cmd->device->host); in esp_eh_bus_reset_handler() local
2567 spin_lock_irqsave(esp->host->host_lock, flags); in esp_eh_bus_reset_handler()
2569 esp->eh_reset = &eh_reset; in esp_eh_bus_reset_handler()
2576 esp->flags |= ESP_FLAG_RESETTING; in esp_eh_bus_reset_handler()
2577 scsi_esp_cmd(esp, ESP_CMD_RS); in esp_eh_bus_reset_handler()
2579 spin_unlock_irqrestore(esp->host->host_lock, flags); in esp_eh_bus_reset_handler()
2584 spin_lock_irqsave(esp->host->host_lock, flags); in esp_eh_bus_reset_handler()
2585 esp->eh_reset = NULL; in esp_eh_bus_reset_handler()
2586 spin_unlock_irqrestore(esp->host->host_lock, flags); in esp_eh_bus_reset_handler()
2597 struct esp *esp = shost_priv(cmd->device->host); in esp_eh_host_reset_handler() local
2600 spin_lock_irqsave(esp->host->host_lock, flags); in esp_eh_host_reset_handler()
2601 esp_bootup_reset(esp); in esp_eh_host_reset_handler()
2602 esp_reset_cleanup(esp); in esp_eh_host_reset_handler()
2603 spin_unlock_irqrestore(esp->host->host_lock, flags); in esp_eh_host_reset_handler()
2639 struct esp *esp = shost_priv(host); in esp_get_signalling() local
2642 if (esp->flags & ESP_FLAG_DIFFERENTIAL) in esp_get_signalling()
2653 struct esp *esp = shost_priv(host); in esp_set_offset() local
2654 struct esp_target_data *tp = &esp->target[target->id]; in esp_set_offset()
2656 if (esp->flags & ESP_FLAG_DISABLE_SYNC) in esp_set_offset()
2666 struct esp *esp = shost_priv(host); in esp_set_period() local
2667 struct esp_target_data *tp = &esp->target[target->id]; in esp_set_period()
2676 struct esp *esp = shost_priv(host); in esp_set_width() local
2677 struct esp_target_data *tp = &esp->target[target->id]; in esp_set_width()