PERFORCE change 120122 for review

Matt Jacob mjacob at FreeBSD.org
Sun May 20 20:50:42 UTC 2007


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

Change 120122 by mjacob at mjexp-obrien on 2007/05/20 20:50:22

	IFC

Affected files ...

.. //depot/projects/mjexp/sys/dev/de/if_devar.h#2 integrate
.. //depot/projects/mjexp/sys/dev/hptmv/ioctl.c#3 integrate
.. //depot/projects/mjexp/sys/dev/if_ndis/if_ndis.c#5 integrate
.. //depot/projects/mjexp/sys/i386/i386/busdma_machdep.c#4 integrate
.. //depot/projects/mjexp/sys/ia64/ia64/pmap.c#7 integrate
.. //depot/projects/mjexp/sys/kern/kern_sx.c#10 integrate
.. //depot/projects/mjexp/sys/kern/uipc_syscalls.c#12 integrate
.. //depot/projects/mjexp/sys/net/if_lagg.c#5 integrate
.. //depot/projects/mjexp/sys/sparc64/include/smp.h#3 integrate
.. //depot/projects/mjexp/sys/sparc64/include/ver.h#2 integrate
.. //depot/projects/mjexp/sys/sparc64/pci/ofw_pcibus.c#4 integrate
.. //depot/projects/mjexp/sys/sparc64/sparc64/identcpu.c#3 integrate
.. //depot/projects/mjexp/sys/sparc64/sparc64/mem.c#3 integrate
.. //depot/projects/mjexp/sys/sparc64/sparc64/mp_machdep.c#2 integrate
.. //depot/projects/mjexp/sys/sun4v/include/cache.h#3 delete
.. //depot/projects/mjexp/sys/sun4v/include/iommureg.h#2 delete
.. //depot/projects/mjexp/sys/sun4v/include/iommuvar.h#2 delete
.. //depot/projects/mjexp/sys/sun4v/include/ofw_upa.h#2 delete
.. //depot/projects/mjexp/sys/sun4v/include/pmap.h#3 integrate
.. //depot/projects/mjexp/sys/sun4v/include/upa.h#2 integrate
.. //depot/projects/mjexp/sys/sun4v/include/ver.h#2 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/bus_machdep.c#3 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/hviommu.c#3 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/machdep.c#6 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/nexus.c#4 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/pmap.c#8 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/tick.c#3 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/tte_hash.c#5 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/vm_machdep.c#4 integrate
.. //depot/projects/mjexp/sys/sun4v/sun4v/vnex.c#5 integrate
.. //depot/projects/mjexp/sys/sys/sx.h#8 integrate

Differences ...

==== //depot/projects/mjexp/sys/dev/de/if_devar.h#2 (text) ====

@@ -1,6 +1,6 @@
 /*	$NetBSD: if_devar.h,v 1.32 1999/04/01 14:55:25 tsubai Exp $	*/
 
