Home | History | Annotate | Download | only in dti

Lines Matching defs:ccb

345 	struct bt_ccb *ccb;
371 * fill up with ccb's
374 ccb = (struct bt_ccb *)bouncearea;
376 bt_init_ccb(sc, ccb);
377 TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain);
420 struct bt_ccb *ccb;
443 ccb = bt_ccb_phys_kv(sc, phystol(wmbi->ccb_addr));
444 if (!ccb) {
445 printf("%s: bad mbi ccb pointer; skipping\n",
452 u_char *cp = (u_char *) &ccb->scsi_cmd;
457 printf("ccb addr = 0x%x\n", ccb);
464 if ((ccb->flags & CCB_ABORT) != 0) {
467 * to complete before clearing the CCB. We
471 * the CCB a bit later than we need to. BFD.
480 * Even if the CCB wasn't found, we clear it anyway.
491 callout_stop(&ccb->xs->xs_callout);
492 bt_done(sc, ccb);
526 /* Make sure we clear CCB_SENDING before finishing a CCB. */
549 bt_reset_ccb(struct bt_softc *sc, struct bt_ccb *ccb)
552 ccb->flags = 0;
556 * A ccb is put onto the free list.
559 bt_free_ccb(struct bt_softc *sc, struct bt_ccb *ccb)
565 bt_reset_ccb(sc, ccb);
566 TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain);
572 if (ccb->chain.tqe_next == 0)
602 bt_init_ccb(struct bt_softc *sc, struct bt_ccb *ccb)
606 memset(ccb, 0, sizeof(struct bt_ccb));
611 ccb->hashkey = KVTOPHYS(ccb);
612 hashnum = CCB_HASH(ccb->hashkey);
613 ccb->nexthash = sc->sc_ccbhash[hashnum];
614 sc->sc_ccbhash[hashnum] = ccb;
615 bt_reset_ccb(sc, ccb);
619 * Get a free ccb
626 struct bt_ccb *ccb;
635 ccb = sc->sc_free_ccb.tqh_first;
636 if (ccb) {
637 TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
645 ccb->flags |= CCB_ALLOC;
649 return ccb;
686 * Given a physical address, find the ccb that it corresponds to.
692 struct bt_ccb *ccb = sc->sc_ccbhash[hashnum];
694 while (ccb) {
695 if (ccb->hashkey == ccb_phys)
697 ccb = ccb->nexthash;
699 return ccb;
703 * Queue a CCB to be sent to the controller, and send it if possible.
706 bt_queue_ccb(struct bt_softc *sc, struct bt_ccb *ccb)
709 TAILQ_INSERT_TAIL(&sc->sc_waiting_ccb, ccb, chain);
728 ccb = bt_ccb_phys_kv(sc, phystol(wmbo->ccb_addr));
729 ccb->flags &= ~CCB_SENDING;
747 struct bt_ccb *ccb;
751 while ((ccb = sc->sc_waiting_ccb.tqh_first) != NULL) {
765 TAILQ_REMOVE(&sc->sc_waiting_ccb, ccb, chain);
767 ccb->flags |= CCB_SENDING;
770 /* Link ccb to mbo. */
771 ltophys(KVTOPHYS(ccb), wmbo->ccb_addr);
772 if (ccb->flags & CCB_ABORT)
780 if ((ccb->xs->xs_control & XS_CTL_POLL) == 0)
781 callout_reset(&ccb->xs->xs_callout,
782 mstohz(ccb->timeout), bt_timeout, ccb);
792 * We have a ccb which has been processed by the
797 bt_done(struct bt_softc *sc, struct bt_ccb *ccb)
800 struct scsipi_xfer *xs = ccb->xs;
813 if (ccb->flags & CCB_SENDING) {
814 printf("%s: exiting ccb still in transit!\n",
820 if ((ccb->flags & CCB_ALLOC) == 0) {
821 printf("%s: exiting ccb not allocated!\n",
827 if (ccb->host_stat != BT_OK) {
828 switch (ccb->host_stat) {
834 device_xname(sc->sc_dev), ccb->host_stat);
838 } else if (ccb->target_stat != SCSI_OK) {
839 switch (ccb->target_stat) {
841 s1 = &ccb->scsi_sense;
851 device_xname(sc->sc_dev), ccb->target_stat);
861 sg = ccb->scat_gath;
862 seg = phystol(ccb->data_length) / sizeof(struct bt_scat_gath);
879 bt_free_ccb(sc, ccb);
1215 struct bt_ccb *ccb;
1224 * get a ccb to use. If the transfer
1229 if ((ccb = bt_get_ccb(sc, control & XS_CTL_NOSLEEP)) == NULL) {
1233 ccb->xs = xs;
1234 ccb->timeout = xs->timeout;
1237 * Put all the arguments for the xfer in the ccb
1240 ccb->opcode = BT_RESET_CCB;
1241 ccb->scsi_cmd_length = 0;
1244 if (xs->cmdlen > sizeof(ccb->scsi_cmd)) {
1245 printf("%s: cmdlen %d too large for CCB\n",
1248 bt_free_ccb(sc, ccb);
1251 ccb->opcode = (xs->datalen ? BT_INIT_SCAT_GATH_CCB
1253 memcpy(&ccb->scsi_cmd, xs->cmd,
1254 ccb->scsi_cmd_length = xs->cmdlen);
1258 sg = ccb->scat_gath;
1294 ltophys(KVTOPHYS(ccb->scat_gath), ccb->data_addr);
1295 ltophys(seg * sizeof(struct bt_scat_gath), ccb->data_length);
1297 ltophys(0, ccb->data_addr);
1298 ltophys(0, ccb->data_length);
1301 ccb->data_out = 0;
1302 ccb->data_in = 0;
1303 ccb->target = sc_link->scsipi_scsi.target;
1304 ccb->lun = sc_link->scsipi_scsi.lun;
1305 ltophys(KVTOPHYS(&ccb->scsi_sense), ccb->sense_ptr);
1306 ccb->req_sense_length = sizeof(ccb->scsi_sense);
1307 ccb->host_stat = 0x00;
1308 ccb->target_stat = 0x00;
1309 ccb->link_id = 0;
1310 ltophys(0, ccb->link_addr);
1313 bt_queue_ccb(sc, ccb);
1326 if (bt_poll(sc, xs, ccb->timeout)) {
1327 bt_timeout(ccb);
1328 if (bt_poll(sc, xs, ccb->timeout))
1329 bt_timeout(ccb);
1334 sg = ccb->scat_gath;
1342 bt_free_ccb(sc, ccb);
1373 struct bt_ccb *ccb = arg;
1374 struct scsipi_xfer *xs = ccb->xs;
1386 * If the ccb's mbx is not free, then the board has gone Far East?
1389 if (ccb->flags & CCB_SENDING) {
1400 if (ccb->flags & CCB_ABORT) {
1407 ccb->xs->error = XS_TIMEOUT;
1408 ccb->timeout = BT_ABORT_TIMEOUT;
1409 ccb->flags |= CCB_ABORT;
1410 bt_queue_ccb(sc, ccb);