Home | History | Annotate | Download | only in ic

Lines Matching refs:scb

87 	{ MPARERR,	"Scratch or SCB Memory Parity Error" },
146 struct scb *scb);
149 struct scb *scb);
186 struct scb *scb);
197 struct scb *scb, u_int col_idx);
199 struct scb *scb);
202 struct scb *prev_scb,
203 struct scb *scb);
233 struct scb *scb);
235 struct scb *scb);
391 struct scb *scb;
417 scb = ahd_lookup_scb(ahd, scbid);
418 if (scb == NULL) {
419 printf("%s: Warning - GSFIFO SCB %d invalid\n",
433 if (ahd_scb_active_in_fifo(ahd, scb) == 0)
436 ahd_run_data_fifo(ahd, scb);
456 * Place this SCB on the complete DMA list
458 * SCB before completing the command.
464 ahd_outw(ahd, SCB_TAG, SCB_GET_TAG(scb));
469 SCB_GET_TAG(scb));
471 ahd_complete_scb(ahd, scb);
482 * if this if for an SCB in the qinfifo.
508 scb = ahd_lookup_scb(ahd, scbid);
509 if (scb == NULL) {
511 "SCB %d invalid\n", ahd_name(ahd), scbid);
514 hscb_ptr = (uint8_t *)scb->hscb;
518 ahd_complete_scb(ahd, scb);
528 scb = ahd_lookup_scb(ahd, scbid);
529 if (scb == NULL) {
530 printf("%s: Warning - Complete SCB %d invalid\n",
535 ahd_complete_scb(ahd, scb);
549 * Determine if an SCB for a packetized transaction
553 ahd_scb_active_in_fifo(struct ahd_softc *ahd, struct scb *scb)
558 * the SCBPTR matches the SCB's ID and the firmware
562 if (ahd_get_scbptr(ahd) != SCB_GET_TAG(scb)
582 ahd_run_data_fifo(struct ahd_softc *ahd, struct scb *scb)
619 * Mark the SCB as having a FIFO in use.
740 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
747 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
802 * the FIFO use count for the SCB, and release
814 struct scb *scb;
826 scb = ahd_lookup_scb(ahd, scb_index);
827 if (scb == NULL) {
828 printf("%s: WARNING no command for scb %d "
834 ahd_complete_scb(ahd, scb);
906 struct scb *scb;
911 scb = ahd_lookup_scb(ahd, scbid);
912 if (scb != NULL) {
913 ahd_complete_scb(ahd, scb);
915 printf("%s: WARNING no command for scb %d "
926 struct scb *scb;
932 scb = ahd_lookup_scb(ahd, scbid);
933 if (scb == NULL) {
941 ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid);
942 ahd_outb(ahd, SAVED_LUN, scb->hscb->lun);
972 struct scb *scb;
976 scb = ahd_lookup_scb(ahd, scbid);
977 if (scb != NULL)
978 ahd_print_path(ahd, scb);
981 printf("SCB %d Packetized Status Overrun", scbid);
988 struct scb *scb;
992 scb = ahd_lookup_scb(ahd, scbid);
993 if (scb == NULL) {
995 printf("CFG4ISTAT: Free SCB %d referenced", scbid);
998 ahd_outq(ahd, HADDR, scb->sense_busaddr);
1027 struct scb *scb;
1046 scb = ahd_lookup_scb(ahd, scbid);
1047 if (scb == NULL) {
1048 printf("Invalid phase with no valid SCB. "
1054 ahd_compile_devinfo(&devinfo, SCB_GET_OUR_ID(scb),
1055 SCB_GET_TARGET(ahd, scb),
1056 SCB_GET_LUN(scb),
1057 SCB_GET_CHANNEL(ahd, scb),
1078 scb->hscb->control &= ~(TAG_ENB|SCB_TAG_TYPE);
1079 scb->hscb->control |= MK_MESSAGE;
1080 ahd_outb(ahd, SCB_CONTROL, scb->hscb->control);
1082 ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid);
1084 * The lun is 0, regardless of the SCB's lun
1090 scb->flags &= ~(SCB_PACKETIZED);
1091 scb->flags |= SCB_ABORT|SCB_CMDPHASE_ABORT;
1092 ahd_freeze_devq(ahd, scb);
1093 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ);
1094 ahd_freeze_scb(scb);
1107 ahd_print_path(ahd, scb);
1119 struct scb *scb;
1129 scb = ahd_lookup_scb(ahd, scb_index);
1130 if (scb == NULL) {
1132 * Attempt to transfer to an SCB that is
1143 * attempt to complete this bogus SCB.
1186 struct scb *scb;
1206 scb = ahd_lookup_scb(ahd, scb_index);
1211 scb);
1228 scb);
1242 printf("%s:%c:%d: no active SCB for reconnecting "
1322 struct scb *scb;
1329 scb = ahd_lookup_scb(ahd, scbindex);
1333 ahd_print_path(ahd, scb);
1336 SCB_GET_TAG(scb));
1337 ahd_print_path(ahd, scb);
1342 ahd_get_transfer_length(scb), scb->sg_count);
1343 ahd_dump_sglist(scb);
1351 ahd_freeze_devq(ahd, scb);
1352 ahd_set_transaction_status(scb, CAM_DATA_RUN_ERR);
1353 ahd_freeze_scb(scb);
1359 struct scb *scb;
1367 scb = ahd_lookup_scb(ahd, scbid);
1368 if (scb != NULL
1369 && (scb->flags & SCB_RECOVERY_SCB) != 0)
1372 * SCB into the QINFIFO.
1374 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb),
1375 SCB_GET_CHANNEL(ahd, scb),
1376 SCB_GET_LUN(scb), SCB_GET_TAG(scb),
1386 struct scb *scb;
1389 scb = ahd_lookup_scb(ahd, scbid);
1390 if (scb != NULL) {
1395 ahd_print_path(ahd, scb);
1397 scb->hscb->task_management);
1401 switch (scb->hscb->task_management) {
1403 tag = SCB_GET_TAG(scb);
1407 lun = scb->hscb->lun;
1409 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb),
1414 lun = scb->hscb->lun;
1420 ahd_scb_devinfo(ahd, &devinfo, scb);
1440 struct scb *scb;
1447 scb = ahd_lookup_scb(ahd, scbid);
1448 if (scb != NULL) {
1450 * Remove the second instance of this SCB from
1453 ahd_print_path(ahd, scb);
1454 printf("SCB completes before TMF\n");
1458 * set the TMF back to zero in this SCB so that
1467 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb),
1468 SCB_GET_CHANNEL(ahd, scb),
1469 SCB_GET_LUN(scb), SCB_GET_TAG(scb),
1503 struct scb *scb;
1530 scb = ahd_lookup_scb(ahd, scbid);
1531 if (scb != NULL
1533 scb = NULL;
1590 scb = ahd_lookup_scb(ahd, scbid1);
1591 if (scb == NULL) {
1592 printf("%s: ahd_intr - referenced scb not "
1593 "valid during SELTO scb(0x%x)\n",
1600 ahd_print_path(ahd, scb);
1601 printf("Saw Selection Timeout for SCB 0x%x\n",
1614 ahd_scb_devinfo(ahd, &devinfo, scb);
1616 ahd_set_transaction_status(scb, CAM_SEL_TIMEOUT);
1617 ahd_freeze_devq(ahd, scb);
1666 struct scb *scb1;
1674 printf("%s: Invalid SCB %d in DFF%d "
1751 struct scb *scb;
1761 scb = NULL;
1792 * Try to find the SCB associated with this error.
1800 scb = ahd_lookup_scb(ahd, scbid);
1801 if (scb != NULL && SCB_IS_SILENT(scb))
1896 if (scb == NULL) {
1897 printf("%s: No SCB valid for LQICRC_NLQ. "
1927 if (scb != NULL && msg_out == MSG_INITIATOR_DET_ERR)
1928 scb->flags |= SCB_TRANSMISSION_ERROR;
1985 struct scb *scb;
2006 * SCB that encountered the failure. Clean
2013 scb = ahd_lookup_scb(ahd, scbid);
2014 if (scb == NULL)
2015 panic("SCB not valid during LQOBUSFREE");
2036 * we restart on the correct SCB.
2055 if (scb->crc_retry_count < AHD_MAX_LQ_CRC_ERRORS) {
2056 if (SCB_IS_SILENT(scb) == FALSE) {
2057 ahd_print_path(ahd, scb);
2061 scb->crc_retry_count++;
2063 ahd_set_transaction_status(scb, CAM_UNCOR_PARITY);
2064 ahd_freeze_scb(scb);
2065 ahd_freeze_devq(ahd, scb);
2089 struct scb *scb;
2092 scb = ahd_lookup_scb(ahd, scbid);
2093 ahd_print_path(ahd, scb);
2096 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), 'A',
2097 SCB_GET_LUN(scb), SCB_GET_TAG(scb),
2116 struct scb *scb;
2141 scb = ahd_lookup_scb(ahd, scbid);
2142 if (scb != NULL
2144 scb = NULL;
2156 if (scb == NULL) {
2164 ahd_print_path(ahd, scb);
2165 printf("SCB %d - Abort%s Completed.\n",
2166 SCB_GET_TAG(scb),
2170 tag = SCB_GET_TAG(scb);
2172 if ((scb->flags & SCB_CMDPHASE_ABORT) != 0) {
2179 * abort only the SCB that encountered
2181 * lun. The SCB will be retried so the OS
2185 tag = SCB_GET_TAG(scb);
2186 saved_lun = scb->hscb->lun;
2201 if (scb != NULL
2202 && scb->io_ctx->ccb_h.func_code== XPT_RESET_DEV
2203 scb, target, 'A',
2206 ahd_set_transaction_status(scb, CAM_REQ_CMP);
2231 ahd_qinfifo_requeue_tail(ahd, scb);
2247 ahd_qinfifo_requeue_tail(ahd, scb);
2264 ahd_qinfifo_requeue_tail(ahd, scb);
2296 ahd_freeze_devq(ahd, scb);
2297 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ);
2298 ahd_freeze_scb(scb);
2300 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb),
2301 SCB_GET_CHANNEL(ahd, scb),
2302 SCB_GET_LUN(scb), SCB_LIST_NULL,
2309 ahd_done(ahd, scb);
2317 if (scb != NULL) {
2320 if ((scb->hscb->control & TAG_ENB) != 0)
2321 tag = SCB_GET_TAG(scb);
2324 ahd_print_path(ahd, scb);
2326 SCB_GET_LUN(scb), tag,
2354 struct scb *scb;
2363 scb = ahd_lookup_scb(ahd, scbid);
2371 * identify message, or did, but we didn't find an SCB
2377 scb = NULL;
2378 } else if (scb == NULL) {
2380 * We don't seem to have an SCB active for this
2384 printf("No SCB found during protocol violation\n");
2387 ahd_set_transaction_status(scb, CAM_SEQUENCE_FAIL);
2389 ahd_print_path(ahd, scb);
2400 ahd_print_path(ahd, scb);
2403 ahd_print_path(ahd, scb);
2430 if (scb == NULL) {
2437 ahd_print_path(ahd, scb);
2438 scb->flags |= SCB_ABORT;
2627 ahd_print_scb(struct scb *scb)
2632 hscb = scb->hscb;
2633 printf("scb:%p control:0x%x scsiid:0x%x lun:%d cdb_len:%d\n",
2634 (void *)scb,
2647 SCB_GET_TAG(scb));
2648 ahd_dump_sglist(scb);
2652 ahd_dump_sglist(struct scb *scb)
2656 if (scb->sg_count > 0) {
2657 if ((scb->ahd_softc->flags & AHD_64BIT_ADDRESSING) != 0) {
2660 sg_list = (struct ahd_dma64_seg*)scb->sg_list;
2661 for (i = 0; i < scb->sg_count; i++) {
2676 sg_list = (struct ahd_dma_seg*)scb->sg_list;
2677 for (i = 0; i < scb->sg_count; i++) {
3269 struct scb *pending_scb;
3277 * Traverse the pending SCB list and ensure that all of the
3282 * SCB. For this reason, all callers only call this routine
3427 struct scb *scb)
3432 our_id = SCSIID_OUR_ID(scb->hscb->scsiid);
3434 if ((scb->hscb->control & TARGET_SCB) != 0)
3436 ahd_compile_devinfo(devinfo, our_id, SCB_GET_TARGET(ahd, scb),
3437 SCB_GET_LUN(scb), SCB_GET_CHANNEL(ahd, scb), role);
3450 struct scb *scb)
3473 } else if (scb == NULL) {
3482 if ((scb->flags & SCB_DEVICE_RESET) == 0
3483 && (scb->flags & SCB_PACKETIZED) == 0
3487 identify_msg = MSG_IDENTIFYFLAG | SCB_GET_LUN(scb);
3488 if ((scb->hscb->control & DISCENB) != 0)
3493 if ((scb->hscb->control & TAG_ENB) != 0) {
3495 scb->hscb->control & (TAG_ENB|SCB_TAG_TYPE);
3496 ahd->msgout_buf[ahd->msgout_index++] = SCB_GET_TAG(scb);
3501 if (scb->flags & SCB_DEVICE_RESET) {
3504 ahd_print_path(ahd, scb);
3514 } else if ((scb->flags & SCB_ABORT) != 0) {
3516 if ((scb->hscb->control & TAG_ENB) != 0) {
3522 ahd_print_path(ahd, scb);
3524 (scb->hscb->control & TAG_ENB) != 0 ? " Tag" : "");
3533 } else if ((scb->flags & (SCB_AUTO_NEGOTIATE|SCB_NEGOTIATE)) != 0) {
3544 printf("ahd_intr: AWAITING_MSG for an SCB that "
3546 printf("SCSIID = %x, target_mask = %x\n", scb->hscb->scsiid,
3548 panic("SCB = %d, SCB Control = %x:%x, MSG_OUT = %x "
3549 "SCB flags = %x", SCB_GET_TAG(scb), scb->hscb->control,
3551 scb->flags);
3555 * Clear the MK_MESSAGE flag from the SCB so we aren't
3560 scb->hscb->control &= ~MK_MESSAGE;
4586 struct scb *scb;
4594 scb = ahd_lookup_scb(ahd, scb_index);
4674 } else if ((scb->hscb->control & MSG_SIMPLE_TASK) != 0) {
4678 tag_type = (scb->hscb->control & MSG_SIMPLE_TASK);
4702 scb->hscb->control &= mask;
4703 ahd_set_transaction_tag(scb, /*enabled*/FALSE,
4707 ahd_busy_tcl(ahd, BUILD_TCL(scb->hscb->scsiid, devinfo->lun),
4708 SCB_GET_TAG(scb));
4715 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb),
4716 SCB_GET_CHANNEL(ahd, scb),
4717 SCB_GET_LUN(scb), /*tag*/SCB_LIST_NULL,
4753 struct scb *scb;
4758 scb = ahd_lookup_scb(ahd, scb_index);
4764 || ahd_get_transfer_dir(scb) != CAM_DIR_IN) {
4812 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
4820 if (sg != scb->sg_list
4839 sgptr = ahd_sg_virt_to_bus(ahd, scb,
4845 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
4853 if (sg != scb->sg_list
4872 sgptr = ahd_sg_virt_to_bus(ahd, scb,
4904 struct scb *scb;
4916 scb = ahd_lookup_scb(ahd, scb_index);
4927 ahd_print_path(ahd, scb);
4954 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
4969 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr);
5057 struct scb *scb)
5068 if (scb != NULL && (scb->flags & SCB_AUTO_NEGOTIATE) != 0)
5423 printf("%s: No SCB space found\n", ahd_name(ahd));
5458 static struct scb *
5461 struct scb *scb;
5466 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
5467 if (SCB_GET_TAG(scb) == tag)
5468 return (scb);
5474 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {
5475 struct scb *list_scb;
5477 list_scb = scb;
5488 LIST_FOREACH(scb, &ahd->scb_data.any_dev_free_scb_list, links.le) {
5489 if (SCB_GET_TAG(scb) == tag)
5490 return (scb);
5605 /*************************** SCB Management ***********************************/
5607 ahd_add_col_list(struct ahd_softc *ahd, struct scb *scb, u_int col_idx)
5611 struct scb *first_scb;
5613 scb->flags |= SCB_ON_COL_LIST;
5614 AHD_SET_SCB_COL_IDX(scb, col_idx);
5619 LIST_INSERT_AFTER(first_scb, scb, collision_links);
5621 LIST_INSERT_HEAD(free_list, scb, collision_links);
5622 TAILQ_INSERT_TAIL(free_tailq, scb, links.tqe);
5627 ahd_rem_col_list(struct ahd_softc *ahd, struct scb *scb)
5631 struct scb *first_scb;
5634 scb->flags &= ~SCB_ON_COL_LIST;
5635 col_idx = AHD_GET_SCB_COL_IDX(ahd, scb);
5639 if (first_scb == scb) {
5640 struct scb *next_scb;
5647 next_scb = LIST_NEXT(scb, collision_links);
5649 TAILQ_INSERT_AFTER(free_tailq, scb,
5652 TAILQ_REMOVE(free_tailq, scb, links.tqe);
5654 LIST_REMOVE(scb, collision_links);
5658 * Get a free scb. If there are none, see if we can allocate a new SCB.
5660 struct scb *
5663 struct scb *scb;
5664 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {
5665 if (AHD_GET_SCB_COL_IDX(ahd, scb) != col_idx) {
5666 ahd_rem_col_list(ahd, scb);
5670 if ((scb = LIST_FIRST(&ahd->scb_data.any_dev_free_scb_list)) == NULL)
5672 LIST_REMOVE(scb, links.le);
5674 && (scb->col_scb != NULL)
5675 && (scb->col_scb->flags & SCB_ACTIVE) == 0) {
5676 LIST_REMOVE(scb->col_scb, links.le);
5677 ahd_add_col_list(ahd, scb->col_scb, col_idx);
5680 scb->flags |= SCB_ACTIVE;
5681 return (scb);
5685 * Return an SCB resource to the free list.
5688 ahd_free_scb(struct ahd_softc *ahd, struct scb *scb)
5692 scb->flags = SCB_FLAG_NONE;
5693 scb->hscb->control = 0;
5694 ahd->scb_data.scbindex[SCB_GET_TAG(scb)] = NULL;
5696 if (scb->col_scb == NULL) {
5702 scb, links.le);
5703 } else if ((scb->col_scb->flags & SCB_ON_COL_LIST) != 0) {
5706 * The SCB we might have collided with is on
5710 ahd_rem_col_list(ahd, scb->col_scb);
5712 scb, links.le);
5714 scb->col_scb, links.le);
5715 } else if ((scb->col_scb->flags
5717 && (scb->col_scb->hscb->control & TAG_ENB) != 0) {
5720 * The SCB we might collide with on the next allocation
5722 * Put us on the SCB collision list.
5724 ahd_add_col_list(ahd, scb,
5725 AHD_GET_SCB_COL_IDX(ahd, scb->col_scb));
5728 * The SCB we might collide with on the next allocation
5730 * Since we can't collide, put this SCB on the generic
5734 scb, links.le);
5737 ahd_platform_scb_free(ahd, scb);
5744 struct scb *next_scb;
5785 "hardware SCB structures") < 0) {
5922 * The first entry is embedded in the scb.
6026 panic("Hardware SCB size is incorrect");
6091 * We need one SCB to serve as the "next SCB". Since the
6092 * tag identifier in this SCB will never be used, there is
6093 * no point in using a valid HSCB tag from an SCB pulled from
6103 /* Allocate SCB data now that parent_dmat is initialized */
6332 * Setup SCB Offset registers.
6398 * supported. We use this to catch invalid SCB references.
6507 * Tell the sequencer which SCB will be the next one it receives.
6831 struct scb *waiting_scb;
6907 * Set SCBPTR to the SCB that contains the busy
6909 * the SCB that contains the entry for TCL.
6918 * Index to the SCB that contains the busy entry.
6926 * And now calculate the SCB offset to the entry.
6960 /************************** SCB and SCB queue management **********************/
6962 ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, int target,
6965 int targ = SCB_GET_TARGET(ahd, scb);
6966 char chan = SCB_GET_CHANNEL(ahd, scb);
6967 int slun = SCB_GET_LUN(scb);
6979 group = XPT_FC_GROUP(scb->io_ctx->ccb_h.func_code);
6982 && ((tag == SCB_GET_TAG(scb))
6986 && ((tag == scb->io_ctx->csio.tag_id)
6990 match = ((tag == SCB_GET_TAG(scb)) || (tag == SCB_LIST_NULL));
6998 ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb)
7004 target = SCB_GET_TARGET(ahd, scb);
7005 lun = SCB_GET_LUN(scb);
7006 channel = SCB_GET_CHANNEL(ahd, scb);
7012 ahd_platform_freeze_devq(ahd, scb);
7016 ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, struct scb *scb)
7018 struct scb *prev_scb;
7032 ahd_qinfifo_requeue(ahd, prev_scb, scb);
7038 ahd_qinfifo_requeue(struct ahd_softc *ahd, struct scb *prev_scb,
7039 struct scb *scb)
7044 busaddr = ahd_le32toh(scb->hscb->hscb_busaddr);
7050 prev_scb->hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr;
7054 ahd->qinfifo[AHD_QIN_WRAP(ahd->qinfifonext)] = SCB_GET_TAG(scb);
7056 scb->hscb->next_hscb_busaddr = ahd->next_queued_hscb->hscb_busaddr;
7057 ahd_sync_scb(ahd, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
7081 struct scb *scb;
7095 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
7108 struct scb *scb;
7109 struct scb *prev_scb;
7128 * Halt any pending SCB DMA. The sequencer will reinitiate
7146 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
7168 scb = ahd_lookup_scb(ahd, ahd->qinfifo[qinpos]);
7169 if (scb == NULL) {
7173 if (ahd_match_scb(ahd, scb, target, channel, lun, tag, role)) {
7175 * We found an scb that needs to be acted on.
7184 ostat = ahd_get_scsi_status(scb);
7186 ahd_set_scsi_status(scb, status);
7187 cstat = ahd_get_transaction_status(scb);
7189 ahd_freeze_scb(scb);
7190 if ((scb->flags & SCB_ACTIVE) == 0)
7191 printf("Inactive SCB in qinfifo\n");
7192 if ((cam_status)scb->xs->error != CAM_REQ_CMP)
7196 SCB_GET_TAG(scb), ostat, cstat,
7197 scb->xs->error);
7198 ahd_done(ahd, scb);
7208 ahd_qinfifo_requeue(ahd, prev_scb, scb);
7209 prev_scb = scb;
7213 ahd_qinfifo_requeue(ahd, prev_scb, scb);
7214 prev_scb = scb;
7247 "SCB index == 0x%x, yet numscbs == 0x%x.",
7252 scb = ahd_lookup_scb(ahd, scbid);
7253 if (scb == NULL) {
7254 printf("%s: SCB = 0x%x Not Active!\n",
7261 if (ahd_match_scb(ahd, scb, target, channel, CAM_LUN_WILDCARD,
7271 printf(" %d ( ", SCB_GET_TARGET(ahd, scb));
7276 SCB_GET_TARGET(ahd, scb));
7294 struct scb *scb;
7306 printf("%s:SCB List inconsistency. "
7307 "SCB == 0x%x, yet numscbs == 0x%x.",
7312 scb = ahd_lookup_scb(ahd, scbid);
7313 if (scb == NULL) {
7314 printf("%s: SCB = %d Not Active!\n",
7320 if (ahd_match_scb(ahd, scb, target, channel,
7332 ostat = ahd_get_scsi_status(scb);
7334 ahd_set_scsi_status(scb, status);
7335 cstat = ahd_get_transaction_status(scb);
7337 ahd_freeze_scb(scb);
7338 if ((scb->flags & SCB_ACTIVE) == 0)
7339 printf("Inactive SCB in Waiting List\n");
7340 ahd_done(ahd, scb);
7356 panic("SCB LIST LOOP");
7400 * scb that follows the one that we remove.
7428 * Add the SCB as selected by SCBPTR onto the on chip list of
7430 * performing SCB paging.
7456 struct scb *scbp;
7457 struct scb *scbp_next;
7537 printf("Inactive SCB on pending list\n");
7823 ahd_handle_scb_status(struct ahd_softc *ahd, struct scb *scb)
7825 if (scb->hscb->shared_data.istatus.scsi_status != 0) {
7826 ahd_handle_scsi_status(ahd, scb);
7828 ahd_calc_residual(ahd, scb);
7829 ahd_done(ahd, scb);
7834 ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
7845 hscb = scb->hscb;
7848 ahd_freeze_devq(ahd, scb);
7849 ahd_freeze_scb(scb);
7862 if ((scb->flags & SCB_SENSE) != 0) {
7867 scb->flags &= ~SCB_SENSE;
7868 ahd_set_transaction_status(scb, CAM_AUTOSENSE_FAIL);
7869 ahd_done(ahd, scb);
7872 ahd_set_scsi_status(scb, hscb->shared_data.istatus.scsi_status);
7873 ahd_set_xfer_status(scb, hscb->shared_data.istatus.scsi_status);
7879 ahd_sync_sense(ahd, scb, BUS_DMASYNC_POSTREAD);
7880 siu = (struct scsi_status_iu_header *)scb->sense_data;
7881 ahd_set_scsi_status(scb, siu->status);
7884 ahd_print_path(ahd, scb);
7885 printf("SCB 0x%x Received PKT Status of 0x%x\n",
7886 SCB_GET_TAG(scb), siu->status);
7890 scsipi_printaddr(scb->xs->xs_periph);
7918 ahd_set_transaction_status(scb,
7922 scb->flags |= SCB_PKT_SENSE;
7928 ((uint8_t)scb->sense_data[
7930 ((uint8_t)scb->sense_data[
7932 ((uint8_t)scb->sense_data[
7937 ahd_done(ahd, scb);
7950 ahd_print_path(ahd, scb);
7951 printf("SCB %d: requests Check Status\n",
7952 SCB_GET_TAG(scb));
7956 if (ahd_perform_autosense(scb) == 0)
7959 ahd_compile_devinfo(&devinfo, SCB_GET_OUR_ID(scb),
7960 SCB_GET_TARGET(ahd, scb),
7961 SCB_GET_LUN(scb),
7962 SCB_GET_CHANNEL(ahd, scb),
7969 sg = scb->sg_list;
7974 ahd_update_residual(ahd, scb);
7977 ahd_print_path(ahd, scb);
7981 scb->sg_count = 0;
7982 sg = ahd_sg_setup(ahd, scb, sg, ahd_get_sense_bufaddr(ahd, scb),
7983 ahd_get_sense_bufsize(ahd, scb),
7987 sc->length = ahd_get_sense_bufsize(ahd, scb);
8006 if (ahd_get_residual(scb) == ahd_get_transfer_length(scb)) {
8013 scb->flags &=
8015 scb->flags |= SCB_AUTO_NEGOTIATE;
8018 ahd_setup_data_scb(ahd, scb);
8019 scb->flags |= SCB_SENSE;
8020 ahd_queue_scb(ahd, scb);
8025 ahd_scb_timer_reset(scb, 5 * 1000000);
8029 printf("%s: Interrupted for status of 0? (SCB 0x%x)\n",
8030 ahd_name(ahd), SCB_GET_TAG(scb));
8033 ahd_done(ahd, scb);
8039 * Calculate the residual for a just completed SCB.
8042 ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb)
8066 hscb = scb->hscb;
8081 * regardless of the role for this SCB.
8087 resid = ahd_get_transfer_length(scb);
8092 ahd_print_path(ahd, scb);
8094 SCB_GET_TAG(scb));
8095 ahd_freeze_devq(ahd, scb);
8096 ahd_set_transaction_status(scb, CAM_DATA_RUN_ERR);
8097 ahd_freeze_scb(scb);
8110 sg = ahd_sg_bus_to_virt(ahd, scb, resid_sgptr & SG_PTR_MASK);
8126 if ((scb->flags & SCB_SENSE) == 0)
8127 ahd_set_residual(scb, resid);
8129 ahd_set_sense_residual(scb, resid);*/
8133 ahd_print_path(ahd, scb);
8135 (scb->flags & SCB_SENSE) ? "Sense " : "", resid);
8656 struct scb *scb;
8729 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
8732 /*cur_col =*/ printf("\n%3d FIFO_USE[0x%x] ", SCB_GET_TAG(scb),
8734 ahd_set_scbptr(ahd, SCB_GET_TAG(scb));
8742 printf("Kernel Free SCB list: ");
8744 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {
8745 struct scb *list_scb;
8747 list_scb = scb;
8754 LIST_FOREACH(scb, &ahd->scb_data.any_dev_free_scb_list, links.le) {
8757 printf("%d ", SCB_GET_TAG(scb));
8795 struct scb *fifo_scb;
8801 printf("\n%s: FIFO%d %s, LONGJMP == 0x%x, SCB 0x%x\n",
9429 struct scb *scb;
9440 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
9443 ccbh = &scb->io_ctx->ccb_h;