Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2015 02:38:54 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r291051 - in projects/powernv: arm/arm boot/common boot/powerpc/kboot conf dev/isp dev/ntb/if_ntb dev/ntb/ntb_hw dev/uart dev/xen/control geom kern mips/conf modules/tests/framework net...
Message-ID:  <201511190238.tAJ2cscH062145@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Thu Nov 19 02:38:53 2015
New Revision: 291051
URL: https://svnweb.freebsd.org/changeset/base/291051

Log:
  Bring up to date with HEAD.

Added:
  projects/powernv/mips/conf/AP143
     - copied unchanged from r291050, head/sys/mips/conf/AP143
  projects/powernv/mips/conf/AP143.hints
     - copied unchanged from r291050, head/sys/mips/conf/AP143.hints
  projects/powernv/mips/conf/ONIONOMEGA
     - copied unchanged from r291050, head/sys/mips/conf/ONIONOMEGA
  projects/powernv/mips/conf/ONIONOMEGA.hints
     - copied unchanged from r291050, head/sys/mips/conf/ONIONOMEGA.hints
  projects/powernv/mips/conf/QCA953X_BASE
     - copied unchanged from r291050, head/sys/mips/conf/QCA953X_BASE
  projects/powernv/mips/conf/QCA953X_BASE.hints
     - copied unchanged from r291050, head/sys/mips/conf/QCA953X_BASE.hints
Modified:
  projects/powernv/arm/arm/busdma_machdep-v6.c
  projects/powernv/boot/common/loader.8
  projects/powernv/boot/powerpc/kboot/Makefile
  projects/powernv/conf/files.powerpc
  projects/powernv/conf/options
  projects/powernv/conf/options.powerpc
  projects/powernv/dev/isp/isp.c
  projects/powernv/dev/isp/isp_freebsd.c
  projects/powernv/dev/isp/isp_library.c
  projects/powernv/dev/isp/isp_library.h
  projects/powernv/dev/isp/isp_stds.h
  projects/powernv/dev/isp/isp_target.c
  projects/powernv/dev/isp/ispmbox.h
  projects/powernv/dev/isp/ispvar.h
  projects/powernv/dev/ntb/if_ntb/if_ntb.c
  projects/powernv/dev/ntb/ntb_hw/ntb_hw.c
  projects/powernv/dev/ntb/ntb_hw/ntb_hw.h
  projects/powernv/dev/uart/uart_dev_ns8250.c
  projects/powernv/dev/xen/control/control.c
  projects/powernv/geom/geom_dev.c
  projects/powernv/kern/imgact_elf.c
  projects/powernv/mips/conf/ALFA_HORNET_UB
  projects/powernv/mips/conf/AP121
  projects/powernv/mips/conf/AP135
  projects/powernv/mips/conf/AP91
  projects/powernv/mips/conf/AP93
  projects/powernv/mips/conf/AP94
  projects/powernv/mips/conf/AP96
  projects/powernv/mips/conf/BERI_DE4_MDROOT
  projects/powernv/mips/conf/BERI_DE4_SDROOT
  projects/powernv/mips/conf/BERI_SIM_MDROOT
  projects/powernv/mips/conf/BERI_SIM_SDROOT
  projects/powernv/mips/conf/BERI_SIM_VIRTIO
  projects/powernv/mips/conf/CARAMBOLA2
  projects/powernv/mips/conf/DB120
  projects/powernv/mips/conf/DIR-655A1
  projects/powernv/mips/conf/DIR-825B1
  projects/powernv/mips/conf/DIR-825C1
  projects/powernv/mips/conf/ENH200
  projects/powernv/mips/conf/PB47
  projects/powernv/mips/conf/PICOSTATION_M2HP
  projects/powernv/mips/conf/ROUTERSTATION
  projects/powernv/mips/conf/ROUTERSTATION_MFS
  projects/powernv/mips/conf/RSPRO
  projects/powernv/mips/conf/RSPRO_MFS
  projects/powernv/mips/conf/TL-ARCHERC7V2
  projects/powernv/mips/conf/TL-WDR4300
  projects/powernv/mips/conf/TL-WR1043NDv2
  projects/powernv/mips/conf/TL-WR740Nv4
  projects/powernv/mips/conf/TP-MR3020
  projects/powernv/mips/conf/TP-WN1043ND
  projects/powernv/mips/conf/WZR-300HP
  projects/powernv/mips/conf/WZR-HPAG300H
  projects/powernv/modules/tests/framework/Makefile
  projects/powernv/netinet/in_mcast.c
  projects/powernv/netinet6/in6_mcast.c
  projects/powernv/netpfil/ipfw/ip_fw_dynamic.c
  projects/powernv/netsmb/smb_conn.c
  projects/powernv/netsmb/smb_iod.c
  projects/powernv/ofed/drivers/net/mlx4/cmd.c
  projects/powernv/powerpc/include/bus.h
  projects/powernv/powerpc/mpc85xx/mpc85xx.c
  projects/powernv/powerpc/mpc85xx/mpc85xx.h
  projects/powernv/x86/x86/intr_machdep.c
  projects/powernv/x86/xen/hvm.c
  projects/powernv/x86/xen/xen_intr.c
Directory Properties:
  projects/powernv/   (props changed)
  projects/powernv/boot/   (props changed)
  projects/powernv/boot/powerpc/kboot/   (props changed)
  projects/powernv/conf/   (props changed)

Modified: projects/powernv/arm/arm/busdma_machdep-v6.c
==============================================================================
--- projects/powernv/arm/arm/busdma_machdep-v6.c	Thu Nov 19 02:04:16 2015	(r291050)
+++ projects/powernv/arm/arm/busdma_machdep-v6.c	Thu Nov 19 02:38:53 2015	(r291051)
@@ -117,8 +117,8 @@ struct bounce_page {
 
 struct sync_list {
 	vm_offset_t	vaddr;		/* kva of client data */
+	bus_addr_t	paddr;		/* physical address */
 	vm_page_t	pages;		/* starting page of client data */
-	vm_offset_t	dataoffs;	/* page offset of client data */
 	bus_size_t	datacount;	/* client data count */
 };
 
@@ -1076,17 +1076,19 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat
 			    sgsize);
 		} else {
 			if (map->sync_count > 0)
-				sl_end = VM_PAGE_TO_PHYS(sl->pages) +
-				    sl->dataoffs + sl->datacount;
+				sl_end = sl->paddr + sl->datacount;
 
 			if (map->sync_count == 0 || curaddr != sl_end) {
 				if (++map->sync_count > dmat->nsegments)
 					break;
 				sl++;
 				sl->vaddr = 0;
+				sl->paddr = curaddr;
 				sl->datacount = sgsize;
 				sl->pages = PHYS_TO_VM_PAGE(curaddr);
-				sl->dataoffs = curaddr & PAGE_MASK;
+				KASSERT(sl->pages != NULL,
+				    ("%s: page at PA:0x%08lx is not in "
+				    "vm_page_array", __func__, curaddr));
 			} else
 				sl->datacount += sgsize;
 		}