-/* $FreeBSD: src/sys/dev/de/if_devar.h,v 1.44 2006/09/15 15:16:11 glebius Exp $ */
+/* $FreeBSD: src/sys/dev/de/if_devar.h,v 1.45 2007/05/20 16:43:35 mjacob Exp $ */
 
 /*-
  * Copyright (c) 1994-1997 Matt Thomas (matt at 3am-software.com)
@@ -521,7 +521,7 @@
 	u_int32_t		tulip_intrmask;
 	u_int32_t		tulip_cmdmode;
 	u_int32_t		tulip_last_system_error:3;
-	u_int32_t		tulip_txtimer:2;	/* transmission timer */
+	u_int32_t		tulip_txtimer:3;	/* transmission timer */
 	u_int32_t		tulip_system_errors;
 	u_int32_t		tulip_statusbits;	/* status bits from
 							 * CSR5 that may need

==== //depot/projects/mjexp/sys/dev/hptmv/ioctl.c#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/hptmv/ioctl.c,v 1.6 2007/02/27 17:23:27 jhb Exp $
+ * $FreeBSD: src/sys/dev/hptmv/ioctl.c,v 1.7 2007/05/20 16:49:09 mjacob Exp $
  */
 /*
  * ioctl.c   ioctl interface implementation
@@ -151,7 +151,7 @@
 	}
 	event_queue_add(&e);
 	if (event==ET_DEVICE_REMOVED) {
-		int controller, channel;
+		int controller = 0, channel = 0;
 		get_disk_location(&((PVDevice)param)->u.disk, &controller, &channel);
 		hpt_printk(("Device removed: controller %d channel %d\n", controller, channel));
 	}

==== //depot/projects/mjexp/sys/dev/if_ndis/if_ndis.c#5 (text+ko) ====

@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.120 2007/03/11 22:37:32 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.121 2007/05/20 16:59:37 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1082,7 +1082,7 @@
 	uint32_t		pktlen;
 {
 	ndis_miniport_block	*block;
-	uint8_t			irql;
+	uint8_t			irql = 0;
 	uint32_t		status;
 	ndis_buffer		*b;
 	ndis_packet		*p;

==== //depot/projects/mjexp/sys/i386/i386/busdma_machdep.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.86 2007/04/17 21:05:34 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.87 2007/05/20 16:53:45 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/kdb.h>
@@ -869,6 +869,7 @@
 	nsegs = 0;
 	error = 0;
 	first = 1;
+	lastaddr = (bus_addr_t) 0;
 	for (i = 0; i < uio->uio_iovcnt && resid != 0 && !error; i++) {
 		/*
 		 * Now at the first iovec to load.  Load each iovec

==== //depot/projects/mjexp/sys/ia64/ia64/pmap.c#7 (text+ko) ====

@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.184 2007/05/19 13:11:27 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.185 2007/05/19 18:25:14 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1420,14 +1420,14 @@
 				pmap_remove_pte(pmap, pte, va, pv, 1);
 			}
 		}
-		
 	} else {
-		for (va = sva; va < eva; va = va += PAGE_SIZE) {
+		for (va = sva; va < eva; va += PAGE_SIZE) {
 			pte = pmap_find_vhpt(va);
 			if (pte != NULL)
 				pmap_remove_pte(pmap, pte, va, 0, 1);
 		}
 	}
+
 out:
 	vm_page_unlock_queues();
 	pmap_install(oldpmap);

==== //depot/projects/mjexp/sys/kern/kern_sx.c#10 (text+ko) ====

@@ -40,7 +40,7 @@
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.47 2007/05/19 16:35:26 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.50 2007/05/19 21:26:05 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/ktr.h>
@@ -101,14 +101,6 @@
  */
 #define	sx_recursed(sx)		((sx)->sx_recurse != 0)
 
-/*
- * Return a pointer to the owning thread if the lock is exclusively
- * locked.
- */
-#define	sx_xholder(sx)							\
-	((sx)->sx_lock & SX_LOCK_SHARED ? NULL :			\
-	(struct thread *)SX_OWNER((sx)->sx_lock))
-
 #ifdef DDB
 static void	db_show_sx(struct lock_object *lock);
 #endif
@@ -147,7 +139,7 @@
 	struct sx *sx;
 
 	sx = (struct sx *)lock;
-	sx_assert(sx, SX_LOCKED | SX_NOTRECURSED);
+	sx_assert(sx, SA_LOCKED | SA_NOTRECURSED);
 	if (sx_xlocked(sx)) {
 		sx_xunlock(sx);
 		return (1);
@@ -171,7 +163,7 @@
 	int flags;
 
 	MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK |
-	    SX_NOPROFILE)) == 0);
+	    SX_NOPROFILE | SX_ADAPTIVESPIN)) == 0);
 
 	flags = LO_SLEEPABLE | LO_UPGRADABLE | LO_RECURSABLE;
 	if (opts & SX_DUPOK)
@@ -281,7 +273,7 @@
 	MPASS(curthread != NULL);
 	KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
 	    ("sx_sunlock() of destroyed sx @ %s:%d", file, line));
-	_sx_assert(sx, SX_SLOCKED, file, line);
+	_sx_assert(sx, SA_SLOCKED, file, line);
 	curthread->td_locks--;
 	WITNESS_UNLOCK(&sx->lock_object, 0, file, line);
 	LOCK_LOG_LOCK("SUNLOCK", &sx->lock_object, 0, 0, file, line);
@@ -297,7 +289,7 @@
 	MPASS(curthread != NULL);
 	KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
 	    ("sx_xunlock() of destroyed sx @ %s:%d", file, line));
-	_sx_assert(sx, SX_XLOCKED, file, line);
+	_sx_assert(sx, SA_XLOCKED, file, line);
 	curthread->td_locks--;
 	WITNESS_UNLOCK(&sx->lock_object, LOP_EXCLUSIVE, file, line);
 	LOCK_LOG_LOCK("XUNLOCK", &sx->lock_object, 0, sx->sx_recurse, file,
@@ -320,7 +312,7 @@
 
 	KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
 	    ("sx_try_upgrade() of destroyed sx @ %s:%d", file, line));
