PERFORCE change 117170 for review

Marcel Moolenaar marcel at FreeBSD.org
Mon Apr 2 06:21:21 UTC 2007


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

Change 117170 by marcel at marcel_cluster on 2007/04/02 06:20:52

	IFC @117168

Affected files ...

.. //depot/projects/uart/amd64/amd64/support.S#10 integrate
.. //depot/projects/uart/conf/NOTES#49 integrate
.. //depot/projects/uart/conf/options#46 integrate
.. //depot/projects/uart/dev/acpica/acpi_ec.c#18 integrate
.. //depot/projects/uart/dev/ahb/ahb.c#10 integrate
.. //depot/projects/uart/dev/arcmsr/arcmsr.c#7 integrate
.. //depot/projects/uart/dev/ed/if_ed_pccard.c#15 integrate
.. //depot/projects/uart/dev/firewire/fwohci_pci.c#15 integrate
.. //depot/projects/uart/dev/ipmi/ipmi_pci.c#3 integrate
.. //depot/projects/uart/dev/isp/isp_freebsd.c#21 integrate
.. //depot/projects/uart/dev/isp/isp_freebsd.h#17 integrate
.. //depot/projects/uart/dev/isp/isp_library.c#10 integrate
.. //depot/projects/uart/dev/isp/isp_library.h#7 integrate
.. //depot/projects/uart/dev/isp/isp_pci.c#21 integrate
.. //depot/projects/uart/dev/isp/isp_sbus.c#16 integrate
.. //depot/projects/uart/dev/mxge/if_mxge.c#8 integrate
.. //depot/projects/uart/dev/pci/pci.c#30 integrate
.. //depot/projects/uart/dev/pci/pci_pci.c#12 integrate
.. //depot/projects/uart/dev/pci/pcireg.h#14 integrate
.. //depot/projects/uart/dev/sk/if_sk.c#14 integrate
.. //depot/projects/uart/dev/sk/if_skreg.h#9 integrate
.. //depot/projects/uart/dev/sound/pcm/channel.c#12 integrate
.. //depot/projects/uart/dev/sound/pcm/mixer.c#12 integrate
.. //depot/projects/uart/dev/sound/usb/uaudio.c#9 integrate
.. //depot/projects/uart/dev/usb/if_aue.c#15 integrate
.. //depot/projects/uart/dev/usb/if_axe.c#16 integrate
.. //depot/projects/uart/dev/usb/ubser.c#6 integrate
.. //depot/projects/uart/gnu/fs/xfs/FreeBSD/support/mrlock.c#2 integrate
.. //depot/projects/uart/gnu/fs/xfs/FreeBSD/support/mrlock.h#2 integrate
.. //depot/projects/uart/i386/acpica/acpi_machdep.c#11 integrate
.. //depot/projects/uart/i386/i386/support.s#10 integrate
.. //depot/projects/uart/i4b/layer1/ifpnp/i4b_ifpnp_avm.c#5 integrate
.. //depot/projects/uart/i4b/layer1/ihfc/i4b_ihfc_pnp.c#5 integrate
.. //depot/projects/uart/i4b/layer1/isic/i4b_avm_a1.c#5 integrate
.. //depot/projects/uart/i4b/layer1/isic/i4b_isic_pnp.c#5 integrate
.. //depot/projects/uart/i4b/layer1/isic/i4b_itk_ix1.c#5 integrate
.. //depot/projects/uart/i4b/layer1/isic/i4b_tel_s016.c#5 integrate
.. //depot/projects/uart/i4b/layer1/isic/i4b_tel_s0163.c#5 integrate
.. //depot/projects/uart/kern/kern_sx.c#12 integrate
.. //depot/projects/uart/kern/subr_witness.c#21 integrate
.. //depot/projects/uart/kern/vfs_lookup.c#17 integrate
.. //depot/projects/uart/kern/vfs_mount.c#31 integrate
.. //depot/projects/uart/kern/vfs_subr.c#39 integrate
.. //depot/projects/uart/modules/cryptodev/Makefile#2 integrate
.. //depot/projects/uart/netgraph/ng_base.c#17 integrate
.. //depot/projects/uart/netinet/sctp_auth.c#3 integrate
.. //depot/projects/uart/netinet/sctp_constants.h#3 integrate
.. //depot/projects/uart/netinet/sctp_indata.c#3 integrate
.. //depot/projects/uart/netinet/sctp_input.c#3 integrate
.. //depot/projects/uart/netinet/sctp_os_bsd.h#3 integrate
.. //depot/projects/uart/netinet/sctp_output.c#3 integrate
.. //depot/projects/uart/netinet/sctp_pcb.c#3 integrate
.. //depot/projects/uart/netinet/sctp_pcb.h#3 integrate
.. //depot/projects/uart/netinet/sctp_structs.h#3 integrate
.. //depot/projects/uart/netinet/sctp_sysctl.c#2 integrate
.. //depot/projects/uart/netinet/sctp_sysctl.h#2 integrate
.. //depot/projects/uart/netinet/sctp_uio.h#3 integrate
.. //depot/projects/uart/netinet/sctp_usrreq.c#3 integrate
.. //depot/projects/uart/netinet/sctputil.c#3 integrate
.. //depot/projects/uart/netinet6/in6_src.c#14 integrate
.. //depot/projects/uart/netinet6/sctp6_usrreq.c#3 integrate
.. //depot/projects/uart/powerpc/conf/GENERIC#16 integrate
.. //depot/projects/uart/powerpc/conf/NOTES#6 integrate
.. //depot/projects/uart/powerpc/powermac/uninorth.c#7 integrate
.. //depot/projects/uart/powerpc/powerpc/extintr.c#2 delete
.. //depot/projects/uart/sys/_sx.h#1 branch
.. //depot/projects/uart/sys/mount.h#22 integrate
.. //depot/projects/uart/sys/sleepqueue.h#6 integrate
.. //depot/projects/uart/sys/sx.h#10 integrate
.. //depot/projects/uart/sys/vnode.h#21 integrate