@@ -1188,8 +1190,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 			    sgsize);
 		} else {
 			if (map->sync_count > 0) {
-				sl_pend = VM_PAGE_TO_PHYS(sl->pages) +
-				    sl->dataoffs + sl->datacount;
+				sl_pend = sl->paddr + sl->datacount;
 				sl_vend = sl->vaddr + sl->datacount;
 			}
 
@@ -1201,9 +1202,17 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 					goto cleanup;
 				sl++;
 				sl->vaddr = kvaddr;
+				sl->paddr = curaddr;
+				if (kvaddr != 0) {
+					sl->pages = NULL;
+				} else {
+					sl->pages = PHYS_TO_VM_PAGE(curaddr);
+					KASSERT(sl->pages != NULL,
+					    ("%s: page at PA:0x%08lx is not "
+					    "in vm_page_array", __func__,
+					    curaddr));
+				}
 				sl->datacount = sgsize;
-				sl->pages = PHYS_TO_VM_PAGE(curaddr);
-				sl->dataoffs = curaddr & PAGE_MASK;
 			} else
 				sl->datacount += sgsize;
 		}
@@ -1299,10 +1308,10 @@ dma_dcache_sync(struct sync_list *sl, bu
 	vm_offset_t va, tempva;
 	bus_size_t size;
 
-	offset = sl->dataoffs;
+	offset = sl->paddr & PAGE_MASK;
 	m = sl->pages;
 	size = sl->datacount;
-	pa = VM_PAGE_TO_PHYS(m) | offset;
+	pa = sl->paddr;
 
 	for ( ; size != 0; size -= len, pa += len, offset = 0, ++m) {
 		tempva = 0;
@@ -1310,13 +1319,13 @@ dma_dcache_sync(struct sync_list *sl, bu
 			len = min(PAGE_SIZE - offset, size);
 			tempva = pmap_quick_enter_page(m);
 			va = tempva | offset;
+			KASSERT(pa == (VM_PAGE_TO_PHYS(m) | offset),
+			    ("unexpected vm_page_t phys: 0x%08x != 0x%08x",
+			    VM_PAGE_TO_PHYS(m) | offset, pa));
 		} else {
 			len = sl->datacount;
 			va = sl->vaddr;
 		}
-		KASSERT(pa == (VM_PAGE_TO_PHYS(m) | offset),
-		    ("unexpected vm_page_t phys: 0x%08x != 0x%08x",
-		    VM_PAGE_TO_PHYS(m) | offset, pa));
 
 		switch (op) {
 		case BUS_DMASYNC_PREWRITE:

Modified: projects/powernv/boot/common/loader.8
==============================================================================
--- projects/powernv/boot/common/loader.8	Thu Nov 19 02:04:16 2015	(r291050)
+++ projects/powernv/boot/common/loader.8	Thu Nov 19 02:38:53 2015	(r291051)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 25, 2015
+.Dd November 18, 2015
 .Dt LOADER 8
 .Os
 .Sh NAME
@@ -471,6 +471,14 @@ userland output (e.g.\& from
 .It Va currdev
 Selects the default device.
 Syntax for devices is odd.
+.It Va dumpdev
+Sets the device for kernel dumps.
+This can be used to ensure that a device is configured before the corresponding
+.Va dumpdev
+directive from
+.Xr rc.conf 5
+has been processed, allowing kernel panics that happen during the early stages
+of boot to be captured.
 .It Va init_chroot
 If set to a valid directory in the root file system, it causes
 .Xr init 8

Modified: projects/powernv/boot/powerpc/kboot/Makefile
==============================================================================
--- projects/powernv/boot/powerpc/kboot/Makefile	Thu Nov 19 02:04:16 2015	(r291050)
+++ projects/powernv/boot/powerpc/kboot/Makefile	Thu Nov 19 02:38:53 2015	(r291051)
@@ -102,11 +102,6 @@ CFLAGS+=	-I${.CURDIR}/../../../../lib/li
 DPADD=		${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
 LDADD=		${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
 
-SC_DFLT_FONT=cp437
-
-font.h:
-	uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h
-
 vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
 	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
 

Modified: projects/powernv/conf/files.powerpc
==============================================================================
--- projects/powernv/conf/files.powerpc	Thu Nov 19 02:04:16 2015	(r291050)
+++ projects/powernv/conf/files.powerpc	Thu Nov 19 02:38:53 2015	(r291051)
@@ -74,7 +74,7 @@ dev/syscons/scvtb.c		optional	sc
 dev/tsec/if_tsec.c		optional	tsec
 dev/tsec/if_tsec_fdt.c		optional	tsec fdt
 dev/uart/uart_cpu_powerpc.c	optional	uart
-dev/usb/controller/ehci_fsl.c	optional	ehci mpc85xx
+dev/usb/controller/ehci_fsl.c	optional	ehci mpc85xx | ehci qoriq_dpaa
 dev/vt/hw/ofwfb/ofwfb.c		optional	vt aim
 kern/kern_clocksource.c		standard
 kern/subr_dummy_vdso_tc.c	standard
@@ -133,15 +133,15 @@ powerpc/mikrotik/platform_rb.c	optional	
 powerpc/mpc85xx/atpic.c		optional	mpc85xx isa
 powerpc/mpc85xx/ds1553_bus_fdt.c	optional	ds1553 fdt
 powerpc/mpc85xx/ds1553_core.c	optional	ds1553
-powerpc/mpc85xx/fsl_sdhc.c	optional	mpc85xx sdhc
+powerpc/mpc85xx/fsl_sdhc.c	optional	mpc85xx sdhc | qoriq_dpaa sdhc
 powerpc/mpc85xx/i2c.c		optional	iicbus fdt
 powerpc/mpc85xx/isa.c		optional	mpc85xx isa
-powerpc/mpc85xx/lbc.c		optional	mpc85xx
-powerpc/mpc85xx/mpc85xx.c	optional	mpc85xx
+powerpc/mpc85xx/lbc.c		optional	mpc85xx | qoriq_dpaa
+powerpc/mpc85xx/mpc85xx.c	optional	mpc85xx | qoriq_dpaa
 powerpc/mpc85xx/mpc85xx_gpio.c	optional	mpc85xx gpio
-powerpc/mpc85xx/platform_mpc85xx.c	optional	mpc85xx
-powerpc/mpc85xx/pci_mpc85xx.c	optional	pci mpc85xx
-powerpc/mpc85xx/pci_mpc85xx_pcib.c	optional	pci mpc85xx
+powerpc/mpc85xx/platform_mpc85xx.c	optional	mpc85xx | qoriq_dpaa
+powerpc/mpc85xx/pci_mpc85xx.c	optional	pci mpc85xx | pci qoriq_dpaa
+powerpc/mpc85xx/pci_mpc85xx_pcib.c	optional	pci mpc85xx | pci qoriq_dpaa
 powerpc/ofw/ofw_machdep.c	standard
 powerpc/ofw/ofw_pci.c		optional	pci
 powerpc/ofw/ofw_pcibus.c	optional	pci

Modified: projects/powernv/conf/options
==============================================================================
--- projects/powernv/conf/options	Thu Nov 19 02:04:16 2015	(r291050)
+++ projects/powernv/conf/options	Thu Nov 19 02:38:53 2015	(r291051)
@@ -650,6 +650,7 @@ BKTR_NEW_MSP34XX_DRIVER		opt_bktr.h
 # Options for uart(4)
 UART_PPS_ON_CTS		opt_uart.h
 UART_POLL_FREQ		opt_uart.h
+UART_DEV_TOLERANCE_PCT	opt_uart.h
 
 # options for bus/device framework
 BUS_DEBUG		opt_bus.h

Modified: projects/powernv/conf/options.powerpc
==============================================================================
--- projects/powernv/conf/options.powerpc	Thu Nov 19 02:04:16 2015	(r291050)
+++ projects/powernv/conf/options.powerpc	Thu Nov 19 02:38:53 2015	(r291051)
@@ -21,6 +21,7 @@ GFB_NO_MODE_CHANGE	opt_gfb.h
 MPC85XX			opt_platform.h
 POWERMAC		opt_platform.h
 PS3			opt_platform.h
+QORIQ_DPAA		opt_platform.h
 MAMBO
 POWERNV
 PSERIES

Modified: projects/powernv/dev/isp/isp.c
==============================================================================
--- projects/powernv/dev/isp/isp.c	Thu Nov 19 02:04:16 2015	(r291050)
+++ projects/powernv/dev/isp/isp.c	Thu Nov 19 02:38:53 2015	(r291051)
@@ -64,19 +64,13 @@ __FBSDID("$FreeBSD$");
  * General defines
  */
 #define	MBOX_DELAY_COUNT	1000000 / 100
-#define	ISP_MARK_PORTDB(a, b, c)				\
-	do {								\
-		isp_prt(isp, ISP_LOG_SANCFG, 				\
-		    "Chan %d ISP_MARK_PORTDB@LINE %d", (b), __LINE__);	\
-		isp_mark_portdb((a), (b), (c));				\
-	} while (0)
 
 /*
  * Local static data
  */
 static const char fconf[] = "Chan %d PortDB[%d] changed:\n current =(0x%x@0x%06x 0x%08x%08x 0x%08x%08x)\n database=(0x%x@0x%06x 0x%08x%08x 0x%08x%08x)";
 static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d";
-static const char topology[] = "Chan %d WWPN 0x%08x%08x PortID 0x%06x handle 0x%x, Connection '%s'";
+static const char topology[] = "Chan %d WWPN 0x%08x%08x PortID 0x%06x LoopID 0x%x Connection '%s'";
 static const char bun[] = "bad underrun (count %d, resid %d, status %s)";
 static const char lipd[] = "Chan %d LIP destroyed %d active commands";
 static const char sacq[] = "unable to acquire scratch area";
@@ -131,8 +125,9 @@ static int isp_scan_fabric(ispsoftc_t *,
 static int isp_login_device(ispsoftc_t *, int, uint32_t, isp_pdb_t *, uint16_t *);
 static int isp_register_fc4_type(ispsoftc_t *, int);
 static int isp_register_fc4_type_24xx(ispsoftc_t *, int);
+static int isp_register_fc4_features_24xx(ispsoftc_t *, int);
 static uint16_t isp_next_handle(ispsoftc_t *, uint16_t *);
-static void isp_fw_state(ispsoftc_t *, int);
+static int isp_fw_state(ispsoftc_t *, int);
 static void isp_mboxcmd_qnw(ispsoftc_t *, mbreg_t *, int);
 static void isp_mboxcmd(ispsoftc_t *, mbreg_t *);
 
@@ -149,6 +144,19 @@ static void isp_parse_nvram_12160(ispsof
 static void isp_parse_nvram_2100(ispsoftc_t *, uint8_t *);
 static void isp_parse_nvram_2400(ispsoftc_t *, uint8_t *);
 
+static void
+isp_change_fw_state(ispsoftc_t *isp, int chan, int state)
+{
+	fcparam *fcp = FCPARAM(isp, chan);
+
+	if (fcp->isp_fwstate == state)
+		return;
+	isp_prt(isp, ISP_LOGCONFIG|ISP_LOG_SANCFG,
+	    "Chan %d Firmware state <%s->%s>", chan,
+	    isp_fc_fw_statename(fcp->isp_fwstate), isp_fc_fw_statename(state));
+	fcp->isp_fwstate = state;
+}
+
 /*
  * Reset Hardware.
  *
@@ -1267,8 +1275,9 @@ isp_reset(ispsoftc_t *isp, int do_load_d
 			isp->isp_nchan = 1;
 		}
 	}
-	for (i = 0; i < isp->isp_nchan; i++) {
-		isp_fw_state(isp, i);
+	if (IS_FC(isp)) {
+		for (i = 0; i < isp->isp_nchan; i++)
+			isp_change_fw_state(isp, i, FW_CONFIG_WAIT);
 	}
 	if (isp->isp_dead) {
 		isp_shutdown(isp);
@@ -2577,7 +2586,10 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
 		pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
 		ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8);
 		ISP_MEMCPY(pdb->nodename, un.bill.pdb_nodename, 8);
-		isp_prt(isp, ISP_LOG_SANCFG, "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x", chan, id, pdb->portid, un.bill.pdb_flags, un.bill.pdb_curstate);
+		isp_prt(isp, ISP_LOGDEBUG1,
+		    "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x",
+		    chan, id, pdb->portid, un.bill.pdb_flags,
+		    un.bill.pdb_curstate);
 		if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) {
 			mbs.param[0] = MBOX_NOT_LOGGED_IN;
 			if (dolock) {
@@ -2592,6 +2604,8 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
 		pdb->portid = BITS2WORD(un.fred.pdb_portid_bits);
 		ISP_MEMCPY(pdb->portname, un.fred.pdb_portname, 8);
 		ISP_MEMCPY(pdb->nodename, un.fred.pdb_nodename, 8);
+		isp_prt(isp, ISP_LOGDEBUG1,
+		    "Chan %d handle 0x%x Port 0x%06x", chan, id, pdb->portid);
 	}
 	if (dolock) {
 		FC_SCRATCH_RELEASE(isp, chan);
@@ -2675,7 +2689,7 @@ static void
 isp_dump_chip_portdb(ispsoftc_t *isp, int chan, int dolock)
 {
 	isp_pdb_t pdb;
-	int lim, loopid;
+	uint16_t lim, nphdl;
 
 	isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGINFO, "Chan %d chip port dump", chan);
 	if (ISP_CAP_2KLOGIN(isp)) {
@@ -2683,40 +2697,35 @@ isp_dump_chip_portdb(ispsoftc_t *isp, in
 	} else {
 		lim = NPH_MAX;
 	}
-	for (loopid = 0; loopid != lim; loopid++) {
-		if (isp_getpdb(isp, chan, loopid, &pdb, dolock)) {
+	for (nphdl = 0; nphdl != lim; nphdl++) {
+		if (isp_getpdb(isp, chan, nphdl, &pdb, dolock)) {
 			continue;
 		}
-		isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGINFO, "Chan %d Loopid 0x%04x "
+		isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGINFO, "Chan %d Handle 0x%04x "
 		    "PortID 0x%06x WWPN 0x%02x%02x%02x%02x%02x%02x%02x%02x",
-		    chan, loopid, pdb.portid, pdb.portname[0], pdb.portname[1],
+		    chan, nphdl, pdb.portid, pdb.portname[0], pdb.portname[1],
 		    pdb.portname[2], pdb.portname[3], pdb.portname[4],
 		    pdb.portname[5], pdb.portname[6], pdb.portname[7]);
 	}
 }
 
 static uint64_t
-isp_get_wwn(ispsoftc_t *isp, int chan, int loopid, int nodename)
+isp_get_wwn(ispsoftc_t *isp, int chan, int nphdl, int nodename)
 {
 	uint64_t wwn = INI_NONE;
-	fcparam *fcp = FCPARAM(isp, chan);
 	mbreg_t mbs;
 
-	if (fcp->isp_fwstate < FW_READY ||
-	    fcp->isp_loopstate < LOOP_PDB_RCVD) {
-		return (wwn);
-	}
 	MBSINIT(&mbs, MBOX_GET_PORT_NAME,
 	    MBLOGALL & ~MBLOGMASK(MBOX_COMMAND_PARAM_ERROR), 500000);
 	if (ISP_CAP_2KLOGIN(isp)) {
-		mbs.param[1] = loopid;
+		mbs.param[1] = nphdl;
 		if (nodename) {
 			mbs.param[10] = 1;
 		}
 		mbs.param[9] = chan;
 	} else {
 		mbs.ibitm = 3;
-		mbs.param[1] = loopid << 8;
+		mbs.param[1] = nphdl << 8;
 		if (nodename) {
 			mbs.param[1] |= 1;
 		}
@@ -2757,30 +2766,29 @@ static int
 isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay)
 {
 	mbreg_t mbs;
-	int check_for_fabric, r;
-	uint8_t lwfs;
-	int loopid;
+	int r;
+	uint16_t nphdl;
 	fcparam *fcp;
-	fcportdb_t *lp;
 	isp_pdb_t pdb;
 	NANOTIME_T hra, hrb;
 
 	fcp = FCPARAM(isp, chan);
 
-	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC Link Test Entry", chan);
-	ISP_MARK_PORTDB(isp, chan, 1);
+	/* Mark port database entries for following scan. */
+	isp_mark_portdb(isp, chan, 1);
+
+	if (fcp->isp_loopstate >= LOOP_LTEST_DONE)
+		return (0);
+
+	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC link test", chan);
+	fcp->isp_loopstate = LOOP_TESTING_LINK;
 
 	/*
 	 * Wait up to N microseconds for F/W to go to a ready state.
 	 */
-	lwfs = FW_CONFIG_WAIT;
 	GET_NANOTIME(&hra);
 	while (1) {
-		isp_fw_state(isp, chan);
-		if (lwfs != fcp->isp_fwstate) {
-			isp_prt(isp, ISP_LOGCONFIG|ISP_LOG_SANCFG, "Chan %d Firmware State <%s->%s>", chan, isp_fc_fw_statename((int)lwfs), isp_fc_fw_statename((int)fcp->isp_fwstate));
-			lwfs = fcp->isp_fwstate;
-		}
+		isp_change_fw_state(isp, chan, isp_fw_state(isp, chan));
 		if (fcp->isp_fwstate == FW_READY) {
 			break;
 		}
@@ -2794,7 +2802,9 @@ isp_fclink_test(ispsoftc_t *isp, int cha
 	 * If we haven't gone to 'ready' state, return.
 	 */
 	if (fcp->isp_fwstate != FW_READY) {
-		isp_prt(isp, ISP_LOG_SANCFG, "%s: chan %d not at FW_READY state", __func__, chan);
+		isp_prt(isp, ISP_LOG_SANCFG,
+		    "Chan %d Firmware is not ready (%s)",
+		    chan, isp_fc_fw_statename(fcp->isp_fwstate));
 		return (-1);
 	}
 
@@ -2815,7 +2825,14 @@ isp_fclink_test(ispsoftc_t *isp, int cha
 	}
 
 	if (IS_2100(isp)) {
-		fcp->isp_topo = TOPO_NL_PORT;
+		/*
+		 * Don't bother with fabric if we are using really old
+		 * 2100 firmware. It's just not worth it.
+		 */
+		if (ISP_FW_NEWER_THAN(isp, 1, 15, 37))
+			fcp->isp_topo = TOPO_FL_PORT;
+		else
+			fcp->isp_topo = TOPO_NL_PORT;
 	} else {
 		int topo = (int) mbs.param[6];
 		if (topo < TOPO_NL_PORT || topo > TOPO_PTP_STUB) {
@@ -2825,22 +2842,6 @@ isp_fclink_test(ispsoftc_t *isp, int cha
 	}
 	fcp->isp_portid = mbs.param[2] | (mbs.param[3] << 16);
 
-	if (IS_2100(isp)) {
-		/*
-		 * Don't bother with fabric if we are using really old
-		 * 2100 firmware. It's just not worth it.
-		 */
-		if (ISP_FW_NEWER_THAN(isp, 1, 15, 37)) {
-			check_for_fabric = 1;
-		} else {
-			check_for_fabric = 0;
-		}
-	} else if (fcp->isp_topo == TOPO_FL_PORT || fcp->isp_topo == TOPO_F_PORT) {
-		check_for_fabric = 1;
-	} else {
-		check_for_fabric = 0;
-	}
-
 	/*
 	 * Check to make sure we got a valid loopid
 	 * The 24XX seems to mess this up for multiple channels.
@@ -2860,63 +2861,33 @@ isp_fclink_test(ispsoftc_t *isp, int cha
 			}
 			if (alpa_map[i] && fcp->isp_loopid != i) {
 				isp_prt(isp, ISP_LOG_SANCFG,
-				    "Chan %d deriving loopid %d from AL_PA map (AL_PA 0x%x) and ignoring returned value %d (AL_PA 0x%x)",
+				    "Chan %d Deriving loopid %d from AL_PA map (AL_PA 0x%x) and ignoring returned value %d (AL_PA 0x%x)",
 				    chan, i, alpa_map[i], fcp->isp_loopid, alpa);
 				fcp->isp_loopid = i;
 			}
 		}
 	}
 
-
-	if (IS_24XX(isp)) { /* XXX SHOULDN'T THIS BE FOR 2K F/W? XXX */
-		loopid = NPH_FL_ID;
-	} else {
-		loopid = FL_ID;
-	}
-	if (check_for_fabric) {
-		r = isp_getpdb(isp, chan, loopid, &pdb, 1);
-		if (r && (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT)) {
-			isp_prt(isp, ISP_LOGWARN, "fabric topology but cannot get info about fabric controller (0x%x)", r);
-			fcp->isp_topo = TOPO_PTP_STUB;
-		}
-	} else {
-		r = -1;
-	}
-	if (r == 0) {
-		if (IS_2100(isp)) {
-			fcp->isp_topo = TOPO_FL_PORT;
-		}
-		if (pdb.portid == 0) {
-			/*
-			 * Crock.
-			 */
-			fcp->isp_topo = TOPO_NL_PORT;
+	if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) {
+		nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID;
+		r = isp_getpdb(isp, chan, nphdl, &pdb, 1);
+		if (r != 0 || pdb.portid == 0) {
+			if (IS_2100(isp)) {
+				fcp->isp_topo = TOPO_NL_PORT;
+			} else {
+				isp_prt(isp, ISP_LOGWARN,
+				    "fabric topology, but cannot get info about fabric controller (0x%x)", r);
+				fcp->isp_topo = TOPO_PTP_STUB;
+			}
 			goto not_on_fabric;
 		}
 
-		/*
-		 * Save the Fabric controller's port database entry.
-		 */
-		lp = &fcp->portdb[FL_ID];
-		lp->state = FC_PORTDB_STATE_PENDING_VALID;
-		MAKE_WWN_FROM_NODE_NAME(lp->node_wwn, pdb.nodename);
-		MAKE_WWN_FROM_NODE_NAME(lp->port_wwn, pdb.portname);
-		lp->prli_word3 = pdb.prli_word3;
-		lp->portid = pdb.portid;
-		lp->handle = pdb.handle;
-		lp->new_portid = lp->portid;
-		lp->new_prli_word3 = lp->prli_word3;
 		if (IS_24XX(isp)) {
-			if (check_for_fabric) {
-				/*
-				 * The mbs is still hanging out from the MBOX_GET_LOOP_ID above.
-				 */
-				fcp->isp_fabric_params = mbs.param[7];
-			} else {
-				fcp->isp_fabric_params = 0;
-			}
+			fcp->isp_fabric_params = mbs.param[7];
 			fcp->isp_sns_hdl = NPH_SNS_ID;
 			r = isp_register_fc4_type_24xx(isp, chan);
+			if (r == 0)
+				isp_register_fc4_features_24xx(isp, chan);
 		} else {
 			fcp->isp_sns_hdl = SNS_ID;
 			r = isp_register_fc4_type(isp, chan);
@@ -2925,11 +2896,9 @@ isp_fclink_test(ispsoftc_t *isp, int cha
 			isp_prt(isp, ISP_LOGWARN|ISP_LOG_SANCFG, "%s: register fc4 type failed", __func__);
 			return (-1);
 		}
-	} else {
-not_on_fabric:
-		fcp->portdb[FL_ID].state = FC_PORTDB_STATE_NIL;
 	}
 
+not_on_fabric:
 	fcp->isp_gbspeed = 1;
 	if (IS_23XX(isp) || IS_24XX(isp)) {
 		MBSINIT(&mbs, MBOX_GET_SET_DATA_RATE, MBLOGALL, 3000000);
@@ -2953,11 +2922,12 @@ not_on_fabric:
 		}
 	}
 
+	fcp->isp_loopstate = LOOP_LTEST_DONE;
 	/*
 	 * Announce ourselves, too.
 	 */
 	isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGCONFIG, topology, chan, (uint32_t) (fcp->isp_wwpn >> 32), (uint32_t) fcp->isp_wwpn, fcp->isp_portid, fcp->isp_loopid, isp_fc_toponame(fcp));
-	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC Link Test Complete", chan);
+	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC link test done", chan);
 	return (0);
 }
 
@@ -2967,19 +2937,10 @@ not_on_fabric:
  * At this point, we've scanned the local loop (if any) and the fabric
  * and performed fabric logins on all new devices.
  *
- * Our task here is to go through our port database and remove any entities
+ * Our task here is to go through our port database removing any entities
  * that are still marked probational (issuing PLOGO for ones which we had
- * PLOGI'd into) or are dead.
- *
- * Our task here is to also check policy to decide whether devices which
- * have *changed* in some way should still be kept active. For example,
- * if a device has just changed PortID, we can either elect to treat it
- * as an old device or as a newly arrived device (and notify the outer
- * layer appropriately).
- *
- * We also do initiator map target id assignment here for new initiator
- * devices and refresh old ones ot make sure that they point to the correct
- * entities.
+ * PLOGI'd into) or are dead, and notifying upper layers about new/changed
+ * devices.
  */
 static int
 isp_pdb_sync(ispsoftc_t *isp, int chan)
@@ -2988,44 +2949,14 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
 	fcportdb_t *lp;
 	uint16_t dbidx;
 
-	if (fcp->isp_loopstate == LOOP_READY) {
-		return (0);
-	}
-
-	/*
-	 * Make sure we're okay for doing this right now.
-	 */
-	if (fcp->isp_loopstate != LOOP_PDB_RCVD &&
-	    fcp->isp_loopstate != LOOP_FSCAN_DONE &&
-	    fcp->isp_loopstate != LOOP_LSCAN_DONE) {
-		isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d",
-		    fcp->isp_loopstate);
+	if (fcp->isp_loopstate < LOOP_FSCAN_DONE) {
 		return (-1);
 	}
-
-	if (fcp->isp_topo == TOPO_FL_PORT ||
-	    fcp->isp_topo == TOPO_NL_PORT ||
-	    fcp->isp_topo == TOPO_N_PORT) {
-		if (fcp->isp_loopstate < LOOP_LSCAN_DONE) {
-			if (isp_scan_loop(isp, chan) != 0) {
-				isp_prt(isp, ISP_LOGWARN,
-				    "isp_pdb_sync: isp_scan_loop failed");
-				return (-1);
-			}
-		}
-	}
-
-	if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) {
-		if (fcp->isp_loopstate < LOOP_FSCAN_DONE) {
-			if (isp_scan_fabric(isp, chan) != 0) {
-				isp_prt(isp, ISP_LOGWARN,
-				    "isp_pdb_sync: isp_scan_fabric failed");
-				return (-1);
-			}
-		}
+	if (fcp->isp_loopstate > LOOP_SYNCING_PDB) {
+		return (0);
 	}
 
-	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Synchronizing PDBs", chan);
+	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC PDB sync", chan);
 
 	fcp->isp_loopstate = LOOP_SYNCING_PDB;
 
@@ -3079,10 +3010,6 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
 			lp->prli_word3 = lp->new_prli_word3;
 			lp->state = FC_PORTDB_STATE_VALID;
 			isp_async(isp, ISPASYNC_DEV_STAYED, chan, lp);
-			if (dbidx != FL_ID) {
-				lp->new_prli_word3 = 0;
-				lp->new_portid = 0;
-			}
 			break;
 		case FC_PORTDB_STATE_ZOMBIE:
 			break;
@@ -3101,6 +3028,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
 	 */
 	fcp->loop_seen_once = 1;
 	fcp->isp_loopstate = LOOP_READY;
+	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC PDB sync done", chan);
 	return (0);
 }
 
@@ -3117,36 +3045,34 @@ isp_scan_loop(ispsoftc_t *isp, int chan)
 	uint16_t handles[LOCAL_LOOP_LIM];
 	uint16_t handle;
 
-	if (fcp->isp_fwstate < FW_READY ||
-	    fcp->isp_loopstate < LOOP_PDB_RCVD) {
+	if (fcp->isp_loopstate < LOOP_LTEST_DONE) {
 		return (-1);
 	}
 	if (fcp->isp_loopstate > LOOP_SCANNING_LOOP) {
 		return (0);
 	}
+	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC loop scan", chan);
 	if (fcp->isp_topo != TOPO_NL_PORT && fcp->isp_topo != TOPO_FL_PORT &&
 	    fcp->isp_topo != TOPO_N_PORT) {
 		isp_prt(isp, ISP_LOG_SANCFG,
-		    "Chan %d no loop topology to scan", chan);
+		    "Chan %d FC loop scan done (no loop)", chan);
 		fcp->isp_loopstate = LOOP_LSCAN_DONE;
 		return (0);
 	}
-
 	fcp->isp_loopstate = LOOP_SCANNING_LOOP;
 
 	lim = LOCAL_LOOP_LIM;
 	r = isp_gethandles(isp, chan, handles, &lim, 1, 1);
 	if (r != 0) {
 		isp_prt(isp, ISP_LOG_SANCFG,
-		    "Chan %d getting list of handles failed with %x", chan, r);
+		    "Chan %d Getting list of handles failed with %x", chan, r);
 fail:
-		ISP_MARK_PORTDB(isp, chan, 1);
 		isp_prt(isp, ISP_LOG_SANCFG,
-		    "Chan %d FC scan loop DONE (bad)", chan);
+		    "Chan %d FC loop scan done (bad)", chan);
 		return (-1);
 	}
 
-	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC scan loop -- %d ports",
+	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Got %d handles",
 	    chan, lim);
 
 	/*
@@ -3172,8 +3098,12 @@ fail:
 		 */
 		if (IS_2100(isp) || IS_2200(isp)) {
 			uint64_t node_wwn = isp_get_wwn(isp, chan, handle, 1);
-			if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
-				goto fail;
+			if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) {
+abort:
+				isp_prt(isp, ISP_LOG_SANCFG,
+				    "Chan %d FC loop scan done (abort)", chan);
+				return (-1);
+			}
 			if (node_wwn == INI_NONE) {
 				continue;
 			}
@@ -3185,15 +3115,15 @@ fail:
 		r = isp_getpdb(isp, chan, handle, &pdb, 1);
 		if (r != 0) {
 			isp_prt(isp, ISP_LOGDEBUG1,
-			    "Chan %d FC scan loop handle %d returned %x",
+			    "Chan %d FC Scan Loop handle %d returned %x",
 			    chan, handle, r);
 			if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
-				goto fail;
+				goto abort;
 			continue;
 		}
 
 		if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
-			goto fail;
+			goto abort;
 
 		/*
 		 * On *very* old 2100 firmware we would end up sometimes
@@ -3279,7 +3209,9 @@ fail:
 				lp->new_portid = tmp.portid;
 				lp->new_prli_word3 = tmp.prli_word3;
 				lp->state = FC_PORTDB_STATE_PENDING_VALID;
-				isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Loop Port 0x%06x@0x%04x Pending Valid", chan, tmp.portid, tmp.handle);
+				isp_prt(isp, ISP_LOG_SANCFG,
+				    "Chan %d Loop port 0x%06x@0x%04x now pending valid",
+				    chan, tmp.portid, tmp.handle);
 				continue;
 			}
 
@@ -3293,7 +3225,9 @@ fail:
 			 * Claim that this has changed and let somebody else
 			 * decide what to do.
 			 */
-			isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Loop Port 0x%06x@0x%04x changed", chan, tmp.portid, tmp.handle);
+			isp_prt(isp, ISP_LOG_SANCFG,
+			    "Chan %d Loop port 0x%06x@0x%04x changed",
+			    chan, tmp.portid, tmp.handle);
 			lp->state = FC_PORTDB_STATE_CHANGED;
 			lp->new_portid = tmp.portid;
 			lp->new_prli_word3 = tmp.prli_word3;
@@ -3324,10 +3258,14 @@ fail:
 		lp->handle = tmp.handle;
 		lp->port_wwn = tmp.port_wwn;
 		lp->node_wwn = tmp.node_wwn;
-		isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Loop Port 0x%06x@0x%04x is New Entry", chan, tmp.portid, tmp.handle);
+		isp_prt(isp, ISP_LOG_SANCFG,
+		    "Chan %d Loop port 0x%06x@0x%04x is a new entry",
+		    chan, tmp.portid, tmp.handle);
 	}
+	if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
+		goto abort;
 	fcp->isp_loopstate = LOOP_LSCAN_DONE;
-	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC scan loop DONE", chan);
+	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC loop scan done", chan);
 	return (0);
 }
 
@@ -3508,53 +3446,53 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 {
 	fcparam *fcp = FCPARAM(isp, chan);
 	uint32_t portid;
-	uint16_t handle, loopid;
+	uint16_t nphdl;
 	isp_pdb_t pdb;
 	int portidx, portlim, r;
 	sns_gid_ft_rsp_t *rs0, *rs1;
 
-	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC Scan Fabric", chan);
-	if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate < LOOP_LSCAN_DONE) {
+	if (fcp->isp_loopstate < LOOP_LSCAN_DONE) {
 		return (-1);
 	}
 	if (fcp->isp_loopstate > LOOP_SCANNING_FABRIC) {
 		return (0);
 	}
+	isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC fabric scan", chan);
 	if (fcp->isp_topo != TOPO_FL_PORT && fcp->isp_topo != TOPO_F_PORT) {
 		fcp->isp_loopstate = LOOP_FSCAN_DONE;
-		isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC Scan Fabric Done (no fabric)", chan);
+		isp_prt(isp, ISP_LOG_SANCFG,
+		    "Chan %d FC fabric scan done (no fabric)", chan);
 		return (0);
 	}
-
 	fcp->isp_loopstate = LOOP_SCANNING_FABRIC;
+
 	if (FC_SCRATCH_ACQUIRE(isp, chan)) {
 		isp_prt(isp, ISP_LOGERR, sacq);
-		ISP_MARK_PORTDB(isp, chan, 1);
+fail:
+		isp_prt(isp, ISP_LOG_SANCFG,
+		    "Chan %d FC fabric scan done (bad)", chan);
 		return (-1);
 	}
 	if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
+abort:
 		FC_SCRATCH_RELEASE(isp, chan);
-		ISP_MARK_PORTDB(isp, chan, 1);
+		isp_prt(isp, ISP_LOG_SANCFG,
+		    "Chan %d FC fabric scan done (abort)", chan);
 		return (-1);
 	}
 
 	/*
 	 * Make sure we still are logged into the fabric controller.
 	 */
-	if (IS_24XX(isp)) {	/* XXX SHOULDN'T THIS BE TRUE FOR 2K F/W? XXX */
-		loopid = NPH_FL_ID;
-	} else {
-		loopid = FL_ID;
-	}
-	r = isp_getpdb(isp, chan, loopid, &pdb, 0);
+	nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID;
+	r = isp_getpdb(isp, chan, nphdl, &pdb, 0);
 	if ((r & 0xffff) == MBOX_NOT_LOGGED_IN) {
 		isp_dump_chip_portdb(isp, chan, 0);
 	}
 	if (r) {
-		fcp->isp_loopstate = LOOP_PDB_RCVD;
+		fcp->isp_loopstate = LOOP_LTEST_DONE;
 		FC_SCRATCH_RELEASE(isp, chan);
-		ISP_MARK_PORTDB(isp, chan, 1);
-		return (-1);
+		goto fail;
 	}
 
 	if (IS_24XX(isp)) {
@@ -3564,9 +3502,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 	}
 
 	if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
-		FC_SCRATCH_RELEASE(isp, chan);
-		ISP_MARK_PORTDB(isp, chan, 1);
-		return (-1);
+		goto abort;
 	}
 
 	if (r > 0) {
@@ -3574,7 +3510,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 		FC_SCRATCH_RELEASE(isp, chan);
 		return (0);
 	} else if (r < 0) {
-		fcp->isp_loopstate = LOOP_PDB_RCVD;	/* try again */
+		fcp->isp_loopstate = LOOP_LTEST_DONE;	/* try again */
 		FC_SCRATCH_RELEASE(isp, chan);
 		return (0);
 	}
@@ -3584,9 +3520,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 	rs1 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+OGPOFF);
 	isp_get_gid_ft_response(isp, rs0, rs1, NGENT);
 	if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
-		FC_SCRATCH_RELEASE(isp, chan);
-		ISP_MARK_PORTDB(isp, chan, 1);
-		return (-1);
+		goto abort;
 	}
 	if (rs1->snscb_cthdr.ct_cmd_resp != LS_ACC) {
 		int level;
@@ -3604,12 +3538,6 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 		return (0);
 	}
 
-
-	/*
-	 * If we get this far, we certainly still have the fabric controller.
-	 */
-	fcp->portdb[FL_ID].state = FC_PORTDB_STATE_PENDING_VALID;
-
 	/*
 	 * Go through the list and remove duplicate port ids.
 	 */
@@ -3631,7 +3559,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 	}
 	portlim = portidx + 1;
 	isp_prt(isp, ISP_LOG_SANCFG,
-	    "Chan %d got %d ports back from name server", chan, portlim);
+	    "Chan %d Got %d ports back from name server", chan, portlim);
 
 	for (portidx = 0; portidx < portlim; portidx++) {
 		int npidx;
@@ -3686,35 +3614,19 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 
 		if (portid == 0) {
 			isp_prt(isp, ISP_LOG_SANCFG,
-			    "Chan %d skipping null PortID at idx %d",
+			    "Chan %d Skipping null PortID at idx %d",
 			    chan, portidx);
 			continue;
 		}
 
-		/*
-		 * Skip ourselves here and on other channels. If we're
-		 * multi-id, we can't check the portids in other FCPARAM
-		 * arenas because the resolutions here aren't synchronized.
-		 * The best way to do this is to exclude looking at portids
-		 * that have the same domain and area code as our own
-		 * portid.
-		 */
-		if (ISP_CAP_MULTI_ID(isp) && isp->isp_nchan > 1) {
-			if ((portid >> 8) == (fcp->isp_portid >> 8)) {
-				isp_prt(isp, ISP_LOG_SANCFG,
-				    "Chan %d skip PortID 0x%06x",
-				    chan, portid);
-				continue;
-			}
-		} else if (portid == fcp->isp_portid) {
+		if (portid == fcp->isp_portid) {
 			isp_prt(isp, ISP_LOG_SANCFG,
-			    "Chan %d skip ourselves on @ PortID 0x%06x",
-			    chan, portid);
+			    "Chan %d Skipping our PortID 0x%06x", chan, portid);
 			continue;
 		}
 
 		isp_prt(isp, ISP_LOG_SANCFG,
-		    "Chan %d Checking Fabric Port 0x%06x", chan, portid);
+		    "Chan %d Checking fabric port 0x%06x", chan, portid);
 
 		/*
 		 * We now search our Port Database for any
@@ -3759,10 +3671,8 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 			 */
 
 			r = isp_getpdb(isp, chan, lp->handle, &pdb, 0);
