Lines Matching full:dcb

214 	struct DeviceCtlBlk *dcb;  member
254 struct list_head list; /* next/prev ptrs for the dcb list */
286 struct list_head dcb_list; /* head of going dcb list */
364 static u8 start_scsi(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
368 static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb,
376 static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
378 static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
381 struct DeviceCtlBlk *dcb);
701 /* find supplied dcb and then select the next one */ in dcb_get_next()
720 static void free_tag(struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) in free_tag() argument
723 dcb->tag_mask &= ~(1 << srb->tag_number); /* free tag mask */ in free_tag()
759 struct DeviceCtlBlk *dcb; in waiting_process_next() local
774 * Find the starting dcb. Need to find it again in the list in waiting_process_next()
777 list_for_each_entry(dcb, dcb_list_head, list) in waiting_process_next()
778 if (dcb == acb->dcb_run_robin) { in waiting_process_next()
779 start = dcb; in waiting_process_next()
790 * Loop over the dcb, but we start somewhere (potentially) in in waiting_process_next()
803 /* move to next dcb */ in waiting_process_next()
833 /* Get the DCB for a given ID/LUN combination */
843 struct DeviceCtlBlk *dcb = srb->dcb; in send_srb() local
845 if (dcb->max_command <= list_size(&dcb->srb_going_list) || in send_srb()
848 list_add_tail(&srb->list, &dcb->srb_waiting_list); in send_srb()
853 if (!start_scsi(acb, dcb, srb)) { in send_srb()
854 list_add_tail(&srb->list, &dcb->srb_going_list); in send_srb()
856 list_add(&srb->list, &dcb->srb_waiting_list); in send_srb()
861 /* Prepare SRB for being sent to Device DCB w/ command *cmd */
862 static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb, in build_srb() argument
868 cmd, dcb->target_id, dcb->target_lun); in build_srb()
870 srb->dcb = dcb; in build_srb()
927 if (dcb->sync_period & WIDE_SYNC && in build_srb()
933 srb->sg_bus_addr = dma_map_single(&dcb->acb->dev->dev, in build_srb()
965 struct DeviceCtlBlk *dcb; in dc395x_queue_command_lck() local
989 /* do we have a DCB for the device */ in dc395x_queue_command_lck()
990 dcb = find_dcb(acb, cmd->device->id, cmd->device->lun); in dc395x_queue_command_lck()
991 if (!dcb) { in dc395x_queue_command_lck()
1013 build_srb(cmd, dcb, srb); in dc395x_queue_command_lck()
1015 if (!list_empty(&dcb->srb_waiting_list)) { in dc395x_queue_command_lck()
1017 list_add_tail(&srb->list, &dcb->srb_waiting_list); in dc395x_queue_command_lck()
1040 struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb) in DEF_SCSI_QCMD()
1045 if (!dcb) in DEF_SCSI_QCMD()
1046 dcb = acb->active_dcb; in DEF_SCSI_QCMD()
1047 if (!srb && dcb) in DEF_SCSI_QCMD()
1048 srb = dcb->active_srb; in DEF_SCSI_QCMD()
1121 struct DeviceCtlBlk *dcb; in reset_dev_param() local
1125 list_for_each_entry(dcb, &acb->dcb_list, list) { in reset_dev_param()
1128 dcb->sync_mode &= ~(SYNC_NEGO_DONE + WIDE_NEGO_DONE); in reset_dev_param()
1129 dcb->sync_period = 0; in reset_dev_param()
1130 dcb->sync_offset = 0; in reset_dev_param()
1132 dcb->dev_mode = eeprom->target[dcb->target_id].cfg0; in reset_dev_param()
1133 period_index = eeprom->target[dcb->target_id].period & 0x07; in reset_dev_param()
1134 dcb->min_nego_period = clock_period[period_index]; in reset_dev_param()
1135 if (!(dcb->dev_mode & NTC_DO_WIDE_NEGO) in reset_dev_param()
1137 dcb->sync_mode &= ~WIDE_NEGO_ENABLE; in reset_dev_param()
1217 struct DeviceCtlBlk *dcb; in dc395x_eh_abort() local
1222 dcb = find_dcb(acb, cmd->device->id, cmd->device->lun); in dc395x_eh_abort()
1223 if (!dcb) { in dc395x_eh_abort()
1228 srb = find_cmd(cmd, &dcb->srb_waiting_list); in dc395x_eh_abort()
1233 free_tag(dcb, srb); in dc395x_eh_abort()
1239 srb = find_cmd(cmd, &dcb->srb_going_list); in dc395x_eh_abort()
1251 static void build_sdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in build_sdtr() argument
1262 if (!(dcb->dev_mode & NTC_DO_SYNC_NEGO)) { in build_sdtr()
1263 dcb->sync_offset = 0; in build_sdtr()
1264 dcb->min_nego_period = 200 >> 2; in build_sdtr()
1265 } else if (dcb->sync_offset == 0) in build_sdtr()
1266 dcb->sync_offset = SYNC_NEGO_OFFSET; in build_sdtr()
1268 srb->msg_count += spi_populate_sync_msg(ptr, dcb->min_nego_period, in build_sdtr()
1269 dcb->sync_offset); in build_sdtr()
1275 static void build_wdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in build_wdtr() argument
1278 u8 wide = ((dcb->dev_mode & NTC_DO_WIDE_NEGO) & in build_wdtr()
1332 static u8 start_scsi(struct AdapterCtlBlk* acb, struct DeviceCtlBlk* dcb, in start_scsi() argument
1339 dcb->target_id, dcb->target_lun, srb); in start_scsi()
1386 DC395x_write8(acb, TRM_S1040_SCSI_TARGETID, dcb->target_id); in start_scsi()
1387 DC395x_write8(acb, TRM_S1040_SCSI_SYNC, dcb->sync_period); in start_scsi()
1388 DC395x_write8(acb, TRM_S1040_SCSI_OFFSET, dcb->sync_offset); in start_scsi()
1391 identify_message = dcb->identify_msg; in start_scsi()
1400 && (((dcb->sync_mode & WIDE_NEGO_ENABLE) in start_scsi()
1401 && !(dcb->sync_mode & WIDE_NEGO_DONE)) in start_scsi()
1402 || ((dcb->sync_mode & SYNC_NEGO_ENABLE) in start_scsi()
1403 && !(dcb->sync_mode & SYNC_NEGO_DONE))) in start_scsi()
1404 && (dcb->target_lun == 0)) { in start_scsi()
1410 if (dcb->sync_mode & WIDE_NEGO_ENABLE in start_scsi()
1411 && dcb->inquiry7 & SCSI_INQ_WBUS16) { in start_scsi()
1412 build_wdtr(acb, dcb, srb); in start_scsi()
1416 if (dcb->sync_mode & SYNC_NEGO_ENABLE in start_scsi()
1417 && dcb->inquiry7 & SCSI_INQ_SYNC) { in start_scsi()
1418 build_sdtr(acb, dcb, srb); in start_scsi()
1421 if (dcb->sync_mode & WIDE_NEGO_ENABLE in start_scsi()
1422 && dcb->inquiry7 & SCSI_INQ_WBUS16) { in start_scsi()
1423 build_wdtr(acb, dcb, srb); in start_scsi()
1434 if ((dcb->sync_mode & EN_TAG_QUEUEING) in start_scsi()
1439 while (tag_mask & dcb->tag_mask in start_scsi()
1440 && tag_number < dcb->max_command) { in start_scsi()
1444 if (tag_number >= dcb->max_command) { in start_scsi()
1457 dcb->tag_mask |= tag_mask; in start_scsi()
1470 DC395x_write8(acb, TRM_S1040_SCSI_FIFO, (dcb->target_lun << 5)); in start_scsi()
1490 srb->cmd, dcb->target_id, dcb->target_lun); in start_scsi()
1492 free_tag(dcb, srb); in start_scsi()
1502 dcb->active_srb = srb; in start_scsi()
1503 acb->active_dcb = dcb; in start_scsi()
1542 struct DeviceCtlBlk *dcb; in dc395x_handle_interrupt() local
1583 dcb = acb->active_dcb; in dc395x_handle_interrupt()
1584 if (!dcb) { in dc395x_handle_interrupt()
1590 srb = dcb->active_srb; in dc395x_handle_interrupt()
1591 if (dcb->flag & ABORT_DEV_) { in dc395x_handle_interrupt()
1739 struct DeviceCtlBlk *dcb; in command_phase1() local
1754 dcb = acb->active_dcb; in command_phase1()
1756 DC395x_write8(acb, TRM_S1040_SCSI_FIFO, (dcb->target_lun << 5)); in command_phase1()
1816 dma_sync_single_for_cpu(&srb->dcb->acb->dev->dev, in sg_update_list()
1822 dma_sync_single_for_device(&srb->dcb->acb->dev->dev, in sg_update_list()
1882 struct DeviceCtlBlk *dcb = srb->dcb; in data_out_phase0() local
1928 if (dcb->sync_period & WIDE_SYNC) in data_out_phase0()
1935 (dcb->sync_period & WIDE_SYNC) ? "words" : "bytes", in data_out_phase0()
1958 if (d_left_counter == 1 && dcb->sync_period & WIDE_SYNC in data_out_phase0()
1986 (dcb->sync_period & WIDE_SYNC) ? 2 : 1; in data_out_phase0()
2086 << ((srb->dcb->sync_period & WIDE_SYNC) ? 1 : in data_in_phase0()
2093 (srb->dcb->sync_period & WIDE_SYNC) ? "words" : "bytes", in data_in_phase0()
2110 (srb->dcb->sync_period & WIDE_SYNC) ? in data_in_phase0()
2113 if (srb->dcb->sync_period & WIDE_SYNC) in data_in_phase0()
2154 if (fc == 0x40 && (srb->dcb->sync_period & WIDE_SYNC)) { in data_in_phase0()
2191 if (srb->dcb->sync_period & WIDE_SYNC) in data_in_phase0()
2247 struct DeviceCtlBlk *dcb = srb->dcb; in data_io_transfer() local
2270 dump_register_info(acb, dcb, srb); in data_io_transfer()
2330 if (srb->dcb->sync_period & WIDE_SYNC) in data_io_transfer()
2360 if (srb->dcb->sync_period & WIDE_SYNC) { in data_io_transfer()
2386 if (dcb->sync_period & WIDE_SYNC) { in data_io_transfer()
2469 srb->dcb->target_id, srb->dcb->target_lun); in msgin_reject()
2474 struct DeviceCtlBlk *dcb, u8 tag) in msgin_qtag() argument
2481 if (!(dcb->tag_mask & (1 << tag))) in msgin_qtag()
2484 dcb->tag_mask, tag); in msgin_qtag()
2486 if (list_empty(&dcb->srb_going_list)) in msgin_qtag()
2488 list_for_each_entry(i, &dcb->srb_going_list, list) { in msgin_qtag()
2498 srb->cmd, srb->dcb->target_id, srb->dcb->target_lun); in msgin_qtag()
2499 if (dcb->flag & ABORT_DEV_) { in msgin_qtag()
2507 memcpy(srb->msgin_buf, dcb->active_srb->msgin_buf, acb->msg_len); in msgin_qtag()
2508 srb->state |= dcb->active_srb->state; in msgin_qtag()
2510 dcb->active_srb = srb; in msgin_qtag()
2517 dcb->active_srb = srb; in msgin_qtag()
2527 struct DeviceCtlBlk *dcb) in reprogram_regs() argument
2529 DC395x_write8(acb, TRM_S1040_SCSI_TARGETID, dcb->target_id); in reprogram_regs()
2530 DC395x_write8(acb, TRM_S1040_SCSI_SYNC, dcb->sync_period); in reprogram_regs()
2531 DC395x_write8(acb, TRM_S1040_SCSI_OFFSET, dcb->sync_offset); in reprogram_regs()
2532 set_xfer_rate(acb, dcb); in reprogram_regs()
2539 struct DeviceCtlBlk *dcb = srb->dcb; in msgin_set_async() local
2541 dcb->target_id, dcb->target_lun); in msgin_set_async()
2543 dcb->sync_mode &= ~(SYNC_NEGO_ENABLE); in msgin_set_async()
2544 dcb->sync_mode |= SYNC_NEGO_DONE; in msgin_set_async()
2545 /*dcb->sync_period &= 0; */ in msgin_set_async()
2546 dcb->sync_offset = 0; in msgin_set_async()
2547 dcb->min_nego_period = 200 >> 2; /* 200ns <=> 5 MHz */ in msgin_set_async()
2549 reprogram_regs(acb, dcb); in msgin_set_async()
2550 if ((dcb->sync_mode & WIDE_NEGO_ENABLE) in msgin_set_async()
2551 && !(dcb->sync_mode & WIDE_NEGO_DONE)) { in msgin_set_async()
2552 build_wdtr(acb, dcb, srb); in msgin_set_async()
2562 struct DeviceCtlBlk *dcb = srb->dcb; in msgin_set_sync() local
2567 dcb->target_id, srb->msgin_buf[3] << 2, in msgin_set_sync()
2574 if (!(dcb->dev_mode & NTC_DO_SYNC_NEGO)) in msgin_set_sync()
2575 dcb->sync_offset = 0; in msgin_set_sync()
2576 else if (dcb->sync_offset == 0) in msgin_set_sync()
2577 dcb->sync_offset = srb->msgin_buf[4]; in msgin_set_sync()
2578 if (srb->msgin_buf[4] > dcb->sync_offset) in msgin_set_sync()
2579 srb->msgin_buf[4] = dcb->sync_offset; in msgin_set_sync()
2581 dcb->sync_offset = srb->msgin_buf[4]; in msgin_set_sync()
2584 || dcb->min_nego_period > in msgin_set_sync()
2592 dcb->sync_period &= 0xf0; in msgin_set_sync()
2593 dcb->sync_period |= ALT_SYNC | bval; in msgin_set_sync()
2594 dcb->min_nego_period = srb->msgin_buf[3]; in msgin_set_sync()
2596 if (dcb->sync_period & WIDE_SYNC) in msgin_set_sync()
2603 dcb->target_id, (fact == 500) ? "Wide16" : "", in msgin_set_sync()
2604 dcb->min_nego_period << 2, dcb->sync_offset, in msgin_set_sync()
2605 (fact / dcb->min_nego_period), in msgin_set_sync()
2606 ((fact % dcb->min_nego_period) * 10 + in msgin_set_sync()
2607 dcb->min_nego_period / 2) / dcb->min_nego_period); in msgin_set_sync()
2617 dcb->sync_mode |= SYNC_NEGO_DONE; in msgin_set_sync()
2619 if ((dcb->sync_mode & WIDE_NEGO_ENABLE) in msgin_set_sync()
2620 && !(dcb->sync_mode & WIDE_NEGO_DONE)) { in msgin_set_sync()
2621 build_wdtr(acb, dcb, srb); in msgin_set_sync()
2627 dcb->sync_mode |= SYNC_NEGO_DONE | SYNC_NEGO_ENABLE; in msgin_set_sync()
2629 reprogram_regs(acb, dcb); in msgin_set_sync()
2636 struct DeviceCtlBlk *dcb = srb->dcb; in msgin_set_nowide() local
2637 dprintkdbg(DBG_1, "msgin_set_nowide: <%02i>\n", dcb->target_id); in msgin_set_nowide()
2639 dcb->sync_period &= ~WIDE_SYNC; in msgin_set_nowide()
2640 dcb->sync_mode &= ~(WIDE_NEGO_ENABLE); in msgin_set_nowide()
2641 dcb->sync_mode |= WIDE_NEGO_DONE; in msgin_set_nowide()
2643 reprogram_regs(acb, dcb); in msgin_set_nowide()
2644 if ((dcb->sync_mode & SYNC_NEGO_ENABLE) in msgin_set_nowide()
2645 && !(dcb->sync_mode & SYNC_NEGO_DONE)) { in msgin_set_nowide()
2646 build_sdtr(acb, dcb, srb); in msgin_set_nowide()
2654 struct DeviceCtlBlk *dcb = srb->dcb; in msgin_set_wide() local
2655 u8 wide = (dcb->dev_mode & NTC_DO_WIDE_NEGO in msgin_set_wide()
2657 dprintkdbg(DBG_1, "msgin_set_wide: <%02i>\n", dcb->target_id); in msgin_set_wide()
2665 dcb->target_id); in msgin_set_wide()
2672 dcb->sync_mode |= (WIDE_NEGO_ENABLE | WIDE_NEGO_DONE); in msgin_set_wide()
2674 dcb->sync_period |= WIDE_SYNC; in msgin_set_wide()
2676 dcb->sync_period &= ~WIDE_SYNC; in msgin_set_wide()
2678 /*dcb->sync_mode &= ~(WIDE_NEGO_ENABLE+WIDE_NEGO_DONE); */ in msgin_set_wide()
2681 (8 << srb->msgin_buf[3]), dcb->target_id); in msgin_set_wide()
2682 reprogram_regs(acb, dcb); in msgin_set_wide()
2683 if ((dcb->sync_mode & SYNC_NEGO_ENABLE) in msgin_set_wide()
2684 && !(dcb->sync_mode & SYNC_NEGO_DONE)) { in msgin_set_wide()
2685 build_sdtr(acb, dcb, srb); in msgin_set_wide()
2707 struct DeviceCtlBlk *dcb = acb->active_dcb; in msgin_phase0() local
2722 msgin_qtag(acb, dcb, in msgin_phase0()
2786 srb->cmd, dcb->target_id, in msgin_phase0()
2787 dcb->target_lun); in msgin_phase0()
2788 dcb->flag |= ABORT_DEV_; in msgin_phase0()
2797 srb->msgout_buf[0] = dcb->identify_msg; in msgin_phase0()
2843 static void set_xfer_rate(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb) in set_xfer_rate() argument
2848 if (dcb->identify_msg & 0x07) in set_xfer_rate()
2852 current_sync_offset = dcb->sync_offset; in set_xfer_rate()
2857 if (i->target_id == dcb->target_id) { in set_xfer_rate()
2858 i->sync_period = dcb->sync_period; in set_xfer_rate()
2859 i->sync_offset = dcb->sync_offset; in set_xfer_rate()
2860 i->sync_mode = dcb->sync_mode; in set_xfer_rate()
2861 i->min_nego_period = dcb->min_nego_period; in set_xfer_rate()
2868 struct DeviceCtlBlk *dcb = acb->active_dcb; in disconnect() local
2871 if (!dcb) { in disconnect()
2882 srb = dcb->active_srb; in disconnect()
2892 dcb->target_id, dcb->target_lun); in disconnect()
2896 dcb->flag &= ~ABORT_DEV_; in disconnect()
2922 dcb->target_id, dcb->target_lun); in disconnect()
2929 free_tag(dcb, srb); in disconnect()
2930 list_move(&srb->list, &dcb->srb_waiting_list); in disconnect()
2953 free_tag(dcb, srb); in disconnect()
2954 dcb->active_srb = NULL; in disconnect()
2956 srb_done(acb, dcb, srb); in disconnect()
2964 struct DeviceCtlBlk *dcb = acb->active_dcb; in reselect() local
2974 if (dcb) { /* Arbitration lost but Reselection win */ in reselect()
2975 srb = dcb->active_srb; in reselect()
2986 srb->cmd, dcb->target_id, in reselect()
2987 dcb->target_lun, rsel_tar_lun_id, in reselect()
2992 free_tag(dcb, srb); in reselect()
2993 list_move(&srb->list, &dcb->srb_waiting_list); in reselect()
3005 dcb = find_dcb(acb, id, lun); in reselect()
3006 if (!dcb) { in reselect()
3012 acb->active_dcb = dcb; in reselect()
3014 if (!(dcb->dev_mode & NTC_DO_DISCONNECT)) in reselect()
3017 dcb->target_id, dcb->target_lun); in reselect()
3019 if (dcb->sync_mode & EN_TAG_QUEUEING) { in reselect()
3021 dcb->active_srb = srb; in reselect()
3024 srb = dcb->active_srb; in reselect()
3031 dcb->target_id, dcb->target_lun); in reselect()
3034 dcb->active_srb = srb; in reselect()
3037 if (dcb->flag & ABORT_DEV_) { in reselect()
3048 dprintkdbg(DBG_0, "reselect: select <%i>\n", dcb->target_id); in reselect()
3050 DC395x_write8(acb, TRM_S1040_SCSI_TARGETID, dcb->target_id); /* target ID */ in reselect()
3051 DC395x_write8(acb, TRM_S1040_SCSI_OFFSET, dcb->sync_offset); /* offset */ in reselect()
3052 DC395x_write8(acb, TRM_S1040_SCSI_SYNC, dcb->sync_period); /* sync period, wide */ in reselect()
3075 static void disc_tagq_set(struct DeviceCtlBlk *dcb, struct ScsiInqData *ptr) in disc_tagq_set() argument
3080 && (dcb->dev_mode & NTC_DO_TAG_QUEUEING) && in disc_tagq_set()
3081 /*(dcb->dev_mode & NTC_DO_DISCONNECT) */ in disc_tagq_set()
3082 /* ((dcb->dev_type == TYPE_DISK) in disc_tagq_set()
3083 || (dcb->dev_type == TYPE_MOD)) && */ in disc_tagq_set()
3085 if (dcb->max_command == 1) in disc_tagq_set()
3086 dcb->max_command = in disc_tagq_set()
3087 dcb->acb->tag_max_num; in disc_tagq_set()
3088 dcb->sync_mode |= EN_TAG_QUEUEING; in disc_tagq_set()
3089 /*dcb->tag_mask = 0; */ in disc_tagq_set()
3091 dcb->max_command = 1; in disc_tagq_set()
3096 static void add_dev(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in add_dev() argument
3100 dcb->dev_type = bval1; in add_dev()
3102 disc_tagq_set(dcb, ptr); in add_dev()
3150 static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in srb_done() argument
3180 cmd->cmnd[0], dcb->target_id, in srb_done()
3181 dcb->target_lun, status, acb->scan_devices); in srb_done()
3186 cmd->cmnd[0], dcb->target_id, in srb_done()
3187 dcb->target_lun, status, acb->scan_devices); in srb_done()
3192 cmd->cmnd[0], dcb->target_id, in srb_done()
3193 dcb->target_lun, status, acb->scan_devices); in srb_done()
3198 cmd->cmnd[0], dcb->target_id, in srb_done()
3199 dcb->target_lun, status, acb->scan_devices); in srb_done()
3204 cmd->cmnd[0], dcb->target_id, in srb_done()
3205 dcb->target_lun, status, acb->scan_devices); in srb_done()
3238 request_sense(acb, dcb, srb); in srb_done()
3241 tempcnt = (u8)list_size(&dcb->srb_going_list); in srb_done()
3243 dcb->target_id, dcb->target_lun, tempcnt); in srb_done()
3246 dcb->max_command = tempcnt; in srb_done()
3247 free_tag(dcb, srb); in srb_done()
3248 list_move(&srb->list, &dcb->srb_waiting_list); in srb_done()
3299 dcb->inquiry7 = ptr->Flags; in srb_done()
3305 if (!dcb->init_tcq_flag) { in srb_done()
3306 add_dev(acb, dcb, ptr); in srb_done()
3307 dcb->init_tcq_flag = 1; in srb_done()
3343 struct DeviceCtlBlk *dcb; in doing_srb_done() local
3346 list_for_each_entry(dcb, &acb->dcb_list, list) { in doing_srb_done()
3351 list_for_each_entry_safe(srb, tmp, &dcb->srb_going_list, list) { in doing_srb_done()
3356 free_tag(dcb, srb); in doing_srb_done()
3368 if (!list_empty(&dcb->srb_going_list)) in doing_srb_done()
3371 dcb->target_id, dcb->target_lun); in doing_srb_done()
3372 if (dcb->tag_mask) in doing_srb_done()
3375 dcb->target_id, dcb->target_lun, in doing_srb_done()
3376 dcb->tag_mask); in doing_srb_done()
3379 list_for_each_entry_safe(srb, tmp, &dcb->srb_waiting_list, list) { in doing_srb_done()
3395 if (!list_empty(&dcb->srb_waiting_list)) in doing_srb_done()
3397 list_size(&dcb->srb_waiting_list), dcb->target_id, in doing_srb_done()
3398 dcb->target_lun); in doing_srb_done()
3399 dcb->flag &= ~ABORT_DEV_; in doing_srb_done()
3487 static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, in request_sense() argument
3520 if (start_scsi(acb, dcb, srb)) { /* Should only happen, if sb. else grabs the bus */ in request_sense()
3523 srb->cmd, dcb->target_id, dcb->target_lun); in request_sense()
3524 list_move(&srb->list, &dcb->srb_waiting_list); in request_sense()
3548 struct DeviceCtlBlk *dcb; in device_alloc() local
3550 dcb = kmalloc(sizeof(struct DeviceCtlBlk), GFP_ATOMIC); in device_alloc()
3552 if (!dcb) in device_alloc()
3554 dcb->acb = NULL; in device_alloc()
3555 INIT_LIST_HEAD(&dcb->srb_going_list); in device_alloc()
3556 INIT_LIST_HEAD(&dcb->srb_waiting_list); in device_alloc()
3557 dcb->active_srb = NULL; in device_alloc()
3558 dcb->tag_mask = 0; in device_alloc()
3559 dcb->max_command = 1; in device_alloc()
3560 dcb->target_id = target; in device_alloc()
3561 dcb->target_lun = lun; in device_alloc()
3562 dcb->dev_mode = eeprom->target[target].cfg0; in device_alloc()
3564 dcb->identify_msg = in device_alloc()
3565 IDENTIFY(dcb->dev_mode & NTC_DO_DISCONNECT, lun); in device_alloc()
3567 dcb->identify_msg = IDENTIFY(0, lun); in device_alloc()
3569 dcb->inquiry7 = 0; in device_alloc()
3570 dcb->sync_mode = 0; in device_alloc()
3571 dcb->min_nego_period = clock_period[period_index]; in device_alloc()
3572 dcb->sync_period = 0; in device_alloc()
3573 dcb->sync_offset = 0; in device_alloc()
3574 dcb->flag = 0; in device_alloc()
3577 if ((dcb->dev_mode & NTC_DO_WIDE_NEGO) in device_alloc()
3579 dcb->sync_mode |= WIDE_NEGO_ENABLE; in device_alloc()
3582 if (dcb->dev_mode & NTC_DO_SYNC_NEGO) in device_alloc()
3584 dcb->sync_mode |= SYNC_NEGO_ENABLE; in device_alloc()
3586 if (dcb->target_lun != 0) { in device_alloc()
3591 if (iter->target_id == dcb->target_id) { in device_alloc()
3597 kfree(dcb); in device_alloc()
3603 dcb->target_id, dcb->target_lun, in device_alloc()
3605 dcb->sync_mode = p->sync_mode; in device_alloc()
3606 dcb->sync_period = p->sync_period; in device_alloc()
3607 dcb->min_nego_period = p->min_nego_period; in device_alloc()
3608 dcb->sync_offset = p->sync_offset; in device_alloc()
3609 dcb->inquiry7 = p->inquiry7; in device_alloc()
3611 return dcb; in device_alloc()
3619 * @dcb: A newly created and initialised device instance to add.
3622 struct DeviceCtlBlk *dcb) in adapter_add_device() argument
3625 dcb->acb = acb; in adapter_add_device()
3629 acb->dcb_run_robin = dcb; in adapter_add_device()
3632 list_add_tail(&dcb->list, &acb->dcb_list); in adapter_add_device()
3635 acb->dcb_map[dcb->target_id] |= (1 << dcb->target_lun); in adapter_add_device()
3636 acb->children[dcb->target_id][dcb->target_lun] = dcb; in adapter_add_device()
3647 * @dcb: A device that has previously been added to the adapter.
3650 struct DeviceCtlBlk *dcb) in adapter_remove_device() argument
3655 dcb->target_id, dcb->target_lun); in adapter_remove_device()
3658 if (acb->active_dcb == dcb) in adapter_remove_device()
3660 if (acb->dcb_run_robin == dcb) in adapter_remove_device()
3661 acb->dcb_run_robin = dcb_get_next(&acb->dcb_list, dcb); in adapter_remove_device()
3665 if (dcb == i) { in adapter_remove_device()
3671 acb->dcb_map[dcb->target_id] &= ~(1 << dcb->target_lun); in adapter_remove_device()
3672 acb->children[dcb->target_id][dcb->target_lun] = NULL; in adapter_remove_device()
3673 dcb->acb = NULL; in adapter_remove_device()
3682 * @dcb: A device that has previously been added to the adapter.
3685 struct DeviceCtlBlk *dcb) in adapter_remove_and_free_device() argument
3687 if (list_size(&dcb->srb_going_list) > 1) { in adapter_remove_and_free_device()
3690 dcb->target_id, dcb->target_lun, in adapter_remove_and_free_device()
3691 list_size(&dcb->srb_going_list)); in adapter_remove_and_free_device()
3694 adapter_remove_device(acb, dcb); in adapter_remove_and_free_device()
3695 kfree(dcb); in adapter_remove_and_free_device()
3707 struct DeviceCtlBlk *dcb; in adapter_remove_and_free_all_devices() local
3712 list_for_each_entry_safe(dcb, tmp, &acb->dcb_list, list) in adapter_remove_and_free_all_devices()
3713 adapter_remove_and_free_device(acb, dcb); in adapter_remove_and_free_all_devices()
3727 struct DeviceCtlBlk *dcb; in dc395x_slave_alloc() local
3729 dcb = device_alloc(acb, scsi_device->id, scsi_device->lun); in dc395x_slave_alloc()
3730 if (!dcb) in dc395x_slave_alloc()
3732 adapter_add_device(acb, dcb); in dc395x_slave_alloc()
3747 struct DeviceCtlBlk *dcb = find_dcb(acb, scsi_device->id, scsi_device->lun); in dc395x_slave_destroy() local
3748 if (dcb) in dc395x_slave_destroy()
3749 adapter_remove_and_free_device(acb, dcb); in dc395x_slave_destroy()
4365 "size{acb=0x%04x dcb=0x%04x srb=0x%04x}\n", in adapter_init()
4444 struct DeviceCtlBlk *dcb; in dc395x_show_info() local
4478 list_for_each_entry(dcb, &acb->dcb_list, list) { in dc395x_show_info()
4480 seq_printf(m, "%02i %02i %02i ", dev, dcb->target_id, in dc395x_show_info()
4481 dcb->target_lun); in dc395x_show_info()
4482 YESNO(dcb->dev_mode & NTC_DO_PARITY_CHK); in dc395x_show_info()
4483 YESNO(dcb->sync_offset); in dc395x_show_info()
4484 YESNO(dcb->sync_period & WIDE_SYNC); in dc395x_show_info()
4485 YESNO(dcb->dev_mode & NTC_DO_DISCONNECT); in dc395x_show_info()
4486 YESNO(dcb->dev_mode & NTC_DO_SEND_START); in dc395x_show_info()
4487 YESNO(dcb->sync_mode & EN_TAG_QUEUEING); in dc395x_show_info()
4488 nego_period = clock_period[dcb->sync_period & 0x07] << 2; in dc395x_show_info()
4489 if (dcb->sync_offset) in dc395x_show_info()
4492 seq_printf(m, " (%03i ns)", (dcb->min_nego_period << 2)); in dc395x_show_info()
4494 if (dcb->sync_offset & 0x0f) { in dc395x_show_info()
4499 (dcb->sync_offset & 0x0f)); in dc395x_show_info()
4504 seq_printf(m, " %02i\n", dcb->max_command); in dc395x_show_info()
4513 list_for_each_entry(dcb, &acb->dcb_list, list) { in dc395x_show_info()
4515 if (!list_empty(&dcb->srb_waiting_list)) in dc395x_show_info()
4516 seq_printf(m, "DCB (%02i-%i): Waiting: %i:", in dc395x_show_info()
4517 dcb->target_id, dcb->target_lun, in dc395x_show_info()
4518 list_size(&dcb->srb_waiting_list)); in dc395x_show_info()
4519 list_for_each_entry(srb, &dcb->srb_waiting_list, list) in dc395x_show_info()
4521 if (!list_empty(&dcb->srb_going_list)) in dc395x_show_info()
4523 dcb->target_id, dcb->target_lun, in dc395x_show_info()
4524 list_size(&dcb->srb_going_list)); in dc395x_show_info()
4525 list_for_each_entry(srb, &dcb->srb_going_list, list) in dc395x_show_info()
4527 if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list)) in dc395x_show_info()
4532 seq_printf(m, "DCB list for ACB %p:\n", acb); in dc395x_show_info()
4533 list_for_each_entry(dcb, &acb->dcb_list, list) { in dc395x_show_info()
4534 seq_printf(m, "%p -> ", dcb); in dc395x_show_info()