Date: Tue, 26 Sep 2006 05:01:20 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 106708 for review Message-ID: <200609260501.k8Q51Kfl076044@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=106708 Change 106708 by mjacob@newisp on 2006/09/26 05:00:36 Add sysctl stuff for WWNN/WWPN and Initiator ID. Affected files ... .. //depot/projects/newisp/dev/isp/isp_freebsd.c#9 edit Differences ... ==== //depot/projects/newisp/dev/isp/isp_freebsd.c#9 (text+ko) ==== @@ -38,6 +38,9 @@ #include <sys/module.h> #include <sys/ioccom.h> #include <dev/isp/isp_ioctl.h> +#if __FreeBSD_version >= 500000 +#include <sys/sysctl.h> +#endif MODULE_VERSION(isp, 1); @@ -76,6 +79,7 @@ /* psize */ nopsize, /* flags */ D_TAPE, }; +#define isp_sysctl_update(x) do { ; } while (0) #else static struct cdevsw isp_cdevsw = { .d_version = D_VERSION, @@ -83,6 +87,7 @@ .d_ioctl = ispioctl, .d_name = "isp", }; +static void isp_sysctl_update(ispsoftc_t *); #endif static ispsoftc_t *isplist = NULL; @@ -251,7 +256,7 @@ } tmp->isp_osinfo.next = isp; } - + isp_sysctl_update(isp); } static __inline void @@ -618,6 +623,38 @@ return (retval); } +#if __FreeBSD_version >= 500000 +static void +isp_sysctl_update(ispsoftc_t *isp) +{ + struct sysctl_ctx_list *ctx = + device_get_sysctl_ctx(isp->isp_osinfo.dev); + struct sysctl_oid *tree = device_get_sysctl_tree(isp->isp_osinfo.dev); + + if (IS_SCSI(isp)) { + isp->isp_osinfo.sysctl_info.spi.iid = DEFAULT_IID(isp); + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "iid", + CTLFLAG_RD, &isp->isp_osinfo.sysctl_info.spi.iid, 0, + "Initiator ID"); + return; + } + snprintf(isp->isp_osinfo.sysctl_info.fc.wwnn, + sizeof (isp->isp_osinfo.sysctl_info.fc.wwnn), "0x%08x%08x", + (uint32_t) (ISP_NODEWWN(isp) >> 32), (uint32_t) ISP_NODEWWN(isp)); + + snprintf(isp->isp_osinfo.sysctl_info.fc.wwpn, + sizeof (isp->isp_osinfo.sysctl_info.fc.wwpn), "0x%08x%08x", + (uint32_t) (ISP_PORTWWN(isp) >> 32), (uint32_t) ISP_PORTWWN(isp)); + + SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "wwnn", CTLFLAG_RD, isp->isp_osinfo.sysctl_info.fc.wwnn, 0, + "World Wide Node Name"); + SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "wwpn", CTLFLAG_RD, isp->isp_osinfo.sysctl_info.fc.wwpn, 0, + "World Wide Port Name"); +} +#endif + static void isp_intr_enable(void *arg) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609260501.k8Q51Kfl076044>