PERFORCE change 59774 for review

Robert Watson rwatson at FreeBSD.org
Sun Aug 15 19:45:17 PDT 2004


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

Change 59774 by rwatson at rwatson_paprika on 2004/08/16 02:44:45

	Integrate netperf_socket from FreeBSD CVS:
	
	More VM locking.
	KQueue locking (yehaw!).
	Linux emulation timeval bits broken out from FreeBSD bits.
	Less sio on sparc64.  More hme on non-sparc64.
	USB tweaks.
	pfs_exit() fix to not hold mutex over vgone().
	pfind() no longer returns PRS_NEW processes.
	kdb_stop_cpus sysctl.
	More pipe optimization.
	Loop back UNIX domain socket comments from rwatson_netperf.
	MP_WATCHDOG.

Affected files ...

.. //depot/projects/netperf_socket/sys/alpha/alpha/pmap.c#17 integrate
.. //depot/projects/netperf_socket/sys/cam/scsi/scsi_target.c#4 integrate
.. //depot/projects/netperf_socket/sys/compat/linux/linux_misc.c#6 integrate
.. //depot/projects/netperf_socket/sys/compat/linux/linux_util.h#2 integrate
.. //depot/projects/netperf_socket/sys/conf/NOTES#35 integrate
.. //depot/projects/netperf_socket/sys/conf/files.i386#26 integrate
.. //depot/projects/netperf_socket/sys/conf/files.sparc64#9 integrate
.. //depot/projects/netperf_socket/sys/conf/kmod.mk#13 integrate
.. //depot/projects/netperf_socket/sys/conf/options.i386#4 integrate
.. //depot/projects/netperf_socket/sys/dev/exca/exca.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/exca/excavar.h#2 integrate
.. //depot/projects/netperf_socket/sys/dev/fdc/fdc.c#8 integrate
.. //depot/projects/netperf_socket/sys/dev/hme/if_hme_pci.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/mii/mii.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_bus_isa.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu.h#3 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_alpha.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_amd64.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_i386.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_ia64.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_pc98.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_sparc64.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/if_axe.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ubser.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/udbp.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ufm.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ugen.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uhid.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uhub.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ukbd.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ulpt.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/umass.c#10 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/ums.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/urio.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/usb_port.h#2 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/usb_subr.c#9 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/usbdi.h#3 integrate
.. //depot/projects/netperf_socket/sys/dev/usb/uscanner.c#6 integrate
.. //depot/projects/netperf_socket/sys/fs/fifofs/fifo_vnops.c#11 integrate
.. //depot/projects/netperf_socket/sys/fs/pseudofs/pseudofs_vncache.c#3 integrate
.. //depot/projects/netperf_socket/sys/geom/mirror/g_mirror.c#6 integrate
.. //depot/projects/netperf_socket/sys/gnu/ext2fs/ext2_vnops.c#5 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/mp_machdep.c#6 integrate
.. //depot/projects/netperf_socket/sys/i386/i386/mp_watchdog.c#1 branch
.. //depot/projects/netperf_socket/sys/i386/include/mp_watchdog.h#1 branch
.. //depot/projects/netperf_socket/sys/kern/init_main.c#7 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_conf.c#8 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_descrip.c#16 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_event.c#10 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_exec.c#14 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_exit.c#18 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_fork.c#16 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_proc.c#15 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_shutdown.c#13 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_sig.c#19 integrate
.. //depot/projects/netperf_socket/sys/kern/subr_kdb.c#5 integrate
.. //depot/projects/netperf_socket/sys/kern/sys_pipe.c#7 integrate
.. //depot/projects/netperf_socket/sys/kern/tty.c#14 integrate
.. //depot/projects/netperf_socket/sys/kern/tty_cons.c#6 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#37 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_socket2.c#22 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_syscalls.c#25 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_usrreq.c#23 integrate
.. //depot/projects/netperf_socket/sys/kern/vfs_aio.c#7 integrate
.. //depot/projects/netperf_socket/sys/kern/vfs_subr.c#20 integrate
.. //depot/projects/netperf_socket/sys/kern/vfs_vnops.c#10 integrate
.. //depot/projects/netperf_socket/sys/modules/Makefile#16 integrate
.. //depot/projects/netperf_socket/sys/modules/hme/Makefile#3 integrate
.. //depot/projects/netperf_socket/sys/modules/uart/Makefile#6 integrate
.. //depot/projects/netperf_socket/sys/net/bpf.c#11 integrate
.. //depot/projects/netperf_socket/sys/net/if.c#16 integrate
.. //depot/projects/netperf_socket/sys/net/if_var.h#19 integrate
.. //depot/projects/netperf_socket/sys/net/if_vlan.c#13 integrate
.. //depot/projects/netperf_socket/sys/pci/if_dc.c#10 integrate
.. //depot/projects/netperf_socket/sys/sparc64/include/ofw_machdep.h#2 integrate
.. //depot/projects/netperf_socket/sys/sparc64/pci/ofw_pcibus.c#3 integrate
.. //depot/projects/netperf_socket/sys/sparc64/sparc64/mem.c#7 integrate
.. //depot/projects/netperf_socket/sys/sparc64/sparc64/ofw_machdep.c#5 integrate
.. //depot/projects/netperf_socket/sys/sparc64/sparc64/uio_machdep.c#5 integrate
.. //depot/projects/netperf_socket/sys/sys/event.h#4 integrate
.. //depot/projects/netperf_socket/sys/sys/eventvar.h#3 integrate
.. //depot/projects/netperf_socket/sys/sys/filedesc.h#4 integrate
.. //depot/projects/netperf_socket/sys/sys/proc.h#22 integrate
.. //depot/projects/netperf_socket/sys/sys/selinfo.h#3 integrate
.. //depot/projects/netperf_socket/sys/sys/vnode.h#10 integrate
.. //depot/projects/netperf_socket/sys/ufs/ffs/ffs_vnops.c#7 integrate
.. //depot/projects/netperf_socket/sys/ufs/ufs/ufs_acl.c#3 integrate
.. //depot/projects/netperf_socket/sys/ufs/ufs/ufs_vnops.c#6 integrate
.. //depot/projects/netperf_socket/sys/vm/vm_map.c#20 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/alpha/alpha/pmap.c#17 (text+ko) ====

