summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/mpii.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c
index dca679df65d..3caf8c4d992 100644
--- a/sys/dev/pci/mpii.c
+++ b/sys/dev/pci/mpii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpii.c,v 1.61 2012/08/23 11:52:02 mikeb Exp $ */
+/* $OpenBSD: mpii.c,v 1.62 2012/08/23 15:42:50 mikeb Exp $ */
/*
* Copyright (c) 2010 Mike Belopuhov <mkb@crypt.org.ru>
* Copyright (c) 2009 James Giannoules
@@ -919,7 +919,6 @@ mpii_wait_ne(struct mpii_softc *sc, bus_size_t r, u_int32_t mask,
return (1);
}
-
int
mpii_init(struct mpii_softc *sc)
{
@@ -1203,28 +1202,27 @@ mpii_iocfacts(struct mpii_softc *sc)
sc->sc_request_depth = MIN(letoh16(ifp.request_credit),
MPII_MAX_REQUEST_CREDIT);
-
- /* should not be multiple of 16 */
sc->sc_num_reply_frames = sc->sc_request_depth + 32;
- if (!(sc->sc_num_reply_frames % 16))
- sc->sc_num_reply_frames--;
/* must be multiple of 16 */
- sc->sc_reply_free_qdepth = sc->sc_num_reply_frames +
- (16 - (sc->sc_num_reply_frames % 16));
- sc->sc_reply_post_qdepth = ((sc->sc_request_depth +
- sc->sc_num_reply_frames + 1 + 15) / 16) * 16;
+ sc->sc_reply_post_qdepth = sc->sc_request_depth +
+ sc->sc_num_reply_frames;
+ sc->sc_reply_post_qdepth += (16 - (sc->sc_reply_post_qdepth % 16));
if (sc->sc_reply_post_qdepth >
- ifp.max_reply_descriptor_post_queue_depth)
+ letoh16(ifp.max_reply_descriptor_post_queue_depth)) {
sc->sc_reply_post_qdepth =
- ifp.max_reply_descriptor_post_queue_depth;
+ letoh16(ifp.max_reply_descriptor_post_queue_depth);
+ if (sc->sc_reply_post_qdepth < 16) {
+ printf("%s: RDPQ is too shallow\n", DEVNAME(sc));
+ return (1);
+ }
+ sc->sc_request_depth = sc->sc_reply_post_qdepth / 2 - 4;
+ sc->sc_num_reply_frames = sc->sc_request_depth + 4;
+ }
- DNPRINTF(MPII_D_MISC, "%s: sc_request_depth: %d "
- "sc_num_reply_frames: %d sc_reply_free_qdepth: %d "
- "sc_reply_post_qdepth: %d\n", DEVNAME(sc), sc->sc_request_depth,
- sc->sc_num_reply_frames, sc->sc_reply_free_qdepth,
- sc->sc_reply_post_qdepth);
+ sc->sc_reply_free_qdepth = sc->sc_num_reply_frames +
+ (16 - (sc->sc_num_reply_frames % 16));
/*
* you can fit sg elements on the end of the io cmd if they fit in the
@@ -1246,8 +1244,6 @@ mpii_iocfacts(struct mpii_softc *sc)
/* the sgl chains lose an entry for each chain element */
sc->sc_max_sgl_len -= (MPII_MAX_SGL - sc->sc_first_sgl_len) /
sc->sc_chain_len;
- DNPRINTF(MPII_D_MISC, "%s: max sgl len: %d\n", DEVNAME(sc),
- sc->sc_max_sgl_len);
/* XXX we're ignoring the max chain depth */