-	_sx_assert(sx, SX_SLOCKED, file, line);
+	_sx_assert(sx, SA_SLOCKED, file, line);
 
 	/*
 	 * Try to switch from one shared lock to an exclusive lock.  We need
@@ -347,7 +339,7 @@
 
 	KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
 	    ("sx_downgrade() of destroyed sx @ %s:%d", file, line));
-	_sx_assert(sx, SX_XLOCKED | SX_NOTRECURSED, file, line);
+	_sx_assert(sx, SA_XLOCKED | SA_NOTRECURSED, file, line);
 #ifndef INVARIANTS
 	if (sx_recursed(sx))
 		panic("downgrade of a recursed lock");
@@ -853,16 +845,16 @@
 	if (panicstr != NULL)
 		return;
 	switch (what) {
-	case SX_SLOCKED:
-	case SX_SLOCKED | SX_NOTRECURSED:
-	case SX_SLOCKED | SX_RECURSED:
+	case SA_SLOCKED:
+	case SA_SLOCKED | SA_NOTRECURSED:
+	case SA_SLOCKED | SA_RECURSED:
 #ifndef WITNESS
 		slocked = 1;
 		/* FALLTHROUGH */
 #endif
-	case SX_LOCKED:
-	case SX_LOCKED | SX_NOTRECURSED:
-	case SX_LOCKED | SX_RECURSED:
+	case SA_LOCKED:
+	case SA_LOCKED | SA_NOTRECURSED:
+	case SA_LOCKED | SA_RECURSED:
 #ifdef WITNESS
 		witness_assert(&sx->lock_object, what, file, line);
 #else
@@ -880,31 +872,31 @@
 
 		if (!(sx->sx_lock & SX_LOCK_SHARED)) {
 			if (sx_recursed(sx)) {
-				if (what & SX_NOTRECURSED)
+				if (what & SA_NOTRECURSED)
 					panic("Lock %s recursed @ %s:%d\n",
 					    sx->lock_object.lo_name, file,
 					    line);
-			} else if (what & SX_RECURSED)
+			} else if (what & SA_RECURSED)
 				panic("Lock %s not recursed @ %s:%d\n",
 				    sx->lock_object.lo_name, file, line);
 		}
 #endif
 		break;
-	case SX_XLOCKED:
-	case SX_XLOCKED | SX_NOTRECURSED:
-	case SX_XLOCKED | SX_RECURSED:
+	case SA_XLOCKED:
+	case SA_XLOCKED | SA_NOTRECURSED:
+	case SA_XLOCKED | SA_RECURSED:
 		if (sx_xholder(sx) != curthread)
 			panic("Lock %s not exclusively locked @ %s:%d\n",
 			    sx->lock_object.lo_name, file, line);
 		if (sx_recursed(sx)) {
-			if (what & SX_NOTRECURSED)
+			if (what & SA_NOTRECURSED)
 				panic("Lock %s recursed @ %s:%d\n",
 				    sx->lock_object.lo_name, file, line);
-		} else if (what & SX_RECURSED)
+		} else if (what & SA_RECURSED)
 			panic("Lock %s not recursed @ %s:%d\n",
 			    sx->lock_object.lo_name, file, line);
 		break;
-	case SX_UNLOCKED:
+	case SA_UNLOCKED:
 #ifdef WITNESS
 		witness_assert(&sx->lock_object, what, file, line);
 #else

==== //depot/projects/mjexp/sys/kern/uipc_syscalls.c#12 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.255 2007/05/16 20:41:08 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.256 2007/05/19 20:50:59 andre Exp $");
 
 #include "opt_sctp.h"
 #include "opt_compat.h"
@@ -1819,8 +1819,8 @@
 	struct mbuf *m = NULL;
 	struct sf_buf *sf;
 	struct vm_page *pg;
-	off_t off, xfsize, sbytes = 0, rem = 0;
-	int error, mnw = 0;
+	off_t off, xfsize, fsbytes = 0, sbytes = 0, rem = 0;
+	int error, hdrlen = 0, mnw = 0;
 	int vfslocked;
 
 	NET_LOCK_GIANT();
@@ -1916,6 +1916,7 @@
 				error = mnw ? EAGAIN : ENOBUFS;
 				goto out;
 			}
+			hdrlen = m_length(m, NULL);
 		}
 	}
 
@@ -1933,7 +1934,7 @@
 	 * The outer loop checks the state and available space of the socket
 	 * and takes care of the overall progress.
 	 */
