Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Keep track of what appear to be live Fibre Channe...



details:   https://anonhg.NetBSD.org/src/rev/841891fd46d1
branches:  trunk
changeset: 750692:841891fd46d1
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Mon Jan 11 01:33:22 2010 +0000

description:
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).

diffstat:

 sys/dev/ic/isp_netbsd.c |  16 ++++++++++++++--
 sys/dev/ic/isp_netbsd.h |   5 +++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diffs (56 lines):

diff -r 530ef7a4fa89 -r 841891fd46d1 sys/dev/ic/isp_netbsd.c
--- a/sys/dev/ic/isp_netbsd.c   Mon Jan 11 00:18:26 2010 +0000
+++ b/sys/dev/ic/isp_netbsd.c   Mon Jan 11 01:33:22 2010 +0000
@@ -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;
diff -r 530ef7a4fa89 -r 841891fd46d1 sys/dev/ic/isp_netbsd.h
--- a/sys/dev/ic/isp_netbsd.h   Mon Jan 11 00:18:26 2010 +0000
+++ b/sys/dev/ic/isp_netbsd.h   Mon Jan 11 01:33:22 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index