summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-05-31 03:06:40 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-05-31 03:06:40 +0000
commit05f31df8987fd2c50c38ef52709c52fa4439bf54 (patch)
tree9ee0fd1a9cd5e733910fee32a0e66d1abe19b0e0 /sys
parentee729b690ed14d7f8526994db000ee411e8603f7 (diff)
mpi hardware uses an 8 bit field to describe the number of devices it has
on a port. since 256 wont fit into 8 bits they say 0 means 256. this diff does the appropriate interpretation. it also avoids a divide by zero when we figure the openings out by dividing the number of commands the controller can support by the number of devices it supports. panic found while testing the fc controller at home.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/mpi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c
index 2b6e0095aa4..7a1b7d6d173 100644
--- a/sys/dev/ic/mpi.c
+++ b/sys/dev/ic/mpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpi.c,v 1.18 2006/05/31 02:39:29 dlg Exp $ */
+/* $OpenBSD: mpi.c,v 1.19 2006/05/31 03:06:39 dlg Exp $ */
/*
* Copyright (c) 2005, 2006 David Gwynne <dlg@openbsd.org>
@@ -1274,7 +1274,7 @@ mpi_iocfacts(struct mpi_softc *sc)
#endif /* MPI_DEBUG */
sc->sc_maxcmds = letoh16(ifp.global_credits);
- sc->sc_buswidth = ifp.max_devices;
+ sc->sc_buswidth = (ifp.max_devices == 0) ? 256 : ifp.max_devices;
sc->sc_maxchdepth = ifp.max_chain_depth;
/*
@@ -1311,7 +1311,7 @@ mpi_iocinit(struct mpi_softc *sc)
iiq.function = MPI_FUNCTION_IOC_INIT;
iiq.whoinit = MPI_WHOINIT_HOST_DRIVER;
- iiq.max_devices = sc->sc_buswidth;
+ iiq.max_devices = (sc->sc_buswidth == 256) ? 0 : sc->sc_buswidth;
iiq.max_buses = 1;
iiq.msg_context = htole32(0xd00fd00f);