Differences ...

==== //depot/projects/uart/amd64/amd64/support.S#10 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.122 2007/03/30 01:07:27 jkim Exp $
+ * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.126 2007/03/31 01:47:37 jkim Exp $
  */
 
 #include "opt_ddb.h"
@@ -242,7 +242,7 @@
 	cmpq	%rcx,%rax
 	ja	copyout_fault
 
-	xchgq	%rdi, %rsi
+	xchgq	%rdi,%rsi
 	/* bcopy(%rsi, %rdi, %rdx) */
 	movq	%rdx,%rcx
 
@@ -288,8 +288,8 @@
 	cmpq	%rcx,%rax
 	ja	copyin_fault
 
-	xchgq	%rdi, %rsi
-	movq	%rdx, %rcx
+	xchgq	%rdi,%rsi
+	movq	%rdx,%rcx
 	movb	%cl,%al
 	shrq	$3,%rcx				/* copy longword-wise */
 	cld
@@ -353,11 +353,11 @@
 	cmpq	%rax,%rdi			/* verify address is valid */
 	ja	fusufault
 
-	movq	%rsi, %rax			/* old */
+	movq	%rsi,%rax			/* old */
 #ifdef SMP
 	lock
 #endif
-	cmpxchgq %rdx, (%rdi)			/* new = %rdx */
+	cmpxchgq %rdx,(%rdi)			/* new = %rdx */
 
 	/*
 	 * The old value is in %eax.  If the store succeeded it will be the
@@ -501,7 +501,7 @@
 	cmpq	%rax,%rdi			/* verify address validity */
 	ja	fusufault
 
-	movl	%esi, %eax
+	movl	%esi,%eax
 	movb	%al,(%rdi)
 	xorl	%eax,%eax
 	movq	PCPU(CURPCB),%rcx		/* restore trashed register */
@@ -518,9 +518,9 @@
  *	return the actual length in *lencopied.
  */
 ENTRY(copyinstr)
-	movq	%rdx, %r8			/* %r8 = maxlen */
-	movq	%rcx, %r9			/* %r9 = *len */
-	xchgq	%rdi, %rsi			/* %rdi = from, %rsi = to */
+	movq	%rdx,%r8			/* %r8 = maxlen */
+	movq	%rcx,%r9			/* %r9 = *len */
+	xchgq	%rdi,%rsi			/* %rdi = from, %rsi = to */
 	movq	PCPU(CURPCB),%rcx
 	movq	$cpystrflt,PCB_ONFAULT(%rcx)
 
@@ -582,9 +582,9 @@
  *         %rdi, %rsi, %rdx, %rcx
  */
 ENTRY(copystr)
-	movq	%rdx, %r8			/* %r8 = maxlen */
+	movq	%rdx,%r8			/* %r8 = maxlen */
 
-	xchgq	%rdi, %rsi
+	xchgq	%rdi,%rsi
 	incq	%rdx
 	cld
 1:
@@ -605,11 +605,11 @@
 
 6:
 
-	testq	%rcx, %rcx
+	testq	%rcx,%rcx
 	jz	7f
 	/* set *lencopied and return %rax */
-	subq	%rdx, %r8
-	movq	%r8, (%rcx)
+	subq	%rdx,%r8
+	movq	%r8,(%rcx)
 7:
 	ret
 
@@ -626,7 +626,7 @@
 	jmp	1f
 	nop
 1:
-	movl	$KDSEL, %eax
+	movl	$KDSEL,%eax
 	movl	%eax,%ds
 	movl	%eax,%es
 	movl	%eax,%fs	/* Beware, use wrmsr to set 64 bit base */
@@ -671,6 +671,49 @@
 	incl	%eax
 	ret
 
