PERFORCE change 110242 for review

Roman Divacky rdivacky at FreeBSD.org
Tue Nov 21 16:17:22 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=110242

Change 110242 by rdivacky at rdivacky_witten on 2006/11/19 09:59:09

	IFC

Affected files ...

.. //depot/projects/linuxolator/src/sys/compat/linux/linux_getcwd.c#4 integrate
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#36 integrate
.. //depot/projects/linuxolator/src/sys/conf/files.sun4v#5 integrate
.. //depot/projects/linuxolator/src/sys/dev/em/if_em.c#10 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/isp.c#5 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/isp_library.c#5 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/isp_library.h#4 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/isp_pci.c#5 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/isp_stds.h#3 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/ispmbox.h#4 integrate
.. //depot/projects/linuxolator/src/sys/dev/isp/ispvar.h#4 integrate
.. //depot/projects/linuxolator/src/sys/dev/mfi/mfi.c#7 integrate
.. //depot/projects/linuxolator/src/sys/gnu/fs/ext2fs/ext2_vfsops.c#4 integrate
.. //depot/projects/linuxolator/src/sys/ia64/ia64/genassym.c#3 integrate
.. //depot/projects/linuxolator/src/sys/ia64/ia64/interrupt.c#2 integrate
.. //depot/projects/linuxolator/src/sys/ia64/ia64/machdep.c#4 integrate
.. //depot/projects/linuxolator/src/sys/ia64/ia64/mp_machdep.c#2 integrate
.. //depot/projects/linuxolator/src/sys/ia64/include/kdb.h#2 integrate
.. //depot/projects/linuxolator/src/sys/ia64/include/pcpu.h#2 integrate
.. //depot/projects/linuxolator/src/sys/net/ethernet.h#2 integrate
.. //depot/projects/linuxolator/src/sys/net/if_ethersubr.c#3 integrate
.. //depot/projects/linuxolator/src/sys/sparc64/sparc64/autoconf.c#2 integrate
.. //depot/projects/linuxolator/src/sys/sparc64/sparc64/identcpu.c#2 integrate
.. //depot/projects/linuxolator/src/sys/sparc64/sparc64/mem.c#2 integrate
.. //depot/projects/linuxolator/src/sys/sun4v/conf/NOTES#6 integrate
.. //depot/projects/linuxolator/src/sys/sun4v/include/cache.h#2 integrate
.. //depot/projects/linuxolator/src/sys/sun4v/include/pcpu.h#2 integrate
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/autoconf.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/clock.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/counter.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/db_disasm.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/eeprom.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/elf_machdep.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/gdb_machdep.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/identcpu.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/in_cksum.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/iommu.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/mem.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/ofw_bus.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/ofw_machdep.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/prof_machdep.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/rwindow.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/sys_machdep.c#2 delete
.. //depot/projects/linuxolator/src/sys/sun4v/sun4v/tlb.c#2 delete

Differences ...

==== //depot/projects/linuxolator/src/sys/compat/linux/linux_getcwd.c#4 (text+ko) ====

@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.25 2006/10/22 11:52:11 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.27 2006/11/18 17:27:39 kib Exp $");
 
 #include "opt_compat.h"
 #include "opt_mac.h"
@@ -426,7 +426,7 @@
 
 #ifdef DEBUG
 	if (ldebug(getcwd))
-   	   	printf(ARGS(getcwd, "%p, %ld"), args->buf, (long)args->bufsize);
+		printf(ARGS(getcwd, "%p, %ld"), args->buf, (long)args->bufsize);
 #endif
 
 	len = args->bufsize;

==== //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#36 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.194 2006/11/15 10:01:06 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.197 2006/11/18 14:37:54 kib Exp $");
 
 #include "opt_compat.h"
 #include "opt_mac.h"
@@ -118,7 +118,7 @@
 	l_ulong		totalbig;
 	l_ulong		freebig;
 	l_uint		mem_unit;
-	char		_f[20-2*sizeof(l_long)-sizeof(l_int)];		/* Pads structure */
+	char		_f[20-2*sizeof(l_long)-sizeof(l_int)];	/* padding */
 };
 int
 linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
@@ -1413,6 +1413,11 @@
 		printf(ARGS(getpid, ""));
 #endif
 
+#ifdef DEBUG
+	if (ldebug(getpid))
+		printf(ARGS(getpid, ""));
+#endif
+
 	if (linux_use26(td)) {
    	   	em = em_find(td->td_proc, EMUL_UNLOCKED);
 		KASSERT(em != NULL, ("getpid: emuldata not found.\n"));
@@ -1449,6 +1454,11 @@
 		printf(ARGS(getppid, ""));
 #endif
 
+#ifdef DEBUG
+	if (ldebug(getppid))
+		printf(ARGS(getppid, ""));
+#endif
+
 	if (!linux_use26(td)) {
 	   	PROC_LOCK(td->td_proc);
 	   	td->td_retval[0] = td->td_proc->p_pptr->p_pid;
@@ -1500,6 +1510,11 @@
 		printf(ARGS(getgid, ""));
 #endif
 
+#ifdef DEBUG
+	if (ldebug(getgid))
+		printf(ARGS(getgid, ""));
+#endif
+
 	td->td_retval[0] = td->td_ucred->cr_rgid;
 	return (0);
 }
@@ -1512,6 +1527,11 @@
 		printf(ARGS(getuid, ""));
 #endif
 
+#ifdef DEBUG
+	if (ldebug(getuid))
+		printf(ARGS(getuid, ""));
+#endif
+
 	td->td_retval[0] = td->td_ucred->cr_ruid;
 	return (0);
 }

