summaryrefslogtreecommitdiff
path: root/sys/dev/ic/mpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic/mpi.c')
-rw-r--r--sys/dev/ic/mpi.c74
1 files changed, 71 insertions, 3 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c
index 6eb2203fc5f..1712936b5ed 100644
--- a/sys/dev/ic/mpi.c
+++ b/sys/dev/ic/mpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpi.c,v 1.44 2006/06/16 05:36:46 dlg Exp $ */
+/* $OpenBSD: mpi.c,v 1.45 2006/06/18 00:08:00 marco Exp $ */
/*
* Copyright (c) 2005, 2006 David Gwynne <dlg@openbsd.org>
@@ -44,7 +44,7 @@ uint32_t mpi_debug = 0
/* | MPI_D_MEM */
/* | MPI_D_CCB */
/* | MPI_D_PPR */
- | MPI_D_RAID
+/* | MPI_D_RAID */
;
#endif
@@ -79,6 +79,7 @@ void mpi_start(struct mpi_softc *, struct mpi_ccb *);
int mpi_complete(struct mpi_softc *, struct mpi_ccb *, int);
int mpi_poll(struct mpi_softc *, struct mpi_ccb *, int);
+void mpi_fc_print(struct mpi_softc *);
void mpi_run_ppr(struct mpi_softc *);
int mpi_ppr(struct mpi_softc *, struct scsi_link *,
int, int, int);
@@ -214,6 +215,8 @@ mpi_attach(struct mpi_softc *sc)
/* do domain validation */
if (sc->sc_porttype == MPI_PORTFACTS_PORTTYPE_SCSI)
mpi_run_ppr(sc);
+ if (sc->sc_porttype == MPI_PORTFACTS_PORTTYPE_FC)
+ mpi_fc_print(sc);
/* XXX enable interrupts */
mpi_write(sc, MPI_INTR_MASK, MPI_INTR_MASK_DOORBELL);
@@ -234,6 +237,72 @@ free_ccbs:
}
void
+mpi_fc_print(struct mpi_softc *sc)
+{
+ struct mpi_cfg_hdr hdr;
+ struct mpi_cfg_fc_port_pg0 pg;
+ struct mpi_cfg_fc_device_pg0 dpg;
+ struct device *dev;
+ struct scsibus_softc *ssc;
+ struct scsi_link *link;
+ int i;
+ u_int32_t btid;
+
+ if (mpi_cfg_header(sc, MPI_CONFIG_REQ_PAGE_TYPE_FC_PORT, 0, 0,
+ &hdr) != 0) {
+ DNPRINTF(MPI_D_PPR, "%s: mpi_fc_print unable to fetch header\n",
+ DEVNAME(sc));
+ return;
+ }
+
+ if (mpi_cfg_page(sc, 0, &hdr, 1, &pg, sizeof(pg)) != 0) {
+ DNPRINTF(MPI_D_PPR, "%s: mpi_fc_print unable to fetch page\n",
+ DEVNAME(sc));
+ return;
+ }
+
+ printf("%s: at: %dGHz WWNN: %016llx WWPN: %016llx\n", DEVNAME(sc),
+ letoh32(pg.current_speed), letoh64(pg.wwnn), letoh64(pg.wwpn));
+
+ 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];
+
+ if (link == NULL)
+ continue;
+
+ btid = i | MPI_PAGE_ADDRESS_FC_BTID;
+ if (mpi_cfg_header(sc, MPI_CONFIG_REQ_PAGE_TYPE_FC_DEV, 0,
+ btid, &hdr) != 0) {
+ DNPRINTF(MPI_D_PPR, "%s: mpi_fc_print unable to fetch "
+ "device header 0\n", DEVNAME(sc));
+ return;
+ }
+
+ bzero(&dpg, sizeof(dpg));
+ if (mpi_cfg_page(sc, btid, &hdr, 1, &dpg, sizeof(dpg)) != 0) {
+ DNPRINTF(MPI_D_PPR, "%s: mpi_fc_print unable to fetch "
+ "device page 0\n", DEVNAME(sc));
+ continue;
+ }
+
+ printf("%s: target %d WWNN: %016llx WWPN: %016llx\n",
+ DEVNAME(sc), i, letoh64(dpg.wwnn),
+ letoh64(dpg.wwpn));
+ }
+}
+
+void
mpi_run_ppr(struct mpi_softc *sc)
{
struct mpi_cfg_hdr hdr;
@@ -295,7 +364,6 @@ mpi_run_ppr(struct mpi_softc *sc)
}
}
-
int
mpi_ppr(struct mpi_softc *sc, struct scsi_link *link, int period, int offset,
int try)