-	for (off = uap->offset; ; ) {
+	for (off = uap->offset, rem = uap->nbytes; ; ) {
 		int loopbytes = 0;
 		int space = 0;
 		int done = 0;
@@ -1998,6 +1999,13 @@
 		SOCKBUF_UNLOCK(&so->so_snd);
 
 		/*
+		 * Reduce space in the socket buffer by the size of
+		 * the header mbuf chain.
+		 * hdrlen is set to 0 after the first loop.
+		 */
+		space -= hdrlen;
+
+		/*
 		 * Loop and construct maximum sized mbuf chain to be bulk
 		 * dumped into socket buffer.
 		 */
@@ -2015,12 +2023,12 @@
 			pgoff = (vm_offset_t)(off & PAGE_MASK);
 			xfsize = omin(PAGE_SIZE - pgoff,
 			    obj->un_pager.vnp.vnp_size - uap->offset -
-			    sbytes - loopbytes);
+			    fsbytes - loopbytes);
 			if (uap->nbytes)
-				rem = (uap->nbytes - sbytes - loopbytes);
+				rem = (uap->nbytes - fsbytes - loopbytes);
 			else
-				rem = obj->un_pager.vnp.vnp_size - uap->offset -
-				    sbytes - loopbytes;
+				rem = obj->un_pager.vnp.vnp_size -
+				    uap->offset - fsbytes - loopbytes;
 			xfsize = omin(rem, xfsize);
 			if (xfsize <= 0) {
 				VM_OBJECT_UNLOCK(obj);
@@ -2038,9 +2046,8 @@
 			}
 
 			/*
-			 * Attempt to look up the page.
-			 * Allocate if not found or
-			 * wait and loop if busy.
+			 * Attempt to look up the page.  Allocate
+			 * if not found or wait and loop if busy.
 			 */
 			pindex = OFF_TO_IDX(off);
 			pg = vm_page_grab(obj, pindex, VM_ALLOC_NOBUSY |
@@ -2161,7 +2168,7 @@
 
 		/* Add the buffer chain to the socket buffer. */
 		if (m != NULL) {
-			int mlen;
+			int mlen, err;
 
 			mlen = m_length(m, NULL);
 			SOCKBUF_LOCK(&so->so_snd);
@@ -2171,10 +2178,27 @@
 				goto done;
 			}
 			SOCKBUF_UNLOCK(&so->so_snd);
-			error = (*so->so_proto->pr_usrreqs->pru_send)
+			/* Avoid error aliasing. */
+			err = (*so->so_proto->pr_usrreqs->pru_send)
 				    (so, 0, m, NULL, NULL, td);
-			if (!error)
+			if (err == 0) {
+				/*
+				 * We need two counters to get the
+				 * file offset and nbytes to send
+				 * right:
+				 * - sbytes contains the total amount
+				 *   of bytes sent, including headers.
+				 * - fsbytes contains the total amount
+				 *   of bytes sent from the file.
+				 */
 				sbytes += mlen;
+				fsbytes += mlen;
+				if (hdrlen) {
+					fsbytes -= hdrlen;
+					hdrlen = 0;
+				}
+			} else if (error == 0)
+				error = err;
 			m = NULL;	/* pru_send always consumes */
 		}
 

==== //depot/projects/mjexp/sys/net/if_lagg.c#5 (text+ko) ====

@@ -1078,8 +1078,6 @@
 	m = (*sc->sc_input)(sc, lp, m);
 
 	if (m != NULL) {
-		ifp->if_ipackets++;
-		ifp->if_ibytes += m->m_pkthdr.len;
 		trifp->if_ipackets++;
 		trifp->if_ibytes += m->m_pkthdr.len;
 	}
@@ -1271,17 +1269,7 @@
 {
 	int error = 0;
 
-	/* Send mbuf */
-	IFQ_ENQUEUE(&ifp->if_snd, m, error);
-	if (error)
-		return (error);
-	if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0)
-		(*ifp->if_start)(ifp);
-
-	ifp->if_obytes += m->m_pkthdr.len;
-	if (m->m_flags & M_MCAST)
-		ifp->if_omcasts++;
-
+	IFQ_HANDOFF(ifp, m, error);
 	return (error);
 }
 

==== //depot/projects/mjexp/sys/sparc64/include/smp.h#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sparc64/include/smp.h,v 1.20 2007/05/19 05:01:43 kan Exp $
+ * $FreeBSD: src/sys/sparc64/include/smp.h,v 1.21 2007/05/20 14:49:01 marius Exp $
  */
 
 #ifndef	_MACHINE_SMP_H_
@@ -42,6 +42,8 @@
 #define	IDR_BUSY	(1<<0)
 #define	IDR_NACK	(1<<1)
 
+#define	IDC_ITID_SHIFT			14
+
 #define	IPI_AST		PIL_AST
 #define	IPI_RENDEZVOUS	PIL_RENDEZVOUS
 #define	IPI_STOP	PIL_STOP