==== //depot/projects/linuxolator/src/sys/conf/files.sun4v#5 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: src/sys/conf/files.sun4v,v 1.4 2006/11/13 01:02:18 kmacy Exp $
+# $FreeBSD: src/sys/conf/files.sun4v,v 1.6 2006/11/18 07:24:56 kmacy Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -37,20 +37,18 @@
 libkern/ffsl.c			standard
 libkern/fls.c			standard
 libkern/flsl.c			standard
-sun4v/sun4v/autoconf.c	standard
+sparc64/sparc64/autoconf.c	standard
 sun4v/sun4v/bus_machdep.c	standard
-sun4v/sun4v/clock.c		standard
-sun4v/sun4v/counter.c	standard
-sun4v/sun4v/db_disasm.c	optional	ddb
+sparc64/sparc64/clock.c		standard
+sparc64/sparc64/counter.c	standard
+sparc64/sparc64/db_disasm.c	optional	ddb
 sun4v/sun4v/db_interface.c	optional	ddb
 sun4v/sun4v/db_trace.c	optional	ddb
 sun4v/sun4v/db_hwwatch.c	optional	ddb
 sun4v/sun4v/dump_machdep.c	standard
-sun4v/sun4v/elf_machdep.c	standard
+sparc64/sparc64/elf_machdep.c	standard
 sun4v/sun4v/exception.S	standard	no-obj
-sun4v/sun4v/eeprom.c	optional	eeprom ebus | eeprom fhc | \
-						eeprom sbus
-sun4v/sun4v/gdb_machdep.c	optional	gdb
+sparc64/sparc64/gdb_machdep.c	optional	gdb
 sun4v/sun4v/hv_pci.c	optional	pci
 sun4v/sun4v/trap_trace.S	optional	trap_tracing
 sparc64/pci/ofw_pci.c		optional	pci
@@ -63,27 +61,27 @@
 sun4v/sun4v/hvcons.c	standard	
 sun4v/sun4v/hcall.S	standard
 sun4v/sun4v/hviommu.c	standard
-sun4v/sun4v/identcpu.c	standard
-sun4v/sun4v/in_cksum.c	optional	inet
+sparc64/sparc64/identcpu.c	standard
+sparc64/sparc64/in_cksum.c	optional	inet
 sun4v/sun4v/interrupt.S	standard	no-obj
 sun4v/sun4v/intr_machdep.c	standard
 sun4v/sun4v/locore.S	standard	no-obj
 sun4v/sun4v/machdep.c	standard
-sun4v/sun4v/mem.c		optional	mem
+sparc64/sparc64/mem.c		optional	mem
 sun4v/sun4v/mp_exception.S	optional	smp
 sun4v/sun4v/mp_locore.S	optional	smp
 sun4v/sun4v/mp_machdep.c	optional	smp
 sun4v/sun4v/nexus.c		standard
 sun4v/sun4v/t1_copy.S	standard
-sun4v/sun4v/ofw_bus.c	standard
-sun4v/sun4v/ofw_machdep.c	standard
+sparc64/sparc64/ofw_bus.c	standard
+sparc64/sparc64/ofw_machdep.c	standard
 sun4v/sun4v/pmap.c		standard
-sun4v/sun4v/prof_machdep.c	optional	profiling-routine
-sun4v/sun4v/rwindow.c		standard
+sparc64/sparc64/prof_machdep.c	optional	profiling-routine
+sparc64/sparc64/rwindow.c		standard
 sun4v/sun4v/rtc.c		standard
 sun4v/sun4v/simdisk.c		optional	simulator
 sun4v/sun4v/support.S		standard
-sun4v/sun4v/sys_machdep.c	standard
+sparc64/sparc64/sys_machdep.c	standard
 sun4v/sun4v/swtch.S		standard
 sun4v/sun4v/tsb.c		standard
 sun4v/sun4v/tte.c		standard

==== //depot/projects/linuxolator/src/sys/dev/em/if_em.c#10 (text+ko) ====

@@ -31,7 +31,7 @@
 
 ***************************************************************************/
 
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.164 2006/11/15 20:04:56 jhb Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.165 2006/11/18 23:18:43 csjp Exp $*/
 
 #ifdef HAVE_KERNEL_OPTION_HEADERS
 #include "opt_device_polling.h"
@@ -248,7 +248,6 @@
 static void	em_update_link_status(struct adapter *);
 static int	em_get_buf(struct adapter *, int);
 static void	em_enable_vlans(struct adapter *);
-static void	em_disable_vlans(struct adapter *);
 static int	em_encap(struct adapter *, struct mbuf **);
 static void	em_smartspeed(struct adapter *);
 static int	em_82547_fifo_workaround(struct adapter *, int);
@@ -761,7 +760,7 @@
 		}
 
 		/* Send a copy of the frame to the BPF listener */
-		BPF_MTAP(ifp, m_head);
+		ETHER_BPF_MTAP(ifp, m_head);
 
 		/* Set timeout in case hardware has problems transmitting. */
 		adapter->watchdog_timer = EM_TX_TIMEOUT;
