PERFORCE change 110082 for review

Matt Jacob mjacob at FreeBSD.org
Thu Nov 16 00:30:00 UTC 2006


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

Change 110082 by mjacob at newisp on 2006/11/16 00:29:15

	IFC

Affected files ...

.. //depot/projects/newisp/amd64/amd64/db_trace.c#3 integrate
.. //depot/projects/newisp/amd64/amd64/machdep.c#7 integrate
.. //depot/projects/newisp/amd64/amd64/msi.c#2 integrate
.. //depot/projects/newisp/amd64/include/reg.h#2 integrate
.. //depot/projects/newisp/compat/linux/linux_emul.c#6 integrate
.. //depot/projects/newisp/compat/linux/linux_misc.c#8 integrate
.. //depot/projects/newisp/conf/NOTES#14 integrate
.. //depot/projects/newisp/conf/files#13 integrate
.. //depot/projects/newisp/conf/files.pc98#4 integrate
.. //depot/projects/newisp/dev/bce/if_bce.c#8 integrate
.. //depot/projects/newisp/dev/em/if_em.c#13 integrate
.. //depot/projects/newisp/dev/em/if_em.h#7 integrate
.. //depot/projects/newisp/dev/fxp/if_fxp.c#4 integrate
.. //depot/projects/newisp/dev/isp/isp.c#36 integrate
.. //depot/projects/newisp/dev/isp/isp_freebsd.c#28 integrate
.. //depot/projects/newisp/dev/isp/isp_freebsd.h#18 integrate
.. //depot/projects/newisp/dev/isp/isp_library.c#19 integrate
.. //depot/projects/newisp/dev/isp/isp_library.h#12 integrate
.. //depot/projects/newisp/dev/isp/isp_pci.c#19 integrate
.. //depot/projects/newisp/dev/isp/ispvar.h#16 integrate
.. //depot/projects/newisp/dev/mfi/mfi.c#8 integrate
.. //depot/projects/newisp/dev/mfi/mfi_ioctl.h#2 integrate
.. //depot/projects/newisp/dev/mfi/mfi_linux.c#2 integrate
.. //depot/projects/newisp/dev/mpt/mpt.c#3 integrate
.. //depot/projects/newisp/dev/mpt/mpt.h#3 integrate
.. //depot/projects/newisp/dev/mpt/mpt_cam.c#10 integrate
.. //depot/projects/newisp/dev/mpt/mpt_pci.c#4 integrate
.. //depot/projects/newisp/dev/pci/pcivar.h#5 integrate
.. //depot/projects/newisp/dev/usb/uark.c#1 branch
.. //depot/projects/newisp/dev/usb/usbdevs#5 integrate
.. //depot/projects/newisp/i386/i386/db_trace.c#3 integrate
.. //depot/projects/newisp/i386/i386/machdep.c#6 integrate
.. //depot/projects/newisp/i386/i386/msi.c#2 integrate
.. //depot/projects/newisp/i386/include/reg.h#2 integrate
.. //depot/projects/newisp/kern/kern_synch.c#3 integrate
.. //depot/projects/newisp/kern/sched_4bsd.c#4 integrate
.. //depot/projects/newisp/modules/Makefile#5 integrate
.. //depot/projects/newisp/modules/uark/Makefile#1 branch
.. //depot/projects/newisp/sun4v/include/asmacros.h#2 integrate
.. //depot/projects/newisp/sun4v/include/tte_hash.h#2 integrate
.. //depot/projects/newisp/sun4v/sun4v/exception.S#3 integrate
.. //depot/projects/newisp/sun4v/sun4v/interrupt.S#3 integrate
.. //depot/projects/newisp/sun4v/sun4v/tte_hash.c#2 integrate
.. //depot/projects/newisp/sys/elf_common.h#3 integrate
.. //depot/projects/newisp/sys/lock_profile.h#2 integrate
.. //depot/projects/newisp/sys/mbuf.h#7 integrate

Differences ...