-			if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) {
-				FC_SCRATCH_RELEASE(isp, chan);
-				ISP_MARK_PORTDB(isp, chan, 1);
-				return (-1);
+			if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
+				goto abort;
 			}
 			if (r != 0) {
 				lp->new_portid = portid;
@@ -3806,19 +3716,14 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 				     &FCPARAM(isp, 0)->isp_lasthdl)) {
 					lp->new_portid = portid;
 					lp->state = FC_PORTDB_STATE_DEAD;
-					if (fcp->isp_loopstate !=
+					if (fcp->isp_loopstate <
 					    LOOP_SCANNING_FABRIC) {
-						FC_SCRATCH_RELEASE(isp, chan);
-						ISP_MARK_PORTDB(isp, chan, 1);
-						return (-1);
+						goto abort;
 					}
 					continue;
 				}
-				if (fcp->isp_loopstate !=
-				    LOOP_SCANNING_FABRIC) {
-					FC_SCRATCH_RELEASE(isp, chan);
-					ISP_MARK_PORTDB(isp, chan, 1);
-					return (-1);
+				if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
+					goto abort;
 				}
 				MAKE_WWN_FROM_NODE_NAME(wwnn, pdb.nodename);
 				MAKE_WWN_FROM_NODE_NAME(wwpn, pdb.portname);
@@ -3852,10 +3757,14 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 			lp->new_portid = portid;
 			lp->new_prli_word3 = nr;
 			if (pdb.portid != lp->portid || nr != lp->prli_word3 || handle_changed) {
-				isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Fabric Port 0x%06x changed", chan, portid);
+				isp_prt(isp, ISP_LOG_SANCFG,
+				    "Chan %d Fabric port 0x%06x changed",
+				    chan, portid);
 				lp->state = FC_PORTDB_STATE_CHANGED;
 			} else {
-				isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Fabric Port 0x%06x Now Pending Valid", chan, portid);
+				isp_prt(isp, ISP_LOG_SANCFG,
+				    "Chan %d Fabric port 0x%06x now pending valid",
+				    chan, portid);
 				lp->state = FC_PORTDB_STATE_PENDING_VALID;
 			}
 			continue;
@@ -3873,10 +3782,6 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 
 		dbidx = MAX_FC_TARG;
 		for (lp = fcp->portdb; lp < &fcp->portdb[MAX_FC_TARG]; lp++) {
-			if (lp >= &fcp->portdb[FL_ID] &&
-			    lp <= &fcp->portdb[SNS_ID]) {
-				continue;
-			}
 			if (lp->state == FC_PORTDB_STATE_NIL) {
 				if (dbidx == MAX_FC_TARG) {
 					dbidx = lp - fcp->portdb;
@@ -3922,20 +3827,16 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 		 */
 		if (isp_login_device(isp, chan, portid, &pdb,
 		    &FCPARAM(isp, 0)->isp_lasthdl)) {
-			if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) {
-				FC_SCRATCH_RELEASE(isp, chan);
-				ISP_MARK_PORTDB(isp, chan, 1);
-				return (-1);
+			if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
+				goto abort;
 			}
 			continue;
 		}
-		if (fcp->isp_loopstate != LOOP_SCANNING_FABRIC) {
-			FC_SCRATCH_RELEASE(isp, chan);
-			ISP_MARK_PORTDB(isp, chan, 1);
-			return (-1);
+		if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
+			goto abort;
 		}
 
-		handle = pdb.handle;
+		nphdl = pdb.handle;
 		MAKE_WWN_FROM_NODE_NAME(wwnn, pdb.nodename);
 		MAKE_WWN_FROM_NODE_NAME(wwpn, pdb.portname);
 		nr = pdb.prli_word3;
@@ -3946,9 +3847,6 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
 		 * WWNN/WWPN duple
 		 */
 		for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) {
-			if (dbidx >= FL_ID && dbidx <= SNS_ID) {
-				continue;
-			}
 			if ((fcp->portdb[dbidx].node_wwn == wwnn ||
 			     fcp->portdb[dbidx].node_wwn == 0) &&

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511190238.tAJ2cscH062145>