/* * XXX * since we allocate all QCB space up front during initialization, then * why bother with this routine? */ static void ida_alloc_qcb(struct ida_softc *ida) { struct ida_qcb *qcb; int error; if (ida->num_qcbs >= IDA_QCB_MAX) return; qcb = &ida->qcbs[ida->num_qcbs]; error = bus_dmamap_create(ida->buffer_dmat, /*flags*/0, &qcb->dmamap); if (error != 0) return; qcb->flags = QCB_FREE; qcb->hwqcb = &ida->hwqcbs[ida->num_qcbs]; qcb->hwqcb->qcb = qcb; qcb->hwqcb_busaddr = idahwqcbvtop(ida, qcb->hwqcb); SLIST_INSERT_HEAD(&ida->free_qcbs, qcb, link.sle); ida->num_qcbs++; }
static int ida_alloc_qcbs(struct ida_softc *ida) { struct ida_qcb *qcb; int error, i; for (i = 0; i < IDA_QCB_MAX; i++) { qcb = &ida->qcbs[i]; error = bus_dmamap_create(ida->buffer_dmat, /*flags*/0, &qcb->dmamap); if (error != 0) return (error); qcb->ida = ida; qcb->flags = QCB_FREE; qcb->hwqcb = &ida->hwqcbs[i]; qcb->hwqcb->qcb = qcb; qcb->hwqcb_busaddr = idahwqcbvtop(ida, qcb->hwqcb); SLIST_INSERT_HEAD(&ida->free_qcbs, qcb, link.sle); } return (0); }