+/*****************************************************************************/
+/* linux_futex support                                                       */
+/*****************************************************************************/
+
+futex_fault:
+	movq	$0,PCB_ONFAULT(%rcx)
+	movq	$-EFAULT,%rax
+	ret
+
+ENTRY(futex_xchgl)
+	movq	PCPU(CURPCB),%rcx
+	movq	$futex_fault,PCB_ONFAULT(%rcx)
+
+	movq	$VM_MAXUSER_ADDRESS-4,%rax
+	cmpq	%rax,%rsi
+	ja	futex_fault
+
+#ifdef SMP
+	lock
+#endif
+	xchgl	%edi,(%rsi)
+	movl	%edi,(%rdx)
+	xorl	%eax,%eax
+	movq	%rax,PCB_ONFAULT(%rcx)
+	ret
+
+ENTRY(futex_addl)
+	movq	PCPU(CURPCB),%rcx
+	movq	$futex_fault,PCB_ONFAULT(%rcx)
+
+	movq	$VM_MAXUSER_ADDRESS-4,%rax
+	cmpq	%rax,%rsi
+	ja	futex_fault
+
+#ifdef SMP
+	lock
+#endif
+	xaddl	%edi,(%rsi)
+	movl	%edi,(%rdx)
+	xorl	%eax,%eax
+	movq	%rax,PCB_ONFAULT(%rcx)
+	ret
+
 /*
  * Support for BB-profiling (gcc -a).  The kernbb program will extract
  * the data from the kernel.
@@ -689,47 +732,3 @@
 	movq	%rax,32(%rdi)
 	movq	%rdi,bbhead
 	NON_GPROF_RET
-
-#if defined(SMP) || !defined(_KERNEL)
-#define MPLOCKED	lock ;
-#else
-#define MPLOCKED
-#endif
-
-	.text
-
-futex_fault:
-	movq	PCPU(CURPCB), %rdx
-	movq	$0, PCB_ONFAULT(%rdx)
-	movq	$-EFAULT, %rax
-	ret
-
-/* int futex_xchgl(int oparg, caddr_t uaddr, int *oldval); */
-ENTRY(futex_xchgl)
-	movq	PCPU(CURPCB), %r11
-	movq	$futex_fault, PCB_ONFAULT(%r11)
-
-	movq	$VM_MAXUSER_ADDRESS-4, %rax
-	cmpq	%rax, %rsi
-	ja	futex_fault
-
-	MPLOCKED xchgl	%edi, (%rsi)
-	movl	%edi, (%rdx)
-	xorl	%eax, %eax
-	movq	%rax, PCB_ONFAULT(%r11)
-	ret
-
-/* int futex_addl(int oparg, caddr_t uaddr, int *oldval); */
-ENTRY(futex_addl)
-	movq	PCPU(CURPCB), %r11
-	movq	$futex_fault, PCB_ONFAULT(%r11)
-
-	movq	$VM_MAXUSER_ADDRESS-4, %rax
-	cmpq	%rax, %rsi
-	ja	futex_fault
-
-	MPLOCKED xaddl	%edi, (%rsi)
-	movl	%edi, (%rdx)
-	xorl	%eax, %eax
-	movq	%rax, PCB_ONFAULT(%r11)
-	ret

==== //depot/projects/uart/conf/NOTES#49 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1416 2007/03/26 09:10:28 yar Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1418 2007/04/02 01:04:20 mjacob Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -214,6 +214,12 @@
 # to sleep rather than spinning.
 options 	ADAPTIVE_GIANT
 
+# ADAPTIVE_SX changes the behavior of sx locks to spin if the thread
+# that currently owns the lock is executing on another CPU.  Note that
+# in addition to enabling this option, individual sx locks must be
+# initialized with the SX_ADAPTIVESPIN flag.
+options 	ADAPTIVE_SX
+
 # MUTEX_NOINLINE forces mutex operations to call functions to perform each
 # operation rather than inlining the simple cases.  This can be used to
 # shrink the size of the kernel text segment.  Note that this behavior is
@@ -233,6 +239,13 @@
 # and WITNESS options.
 options 	RWLOCK_NOINLINE
 
+# SX_NOINLINE forces sx lock operations to call functions to perform each
+# operation rather than inlining the simple cases.  This can be used to
+# shrink the size of the kernel text segment.  Note that this behavior is
+# already implied by the INVARIANT_SUPPORT, INVARIANTS, KTR, LOCK_PROFILING,
+# and WITNESS options.
+options 	SX_NOINLINE
+
 # SMP Debugging Options:
 #
 # PREEMPTION allows the threads that are in the kernel to be preempted
@@ -1521,9 +1534,13 @@
 #
 options 	ISP_TARGET_MODE=1
 #
-#	ISP_DEFAULT_ROLES	-	default role (none, target, init, both)
+#	ISP_DEFAULT_ROLES	-	default role
+#		none=0
+#		target=1
+#		initiator=2
+#		both=3			(not supported currently)
 #
-options 	ISP_DEFAULT_ROLES=3
+options 	ISP_DEFAULT_ROLES=2
 
 # Options used in dev/sym/ (Symbios SCSI driver).
 #options 	SYM_SETUP_LP_PROBE_MAP	#-Low Priority Probe Map (bits)

==== //depot/projects/uart/conf/options#46 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.583 2007/03/27 19:32:40 jhb Exp $
+# $FreeBSD: src/sys/conf/options,v 1.584 2007/03/31 23:23:41 jhb Exp $
 #
 #        On the handling of kernel options
 #
