diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2009-11-02 23:20:42 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2009-11-02 23:20:42 +0000 |
commit | 4ae6c86d1863db8024e30ed109a39eba3814b9b2 (patch) | |
tree | 125746dc9a7f84a0f62a301cdffbcf05ed7a5523 | |
parent | 9d941b635cf8c118d1188816786388bf63b54864 (diff) |
Don't write bogus values to reply_fifo_host_signalling_addr. This register
should remain untouched because it is only for interruptless drivers.
Honor reply queue depth per the spec instead of clipping it at 32.
ok dlg
-rw-r--r-- | sys/dev/ic/mpi.c | 31 | ||||
-rw-r--r-- | sys/dev/ic/mpivar.h | 6 |
2 files changed, 19 insertions, 18 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index d8081fcf5f9..d0768a8115f 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.116 2009/10/23 13:30:54 dlg Exp $ */ +/* $OpenBSD: mpi.c,v 1.117 2009/11/02 23:20:41 marco Exp $ */ /* * Copyright (c) 2005, 2006 David Gwynne <dlg@openbsd.org> @@ -341,8 +341,8 @@ done: return (0); free_replies: - bus_dmamap_sync(sc->sc_dmat, MPI_DMA_MAP(sc->sc_replies), - 0, PAGE_SIZE, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->sc_dmat, MPI_DMA_MAP(sc->sc_replies), 0, + sc->sc_repq * MPI_REPLY_SIZE, BUS_DMASYNC_POSTREAD); mpi_dmamem_free(sc, sc->sc_replies); free_ccbs: while ((ccb = mpi_get_ccb(sc)) != NULL) @@ -844,8 +844,8 @@ mpi_reply(struct mpi_softc *sc, u_int32_t reg) if (reg & MPI_REPLY_QUEUE_ADDRESS) { bus_dmamap_sync(sc->sc_dmat, - MPI_DMA_MAP(sc->sc_replies), 0, PAGE_SIZE, - BUS_DMASYNC_POSTREAD); + MPI_DMA_MAP(sc->sc_replies), 0, sc->sc_repq * + MPI_REPLY_SIZE, BUS_DMASYNC_POSTREAD); reply_dva = (reg & MPI_REPLY_QUEUE_ADDRESS_MASK) << 1; @@ -857,8 +857,8 @@ mpi_reply(struct mpi_softc *sc, u_int32_t reg) id = letoh32(reply->msg_context); bus_dmamap_sync(sc->sc_dmat, - MPI_DMA_MAP(sc->sc_replies), 0, PAGE_SIZE, - BUS_DMASYNC_PREREAD); + MPI_DMA_MAP(sc->sc_replies), 0, sc->sc_repq * + MPI_REPLY_SIZE, BUS_DMASYNC_PREREAD); } else { switch (reg & MPI_REPLY_QUEUE_TYPE_MASK) { case MPI_REPLY_QUEUE_TYPE_INIT: @@ -1050,12 +1050,12 @@ mpi_alloc_replies(struct mpi_softc *sc) { DNPRINTF(MPI_D_MISC, "%s: mpi_alloc_replies\n", DEVNAME(sc)); - sc->sc_rcbs = malloc(MPI_REPLY_COUNT * sizeof(struct mpi_rcb), - M_DEVBUF, M_WAITOK|M_CANFAIL); + sc->sc_rcbs = malloc(sc->sc_repq * sizeof(struct mpi_rcb), M_DEVBUF, + M_WAITOK|M_CANFAIL); if (sc->sc_rcbs == NULL) return (1); - sc->sc_replies = mpi_dmamem_alloc(sc, PAGE_SIZE); + sc->sc_replies = mpi_dmamem_alloc(sc, sc->sc_repq * MPI_REPLY_SIZE); if (sc->sc_replies == NULL) { free(sc->sc_rcbs, M_DEVBUF); return (1); @@ -1071,10 +1071,10 @@ mpi_push_replies(struct mpi_softc *sc) char *kva = MPI_DMA_KVA(sc->sc_replies); int i; - bus_dmamap_sync(sc->sc_dmat, MPI_DMA_MAP(sc->sc_replies), - 0, PAGE_SIZE, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->sc_dmat, MPI_DMA_MAP(sc->sc_replies), 0, + sc->sc_repq * MPI_REPLY_SIZE, BUS_DMASYNC_PREREAD); - for (i = 0; i < MPI_REPLY_COUNT; i++) { + for (i = 0; i < sc->sc_repq; i++) { rcb = &sc->sc_rcbs[i]; rcb->rcb_reply = kva + MPI_REPLY_SIZE * i; @@ -1886,6 +1886,8 @@ mpi_iocfacts(struct mpi_softc *sc) if (ifp.flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) sc->sc_fw_len = letoh32(ifp.fw_image_size); + sc->sc_repq = MIN(MPI_REPLYQ_DEPTH, letoh16(ifp.reply_queue_depth)); + /* * you can fit sg elements on the end of the io cmd if they fit in the * request frame size. @@ -1939,9 +1941,6 @@ mpi_iocinit(struct mpi_softc *sc) iiq.host_mfa_hi_addr = htole32(hi_addr); iiq.sense_buffer_hi_addr = htole32(hi_addr); - hi_addr = (u_int32_t)((u_int64_t)MPI_DMA_DVA(sc->sc_replies) >> 32); - iiq.reply_fifo_host_signalling_addr = htole32(hi_addr); - iiq.msg_version_maj = 0x01; iiq.msg_version_min = 0x02; diff --git a/sys/dev/ic/mpivar.h b/sys/dev/ic/mpivar.h index c290007d8c1..8db118095e8 100644 --- a/sys/dev/ic/mpivar.h +++ b/sys/dev/ic/mpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpivar.h,v 1.24 2008/11/01 18:42:26 marco Exp $ */ +/* $OpenBSD: mpivar.h,v 1.25 2009/11/02 23:20:41 marco Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -39,7 +39,8 @@ extern uint32_t mpi_debug; #endif #define MPI_REQUEST_SIZE 512 -#define MPI_REPLY_SIZE 128 +#define MPI_REPLY_SIZE 80 +#define MPI_REPLYQ_DEPTH 128 #define MPI_REPLY_COUNT (PAGE_SIZE / MPI_REPLY_SIZE) /* @@ -127,6 +128,7 @@ struct mpi_softc { struct mpi_dmamem *sc_replies; struct mpi_rcb *sc_rcbs; + int sc_repq; size_t sc_fw_len; struct mpi_dmamem *sc_fw; |