@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.165 2004/08/04 18:04:43 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.166 2004/08/15 20:54:25 alc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2173,7 +2173,7 @@
 /*
  * this routine is used to modify bits in ptes
  */
-static void
+static __inline void
 pmap_changebit(vm_page_t m, int bit, boolean_t setem)
 {
 	pv_entry_t pv;
@@ -2410,7 +2410,7 @@
 pmap_emulate_reference(struct vmspace *vm, vm_offset_t v, int user, int write)
 {
 	pmap_t pmap;
-	pt_entry_t faultoff, *pte;
+	pt_entry_t *pte;
 
 	/*
 	 * Convert process and virtual address to physical address.
@@ -2427,32 +2427,15 @@
 		PMAP_LOCK(pmap);
 		pte = pmap_lev3pte(pmap, v);
 	}
-#ifdef DEBUG				/* These checks are more expensive */
-	if (!pmap_pte_v(pte))
-		panic("pmap_emulate_reference: invalid pte");
-#if 0
+
 	/*
-	 * Can't do these, because cpu_fork and cpu_swapin call
-	 * pmap_emulate_reference(), and the bits aren't guaranteed,
-	 * for them...
+	 * Another CPU can modify the pmap between the emulation trap and this
+	 * CPU locking the pmap.  As a result, the pte may be inconsistent
+	 * with the access that caused the emulation trap.  In such cases,
+	 * invalidate this CPU's TLB entry and return.
 	 */
-	if (write) {
-		if (!(*pte & (user ? PG_UWE : PG_UWE | PG_KWE)))
-			panic("pmap_emulate_reference: write but unwritable");
-		if (!(*pte & PG_FOW))
-			panic("pmap_emulate_reference: write but not FOW");
-	} else {
-		if (!(*pte & (user ? PG_URE : PG_URE | PG_KRE)))
-			panic("pmap_emulate_reference: !write but unreadable");
-		if (!(*pte & (PG_FOR | PG_FOE)))
-			panic("pmap_emulate_reference: !write but not FOR|FOE");
-	}
-#endif
-	/* Other diagnostics? */
-#endif
-	KASSERT((*pte & PG_MANAGED) != 0,
-	    ("pmap_emulate_reference(%p, 0x%lx, %d, %d): pa 0x%lx not managed",
-	    curthread, v, user, write, pmap_pte_pa(pte)));
+	if (!pmap_pte_v(pte))
+		goto tbis;
 
 	/*
 	 * Twiddle the appropriate bits to reflect the reference
@@ -2463,12 +2446,19 @@
 	 *	(2) if it was a write fault, mark page as modified.
 	 */
 	if (write) {
-		faultoff = PG_FOR | PG_FOE | PG_FOW;
+		if (!(*pte & (user ? PG_UWE : PG_UWE | PG_KWE)))
+			goto tbis;
+		if (!(*pte & PG_FOW))
+			goto tbis;
+		*pte &= ~(PG_FOR | PG_FOE | PG_FOW);
 	} else {
-		faultoff = PG_FOR | PG_FOE;
+		if (!(*pte & (user ? PG_URE : PG_URE | PG_KRE)))
+			goto tbis;
+		if (!(*pte & (PG_FOR | PG_FOE)))
+			goto tbis;
+		*pte &= ~(PG_FOR | PG_FOE);
 	}
-
-	*pte = (*pte & ~faultoff);
+tbis:
 	ALPHA_TBIS(v);
 	PMAP_UNLOCK(pmap);
 }

==== //depot/projects/netperf_socket/sys/cam/scsi/scsi_target.c#4 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_target.c,v 1.62 2004/06/17 17:16:40 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_target.c,v 1.63 2004/08/15 06:24:40 jmg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -196,6 +196,7 @@
 	TAILQ_INIT(&softc->work_queue);
 	TAILQ_INIT(&softc->abort_queue);
 	TAILQ_INIT(&softc->user_ccb_queue);
+	knlist_init(&softc->read_select.si_note, &softc->mtx);
 
 	return (0);
 }
@@ -336,9 +337,7 @@
 	softc = (struct targ_softc *)dev->si_drv1;
 	kn->kn_hook = (caddr_t)softc;
 	kn->kn_fop = &targread_filtops;
-	TARG_LOCK(softc);
-	SLIST_INSERT_HEAD(&softc->read_select.si_note, kn, kn_selnext);
-	TARG_UNLOCK(softc);
+	knlist_add(&softc->read_select.si_note, kn, 0);
 	return (0);
 }
 
