diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2006-05-29 19:55:38 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2006-05-29 19:55:38 +0000 |
commit | 70ee2587ea883149c5cf47942d94d01de080547f (patch) | |
tree | 256f7983bc077d52ccc6f0e44c577907b755fd62 | |
parent | 93e44f78a8f963aeafd993ebfb79db6fec617a4f (diff) |
limit the number of scatter gather entries sent with the scsi_io commands
so it fits in the maximum request frame size. this will do until i can
write sgl chaining in a nice way.
-rw-r--r-- | sys/dev/ic/mpi.c | 11 | ||||
-rw-r--r-- | sys/dev/ic/mpivar.h | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index 0171c6af9d0..71b6fa3f8fc 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.10 2006/05/29 08:33:36 dlg Exp $ */ +/* $OpenBSD: mpi.c,v 1.11 2006/05/29 19:55:37 dlg Exp $ */ /* * Copyright (c) 2005, 2006 David Gwynne <dlg@openbsd.org> @@ -374,8 +374,9 @@ mpi_alloc_ccbs(struct mpi_softc *sc) for (i = 0; i < sc->sc_maxcmds; i++) { ccb = &sc->sc_ccbs[i]; - if (bus_dmamap_create(sc->sc_dmat, MAXPHYS, MPI_MAX_SGL, - MAXPHYS, 0, 0, &ccb->ccb_dmamap) != 0) { + if (bus_dmamap_create(sc->sc_dmat, MAXPHYS, + sc->sc_first_sgl_len, MAXPHYS, 0, 0, + &ccb->ccb_dmamap) != 0) { printf("%s: unable to create dma map\n", DEVNAME(sc)); goto free_maps; } @@ -1237,6 +1238,10 @@ mpi_iocfacts(struct mpi_softc *sc) #endif /* MPI_DEBUG */ sc->sc_maxcmds = letoh16(ifp.global_credits); + sc->sc_first_sgl_len = ((letoh16(ifp.request_frame_size) * 4) - + sizeof(struct mpi_msg_scsi_io)) / sizeof(struct mpi_sge); + DPRINTF("%s: first sgl len: %d\n", DEVNAME(sc), + sc->sc_first_sgl_len); sc->sc_maxchdepth = ifp.max_chain_depth; sc->sc_buswidth = ifp.max_devices; diff --git a/sys/dev/ic/mpivar.h b/sys/dev/ic/mpivar.h index 19fb060e6b9..02bd5ae917b 100644 --- a/sys/dev/ic/mpivar.h +++ b/sys/dev/ic/mpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpivar.h,v 1.3 2006/05/29 05:43:55 dlg Exp $ */ +/* $OpenBSD: mpivar.h,v 1.4 2006/05/29 19:55:37 dlg Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -17,12 +17,16 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* XXX */ -#define MPI_MAX_SGL 32 #define MPI_REQUEST_SIZE 512 #define MPI_REPLY_SIZE 128 +/* + * this is the max number of sge's we can stuff in a request frame: + * sizeof(scsi_io) + sizeof(sense) + sizeof(sge) * 32 = MPI_REQUEST_SIZE + */ +#define MPI_MAX_SGL 36 + struct mpi_dmamem { bus_dmamap_t mdm_map; bus_dma_segment_t mdm_seg; @@ -76,6 +80,7 @@ struct mpi_softc { bus_dma_tag_t sc_dmat; int sc_maxcmds; + int sc_first_sgl_len; int sc_maxchdepth; u_int8_t sc_porttype; |