Lines Matching defs:scb

170 						   struct scb *scb);
207 struct scb *scb);
215 struct scb *prev_scb,
216 struct scb *scb);
330 struct scb *scb;
356 scb = ahc_lookup_scb(ahc, scb_index);
357 if (scb == NULL) {
358 printf("%s: WARNING no command for scb %d "
369 ahc_update_residual(ahc, scb);
370 ahc_done(ahc, scb);
386 struct scb *scb;
391 if ((scb = TAILQ_FIRST(queue)) != NULL
392 && (scb->flags & SCB_ACTIVE) == 0) {
393 scb->flags |= SCB_ACTIVE;
394 ahc_queue_scb(ahc, scb);
435 struct scb *scb;
470 scb = ahc_lookup_scb(ahc, scb_index);
471 if (scb == NULL) {
473 printf("ahc_intr - referenced scb "
474 "not valid during seqint 0x%x scb(%d)\n",
481 hscb = scb->hscb;
484 if ((scb->flags & SCB_SENSE) != 0) {
490 scb->flags &= ~SCB_SENSE;
491 ahc_set_transaction_status(scb, CAM_AUTOSENSE_FAIL);
494 ahc_set_transaction_status(scb, CAM_SCSI_STATUS_ERROR);
496 ahc_freeze_devq(ahc, scb);
497 ahc_freeze_scb(scb);
498 ahc_set_scsi_status(scb, hscb->shared_data.status.scsi_status);
514 ahc_print_path(ahc, scb);
516 scb->hscb->tag);
520 if (ahc_perform_autosense(scb) == 0)
529 sg = scb->sg_list;
534 ahc_update_residual(ahc, scb);
537 ahc_print_path(ahc, scb);
541 sg->addr = ahc_get_sense_bufaddr(ahc, scb);
542 sg->len = ahc_get_sense_bufsize(ahc, scb);
552 && SCB_GET_LUN(scb) < 8)
553 sc->byte2 = SCB_GET_LUN(scb) << 5;
576 if (ahc_get_residual(scb)
577 == ahc_get_transfer_length(scb)) {
584 scb->flags &= ~SCB_NEGOTIATE;
585 scb->flags |= SCB_AUTO_NEGOTIATE;
590 hscb->sgptr = scb->sg_list_phys | SG_FULL_RESID;
595 (scb - ahc->scb_data->scbarray) *
600 scb->sg_map->sg_dmamap,
601 0, scb->sg_map->sg_dmamap->dm_mapsize,
608 scb->sg_count = 1;
609 scb->flags |= SCB_SENSE;
610 ahc_qinfifo_requeue_tail(ahc, scb);
616 ahc_scb_timer_reset(scb, 5 * 1000000);
736 scb = ahc_lookup_scb(ahc, scb_index);
738 if (scb == NULL)
745 scb);
762 scb);
824 scb = ahc_lookup_scb(ahc, scb_index);
825 if (scb != NULL)
826 ahc_set_transaction_status(scb,
851 scb = ahc_lookup_scb(ahc, scbindex);
858 ahc_print_path(ahc, scb);
862 scb->hscb->tag);
863 ahc_print_path(ahc, scb);
866 ahc_get_transfer_length(scb), scb->sg_count);
867 if (scb->sg_count > 0) {
868 for (i = 0; i < scb->sg_count; i++) {
872 (aic_le32toh(scb->sg_list[i].len) >> 24
874 aic_le32toh(scb->sg_list[i].addr),
875 aic_le32toh(scb->sg_list[i].len)
885 ahc_freeze_devq(ahc, scb);
886 if ((scb->flags & SCB_SENSE) == 0) {
887 ahc_set_transaction_status(scb, CAM_DATA_RUN_ERR);
889 scb->flags &= ~SCB_SENSE;
890 ahc_set_transaction_status(scb, CAM_AUTOSENSE_FAIL);
892 ahc_freeze_scb(scb);
923 scb = ahc_lookup_scb(ahc, scbindex);
924 if (scb != NULL)
929 ahc_search_qinfifo(ahc, SCB_GET_TARGET(ahc, scb),
930 SCB_GET_CHANNEL(ahc, scb),
931 SCB_GET_LUN(scb), scb->hscb->tag,
1004 struct scb *scb;
1040 scb = ahc_lookup_scb(ahc, scb_index);
1041 if (scb != NULL
1043 scb = NULL;
1119 if (scb != NULL) {
1120 if (SCB_IS_SILENT(scb))
1123 ahc_print_path(ahc, scb);
1124 scb->flags |= SCB_TRANSMISSION_ERROR;
1211 scb = ahc_lookup_scb(ahc, scb_index);
1212 if (scb == NULL) {
1213 printf("%s: ahc_intr - referenced scb not "
1214 "valid during SELTO scb(%d, %d)\n",
1221 ahc_print_path(ahc, scb);
1226 ahc_scb_devinfo(ahc, &devinfo, scb);
1227 ahc_set_transaction_status(scb, CAM_SEL_TIMEOUT);
1228 ahc_freeze_devq(ahc, scb);
1296 tag = scb->hscb->tag;
1297 ahc_print_path(ahc, scb);
1299 scb->hscb->tag, tag == SCB_LIST_NULL ?
1314 if (scb != NULL
1315 && scb->io_ctx->ccb_h.func_code== XPT_RESET_DEV
1316 && ahc_match_scb(ahc, scb, target, channel,
1320 ahc_set_transaction_status(scb, CAM_REQ_CMP);
1351 ahc_qinfifo_requeue_tail(ahc, scb);
1363 ahc_qinfifo_requeue_tail(ahc, scb);
1377 ahc_qinfifo_requeue_tail(ahc, scb);
1384 if (scb != NULL) {
1387 if ((scb->hscb->control & TAG_ENB) != 0)
1388 tag = scb->hscb->tag;
1391 ahc_print_path(ahc, scb);
1393 SCB_GET_LUN(scb), tag,
1561 ahc_print_scb(struct scb *scb)
1565 struct hardware_scb *hscb = scb->hscb;
1567 printf("scb:%p control:0x%x scsiid:0x%x lun:%d cdb_len:%d\n",
1568 (void *)scb,
1581 if (scb->sg_count > 0) {
1582 for (i = 0; i < scb->sg_count; i++) {
1585 (aic_le32toh(scb->sg_list[i].len) >> 24
1587 aic_le32toh(scb->sg_list[i].addr),
1588 aic_le32toh(scb->sg_list[i].len));
2131 struct scb *pending_scb;
2280 struct scb *scb)
2285 our_id = SCSIID_OUR_ID(scb->hscb->scsiid);
2287 if ((scb->flags & SCB_TARGET_SCB) != 0)
2289 ahc_compile_devinfo(devinfo, our_id, SCB_GET_TARGET(ahc, scb),
2290 SCB_GET_LUN(scb), SCB_GET_CHANNEL(ahc, scb), role);
2314 struct scb *scb)
2324 if ((scb->flags & SCB_DEVICE_RESET) == 0
2328 identify_msg = MSG_IDENTIFYFLAG | SCB_GET_LUN(scb);
2329 if ((scb->hscb->control & DISCENB) != 0)
2334 if ((scb->hscb->control & TAG_ENB) != 0) {
2336 scb->hscb->control & (TAG_ENB|SCB_TAG_TYPE);
2337 ahc->msgout_buf[ahc->msgout_index++] = scb->hscb->tag;
2342 if (scb->flags & SCB_DEVICE_RESET) {
2345 ahc_print_path(ahc, scb);
2355 } else if ((scb->flags & SCB_ABORT) != 0) {
2356 if ((scb->hscb->control & TAG_ENB) != 0)
2361 ahc_print_path(ahc, scb);
2363 (scb->hscb->control & TAG_ENB) != 0 ? " Tag" : "");
2372 } else if ((scb->flags & (SCB_AUTO_NEGOTIATE|SCB_NEGOTIATE)) != 0) {
2377 printf("SCSIID = %x, target_mask = %x\n", scb->hscb->scsiid,
2380 "SCB flags = %x", scb->hscb->tag, scb->hscb->control,
2381 ahc_inb(ahc, MSG_OUT), scb->flags);
2389 scb->hscb->control &= ~MK_MESSAGE;
2588 struct scb *scb;
2597 scb = ahc_lookup_scb(ahc, scbid);
2611 scb = NULL;
2612 } else if (scb == NULL) {
2621 ahc_set_transaction_status(scb, CAM_SEQUENCE_FAIL);
2623 ahc_print_path(ahc, scb);
2633 ahc_print_path(ahc, scb);
2636 ahc_print_path(ahc, scb);
2663 if (scb == NULL) {
2670 ahc_print_path(ahc, scb);
2671 scb->flags |= SCB_ABORT;
3461 struct scb *scb;
3469 scb = ahc_lookup_scb(ahc, scb_index);
3530 } else if ((scb->hscb->control & MSG_SIMPLE_TASK) != 0) {
3534 tag_type = (scb->hscb->control & MSG_SIMPLE_TASK);
3558 scb->hscb->control &= mask;
3559 ahc_set_transaction_tag(scb, /*enabled*/FALSE,
3573 TAILQ_INSERT_HEAD(untagged_q, scb, links.tqe);
3574 scb->flags |= SCB_UNTAGGEDQ;
3576 ahc_busy_tcl(ahc, BUILD_TCL(scb->hscb->scsiid, devinfo->lun),
3577 scb->hscb->tag);
3584 ahc_search_qinfifo(ahc, SCB_GET_TARGET(ahc, scb),
3585 SCB_GET_CHANNEL(ahc, scb),
3586 SCB_GET_LUN(scb), /*tag*/SCB_LIST_NULL,
3607 struct scb *scb;
3610 scb = ahc_lookup_scb(ahc, scb_index);
3616 || ahc_get_transfer_dir(scb) != CAM_DIR_IN) {
3665 sg = ahc_sg_bus_to_virt(scb, sgptr);
3673 if (sg != scb->sg_list
3691 sgptr = ahc_sg_virt_to_bus(scb, sg);
3715 struct scb *scb;
3723 scb = ahc_lookup_scb(ahc, scb_index);
3730 sg = ahc_sg_bus_to_virt(scb, sgptr);
3825 struct scb *scb)
3836 if (scb != NULL && (scb->flags & SCB_AUTO_NEGOTIATE) != 0)
3856 /* XXX The shared scb data stuff should be deprecated */
4210 scb_data->scbarray = mallocarray(AHC_SCB_MAX_ALLOC, sizeof(struct scb),
4325 AHC_SCB_MAX_ALLOC * sizeof(struct scb));
4333 struct scb *next_scb;
4376 * The first entry is embedded in the scb.
4767 printf("%s: hardware scb %u bytes; kernel scb %u bytes; "
4771 (u_int)sizeof(struct scb),
5003 ahc_match_scb(struct ahc_softc *ahc, struct scb *scb, int target,
5009 if (scb == NULL)
5012 targ = SCB_GET_TARGET(ahc, scb);
5013 chan = SCB_GET_CHANNEL(ahc, scb);
5014 slun = SCB_GET_LUN(scb);
5025 group = XPT_FC_GROUP(scb->io_ctx->ccb_h.func_code);
5028 && ((tag == scb->hscb->tag)
5032 && ((tag == scb->io_ctx->csio.tag_id)
5036 match = ((tag == scb->hscb->tag) || (tag == SCB_LIST_NULL));
5044 ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
5050 target = SCB_GET_TARGET(ahc, scb);
5051 lun = SCB_GET_LUN(scb);
5052 channel = SCB_GET_CHANNEL(ahc, scb);
5060 ahc_qinfifo_requeue_tail(struct ahc_softc *ahc, struct scb *scb)
5062 struct scb *prev_scb;
5073 ahc_qinfifo_requeue(ahc, prev_scb, scb);
5082 ahc_qinfifo_requeue(struct ahc_softc *ahc, struct scb *prev_scb,
5083 struct scb *scb)
5086 ahc_outb(ahc, NEXT_QUEUED_SCB, scb->hscb->tag);
5088 prev_scb->hscb->next = scb->hscb->tag;
5092 ahc->qinfifo[ahc->qinfifonext] = scb->hscb->tag;
5097 scb->hscb->next = ahc->next_queued_scb->hscb->tag;
5098 ahc_sync_scb(ahc, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
5121 struct scb *scb;
5122 struct scb *prev_scb;
5159 scb = ahc_lookup_scb(ahc, ahc->qinfifo[qinpos]);
5160 if (scb == NULL) {
5166 if (ahc_match_scb(ahc, scb, target, channel, lun, tag, role)) {
5168 * We found an scb that needs to be acted on.
5177 ostat = ahc_get_transaction_status(scb);
5179 ahc_set_transaction_status(scb, status);
5180 cstat = ahc_get_transaction_status(scb);
5182 ahc_freeze_scb(scb);
5183 if ((scb->flags & SCB_ACTIVE) == 0)
5185 ahc_done(ahc, scb);
5192 ahc_qinfifo_requeue(ahc, prev_scb, scb);
5193 prev_scb = scb;
5197 ahc_qinfifo_requeue(ahc, prev_scb, scb);
5198 prev_scb = scb;
5224 scb = ahc_lookup_scb(ahc, ahc->qinfifo[qinstart]);
5226 if (scb == NULL) {
5237 next = scb->hscb->next;
5238 ahc->scb_data->scbindex[scb->hscb->tag] = NULL;
5239 ahc_swap_with_next_hscb(ahc, scb);
5240 scb->hscb->next = next;
5241 ahc->qinfifo[qinstart] = scb->hscb->tag;
5244 ahc_outb(ahc, NEXT_QUEUED_SCB, scb->hscb->tag);
5248 scb = ahc_lookup_scb(ahc, ahc->qinfifo[qintail]);
5249 scb->hscb->next = ahc->next_queued_scb->hscb->tag;
5271 scb = ahc_lookup_scb(ahc, scb_index);
5272 if (scb == NULL) {
5277 if (ahc_match_scb(ahc, scb, target, channel,
5280 * We found an scb that needs to be acted on.
5289 ostat = ahc_get_transaction_status(scb);
5291 ahc_set_transaction_status(scb, status);
5292 cstat = ahc_get_transaction_status(scb);
5294 ahc_freeze_scb(scb);
5295 if ((scb->flags & SCB_ACTIVE) == 0)
5297 ahc_done(ahc, scb);
5329 struct scb *scb;
5360 struct scb *next_scb;
5366 scb = next_scb;
5367 next_scb = TAILQ_NEXT(scb, links.tqe);
5378 if ((scb->flags & SCB_ACTIVE) != 0)
5381 if (ahc_match_scb(ahc, scb, target, channel, lun,
5383 || (xs != NULL && xs != scb->xs))
5387 * We found an scb that needs to be acted on.
5396 ostat = ahc_get_transaction_status(scb);
5398 ahc_set_transaction_status(scb, status);
5399 cstat = ahc_get_transaction_status(scb);
5401 ahc_freeze_scb(scb);
5402 ahc_done(ahc, scb);
5406 scb->flags &= ~SCB_UNTAGGEDQ;
5407 TAILQ_REMOVE(untagged_q, scb, links.tqe);
5425 struct scb *scbp;
5530 * scb that follows the one that we remove.
5562 * Select the scb that pointed to us
5570 * Point us back at the original scb position.
5587 struct scb *scbp;
5588 struct scb *scbp_next;
5670 * bus free with the same scb queued for an abort). Don't hold this
5903 ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
5927 hscb = scb->hscb;
5942 resid = ahc_get_transfer_length(scb);
5956 sg = ahc_sg_bus_to_virt(scb, resid_sgptr & SG_PTR_MASK);
5971 if ((scb->flags & SCB_SENSE) == 0)
5972 ahc_set_residual(scb, resid);
5974 ahc_set_sense_residual(scb, resid);
5978 ahc_print_path(ahc, scb);
5980 (scb->flags & SCB_SENSE) ? "Sense " : "", resid);
6421 struct scb *scb;
6552 LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) {
6555 /*cur_col =*/ printf("\n%3d ", scb->hscb->tag);
6556 ahc_scb_control_print(scb->hscb->control, &cur_col, 60);
6557 ahc_scb_scsiid_print(scb->hscb->scsiid, &cur_col, 60);
6558 ahc_scb_lun_print(scb->hscb->lun, &cur_col, 60);
6560 ahc_outb(ahc, SCBPTR, scb->hscb->tag);
6573 SLIST_FOREACH(scb, &ahc->scb_data->free_scbs, links.sle) {
6576 printf("%d ", scb->hscb->tag);
6588 TAILQ_FOREACH(scb, untagged_q, links.tqe) {
6591 printf("%d ", scb->hscb->tag);
6905 struct scb *scb;
6916 LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) {
6919 ccbh = &scb->io_ctx->ccb_h;