@@ -348,9 +347,7 @@
 	struct  targ_softc *softc;
 
 	softc = (struct targ_softc *)kn->kn_hook;
-	TARG_LOCK(softc);
-	SLIST_REMOVE(&softc->read_select.si_note, kn, knote, kn_selnext);
-	TARG_UNLOCK(softc);
+	knlist_remove(&softc->read_select.si_note, kn, 0);
 }
 
 /* Notify the user's kqueue when the user queue or abort queue gets a CCB */
@@ -361,10 +358,8 @@
 	int	retval;
 
 	softc = (struct targ_softc *)kn->kn_hook;
-	TARG_LOCK(softc);
 	retval = !TAILQ_EMPTY(&softc->user_ccb_queue) ||
 		 !TAILQ_EMPTY(&softc->abort_queue);
-	TARG_UNLOCK(softc);
 	return (retval);
 }
 
@@ -1096,19 +1091,8 @@
 
 	/* If we aborted anything from the work queue, wakeup user. */
 	if (!TAILQ_EMPTY(&softc->user_ccb_queue)
-	 || !TAILQ_EMPTY(&softc->abort_queue)) {
-		/*
-		 * XXX KNOTE calls back into targreadfilt, causing a
-		 * lock recursion.  So unlock around calls to it although
-		 * this may open up a race allowing a user to submit
-		 * another CCB after we have aborted all pending ones
-		 * A better approach is to mark the softc as dying
-		 * under lock and check for this in targstart().
-		 */
-		TARG_UNLOCK(softc);
+	 || !TAILQ_EMPTY(&softc->abort_queue))
 		notify_user(softc);
-		TARG_LOCK(softc);
-	}
 }
 
 /* Notify the user that data is ready */
@@ -1120,7 +1104,7 @@
 	 * blocking read().
 	 */
 	selwakeuppri(&softc->read_select, PRIBIO);
-	KNOTE(&softc->read_select.si_note, 0);
+	KNOTE_LOCKED(&softc->read_select.si_note, 0);
 	wakeup(&softc->user_ccb_queue);
 }
 

==== //depot/projects/netperf_socket/sys/compat/linux/linux_misc.c#6 (text+ko) ====

@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2002 Doug Rabson
  * Copyright (c) 1994-1995 Søren Schmidt
  * All rights reserved.
  *
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.155 2004/07/26 07:24:01 cperciva Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.157 2004/08/15 12:34:15 tjr Exp $");
 
 #include "opt_mac.h"
 
