Lines Matching refs:dcb
229 struct DeviceCtlBlk *dcb; member
377 static u8 start_scsi(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
381 static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb,
389 static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
391 static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
394 struct DeviceCtlBlk *dcb);
735 static void free_tag(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) in free_tag() argument
738 dcb->tag_mask &= ~(1 << srb->tag_number); /* free tag mask */ in free_tag()
777 static void srb_waiting_insert(struct DeviceCtlBlk *dcb, in srb_waiting_insert() argument
781 srb->cmd->serial_number, dcb->target_id, dcb->target_lun, srb); in srb_waiting_insert()
782 list_add(&srb->list, &dcb->srb_waiting_list); in srb_waiting_insert()
786 static void srb_waiting_append(struct DeviceCtlBlk *dcb, in srb_waiting_append() argument
790 srb->cmd->serial_number, dcb->target_id, dcb->target_lun, srb); in srb_waiting_append()
791 list_add_tail(&srb->list, &dcb->srb_waiting_list); in srb_waiting_append()
795 static void srb_going_append(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) in srb_going_append() argument
798 srb->cmd->serial_number, dcb->target_id, dcb->target_lun, srb); in srb_going_append()
799 list_add_tail(&srb->list, &dcb->srb_going_list); in srb_going_append()
803 static void srb_going_remove(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) in srb_going_remove() argument
808 srb->cmd->serial_number, dcb->target_id, dcb->target_lun, srb); in srb_going_remove()
810 list_for_each_entry_safe(i, tmp, &dcb->srb_going_list, list) in srb_going_remove()
818 static void srb_waiting_remove(struct DeviceCtlBlk *dcb, in srb_waiting_remove() argument
824 srb->cmd->serial_number, dcb->target_id, dcb->target_lun, srb); in srb_waiting_remove()
826 list_for_each_entry_safe(i, tmp, &dcb->srb_waiting_list, list) in srb_waiting_remove()
834 static void srb_going_to_waiting_move(struct DeviceCtlBlk *dcb, in srb_going_to_waiting_move() argument
839 srb->cmd->serial_number, dcb->target_id, dcb->target_lun, srb); in srb_going_to_waiting_move()
840 list_move(&srb->list, &dcb->srb_waiting_list); in srb_going_to_waiting_move()
844 static void srb_waiting_to_going_move(struct DeviceCtlBlk *dcb, in srb_waiting_to_going_move() argument
849 srb->cmd->serial_number, dcb->target_id, dcb->target_lun, srb); in srb_waiting_to_going_move()
850 list_move(&srb->list, &dcb->srb_going_list); in srb_waiting_to_going_move()
876 struct DeviceCtlBlk *dcb; in waiting_process_next() local
894 list_for_each_entry(dcb, dcb_list_head, list) in waiting_process_next()
895 if (dcb == acb->dcb_run_robin) { in waiting_process_next()
896 start = dcb; in waiting_process_next()
960 struct DeviceCtlBlk *dcb = srb->dcb; in send_srb() local
962 if (dcb->max_command <= list_size(&dcb->srb_going_list) || in send_srb()
965 srb_waiting_append(dcb, srb); in send_srb()
970 if (!start_scsi(acb, dcb, srb)) in send_srb()
971 srb_going_append(dcb, srb); in send_srb()
973 srb_waiting_insert(dcb, srb); in send_srb()
979 static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb, in build_srb() argument
985 cmd->serial_number, dcb->target_id, dcb->target_lun); in build_srb()
987 srb->dcb = dcb; in build_srb()
1044 if (dcb->sync_period & WIDE_SYNC && in build_srb()
1050 srb->sg_bus_addr = pci_map_single(dcb->acb->dev, in build_srb()
1084 struct DeviceCtlBlk *dcb; in dc395x_queue_command() local
1109 dcb = find_dcb(acb, cmd->device->id, cmd->device->lun); in dc395x_queue_command()
1110 if (!dcb) { in dc395x_queue_command()
1132 build_srb(cmd, dcb, srb); in dc395x_queue_command()
1134 if (!list_empty(&dcb->srb_waiting_list)) { in dc395x_queue_command()
1136 srb_waiting_append(dcb, srb); in dc395x_queue_command()
1190 struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) in dump_register_info() argument
1195 if (!dcb) in dump_register_info()
1196 dcb = acb->active_dcb; in dump_register_info()
1197 if (!srb && dcb) in dump_register_info()
1198 srb = dcb->active_srb; in dump_register_info()
1271 struct DeviceCtlBlk *dcb; in reset_dev_param() local
1275 list_for_each_entry(dcb, &acb->dcb_list, list) { in reset_dev_param()
1278 dcb->sync_mode &= ~(SYNC_NEGO_DONE + WIDE_NEGO_DONE); in reset_dev_param()
1279 dcb->sync_period = 0; in reset_dev_param()
1280 dcb->sync_offset = 0; in reset_dev_param()
1282 dcb->dev_mode = eeprom->target[dcb->target_id].cfg0; in reset_dev_param()
1283 period_index = eeprom->target[dcb->target_id].period & 0x07; in reset_dev_param()
1284 dcb->min_nego_period = clock_period[period_index]; in reset_dev_param()
1285 if (!(dcb->dev_mode & NTC_DO_WIDE_NEGO) in reset_dev_param()
1287 dcb->sync_mode &= ~WIDE_NEGO_ENABLE; in reset_dev_param()
1367 struct DeviceCtlBlk *dcb; in dc395x_eh_abort() local
1372 dcb = find_dcb(acb, cmd->device->id, cmd->device->lun); in dc395x_eh_abort()
1373 if (!dcb) { in dc395x_eh_abort()
1378 srb = find_cmd(cmd, &dcb->srb_waiting_list); in dc395x_eh_abort()
1380 srb_waiting_remove(dcb, srb); in dc395x_eh_abort()
1383 free_tag(dcb, srb); in dc395x_eh_abort()
1389 srb = find_cmd(cmd, &dcb->srb_going_list); in dc395x_eh_abort()
1401 static void build_sdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in build_sdtr() argument
1412 if (!(dcb->dev_mode & NTC_DO_SYNC_NEGO)) { in build_sdtr()
1413 dcb->sync_offset = 0; in build_sdtr()
1414 dcb->min_nego_period = 200 >> 2; in build_sdtr()
1415 } else if (dcb->sync_offset == 0) in build_sdtr()
1416 dcb->sync_offset = SYNC_NEGO_OFFSET; in build_sdtr()
1421 *ptr++ = dcb->min_nego_period; /* Transfer period (in 4ns) */ in build_sdtr()
1422 *ptr++ = dcb->sync_offset; /* Transfer period (max. REQ/ACK dist) */ in build_sdtr()
1429 static void build_wdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in build_wdtr() argument
1432 u8 wide = ((dcb->dev_mode & NTC_DO_WIDE_NEGO) & in build_wdtr()
1490 static u8 start_scsi(struct AdapterCtlBlk* acb, struct DeviceCtlBlk* dcb, in start_scsi() argument
1497 srb->cmd->serial_number, dcb->target_id, dcb->target_lun, srb); in start_scsi()
1545 DC395x_write8(acb, TRM_S1040_SCSI_TARGETID, dcb->target_id); in start_scsi()
1546 DC395x_write8(acb, TRM_S1040_SCSI_SYNC, dcb->sync_period); in start_scsi()
1547 DC395x_write8(acb, TRM_S1040_SCSI_OFFSET, dcb->sync_offset); in start_scsi()
1550 identify_message = dcb->identify_msg; in start_scsi()
1559 && (((dcb->sync_mode & WIDE_NEGO_ENABLE) in start_scsi()
1560 && !(dcb->sync_mode & WIDE_NEGO_DONE)) in start_scsi()
1561 || ((dcb->sync_mode & SYNC_NEGO_ENABLE) in start_scsi()
1562 && !(dcb->sync_mode & SYNC_NEGO_DONE))) in start_scsi()
1563 && (dcb->target_lun == 0)) { in start_scsi()
1569 if (dcb->sync_mode & WIDE_NEGO_ENABLE in start_scsi()
1570 && dcb->inquiry7 & SCSI_INQ_WBUS16) { in start_scsi()
1571 build_wdtr(acb, dcb, srb); in start_scsi()
1575 if (dcb->sync_mode & SYNC_NEGO_ENABLE in start_scsi()
1576 && dcb->inquiry7 & SCSI_INQ_SYNC) { in start_scsi()
1577 build_sdtr(acb, dcb, srb); in start_scsi()
1580 if (dcb->sync_mode & WIDE_NEGO_ENABLE in start_scsi()
1581 && dcb->inquiry7 & SCSI_INQ_WBUS16) { in start_scsi()
1582 build_wdtr(acb, dcb, srb); in start_scsi()
1593 if ((dcb->sync_mode & EN_TAG_QUEUEING) in start_scsi()
1598 while (tag_mask & dcb->tag_mask in start_scsi()
1599 && tag_number <= dcb->max_command) { in start_scsi()
1603 if (tag_number >= dcb->max_command) { in start_scsi()
1616 dcb->tag_mask |= tag_mask; in start_scsi()
1629 DC395x_write8(acb, TRM_S1040_SCSI_FIFO, (dcb->target_lun << 5)); in start_scsi()
1649 srb->cmd->serial_number, dcb->target_id, dcb->target_lun); in start_scsi()
1651 free_tag(dcb, srb); in start_scsi()
1661 dcb->active_srb = srb; in start_scsi()
1662 acb->active_dcb = dcb; in start_scsi()
1701 struct DeviceCtlBlk *dcb; in dc395x_handle_interrupt() local
1742 dcb = acb->active_dcb; in dc395x_handle_interrupt()
1743 if (!dcb) { in dc395x_handle_interrupt()
1749 srb = dcb->active_srb; in dc395x_handle_interrupt()
1750 if (dcb->flag & ABORT_DEV_) { in dc395x_handle_interrupt()
1897 struct DeviceCtlBlk *dcb; in command_phase1() local
1912 dcb = acb->active_dcb; in command_phase1()
1914 DC395x_write8(acb, TRM_S1040_SCSI_FIFO, (dcb->target_lun << 5)); in command_phase1()
1977 pci_dma_sync_single_for_device(srb->dcb-> in sg_update_list()
2039 struct DeviceCtlBlk *dcb = srb->dcb; in data_out_phase0() local
2085 if (dcb->sync_period & WIDE_SYNC) in data_out_phase0()
2092 (dcb->sync_period & WIDE_SYNC) ? "words" : "bytes", in data_out_phase0()
2115 if (d_left_counter == 1 && dcb->sync_period & WIDE_SYNC in data_out_phase0()
2143 (dcb->sync_period & WIDE_SYNC) ? 2 : 1; in data_out_phase0()
2243 << ((srb->dcb->sync_period & WIDE_SYNC) ? 1 : in data_in_phase0()
2250 (srb->dcb->sync_period & WIDE_SYNC) ? "words" : "bytes", in data_in_phase0()
2267 (srb->dcb->sync_period & WIDE_SYNC) ? in data_in_phase0()
2270 if (srb->dcb->sync_period & WIDE_SYNC) in data_in_phase0()
2311 if (fc == 0x40 && (srb->dcb->sync_period & WIDE_SYNC)) { in data_in_phase0()
2348 if (srb->dcb->sync_period & WIDE_SYNC) in data_in_phase0()
2404 struct DeviceCtlBlk *dcb = srb->dcb; in data_io_transfer() local
2427 dump_register_info(acb, dcb, srb); in data_io_transfer()
2487 if (srb->dcb->sync_period & WIDE_SYNC) in data_io_transfer()
2517 if (srb->dcb->sync_period & WIDE_SYNC) { in data_io_transfer()
2544 if (dcb->sync_period & WIDE_SYNC) { in data_io_transfer()
2627 srb->dcb->target_id, srb->dcb->target_lun); in msgin_reject()
2632 struct DeviceCtlBlk *dcb, u8 tag) in msgin_qtag() argument
2639 if (!(dcb->tag_mask & (1 << tag))) in msgin_qtag()
2642 dcb->tag_mask, tag); in msgin_qtag()
2644 if (list_empty(&dcb->srb_going_list)) in msgin_qtag()
2646 list_for_each_entry(i, &dcb->srb_going_list, list) { in msgin_qtag()
2656 srb->cmd->serial_number, srb->dcb->target_id, srb->dcb->target_lun); in msgin_qtag()
2657 if (dcb->flag & ABORT_DEV_) { in msgin_qtag()
2665 memcpy(srb->msgin_buf, dcb->active_srb->msgin_buf, acb->msg_len); in msgin_qtag()
2666 srb->state |= dcb->active_srb->state; in msgin_qtag()
2668 dcb->active_srb = srb; in msgin_qtag()
2675 dcb->active_srb = srb; in msgin_qtag()
2685 struct DeviceCtlBlk *dcb) in reprogram_regs() argument
2687 DC395x_write8(acb, TRM_S1040_SCSI_TARGETID, dcb->target_id); in reprogram_regs()
2688 DC395x_write8(acb, TRM_S1040_SCSI_SYNC, dcb->sync_period); in reprogram_regs()
2689 DC395x_write8(acb, TRM_S1040_SCSI_OFFSET, dcb->sync_offset); in reprogram_regs()
2690 set_xfer_rate(acb, dcb); in reprogram_regs()
2697 struct DeviceCtlBlk *dcb = srb->dcb; in msgin_set_async() local
2699 dcb->target_id, dcb->target_lun); in msgin_set_async()
2701 dcb->sync_mode &= ~(SYNC_NEGO_ENABLE); in msgin_set_async()
2702 dcb->sync_mode |= SYNC_NEGO_DONE; in msgin_set_async()
2704 dcb->sync_offset = 0; in msgin_set_async()
2705 dcb->min_nego_period = 200 >> 2; /* 200ns <=> 5 MHz */ in msgin_set_async()
2707 reprogram_regs(acb, dcb); in msgin_set_async()
2708 if ((dcb->sync_mode & WIDE_NEGO_ENABLE) in msgin_set_async()
2709 && !(dcb->sync_mode & WIDE_NEGO_DONE)) { in msgin_set_async()
2710 build_wdtr(acb, dcb, srb); in msgin_set_async()
2720 struct DeviceCtlBlk *dcb = srb->dcb; in msgin_set_sync() local
2725 dcb->target_id, srb->msgin_buf[3] << 2, in msgin_set_sync()
2732 if (!(dcb->dev_mode & NTC_DO_SYNC_NEGO)) in msgin_set_sync()
2733 dcb->sync_offset = 0; in msgin_set_sync()
2734 else if (dcb->sync_offset == 0) in msgin_set_sync()
2735 dcb->sync_offset = srb->msgin_buf[4]; in msgin_set_sync()
2736 if (srb->msgin_buf[4] > dcb->sync_offset) in msgin_set_sync()
2737 srb->msgin_buf[4] = dcb->sync_offset; in msgin_set_sync()
2739 dcb->sync_offset = srb->msgin_buf[4]; in msgin_set_sync()
2742 || dcb->min_nego_period > in msgin_set_sync()
2750 dcb->sync_period &= 0xf0; in msgin_set_sync()
2751 dcb->sync_period |= ALT_SYNC | bval; in msgin_set_sync()
2752 dcb->min_nego_period = srb->msgin_buf[3]; in msgin_set_sync()
2754 if (dcb->sync_period & WIDE_SYNC) in msgin_set_sync()
2761 dcb->target_id, (fact == 500) ? "Wide16" : "", in msgin_set_sync()
2762 dcb->min_nego_period << 2, dcb->sync_offset, in msgin_set_sync()
2763 (fact / dcb->min_nego_period), in msgin_set_sync()
2764 ((fact % dcb->min_nego_period) * 10 + in msgin_set_sync()
2765 dcb->min_nego_period / 2) / dcb->min_nego_period); in msgin_set_sync()
2775 dcb->sync_mode |= SYNC_NEGO_DONE; in msgin_set_sync()
2777 if ((dcb->sync_mode & WIDE_NEGO_ENABLE) in msgin_set_sync()
2778 && !(dcb->sync_mode & WIDE_NEGO_DONE)) { in msgin_set_sync()
2779 build_wdtr(acb, dcb, srb); in msgin_set_sync()
2785 dcb->sync_mode |= SYNC_NEGO_DONE | SYNC_NEGO_ENABLE; in msgin_set_sync()
2787 reprogram_regs(acb, dcb); in msgin_set_sync()
2794 struct DeviceCtlBlk *dcb = srb->dcb; in msgin_set_nowide() local
2795 dprintkdbg(DBG_1, "msgin_set_nowide: <%02i>\n", dcb->target_id); in msgin_set_nowide()
2797 dcb->sync_period &= ~WIDE_SYNC; in msgin_set_nowide()
2798 dcb->sync_mode &= ~(WIDE_NEGO_ENABLE); in msgin_set_nowide()
2799 dcb->sync_mode |= WIDE_NEGO_DONE; in msgin_set_nowide()
2801 reprogram_regs(acb, dcb); in msgin_set_nowide()
2802 if ((dcb->sync_mode & SYNC_NEGO_ENABLE) in msgin_set_nowide()
2803 && !(dcb->sync_mode & SYNC_NEGO_DONE)) { in msgin_set_nowide()
2804 build_sdtr(acb, dcb, srb); in msgin_set_nowide()
2812 struct DeviceCtlBlk *dcb = srb->dcb; in msgin_set_wide() local
2813 u8 wide = (dcb->dev_mode & NTC_DO_WIDE_NEGO in msgin_set_wide()
2815 dprintkdbg(DBG_1, "msgin_set_wide: <%02i>\n", dcb->target_id); in msgin_set_wide()
2823 dcb->target_id); in msgin_set_wide()
2830 dcb->sync_mode |= (WIDE_NEGO_ENABLE | WIDE_NEGO_DONE); in msgin_set_wide()
2832 dcb->sync_period |= WIDE_SYNC; in msgin_set_wide()
2834 dcb->sync_period &= ~WIDE_SYNC; in msgin_set_wide()
2839 (8 << srb->msgin_buf[3]), dcb->target_id); in msgin_set_wide()
2840 reprogram_regs(acb, dcb); in msgin_set_wide()
2841 if ((dcb->sync_mode & SYNC_NEGO_ENABLE) in msgin_set_wide()
2842 && !(dcb->sync_mode & SYNC_NEGO_DONE)) { in msgin_set_wide()
2843 build_sdtr(acb, dcb, srb); in msgin_set_wide()
2865 struct DeviceCtlBlk *dcb = acb->active_dcb; in msgin_phase0() local
2880 msgin_qtag(acb, dcb, in msgin_phase0()
2944 srb->cmd->serial_number, dcb->target_id, in msgin_phase0()
2945 dcb->target_lun); in msgin_phase0()
2946 dcb->flag |= ABORT_DEV_; in msgin_phase0()
2955 srb->msgout_buf[0] = dcb->identify_msg; in msgin_phase0()
3001 static void set_xfer_rate(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb) in set_xfer_rate() argument
3006 if (dcb->identify_msg & 0x07) in set_xfer_rate()
3010 current_sync_offset = dcb->sync_offset; in set_xfer_rate()
3015 if (i->target_id == dcb->target_id) { in set_xfer_rate()
3016 i->sync_period = dcb->sync_period; in set_xfer_rate()
3017 i->sync_offset = dcb->sync_offset; in set_xfer_rate()
3018 i->sync_mode = dcb->sync_mode; in set_xfer_rate()
3019 i->min_nego_period = dcb->min_nego_period; in set_xfer_rate()
3026 struct DeviceCtlBlk *dcb = acb->active_dcb; in disconnect() local
3029 if (!dcb) { in disconnect()
3040 srb = dcb->active_srb; in disconnect()
3050 dcb->target_id, dcb->target_lun); in disconnect()
3054 dcb->flag &= ~ABORT_DEV_; in disconnect()
3080 dcb->target_id, dcb->target_lun); in disconnect()
3087 free_tag(dcb, srb); in disconnect()
3088 srb_going_to_waiting_move(dcb, srb); in disconnect()
3111 free_tag(dcb, srb); in disconnect()
3112 dcb->active_srb = NULL; in disconnect()
3114 srb_done(acb, dcb, srb); in disconnect()
3122 struct DeviceCtlBlk *dcb = acb->active_dcb; in reselect() local
3133 if (dcb) { /* Arbitration lost but Reselection win */ in reselect()
3134 srb = dcb->active_srb; in reselect()
3145 srb->cmd->serial_number, dcb->target_id, in reselect()
3146 dcb->target_lun, rsel_tar_lun_id, in reselect()
3152 free_tag(dcb, srb); in reselect()
3153 srb_going_to_waiting_move(dcb, srb); in reselect()
3165 dcb = find_dcb(acb, id, lun); in reselect()
3166 if (!dcb) { in reselect()
3172 acb->active_dcb = dcb; in reselect()
3174 if (!(dcb->dev_mode & NTC_DO_DISCONNECT)) in reselect()
3177 dcb->target_id, dcb->target_lun); in reselect()
3179 if (dcb->sync_mode & EN_TAG_QUEUEING /*&& !arblostflag */) { in reselect()
3181 dcb->active_srb = srb; in reselect()
3184 srb = dcb->active_srb; in reselect()
3191 dcb->target_id, dcb->target_lun); in reselect()
3194 dcb->active_srb = srb; in reselect()
3197 if (dcb->flag & ABORT_DEV_) { in reselect()
3208 dprintkdbg(DBG_0, "reselect: select <%i>\n", dcb->target_id); in reselect()
3210 DC395x_write8(acb, TRM_S1040_SCSI_TARGETID, dcb->target_id); /* target ID */ in reselect()
3211 DC395x_write8(acb, TRM_S1040_SCSI_OFFSET, dcb->sync_offset); /* offset */ in reselect()
3212 DC395x_write8(acb, TRM_S1040_SCSI_SYNC, dcb->sync_period); /* sync period, wide */ in reselect()
3235 static void disc_tagq_set(struct DeviceCtlBlk *dcb, struct ScsiInqData *ptr) in disc_tagq_set() argument
3240 && (dcb->dev_mode & NTC_DO_TAG_QUEUEING) && in disc_tagq_set()
3245 if (dcb->max_command == 1) in disc_tagq_set()
3246 dcb->max_command = in disc_tagq_set()
3247 dcb->acb->tag_max_num; in disc_tagq_set()
3248 dcb->sync_mode |= EN_TAG_QUEUEING; in disc_tagq_set()
3251 dcb->max_command = 1; in disc_tagq_set()
3256 static void add_dev(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in add_dev() argument
3260 dcb->dev_type = bval1; in add_dev()
3262 disc_tagq_set(dcb, ptr); in add_dev()
3311 static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in srb_done() argument
3339 cmd->cmnd[0], dcb->target_id, in srb_done()
3340 dcb->target_lun, status, acb->scan_devices); in srb_done()
3345 cmd->cmnd[0], dcb->target_id, in srb_done()
3346 dcb->target_lun, status, acb->scan_devices); in srb_done()
3351 cmd->cmnd[0], dcb->target_id, in srb_done()
3352 dcb->target_lun, status, acb->scan_devices); in srb_done()
3357 cmd->cmnd[0], dcb->target_id, in srb_done()
3358 dcb->target_lun, status, acb->scan_devices); in srb_done()
3363 cmd->cmnd[0], dcb->target_id, in srb_done()
3364 dcb->target_lun, status, acb->scan_devices); in srb_done()
3406 request_sense(acb, dcb, srb); in srb_done()
3409 tempcnt = (u8)list_size(&dcb->srb_going_list); in srb_done()
3411 dcb->target_id, dcb->target_lun, tempcnt); in srb_done()
3414 dcb->max_command = tempcnt; in srb_done()
3415 free_tag(dcb, srb); in srb_done()
3416 srb_going_to_waiting_move(dcb, srb); in srb_done()
3474 dcb->inquiry7 = ptr->Flags; in srb_done()
3481 if (!dcb->init_tcq_flag) { in srb_done()
3482 add_dev(acb, dcb, ptr); in srb_done()
3483 dcb->init_tcq_flag = 1; in srb_done()
3504 srb_going_remove(dcb, srb); in srb_done()
3524 struct DeviceCtlBlk *dcb; in doing_srb_done() local
3527 list_for_each_entry(dcb, &acb->dcb_list, list) { in doing_srb_done()
3532 list_for_each_entry_safe(srb, tmp, &dcb->srb_going_list, list) { in doing_srb_done()
3541 srb_going_remove(dcb, srb); in doing_srb_done()
3542 free_tag(dcb, srb); in doing_srb_done()
3553 if (!list_empty(&dcb->srb_going_list)) in doing_srb_done()
3556 dcb->target_id, dcb->target_lun); in doing_srb_done()
3557 if (dcb->tag_mask) in doing_srb_done()
3560 dcb->target_id, dcb->target_lun, in doing_srb_done()
3561 dcb->tag_mask); in doing_srb_done()
3564 list_for_each_entry_safe(srb, tmp, &dcb->srb_waiting_list, list) { in doing_srb_done()
3571 srb_waiting_remove(dcb, srb); in doing_srb_done()
3582 if (!list_empty(&dcb->srb_waiting_list)) in doing_srb_done()
3584 list_size(&dcb->srb_waiting_list), dcb->target_id, in doing_srb_done()
3585 dcb->target_lun); in doing_srb_done()
3586 dcb->flag &= ~ABORT_DEV_; in doing_srb_done()
3674 static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in request_sense() argument
3707 if (start_scsi(acb, dcb, srb)) { /* Should only happen, if sb. else grabs the bus */ in request_sense()
3710 srb->cmd->serial_number, dcb->target_id, dcb->target_lun); in request_sense()
3711 srb_going_to_waiting_move(dcb, srb); in request_sense()
3735 struct DeviceCtlBlk *dcb; in device_alloc() local
3737 dcb = kmalloc(sizeof(struct DeviceCtlBlk), GFP_ATOMIC); in device_alloc()
3739 if (!dcb) in device_alloc()
3741 dcb->acb = NULL; in device_alloc()
3742 INIT_LIST_HEAD(&dcb->srb_going_list); in device_alloc()
3743 INIT_LIST_HEAD(&dcb->srb_waiting_list); in device_alloc()
3744 dcb->active_srb = NULL; in device_alloc()
3745 dcb->tag_mask = 0; in device_alloc()
3746 dcb->max_command = 1; in device_alloc()
3747 dcb->target_id = target; in device_alloc()
3748 dcb->target_lun = lun; in device_alloc()
3750 dcb->identify_msg = in device_alloc()
3751 IDENTIFY(dcb->dev_mode & NTC_DO_DISCONNECT, lun); in device_alloc()
3753 dcb->identify_msg = IDENTIFY(0, lun); in device_alloc()
3755 dcb->dev_mode = eeprom->target[target].cfg0; in device_alloc()
3756 dcb->inquiry7 = 0; in device_alloc()
3757 dcb->sync_mode = 0; in device_alloc()
3758 dcb->min_nego_period = clock_period[period_index]; in device_alloc()
3759 dcb->sync_period = 0; in device_alloc()
3760 dcb->sync_offset = 0; in device_alloc()
3761 dcb->flag = 0; in device_alloc()
3764 if ((dcb->dev_mode & NTC_DO_WIDE_NEGO) in device_alloc()
3766 dcb->sync_mode |= WIDE_NEGO_ENABLE; in device_alloc()
3769 if (dcb->dev_mode & NTC_DO_SYNC_NEGO) in device_alloc()
3771 dcb->sync_mode |= SYNC_NEGO_ENABLE; in device_alloc()
3773 if (dcb->target_lun != 0) { in device_alloc()
3777 if (p->target_id == dcb->target_id) in device_alloc()
3781 dcb->target_id, dcb->target_lun, in device_alloc()
3783 dcb->sync_mode = p->sync_mode; in device_alloc()
3784 dcb->sync_period = p->sync_period; in device_alloc()
3785 dcb->min_nego_period = p->min_nego_period; in device_alloc()
3786 dcb->sync_offset = p->sync_offset; in device_alloc()
3787 dcb->inquiry7 = p->inquiry7; in device_alloc()
3789 return dcb; in device_alloc()
3800 struct DeviceCtlBlk *dcb) in adapter_add_device() argument
3803 dcb->acb = acb; in adapter_add_device()
3807 acb->dcb_run_robin = dcb; in adapter_add_device()
3810 list_add_tail(&dcb->list, &acb->dcb_list); in adapter_add_device()
3813 acb->dcb_map[dcb->target_id] |= (1 << dcb->target_lun); in adapter_add_device()
3814 acb->children[dcb->target_id][dcb->target_lun] = dcb; in adapter_add_device()
3828 struct DeviceCtlBlk *dcb) in adapter_remove_device() argument
3833 dcb->target_id, dcb->target_lun); in adapter_remove_device()
3836 if (acb->active_dcb == dcb) in adapter_remove_device()
3838 if (acb->dcb_run_robin == dcb) in adapter_remove_device()
3839 acb->dcb_run_robin = dcb_get_next(&acb->dcb_list, dcb); in adapter_remove_device()
3843 if (dcb == i) { in adapter_remove_device()
3849 acb->dcb_map[dcb->target_id] &= ~(1 << dcb->target_lun); in adapter_remove_device()
3850 acb->children[dcb->target_id][dcb->target_lun] = NULL; in adapter_remove_device()
3851 dcb->acb = NULL; in adapter_remove_device()
3863 struct DeviceCtlBlk *dcb) in adapter_remove_and_free_device() argument
3865 if (list_size(&dcb->srb_going_list) > 1) { in adapter_remove_and_free_device()
3868 dcb->target_id, dcb->target_lun, in adapter_remove_and_free_device()
3869 list_size(&dcb->srb_going_list)); in adapter_remove_and_free_device()
3872 adapter_remove_device(acb, dcb); in adapter_remove_and_free_device()
3873 kfree(dcb); in adapter_remove_and_free_device()
3885 struct DeviceCtlBlk *dcb; in adapter_remove_and_free_all_devices() local
3890 list_for_each_entry_safe(dcb, tmp, &acb->dcb_list, list) in adapter_remove_and_free_all_devices()
3891 adapter_remove_and_free_device(acb, dcb); in adapter_remove_and_free_all_devices()
3905 struct DeviceCtlBlk *dcb; in dc395x_slave_alloc() local
3907 dcb = device_alloc(acb, scsi_device->id, scsi_device->lun); in dc395x_slave_alloc()
3908 if (!dcb) in dc395x_slave_alloc()
3910 adapter_add_device(acb, dcb); in dc395x_slave_alloc()
3925 struct DeviceCtlBlk *dcb = find_dcb(acb, scsi_device->id, scsi_device->lun); in dc395x_slave_destroy() local
3926 if (dcb) in dc395x_slave_destroy()
3927 adapter_remove_and_free_device(acb, dcb); in dc395x_slave_destroy()
4631 struct DeviceCtlBlk *dcb; in dc395x_proc_info() local
4676 list_for_each_entry(dcb, &acb->dcb_list, list) { in dc395x_proc_info()
4678 SPRINTF("%02i %02i %02i ", dev, dcb->target_id, in dc395x_proc_info()
4679 dcb->target_lun); in dc395x_proc_info()
4680 YESNO(dcb->dev_mode & NTC_DO_PARITY_CHK); in dc395x_proc_info()
4681 YESNO(dcb->sync_offset); in dc395x_proc_info()
4682 YESNO(dcb->sync_period & WIDE_SYNC); in dc395x_proc_info()
4683 YESNO(dcb->dev_mode & NTC_DO_DISCONNECT); in dc395x_proc_info()
4684 YESNO(dcb->dev_mode & NTC_DO_SEND_START); in dc395x_proc_info()
4685 YESNO(dcb->sync_mode & EN_TAG_QUEUEING); in dc395x_proc_info()
4686 nego_period = clock_period[dcb->sync_period & 0x07] << 2; in dc395x_proc_info()
4687 if (dcb->sync_offset) in dc395x_proc_info()
4690 SPRINTF(" (%03i ns)", (dcb->min_nego_period << 2)); in dc395x_proc_info()
4692 if (dcb->sync_offset & 0x0f) { in dc395x_proc_info()
4697 (dcb->sync_offset & 0x0f)); in dc395x_proc_info()
4702 SPRINTF(" %02i\n", dcb->max_command); in dc395x_proc_info()
4711 list_for_each_entry(dcb, &acb->dcb_list, list) { in dc395x_proc_info()
4713 if (!list_empty(&dcb->srb_waiting_list)) in dc395x_proc_info()
4715 dcb->target_id, dcb->target_lun, in dc395x_proc_info()
4716 list_size(&dcb->srb_waiting_list)); in dc395x_proc_info()
4717 list_for_each_entry(srb, &dcb->srb_waiting_list, list) in dc395x_proc_info()
4719 if (!list_empty(&dcb->srb_going_list)) in dc395x_proc_info()
4721 dcb->target_id, dcb->target_lun, in dc395x_proc_info()
4722 list_size(&dcb->srb_going_list)); in dc395x_proc_info()
4723 list_for_each_entry(srb, &dcb->srb_going_list, list) in dc395x_proc_info()
4725 if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list)) in dc395x_proc_info()
4731 list_for_each_entry(dcb, &acb->dcb_list, list) { in dc395x_proc_info()
4732 SPRINTF("%p -> ", dcb); in dc395x_proc_info()