Lines Matching refs:scb

140 					struct scb *scb);
143 struct scb *scb);
179 struct scb *scb);
192 struct scb *scb, u_int col_idx);
194 struct scb *scb);
197 struct scb *prev_scb,
198 struct scb *scb);
229 struct scb *scb,
230 struct scb *other_scb);
232 struct scb *scb);
234 struct scb *scb);
380 struct scb *scb;
399 scb = ahd_lookup_scb(ahd, scbid);
400 if (scb == NULL) {
418 if (ahd_scb_active_in_fifo(ahd, scb) == 0)
421 ahd_run_data_fifo(ahd, scb);
474 ahd_complete_scb(ahd, scb);
524 scb = ahd_lookup_scb(ahd, scbid);
525 if (scb == NULL) {
531 hscb_ptr = (uint8_t *)scb->hscb;
535 ahd_complete_scb(ahd, scb);
546 scb = ahd_lookup_scb(ahd, scbid);
547 if (scb == NULL) {
554 ahd_complete_scb(ahd, scb);
564 scb = ahd_lookup_scb(ahd, scbid);
565 if (scb == NULL) {
572 ahd_complete_scb(ahd, scb);
590 ahd_scb_active_in_fifo(struct ahd_softc *ahd, struct scb *scb)
599 if (ahd_get_scbptr(ahd) != SCB_GET_TAG(scb)
619 ahd_run_data_fifo(struct ahd_softc *ahd, struct scb *scb)
773 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
780 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
856 struct scb *scb;
870 scb = ahd_lookup_scb(ahd, scb_index);
871 if (scb == NULL) {
872 printf("%s: WARNING no command for scb %d "
879 ahd_handle_scb_status(ahd, scb);
881 ahd_done(ahd, scb);
956 struct scb *scb;
962 scb = ahd_lookup_scb(ahd, scbid);
963 if (scb == NULL) {
971 ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid);
972 ahd_outb(ahd, SAVED_LUN, scb->hscb->lun);
1003 struct scb *scb;
1007 scb = ahd_lookup_scb(ahd, scbid);
1008 if (scb != NULL)
1009 ahd_print_path(ahd, scb);
1020 struct scb *scb;
1024 scb = ahd_lookup_scb(ahd, scbid);
1025 if (scb == NULL) {
1031 ahd_outq(ahd, HADDR, scb->sense_busaddr);
1061 struct scb *scb;
1079 scb = ahd_lookup_scb(ahd, scbid);
1080 if (scb == NULL) {
1088 ahd_compile_devinfo(&devinfo, SCB_GET_OUR_ID(scb),
1089 SCB_GET_TARGET(ahd, scb),
1090 SCB_GET_LUN(scb),
1091 SCB_GET_CHANNEL(ahd, scb),
1111 scb->hscb->control &= ~(TAG_ENB|SCB_TAG_TYPE);
1112 scb->hscb->control |= MK_MESSAGE;
1113 ahd_outb(ahd, SCB_CONTROL, scb->hscb->control);
1115 ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid);
1123 scb->flags &= ~SCB_PACKETIZED;
1124 scb->flags |= SCB_ABORT|SCB_CMDPHASE_ABORT;
1125 ahd_freeze_devq(ahd, scb);
1126 aic_set_transaction_status(scb, CAM_REQUEUE_REQ);
1127 aic_freeze_scb(scb);
1140 ahd_print_path(ahd, scb);
1153 struct scb *scb;
1163 scb = ahd_lookup_scb(ahd, scb_index);
1164 if (scb == NULL) {
1220 struct scb *scb;
1241 scb = ahd_lookup_scb(ahd, scb_index);
1246 scb);
1263 scb);
1359 struct scb *scb;
1366 scb = ahd_lookup_scb(ahd, scbindex);
1370 ahd_print_path(ahd, scb);
1373 SCB_GET_TAG(scb));
1374 ahd_print_path(ahd, scb);
1379 aic_get_transfer_length(scb), scb->sg_count);
1380 ahd_dump_sglist(scb);
1388 ahd_freeze_devq(ahd, scb);
1389 aic_set_transaction_status(scb, CAM_DATA_RUN_ERR);
1390 aic_freeze_scb(scb);
1396 struct scb *scb;
1404 scb = ahd_lookup_scb(ahd, scbid);
1406 if (scb != NULL
1407 && (scb->flags & SCB_RECOVERY_SCB) != 0)
1412 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb),
1413 SCB_GET_CHANNEL(ahd, scb),
1414 SCB_GET_LUN(scb), SCB_GET_TAG(scb),
1424 struct scb *scb;
1427 scb = ahd_lookup_scb(ahd, scbid);
1428 if (scb != NULL) {
1433 ahd_print_path(ahd, scb);
1435 scb->hscb->task_management);
1439 switch (scb->hscb->task_management) {
1441 tag = SCB_GET_TAG(scb);
1444 lun = scb->hscb->lun;
1446 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb),
1451 lun = scb->hscb->lun;
1456 ahd_scb_devinfo(ahd, &devinfo, scb);
1476 struct scb *scb;
1483 scb = ahd_lookup_scb(ahd, scbid);
1484 if (scb != NULL) {
1489 ahd_print_path(ahd, scb);
1503 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb),
1504 SCB_GET_CHANNEL(ahd, scb),
1505 SCB_GET_LUN(scb), SCB_GET_TAG(scb),
1539 struct scb *scb;
1566 scb = ahd_lookup_scb(ahd, scbid);
1567 if (scb != NULL
1569 scb = NULL;
1634 scb = ahd_lookup_scb(ahd, scbid);
1635 if (scb == NULL) {
1636 printf("%s: ahd_intr - referenced scb not "
1637 "valid during SELTO scb(0x%x)\n",
1645 ahd_print_path(ahd, scb);
1650 ahd_scb_devinfo(ahd, &devinfo, scb);
1651 aic_set_transaction_status(scb, CAM_SEL_TIMEOUT);
1652 ahd_freeze_devq(ahd, scb);
1723 struct scb *scb;
1729 scb = ahd_lookup_scb(ahd, scbid);
1730 if (scb == NULL) {
1737 packetized = (scb->flags & SCB_PACKETIZED) != 0;
1817 struct scb *scb;
1828 scb = NULL;
1867 scb = ahd_lookup_scb(ahd, scbid);
1868 if (scb != NULL && SCB_IS_SILENT(scb))
1966 if (scb == NULL) {
1998 if (scb != NULL && msg_out == MSG_INITIATOR_DET_ERR)
1999 scb->flags |= SCB_TRANSMISSION_ERROR;
2059 struct scb *scb;
2083 scb = ahd_lookup_scb(ahd, scbid);
2084 if (scb == NULL)
2125 if (scb->crc_retry_count < AHD_MAX_LQ_CRC_ERRORS) {
2126 if (SCB_IS_SILENT(scb) == FALSE) {
2127 ahd_print_path(ahd, scb);
2132 scb->crc_retry_count++;
2134 aic_set_transaction_status(scb, CAM_UNCOR_PARITY);
2135 aic_freeze_scb(scb);
2136 ahd_freeze_devq(ahd, scb);
2160 struct scb *scb;
2163 scb = ahd_lookup_scb(ahd, scbid);
2164 ahd_print_path(ahd, scb);
2168 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), 'A',
2169 SCB_GET_LUN(scb), SCB_GET_TAG(scb),
2189 struct scb *scb;
2214 scb = ahd_lookup_scb(ahd, scbid);
2215 if (scb != NULL
2217 scb = NULL;
2229 if (scb == NULL) {
2237 ahd_print_path(ahd, scb);
2239 SCB_GET_TAG(scb),
2243 tag = SCB_GET_TAG(scb);
2245 if ((scb->flags & SCB_CMDPHASE_ABORT) != 0) {
2258 tag = SCB_GET_TAG(scb);
2259 saved_lun = scb->hscb->lun;
2274 if (scb != NULL
2275 && scb->io_ctx->ccb_h.func_code== XPT_RESET_DEV
2276 && ahd_match_scb(ahd, scb, target, 'A',
2279 aic_set_transaction_status(scb, CAM_REQ_CMP);
2331 ahd_freeze_devq(ahd, scb);
2332 ahd_qinfifo_requeue_tail(ahd, scb);
2354 ahd_freeze_devq(ahd, scb);
2355 ahd_qinfifo_requeue_tail(ahd, scb);
2377 ahd_freeze_devq(ahd, scb);
2378 ahd_qinfifo_requeue_tail(ahd, scb);
2410 ahd_freeze_devq(ahd, scb);
2411 aic_set_transaction_status(scb, CAM_REQUEUE_REQ);
2412 aic_freeze_scb(scb);
2414 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb),
2415 SCB_GET_CHANNEL(ahd, scb),
2416 SCB_GET_LUN(scb), SCB_LIST_NULL,
2423 ahd_done(ahd, scb);
2431 if (scb != NULL) {
2434 if ((scb->hscb->control & TAG_ENB) != 0)
2435 tag = SCB_GET_TAG(scb);
2438 ahd_print_path(ahd, scb);
2440 SCB_GET_LUN(scb), tag,
2468 struct scb *scb;
2477 scb = ahd_lookup_scb(ahd, scbid);
2492 scb = NULL;
2493 } else if (scb == NULL) {
2503 aic_set_transaction_status(scb, CAM_SEQUENCE_FAIL);
2505 ahd_print_path(ahd, scb);
2517 ahd_print_path(ahd, scb);
2520 ahd_print_path(ahd, scb);
2549 if (scb == NULL) {
2556 ahd_print_path(ahd, scb);
2557 scb->flags |= SCB_ABORT;
2747 ahd_print_scb(struct scb *scb)
2752 hscb = scb->hscb;
2753 printf("scb:%p control:0x%x scsiid:0x%x lun:%d cdb_len:%d\n",
2754 (void *)scb,
2767 SCB_GET_TAG(scb));
2768 ahd_dump_sglist(scb);
2772 ahd_dump_sglist(struct scb *scb)
2776 if (scb->sg_count > 0) {
2777 if ((scb->ahd_softc->flags & AHD_64BIT_ADDRESSING) != 0) {
2780 sg_list = (struct ahd_dma64_seg*)scb->sg_list;
2781 for (i = 0; i < scb->sg_count; i++) {
2798 sg_list = (struct ahd_dma_seg*)scb->sg_list;
2799 for (i = 0; i < scb->sg_count; i++) {
3402 struct scb *pending_scb;
3559 struct scb *scb)
3564 our_id = SCSIID_OUR_ID(scb->hscb->scsiid);
3566 if ((scb->hscb->control & TARGET_SCB) != 0)
3568 ahd_compile_devinfo(devinfo, our_id, SCB_GET_TARGET(ahd, scb),
3569 SCB_GET_LUN(scb), SCB_GET_CHANNEL(ahd, scb), role);
3582 struct scb *scb)
3605 } else if (scb == NULL) {
3615 if ((scb->flags & SCB_DEVICE_RESET) == 0
3616 && (scb->flags & SCB_PACKETIZED) == 0
3620 identify_msg = MSG_IDENTIFYFLAG | SCB_GET_LUN(scb);
3621 if ((scb->hscb->control & DISCENB) != 0)
3626 if ((scb->hscb->control & TAG_ENB) != 0) {
3628 scb->hscb->control & (TAG_ENB|SCB_TAG_TYPE);
3629 ahd->msgout_buf[ahd->msgout_index++] = SCB_GET_TAG(scb);
3634 if (scb->flags & SCB_DEVICE_RESET) {
3637 ahd_print_path(ahd, scb);
3648 } else if ((scb->flags & SCB_ABORT) != 0) {
3650 if ((scb->hscb->control & TAG_ENB) != 0) {
3656 ahd_print_path(ahd, scb);
3658 (scb->hscb->control & TAG_ENB) != 0 ? " Tag" : "");
3668 } else if ((scb->flags & (SCB_AUTO_NEGOTIATE|SCB_NEGOTIATE)) != 0) {
3681 printf("SCSIID = %x, target_mask = %x\n", scb->hscb->scsiid,
3685 "SCB flags = %x", SCB_GET_TAG(scb), scb->hscb->control,
3687 scb->flags);
3696 scb->hscb->control &= ~MK_MESSAGE;
4722 struct scb *scb;
4730 scb = ahd_lookup_scb(ahd, scb_index);
4810 } else if ((scb->hscb->control & MSG_SIMPLE_TASK) != 0) {
4814 tag_type = (scb->hscb->control & MSG_SIMPLE_TASK);
4838 scb->hscb->control &= mask;
4839 aic_set_transaction_tag(scb, /*enabled*/FALSE,
4843 ahd_busy_tcl(ahd, BUILD_TCL(scb->hscb->scsiid, devinfo->lun),
4844 SCB_GET_TAG(scb));
4851 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb),
4852 SCB_GET_CHANNEL(ahd, scb),
4853 SCB_GET_LUN(scb), /*tag*/SCB_LIST_NULL,
4888 struct scb *scb;
4891 scb = ahd_lookup_scb(ahd, scb_index);
4897 || aic_get_transfer_dir(scb) != CAM_DIR_IN) {
4945 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
4953 if (sg != scb->sg_list
4972 sgptr = ahd_sg_virt_to_bus(ahd, scb,
4978 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
4986 if (sg != scb->sg_list
5005 sgptr = ahd_sg_virt_to_bus(ahd, scb,
5037 struct scb *scb;
5049 scb = ahd_lookup_scb(ahd, scb_index);
5060 ahd_print_path(ahd, scb);
5084 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
5096 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
5185 struct scb *scb)
5196 if (scb != NULL && (scb->flags & SCB_AUTO_NEGOTIATE) != 0)
5322 printf("%s: scb size = 0x%x, hscb size = 0x%x\n",
5323 ahd_name(ahd), (u_int)sizeof(struct scb),
5695 /* DMA tag for our hardware scb structures */
5763 static struct scb *
5766 struct scb *scb;
5771 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
5772 if (SCB_GET_TAG(scb) == tag)
5773 return (scb);
5779 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {
5780 struct scb *list_scb;
5782 list_scb = scb;
5793 LIST_FOREACH(scb, &ahd->scb_data.any_dev_free_scb_list, links.le) {
5794 if (SCB_GET_TAG(scb) == tag)
5795 return (scb);
5920 ahd_add_col_list(struct ahd_softc *ahd, struct scb *scb, u_int col_idx)
5924 struct scb *first_scb;
5926 scb->flags |= SCB_ON_COL_LIST;
5927 AHD_SET_SCB_COL_IDX(scb, col_idx);
5932 LIST_INSERT_AFTER(first_scb, scb, collision_links);
5934 LIST_INSERT_HEAD(free_list, scb, collision_links);
5935 TAILQ_INSERT_TAIL(free_tailq, scb, links.tqe);
5940 ahd_rem_col_list(struct ahd_softc *ahd, struct scb *scb)
5944 struct scb *first_scb;
5947 scb->flags &= ~SCB_ON_COL_LIST;
5948 col_idx = AHD_GET_SCB_COL_IDX(ahd, scb);
5952 if (first_scb == scb) {
5953 struct scb *next_scb;
5960 next_scb = LIST_NEXT(scb, collision_links);
5962 TAILQ_INSERT_AFTER(free_tailq, scb,
5965 TAILQ_REMOVE(free_tailq, scb, links.tqe);
5967 LIST_REMOVE(scb, collision_links);
5971 * Get a free scb. If there are none, see if we can allocate a new SCB.
5973 struct scb *
5976 struct scb *scb;
5981 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {
5982 if (AHD_GET_SCB_COL_IDX(ahd, scb) != col_idx) {
5983 ahd_rem_col_list(ahd, scb);
5987 if ((scb = LIST_FIRST(&ahd->scb_data.any_dev_free_scb_list)) == NULL) {
5995 LIST_REMOVE(scb, links.le);
5997 && (scb->col_scb != NULL)
5998 && (scb->col_scb->flags & SCB_ACTIVE) == 0) {
5999 LIST_REMOVE(scb->col_scb, links.le);
6000 ahd_add_col_list(ahd, scb->col_scb, col_idx);
6003 scb->flags |= SCB_ACTIVE;
6004 return (scb);
6011 ahd_free_scb(struct ahd_softc *ahd, struct scb *scb)
6015 scb->flags = SCB_FLAG_NONE;
6016 scb->hscb->control = 0;
6017 ahd->scb_data.scbindex[SCB_GET_TAG(scb)] = NULL;
6019 if (scb->col_scb == NULL) {
6025 scb, links.le);
6026 } else if ((scb->col_scb->flags & SCB_ON_COL_LIST) != 0) {
6033 ahd_rem_col_list(ahd, scb->col_scb);
6035 scb, links.le);
6037 scb->col_scb, links.le);
6038 } else if ((scb->col_scb->flags
6040 && (scb->col_scb->hscb->control & TAG_ENB) != 0) {
6047 ahd_add_col_list(ahd, scb,
6048 AHD_GET_SCB_COL_IDX(ahd, scb->col_scb));
6057 scb, links.le);
6060 aic_platform_scb_free(ahd, scb);
6067 struct scb *next_scb;
6206 next_scb = (struct scb *)malloc(sizeof(*next_scb),
6230 * The first entry is embedded in the scb.
7282 ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, int target,
7285 int targ = SCB_GET_TARGET(ahd, scb);
7286 char chan = SCB_GET_CHANNEL(ahd, scb);
7287 int slun = SCB_GET_LUN(scb);
7299 group = XPT_FC_GROUP(scb->io_ctx->ccb_h.func_code);
7302 && ((tag == SCB_GET_TAG(scb))
7306 && ((tag == scb->io_ctx->csio.tag_id)
7310 match = ((tag == SCB_GET_TAG(scb)) || (tag == SCB_LIST_NULL));
7318 ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb)
7324 target = SCB_GET_TARGET(ahd, scb);
7325 lun = SCB_GET_LUN(scb);
7326 channel = SCB_GET_CHANNEL(ahd, scb);
7332 ahd_platform_freeze_devq(ahd, scb);
7336 ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, struct scb *scb)
7338 struct scb *prev_scb;
7352 ahd_qinfifo_requeue(ahd, prev_scb, scb);
7358 ahd_qinfifo_requeue(struct ahd_softc *ahd, struct scb *prev_scb,
7359 struct scb *scb)
7364 busaddr = aic_le32toh(scb->hscb->hscb_busaddr);
7367 prev_scb->hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr;
7371 ahd->qinfifo[AHD_QIN_WRAP(ahd->qinfifonext)] = SCB_GET_TAG(scb);
7373 scb->hscb->next_hscb_busaddr = ahd->next_queued_hscb->hscb_busaddr;
7374 ahd_sync_scb(ahd, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
7398 struct scb *scb;
7412 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
7421 ahd_done_with_status(struct ahd_softc *ahd, struct scb *scb, uint32_t status)
7426 ostat = aic_get_transaction_status(scb);
7428 aic_set_transaction_status(scb, status);
7429 cstat = aic_get_transaction_status(scb);
7431 aic_freeze_scb(scb);
7432 ahd_done(ahd, scb);
7440 struct scb *scb;
7441 struct scb *mk_msg_scb;
7442 struct scb *prev_scb;
7492 scb = ahd_lookup_scb(ahd, ahd->qinfifo[qinpos]);
7493 if (scb == NULL) {
7500 if (ahd_match_scb(ahd, scb, target, channel, lun, tag, role)) {
7502 * We found an scb that needs to be acted on.
7507 if ((scb->flags & SCB_ACTIVE) == 0)
7509 ahd_done_with_status(ahd, scb, status);
7517 ahd_qinfifo_requeue(ahd, prev_scb, scb);
7518 prev_scb = scb;
7522 ahd_qinfifo_requeue(ahd, prev_scb, scb);
7523 prev_scb = scb;
7565 scb = ahd_lookup_scb(ahd, scbid);
7566 if (scb == NULL) {
7573 if (ahd_match_scb(ahd, scb, target, channel, CAM_LUN_WILDCARD,
7583 printf(" %d ( ", SCB_GET_TARGET(ahd, scb));
7588 SCB_GET_TARGET(ahd, scb));
7598 * We found an scb that needs to be acted on.
7611 printf("Removing MK_MSG scb\n");
7629 printf(" 0x%x", SCB_GET_TAG(scb));
7638 && ahd_match_scb(ahd, scb, target, channel, CAM_LUN_WILDCARD,
7643 * queue with a pending MK_MESSAGE scb, we
7644 * must queue the MK_MESSAGE scb.
7672 struct scb *scb;
7691 scb = ahd_lookup_scb(ahd, scbid);
7692 if (scb == NULL) {
7700 if (ahd_match_scb(ahd, scb, target, channel,
7708 if ((scb->flags & SCB_ACTIVE) == 0)
7710 ahd_done_with_status(ahd, scb, status);
7769 * scb that follows the one that we remove.
7826 struct scb *scbp;
7827 struct scb *scbp_next;
8168 ahd_handle_scb_status(struct ahd_softc *ahd, struct scb *scb)
8170 if (scb->hscb->shared_data.istatus.scsi_status != 0) {
8171 ahd_handle_scsi_status(ahd, scb);
8173 ahd_calc_residual(ahd, scb);
8174 ahd_done(ahd, scb);
8179 ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
8193 hscb = scb->hscb;
8203 ahd_freeze_devq(ahd, scb);
8204 aic_freeze_scb(scb);
8212 if ((scb->flags & SCB_SENSE) != 0) {
8217 scb->flags &= ~SCB_SENSE;
8218 aic_set_transaction_status(scb, CAM_AUTOSENSE_FAIL);
8219 ahd_done(ahd, scb);
8222 aic_set_transaction_status(scb, CAM_SCSI_STATUS_ERROR);
8223 aic_set_scsi_status(scb, hscb->shared_data.istatus.scsi_status);
8229 ahd_sync_sense(ahd, scb, BUS_DMASYNC_POSTREAD);
8230 siu = (struct scsi_status_iu_header *)scb->sense_data;
8231 aic_set_scsi_status(scb, siu->status);
8234 ahd_print_path(ahd, scb);
8236 SCB_GET_TAG(scb), siu->status);
8244 ahd_print_path(ahd, scb);
8278 aic_set_transaction_status(scb,
8282 scb->flags |= SCB_PKT_SENSE;
8288 ahd_done(ahd, scb);
8302 ahd_print_path(ahd, scb);
8304 SCB_GET_TAG(scb));
8308 if (aic_perform_autosense(scb) == 0)
8311 ahd_compile_devinfo(&devinfo, SCB_GET_OUR_ID(scb),
8312 SCB_GET_TARGET(ahd, scb),
8313 SCB_GET_LUN(scb),
8314 SCB_GET_CHANNEL(ahd, scb),
8322 sg = scb->sg_list;
8327 ahd_update_residual(ahd, scb);
8330 ahd_print_path(ahd, scb);
8334 scb->sg_count = 0;
8335 sg = ahd_sg_setup(ahd, scb, sg, ahd_get_sense_bufaddr(ahd, scb),
8336 aic_get_sense_bufsize(ahd, scb),
8341 && SCB_GET_LUN(scb) < 8)
8342 sc->byte2 = SCB_GET_LUN(scb) << 5;
8345 sc->length = aic_get_sense_bufsize(ahd, scb);
8365 if (aic_get_residual(scb) == aic_get_transfer_length(scb)) {
8372 scb->flags &=
8374 scb->flags |= SCB_AUTO_NEGOTIATE;
8377 ahd_setup_data_scb(ahd, scb);
8378 scb->flags |= SCB_SENSE;
8379 ahd_queue_scb(ahd, scb);
8388 || (scb->flags & SCB_RECOVERY_SCB) != 0)
8389 aic_scb_timer_reset(scb, 5 * 1000);
8397 ahd_done(ahd, scb);
8406 ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb)
8430 hscb = scb->hscb;
8451 resid = aic_get_transfer_length(scb);
8456 ahd_print_path(ahd, scb);
8458 SCB_GET_TAG(scb));
8459 ahd_freeze_devq(ahd, scb);
8460 aic_set_transaction_status(scb, CAM_DATA_RUN_ERR);
8461 aic_freeze_scb(scb);
8474 sg = ahd_sg_bus_to_virt(ahd, scb, resid_sgptr & SG_PTR_MASK);
8489 if ((scb->flags & SCB_SENSE) == 0)
8490 aic_set_residual(scb, resid);
8492 aic_set_sense_residual(scb, resid);
8496 ahd_print_path(ahd, scb);
8498 (scb->flags & SCB_SENSE) ? "Sense " : "", resid);
9011 struct scb *scb;
9094 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
9097 cur_col = printf("\n%3d FIFO_USE[0x%x] ", SCB_GET_TAG(scb),
9099 ahd_set_scbptr(ahd, SCB_GET_TAG(scb));
9109 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {
9110 struct scb *list_scb;
9112 printf("\n COLIDX[%d]: ", AHD_GET_SCB_COL_IDX(ahd, scb));
9113 list_scb = scb;
9121 LIST_FOREACH(scb, &ahd->scb_data.any_dev_free_scb_list, links.le) {
9124 printf("%d ", SCB_GET_TAG(scb));
9171 struct scb *fifo_scb;
9302 ahd_timeout(struct scb *scb)
9306 ahd = scb->ahd_softc;
9307 if ((scb->flags & SCB_ACTIVE) != 0) {
9308 if ((scb->flags & SCB_TIMEDOUT) == 0) {
9309 LIST_INSERT_HEAD(&ahd->timedout_scbs, scb,
9311 scb->flags |= SCB_TIMEDOUT;
9327 struct scb *scb;
9328 struct scb *active_scb;
9378 while ((scb = LIST_FIRST(&ahd->timedout_scbs)) != NULL) {
9383 target = SCB_GET_TARGET(ahd, scb);
9384 channel = SCB_GET_CHANNEL(ahd, scb);
9385 lun = SCB_GET_LUN(scb);
9387 ahd_print_path(ahd, scb);
9388 printf("SCB %d - timed out\n", SCB_GET_TAG(scb));
9390 if (scb->flags & (SCB_DEVICE_RESET|SCB_ABORT)) {
9395 aic_set_transaction_status(scb, CAM_CMD_TIMEOUT);
9409 LIST_REMOVE(scb, timedout_links);
9410 scb->flags &= ~SCB_TIMEDOUT;
9414 if (active_scb != scb) {
9424 if (ahd_other_scb_timeout(ahd, scb,
9440 aic_scb_timer_reset(scb, 2 * 1000);
9455 SCB_GET_TAG(scb),
9465 if (ahd_other_scb_timeout(ahd, scb, NULL) == 0)
9473 ahd_set_recoveryscb(ahd, scb);
9482 scb->flags |= SCB_DEVICE_RESET;
9483 scb->hscb->cdb_len = 0;
9484 scb->hscb->task_attribute = 0;
9485 scb->hscb->task_management = SIU_TASKMGMT_ABORT_TASK;
9487 ahd_set_scbptr(ahd, SCB_GET_TAG(scb));
9488 if ((scb->flags & SCB_PACKETIZED) != 0) {
9497 scb->hscb->task_management);
9509 scb->hscb->control |= MK_MESSAGE|DISCONNECTED;
9529 ahd_qinfifo_requeue_tail(ahd, scb);
9531 ahd_print_path(ahd, scb);
9533 aic_scb_timer_reset(scb, 2 * 1000);
9543 while ((scb = LIST_FIRST(&ahd->timedout_scbs)) != NULL) {
9545 LIST_REMOVE(scb, timedout_links);
9546 scb->flags &= ~SCB_TIMEDOUT;
9559 ahd_other_scb_timeout(struct ahd_softc *ahd, struct scb *scb,
9560 struct scb *other_scb)
9565 ahd_print_path(ahd, scb);
9567 (scb->flags & SCB_OTHERTCL_TIMEOUT) != 0
9571 newtimeout = aic_get_timeout(scb);
9572 scb->flags |= SCB_OTHERTCL_TIMEOUT;
9595 aic_scb_timer_reset(scb, newtimeout);
9597 ahd_print_path(ahd, scb);
10105 struct scb *scb;
10114 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
10117 ccbh = &scb->io_ctx->ccb_h;