From 1e727c75e474554e0d66be5fca8981d038cb76b7 Mon Sep 17 00:00:00 2001 From: mdodd Date: Mon, 12 Jan 2004 12:31:03 +0000 Subject: - Initialize qcb flags in ida_construct_qcb() with respect to DMA direction. - Print operation type, if known in hard/soft error message in ida_done(). - NULL qcb struct bio pointer in ida_done(). --- sys/dev/ida/ida.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'sys/dev/ida') diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index e95ff03..66781ec 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -393,7 +393,7 @@ ida_construct_qcb(struct ida_softc *ida) bioq_remove(&ida->bio_queue, bp); qcb->buf = bp; - qcb->flags = 0; + qcb->flags = bp->bio_cmd == BIO_READ ? DMA_DATA_IN : DMA_DATA_OUT; hwqcb = qcb->hwqcb; bzero(hwqcb, sizeof(struct ida_hdr) + sizeof(struct ida_req)); @@ -512,11 +512,22 @@ ida_done(struct ida_softc *ida, struct ida_qcb *qcb) bus_dmamap_unload(ida->buffer_dmat, qcb->dmamap); } - if (qcb->hwqcb->req.error & SOFT_ERROR) - device_printf(ida->dev, "soft error\n"); + if (qcb->hwqcb->req.error & SOFT_ERROR) { + if (qcb->buf) + device_printf(ida->dev, "soft %s error\n", + qcb->buf->bio_cmd == BIO_READ ? + "read" : "write"); + else + device_printf(ida->dev, "soft error\n"); + } if (qcb->hwqcb->req.error & HARD_ERROR) { error = 1; - device_printf(ida->dev, "hard error\n"); + if (qcb->buf) + device_printf(ida->dev, "hard %s error\n", + qcb->buf->bio_cmd == BIO_READ ? + "read" : "write"); + else + device_printf(ida->dev, "hard error\n"); } if (qcb->hwqcb->req.error & CMD_REJECTED) { error = 1; @@ -533,6 +544,7 @@ ida_done(struct ida_softc *ida, struct ida_qcb *qcb) } qcb->state = QCB_FREE; + qcb->buf = NULL; SLIST_INSERT_HEAD(&ida->free_qcbs, qcb, link.sle); ida_construct_qcb(ida); } -- cgit v1.1