Lines Matching refs:scb
54 void ahc_setup_data(struct ahc_softc *, struct scsi_xfer *, struct scb *);
56 void ahc_adapter_req_set_xfer_mode(struct ahc_softc *, struct scb *);
146 ahc_done(struct ahc_softc *ahc, struct scb *scb) in ahc_done() argument
148 struct scsi_xfer *xs = scb->xs; in ahc_done()
154 LIST_REMOVE(scb, pending_links); in ahc_done()
155 if ((scb->flags & SCB_UNTAGGEDQ) != 0) { in ahc_done()
159 target_offset = SCB_GET_TARGET_OFFSET(ahc, scb); in ahc_done()
161 TAILQ_REMOVE(untagged_q, scb, links.tqe); in ahc_done()
162 scb->flags &= ~SCB_UNTAGGEDQ; in ahc_done()
175 bus_dmamap_sync(ahc->parent_dmat, scb->dmamap, 0, in ahc_done()
176 scb->dmamap->dm_mapsize, op); in ahc_done()
177 bus_dmamap_unload(ahc->parent_dmat, scb->dmamap); in ahc_done()
192 if ((scb->flags & SCB_SENSE) == 0) { in ahc_done()
225 } else if ((scb->flags & SCB_SENSE) != 0) { in ahc_done()
237 memcpy(&xs->sense, ahc_get_sense_buf(ahc, scb), in ahc_done()
238 aic_le32toh(scb->sg_list->len) & AHC_SG_LEN_MASK); in ahc_done()
249 struct scb *scb; in ahc_action() local
265 scb = xs->io; in ahc_action()
268 scb->flags = SCB_FLAG_NONE; in ahc_action()
270 hscb = scb->hscb; in ahc_action()
275 printf("%s: start scb(%p)\n", ahc_name(ahc), scb); in ahc_action()
277 scb->xs = xs; in ahc_action()
278 timeout_set(&xs->stimeout, ahc_timeout, scb); in ahc_action()
288 scb->flags |= SCB_DEVICE_RESET; in ahc_action()
290 ahc_execute_scb(scb, NULL, 0); in ahc_action()
294 ahc_setup_data(ahc, xs, scb); in ahc_action()
300 struct scb *scb; in ahc_execute_scb() local
309 scb = (struct scb *)arg; in ahc_execute_scb()
310 xs = scb->xs; in ahc_execute_scb()
323 sg = scb->sg_list; in ahc_execute_scb()
341 scb->hscb->sgptr = aic_htole32(scb->sg_list_phys|SG_FULL_RESID); in ahc_execute_scb()
348 bus_dmamap_sync(ahc->parent_dmat, scb->dmamap, 0, in ahc_execute_scb()
349 scb->dmamap->dm_mapsize, op); in ahc_execute_scb()
354 bus_dmamap_sync(ahc->parent_dmat, scb->sg_map->sg_dmamap, in ahc_execute_scb()
355 0, scb->sg_map->sg_dmamap->dm_mapsize, in ahc_execute_scb()
359 scb->hscb->dataptr = scb->sg_list->addr; in ahc_execute_scb()
360 scb->hscb->datacnt = scb->sg_list->len; in ahc_execute_scb()
362 scb->hscb->sgptr = aic_htole32(SG_LIST_NULL); in ahc_execute_scb()
363 scb->hscb->dataptr = 0; in ahc_execute_scb()
364 scb->hscb->datacnt = 0; in ahc_execute_scb()
367 scb->sg_count = nsegments; in ahc_execute_scb()
371 tinfo = ahc_fetch_transinfo(ahc, SCSIID_CHANNEL(ahc, scb->hscb->scsiid), in ahc_execute_scb()
372 SCSIID_OUR_ID(scb->hscb->scsiid), in ahc_execute_scb()
373 SCSIID_TARGET(ahc, scb->hscb->scsiid), in ahc_execute_scb()
376 mask = SCB_GET_TARGET_MASK(ahc, scb); in ahc_execute_scb()
377 scb->hscb->scsirate = tinfo->scsirate; in ahc_execute_scb()
378 scb->hscb->scsioffset = tinfo->curr.offset; in ahc_execute_scb()
381 scb->hscb->control |= ULTRAENB; in ahc_execute_scb()
384 scb->hscb->control |= DISCENB; in ahc_execute_scb()
387 scb->flags |= SCB_AUTO_NEGOTIATE; in ahc_execute_scb()
388 scb->hscb->control |= MK_MESSAGE; in ahc_execute_scb()
392 scb->hscb->control |= TAG_ENB; in ahc_execute_scb()
398 LIST_INSERT_HEAD(&ahc->pending_scbs, scb, pending_links); in ahc_execute_scb()
413 if ((scb->hscb->control & (TARGET_SCB|TAG_ENB)) == 0 in ahc_execute_scb()
418 target_offset = SCB_GET_TARGET_OFFSET(ahc, scb); in ahc_execute_scb()
420 TAILQ_INSERT_TAIL(untagged_q, scb, links.tqe); in ahc_execute_scb()
421 scb->flags |= SCB_UNTAGGEDQ; in ahc_execute_scb()
422 if (TAILQ_FIRST(untagged_q) != scb) { in ahc_execute_scb()
431 scb->flags |= SCB_ACTIVE; in ahc_execute_scb()
433 if ((scb->flags & SCB_TARGET_IMMEDIATE) != 0) { in ahc_execute_scb()
435 ahc->scb_data->scbindex[scb->hscb->tag] = scb; in ahc_execute_scb()
438 ahc_outb(ahc, SCBPTR, scb->hscb->tag); in ahc_execute_scb()
439 ahc_outb(ahc, TARG_IMMEDIATE_SCB, scb->hscb->tag); in ahc_execute_scb()
442 ahc_queue_scb(ahc, scb); in ahc_execute_scb()
449 ahc_adapter_req_set_xfer_mode(ahc, scb); in ahc_execute_scb()
450 ahc_scb_devinfo(ahc, &devinfo, scb); in ahc_execute_scb()
472 ahc_timeout(scb); in ahc_execute_scb()
500 struct scb *scb) in ahc_setup_data() argument
504 hscb = scb->hscb; in ahc_setup_data()
517 scb->flags |= SCB_CDB32_PTR; in ahc_setup_data()
527 scb->dmamap, xs->data, in ahc_setup_data()
541 ahc_execute_scb(scb, scb->dmamap->dm_segs, in ahc_setup_data()
542 scb->dmamap->dm_nsegs); in ahc_setup_data()
544 ahc_execute_scb(scb, NULL, 0); in ahc_setup_data()
551 struct scb *scb, *list_scb; in ahc_timeout() local
557 scb = arg; in ahc_timeout()
558 ahc = scb->xs->sc_link->bus->sb_adapter_softc; in ahc_timeout()
563 printf("%s: SCB %d timed out\n", ahc_name(ahc), scb->hscb->tag); in ahc_timeout()
569 if (scb->flags & SCB_ACTIVE) { in ahc_timeout()
570 channel = SCB_GET_CHANNEL(ahc, scb); in ahc_timeout()
571 ahc_set_transaction_status(scb, CAM_CMD_TIMEOUT); in ahc_timeout()
629 ahc_adapter_req_set_xfer_mode(struct ahc_softc *ahc, struct scb *scb) in ahc_adapter_req_set_xfer_mode() argument
641 ahc_scb_devinfo(ahc, &devinfo, scb); in ahc_adapter_req_set_xfer_mode()
642 quirks = scb->xs->sc_link->quirks; in ahc_adapter_req_set_xfer_mode()
709 struct scb *scb; in ahc_scb_alloc() local
712 scb = SLIST_FIRST(&ahc->scb_data->free_scbs); in ahc_scb_alloc()
714 if (scb != NULL) in ahc_scb_alloc()
719 return (scb); in ahc_scb_alloc()
729 struct scb *scb = io; in ahc_scb_free() local
732 hscb = scb->hscb; in ahc_scb_free()
735 scb->flags = SCB_FLAG_NONE; in ahc_scb_free()
739 SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs, scb, links.sle); in ahc_scb_free()
743 ahc_platform_scb_free(ahc, scb); in ahc_scb_free()