@@ -59,6 +59,7 @@
 
 # Miscellaneous options.
 ADAPTIVE_GIANT	opt_adaptive_mutexes.h
+ADAPTIVE_SX
 ALQ
 AUDIT		opt_global.h
 CODA_COMPAT_5	opt_coda.h
@@ -555,6 +556,7 @@
 REGRESSION		opt_global.h
 RESTARTABLE_PANICS	opt_global.h
 RWLOCK_NOINLINE		opt_global.h
+SX_NOINLINE		opt_global.h
 VFS_BIO_DEBUG		opt_global.h
 
 # These are VM related options

==== //depot/projects/uart/dev/acpica/acpi_ec.c#18 (text+ko) ====

@@ -136,12 +136,13 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_ec.c,v 1.72 2007/03/22 18:16:40 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_ec.c,v 1.73 2007/03/31 23:23:41 jhb Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/bus.h>
+#include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
 #include <sys/sx.h>

==== //depot/projects/uart/dev/ahb/ahb.c#10 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/ahb/ahb.c,v 1.39 2007/02/23 12:18:30 piso Exp $
+ * $FreeBSD: src/sys/dev/ahb/ahb.c,v 1.40 2007/04/01 16:55:31 netchild Exp $
  */
 
 #include <sys/param.h>
@@ -378,8 +378,10 @@
 		goto error_exit;
 
 	/* Enable our interrupt */
-	bus_setup_intr(dev, irq, INTR_TYPE_CAM|INTR_ENTROPY, NULL, ahbintr, 
-	    ahb, &ih);
+	if (bus_setup_intr(dev, irq, INTR_TYPE_CAM|INTR_ENTROPY, NULL, ahbintr, 
+	    ahb, &ih) != 0)
+		goto error_exit;
+
 	return (0);
 
 error_exit:

==== //depot/projects/uart/dev/arcmsr/arcmsr.c#7 (text+ko) ====

@@ -56,7 +56,7 @@
 **                                                       and cause g_vfs_done() read write error
 
 ******************************************************************************************
-* $FreeBSD: src/sys/dev/arcmsr/arcmsr.c,v 1.20 2007/03/12 05:10:29 mjacob Exp $
+* $FreeBSD: src/sys/dev/arcmsr/arcmsr.c,v 1.21 2007/04/02 03:31:37 scottl Exp $
 */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1270,8 +1270,7 @@
 				, acb->pci_unit, error);
 		}
 		if((pccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) {
-			xpt_freeze_devq(pccb->ccb_h.path, /*count*/1);
-			pccb->ccb_h.status |= (CAM_REQ_TOO_BIG|CAM_DEV_QFRZN);
+			pccb->ccb_h.status |= CAM_REQ_TOO_BIG;
 		}
 		arcmsr_srb_complete(srb, 0);
 		return;
@@ -1307,14 +1306,14 @@
 		arcmsr_srb_complete(srb, 0);
 		return;
 	}
-	pccb->ccb_h.status |= CAM_SIM_QUEUED;
 	if(acb->srboutstandingcount >= ARCMSR_MAX_OUTSTANDING_CMD) {
-		pccb->ccb_h.status &= ~CAM_STATUS_MASK;
-		pccb->ccb_h.status |= (CAM_REQUEUE_REQ|CAM_DEV_QFRZN);
+		xpt_freeze_simq(acb->psim, 1);
+		pccb->ccb_h.status = CAM_REQUEUE_REQ;
 		acb->acb_flags |= ACB_F_CAM_DEV_QFRZN;
 		arcmsr_srb_complete(srb, 0);
 		return;
 	}
+	pccb->ccb_h.status |= CAM_SIM_QUEUED;
 	arcmsr_build_srb(srb, dm_segs, nseg);
 	arcmsr_post_srb(acb, srb);
 	return;

==== //depot/projects/uart/dev/ed/if_ed_pccard.c#15 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.111 2007/02/23 12:18:38 piso Exp $
+ * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.112 2007/04/01 14:15:26 netchild Exp $
  */
 
 /*
@@ -541,7 +541,7 @@
 	    sc->chip_type == ED_CHIP_TYPE_DL10022) {
 		/* Probe for an MII bus, but ignore errors. */
 		ed_pccard_dl100xx_mii_reset(sc);