==== //depot/projects/newisp/amd64/amd64/db_trace.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.76 2006/10/20 09:44:20 bde Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.77 2006/11/15 19:53:47 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -202,8 +202,8 @@
 
 static char * watchtype_str(int type);
 int  amd64_set_watch(int watchnum, unsigned long watchaddr, int size,
-		    int access, struct dbreg * d);
-int  amd64_clr_watch(int watchnum, struct dbreg * d);
+		    int access, struct dbreg *d);
+int  amd64_clr_watch(int watchnum, struct dbreg *d);
 
 /*
  * Figure out how many arguments were passed into the frame at "fp".
@@ -536,11 +536,11 @@
 	unsigned long watchaddr;
 	int size;
 	int access;
-	struct dbreg * d;
+	struct dbreg *d;
 {
 	int i;
 	unsigned int mask;
-	
+
 	if (watchnum == -1) {
 		for (i = 0, mask = 0x3; i < 4; i++, mask <<= 2)
 			if ((d->dr[7] & mask) == 0)
@@ -550,7 +550,7 @@
 		else
 			return (-1);
 	}
-	
+
 	switch (access) {
 	case DBREG_DR7_EXEC:
 		size = 1; /* size must be 1 for an execution breakpoint */
@@ -558,9 +558,10 @@
 	case DBREG_DR7_WRONLY:
 	case DBREG_DR7_RDWR:
 		break;
-	default : return (-1);
+	default:
+		return (-1);
 	}
-	
+
 	/*
 	 * we can watch a 1, 2, or 4 byte sized location
 	 */
@@ -577,7 +578,7 @@
 	d->dr[7] &= ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16)));
 
 	/* set drN register to the address, N=watchnum */
-	DBREG_DRX(d,watchnum) = watchaddr;
+	DBREG_DRX(d, watchnum) = watchaddr;
 
 	/* enable the watchpoint */
 	d->dr[7] |= (0x2 << (watchnum*2)) | (mask << (watchnum*4+16));
@@ -589,15 +590,15 @@
 int
 amd64_clr_watch(watchnum, d)
 	int watchnum;
-	struct dbreg * d;
+	struct dbreg *d;
 {
 
 	if (watchnum < 0 || watchnum >= 4)
 		return (-1);
-	
+
 	d->dr[7] = d->dr[7] & ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16)));
-	DBREG_DRX(d,watchnum) = 0;
-	
+	DBREG_DRX(d, watchnum) = 0;
+
 	return (0);
 }
 