@@ -1507,45 +1506,6 @@
 	}
 
 	/*
-	 * When operating in promiscuous mode, hardware stripping of the
-	 * VLAN tag on receive is disabled.  This should not prevent us
-	 * from doing hardware insertion of the VLAN tag here as that
-	 * is controlled by the dma descriptor flags and not the receive
-	 * tag strip setting.  Unfortunatly this hardware switches the
-	 * VLAN encapsulation type from 802.1q to ISL when stripping om
-	 * receive is disabled.  This means we have to add the vlan
-	 * encapsulation here in the driver, since it will have come down
-	 * from the VLAN layer with a tag instead of a VLAN header.
-	 */
-	if ((m_head->m_flags & M_VLANTAG) && adapter->em_insert_vlan_header) {
-		struct ether_vlan_header *evl;
-		struct ether_header eh;
-
-		m_head = m_pullup(m_head, sizeof(eh));
-		if (m_head == NULL) {
-			*m_headp = NULL;
-			return (ENOBUFS);
-		}
-		eh = *mtod(m_head, struct ether_header *);
-		M_PREPEND(m_head, sizeof(*evl), M_DONTWAIT);
-		if (m_head == NULL) {
-			*m_headp = NULL;
-			return (ENOBUFS);
-		}
-		m_head = m_pullup(m_head, sizeof(*evl));
-		if (m_head == NULL) {
-			*m_headp = NULL;
-			return (ENOBUFS);
-		}
-		evl = mtod(m_head, struct ether_vlan_header *);
-		bcopy(&eh, evl, sizeof(*evl));
-		evl->evl_proto = evl->evl_encap_proto;
-		evl->evl_encap_proto = htons(ETHERTYPE_VLAN);
-		evl->evl_tag = htons(m_head->m_pkthdr.ether_vtag);
-		*m_headp = m_head;
-	}
-
-	/*
 	 * TSO workaround:
 	 *  If an mbuf contains only the IP and TCP header we have
 	 *  to pull 4 bytes of data into it.
@@ -1915,29 +1875,16 @@
 	if (ifp->if_flags & IFF_PROMISC) {
 		reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 		E1000_WRITE_REG(&adapter->hw, RCTL, reg_rctl);
-		/*
-		 * Disable VLAN stripping in promiscous mode.
-		 * This enables bridging of vlan tagged frames to occur
-		 * and also allows vlan tags to be seen in tcpdump.
-		 * XXX: This is a bit bogus as tcpdump may be used
-		 * w/o promisc mode as well.
-		 */
-		if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
-			em_disable_vlans(adapter);
-		adapter->em_insert_vlan_header = 1;
 	} else if (ifp->if_flags & IFF_ALLMULTI) {
 		reg_rctl |= E1000_RCTL_MPE;
 		reg_rctl &= ~E1000_RCTL_UPE;
 		E1000_WRITE_REG(&adapter->hw, RCTL, reg_rctl);
-		adapter->em_insert_vlan_header = 0;
-	} else
-		adapter->em_insert_vlan_header = 0;
+	}
 }
 
 static void
 em_disable_promisc(struct adapter *adapter)
 {
-	struct ifnet	*ifp = adapter->ifp;
 	uint32_t	reg_rctl;
 
 	reg_rctl = E1000_READ_REG(&adapter->hw, RCTL);
@@ -1945,10 +1892,6 @@
 	reg_rctl &=  (~E1000_RCTL_UPE);
 	reg_rctl &=  (~E1000_RCTL_MPE);
 	E1000_WRITE_REG(&adapter->hw, RCTL, reg_rctl);
-
-	if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
-		em_enable_vlans(adapter);
-	adapter->em_insert_vlan_header = 0;
 }
 
 
@@ -2429,7 +2372,7 @@
 	 */
 	ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
 	ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU;
-	ifp->if_capenable |= IFCAP_VLAN_MTU;
+	ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU;
 
 #ifdef DEVICE_POLLING
 	ifp->if_capabilities |= IFCAP_POLLING;
@@ -3816,16 +3759,6 @@
 }
 
 static void
-em_disable_vlans(struct adapter *adapter)
-{
-	uint32_t ctrl;
-
-	ctrl = E1000_READ_REG(&adapter->hw, CTRL);
-	ctrl &= ~E1000_CTRL_VME;
-	E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
-}
-
-static void
 em_enable_intr(struct adapter *adapter)
 {
 	E1000_WRITE_REG(&adapter->hw, IMS, (IMS_ENABLE_MASK));

==== //depot/projects/linuxolator/src/sys/dev/isp/isp.c#5 (text+ko) ====

@@ -43,7 +43,7 @@
 #endif
 #ifdef	__FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.131 2006/11/16 00:39:56 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.132 2006/11/18 03:53:16 mjacob Exp $");
 #include <dev/isp/isp_freebsd.h>
 #endif
 #ifdef	__OpenBSD__
@@ -114,9 +114,9 @@
 static void isp_fibre_init(ispsoftc_t *);
 static void isp_fibre_init_2400(ispsoftc_t *);
 static void isp_mark_portdb(ispsoftc_t *, int);
-static void isp_plogx_24xx(ispsoftc_t *, uint16_t, uint32_t, int *);
+static int isp_plogx(ispsoftc_t *, uint16_t, uint32_t, int, int);
 static int isp_port_login(ispsoftc_t *, uint16_t, uint32_t);
-static void isp_port_logout(ispsoftc_t *, uint16_t, uint32_t);
+static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t);
 static int isp_getpdb(ispsoftc_t *, uint16_t, isp_pdb_t *, int);
 static uint64_t isp_get_portname(ispsoftc_t *, int, int);
 static int isp_fclink_test(ispsoftc_t *, int);