@@ -79,7 +81,6 @@
 void	cpu_mp_shutdown(void);
 
 void	cpu_ipi_selected(u_int cpus, u_long d0, u_long d1, u_long d2);
-void	cpu_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2);
 
 void	ipi_selected(u_int cpus, u_int ipi);
 void	ipi_all(u_int ipi);
@@ -220,36 +221,42 @@
 static __inline void *
 ipi_dcache_page_inval(void *func, vm_paddr_t pa)
 {
+
 	return (NULL);
 }
 
 static __inline void *
 ipi_icache_page_inval(void *func, vm_paddr_t pa)
 {
+
 	return (NULL);
 }
 
 static __inline void *
 ipi_tlb_context_demap(struct pmap *pm)
 {
+
 	return (NULL);
 }
 
 static __inline void *
 ipi_tlb_page_demap(struct pmap *pm, vm_offset_t va)
 {
+
 	return (NULL);
 }
 
 static __inline void *
 ipi_tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end)
 {
+
 	return (NULL);
 }
 
 static __inline void
 ipi_wait(void *cookie)
 {
+
 }
 
 #endif /* SMP */

==== //depot/projects/mjexp/sys/sparc64/include/ver.h#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sparc64/include/ver.h,v 1.5 2004/12/24 16:21:46 scottl Exp $
+ * $FreeBSD: src/sys/sparc64/include/ver.h,v 1.6 2007/05/20 13:47:36 marius Exp $
  */
 
 #ifndef	_MACHINE_VER_H_
@@ -62,13 +62,16 @@
 extern char sparc64_model[];
 
 /* Known implementations. */
-#define	CPU_IMPL_SPARC64	0x01
-#define	CPU_IMPL_ULTRASPARCI	0x10
-#define	CPU_IMPL_ULTRASPARCII	0x11
-#define	CPU_IMPL_ULTRASPARCIIi	0x12
-#define	CPU_IMPL_ULTRASPARCIIe	0x13
-#define	CPU_IMPL_ULTRASPARCIII	0x14
-#define	CPU_IMPL_ULTRASPARCIIIp	0x15
-#define	CPU_IMPL_ULTRASPARCIIIi	0x16
+#define	CPU_IMPL_SPARC64		0x01
+#define	CPU_IMPL_ULTRASPARCI		0x10
+#define	CPU_IMPL_ULTRASPARCII		0x11
+#define	CPU_IMPL_ULTRASPARCIIi		0x12
+#define	CPU_IMPL_ULTRASPARCIIe		0x13
+#define	CPU_IMPL_ULTRASPARCIII		0x14
+#define	CPU_IMPL_ULTRASPARCIIIp		0x15
+#define	CPU_IMPL_ULTRASPARCIIIi		0x16
+#define	CPU_IMPL_ULTRASPARCIV		0x18
+#define	CPU_IMPL_ULTRASPARCIVp		0x19
+#define	CPU_IMPL_ULTRASPARCIIIip	0x22
 
 #endif /* !_MACHINE_VER_H_ */

==== //depot/projects/mjexp/sys/sparc64/pci/ofw_pcibus.c#4 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/pci/ofw_pcibus.c,v 1.12 2007/01/08 01:08:24 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/pci/ofw_pcibus.c,v 1.13 2007/05/20 13:06:44 marius Exp $");
 
 #include "opt_ofw_pci.h"
 
@@ -48,8 +48,8 @@
 #include <machine/bus_common.h>
 #ifndef SUN4V
 #include <machine/cache.h>
+#include <machine/iommureg.h>
 #endif
-#include <machine/iommureg.h>
 #include <machine/resource.h>
 
 #include <dev/pci/pcireg.h>
@@ -162,8 +162,8 @@
 	    (clnsz / 4) * 4 == clnsz, ("bogus cache line size %d", clnsz));
 	PCIB_WRITE_CONFIG(bridge, busno, slot, func, PCIR_CACHELNSZ,
 	    clnsz / 4, 1);
+#endif
 
-#endif
 	/*
 	 * The preset in the intline register is usually wrong. Reset it to 255,
 	 * so that the PCI code will reroute the interrupt if needed.

==== //depot/projects/mjexp/sys/sparc64/sparc64/identcpu.c#3 (text+ko) ====

@@ -5,9 +5,11 @@
  *
  * As long as the above copyright statement and this notice remain
  * unchanged, you can do what ever you want with this file.
- *
- * $FreeBSD: src/sys/sparc64/sparc64/identcpu.c,v 1.16 2006/11/18 07:10:51 kmacy Exp $
  */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/identcpu.c,v 1.17 2007/05/20 13:47:36 marius Exp $");
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -25,9 +27,7 @@
 SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
     cpu_model, 0, "Machine model");
 
