diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2006-06-18 00:08:01 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2006-06-18 00:08:01 +0000 |
commit | 7385dff5c7c26bd4cbe4d8f21ab3fdd43e704892 (patch) | |
tree | f96c3f06eab17a9dcf33e79578c92c212dcf5e17 | |
parent | d9b9ad221370d2295de6237bc1fd4912e4e3ee1e (diff) |
Print World Wide Node Name and World Wide Port Name during dmesg so that
we can actually find the drives on the fabric. Requested by kettenis krw
and brad.
ok dlg
-rw-r--r-- | sys/dev/ic/mpi.c | 74 | ||||
-rw-r--r-- | sys/dev/ic/mpireg.h | 48 |
2 files changed, 118 insertions, 4 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) diff --git a/sys/dev/ic/mpireg.h b/sys/dev/ic/mpireg.h index fac91fd167f..65570239f6a 100644 --- a/sys/dev/ic/mpireg.h +++ b/sys/dev/ic/mpireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpireg.h,v 1.16 2006/06/15 06:45:53 marco Exp $ */ +/* $OpenBSD: mpireg.h,v 1.17 2006/06/18 00:08:00 marco Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -304,6 +304,9 @@ struct mpi_sgl_tce { #define MPI_WHOINIT_HOST_DRIVER 0x04 #define MPI_WHOINIT_MANUFACTURER 0x05 +/* page address fields */ +#define MPI_PAGE_ADDRESS_FC_BTID (1<<24) /* Bus Target ID */ + /* default messages */ struct mpi_msg_request { @@ -1052,3 +1055,46 @@ struct mpi_cfg_ioc_pg3 { u_int8_t reserved[3]; struct mpi_cfg_raid_pd phys_disks[1]; /* length stored in header */ } __packed; + +struct mpi_cfg_fc_port_pg0 { + struct mpi_cfg_hdr config_header; + + u_int32_t flags; + u_int8_t mpi_port_nr; + u_int8_t link_type; + u_int8_t port_state; + u_int8_t reserved1; + u_int32_t port_id; + u_int64_t wwnn; + u_int64_t wwpn; + u_int32_t supported_service_class; + u_int32_t supported_speeds; + u_int32_t current_speed; + u_int32_t max_frame_size; + u_int64_t fabric_wwnn; + u_int64_t fabric_wwpn; + u_int32_t discovered_port_count; + u_int32_t max_initiators; + u_int8_t max_aliases_supported; + u_int8_t max_hard_aliases_supported; + u_int8_t num_current_aliases; + u_int8_t reserved2; +} __packed; + +struct mpi_cfg_fc_device_pg0 { + struct mpi_cfg_hdr config_header; + + u_int64_t wwnn; + u_int64_t wwpn; + u_int32_t port_id; + u_int8_t protocol; + u_int8_t flags; + u_int16_t bb_credit; + u_int16_t max_rx_frame_size; + u_int8_t adisc_hard_alpa; + u_int8_t port_nr; + u_int8_t fc_ph_low_version; + u_int8_t fc_ph_high_version; + u_int8_t current_target_id; + u_int8_t current_bus; +} __packed; |