@@ -2083,36 +2083,47 @@
 
 /*
  * Perform an IOCB PLOGI or LOGO via EXECUTE IOCB A64 for 24XX cards
+ * or via FABRIC LOGIN/FABRIC LOGOUT for other cards.
  */
-static void
-isp_plogx_24xx(ispsoftc_t *isp, uint16_t handle, uint32_t portid, int *log_ret)
+static int
+isp_plogx(ispsoftc_t *isp, uint16_t handle, uint32_t portid, int flags, int gs)
 {
 	mbreg_t mbs;
 	uint8_t q[QENTRY_LEN];
-	isp_plogx_t *plp = (isp_plogx_t *) q;
-	uint8_t *scp = FCPARAM(isp)->isp_scratch;
+	isp_plogx_t *plp;
+	uint8_t *scp;
 	uint32_t sst, parm1;
-	int junk;
+	int rval;
+
+	if (!IS_24XX(isp)) {
+		int action = flags & PLOGX_FLG_CMD_MASK;
+		if (action == PLOGX_FLG_CMD_PLOGI) {
+			return (isp_port_login(isp, handle, portid));
+		} else if (action == PLOGX_FLG_CMD_LOGO) {
+			return (isp_port_logout(isp, handle, portid));
+		} else {
+			return (MBOX_INVALID_COMMAND);
+		}
+	}
 
 	MEMZERO(q, QENTRY_LEN);
+	plp = (isp_plogx_t *) q;
 	plp->plogx_header.rqs_entry_count = 1;
 	plp->plogx_header.rqs_entry_type = RQSTYPE_LOGIN;
 	plp->plogx_handle = 0xffffffff;
 	plp->plogx_nphdl = handle;
 	plp->plogx_portlo = portid;
 	plp->plogx_rspsz_porthi = (portid >> 16) & 0xff;
-	if (log_ret) {
-		plp->plogx_flags = *log_ret;
-	} else {
-		log_ret = &junk;
-	}
+	plp->plogx_flags = flags;
 
 	if (isp->isp_dblev & ISP_LOGDEBUG1) {
 		isp_print_bytes(isp, "IOCB LOGX", QENTRY_LEN, plp);
 	}
-	/*
-	 * XXX: We're going to assume somebody has acquired SCRATCH for us
-	 */
+
+	if (gs == 0) {
+		FC_SCRATCH_ACQUIRE(isp);
+	}
+	scp = FCPARAM(isp)->isp_scratch;
 	isp_put_plogx(isp, plp, (isp_plogx_t *) scp);
 
 
@@ -2128,7 +2139,8 @@
 	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN);
 	isp_mboxcmd(isp, &mbs);
 	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
-		*log_ret = mbs.param[0];
+		rval = mbs.param[0];
+		goto out;
 	}
 	MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN);
 	scp += QENTRY_LEN;
@@ -2138,19 +2150,19 @@
 	}
 
 	if (plp->plogx_status == PLOGX_STATUS_OK) {
-		*log_ret = 0;
-		return;
+		rval = 0;
+		goto out;
 	} else if (plp->plogx_status != PLOGX_STATUS_IOCBERR) {
 		isp_prt(isp, ISP_LOGWARN, "status 0x%x on port login IOCB",
 		    plp->plogx_status);
-		*log_ret = -1;
-		return;
+		rval = -1;
+		goto out;
 	}
 
 	sst = plp->plogx_ioparm[0].lo16 | (plp->plogx_ioparm[0].hi16 << 16);
 	parm1 = plp->plogx_ioparm[1].lo16 | (plp->plogx_ioparm[1].hi16 << 16);
 
-	*log_ret = -1;
+	rval = -1;
 
 	switch (sst) {
 	case PLOGX_IOCBERR_NOLINK:
@@ -2166,8 +2178,8 @@
 	case PLOGX_IOCBERR_FAILED:
 		isp_prt(isp, ISP_LOGERR,
 		    "PLOGX(0x%x) of Port 0x%06x failed: reason 0x%x (last LOGIN"
-		    " state 0x%x)", *log_ret, portid,
-		    parm1 & 0xff, (parm1 >> 8) & 0xff);
+		    " state 0x%x)", flags, portid, parm1 & 0xff,
+		    (parm1 >> 8) & 0xff);
 		break;
 	case PLOGX_IOCBERR_NOFABRIC:
 		isp_prt(isp, ISP_LOGERR, "PLOGX failed- no fabric");
@@ -2179,7 +2191,7 @@
 		isp_prt(isp, ISP_LOGERR,
 		    "PLOGX failed- not logged in (last LOGIN state 0x%x)",
 		    parm1);
-		*log_ret = MBOX_NOT_LOGGED_IN;
+		rval = MBOX_NOT_LOGGED_IN;
 		break;
 	case PLOGX_IOCBERR_REJECT:
 		isp_prt(isp, ISP_LOGERR, "PLOGX failed: LS_RJT = 0x%x", parm1);