-#ifndef SUN4V
 int cpu_impl;
-#endif
 
 void setPQL2(int *const size, int *const ways);
 
@@ -88,6 +88,15 @@
 	case CPU_IMPL_ULTRASPARCIIIi:
 		impls = "UltraSparc-IIIi";
 		break;
+	case CPU_IMPL_ULTRASPARCIV:
+		impls = "UltraSparc-IV";
+		break;
+	case CPU_IMPL_ULTRASPARCIVp:
+		impls = "UltraSparc-IV+";
+		break;
+	case CPU_IMPL_ULTRASPARCIIIip:
+		impls = "UltraSparc-IIIi+";
+		break;
 	default:
 		impls = NULL;
 		break;

==== //depot/projects/mjexp/sys/sparc64/sparc64/mem.c#3 (text+ko) ====

@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/mem.c,v 1.17 2006/11/18 07:10:51 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/mem.c,v 1.18 2007/05/20 13:06:45 marius Exp $");
 
 /*
  * Memory special file
@@ -70,7 +70,9 @@
 #include <vm/pmap.h>
 #include <vm/vm_extern.h>
 
+#ifndef SUN4V
 #include <machine/cache.h>
+#endif
 #include <machine/md_var.h>
 #include <machine/pmap.h>
 #include <machine/tlb.h>
@@ -94,9 +96,6 @@
 	vm_page_t m;
 	int error;
 	int i;
-#ifndef SUN4V
-	int color;
-#endif
 
 	cnt = 0;
 	error = 0;
@@ -136,16 +135,20 @@
 			}
 
 			if (m != NULL) {
-				if (ova == 0) {
+#ifndef SUN4V
+				if (ova == 0)
 					ova = kmem_alloc_wait(kernel_map,
 					    PAGE_SIZE * DCACHE_COLORS);
-				}
-#ifndef SUN4V
-				if ((color = m->md.color) != -1)
-					va = ova + color * PAGE_SIZE;
+				if (m->md.color != -1)
+					va = ova + m->md.color * PAGE_SIZE;
 				else
+					va = ova;
+#else
+				if (ova == 0)
+					ova = kmem_alloc_wait(kernel_map,
+					    PAGE_SIZE);
+				va = ova;
 #endif
-					va = ova;
 				pmap_qenter(va, &m, 1);
 				error = uiomove((void *)(va + off), cnt,
 				    uio);
@@ -182,7 +185,11 @@
 		/* else panic! */
 	}
 	if (ova != 0)
+#ifndef SUN4V
 		kmem_free_wakeup(kernel_map, ova, PAGE_SIZE * DCACHE_COLORS);
+#else
+		kmem_free_wakeup(kernel_map, ova, PAGE_SIZE);
+#endif
 	return (error);
 }
 

==== //depot/projects/mjexp/sys/sparc64/sparc64/mp_machdep.c#2 (text+ko) ====

@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/mp_machdep.c,v 1.33 2006/09/03 21:20:21 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/mp_machdep.c,v 1.34 2007/05/20 14:49:01 marius Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,8 +93,8 @@
 
 /*
  * Argument area used to pass data to non-boot processors as they start up.
- * This must be statically initialized with a known invalid upa module id,
- * since the other processors will use it before the boot cpu enters the
+ * This must be statically initialized with a known invalid CPU module ID,
+ * since the other processors will use it before the boot CPU enters the
  * kernel.
  */
 struct	cpu_start_args cpu_start_args = { 0, -1, -1, 0, 0 };
@@ -106,12 +106,14 @@
 
 vm_offset_t mp_tramp;
 
-u_int	mp_boot_mid;
-
 static u_int		cpuid_to_mid[MAXCPU];
 static volatile u_int	shutdown_cpus;
 
-void cpu_mp_unleash(void *);
+static void cpu_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2);
+static void cpu_mp_unleash(void *v);
+static void sun4u_startcpu(phandle_t cpu, void *func, u_long arg);
+static void sun4u_stopself(void);
+
 SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL);
 
 vm_offset_t
@@ -123,7 +125,7 @@
 
 	v = OF_claim(NULL, PAGE_SIZE, PAGE_SIZE);
 	if (v == NULL)
-		panic("mp_tramp_alloc");
+		panic("%s", __func__);
 	bcopy(mp_tramp_code, v, mp_tramp_code_len);
 	*(u_long *)(v + mp_tramp_tlb_slots) = kernel_tlb_slots;
 	*(u_long *)(v + mp_tramp_func) = (u_long)mp_startup;