-		mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
+		(void)mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
 		    ed_ifmedia_sts);
 	} else if (sc->chip_type == ED_CHIP_TYPE_AX88190) {
 		ed_pccard_ax88x90_mii_reset(sc);

==== //depot/projects/uart/dev/firewire/fwohci_pci.c#15 (text+ko) ====

@@ -31,7 +31,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  * 
- * $FreeBSD: src/sys/dev/firewire/fwohci_pci.c,v 1.58 2007/03/19 03:41:27 simokawa Exp $
+ * $FreeBSD: src/sys/dev/firewire/fwohci_pci.c,v 1.59 2007/03/30 22:25:26 simokawa Exp $
  */
 
 #define BOUNCE_BUFFER_TEST	0
@@ -424,19 +424,18 @@
 				  FWOHCI_INTMASKCLR, OHCI_INT_EN);
 
 	if (sc->irq_res) {
-		int err = bus_teardown_intr(self, sc->irq_res, sc->ih);
-		if (err)
-			/* XXX or should we panic? */
-			device_printf(self, "Could not tear down irq, %d\n",
-				      err);
+		int err;
+		if (sc->ih) {
+			err = bus_teardown_intr(self, sc->irq_res, sc->ih);
+			if (err)
+				device_printf(self,
+					 "Could not tear down irq, %d\n", err);
 #if defined(__DragonFly__) || __FreeBSD_version < 500000
-		bus_teardown_intr(self, sc->irq_res, sc->ih_cam);
-		bus_teardown_intr(self, sc->irq_res, sc->ih_bio);
+			bus_teardown_intr(self, sc->irq_res, sc->ih_cam);
+			bus_teardown_intr(self, sc->irq_res, sc->ih_bio);
 #endif
-		sc->ih = NULL;
-	}
-
-	if (sc->irq_res) {
+			sc->ih = NULL;
+		}
 		bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res);
 		sc->irq_res = NULL;
 	}

==== //depot/projects/uart/dev/ipmi/ipmi_pci.c#3 (text) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ipmi/ipmi_pci.c,v 1.2 2006/09/22 22:11:29 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ipmi/ipmi_pci.c,v 1.4 2007/03/31 21:39:02 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -185,7 +185,7 @@
 {
 
 	if (pci_get_class(dev) == PCIC_SERIALBUS &&
-	    pci_get_subclass(dev) == 0x07) {
+	    pci_get_subclass(dev) == PCIS_SERIALBUS_IPMI) {
 		device_set_desc(dev, "IPMI System Interface");
 		return (BUS_PROBE_GENERIC);
 	}
@@ -204,13 +204,13 @@
 
 	/* Interface is determined by progif. */
 	switch (pci_get_progif(dev)) {
-	case 0:
+	case PCIP_SERIALBUS_IPMI_SMIC:
 		iface = SMIC_MODE;
 		break;
-	case 1:
+	case PCIP_SERIALBUS_IPMI_KCS:
 		iface = KCS_MODE;
 		break;
-	case 2:
+	case PCIP_SERIALBUS_IPMI_BT:
 		iface = BT_MODE;
 		device_printf(dev, "BT interface unsupported\n");
 		return (ENXIO);
@@ -220,12 +220,9 @@
 		return (ENXIO);
 	}
 
-	/*
-	 * Bottom bit of bar indicates resouce type.  There should be
-	 * constants in pcireg.h for fields in a BAR.
-	 */
+	/* Check the BAR to determine our resource type. */
 	sc->ipmi_io_rid = PCIR_BAR(0);
-	if (pci_read_config(dev, PCIR_BAR(0), 4) & 0x1)
+	if (PCI_BAR_IO(pci_read_config(dev, PCIR_BAR(0), 4)))
 		type = SYS_RES_IOPORT;
 	else
 		type = SYS_RES_MEMORY;

==== //depot/projects/uart/dev/isp/isp_freebsd.c#21 (text+ko) ====

@@ -28,7 +28,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.136 2007/03/12 04:54:30 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.137 2007/04/02 01:04:20 mjacob Exp $");
 #include <dev/isp/isp_freebsd.h>
 #include <sys/unistd.h>
 #include <sys/kthread.h>
@@ -382,6 +382,14 @@
 			retval = EINVAL;
 			break;
 		}
+		/*
+		 * XXX: Current
+		 */
+		if (nr == ISP_ROLE_BOTH) {
+			isp_prt(isp, ISP_LOGERR, "dual roles not supported");
+			retval = EINVAL;
+			break;
+		}
 		*(int *)addr = isp->isp_role;
 		isp->isp_role = nr;
 		/* FALLTHROUGH */