@@ -2195,13 +2207,13 @@
 		isp_prt(isp, ISP_LOGDEBUG0,
 		    "portid 0x%x already logged in with N-port handle 0x%x",
 		    portid, parm1);
-		*log_ret = MBOX_PORT_ID_USED | (handle << 16);
+		rval = MBOX_PORT_ID_USED | (handle << 16);
 		break;
 	case PLOGX_IOCBERR_HNDLUSED:
 		isp_prt(isp, ISP_LOGDEBUG0,
 		    "N-port handle 0x%x already used for portid 0x%x",
 		    handle, parm1);
-		*log_ret = MBOX_LOOP_ID_USED;
+		rval = MBOX_LOOP_ID_USED;
 		break;
 	case PLOGX_IOCBERR_NOHANDLE:
 		isp_prt(isp, ISP_LOGERR, "PLOGX failed- no handle allocated");
@@ -2210,11 +2222,16 @@
 		isp_prt(isp, ISP_LOGERR, "PLOGX failed- no FLOGI_ACC");
 		break;
 	default:
-		isp_prt(isp, ISP_LOGERR, "status %x from %s", plp->plogx_status,
-		    (*log_ret)? "PLOGI" : "LOGO");
-		*log_ret = -1;
+		isp_prt(isp, ISP_LOGERR, "status %x from %x", plp->plogx_status,
+		    flags);
+		rval = -1;
 		break;
 	}
+out:
+	if (gs == 0) {
+		FC_SCRATCH_RELEASE(isp);
+	}
+	return (rval);
 }
 
 static int
@@ -2239,14 +2256,14 @@
 	switch (mbs.param[0]) {
 	case MBOX_PORT_ID_USED:
 		isp_prt(isp, ISP_LOGDEBUG0,
-		    "isp_port_login: portid 0x%06x already logged in as %u",
+		    "isp_plogi_old: portid 0x%06x already logged in as %u",
 		    portid, mbs.param[1]);
 		return (MBOX_PORT_ID_USED | (mbs.param[1] << 16));
 		break;
 
 	case MBOX_LOOP_ID_USED:
 		isp_prt(isp, ISP_LOGDEBUG0,
-		    "isp_port_login: handle %u in use for port id 0x%02xXXXX",
+		    "isp_plogi_old: handle %u in use for port id 0x%02xXXXX",
 		    handle, mbs.param[1] & 0xff);
 		return (MBOX_LOOP_ID_USED);
 
@@ -2255,24 +2272,24 @@
 
 	case MBOX_COMMAND_ERROR:
 		isp_prt(isp, ISP_LOGINFO,
-		    "isp_port_login: error 0x%x in PLOGI to port 0x%06x",
+		    "isp_plogi_old: error 0x%x in PLOGI to port 0x%06x",
 		    mbs.param[1], portid);
 		return (MBOX_COMMAND_ERROR);
 
 	case MBOX_ALL_IDS_USED:
 		isp_prt(isp, ISP_LOGINFO,
-		    "isp_port_login: all IDs used for fabric login");
+		    "isp_plogi_old: all IDs used for fabric login");
 		return (MBOX_ALL_IDS_USED);
 
 	default:
 		isp_prt(isp, ISP_LOGINFO,
-		    "isp_port_login: error 0x%x on port login of 0x%06x at 0x%0x",
+		    "isp_plogi_old: error 0x%x on port login of 0x%06x at 0x%0x",
 		    mbs.param[0], portid, handle);
 		return (mbs.param[0]);
 	}
 }
 
-static void
+static int
 isp_port_logout(ispsoftc_t *isp, uint16_t handle, uint32_t portid)
 {
 	mbreg_t mbs;
@@ -2288,6 +2305,7 @@
 	mbs.logval = MBLOGNONE;
 	mbs.timeout = 100000;
 	isp_mboxcmd(isp, &mbs);
+	return (mbs.param[0] == MBOX_COMMAND_COMPLETE? 0 : mbs.param[0]);
 }
 
 static int
@@ -2725,19 +2743,10 @@
 			lp->state = FC_PORTDB_STATE_NIL;
 			isp_async(isp, ISPASYNC_DEV_GONE, lp);
 			if (lp->autologin == 0) {
-				if (IS_24XX(isp)) {
-					int action =
-					    PLOGX_FLG_CMD_LOGO |
-					    PLOGX_FLG_IMPLICIT |
-					    PLOGX_FLG_FREE_NPHDL;
-					FC_SCRATCH_ACQUIRE(isp);
-					isp_plogx_24xx(isp, lp->handle,
-					    lp->portid, &action);
-					FC_SCRATCH_RELEASE(isp);
-				} else {
-					isp_port_logout(isp, lp->handle,
-					    lp->portid);
-				}
+				(void) isp_plogx(isp, lp->handle, lp->portid,
+				    PLOGX_FLG_CMD_LOGO |
+				    PLOGX_FLG_IMPLICIT |
+				    PLOGX_FLG_FREE_NPHDL, 0);
 			} else {
 				lp->autologin = 0;
 			}
@@ -2987,7 +2996,7 @@
 				lp->new_roles = tmp.roles;
 				lp->state = FC_PORTDB_STATE_PENDING_VALID;
 				isp_prt(isp, ISP_LOGSANCFG,
-				    "Loop Port 0x%06x at 0x%x Pending Valid",
+				    "Loop Port 0x%02x at 0x%x Pending Valid",
 				    tmp.portid, tmp.handle);
 				break;
 			}