@@ -139,18 +141,17 @@
 }
 
 /*
- * Probe for other cpus.
+ * Probe for other CPUs.
  */
 void
 cpu_mp_setmaxid(void)
 {
+	char buf[128];
 	phandle_t child;
 	phandle_t root;
-	char buf[128];
 	int cpus;
 
-	all_cpus = 1 << PCPU_GET(cpuid);
-	mp_boot_mid = PCPU_GET(mid);
+	all_cpus = 1 << curcpu;
 	mp_ncpus = 1;
 
 	cpus = 0;
@@ -212,7 +213,7 @@
 	};
 
 	openfirmware_exit(&args);
-	panic("sun4u_stopself: failed.");
+	panic("%s: failed.", __func__);
 }
 
 /*
@@ -221,16 +222,16 @@
 void
 cpu_mp_start(void)
 {
+	char buf[128];
 	volatile struct cpu_start_args *csa;
 	struct pcpu *pc;
+	register_t s;
+	vm_offset_t va;
 	phandle_t child;
 	phandle_t root;
-	vm_offset_t va;
-	char buf[128];
 	u_int clock;
+	u_int mid;
 	int cpuid;
-	u_int mid;
-	u_long s;
 
 	mtx_init(&ipi_mtx, "ipi", NULL, MTX_SPIN);
 
@@ -239,7 +240,7 @@
 	    -1, NULL, NULL);
 	intr_setup(PIL_STOP, cpu_ipi_stop, -1, NULL, NULL);
 
-	cpuid_to_mid[PCPU_GET(cpuid)] = mp_boot_mid;
+	cpuid_to_mid[curcpu] = PCPU_GET(mid);
 
 	root = OF_peer(0);
 	csa = &cpu_start_args;
@@ -249,12 +250,12 @@
 			continue;
 		if (OF_getprop(child, "upa-portid", &mid, sizeof(mid)) <= 0 &&
 		    OF_getprop(child, "portid", &mid, sizeof(mid)) <= 0)
-			panic("cpu_mp_start: can't get module id");
-		if (mid == mp_boot_mid)
+			panic("%s: can't get module ID", __func__);
+		if (mid == PCPU_GET(mid))
 			continue;
 		if (OF_getprop(child, "clock-frequency", &clock,
 		    sizeof(clock)) <= 0)
-			panic("cpu_mp_start: can't get clock");
+			panic("%s: can't get clock", __func__);
 
 		csa->csa_state = 0;
 		sun4u_startcpu(child, (void *)mp_tramp, 0);
@@ -281,25 +282,26 @@
 
 		all_cpus |= 1 << cpuid;
 	}
-	PCPU_SET(other_cpus, all_cpus & ~(1 << PCPU_GET(cpuid)));
+	PCPU_SET(other_cpus, all_cpus & ~(1 << curcpu));
 	smp_active = 1;
 }
 
 void
 cpu_mp_announce(void)
 {
+
 }
 
-void
+static void
 cpu_mp_unleash(void *v)
 {
 	volatile struct cpu_start_args *csa;
 	struct pcpu *pc;
+	register_t s;
 	vm_offset_t va;
 	vm_paddr_t pa;
 	u_int ctx_min;
 	u_int ctx_inc;
-	u_long s;
 	int i;
 
 	ctx_min = TLB_CTX_USER_MIN;
@@ -312,17 +314,17 @@
 		pc->pc_tlb_ctx_max = ctx_min + ctx_inc;
 		ctx_min += ctx_inc;
 
-		if (pc->pc_cpuid == PCPU_GET(cpuid))
+		if (pc->pc_cpuid == curcpu)
 			continue;
 		KASSERT(pc->pc_idlethread != NULL,
-		    ("cpu_mp_unleash: idlethread"));
-		pc->pc_curthread = pc->pc_idlethread;	
+		    ("%s: idlethread", __func__));
+		pc->pc_curthread = pc->pc_idlethread;
 		pc->pc_curpcb = pc->pc_curthread->td_pcb;
 		for (i = 0; i < PCPU_PAGES; i++) {
 			va = pc->pc_addr + i * PAGE_SIZE;
 			pa = pmap_kextract(va);
 			if (pa == 0)
-				panic("cpu_mp_unleash: pmap_kextract\n");
+				panic("%s: pmap_kextract", __func__);
 			csa->csa_ttes[i].tte_vpn = TV_VPN(va, TS_8K);
 			csa->csa_ttes[i].tte_data = TD_V | TD_8K | TD_PA(pa) |
 			    TD_L | TD_CP | TD_CV | TD_P | TD_W;
@@ -337,7 +339,7 @@
 	}
 
 	membar(StoreLoad);
-	csa->csa_count = 0; 
+	csa->csa_count = 0;
 	smp_started = 1;
 }
 
@@ -352,9 +354,9 @@
 	tick_start();
 
 	smp_cpus++;
-	KASSERT(curthread != NULL, ("cpu_mp_bootstrap: curthread"));
-	PCPU_SET(other_cpus, all_cpus & ~(1 << PCPU_GET(cpuid)));
-	printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
+	KASSERT(curthread != NULL, ("%s: curthread", __func__));
+	PCPU_SET(other_cpus, all_cpus & ~(1 << curcpu));
+	printf("SMP: AP CPU #%d Launched!\n", curcpu);
 
 	csa->csa_count--;
 	membar(StoreLoad);
@@ -394,14 +396,15 @@
 static void
 cpu_ipi_ast(struct trapframe *tf)
 {
+
 }
 
 static void
 cpu_ipi_stop(struct trapframe *tf)
 {
 
-	CTR1(KTR_SMP, "cpu_ipi_stop: stopped %d", PCPU_GET(cpuid));
-	savectx(&stoppcbs[PCPU_GET(cpuid)]);
+	CTR2(KTR_SMP, "%s: stopped %d", __func__, curcpu);
+	savectx(&stoppcbs[curcpu]);
 	atomic_set_acq_int(&stopped_cpus, PCPU_GET(cpumask));
 	while ((started_cpus & PCPU_GET(cpumask)) == 0) {
 		if ((shutdown_cpus & PCPU_GET(cpumask)) != 0) {
@@ -411,7 +414,7 @@
 	}
 	atomic_clear_rel_int(&started_cpus, PCPU_GET(cpumask));
 	atomic_clear_rel_int(&stopped_cpus, PCPU_GET(cpumask));
-	CTR1(KTR_SMP, "cpu_ipi_stop: restarted %d", PCPU_GET(cpuid));
+	CTR2(KTR_SMP, "%s: restarted %d", __func__, curcpu);
 }
 
 void
@@ -426,21 +429,22 @@
 	}
 }
 
-void
+static void
 cpu_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2)
 {
+	register_t s;
 	u_long ids;
-	u_long s;
 	int i;
 
 	KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_BUSY) == 0,
-	    ("cpu_ipi_send: outstanding dispatch"));
+	    ("%s: outstanding dispatch", __func__));
 	for (i = 0; i < IPI_RETRIES; i++) {
 		s = intr_disable();
 		stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0);
 		stxa(AA_SDB_INTR_D1, ASI_SDB_INTR_W, d1);
 		stxa(AA_SDB_INTR_D2, ASI_SDB_INTR_W, d2);
-		stxa(AA_INTR_SEND | (mid << 14), ASI_SDB_INTR_W, 0);
+		stxa(AA_INTR_SEND | (mid << IDC_ITID_SHIFT),
+		    ASI_SDB_INTR_W, 0);
 		/*
 		 * Workaround for SpitFire erratum #54; do a dummy read
 		 * from a SDB internal register before the MEMBAR #Sync
@@ -451,7 +455,8 @@
 		membar(Sync);
 		(void)ldxa(AA_SDB_CNTL_HIGH, ASI_SDB_CONTROL_R);
 		membar(Sync);
-		while ((ids = ldxa(0, ASI_INTR_DISPATCH_STATUS)) & IDR_BUSY)
+		while (((ids = ldxa(0, ASI_INTR_DISPATCH_STATUS)) &
+		    IDR_BUSY) != 0)
 			;
 		intr_restore(s);
 		if ((ids & IDR_NACK) == 0)
@@ -468,25 +473,29 @@
 	    kdb_active ||
 #endif
 	    panicstr != NULL)
-		printf("cpu_ipi_send: couldn't send ipi to module %u\n", mid);
+		printf("%s: couldn't send IPI to module 0x%u\n",
+		    __func__, mid);
 	else
-		panic("cpu_ipi_send: couldn't send ipi");
+		panic("%s: couldn't send IPI", __func__);
 }
 
 void
 ipi_selected(u_int cpus, u_int ipi)
 {
+
 	cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi);
 }
 
 void
 ipi_all(u_int ipi)
 {
-	panic("ipi_all");
+
+	panic("%s", __func__);
 }
 
 void
 ipi_all_but_self(u_int ipi)
 {
+
 	cpu_ipi_selected(PCPU_GET(other_cpus), 0, (u_long)tl_ipi_level, ipi);
 }

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


More information about the p4-projects mailing list