diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2006-07-06 00:55:04 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2006-07-06 00:55:04 +0000 |
commit | 9354e992d2b35383a715b4466f2c410a13ccaf12 (patch) | |
tree | 805c95201a8dad2e68ffe7d4d24e565dbc883144 /sys | |
parent | 5403233317e305d8cbcd15c34c2be36d38af7051 (diff) |
stash a pointer to the scsibus attached to us so we dont have to walk the
device tree all the time.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/mpi.c | 29 | ||||
-rw-r--r-- | sys/dev/ic/mpivar.h | 4 |
2 files changed, 14 insertions, 19 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index d71e4fdadaa..efa0f3d073a 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.54 2006/07/05 23:50:49 dlg Exp $ */ +/* $OpenBSD: mpi.c,v 1.55 2006/07/06 00:55:03 dlg Exp $ */ /* * Copyright (c) 2005, 2006 David Gwynne <dlg@openbsd.org> @@ -139,6 +139,7 @@ int mpi_cfg_page(struct mpi_softc *, u_int32_t, int mpi_attach(struct mpi_softc *sc) { + struct device *dev; struct mpi_ccb *ccb; printf("\n"); @@ -210,6 +211,13 @@ mpi_attach(struct mpi_softc *sc) config_found(&sc->sc_dev, &sc->sc_link, scsiprint); + /* find our scsibus */ + TAILQ_FOREACH(dev, &alldevs, dv_list) { + if (dev->dv_parent == &sc->sc_dev) + break; + } + sc->sc_scsibus = (struct scsibus_softc *)dev; + /* get raid pages */ mpi_get_raid(sc); @@ -313,9 +321,6 @@ mpi_run_ppr(struct mpi_softc *sc) { struct mpi_cfg_hdr hdr; struct mpi_cfg_spi_port_pg0 pg; - - struct device *dev; - struct scsibus_softc *ssc; struct scsi_link *link; int i, r, tries; @@ -332,25 +337,13 @@ mpi_run_ppr(struct mpi_softc *sc) return; } - TAILQ_FOREACH(dev, &alldevs, dv_list) { - if (dev->dv_parent == &sc->sc_dev) - break; - } - - /* im too nice to punish idiots who don't configure scsibus */ - if (dev == NULL) - return; - - ssc = (struct scsibus_softc *)dev; for (i = 0; i < sc->sc_link.adapter_buswidth; i++) { - link = ssc->sc_link[i][0]; - tries = 0; - + link = sc->sc_scsibus->sc_link[i][0]; if (link == NULL) continue; - /* is this a RAID device? */ + tries = 0; for (r = 0; r < sc->sc_ioc_pg2->max_vols; r++) if (i == sc->sc_ioc_pg2->raid_vol[r].vol_id) { DNPRINTF(MPI_D_PPR, "%s: mpi_run_ppr scsibus " diff --git a/sys/dev/ic/mpivar.h b/sys/dev/ic/mpivar.h index 96e0df6e6f4..e019923e1ed 100644 --- a/sys/dev/ic/mpivar.h +++ b/sys/dev/ic/mpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpivar.h,v 1.15 2006/06/16 05:36:46 dlg Exp $ */ +/* $OpenBSD: mpivar.h,v 1.16 2006/07/06 00:55:03 dlg Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -97,6 +97,8 @@ struct mpi_softc { int sc_flags; #define MPI_F_VMWARE (1<<0) + struct scsibus_softc *sc_scsibus; + bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_size_t sc_ios; |