Module Name: src Committed By: mjacob Date: Mon Jan 11 01:33:22 UTC 2010
Modified Files: src/sys/dev/ic: isp_netbsd.c isp_netbsd.h Log Message: Keep track of what appear to be live Fibre Channel disks and store up the Port WWNs for them as well as attaching them as a "port-wwn" property to the device node in question. This allows MD code to find the boot device on some platforms. This is less clean than it should be. A better solution would be to make some changes to the scsi infrastructure so that periphs can query and use and store their own "native" transport addresses. However, that's a much more invasive change and it is not clear how many ports or devices really want or need that information (yet). To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ic/isp_netbsd.c cvs rdiff -u -r1.70 -r1.71 src/sys/dev/ic/isp_netbsd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/isp_netbsd.c diff -u src/sys/dev/ic/isp_netbsd.c:1.81 src/sys/dev/ic/isp_netbsd.c:1.82 --- src/sys/dev/ic/isp_netbsd.c:1.81 Mon Sep 7 13:39:19 2009 +++ src/sys/dev/ic/isp_netbsd.c Mon Jan 11 01:33:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: isp_netbsd.c,v 1.81 2009/09/07 13:39:19 tsutsui Exp $ */ +/* $NetBSD: isp_netbsd.c,v 1.82 2010/01/11 01:33:22 mjacob Exp $ */ /* * Platform (NetBSD) dependent common attachment code for Qlogic adapters. */ @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.81 2009/09/07 13:39:19 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.82 2010/01/11 01:33:22 mjacob Exp $"); #include <dev/ic/isp_netbsd.h> #include <dev/ic/isp_ioctl.h> @@ -624,6 +624,18 @@ switch (isp_start(xs)) { case CMD_QUEUED: + if (IS_FC(isp) && isp->isp_osinfo.wwns[XS_TGT(xs)] == 0) { + fcparam *fcp = FCPARAM(isp, XS_CHANNEL(xs)); + int dbidx = fcp->isp_dev_map[XS_TGT(xs)] - 1; + device_t dev = xs->xs_periph->periph_dev; + + if (dbidx >= 0 && dev && + prop_dictionary_set_uint64(device_properties(dev), + "port-wwn", fcp->portdb[dbidx].port_wwn) == TRUE) { + isp->isp_osinfo.wwns[XS_TGT(xs)] = + fcp->portdb[dbidx].port_wwn; + } + } if (xs->xs_control & XS_CTL_POLL) { isp_polled_cmd_wait(isp, xs); isp->isp_osinfo.mbox_sleep_ok = ombi; Index: src/sys/dev/ic/isp_netbsd.h diff -u src/sys/dev/ic/isp_netbsd.h:1.70 src/sys/dev/ic/isp_netbsd.h:1.71 --- src/sys/dev/ic/isp_netbsd.h:1.70 Thu Dec 3 14:51:48 2009 +++ src/sys/dev/ic/isp_netbsd.h Mon Jan 11 01:33:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: isp_netbsd.h,v 1.70 2009/12/03 14:51:48 mjacob Exp $ */ +/* $NetBSD: isp_netbsd.h,v 1.71 2010/01/11 01:33:22 mjacob Exp $ */ /* * NetBSD Specific definitions for the Qlogic ISP Host Adapter */ @@ -78,7 +78,8 @@ bus_dma_tag_t dmatag; bus_dmamap_t rqdmap; bus_dmamap_t rsdmap; - bus_dmamap_t scdmap; /* FC only */ + bus_dmamap_t scdmap; /* FC only */ + uint64_t wwns[256]; /* FC only */ int splsaved; int mboxwaiting; uint32_t islocked;