@@ -487,6 +488,7 @@
 int
 linux_select(struct thread *td, struct linux_select_args *args)
 {
+	l_timeval ltv;
 	struct timeval tv0, tv1, utv, *tvp;
 	int error;
 
@@ -502,8 +504,10 @@
 	 * time left.
 	 */
 	if (args->timeout) {
-		if ((error = copyin(args->timeout, &utv, sizeof(utv))))
+		if ((error = copyin(args->timeout, &ltv, sizeof(ltv))))
 			goto select_out;
+		utv.tv_sec = ltv.tv_sec;
+		utv.tv_usec = ltv.tv_usec;
 #ifdef DEBUG
 		if (ldebug(select))
 			printf(LMSG("incoming timeout (%ld/%ld)"),
@@ -566,7 +570,9 @@
 			printf(LMSG("outgoing timeout (%ld/%ld)"),
 			    utv.tv_sec, utv.tv_usec);
 #endif
-		if ((error = copyout(&utv, args->timeout, sizeof(utv))))
+		ltv.tv_sec = utv.tv_sec;
+		ltv.tv_usec = utv.tv_usec;
+		if ((error = copyout(&ltv, args->timeout, sizeof(ltv))))
 			goto select_out;
 	}
 
@@ -913,50 +919,102 @@
 	return 0;
 }
 
-/*
- * Wrappers for get/setitimer for debugging..
- */
+struct l_itimerval {
+	l_timeval it_interval;
+	l_timeval it_value;
+};
+
 int
-linux_setitimer(struct thread *td, struct linux_setitimer_args *args)
+linux_setitimer(struct thread *td, struct linux_setitimer_args *uap)
 {
-	struct setitimer_args bsa;
-	struct itimerval foo;
 	int error;
+	caddr_t sg;
+	struct l_itimerval *lp, *lop, ls;
+	struct itimerval *p = NULL, *op = NULL, s;
 
 #ifdef DEBUG
 	if (ldebug(setitimer))
 		printf(ARGS(setitimer, "%p, %p"),
 		    (void *)args->itv, (void *)args->oitv);
 #endif
-	bsa.which = args->which;
-	bsa.itv = (struct itimerval *)args->itv;
-	bsa.oitv = (struct itimerval *)args->oitv;
-	if (args->itv) {
-	    if ((error = copyin(args->itv, &foo, sizeof(foo))))
-		return error;
+	lp = uap->itv;
+	if (lp != NULL) {
+		sg = stackgap_init();
+		p = stackgap_alloc(&sg, sizeof(struct itimerval));
+		uap->itv = (struct l_itimerval *)p;
+		error = copyin(lp, &ls, sizeof(ls));
+		if (error != 0)
+			return (error);
+		s.it_interval.tv_sec = ls.it_interval.tv_sec;
+		s.it_interval.tv_usec = ls.it_interval.tv_usec;
+		s.it_value.tv_sec = ls.it_value.tv_sec;
+		s.it_value.tv_usec = ls.it_value.tv_usec;
+		error = copyout(&s, p, sizeof(s));
+		if (error != 0)
+			return (error);
 #ifdef DEBUG
-	    if (ldebug(setitimer)) {
-		printf("setitimer: value: sec: %ld, usec: %ld\n",
-		    foo.it_value.tv_sec, foo.it_value.tv_usec);
-		printf("setitimer: interval: sec: %ld, usec: %ld\n",
-		    foo.it_interval.tv_sec, foo.it_interval.tv_usec);
-	    }
+		if (ldebug(setitimer)) {
+			printf("setitimer: value: sec: %ld, usec: %ld\n",
+			    s.it_value.tv_sec, s.it_value.tv_usec);
+			printf("setitimer: interval: sec: %ld, usec: %ld\n",
+			    s.it_interval.tv_sec, s.it_interval.tv_usec);
+		}
 #endif
 	}
-	return setitimer(td, &bsa);
+	lop = uap->oitv;
+	if (lop != NULL) {
+		sg = stackgap_init();
+		op = stackgap_alloc(&sg, sizeof(struct itimerval));
+		uap->oitv = (struct l_itimerval *)op;
+	}
+	error = setitimer(td, (struct setitimer_args *) uap);
+	if (error != 0)
+		return (error);
+	if (lop != NULL) {
+		error = copyin(op, &s, sizeof(s));
+		if (error != 0)
+			return (error);
+		ls.it_interval.tv_sec = s.it_interval.tv_sec;
+		ls.it_interval.tv_usec = s.it_interval.tv_usec;
+		ls.it_value.tv_sec = s.it_value.tv_sec;
+		ls.it_value.tv_usec = s.it_value.tv_usec;
+		error = copyout(&ls, lop, sizeof(ls));
+	}
+	return (error);
 }
 
 int
-linux_getitimer(struct thread *td, struct linux_getitimer_args *args)
+linux_getitimer(struct thread *td, struct linux_getitimer_args *uap)
 {
-	struct getitimer_args bsa;
+	int error;
+	caddr_t sg;
+	struct l_itimerval *lp, ls;
+	struct itimerval *p = NULL, s;
+
 #ifdef DEBUG
 	if (ldebug(getitimer))
 		printf(ARGS(getitimer, "%p"), (void *)args->itv);
 #endif
-	bsa.which = args->which;
-	bsa.itv = (struct itimerval *)args->itv;
-	return getitimer(td, &bsa);
+	lp = uap->itv;
+	if (lp != NULL) {
+		sg = stackgap_init();
+		p = stackgap_alloc(&sg, sizeof(struct itimerval));
+		uap->itv = (struct l_itimerval *)p;
+	}
+	error = getitimer(td, (struct getitimer_args *) uap);
+	if (error != 0)
+		return (error);
+	if (lp != NULL) {
+		error = copyin(p, &s, sizeof(s));
+		if (error != 0)
+			return (error);
+		ls.it_interval.tv_sec = s.it_interval.tv_sec;
+		ls.it_interval.tv_usec = s.it_interval.tv_usec;
+		ls.it_value.tv_sec = s.it_value.tv_sec;
+		ls.it_value.tv_usec = s.it_value.tv_usec;
+		error = copyout(&ls, lp, sizeof(ls));
+	}
+	return (error);
 }
 
 #ifndef __alpha__

==== //depot/projects/netperf_socket/sys/compat/linux/linux_util.h#2 (text+ko) ====

@@ -28,7 +28,7 @@
  *
  * from: svr4_util.h,v 1.5 1994/11/18 02:54:31 christos Exp
  * from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp
- * $FreeBSD: src/sys/compat/linux/linux_util.h,v 1.21 2003/01/02 02:19:10 alfred Exp $
+ * $FreeBSD: src/sys/compat/linux/linux_util.h,v 1.22 2004/08/15 11:52:45 tjr Exp $
  */
 
 /*
@@ -53,11 +53,12 @@
 static __inline void *stackgap_alloc(caddr_t *, size_t);
 
 #define szsigcode (*(curthread->td_proc->p_sysent->sv_szsigcode))
+#define psstrings (curthread->td_proc->p_sysent->sv_psstrings)
 
 static __inline caddr_t
 stackgap_init()
 {
-	return (caddr_t)(PS_STRINGS - szsigcode - SPARE_USRSPACE);
+	return (caddr_t)(psstrings - szsigcode - SPARE_USRSPACE);
 }
 
 static __inline void *
@@ -68,7 +69,7 @@
 	void *p = (void *) *sgp;
 
 	sz = ALIGN(sz);
-	if (*sgp + sz > (caddr_t)(PS_STRINGS - szsigcode))
+	if (*sgp + sz > (caddr_t)(psstrings - szsigcode))
 		return NULL;
 	*sgp += sz;
 	return p;

==== //depot/projects/netperf_socket/sys/conf/NOTES#35 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1259 2004/08/14 15:32:18 dwmalone Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1260 2004/08/14 22:38:50 marius Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -1631,6 +1631,7 @@
 # fxp:  Intel EtherExpress Pro/100B
 #	(hint of prefer_iomap can be done to prefer I/O instead of Mem mapping)
 # gx:   Intel Pro/1000 Gigabit Ethernet (82542, 82543-F, 82543-T)
+# hme:  Sun HME (Happy Meal Ethernet)
 # lge:	Support for PCI gigabit ethernet adapters based on the Level 1
 #	LXT1001 NetCellerator chipset. This includes the D-Link DGE-500SX,
 #	SMC TigerCard 1000 (SMC9462SX), and some Addtron cards.
@@ -1732,6 +1733,7 @@
 device		dc		# DEC/Intel 21143 and various workalikes
 device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)
 hint.fxp.0.prefer_iomap="0"
+device		hme		# Sun HME (Happy Meal Ethernet)
 device		my		# Myson Fast Ethernet (MTD80X, MTD89X)
 device		rl		# RealTek 8129/8139
 device		pcn		# AMD Am79C97x PCI 10/100 NICs

==== //depot/projects/netperf_socket/sys/conf/files.i386#26 (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.i386,v 1.502 2004/08/04 20:49:43 markm Exp $
+# $FreeBSD: src/sys/conf/files.i386,v 1.503 2004/08/15 18:02:09 rwatson Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -234,6 +234,7 @@
 i386/i386/mem.c			optional	mem
 i386/i386/mp_clock.c		optional	smp
 i386/i386/mp_machdep.c		optional	smp
+i386/i386/mp_watchdog.c		optional	mp_watchdog smp
 i386/i386/mpboot.s		optional	smp
 i386/i386/mptable.c		optional	apic
 i386/i386/mptable_pci.c		optional	apic pci

==== //depot/projects/netperf_socket/sys/conf/files.sparc64#9 (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.sparc64,v 1.57 2004/08/12 17:41:29 marius Exp $
+# $FreeBSD: src/sys/conf/files.sparc64,v 1.59 2004/08/15 22:59:34 marius Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -23,8 +23,6 @@
 dev/ofw/openfirm.c		standard
 dev/ofw/openfirmio.c		standard
 dev/ofw/openpromio.c		standard
-dev/sio/sio.c			optional	sio
-dev/sio/sio_isa.c		optional	sio isa
 dev/syscons/scgfbrndr.c		optional	sc
 dev/syscons/schistory.c		optional	sc
 dev/syscons/scmouse.c		optional	sc
@@ -53,14 +51,16 @@
 sparc64/fhc/fhc_central.c	optional	fhc central
 sparc64/fhc/fhc_nexus.c		optional	fhc
 sparc64/isa/isa.c		optional	isa
-sparc64/isa/ofw_isa.c		optional	ebus
-sparc64/isa/ofw_isa.c		optional	isa
+#sparc64/isa/ofw_isa.c		optional	ebus
+#sparc64/isa/ofw_isa.c		optional	isa
+sparc64/isa/ofw_isa.c		standard
 sparc64/pci/apb.c		optional	pci
 sparc64/pci/ofw_pci.c		optional	pci
 sparc64/pci/ofw_pcib.c		optional	pci
 sparc64/pci/ofw_pcib_subr.c	optional	pci
 sparc64/pci/ofw_pcibus.c	optional	pci
-sparc64/pci/ofw_pci_if.m	optional	pci
+#sparc64/pci/ofw_pci_if.m	optional	pci
+sparc64/pci/ofw_pci_if.m	standard
 sparc64/pci/psycho.c		optional	pci
 sparc64/sbus/sbus.c		optional	sbus
 sparc64/sparc64/autoconf.c	standard

==== //depot/projects/netperf_socket/sys/conf/kmod.mk#13 (text+ko) ====

@@ -1,5 +1,5 @@
 #	From: @(#)bsd.prog.mk	5.26 (Berkeley) 6/25/91
-# $FreeBSD: src/sys/conf/kmod.mk,v 1.165 2004/08/13 14:30:26 ru Exp $
+# $FreeBSD: src/sys/conf/kmod.mk,v 1.166 2004/08/14 23:53:04 marius Exp $
 #
 # The include file <bsd.kmod.mk> handles installing Kernel Loadable Device
 # drivers (KLD's).
@@ -299,7 +299,8 @@
     dev/pci/pcib_if.m dev/ppbus/ppbus_if.m dev/smbus/smbus_if.m \
     dev/usb/usb_if.m dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \
     dev/sound/pcm/feeder_if.m dev/sound/pcm/mixer_if.m pci/agp_if.m \
-    opencrypto/crypto_if.m pc98/pc98/canbus_if.m dev/uart/uart_if.m
+    opencrypto/crypto_if.m pc98/pc98/canbus_if.m dev/uart/uart_if.m \
+    sparc64/pci/ofw_pci_if.m
 
 .for _srcsrc in ${MFILES}
 .for _ext in c h

==== //depot/projects/netperf_socket/sys/conf/options.i386#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options.i386,v 1.212 2004/03/14 23:03:56 imp Exp $
+# $FreeBSD: src/sys/conf/options.i386,v 1.213 2004/08/15 18:02:09 rwatson Exp $
 # Options specific to the i386 platform kernels
 
 AUTO_EOI_1		opt_auto_eoi.h
@@ -15,6 +15,7 @@
 POWERFAIL_NMI		opt_trap.h
 PPC_DEBUG		opt_ppc.h
 PPC_PROBE_CHIPSET	opt_ppc.h
+MP_WATCHDOG		opt_mp_watchdog.h
 
 # Options for emulators.  These should only be used at config time, so
 # they are handled like options for static filesystems

==== //depot/projects/netperf_socket/sys/dev/exca/exca.c#2 (text+ko) ====

@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/exca/exca.c,v 1.15 2003/10/07 04:29:04 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/exca/exca.c,v 1.17 2004/08/16 01:57:06 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -195,7 +195,8 @@
 	exca_putb(sc, map->sysmem_stop_msb,
 	    (((mem->addr + mem->realsize - 1) >>
 	    (EXCA_SYSMEM_ADDRX_SHIFT + 8)) &
-	    EXCA_SYSMEM_ADDRX_STOP_MSB_ADDR_MASK));
+	    EXCA_SYSMEM_ADDRX_STOP_MSB_ADDR_MASK) |
+	    EXCA_SYSMEM_ADDRX_STOP_MSB_WAIT2);
 
 	exca_putb(sc, map->sysmem_win,
 	    (mem->addr >> EXCA_MEMREG_WIN_SHIFT) & 0xff);
@@ -208,14 +209,14 @@
 	    ((mem->kind == PCCARD_A_MEM_ATTR) ?
 	    EXCA_CARDMEM_ADDRX_MSB_REGACTIVE_ATTR : 0));
 
-	exca_setb(sc, EXCA_ADDRWIN_ENABLE, map->memenable);
 #ifdef EXCA_DEBUG
 	if (mem->kind == PCCARD_A_MEM_ATTR)
 		printf("attribtue memory\n");
 	else
 		printf("common memory\n");
 #endif
-	exca_setb(sc, EXCA_ADDRWIN_ENABLE, EXCA_ADDRWIN_ENABLE_MEMCS16);
+	exca_setb(sc, EXCA_ADDRWIN_ENABLE, map->memenable |
+	    EXCA_ADDRWIN_ENABLE_MEMCS16);
 
 	DELAY(100);
 #ifdef EXCA_DEBUG
@@ -228,8 +229,8 @@
 		r5 = exca_getb(sc, map->cardmem_msb);
 		r6 = exca_getb(sc, map->cardmem_lsb);
 		r7 = exca_getb(sc, map->sysmem_win);
-		printf("exca_do_mem_map window %d: %02x%02x %02x%02x "
-		    "%02x%02x %02x (%08x+%08x.%08x*%08x)\n",
+		printf("exca_do_mem_map win %d: %02x%02x %02x%02x "
+		    "%02x%02x %02x (%08x+%06x.%06x*%06x)\n",
 		    win, r1, r2, r3, r4, r5, r6, r7,
 		    mem->addr, mem->size, mem->realsize,
 		    mem->cardaddr);
@@ -824,6 +825,73 @@
 	    type, rid, res));
 }
 
+#if 0
+static struct resource *
+exca_alloc_resource(struct exca_softc *sc, device_t child, int type, int *rid,
+    u_long start, u_long end, u_long count, uint flags)
+{
+	struct resource *res = NULL;
+	int tmp;
+
+	switch (type) {
+	case SYS_RES_MEMORY:
+		if (start < cbb_start_mem)
+			start = cbb_start_mem;
+		if (end < start)
+			end = start;
+		flags = (flags & ~RF_ALIGNMENT_MASK) |
+		    rman_make_alignment_flags(CBB_MEMALIGN);
+		break;
+	case SYS_RES_IOPORT:
+		if (start < cbb_start_16_io)
+			start = cbb_start_16_io;
+		if (end < start)
+			end = start;
+		break;
+	case SYS_RES_IRQ:
+		tmp = rman_get_start(sc->irq_res);
+		if (start > tmp || end < tmp || count != 1) {
+			device_printf(child, "requested interrupt %ld-%ld,"
+			    "count = %ld not supported by cbb\n",
+			    start, end, count);
+			return (NULL);
+		}
+		flags |= RF_SHAREABLE;
+		start = end = rman_get_start(sc->irq_res);
+		break;
+	}
+	res = BUS_ALLOC_RESOURCE(up, child, type, rid,
+	    start, end, count, flags & ~RF_ACTIVE);
+	if (res == NULL)
+		return (NULL);
+	cbb_insert_res(sc, res, type, *rid);
+	if (flags & RF_ACTIVE) {
+		if (bus_activate_resource(child, type, *rid, res) != 0) {
+			bus_release_resource(child, type, *rid, res);
+			return (NULL);
+		}
+	}
+
+	return (res);
+}
+
+static int
+exca_release_resource(struct exca_softc *sc, device_t child, int type,
+    int rid, struct resource *res)
+{
+	int error;
+
+	if (rman_get_flags(res) & RF_ACTIVE) {
+		error = bus_deactivate_resource(child, type, rid, res);
+		if (error != 0)
+			return (error);
+	}
+	cbb_remove_res(sc, res);
+	return (BUS_RELEASE_RESOURCE(device_get_parent(brdev), child,
+	    type, rid, res));
+}
+#endif
+
 static int
 exca_modevent(module_t mod, int cmd, void *arg)
 {

==== //depot/projects/netperf_socket/sys/dev/exca/excavar.h#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/exca/excavar.h,v 1.5 2003/06/07 20:46:39 imp Exp $ */
+/* $FreeBSD: src/sys/dev/exca/excavar.h,v 1.6 2004/08/15 23:17:54 imp Exp $ */
 
 /*
  * Copyright (c) 2002 M Warner Losh.  All rights reserved.
@@ -77,8 +77,7 @@
 #define EXCA_SOCKET_PRESENT	0x00000001
 #define EXCA_HAS_MEMREG_WIN	0x00000002
 #define EXCA_CARD_OK		0x00000004
-#define	EXCA_KTHREAD_RUNNING	0x00000008
-#define	EXCA_KTHREAD_DONE	0x00000010
+#define EXCA_EVENT		0x80000000
 	uint32_t	offset;
 	int		chipset;
 #define EXCA_CARDBUS	0
@@ -99,10 +98,8 @@
 #define EXCA_BOGUS	-1		/* Invalid/not present/etc */
 	exca_getb_fn	*getb;
 	exca_putb_fn	*putb;
-	struct proc	*event_thread;
-	struct mtx	mtx;
-	struct cv	cv;
 	device_t	pccarddev;
+	uint32_t	status;		/* status, hw dependent */
 };
 
 void exca_init(struct exca_softc *sc, device_t dev, 

==== //depot/projects/netperf_socket/sys/dev/fdc/fdc.c#8 (text+ko) ====

@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/fdc/fdc.c,v 1.282 2004/07/17 10:05:56 nyan Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/fdc/fdc.c,v 1.283 2004/08/14 21:40:28 phk Exp $");
 
 #include "opt_fdc.h"
 
@@ -253,10 +253,6 @@
 static void fdc_reset(fdc_p);
 static int fd_in(struct fdc_data *, int *);
 static int out_fdc(struct fdc_data *, int);
-/*
- * The open function is named fdopen() to avoid confusion with fdopen()
- * in fd(4).  The difference is now only meaningful for debuggers.
- */
 static	d_open_t	fdopen;
 static	d_close_t	fdclose;
 static	d_strategy_t	fdstrategy;

==== //depot/projects/netperf_socket/sys/dev/hme/if_hme_pci.c#5 (text+ko) ====

@@ -25,11 +25,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	from: NetBSD: if_hme_pci.c,v 1.7 2001/10/05 17:49:43 thorpej Exp
+ *	from: NetBSD: if_hme_pci.c,v 1.14 2004/03/17 08:58:23 martin Exp
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hme/if_hme_pci.c,v 1.14 2004/08/12 20:37:02 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hme/if_hme_pci.c,v 1.15 2004/08/14 22:38:20 marius Exp $");
 
 /*
  * PCI front-end device driver for the HME ethernet device.
@@ -44,8 +44,10 @@
 #include <sys/socket.h>
 
 #include <machine/bus.h>
+#if defined(__powerpc__) || defined(__sparc64__)
 #include <dev/ofw/openfirm.h>
 #include <machine/ofw_machdep.h>
+#endif
 #include <machine/resource.h>
 
 #include <sys/rman.h>
@@ -116,12 +118,16 @@
 MODULE_DEPEND(hme, pci, 1, 1, 1);
 MODULE_DEPEND(hme, ether, 1, 1, 1);
 
+#define	PCI_VENDOR_SUN			0x108e
+#define	PCI_PRODUCT_SUN_EBUS		0x1000
+#define	PCI_PRODUCT_SUN_HMENETWORK	0x1001
+
 int
 hme_pci_probe(device_t dev)
 {
 
-	if (pci_get_vendor(dev) == 0x108e &&
-	    pci_get_device(dev) ==  0x1001) {
+	if (pci_get_vendor(dev) == PCI_VENDOR_SUN &&
+	    pci_get_device(dev) ==  PCI_PRODUCT_SUN_HMENETWORK) {
 		device_set_desc(dev, "Sun HME 10/100 Ethernet");
 		return (0);
 	}
@@ -134,6 +140,40 @@
 	struct hme_pci_softc *hsc = device_get_softc(dev);
 	struct hme_softc *sc = &hsc->hsc_hme;
 	int error = 0;
+#if !(defined(__powerpc__) || defined(__sparc64__))
+	device_t *children, ebus_dev;
+	struct resource *ebus_rres;
+	bus_space_handle_t romh;
+	bus_space_tag_t romt;
+	int dataoff, ebus_rrid, slot, vpdoff;
+	int i, nchildren;
+	uint8_t buf[32];
+	static const uint8_t promhdr[] = { 0x55, 0xaa };
+#define	PROMHDR_PTR_DATA	0x18
+	static const uint8_t promdat[] = {
+		0x50, 0x43, 0x49, 0x52,	/* "PCIR" */
+		PCI_VENDOR_SUN & 0xff, PCI_VENDOR_SUN >> 8,
+		PCI_PRODUCT_SUN_HMENETWORK & 0xff,
+		PCI_PRODUCT_SUN_HMENETWORK >> 8
+	};
+#define	PROMDATA_PTR_VPD	0x08
+#define	PROMDATA_DATA2		0x0a
+	static const uint8_t promdat2[] = {
+		0x18, 0x00,		/* structure length */
+		0x00,			/* structure revision */
+		0x00,			/* interface revision */
+		PCIS_NETWORK_ETHERNET,	/* subclass code */
+		PCIC_NETWORK		/* class code */
+	};
+#define	PCI_VPDRES_ISLARGE(x)			((x) & 0x80)
+#define	PCI_VPDRES_LARGE_NAME(x)		((x) & 0x7f)
+#define	PCI_VPDRES_TYPE_VPD			0x10	/* large */
+	struct pci_vpd {
+		 uint8_t	vpd_key0;
+		 uint8_t	vpd_key1;
+		 uint8_t	vpd_len;
+	} *vpd;
+#endif
 
 	pci_enable_busmaster(dev);
 	/*
@@ -186,7 +226,116 @@
 	bus_space_subregion(hsc->hsc_memt, hsc->hsc_memh, 0x7000, 0x1000,
 	    &sc->sc_mifh);
 
+#if defined(__powerpc__) || defined(__sparc64__)
 	OF_getetheraddr(dev, sc->sc_arpcom.ac_enaddr);
+#else
+	/*
+	 * Dig out VPD (vital product data) and read NA (network address).
+	 *
+	 * The PCI HME is a PCIO chip, which is composed of two functions:
+	 *	function 0: PCI-EBus2 bridge, and
+	 *	function 1: HappyMeal Ethernet controller.
+	 *
+	 * The VPD of HME resides in the Boot PROM (PCI FCode) attached
+	 * to the EBus bridge and can't be accessed via the PCI capability
+	 * pointer.
+	 * ``Writing FCode 3.x Programs'' (newer ones, dated 1997 and later)
+	 * chapter 2 describes the data structure.
+	 *
+	 * We don't have a MI EBus driver since no EBus device exists
+	 * (besides the FCode PROM) on add-on HME boards. The ``no driver
+	 * attached'' message for function 0 therefore is what is expected.
+	 */
+
+	/* Search accompanying EBus bridge. */
+	slot = pci_get_slot(dev);
+	if (device_get_children(device_get_parent(dev), &children,
+	    &nchildren) != 0) {
+		device_printf(dev, "could not get children\n");
+		error = ENXIO;
+		goto fail_sres;
+	}
+	ebus_dev = NULL;
+	for (i = 0; i < nchildren; i++) {
+		if (pci_get_class(children[i]) == PCIC_BRIDGE &&
+		    pci_get_vendor(children[i]) == PCI_VENDOR_SUN &&
+		    pci_get_device(children[i]) ==  PCI_PRODUCT_SUN_EBUS &&
+		    pci_get_slot(children[i]) == slot) {
+			ebus_dev = children[i];
+			break;
+		}
+	}
+	if (ebus_dev == NULL) {
+		device_printf(dev, "could not find EBus bridge\n");
+		error = ENXIO;
+		goto fail_children;
+	}
+
+	/* Map EBus bridge PROM registers. */
+#define	PCI_EBUS2_BOOTROM	0x10
+	ebus_rrid = PCI_EBUS2_BOOTROM;
+	if ((ebus_rres = bus_alloc_resource_any(ebus_dev, SYS_RES_MEMORY,
+	    &ebus_rrid, RF_ACTIVE)) == NULL) {
+		device_printf(dev, "could not map PROM registers\n");
+		error = ENXIO;
+		goto fail_children;
+	}
+	romt = rman_get_bustag(ebus_rres);
+	romh = rman_get_bushandle(ebus_rres);
+
+	/* Read PCI expansion PROM header. */
+	bus_space_read_region_1(romt, romh, 0, buf, sizeof(buf));
+	if (memcmp(buf, promhdr, sizeof(promhdr)) != 0 ||
+	    (dataoff = (buf[PROMHDR_PTR_DATA] |
+	    (buf[PROMHDR_PTR_DATA + 1] << 8))) < 0x1c) {
+		device_printf(dev, "unexpected PCI expansion PROM header\n");
+		error = ENXIO;
+		goto fail_rres;
+	}
+
+	/* Read PCI expansion PROM data. */
+	bus_space_read_region_1(romt, romh, dataoff, buf, sizeof(buf));
+	if (memcmp(buf, promdat, sizeof(promdat)) != 0 ||
+	    memcmp(buf + PROMDATA_DATA2, promdat2, sizeof(promdat2)) != 0 ||
+	    (vpdoff = (buf[PROMDATA_PTR_VPD] |
+	    (buf[PROMDATA_PTR_VPD + 1] << 8))) < 0x1c) {
+		device_printf(dev, "unexpected PCI expansion PROM data\n");
+		error = ENXIO;
+		goto fail_rres;
+	}
+
+	/*
+	 * Read PCI VPD.
+	 * The VPD of HME is not in PCI 2.2 standard format. The length in
+	 * the resource header is in big endian, and resources are not
+	 * properly terminated (only one resource and no end tag).
+	 */
+	bus_space_read_region_1(romt, romh, vpdoff, buf, sizeof(buf));
+	vpd = (void *)(buf + 3);
+	if (PCI_VPDRES_ISLARGE(buf[0]) == 0 ||
+	    PCI_VPDRES_LARGE_NAME(buf[0]) != PCI_VPDRES_TYPE_VPD ||
+	    /* buf[1] != 0 || buf[2] != 9 || */ /*len*/
+	    vpd->vpd_key0 != 0x4e /* N */ ||
+	    vpd->vpd_key1 != 0x41 /* A */ ||
+	    vpd->vpd_len != ETHER_ADDR_LEN) {
+		device_printf(dev, "unexpected PCI VPD\n");
+		error = ENXIO;
+		goto fail_rres;
+	}
+	if (buf + 6 == NULL) {
+		device_printf(dev, "could not read network address\n");
+		error = ENXIO;
+		goto fail_rres;
+	}
+	bcopy(buf + 6, sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN);
+
+fail_rres:
+	bus_release_resource(ebus_dev, SYS_RES_MEMORY, ebus_rrid, ebus_rres);
+fail_children:
+	free(children, M_TEMP);
+	if (error != 0)
+		goto fail_sres;
+#endif

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


More information about the p4-projects mailing list