@@ -607,22 +608,21 @@
 	db_expr_t addr;
 	db_expr_t size;
 {
-	int avail, wsize;
-	int i;
 	struct dbreg d;
-	
+	int avail, i, wsize;
+
 	fill_dbregs(NULL, &d);
-	
+
 	avail = 0;
-	for(i=0; i<4; i++) {
+	for(i = 0; i < 4; i++) {
 		if ((d.dr[7] & (3 << (i*2))) == 0)
 			avail++;
 	}
-	
-	if (avail*4 < size)
+
+	if (avail * 4 < size)
 		return (-1);
-	
-	for (i=0; i<4 && (size != 0); i++) {
+
+	for (i = 0; i < 4 && (size != 0); i++) {
 		if ((d.dr[7] & (3<<(i*2))) == 0) {
 			if (size > 4)
 				wsize = 4;
@@ -630,15 +630,15 @@
 				wsize = size;
 			if (wsize == 3)
 				wsize++;
-			amd64_set_watch(i, addr, wsize, 
+			amd64_set_watch(i, addr, wsize,
 				       DBREG_DR7_WRONLY, &d);
 			addr += wsize;
 			size -= wsize;
 		}
 	}
-	
+
 	set_dbregs(NULL, &d);
-	
+
 	return(0);
 }
 
@@ -653,22 +653,22 @@
 
 	fill_dbregs(NULL, &d);
 
-	for(i=0; i<4; i++) {
+	for(i = 0; i < 4; i++) {
 		if (d.dr[7] & (3 << (i*2))) {
-			if ((DBREG_DRX((&d), i) >= addr) && 
+			if ((DBREG_DRX((&d), i) >= addr) &&
 			    (DBREG_DRX((&d), i) < addr+size))
 				amd64_clr_watch(i, &d);
-			
+
 		}
 	}
-	
+
 	set_dbregs(NULL, &d);
-	
+
 	return(0);
 }
 
 
-static 
+static
 char *
 watchtype_str(type)
 	int type;
@@ -685,30 +685,29 @@
 void
 db_md_list_watchpoints()
 {
-	int i;
 	struct dbreg d;
+	int i, len, type;
 
 	fill_dbregs(NULL, &d);
 
 	db_printf("\nhardware watchpoints:\n");
 	db_printf("  watch    status        type  len     address\n");
 	db_printf("  -----  --------  ----------  ---  ----------\n");
-	for (i=0; i<4; i++) {
+	for (i = 0; i < 4; i++) {
 		if (d.dr[7] & (0x03 << (i*2))) {
-			unsigned type, len;
 			type = (d.dr[7] >> (16+(i*4))) & 3;
 			len =  (d.dr[7] >> (16+(i*4)+2)) & 3;
 			db_printf("  %-5d  %-8s  %10s  %3d  0x%016lx\n",
-				  i, "enabled", watchtype_str(type), 
+				  i, "enabled", watchtype_str(type),
 				  len + 1, DBREG_DRX((&d), i));
 		}
 		else {
 			db_printf("  %-5d  disabled\n", i);
 		}
 	}
-	
+
 	db_printf("\ndebug register values:\n");
-	for (i=0; i<8; i++) {
+	for (i = 0; i < 8; i++) {
 		db_printf("  dr%d 0x%016lx\n", i, DBREG_DRX((&d), i));
 	}
 	db_printf("\n");

==== //depot/projects/newisp/amd64/amd64/machdep.c#7 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.660 2006/11/07 21:57:18 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.661 2006/11/15 19:53:47 jhb Exp $");
 
 #include "opt_atalk.h"
 #include "opt_atpic.h"
@@ -1832,9 +1832,8 @@
                 addr[nbp++] = (caddr_t)rdr3();
         }
 
-        for (i=0; i<nbp; i++) {
-                if (addr[i] <
-                    (caddr_t)VM_MAXUSER_ADDRESS) {
+        for (i = 0; i < nbp; i++) {
+                if (addr[i] < (caddr_t)VM_MAXUSER_ADDRESS) {
                         /*
                          * addr[i] is in user space
                          */

==== //depot/projects/newisp/amd64/amd64/msi.c#2 (text+ko) ====

@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/msi.c,v 1.1 2006/11/13 22:23:32 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/msi.c,v 1.2 2006/11/15 18:40:00 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -315,7 +315,7 @@
 		/* We need count - cnt more sources starting at index 'cnt'. */
 		*newirq = cnt;
 		*newcount = count - cnt;
-		for (j = 0; j < *newirq; j++) {
+		for (j = 0; j < *newcount; j++) {
 
 			/* Create a new MSI source. */
 			msi = malloc(sizeof(struct msi_intsrc), M_MSI,

==== //depot/projects/newisp/amd64/include/reg.h#2 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)reg.h	5.5 (Berkeley) 1/18/91
- * $FreeBSD: src/sys/amd64/include/reg.h,v 1.35 2004/04/05 23:55:14 imp Exp $
+ * $FreeBSD: src/sys/amd64/include/reg.h,v 1.36 2006/11/15 19:53:48 jhb Exp $
  */
 
 #ifndef _MACHINE_REG_H_
@@ -92,11 +92,13 @@
 				/* Index 8-15: reserved */
 };
 
-#define DBREG_DR7_EXEC      0x00      /* break on execute       */
-#define DBREG_DR7_WRONLY    0x01      /* break on write         */
-#define DBREG_DR7_RDWR      0x03      /* break on read or write */
-#define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr15 by
-                                         register number */
+#define	DBREG_DR7_EXEC		0x00	/* break on execute       */
+#define	DBREG_DR7_WRONLY	0x01	/* break on write         */
+#define	DBREG_DR7_RDWR		0x03	/* break on read or write */
+
+#define	DBREG_DRX(d,x)	((d)->dr[(x)])	/* reference dr0 - dr15 by
+					   register number */
+
 #ifdef _KERNEL
 /*
  * XXX these interfaces are MI, so they should be declared in a MI place.

==== //depot/projects/newisp/compat/linux/linux_emul.c#6 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_emul.c,v 1.8 2006/10/28 10:59:59 netchild Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_emul.c,v 1.9 2006/11/15 11:04:37 kib Exp $");
 
 #include "opt_compat.h"
 
@@ -85,7 +85,7 @@
 		em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO);
 		em->pid = child;
 		em->pdeath_signal = 0;
-		if (flags & CLONE_VM) {
+		if (flags & CLONE_THREAD) {
 		   	/* handled later in the code */
 		} else {
 		   	struct linux_emuldata_shared *s;
@@ -117,10 +117,10 @@
 	 * the newly created proc
 	 */
 	if (child != 0) {
-   	   	if (flags & CLONE_VM) {
+   	   	if (flags & CLONE_THREAD) {
    		   	/* lookup the parent */
 		   	p_em = em_find(td->td_proc, EMUL_LOCKED);
-			KASSERT(p_em != NULL, ("proc_init: parent emuldata not found for CLONE_VM\n"));
+			KASSERT(p_em != NULL, ("proc_init: parent emuldata not found for CLONE_THREAD\n"));
 			em->shared = p_em->shared;
 			em->shared->refs++;
 		} else {

==== //depot/projects/newisp/compat/linux/linux_misc.c#8 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.193 2006/11/11 16:26:55 trhodes Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.194 2006/11/15 10:01:06 kib Exp $");
 
 #include "opt_compat.h"
 #include "opt_mac.h"
@@ -802,7 +802,7 @@
 	 * this is necessary because the test in kern_wait doesnt
 	 * work because we mess with the options here
 	 */
-	if (args->options &~ (WUNTRACED|WNOHANG|WCONTINUED))
+	if (args->options &~ (WUNTRACED|WNOHANG|WCONTINUED|__WCLONE))
 	   	return (EINVAL);
 
 	options = (args->options & (WNOHANG | WUNTRACED));

==== //depot/projects/newisp/conf/NOTES#14 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1399 2006/11/11 23:37:52 ru Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1400 2006/11/15 09:13:24 maxim Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -2397,6 +2397,8 @@
 #
 # USB serial support
 device		ucom
+# USB support for Technologies ARK3116 based serial adapters
+device		uark
 # USB support for Belkin F5U103 and compatible serial adapters
 device		ubsa
 # USB support for BWCT console serial adapters

==== //depot/projects/newisp/conf/files#13 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1161 2006/11/11 16:26:56 trhodes Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1162 2006/11/15 09:13:24 maxim Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -1037,6 +1037,7 @@
 dev/usb/ohci_pci.c		optional ohci pci
 dev/usb/sl811hs.c		optional slhci
 dev/usb/slhci_pccard.c		optional slhci pccard
+dev/usb/uark.c			optional uark
 dev/usb/ubsa.c			optional ubsa
 dev/usb/ubser.c			optional ubser
 dev/usb/ucom.c			optional ucom

==== //depot/projects/newisp/conf/files.pc98#4 (text+ko) ====

@@ -3,7 +3,7 @@
 #
 # modified for PC-9801/PC-9821
 #
-# $FreeBSD: src/sys/conf/files.pc98,v 1.349 2006/10/29 14:02:39 netchild Exp $
+# $FreeBSD: src/sys/conf/files.pc98,v 1.350 2006/11/14 14:28:09 ru Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -176,6 +176,7 @@
 i386/i386/mpboot.s		optional smp
 i386/i386/mptable.c		optional apic
 i386/i386/mptable_pci.c		optional apic pci
+i386/i386/msi.c			optional apic pci
 i386/i386/nexus.c		standard
 i386/i386/perfmon.c		optional perfmon
 i386/i386/pmap.c		standard

==== //depot/projects/newisp/dev/bce/if_bce.c#8 (text) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.18 2006/10/31 03:28:25 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.19 2006/11/15 20:04:56 jhb Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -452,7 +452,7 @@
 	struct bce_softc *sc;
 	struct ifnet *ifp;
 	u32 val;
-	int mbuf, rid, rc = 0;
+	int count, mbuf, rid, rc = 0;
 
 	sc = device_get_softc(dev);
 	sc->bce_dev = dev;
@@ -485,7 +485,12 @@
 	sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res);
 
 	/* Allocate PCI IRQ resources. */
-	rid = 0;
+	count = pci_msi_count(dev);
+	if (count == 1 && pci_alloc_msi(dev, &count) == 0) {
+		rid = 1;
+		sc->bce_flags |= BCE_USING_MSI_FLAG;
+	} else
+		rid = 0;
 	sc->bce_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
 	    RF_SHAREABLE | RF_ACTIVE);
 
@@ -2539,9 +2544,12 @@
 	if (sc->bce_irq != NULL)
 		bus_release_resource(dev,
 			SYS_RES_IRQ,
-			0,
+			sc->bce_flags & BCE_USING_MSI_FLAG ? 1 : 0,
 			sc->bce_irq);
 
+	if (sc->bce_flags & BCE_USING_MSI_FLAG)
+		pci_release_msi(dev);
+
 	if (sc->bce_res != NULL)
 		bus_release_resource(dev,
 			SYS_RES_MEMORY,

==== //depot/projects/newisp/dev/em/if_em.c#13 (text+ko) ====

@@ -31,7 +31,7 @@
 
 ***************************************************************************/
 
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.163 2006/11/09 16:00:18 glebius Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.164 2006/11/15 20:04:56 jhb Exp $*/
 
 #ifdef HAVE_KERNEL_OPTION_HEADERS
 #include "opt_device_polling.h"
@@ -2200,7 +2200,12 @@
 		    rman_get_bushandle(adapter->flash_mem);
 	}
 
-	rid = 0x0;
+	val = pci_msi_count(dev);
+	if (val == 1 && pci_alloc_msi(dev, &val) == 0) {
+		rid = 1;
+		adapter->msi = 1;
+	} else
+		rid = 0;
 	adapter->res_interrupt = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
 	    RF_SHAREABLE | RF_ACTIVE);
 	if (adapter->res_interrupt == NULL) {
@@ -2279,7 +2284,11 @@
 	device_t dev = adapter->dev;
 
 	if (adapter->res_interrupt != NULL)
-		bus_release_resource(dev, SYS_RES_IRQ, 0, adapter->res_interrupt);
+		bus_release_resource(dev, SYS_RES_IRQ, adapter->msi ? 1 : 0,
+		    adapter->res_interrupt);
+
+	if (adapter->msi)
+		pci_release_msi(dev);
 
 	if (adapter->res_memory != NULL)
 		bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0),

==== //depot/projects/newisp/dev/em/if_em.h#7 (text+ko) ====

@@ -31,7 +31,7 @@
 
 ***************************************************************************/
 
-/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.55 2006/11/09 16:00:18 glebius Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.56 2006/11/15 20:04:56 jhb Exp $*/
 
 #ifndef _EM_H_DEFINED_
 #define _EM_H_DEFINED_
@@ -288,6 +288,7 @@
 	struct callout	tx_fifo_timer;
 	int		watchdog_timer;
 	int		io_rid;
+	int		msi;
 	int		if_flags;
 	struct mtx	mtx;
 	int		em_insert_vlan_header;

==== //depot/projects/newisp/dev/fxp/if_fxp.c#4 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.259 2006/11/06 12:19:43 rink Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.260 2006/11/14 18:54:31 rink Exp $");
 
 /*
  * Intel EtherExpress Pro/100B PCI Fast Ethernet driver
@@ -179,6 +179,7 @@
     { 0x1068,	-1,	"Intel 82801FBM (ICH6-M) Pro/100 VE Ethernet" },
     { 0x1069,	-1,	"Intel 82562EM/EX/GX Pro/100 Ethernet" },
     { 0x1092,	-1,	"Intel Pro/100 VE Network Connection" },
+    { 0x1093,	-1,	"Intel Pro/100 VM Network Connection" },
     { 0x1094,	-1,	"Intel Pro/100 946GZ (ICH7) Network Connection" },
     { 0x1209,	-1,	"Intel 82559ER Embedded 10/100 Ethernet" },
     { 0x1229,	0x01,	"Intel 82557 Pro/100 Ethernet" },

==== //depot/projects/newisp/dev/isp/isp.c#36 (text+ko) ====

@@ -42,7 +42,7 @@
 #endif
 #ifdef	__FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.128 2006/11/02 03:21:30 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.129 2006/11/14 08:45:47 mjacob Exp $");
 #include <dev/isp/isp_freebsd.h>
 #endif
 #ifdef	__OpenBSD__
@@ -2986,7 +2986,7 @@
 				lp->new_roles = tmp.roles;
 				lp->state = FC_PORTDB_STATE_PENDING_VALID;
 				isp_prt(isp, ISP_LOGSANCFG,
-				    "Loop Port 0x%02x at 0x%x Pending Valid",
+				    "Loop Port 0x%06x at 0x%x Pending Valid",
 				    tmp.portid, tmp.handle);
 				break;
 			}

==== //depot/projects/newisp/dev/isp/isp_freebsd.c#28 (text+ko) ====

@@ -29,7 +29,7 @@
  * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.126 2006/11/02 03:21:31 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.127 2006/11/14 08:45:48 mjacob Exp $");
 #include <dev/isp/isp_freebsd.h>
 #include <sys/unistd.h>
 #include <sys/kthread.h>

==== //depot/projects/newisp/dev/isp/isp_freebsd.h#18 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.94 2006/11/02 03:21:31 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.95 2006/11/14 08:45:48 mjacob Exp $ */
 /*-
  * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions
  *

==== //depot/projects/newisp/dev/isp/isp_library.c#19 (text) ====

@@ -32,7 +32,7 @@
 #endif
 #ifdef	__FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_library.c,v 1.6 2006/11/02 03:21:31 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_library.c,v 1.7 2006/11/14 08:45:48 mjacob Exp $");
 #include <dev/isp/isp_freebsd.h>
 #endif
 #ifdef	__OpenBSD__

==== //depot/projects/newisp/dev/isp/isp_library.h#12 (text) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/isp_library.h,v 1.3 2006/11/02 03:21:31 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/isp_library.h,v 1.4 2006/11/14 08:45:48 mjacob Exp $ */
 /*-
  * Qlogic Host Adapter Library Functions
  *

==== //depot/projects/newisp/dev/isp/isp_pci.c#19 (text+ko) ====

@@ -30,7 +30,7 @@
  * FreeBSD Version.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.124 2006/11/02 03:21:31 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.125 2006/11/14 08:45:48 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>

==== //depot/projects/newisp/dev/isp/ispvar.h#16 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/ispvar.h,v 1.78 2006/11/02 03:21:32 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/ispvar.h,v 1.79 2006/11/14 08:45:48 mjacob Exp $ */
 /*-
  * Soft Definitions for for Qlogic ISP SCSI adapters.
  *

==== //depot/projects/newisp/dev/mfi/mfi.c#8 (text) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.21 2006/10/16 04:30:09 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.22 2006/11/14 16:48:00 ambrisko Exp $");
 
 #include "opt_mfi.h"
 
@@ -1797,6 +1797,14 @@
 {
 	struct mfi_softc *sc;
 	union mfi_statrequest *ms;
+	struct mfi_ioc_packet *ioc;
+	struct mfi_ioc_aen *aen;
+	struct mfi_command *cm = NULL;
+	struct mfi_dcmd_frame *dcmd;
+	uint32_t context;
+	uint32_t *sense_ptr;
+	uint8_t *data = NULL, *temp;
+	int i;
 	int error;
 
 	sc = dev->si_drv1;
@@ -1818,7 +1826,133 @@
 			break;
 		}
 		break;
-	case 0xc1144d01: /* Firmware Linux ioctl shim */
+	case MFI_CMD:
+		ioc = (struct mfi_ioc_packet *)arg;
+
+		mtx_lock(&sc->mfi_io_lock);
+		if ((cm = mfi_dequeue_free(sc)) == NULL) {
+			mtx_unlock(&sc->mfi_io_lock);
+			return (EBUSY);
+		}
+		mtx_unlock(&sc->mfi_io_lock);
+
+		/*
+		 * save off original context since copying from user
+		 * will clobber some data
+		 */
+		context = cm->cm_frame->header.context;
+
+		bcopy(ioc->mi_frame.raw, cm->cm_frame,
+		      ioc->mi_sgl_off); /* Linux can do 2 frames ? */
+		cm->cm_total_frame_size = ioc->mi_sgl_off;
+		cm->cm_sg =
+		    (union mfi_sgl *)&cm->cm_frame->bytes[ioc->mi_sgl_off];
+		cm->cm_flags = MFI_CMD_DATAIN | MFI_CMD_DATAOUT
+			| MFI_CMD_POLLED;
+		cm->cm_len = cm->cm_frame->header.data_len;
+		cm->cm_data = data = malloc(cm->cm_len, M_MFIBUF,
+					    M_WAITOK | M_ZERO);
+
+		/* restore header context */
+		cm->cm_frame->header.context = context;
+		/* ioctl's are dcmd types */
+		dcmd =  &cm->cm_frame->dcmd;
+
+		temp = data;
+		for (i = 0; i < ioc->mi_sge_count; i++) {
+			error = copyin(ioc->mi_sgl[i].iov_base,
+			       temp,
+			       ioc->mi_sgl[i].iov_len);
+			if (error != 0) {
+				device_printf(sc->mfi_dev,
+				    "Copy in failed");
+				goto out;
+			}
+			temp = &temp[ioc->mi_sgl[i].iov_len];
+		}
+
+		if (ioc->mi_sense_len) {
+			sense_ptr =
+			    (void *)&cm->cm_frame->bytes[ioc->mi_sense_off];
+			*sense_ptr = cm->cm_sense_busaddr;
+		}
+
+		mtx_lock(&sc->mfi_io_lock);
+		if ((error = mfi_mapcmd(sc, cm)) != 0) {
+			device_printf(sc->mfi_dev,
+			    "Controller info buffer map failed");
+			mtx_unlock(&sc->mfi_io_lock);
+			goto out;
+		}
+
+		if ((error = mfi_polled_command(sc, cm)) != 0) {
+			device_printf(sc->mfi_dev,
+			    "Controller polled failed");
+			mtx_unlock(&sc->mfi_io_lock);
+			goto out;
+		}
+
+		bus_dmamap_sync(sc->mfi_buffer_dmat, cm->cm_dmamap,
+				BUS_DMASYNC_POSTREAD);
+		bus_dmamap_unload(sc->mfi_buffer_dmat, cm->cm_dmamap);
+		mtx_unlock(&sc->mfi_io_lock);
+
+		temp = data;
+		for (i = 0; i < ioc->mi_sge_count; i++) {
+			error = copyout(temp,
+				ioc->mi_sgl[i].iov_base,
+				ioc->mi_sgl[i].iov_len);
+			if (error != 0) {
+				device_printf(sc->mfi_dev,
+				    "Copy out failed");
+				goto out;
+			}
+			temp = &temp[ioc->mi_sgl[i].iov_len];
+		}
+
+		if (ioc->mi_sense_len) {
+			/* copy out sense */
+			sense_ptr = (void *)
+			    &ioc->mi_frame.raw[ioc->mi_sense_off];
+			temp = 0;
+			temp += cm->cm_sense_busaddr;
+			error = copyout(temp, sense_ptr,
+			    ioc->mi_sense_len);
+			if (error != 0) {
+				device_printf(sc->mfi_dev,
+				    "Copy out failed");
+				goto out;
+			}
+		}
+
+		ioc->mi_frame.hdr.cmd_status = cm->cm_frame->header.cmd_status;
+		if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) {
+			switch (dcmd->opcode) {
+			case MFI_DCMD_CFG_CLEAR:
+			case MFI_DCMD_CFG_ADD:
+/*
+				mfi_ldrescan(sc);
+*/
+				break;
+			}
+		}
+out:
+		if (data)
+			free(data, M_MFIBUF);
+		if (cm) {
+			mtx_lock(&sc->mfi_io_lock);
+			mfi_release_command(cm);
+			mtx_unlock(&sc->mfi_io_lock);
+		}
+
+		break;
+	case MFI_SET_AEN:
+		aen = (struct mfi_ioc_aen *)arg;
+		error = mfi_aen_register(sc, aen->aen_seq_num,
+		    aen->aen_class_locale);
+
+		break;
+	case MFI_LINUX_CMD_2: /* Firmware Linux ioctl shim */
 		{
 			devclass_t devclass;
 			struct mfi_linux_ioc_packet l_ioc;
@@ -1839,7 +1973,7 @@
 			    cmd, arg, flag, td));
 			break;
 		}
-	case 0x400c4d03: /* AEN Linux ioctl shim */
+	case MFI_LINUX_SET_AEN_2: /* AEN Linux ioctl shim */
 		{
 			devclass_t devclass;
 			struct mfi_linux_ioc_aen l_aen;
@@ -1880,13 +2014,14 @@
 	uint32_t *sense_ptr;
 	uint32_t context;
 	uint8_t *data = NULL, *temp;
+	void *temp_convert;
 	int i;
 	int error;
 
 	sc = dev->si_drv1;
 	error = 0;
 	switch (cmd) {
-	case 0xc1144d01: /* Firmware Linux ioctl shim */
+	case MFI_LINUX_CMD_2: /* Firmware Linux ioctl shim */
 		error = copyin(arg, &l_ioc, sizeof(l_ioc));
 		if (error != 0)
 			return (error);
@@ -1924,7 +2059,9 @@
 
 		temp = data;
 		for (i = 0; i < l_ioc.lioc_sge_count; i++) {
-			error = copyin(l_ioc.lioc_sgl[i].iov_base,
+			temp_convert =
+			    (void *)(uintptr_t)l_ioc.lioc_sgl[i].iov_base;
+			error = copyin(temp_convert,
 			       temp,
 			       l_ioc.lioc_sgl[i].iov_len);
 			if (error != 0) {
@@ -1963,8 +2100,10 @@
 
 		temp = data;
 		for (i = 0; i < l_ioc.lioc_sge_count; i++) {
+			temp_convert =
+			    (void *)(uintptr_t)l_ioc.lioc_sgl[i].iov_base;
 			error = copyout(temp,
-				l_ioc.lioc_sgl[i].iov_base,
+				temp_convert,
 				l_ioc.lioc_sgl[i].iov_len);
 			if (error != 0) {
 				device_printf(sc->mfi_dev,
@@ -2017,7 +2156,7 @@
 		}
 
 		return (error);
-	case 0x400c4d03: /* AEN Linux ioctl shim */
+	case MFI_LINUX_SET_AEN_2: /* AEN Linux ioctl shim */
 		error = copyin(arg, &l_aen, sizeof(l_aen));
 		if (error != 0)
 			return (error);

==== //depot/projects/newisp/dev/mfi/mfi_ioctl.h#2 (text) ====

@@ -25,7 +25,14 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_ioctl.h,v 1.2 2006/05/18 23:30:47 ambrisko Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_ioctl.h,v 1.3 2006/11/14 16:48:00 ambrisko Exp $");
+
+#if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */
+struct iovec32 {
+	u_int32_t	iov_base;
+	int		iov_len;
+};
+#endif
 
 #define MFIQ_FREE	0
 #define MFIQ_BIO	1
@@ -43,6 +50,33 @@
 	struct mfi_qstat	ms_qstat;
 };
 
+#define MAX_IOCTL_SGE	16
+
+struct mfi_ioc_packet {
+	uint16_t	mi_adapter_no;
+	uint16_t	mi_pad1;
+	uint32_t	mi_sgl_off;
+	uint32_t	mi_sge_count;
+	uint32_t	mi_sense_off;
+	uint32_t	mi_sense_len;
+	union {
+		uint8_t raw[128];
+		struct mfi_frame_header hdr;
+	} mi_frame;
+
+	struct iovec mi_sgl[MAX_IOCTL_SGE];
+} __packed;
+
+struct mfi_ioc_aen {
+	uint16_t	aen_adapter_no;
+	uint16_t	aen_pad1;
+	uint32_t	aen_seq_num;
+	uint32_t	aen_class_locale;
+} __packed;
+
+#define MFI_CMD		_IOWR('M', 1, struct mfi_ioc_packet)
+#define MFI_SET_AEN	_IOW('M', 3, struct mfi_ioc_aen)
+
 #define MAX_LINUX_IOCTL_SGE	16
 
 struct mfi_linux_ioc_packet {
@@ -57,7 +91,11 @@
 		struct mfi_frame_header hdr;
 	} lioc_frame;
 
+#if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */
+	struct iovec32 lioc_sgl[MAX_LINUX_IOCTL_SGE];
+#else
 	struct iovec lioc_sgl[MAX_LINUX_IOCTL_SGE];
+#endif
 } __packed;
 
 #define MFIIO_STATS	_IOWR('Q', 101, union mfi_statrequest)
@@ -68,3 +106,12 @@
 	uint32_t	laen_seq_num;
 	uint32_t	laen_class_locale;
 } __packed;
+
+/*
+ * Create a second set so the FreeBSD native ioctl doesn't
+ * conflict in FreeBSD ioctl handler.  Translate in mfi_linux.c.
+ */
+#define MFI_LINUX_CMD		0xc1144d01
+#define MFI_LINUX_SET_AEN	0x400c4d03
+#define MFI_LINUX_CMD_2		0xc1144d02
+#define MFI_LINUX_SET_AEN_2	0x400c4d04

==== //depot/projects/newisp/dev/mfi/mfi_linux.c#2 (text) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_linux.c,v 1.1 2006/05/18 23:30:47 ambrisko Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_linux.c,v 1.2 2006/11/14 16:48:00 ambrisko Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -45,6 +45,9 @@
 #include <compat/linux/linux_ioctl.h>
 #include <compat/linux/linux_util.h>
 
+#include <dev/mfi/mfireg.h>
+#include <dev/mfi/mfi_ioctl.h>
+
 /* There are multiple ioctl number ranges that need to be handled */
 #define MFI_LINUX_IOCTL_MIN  0x4d00
 #define MFI_LINUX_IOCTL_MAX  0x4d04
@@ -81,10 +84,20 @@
 {
 	struct file *fp;
 	int error;
+	u_long cmd = args->cmd;
 
+	switch (cmd) {
+	case MFI_LINUX_CMD:
+		cmd = MFI_LINUX_CMD_2;
+		break;
+	case MFI_LINUX_SET_AEN:
+		cmd = MFI_LINUX_SET_AEN_2;
+		break;
+	}
+
 	if ((error = fget(p, args->fd, &fp)) != 0)
 		return (error);
-	error = fo_ioctl(fp, args->cmd, (caddr_t)args->arg, p->td_ucred, p);
+	error = fo_ioctl(fp, cmd, (caddr_t)args->arg, p->td_ucred, p);
 	fdrop(fp, p);
 	return (error);
 }

==== //depot/projects/newisp/dev/mpt/mpt.c#3 (text+ko) ====

@@ -96,7 +96,7 @@

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


More information about the p4-projects mailing list