Home | History | Annotate | Download | only in ic

Lines Matching refs:scb

95 	{ MPARERR,	"Scratch or SCB Memory Parity Error" },
169 struct scb *scb);
173 struct scb *scb);
211 struct scb *scb);
221 struct scb *prev_scb,
222 struct scb *scb);
307 * If we were in the process of DMA'ing SCB data into
308 * an SCB, replace that SCB on the free list. This prevents
309 * an SCB leak.
327 struct scb *scb;
354 scb = ahc_lookup_scb(ahc, scb_index);
355 if (scb == NULL) {
356 printf("%s: WARNING no command for scb %d "
367 ahc_update_residual(ahc, scb);
368 ahc_done(ahc, scb);
384 struct scb *scb;
389 if ((scb = TAILQ_FIRST(queue)) != NULL
390 && (scb->flags & SCB_ACTIVE) == 0) {
391 scb->flags |= SCB_ACTIVE;
392 ahc_queue_scb(ahc, scb);
429 struct scb *scb;
460 * DMA'd the SCB back up to us, so we can reference
464 scb = ahc_lookup_scb(ahc, scb_index);
465 if (scb == NULL) {
467 printf("ahc_intr - referenced scb "
468 "not valid during seqint 0x%x scb(%d)\n",
475 hscb = scb->hscb;
478 if ((scb->flags & SCB_SENSE) != 0) {
484 scb->flags &= ~SCB_SENSE;
488 ahc_freeze_devq(ahc, scb);
489 ahc_freeze_scb(scb);
490 ahc_set_scsi_status(scb, hscb->shared_data.status.scsi_status);
507 ahc_print_path(ahc, scb);
508 printf("SCB %d: requests Check Status\n",
509 scb->hscb->tag);
513 if (ahc_perform_autosense(scb) == 0)
522 sg = scb->sg_list;
528 ahc_update_residual(ahc, scb);
531 ahc_print_path(ahc, scb);
535 sg->addr = ahc_htole32(ahc_get_sense_bufaddr(ahc, scb));
536 len = ahc_get_sense_bufsize(ahc, scb);
542 && SCB_GET_LUN(scb) < 8)
543 sc->byte2 = SCB_GET_LUN(scb) << 5;
563 if (ahc_get_residual(scb)
564 == ahc_get_transfer_length(scb)) {
571 scb->flags &= ~SCB_NEGOTIATE;
572 scb->flags |= SCB_AUTO_NEGOTIATE;
578 ahc_htole32(scb->sg_list_phys | SG_FULL_RESID);
579 scb->sg_count = 1;
580 scb->flags |= SCB_SENSE;
581 ahc_qinfifo_requeue_tail(ahc, scb);
587 ahc_scb_timer_reset(scb, 5 * 1000000);
601 printf("%s:%c:%d: no active SCB for reconnecting "
689 struct scb *scb1;
713 "invalid SCB %x\n", scb_index);
793 struct scb *scb1;
827 scb = ahc_lookup_scb(ahc, scbindex);
832 ahc_print_path(ahc, scb);
836 scb->hscb->tag);
837 ahc_print_path(ahc, scb);
840 ahc_get_transfer_length(scb), scb->sg_count);
841 if (scb->sg_count > 0) {
842 for (i = 0; i < scb->sg_count; i++) {
846 (ahc_le32toh(scb->sg_list[i].len) >> 24
848 ahc_le32toh(scb->sg_list[i].addr),
849 ahc_le32toh(scb->sg_list[i].len)
857 ahc_freeze_devq(ahc, scb);
858 if ((scb->flags & SCB_SENSE) == 0) {
859 ahc_set_transaction_status(scb, CAM_DATA_RUN_ERR);
861 scb->flags &= ~SCB_SENSE;
862 ahc_set_transaction_status(scb, CAM_AUTOSENSE_FAIL);
864 ahc_freeze_scb(scb);
895 scb = ahc_lookup_scb(ahc, scbindex);
896 if (scb != NULL
897 && (scb->flags & SCB_RECOVERY_SCB) != 0)
900 * SCB into the QINFIFO.
902 ahc_search_qinfifo(ahc, SCB_GET_TARGET(ahc, scb),
903 SCB_GET_CHANNEL(ahc, scb),
904 SCB_GET_LUN(scb), scb->hscb->tag,
975 struct scb *scb;
1011 scb = ahc_lookup_scb(ahc, scb_index);
1012 if (scb != NULL
1014 scb = NULL;
1089 if (scb != NULL) {
1090 if (SCB_IS_SILENT(scb))
1093 ahc_print_path(ahc, scb);
1094 scb->flags |= SCB_TRANSMISSION_ERROR;
1179 scb = ahc_lookup_scb(ahc, scb_index);
1180 if (scb == NULL) {
1181 printf("%s: ahc_intr - referenced scb not "
1182 "valid during SELTO scb(%d, %d)\n",
1188 ahc_print_path(ahc, scb);
1189 printf("Saw Selection Timeout for SCB 0x%x\n",
1203 ahc_set_transaction_status(scb, CAM_SEL_TIMEOUT);
1204 ahc_freeze_devq(ahc, scb);
1260 tag = scb->hscb->tag;
1261 ahc_print_path(ahc, scb);
1262 printf("SCB %d - Abort%s Completed.\n",
1263 scb->hscb->tag, tag == SCB_LIST_NULL ?
1278 if (scb != NULL
1279 && scb->io_ctx->ccb_h.func_code== XPT_RESET_DEV
1280 && ahc_match_scb(ahc, scb, target, channel,
1284 ahc_set_transaction_status(scb,
1316 ahc_qinfifo_requeue_tail(ahc, scb);
1336 ahc_qinfifo_requeue_tail(ahc, scb);
1343 if (scb != NULL) {
1346 if ((scb->hscb->control & TAG_ENB) != 0)
1347 tag = scb->hscb->tag;
1350 ahc_print_path(ahc, scb);
1352 SCB_GET_LUN(scb), tag,
1523 ahc_print_scb(struct scb *scb)
1527 struct hardware_scb *hscb = scb->hscb;
1529 printf("scb:%p control:0x%x scsiid:0x%x lun:%d cdb_len:%d\n",
1530 (void *)scb,
1543 if (scb->sg_count > 0) {
1544 for (i = 0; i < scb->sg_count; i++) {
1547 (ahc_le32toh(scb->sg_list[i].len) >> 24
1549 ahc_le32toh(scb->sg_list[i].addr),
1550 ahc_le32toh(scb->sg_list[i].len));
2089 struct scb *pending_scb;
2096 * Traverse the pending SCB list and ensure that all of the
2238 struct scb *scb)
2243 our_id = SCSIID_OUR_ID(scb->hscb->scsiid);
2245 if ((scb->flags & SCB_TARGET_SCB) != 0)
2247 ahc_compile_devinfo(devinfo, our_id, SCB_GET_TARGET(ahc, scb),
2248 SCB_GET_LUN(scb), SCB_GET_CHANNEL(ahc, scb), role);
2272 struct scb *scb)
2282 if ((scb->flags & SCB_DEVICE_RESET) == 0
2286 identify_msg = MSG_IDENTIFYFLAG | SCB_GET_LUN(scb);
2287 if ((scb->hscb->control & DISCENB) != 0)
2292 if ((scb->hscb->control & TAG_ENB) != 0) {
2294 scb->hscb->control & (TAG_ENB|SCB_TAG_TYPE);
2295 ahc->msgout_buf[ahc->msgout_index++] = scb->hscb->tag;
2300 if (scb->flags & SCB_DEVICE_RESET) {
2303 ahc_print_path(ahc, scb);
2313 } else if ((scb->flags & SCB_ABORT) != 0) {
2314 if ((scb->hscb->control & TAG_ENB) != 0)
2319 ahc_print_path(ahc, scb);
2321 (scb->hscb->control & TAG_ENB) != 0 ? " Tag" : "");
2330 } else if ((scb->flags & (SCB_AUTO_NEGOTIATE|SCB_NEGOTIATE)) != 0) {
2333 printf("ahc_intr: AWAITING_MSG for an SCB that "
2335 printf("SCSIID = %x, target_mask = %x\n", scb->hscb->scsiid,
2337 panic("SCB = %d, SCB Control = %x, MSG_OUT = %x "
2338 "SCB flags = %x", scb->hscb->tag, scb->hscb->control,
2339 ahc_inb(ahc, MSG_OUT), scb->flags);
2343 * Clear the MK_MESSAGE flag from the SCB so we aren't
2347 scb->hscb->control &= ~MK_MESSAGE;
2545 struct scb *scb;
2554 scb = ahc_lookup_scb(ahc, scbid);
2562 * identify message, or did, but we didn't find an SCB
2568 scb = NULL;
2569 } else if (scb == NULL) {
2571 * We don't seem to have an SCB active for this
2575 printf("No SCB found during protocol violation\n");
2578 ahc_set_transaction_status(scb, CAM_SEQUENCE_FAIL);
2580 ahc_print_path(ahc, scb);
2590 ahc_print_path(ahc, scb);
2593 ahc_print_path(ahc, scb);
2620 if (scb == NULL) {
2627 ahc_print_path(ahc, scb);
2628 scb->flags |= SCB_ABORT;
3411 struct scb *scb;
3419 scb = ahc_lookup_scb(ahc, scb_index);
3482 } else if ((scb->hscb->control & MSG_SIMPLE_TASK) != 0) {
3486 tag_type = (scb->hscb->control & MSG_SIMPLE_TASK);
3515 scb->hscb->control &= mask;
3516 ahc_set_transaction_tag(scb, /*enabled*/FALSE,
3530 TAILQ_INSERT_HEAD(untagged_q, scb, links.tqe);
3531 scb->flags |= SCB_UNTAGGEDQ;
3533 ahc_busy_tcl(ahc, BUILD_TCL(scb->hscb->scsiid, devinfo->lun),
3534 scb->hscb->tag);
3541 ahc_search_qinfifo(ahc, SCB_GET_TARGET(ahc, scb),
3542 SCB_GET_CHANNEL(ahc, scb),
3543 SCB_GET_LUN(scb), /*tag*/SCB_LIST_NULL,
3566 struct scb *scb;
3569 scb = ahc_lookup_scb(ahc, scb_index);
3575 || ahc_get_transfer_dir(scb) != CAM_DIR_IN) {
3623 sg = ahc_sg_bus_to_virt(scb, sgptr);
3630 if (sg != scb->sg_list
3648 sgptr = ahc_sg_virt_to_bus(scb, sg);
3674 struct scb *scb;
3682 scb = ahc_lookup_scb(ahc, scb_index);
3689 sg = ahc_sg_bus_to_virt(scb, sgptr);
3783 struct scb *scb)
3794 if (scb != NULL && (scb->flags & SCB_AUTO_NEGOTIATE) != 0)
3814 /* XXX The shared scb data stuff should be deprecated */
4141 * Touch all SCB bytes to avoid parity errors
4163 /* Make sure that the last SCB terminates the free list */
4177 /* Allocate SCB resources */
4178 scb_data->scbarray = malloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC,
4185 /* SCB 0 heads the free list */
4192 printf("%s: No SCB space found\n", ahc_name(ahc));
4213 "hardware SCB structures") < 0)
4241 * Tell the sequencer which SCB will be the next one it receives.
4305 struct scb *next_scb;
4354 * The first entry is embedded in the scb.
4533 /* Allocate SCB data now that buffer_dmat is initialized */
4572 printf("%s: hardware scb %lu bytes; kernel scb %lu bytes; "
4576 (u_long)sizeof(struct scb),
4772 * The SCB based BTT allows an entry per
5177 /************************** SCB and SCB queue management **********************/
5179 ahc_match_scb(struct ahc_softc *ahc, struct scb *scb, int target,
5182 int targ = SCB_GET_TARGET(ahc, scb);
5183 char chan = SCB_GET_CHANNEL(ahc, scb);
5184 int slun = SCB_GET_LUN(scb);
5197 group = XPT_FC_GROUP(scb->io_ctx->ccb_h.func_code);
5200 && ((tag == scb->hscb->tag)
5204 && ((tag == scb->io_ctx->csio.tag_id)
5208 match = ((tag == scb->hscb->tag) || (tag == SCB_LIST_NULL));
5217 ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
5223 target = SCB_GET_TARGET(ahc, scb);
5224 lun = SCB_GET_LUN(scb);
5225 channel = SCB_GET_CHANNEL(ahc, scb);
5231 ahc_platform_freeze_devq(ahc, scb);
5235 ahc_qinfifo_requeue_tail(struct ahc_softc *ahc, struct scb *scb)
5237 struct scb *prev_scb;
5248 ahc_qinfifo_requeue(ahc, prev_scb, scb);
5257 ahc_qinfifo_requeue(struct ahc_softc *ahc, struct scb *prev_scb,
5258 struct scb *scb)
5261 ahc_outb(ahc, NEXT_QUEUED_SCB, scb->hscb->tag);
5263 prev_scb->hscb->next = scb->hscb->tag;
5267 ahc->qinfifo[ahc->qinfifonext++] = scb->hscb->tag;
5268 scb->hscb->next = ahc->next_queued_scb->hscb->tag;
5269 ahc_sync_scb(ahc, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
5292 struct scb *scb;
5293 struct scb *prev_scb;
5330 scb = ahc_lookup_scb(ahc, ahc->qinfifo[qinpos]);
5331 if (scb == NULL) {
5332 SCB index = %d\n",
5337 if (ahc_match_scb(ahc, scb, target, channel, lun, tag, role)) {
5339 * We found an scb that needs to be acted on.
5348 ostat = ahc_get_transaction_status(scb);
5350 ahc_set_transaction_status(scb, status);
5351 cstat = ahc_get_transaction_status(scb);
5353 ahc_freeze_scb(scb);
5354 if ((scb->flags & SCB_ACTIVE) == 0)
5355 printf("Inactive SCB in qinfifo\n");
5356 ahc_done(ahc, scb);
5363 ahc_qinfifo_requeue(ahc, prev_scb, scb);
5364 prev_scb = scb;
5368 ahc_qinfifo_requeue(ahc, prev_scb, scb);
5369 prev_scb = scb;
5385 * down the SCB at the beginning of the queue.
5387 * or the second SCB is removed from the queue
5388 * (the first SCB includes a pointer to the "next"
5389 * SCB to DMA). If we have removed any entries, swap
5395 scb = ahc_lookup_scb(ahc, ahc->qinfifo[qinstart]);
5397 if (scb == NULL) {
5404 * point to the reserved SCB for future commands. Save
5408 next = scb->hscb->next;
5409 ahc->scb_data->scbindex[scb->hscb->tag] = NULL;
5410 ahc_swap_with_next_hscb(ahc, scb);
5411 scb->hscb->next = next;
5412 ahc->qinfifo[qinstart] = scb->hscb->tag;
5415 ahc_outb(ahc, NEXT_QUEUED_SCB, scb->hscb->tag);
5419 scb = ahc_lookup_scb(ahc, ahc->qinfifo[qintail]);
5420 scb->hscb->next = ahc->next_queued_scb->hscb->tag;
5437 "SCB index == %d, yet numscbs == %d.",
5442 scb = ahc_lookup_scb(ahc, scb_index);
5443 if (scb == NULL) {
5448 if (ahc_match_scb(ahc, scb, target, channel,
5451 * We found an scb that needs to be acted on.
5460 ostat = ahc_get_transaction_status(scb);
5462 ahc_set_transaction_status(scb, status);
5463 cstat = ahc_get_transaction_status(scb);
5465 ahc_freeze_scb(scb);
5466 if ((scb->flags & SCB_ACTIVE) == 0)
5467 printf("Inactive SCB in "
5469 ahc_done(ahc, scb);
5501 struct scb *scb;
5532 struct scb *next_scb;
5538 scb = next_scb;
5539 next_scb = TAILQ_NEXT(scb, links.tqe);
5550 if ((scb->flags & SCB_ACTIVE) != 0)
5553 if (ahc_match_scb(ahc, scb, target, channel, lun,
5555 /*|| (ctx != NULL && ctx != scb->io_ctx)*/)
5559 * We found an scb that needs to be acted on.
5568 ostat = ahc_get_transaction_status(scb);
5570 ahc_set_transaction_status(scb, status);
5571 cstat = ahc_get_transaction_status(scb);
5573 ahc_freeze_scb(scb);
5574 if ((scb->flags & SCB_ACTIVE) == 0)
5575 printf("Inactive SCB in untaggedQ\n");
5576 ahc_done(ahc, scb);
5580 scb->flags &= ~SCB_UNTAGGEDQ;
5581 TAILQ_REMOVE(untagged_q, scb, links.tqe);
5599 struct scb *scbp;
5623 "SCB index == %d, yet numscbs == %d.",
5658 * Remove an SCB from the on chip list of disconnected transactions.
5659 * This is empty/unused if we are not performing SCB paging.
5683 * Add the SCB as selected by SCBPTR onto the on chip list of
5685 * performing SCB paging.
5704 * scb that follows the one that we remove.
5712 * Select the SCB we want to abort and
5736 * Select the scb that pointed to us
5744 * Point us back at the original scb position.
5761 struct scb *scbp;
5762 struct scb *scbp_next;
5798 * Unless we are using an SCB based
5832 * We save the active SCB and restore it ourselves, so there
5841 * Go through the hardware SCB array looking for commands that
5844 * bus free with the same scb queued for an abort). Don't hold this
5878 printf("Inactive SCB on pending list\n");
6073 * Calculate the residual for a just completed SCB.
6076 ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
6100 hscb = scb->hscb;
6115 resid = ahc_get_transfer_length(scb);
6129 sg = ahc_sg_bus_to_virt(scb, resid_sgptr & SG_PTR_MASK);
6144 if ((scb->flags & SCB_SENSE) == 0)
6145 ahc_set_residual(scb, resid);
6147 ahc_set_sense_residual(scb, resid);
6151 ahc_print_path(ahc, scb);
6153 (scb->flags & SCB_SENSE) ? "Sense " : "", resid);
6601 struct scb *scb;
6708 printf("Sequencer Free SCB List: ");
6718 printf("Sequencer SCB Info: ");
6732 LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) {
6735 /*cur_col =*/ printf("\n%3d ", scb->hscb->tag);
6736 ahc_scb_control_print(scb->hscb->control, &cur_col, 60);
6737 ahc_scb_scsiid_print(scb->hscb->scsiid, &cur_col, 60);
6738 ahc_scb_lun_print(scb->hscb->lun, &cur_col, 60);
6740 ahc_outb(ahc, SCBPTR, scb->hscb->tag);
6750 printf("Kernel Free SCB list: ");
6752 SLIST_FOREACH(scb, &ahc->scb_data->free_scbs, links.sle) {
6755 printf("%d ", scb->hscb->tag);
6766 TAILQ_FOREACH(scb, untagged_q, links.tqe) {
6769 printf("%d ", scb->hscb->tag);
7063 struct scb *scb;
7074 LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) {
7077 ccbh = &scb->io_ctx->ccb_h;