@@ -1133,7 +1141,7 @@
 static void
 isp_ledone(ispsoftc_t *isp, lun_entry_t *lep)
 {
-	const char lfmt[] = "now %sabled for target mode";
+	const char lfmt[] = "now %sabled for target mode\n";
 	union ccb *ccb;
 	uint32_t seq;
 	tstate_t *tptr;

==== //depot/projects/uart/dev/isp/isp_freebsd.h#17 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.102 2007/03/13 06:46:08 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.104 2007/04/02 01:04:20 mjacob Exp $ */
 /*-
  * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions
  *
@@ -532,4 +532,10 @@
 
 #include <dev/isp/isp_library.h>
 
+/*
+ * XXX: Temp
+ */
+#if	ISP_DEFAULT_ROLES == ISP_ROLE_BOTH
+#error	"Dual Role Temporarily Unsupported"
+#endif
 #endif	/* _ISP_FREEBSD_H */

==== //depot/projects/uart/dev/isp/isp_library.c#10 (text) ====

@@ -34,7 +34,7 @@
 #endif
 #ifdef	__FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_library.c,v 1.12 2007/03/22 23:38:31 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_library.c,v 1.13 2007/04/02 01:04:20 mjacob Exp $");
 #include <dev/isp/isp_freebsd.h>
 #endif
 #ifdef	__OpenBSD__
@@ -1499,12 +1499,12 @@
 void *
 isp_find_xs_tgt(ispsoftc_t *isp, uint32_t handle)
 {
-	if (handle == 0 || (handle & 0x8000) == 0 ||
-	    (handle & 0x7fff) > isp->isp_maxcmds) {
+	if (handle == 0 || IS_TARGET_HANDLE(handle) == 0 ||
+	    (handle & ISP_HANDLE_MASK) > isp->isp_maxcmds) {
 		isp_prt(isp, ISP_LOGERR, "bad handle in isp_find_xs_tgt");
 		return (NULL);
 	} else {
-		return (isp->isp_tgtlist[(handle & 0x7fff) - 1]);
+		return (isp->isp_tgtlist[(handle & ISP_HANDLE_MASK) - 1]);
 	}
 }
 
@@ -1515,7 +1515,7 @@
 	if (xs != NULL) {
 		for (i = 0; i < isp->isp_maxcmds; i++) {
 			if (isp->isp_tgtlist[i] == xs) {
-				return ((i+1) & 0x7fff);
+				return ((i+1) & ISP_HANDLE_MASK);
 			}
 		}
 	}
@@ -1525,12 +1525,12 @@
 void
 isp_destroy_tgt_handle(ispsoftc_t *isp, uint32_t handle)
 {
-	if (handle == 0 || (handle & 0x8000) == 0 ||
-	    (handle & 0x7fff) > isp->isp_maxcmds) {
+	if (handle == 0 || IS_TARGET_HANDLE(handle) == 0 ||
+	    (handle & ISP_HANDLE_MASK) > isp->isp_maxcmds) {
 		isp_prt(isp, ISP_LOGERR,
 		    "bad handle in isp_destroy_tgt_handle");
 	} else {
-		isp->isp_tgtlist[(handle & 0x7fff) - 1] = NULL;
+		isp->isp_tgtlist[(handle & ISP_HANDLE_MASK) - 1] = NULL;
 	}
 }
 

==== //depot/projects/uart/dev/isp/isp_library.h#7 (text) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/isp/isp_library.h,v 1.7 2007/03/22 23:38:31 mjacob Exp $ */
+/* $FreeBSD: src/sys/dev/isp/isp_library.h,v 1.8 2007/04/02 01:04:20 mjacob Exp $ */
 /*-
  *  Copyright (c) 1997-2007 by Matthew Jacob
  *  All rights reserved.
@@ -128,6 +128,8 @@
 extern void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
 extern void isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
 
+#define	ISP_HANDLE_MASK		0x7fff
+
 #ifdef	ISP_TARGET_MODE
 #if	defined(__NetBSD__) || defined(__OpenBSD__)
 #include <dev/ic/isp_target.h>

==== //depot/projects/uart/dev/isp/isp_pci.c#21 (text+ko) ====

@@ -28,7 +28,7 @@
  * FreeBSD Version.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.141 2007/03/22 23:38:32 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.142 2007/04/02 01:04:20 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1994,7 +1994,7 @@
 	cto->ct_scsi_status = 0;
 
 	pcs = (struct isp_pcisoftc *)isp;
-	dp = &pcs->dmaps[isp_handle_index(handle)];
+	dp = &pcs->dmaps[isp_handle_index(handle & ISP_HANDLE_MASK)];
 	if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
 		bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD);
 	} else {
@@ -2388,7 +2388,7 @@
 	isp = mp->isp;
 	rq = mp->rq;
 	pcs = (struct isp_pcisoftc *)mp->isp;
-	dp = &pcs->dmaps[isp_handle_index(rq->req_handle)];
+	dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)];
 	nxti = *mp->nxtip;
 
 	if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
@@ -2494,7 +2494,7 @@
 	isp = mp->isp;
 	rq = mp->rq;
 	pcs = (struct isp_pcisoftc *)mp->isp;
-	dp = &pcs->dmaps[isp_handle_index(rq->req_handle)];
+	dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)];
 	nxti = *mp->nxtip;
 
 	if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
@@ -2628,7 +2628,7 @@
 	isp = mp->isp;
 	rq = mp->rq;
 	pcs = (struct isp_pcisoftc *)mp->isp;
-	dp = &pcs->dmaps[isp_handle_index(rq->req_handle)];
+	dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)];
 	nxti = *mp->nxtip;
 
 	if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
@@ -2795,7 +2795,8 @@
 	if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
 		if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) {
 			int error, s;
-			dp = &pcs->dmaps[isp_handle_index(rq->req_handle)];
+			dp = &pcs->dmaps[isp_handle_index(
+			    rq->req_handle & ISP_HANDLE_MASK)];
 			s = splsoftvm();
 			error = bus_dmamap_load(pcs->dmat, *dp,
 			    csio->data_ptr, csio->dxfer_len, eptr, mp, 0);
@@ -2880,7 +2881,8 @@
 isp_pci_dmateardown(ispsoftc_t *isp, XS_T *xs, uint32_t handle)
 {
 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp;
-	bus_dmamap_t *dp = &pcs->dmaps[isp_handle_index(handle)];
+	bus_dmamap_t *dp;
+	dp = &pcs->dmaps[isp_handle_index(handle & ISP_HANDLE_MASK)];
 	if ((xs->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
 		bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_POSTREAD);
 	} else {

==== //depot/projects/uart/dev/isp/isp_sbus.c#16 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/isp/isp_sbus.c,v 1.31 2007/03/28 16:34:11 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/isp/isp_sbus.c,v 1.32 2007/04/02 01:04:20 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -624,7 +624,7 @@
 	isp = mp->isp;
 	rq = mp->rq;
 	sbs = (struct isp_sbussoftc *)mp->isp;
-	dp = &sbs->dmaps[isp_handle_index(rq->req_handle)];
+	dp = &sbs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)];
 	nxti = *mp->nxtip;
 
 	if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
@@ -735,7 +735,8 @@
 	if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
 		if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) {
 			int error, s;
-			dp = &sbs->dmaps[isp_handle_index(rq->req_handle)];
+			dp = &sbs->dmaps[isp_handle_index(
+			    rq->req_handle & ISP_HANDLE_MASK)];
 			s = splsoftvm();
 			error = bus_dmamap_load(sbs->dmat, *dp,
 			    csio->data_ptr, csio->dxfer_len, eptr, mp, 0);
@@ -809,7 +810,8 @@
 isp_sbus_dmateardown(ispsoftc_t *isp, XS_T *xs, uint32_t handle)
 {
 	struct isp_sbussoftc *sbs = (struct isp_sbussoftc *)isp;
-	bus_dmamap_t *dp = &sbs->dmaps[isp_handle_index(handle)];
+	bus_dmamap_t *dp;
+	dp = &sbs->dmaps[isp_handle_index(handle & ISP_HANDLE_MASK)];
 	if ((xs->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
 		bus_dmamap_sync(sbs->dmat, *dp, BUS_DMASYNC_POSTREAD);
 	} else {

==== //depot/projects/uart/dev/mxge/if_mxge.c#8 (text+ko) ====

@@ -32,7 +32,7 @@
 ***************************************************************************/
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/mxge/if_mxge.c,v 1.24 2007/03/27 15:55:32 gallatin Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/mxge/if_mxge.c,v 1.25 2007/03/31 23:23:41 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,6 +44,7 @@
 #include <sys/malloc.h>
 #include <sys/kdb.h>
 #include <sys/kernel.h>
+#include <sys/lock.h>
 #include <sys/module.h>
 #include <sys/memrange.h>
 #include <sys/socket.h>

==== //depot/projects/uart/dev/pci/pci.c#30 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.345 2007/03/26 20:18:52 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.348 2007/03/31 21:39:02 jhb Exp $");
 
 #include "opt_bus.h"
 
@@ -72,7 +72,7 @@
 #endif
 
 static uint32_t		pci_mapbase(unsigned mapreg);
-static int		pci_maptype(unsigned mapreg);
+static const char	*pci_maptype(unsigned mapreg);
 static int		pci_mapsize(unsigned testval);
 static int		pci_maprange(unsigned mapreg);
 static void		pci_fixancient(pcicfgregs *cfg);
@@ -305,29 +305,24 @@
 static uint32_t
 pci_mapbase(uint32_t mapreg)
 {
-	int mask = 0x03;
-	if ((mapreg & 0x01) == 0)
-		mask = 0x0f;
-	return (mapreg & ~mask);
+
+	if (PCI_BAR_MEM(mapreg))
+		return (mapreg & PCIM_BAR_MEM_BASE);
+	else
+		return (mapreg & PCIM_BAR_IO_BASE);
 }
 
 /* return map type of memory or port map */
 
-static int
+static const char *
 pci_maptype(unsigned mapreg)
 {
-	static uint8_t maptype[0x10] = {
-		PCI_MAPMEM,		PCI_MAPPORT,
-		PCI_MAPMEM,		0,
-		PCI_MAPMEM,		PCI_MAPPORT,
-		0,			0,
-		PCI_MAPMEM|PCI_MAPMEMP,	PCI_MAPPORT,
-		PCI_MAPMEM|PCI_MAPMEMP, 0,
-		PCI_MAPMEM|PCI_MAPMEMP,	PCI_MAPPORT,
-		0,			0,
-	};
 
-	return (maptype[mapreg & 0x0f]);
+	if (PCI_BAR_IO(mapreg))
+		return ("I/O Port");
+	if (mapreg & PCIM_BAR_MEM_PREFETCH)
+		return ("Prefetchable Memory");
+	return ("Memory");
 }
 
 /* return log2 of map size decoded for memory or port map */
@@ -355,19 +350,21 @@
 pci_maprange(unsigned mapreg)
 {
 	int ln2range = 0;
-	switch (mapreg & 0x07) {
-	case 0x00:
-	case 0x01:
-	case 0x05:
+
+	if (PCI_BAR_IO(mapreg))
 		ln2range = 32;
-		break;
-	case 0x02:
-		ln2range = 20;
-		break;
-	case 0x04:
-		ln2range = 64;
-		break;
-	}
+	else
+		switch (mapreg & PCIM_BAR_MEM_TYPE) {
+		case PCIM_BAR_MEM_32:
+			ln2range = 32;
+			break;
+		case PCIM_BAR_MEM_1MB:
+			ln2range = 20;
+			break;
+		case PCIM_BAR_MEM_64:
+			ln2range = 64;
+			break;
+		}
 	return (ln2range);
 }
 
@@ -1062,7 +1059,7 @@
 	uint32_t offset, bit;
 
 	KASSERT(cfg->msix.msix_alloc > index, ("bogus index"));
-	offset = cfg->msix.msix_pba_offset + (index / 4) * 4;
+	offset = cfg->msix.msix_pba_offset + (index / 32) * 4;
 	bit = 1 << index % 32;
 	return (bus_read_4(cfg->msix.msix_pba_res, offset) & bit);
 }
@@ -1972,7 +1969,7 @@
 	testval = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4);
 	PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4);
 