@@ -3686,7 +3695,7 @@
 static int
 isp_login_device(ispsoftc_t *isp, uint32_t portid, isp_pdb_t *p, uint16_t *ohp)
 {
-	int lim, i, r, logval;
+	int lim, i, r;
 	uint16_t handle;
 
 	if (IS_24XX(isp)) {
@@ -3704,14 +3713,8 @@
 		 */
 		r = isp_getpdb(isp, handle, p, 0);
 		if (r == 0 && p->portid != portid) {
-			if (IS_24XX(isp)) {
-				logval =
-				    PLOGX_FLG_CMD_LOGO |
-				    PLOGX_FLG_IMPLICIT;
-				isp_plogx_24xx(isp, handle, portid, &logval);
-			} else {
-				isp_port_logout(isp, handle, portid);
-			}
+			(void) isp_plogx(isp, handle,portid,
+			    PLOGX_FLG_CMD_LOGO | PLOGX_FLG_IMPLICIT, 1);
 		} else if (r == 0) {
 			break;
 		}
@@ -3721,22 +3724,17 @@
 		/*
 		 * Now try and log into the device
 		 */
-		if (IS_24XX(isp)) {
-			logval = PLOGX_FLG_CMD_PLOGI;
-			isp_plogx_24xx(isp, handle, portid, &logval);
-		} else {
-			logval = isp_port_login(isp, handle, portid);
-		}
+		r = isp_plogx(isp, handle, portid, PLOGX_FLG_CMD_PLOGI, 1);
 		if (FCPARAM(isp)->isp_loopstate != LOOP_SCANNING_FABRIC) {
 			return (-1);
 		}
-		if (logval == 0) {
+		if (r == 0) {
 			*ohp = handle;
 			break;
-		} else if ((logval & 0xffff) == MBOX_PORT_ID_USED) {
-			handle = logval >> 16;
+		} else if ((r & 0xffff) == MBOX_PORT_ID_USED) {
+			handle = r >> 16;
 			break;
-		} else if (logval != MBOX_LOOP_ID_USED) {
+		} else if (r != MBOX_LOOP_ID_USED) {
 			i = lim;
 			break;
 		} else {
@@ -3929,6 +3927,9 @@
 		}
 	} else {
 		handle += 1;
+		if (handle == NPH_MGT_ID) {
+			handle++;
+		}
 		if (handle >= FL_ID && handle <= SNS_ID) {
 			handle = SNS_ID+1;
 		} else if (IS_24XX(isp)) {
@@ -4423,6 +4424,11 @@
 		isp_mboxcmd(isp, arg);
 		return(0);
 
+	case ISPCTL_PLOGX:
+	{
+		isp_plcmd_t *p = arg;
+		return (isp_plogx(isp, p->handle, p->portid, p->flags, 0));
+	}
 #ifdef	ISP_TARGET_MODE
 	case ISPCTL_TOGGLE_TMODE:
 	{

==== //depot/projects/linuxolator/src/sys/dev/isp/isp_library.c#5 (text) ====

@@ -32,7 +32,7 @@
 #endif
 #ifdef	__FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_library.c,v 1.9 2006/11/16 00:39:56 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_library.c,v 1.10 2006/11/18 03:53:16 mjacob Exp $");
 #include <dev/isp/isp_freebsd.h>
 #endif
 #ifdef	__OpenBSD__
@@ -1038,6 +1038,36 @@
 }
 
 void
+isp_get_ms(ispsoftc_t *isp, isp_ms_t *src, isp_ms_t *dst)
+{
+	int i;
+
+	isp_get_hdr(isp, &src->ms_header, &dst->ms_header);
+	ISP_IOXGET_32(isp, &src->ms_handle, dst->ms_handle);
+	ISP_IOXGET_16(isp, &src->ms_nphdl, dst->ms_nphdl);
+	ISP_IOXGET_16(isp, &src->ms_status, dst->ms_status);
+	ISP_IOXGET_16(isp, &src->ms_flags, dst->ms_flags);
+	ISP_IOXGET_16(isp, &src->ms_reserved1, dst->ms_reserved1);
+	ISP_IOXGET_16(isp, &src->ms_time, dst->ms_time);
+	ISP_IOXGET_16(isp, &src->ms_cmd_cnt, dst->ms_cmd_cnt);
+	ISP_IOXGET_16(isp, &src->ms_tot_cnt, dst->ms_tot_cnt);
+	ISP_IOXGET_8(isp, &src->ms_type, dst->ms_type);
+	ISP_IOXGET_8(isp, &src->ms_r_ctl, dst->ms_r_ctl);
+	ISP_IOXGET_16(isp, &src->ms_rxid, dst->ms_rxid);
+	ISP_IOXGET_16(isp, &src->ms_reserved2, dst->ms_reserved2);
+	ISP_IOXGET_32(isp, &src->ms_rsp_bcnt, dst->ms_rsp_bcnt);
+	ISP_IOXGET_32(isp, &src->ms_cmd_bcnt, dst->ms_cmd_bcnt);
+	for (i = 0; i < 2; i++) {
+		ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_base,
+		    dst->ms_dataseg[i].ds_base);
+		ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_basehi,
+		    dst->ms_dataseg[i].ds_basehi);
+		ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_count,
+		    dst->ms_dataseg[i].ds_count);
+	}
+}
+
+void
 isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *src, isp_ct_pt_t *dst)
 {
 	int i;
@@ -1067,6 +1097,36 @@
 	}
 }
 
