diff options
-rw-r--r-- | sys/dev/mpt/mpt.h | 14 | ||||
-rw-r--r-- | sys/dev/mpt/mpt_cam.c | 26 |
2 files changed, 40 insertions, 0 deletions
diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h index 910305b..48fa2a8 100644 --- a/sys/dev/mpt/mpt.h +++ b/sys/dev/mpt/mpt.h @@ -560,6 +560,20 @@ struct mpt_softc { #define mpt_fcport_speed cfg.fc._port_speed } fc; } cfg; +#if __FreeBSD_version >= 500000 + /* + * Device config information stored up for sysctl to access + */ + union { + struct { + unsigned int initiator_id; + } spi; + struct { + char wwnn[19]; + char wwpn[19]; + } fc; + } scinfo; +#endif /* Controller Info for RAID information */ CONFIG_PAGE_IOC_2 * ioc_page2; diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c index f7f6c8d..4762edb 100644 --- a/sys/dev/mpt/mpt_cam.c +++ b/sys/dev/mpt/mpt_cam.c @@ -105,6 +105,8 @@ __FBSDID("$FreeBSD$"); #include "dev/mpt/mpilib/mpi_targ.h" #include "dev/mpt/mpilib/mpi_fc.h" +#include <sys/sysctl.h> + #include <sys/callout.h> #include <sys/kthread.h> @@ -424,7 +426,31 @@ mpt_read_config_info_fc(struct mpt_softc *mpt) mpt->mpt_fcport_page0.WWPN.High, mpt->mpt_fcport_page0.WWPN.Low, mpt->mpt_fcport_speed); +#if __FreeBSD_version >= 500000 + { + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(mpt->dev); + struct sysctl_oid *tree = device_get_sysctl_tree(mpt->dev); + + snprintf(mpt->scinfo.fc.wwnn, + sizeof (mpt->scinfo.fc.wwnn), "0x%08x%08x", + mpt->mpt_fcport_page0.WWNN.High, + mpt->mpt_fcport_page0.WWNN.Low); + + snprintf(mpt->scinfo.fc.wwpn, + sizeof (mpt->scinfo.fc.wwpn), "0x%08x%08x", + mpt->mpt_fcport_page0.WWPN.High, + mpt->mpt_fcport_page0.WWPN.Low); + SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "wwnn", CTLFLAG_RD, mpt->scinfo.fc.wwnn, 0, + "World Wide Node Name"); + + SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "wwpn", CTLFLAG_RD, mpt->scinfo.fc.wwpn, 0, + "World Wide Port Name"); + + } +#endif return (0); } |