-	if (pci_maptype(map) & PCI_MAPMEM)
+	if (PCI_BAR_MEM(map))
 		type = SYS_RES_MEMORY;
 	else
 		type = SYS_RES_IOPORT;
@@ -1988,8 +1985,7 @@
 	 * areas to the type of memory involved.  Memory must be at least
 	 * 16 bytes in size, while I/O ranges must be at least 4.
 	 */
-	if ((testval & 0x1) == 0x1 &&
-	    (testval & 0x2) != 0)
+	if (PCI_BAR_IO(testval) && (testval & PCIM_BAR_IO_RESERVED) != 0)
 		return (barlen);
 	if ((type == SYS_RES_MEMORY && ln2size < 4) ||
 	    (type == SYS_RES_IOPORT && ln2size < 2))
@@ -1999,7 +1995,7 @@
 		/* Read the other half of a 64bit map register */
 		base |= (uint64_t) PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, 4) << 32;
 	if (bootverbose) {
-		printf("\tmap[%02x]: type %x, range %2d, base %#jx, size %2d",
+		printf("\tmap[%02x]: type %s, range %2d, base %#jx, size %2d",
 		    reg, pci_maptype(map), ln2range, (uintmax_t)base, ln2size);
 		if (type == SYS_RES_IOPORT && !pci_porten(pcib, b, s, f))
 			printf(", port disabled\n");
@@ -2920,7 +2916,7 @@
 		map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32;
 	if (pci_mapbase(testval) == 0)
 		goto out;
-	if (pci_maptype(testval) & PCI_MAPMEM) {
+	if (PCI_BAR_MEM(testval)) {
 		if (type != SYS_RES_MEMORY) {
 			if (bootverbose)
 				device_printf(dev,

==== //depot/projects/uart/dev/pci/pci_pci.c#12 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.46 2007/01/22 21:48:43 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci_pci.c,v 1.47 2007/03/31 20:41:00 jhb Exp $");
 
 /*
  * PCI:PCI bridge support.
@@ -253,7 +253,7 @@
      * parts as subtractive.
      */
     if ((pci_get_devid(dev) & 0xff00ffff) == 0x24008086 ||
-      pci_read_config(dev, PCIR_PROGIF, 1) == 1)
+      pci_read_config(dev, PCIR_PROGIF, 1) == PCIP_BRIDGE_PCI_SUBTRACTIVE)
 	sc->flags |= PCIB_SUBTRACTIVE;
 	
     if (bootverbose) {

==== //depot/projects/uart/dev/pci/pcireg.h#14 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/pci/pcireg.h,v 1.59 2007/03/05 16:18:31 jhb Exp $
+ * $FreeBSD: src/sys/dev/pci/pcireg.h,v 1.61 2007/03/31 21:39:02 jhb Exp $
  *
  */
 
@@ -118,6 +118,19 @@
 #define	PCIR_BARS	0x10
 #define	PCIR_BAR(x)	(PCIR_BARS + (x) * 4)
 #define	PCI_RID2BAR(rid) (((rid)-PCIR_BARS)/4)
+#define	PCI_BAR_IO(x)		(((x) & PCIM_BAR_SPACE) == PCIM_BAR_IO_SPACE)
+#define	PCI_BAR_MEM(x)		(((x) & PCIM_BAR_SPACE) == PCIM_BAR_MEM_SPACE)
+#define	PCIM_BAR_SPACE		0x00000001
+#define	PCIM_BAR_MEM_SPACE	0
+#define	PCIM_BAR_IO_SPACE	1
+#define	PCIM_BAR_MEM_TYPE	0x00000006
+#define	PCIM_BAR_MEM_32		0
+#define	PCIM_BAR_MEM_1MB	2	/* Locate below 1MB in PCI <= 2.1 */
+#define	PCIM_BAR_MEM_64		4

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


More information about the p4-projects mailing list