+void
+isp_put_ms(ispsoftc_t *isp, isp_ms_t *src, isp_ms_t *dst)
+{
+	int i;
+
+	isp_put_hdr(isp, &src->ms_header, &dst->ms_header);
+	ISP_IOXPUT_32(isp, src->ms_handle, &dst->ms_handle);
+	ISP_IOXPUT_16(isp, src->ms_nphdl, &dst->ms_nphdl);
+	ISP_IOXPUT_16(isp, src->ms_status, &dst->ms_status);
+	ISP_IOXPUT_16(isp, src->ms_flags, &dst->ms_flags);
+	ISP_IOXPUT_16(isp, src->ms_reserved1, &dst->ms_reserved1);
+	ISP_IOXPUT_16(isp, src->ms_time, &dst->ms_time);
+	ISP_IOXPUT_16(isp, src->ms_cmd_cnt, &dst->ms_cmd_cnt);
+	ISP_IOXPUT_16(isp, src->ms_tot_cnt, &dst->ms_tot_cnt);
+	ISP_IOXPUT_8(isp, src->ms_type, &dst->ms_type);
+	ISP_IOXPUT_8(isp, src->ms_r_ctl, &dst->ms_r_ctl);
+	ISP_IOXPUT_16(isp, src->ms_rxid, &dst->ms_rxid);
+	ISP_IOXPUT_16(isp, src->ms_reserved2, &dst->ms_reserved2);
+	ISP_IOXPUT_32(isp, src->ms_rsp_bcnt, &dst->ms_rsp_bcnt);
+	ISP_IOXPUT_32(isp, src->ms_cmd_bcnt, &dst->ms_cmd_bcnt);
+	for (i = 0; i < 2; i++) {
+		ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_base,
+		    &dst->ms_dataseg[i].ds_base);
+		ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_basehi,
+		    &dst->ms_dataseg[i].ds_basehi);
+		ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_count,
+		    &dst->ms_dataseg[i].ds_count);
+	}
+}
+
 /*
  * Generic SNS request - not particularly useful since the per-command data
  * isn't always 16 bit words.

==== //depot/projects/linuxolator/src/sys/dev/isp/isp_library.h#4 (text) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/isp_library.h,v 1.4 2006/11/14 08:45:48 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/isp_library.h,v 1.5 2006/11/18 03:53:16 mjacob Exp $ */
 /*-
  * Qlogic Host Adapter Library Functions
  *
@@ -91,8 +91,12 @@
 extern void
 isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
 extern void
+isp_get_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *);
+extern void
 isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
 extern void
+isp_put_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *);
+extern void
 isp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *);
 extern void
 isp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *,

==== //depot/projects/linuxolator/src/sys/dev/isp/isp_pci.c#5 (text+ko) ====

@@ -30,7 +30,7 @@
  * FreeBSD Version.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.126 2006/11/17 17:32:45 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.127 2006/11/18 03:53:16 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1057,7 +1057,6 @@
 		cmd &= ~PCIM_CMD_INTX_DISABLE;
 	}
 
-#ifdef	WE_KNEW_WHAT_WE_WERE_DOING
 	if (IS_24XX(isp)) {
 		int reg;
 
@@ -1089,11 +1088,6 @@
 			pci_write_config(dev, reg, 2, pectl);
 		}
 	}
-#else
-	if (IS_24XX(isp)) {
-		cmd &= ~PCIM_CMD_INTX_DISABLE;
-	}
-#endif
 
 	pci_write_config(dev, PCIR_COMMAND, cmd, 2);
 

==== //depot/projects/linuxolator/src/sys/dev/isp/isp_stds.h#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/isp_stds.h,v 1.2 2006/11/14 08:45:48 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/isp_stds.h,v 1.3 2006/11/18 03:53:16 mjacob Exp $ */
 /*-
  * Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
  *

==== //depot/projects/linuxolator/src/sys/dev/isp/ispmbox.h#4 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/ispmbox.h,v 1.54 2006/11/16 00:39:56 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/ispmbox.h,v 1.55 2006/11/18 03:53:16 mjacob Exp $ */
 /*-
  * Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
  *
@@ -329,6 +329,7 @@
 #define	RQSTYPE_IP_RECV		0x23
 #define	RQSTYPE_IP_RECV_CONT	0x24
 #define	RQSTYPE_CT_PASSTHRU	0x29
+#define	RQSTYPE_MS_PASSTHRU	0x29
 #define	RQSTYPE_ABORT_IO	0x33
 #define	RQSTYPE_T6RQS		0x48
 #define	RQSTYPE_LOGIN		0x52
@@ -631,6 +632,29 @@
 	ispds64_t	ctp_dataseg[2];
 } isp_ct_pt_t;
 
+/*
+ * MS Passthru IOCB
+ */
+typedef struct {
+	isphdr_t	ms_header;
+	uint32_t	ms_handle;
+	uint16_t	ms_nphdl;	/* XXX: Note, this is for 2K Logins only */
+	uint16_t	ms_status;
+	uint16_t	ms_flags;
+	uint16_t	ms_reserved1;	/* low 8 bits */
+	uint16_t	ms_time;
+	uint16_t	ms_cmd_cnt;	/* Command DSD count */;
+	uint16_t	ms_tot_cnt;	/* Total DSD Count */
+	uint8_t		ms_type;	/* MS type */
+	uint8_t		ms_r_ctl;	/* R_CTL */
+	uint16_t	ms_rxid;	/* RX_ID */
+	uint16_t	ms_reserved2;
+	uint32_t	ms_handle2;
+	uint32_t	ms_rsp_bcnt;	/* Response byte count */
+	uint32_t	ms_cmd_bcnt;	/* Command byte count */
+	ispds64_t	ms_dataseg[2];
+} isp_ms_t;
+
 /* 
  * Completion Status Codes.
  */
@@ -1108,6 +1132,17 @@
 } isp_pdb_t;
 
 /*
+ * Genericized Port Login/Logout software structure
+ */
+typedef struct {
+	uint16_t	handle;
+	uint32_t
+		flags	: 8,
+		portid	: 24;
+} isp_plcmd_t;
+/* the flags to use are those for PLOGX_FLG_* below */
+
+/*
  * ISP24XX- Login/Logout Port IOCB
  */
 typedef struct {

==== //depot/projects/linuxolator/src/sys/dev/isp/ispvar.h#4 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/ispvar.h,v 1.79 2006/11/14 08:45:48 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/ispvar.h,v 1.80 2006/11/18 03:53:16 mjacob Exp $ */
 /*-
  * Soft Definitions for for Qlogic ISP SCSI adapters.
  *
@@ -791,7 +791,8 @@
 	ISPCTL_GET_PORTNAME,		/* get portname from an N-port handle */
 	ISPCTL_RUN_MBOXCMD,		/* run a mailbox command */
 	ISPCTL_TOGGLE_TMODE,		/* toggle target mode */
-	ISPCTL_GET_PDB			/* get a single port database entry */
+	ISPCTL_GET_PDB,			/* get a single port database entry */
+	ISPCTL_PLOGX			/* do a port login/logout */
 } ispctl_t;
 int isp_control(ispsoftc_t *, ispctl_t, void *);
 

==== //depot/projects/linuxolator/src/sys/dev/mfi/mfi.c#7 (text) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.22 2006/11/14 16:48:00 ambrisko Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.23 2006/11/18 07:33:53 scottl Exp $");
 
 #include "opt_mfi.h"
 
@@ -57,7 +57,6 @@
 static int	mfi_alloc_commands(struct mfi_softc *);
 static void	mfi_release_command(struct mfi_command *cm);
 static int	mfi_comms_init(struct mfi_softc *);
-static int	mfi_polled_command(struct mfi_softc *, struct mfi_command *);
 static int	mfi_wait_command(struct mfi_softc *, struct mfi_command *);
 static int	mfi_get_controller_info(struct mfi_softc *);
 static int	mfi_get_log_state(struct mfi_softc *,
@@ -91,7 +90,7 @@
 SYSCTL_INT(_hw_mfi, OID_AUTO, event_locale, CTLFLAG_RW, &mfi_event_locale,
             0, "event message locale");
 
-static int	mfi_event_class =  MFI_EVT_CLASS_DEBUG;
+static int	mfi_event_class = 10;
 TUNABLE_INT("hw.mfi.event_class", &mfi_event_class);
 SYSCTL_INT(_hw_mfi, OID_AUTO, event_class, CTLFLAG_RW, &mfi_event_class,
           0, "event message class");
@@ -546,8 +545,10 @@
 	init->header.cmd = MFI_CMD_INIT;
 	init->header.data_len = sizeof(struct mfi_init_qinfo);
 	init->qinfo_new_addr_lo = cm->cm_frame_busaddr + MFI_FRAME_SIZE;
+	cm->cm_data = NULL;
+	cm->cm_flags = MFI_CMD_POLLED;
 
-	if ((error = mfi_polled_command(sc, cm)) != 0) {
+	if ((error = mfi_mapcmd(sc, cm)) != 0) {
 		device_printf(sc->mfi_dev, "failed to send init command\n");
 		mtx_unlock(&sc->mfi_io_lock);
 		return (error);
@@ -574,15 +575,6 @@
 	cm->cm_flags = MFI_CMD_DATAIN | MFI_CMD_POLLED;
 
 	if ((error = mfi_mapcmd(sc, cm)) != 0) {
-		device_printf(sc->mfi_dev, "Controller info buffer map failed\n");
-		free(ci, M_MFIBUF);
-		mfi_release_command(cm);
-		mtx_unlock(&sc->mfi_io_lock);
-		return (error);
-	}
-
-	/* It's ok if this fails, just use default info instead */
-	if ((error = mfi_polled_command(sc, cm)) != 0) {
 		device_printf(sc->mfi_dev, "Failed to get controller info\n");
 		sc->mfi_max_io = (sc->mfi_max_sge - 1) * PAGE_SIZE /
 		    MFI_SECTOR_LEN;
@@ -620,11 +612,6 @@
 	cm->cm_flags = MFI_CMD_DATAIN | MFI_CMD_POLLED;
 
 	if ((error = mfi_mapcmd(sc, cm)) != 0) {
-		device_printf(sc->mfi_dev, "Log state buffer map failed\n");
-		goto out;
-	}
-
-	if ((error = mfi_polled_command(sc, cm)) != 0) {
 		device_printf(sc->mfi_dev, "Failed to get log state\n");
 		goto out;

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list