PERFORCE change 105902 for review

Robert Watson rwatson at FreeBSD.org
Sat Sep 9 10:24:18 PDT 2006


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

Change 105902 by rwatson at rwatson_zoo on 2006/09/09 17:23:46

	Integrate TrustedBSD priv branch from TrustedBSD base branch.  For
	a detailed list of changes in this merge, see @105901.

Affected files ...

.. //depot/projects/trustedbsd/priv/sys/amd64/amd64/local_apic.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/amd64/amd64/machdep.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/amd64/linux32/linux32_sysvec.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/arm/at91/at91_twi.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/arm/at91/if_atereg.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/boot/i386/pxeldr/pxeldr.S#2 integrate
.. //depot/projects/trustedbsd/priv/sys/compat/freebsd32/freebsd32_proto.h#3 integrate
.. //depot/projects/trustedbsd/priv/sys/compat/freebsd32/freebsd32_syscall.h#3 integrate
.. //depot/projects/trustedbsd/priv/sys/compat/freebsd32/freebsd32_syscalls.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/compat/freebsd32/freebsd32_sysent.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/compat/freebsd32/syscalls.master#3 integrate
.. //depot/projects/trustedbsd/priv/sys/compat/linux/linux_futex.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/conf/files.amd64#2 integrate
.. //depot/projects/trustedbsd/priv/sys/contrib/pf/net/pf_ioctl.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/aic7xxx/aic7xxx_osm.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/bge/if_bge.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/bge/if_bgereg.h#3 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/drmP.h#3 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/drm_drv.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/drm_pciids.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/i915_dma.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/i915_drm.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/i915_drv.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/i915_irq.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/mach64_drm.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/radeon_cp.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/radeon_drm.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/radeon_drv.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/drm/radeon_state.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/em/if_em.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/em/if_em.h#3 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/fdc/fdc.c#4 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/ic/nec765.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/if_ndis/if_ndis_usb.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/iicbus/iic.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/mfi/mfi.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/mfi/mfireg.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/mpt/mpt.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/mpt/mpt.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/mpt/mpt_cam.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/mpt/mpt_pci.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/puc/pucdata.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/re/if_re.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/sound/usb/uaudio.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ehci.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ehci_pci.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ehcivar.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/hid.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_aue.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_axe.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_cdce.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_cue.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_kue.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_rue.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_udav.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_udavreg.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_ural.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/if_uralvar.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/kue_fw.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ohci.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ohcivar.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/sl811hs.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/sl811hsvar.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ubsa.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ubser.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ucom.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ucomvar.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/udbp.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ufm.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ufoma.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uftdi.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ugen.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uhci.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uhcivar.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uhid.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uhub.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ukbd.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ulpt.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/umass.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/umct.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/umodem.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/ums.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uplcom.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/urio.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usb.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usb.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usb_ethersubr.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usb_mem.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usb_port.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usb_quirks.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usb_subr.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usbdi.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usbdi.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usbdi_util.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usbdi_util.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/usbdivar.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uscanner.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uvisor.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/usb/uvscom.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/dev/vge/if_vge.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/geom/gate/g_gate.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/geom/gate/g_gate.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/geom/nop/g_nop.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/geom/nop/g_nop.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/i386/acpica/Makefile#2 integrate
.. //depot/projects/trustedbsd/priv/sys/i386/i386/local_apic.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/i386/i386/machdep.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/i386/i386/sys_machdep.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/i386/linux/linux_sysvec.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/kern/kern_ktr.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/kern/kern_umtx.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/kern/uipc_sockbuf.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/kern/vfs_aio.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/kern/vfs_subr.c#4 integrate
.. //depot/projects/trustedbsd/priv/sys/modules/Makefile#4 integrate
.. //depot/projects/trustedbsd/priv/sys/modules/agp/Makefile#2 integrate
.. //depot/projects/trustedbsd/priv/sys/modules/sound/sound/Makefile#2 integrate
.. //depot/projects/trustedbsd/priv/sys/net/bpf.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/net/if.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/net/if.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/net/if_var.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/in_pcb.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/ip_output.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/raw_ip.c#4 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/tcp_input.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/tcp_output.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/tcp_subr.c#4 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/tcp_timer.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/tcp_timer.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/tcp_var.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet/udp_usrreq.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet6/icmp6.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet6/ip6_forward.c#2 integrate
.. //depot/projects/trustedbsd/priv/sys/netinet6/udp6_usrreq.c#4 integrate
.. //depot/projects/trustedbsd/priv/sys/pc98/cbus/fdc.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/security/audit/audit.c#4 integrate
.. //depot/projects/trustedbsd/priv/sys/security/audit/audit.h#3 integrate
.. //depot/projects/trustedbsd/priv/sys/security/audit/audit_bsm.c#3 integrate
.. //depot/projects/trustedbsd/priv/sys/sys/mbuf.h#2 integrate
.. //depot/projects/trustedbsd/priv/sys/sys/param.h#3 integrate

Differences ...

==== //depot/projects/trustedbsd/priv/sys/amd64/amd64/local_apic.c#2 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.26 2006/07/12 21:22:42 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.28 2006/09/06 22:05:34 sobomax Exp $");
 
 #include "opt_hwpmc_hooks.h"
 
@@ -613,6 +613,18 @@
 	/* Send EOI first thing. */
 	lapic_eoi();
 
+#ifdef SMP
+	/*
+	 * Don't do any accounting for the disabled HTT cores, since it
+	 * will provide misleading numbers for the userland.
+	 *
+	 * No locking is necessary here, since even if we loose the race
+	 * when hlt_cpus_mask changes it is not a big deal, really.
+	 */
+	if ((hlt_cpus_mask & (1 << PCPU_GET(cpuid))) != 0)
+		return;
+#endif
+
 	/* Look up our local APIC structure for the tick counters. */
 	la = &lapics[PCPU_GET(apic_id)];
 	(*la->la_timer_count)++;

==== //depot/projects/trustedbsd/priv/sys/amd64/amd64/machdep.c#2 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.651 2006/07/27 19:47:22 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.652 2006/09/07 15:03:02 jhb Exp $");
 
 #include "opt_atalk.h"
 #include "opt_atpic.h"
@@ -160,8 +160,10 @@
 long Maxmem = 0;
 long realmem = 0;
 
-vm_paddr_t phys_avail[20];
-vm_paddr_t dump_avail[20];
+#define PHYSMAP_SIZE	(2 * 30)
+
+vm_paddr_t phys_avail[PHYSMAP_SIZE + 2];
+vm_paddr_t dump_avail[PHYSMAP_SIZE + 2];
 
 /* must be 2 less so 0 0 can signal end of chunks */
 #define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(phys_avail[0])) - 2)
@@ -832,8 +834,6 @@
 }
 #endif
 
-#define PHYSMAP_SIZE	(2 * 20)
-
 u_int basemem;
 
 /*

==== //depot/projects/trustedbsd/priv/sys/amd64/linux32/linux32_sysvec.c#2 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_sysvec.c,v 1.23 2006/08/17 21:06:48 netchild Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_sysvec.c,v 1.24 2006/09/09 16:25:25 netchild Exp $");
 #include "opt_compat.h"
 
 #ifndef COMPAT_IA32
@@ -124,7 +124,7 @@
 static void	linux32_fixlimits(struct proc *p);
 
 extern LIST_HEAD(futex_list, futex) futex_list;
-extern struct mtx futex_mtx;
+extern struct sx futex_sx;
 
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
@@ -1080,7 +1080,7 @@
 			sx_init(&emul_lock, "emuldata lock");
 			sx_init(&emul_shared_lock, "emuldata->shared lock");
 			LIST_INIT(&futex_list);
-			mtx_init(&futex_mtx, "futex protection lock", NULL, MTX_DEF);
+			sx_init(&futex_sx, "futex protection lock");
 			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,
 			      NULL, 1000);
 			linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, linux_schedtail,
@@ -1110,7 +1110,7 @@
 				linux_device_unregister_handler(*ldhp);
 			sx_destroy(&emul_lock);
 			sx_destroy(&emul_shared_lock);
-			mtx_destroy(&futex_mtx);
+			sx_destroy(&futex_sx);
 			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
 			EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);
 			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);

==== //depot/projects/trustedbsd/priv/sys/arm/at91/at91_twi.c#2 (text) ====

@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/at91_twi.c,v 1.3 2006/07/14 22:40:24 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/at91_twi.c,v 1.4 2006/09/07 21:53:28 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -128,20 +128,16 @@
 	sc->cwgr = TWI_CWGR_CKDIV(8 * AT91C_MASTER_CLOCK / 90000) |
 	    TWI_CWGR_CHDIV(TWI_CWGR_DIV(TWI_DEF_CLK)) |
 	    TWI_CWGR_CLDIV(TWI_CWGR_DIV(TWI_DEF_CLK));
-
 	WR4(sc, TWI_CR, TWI_CR_SWRST);
 	WR4(sc, TWI_CR, TWI_CR_MSEN | TWI_CR_SVDIS);
 	WR4(sc, TWI_CWGR, sc->cwgr);
-
 	WR4(sc, TWI_IER, TWI_SR_RXRDY | TWI_SR_OVRE | TWI_SR_UNRE |
 	    TWI_SR_NACK);
 
 	if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL)
 		device_printf(dev, "could not allocate iicbus instance\n");
-
 	/* probe and attach the iicbus */
 	bus_generic_attach(dev);
-
 out:;
 	if (err)
 		at91_twi_deactivate(dev);
@@ -228,12 +224,15 @@
 }
 
 static int
-at91_twi_wait_stop_done(struct at91_twi_softc *sc)
+at91_twi_wait(struct at91_twi_softc *sc, uint32_t bit)
 {
 	int err = 0;
+	int counter = 10000;
 
-	while (!(RD4(sc, TWI_SR) & TWI_SR_TXCOMP))
+	while (!(RD4(sc, TWI_SR) & bit) && counter-- != 0)
 		continue;
+	if (counter == 0)
+		err = EIO;
 	return (err);
 }
 
@@ -252,7 +251,7 @@
 	sc = device_get_softc(dev);
 	if (sc->sc_started) {
 		WR4(sc, TWI_CR, TWI_CR_STOP);
-		err = at91_twi_wait_stop_done(sc);
+		err = at91_twi_wait(sc, TWI_SR_TXCOMP);
 	}
 	return (err);
 }
@@ -345,7 +344,7 @@
 	if (!last)
 		goto errout;
 	WR4(sc, TWI_CR, TWI_CR_STOP);
-	err = at91_twi_wait_stop_done(sc);
+	err = at91_twi_wait(sc, TWI_SR_TXCOMP);
 	*walker = RD4(sc, TWI_RHR) & 0xff;
 	if (read)
 		*read = walker - buf;
@@ -419,6 +418,53 @@
 	return (error);
 }
 
+static int
+at91_twi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
+{
+	struct at91_twi_softc *sc;
+	int i, len;
+	uint32_t rdwr;
+	uint8_t *buf;
+
+	sc = device_get_softc(dev);
+	for (i = 0; i < nmsgs; i++) {
+		/*
+		 * The linux atmel driver doesn't use the internal device
+		 * address feature of twi.  A separate i2c message needs to
+		 * be written to use this.
+		 * See http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
+		 * for details.
+		 */
+		rdwr = (msgs[i].flags & IIC_M_RD) ? TWI_MMR_MREAD : 0;
+		WR4(sc, TWI_MMR, TWI_MMR_DADR(msgs[i].slave) | rdwr);
+		len = msgs[i].len;
+		buf = msgs[i].buf;
+		if (len != 0 || buf == NULL)
+			return EINVAL;
+		WR4(sc, TWI_CR, TWI_CR_START);
+		if (msgs[i].flags & IIC_M_RD) {
+			while (len--) {
+				if (len == 0)
+					WR4(sc, TWI_CR, TWI_CR_STOP);
+				if (!at91_twi_wait(sc, TWI_SR_RXRDY))
+					return EIO;
+				*buf++ = RD4(sc, TWI_RHR) & 0xff;
+			}
+		} else {
+			while (len--) {
+				WR4(sc, TWI_THR, *buf++);
+				if (len == 0)
+					WR4(sc, TWI_CR, TWI_CR_STOP);
+				if (!at91_twi_wait(sc, TWI_SR_TXRDY))
+					return EIO;
+			}
+		}
+		if (!at91_twi_wait(sc, TWI_SR_TXCOMP))
+			return EIO;
+	}
+	return 0;
+}
+
 static device_method_t at91_twi_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		at91_twi_probe),
@@ -433,6 +479,7 @@
 	DEVMETHOD(iicbus_write,		at91_twi_write),
 	DEVMETHOD(iicbus_read,		at91_twi_read),
 	DEVMETHOD(iicbus_reset,		at91_twi_rst_card),
+	DEVMETHOD(iicbus_transfer,	at91_twi_transfer),
 	{ 0, 0 }
 };
 

==== //depot/projects/trustedbsd/priv/sys/arm/at91/if_atereg.h#2 (text) ====

@@ -22,7 +22,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* $FreeBSD: src/sys/arm/at91/if_atereg.h,v 1.1 2006/02/04 23:32:13 imp Exp $ */
+/* $FreeBSD: src/sys/arm/at91/if_atereg.h,v 1.2 2006/09/07 21:50:01 imp Exp $ */
 
 #ifndef ARM_AT91_IF_ATEREG_H
 #define ARM_AT91_IF_ATEREG_H
@@ -52,15 +52,15 @@
 #define ETH_DTE		0x58		/* Deferred Transmittion Frame Reg */
 #define ETH_LCOL	0x5c		/* Late Collision Register */
 #define ETH_ECOL	0x60		/* Excessive Collision Register */
-#define ETH_CSE		0x64		/* Carrier Sense Error Register */
-#define ETH_TUE		0x68		/* Transmit Underrun Error Register */
-#define ETH_CDE		0x6c		/* Code Error Register */
-#define ETH_ELR		0x70		/* Excessive Length Error Register */
-#define ETH_RJB		0x74		/* Receive Jabber Register */
-#define ETH_USF		0x78		/* Undersize Frame Register */
-#define ETH_SQEE	0x7c		/* SQE Test Error Register */
-#define ETH_DRFC	0x80		/* Discarded RX Frame Register */
-		/*	0x84		   reserved */
+#define ETH_TUE		0x64		/* Transmit Underrun Error Register */
+#define ETH_CSE		0x68		/* Carrier Sense Error Register */
+#define ETH_DRFC	0x6c		/* Discarded RX Frame Register */
+#define ETH_ROV		0x68		/* Receive Overrun Register */
+#define ETH_CDE		0x64		/* Code Error Register */
+#define ETH_ELR		0x78		/* Excessive Length Error Register */
+#define ETH_RJB		0x7c		/* Receive Jabber Register */
+#define ETH_USF		0x80		/* Undersize Frame Register */
+#define ETH_SQEE	0x84		/* SQE Test Error Register */
 		/*	0x88		   reserved */
 		/*	0x8c		   reserved */
 #define ETH_HSH		0x90		/* EMAC Hash Address High [63:32] */

==== //depot/projects/trustedbsd/priv/sys/boot/i386/pxeldr/pxeldr.S#2 (text+ko) ====

@@ -12,7 +12,7 @@
  * warranties of merchantability and fitness for a particular
  * purpose.
  *
- * $FreeBSD: src/sys/boot/i386/pxeldr/pxeldr.S,v 1.14 2006/04/11 20:53:49 sobomax Exp $
+ * $FreeBSD: src/sys/boot/i386/pxeldr/pxeldr.S,v 1.15 2006/09/05 19:28:03 ru Exp $
  */
 
 /*
@@ -25,6 +25,8 @@
  * separate PXE-aware client just to load the loader.
  */
 
+#include <sys/reboot.h>
+
 /*
  * Memory locations.
  */
@@ -53,10 +55,6 @@
 		.set KARGS_FLAGS_PXE,0x2	# flag to indicate booting from
 						#  PXE loader
 /*
- * Boot howto bits
- */
-		.set RB_SERIAL,0x1000		# serial console
-/*
  * Segment selectors.
  */
 		.set SEL_SDATA,0x8		# Supervisor data
@@ -119,11 +117,11 @@
 #ifdef PROBE_KEYBOARD
 /*
  * Look at the BIOS data area to see if we have an enhanced keyboard.  If not,
- * set the RBX_SERIAL bit in the howto byte.
+ * set the RBX_DUAL and RBX_SERIAL bits in the howto byte.
  */
 		testb $KEYBOARD_BIT, MEM_BIOS_KEYBOARD # keyboard present?
 		jnz keyb			# yes, so skip
-		orl $RB_SERIAL, (%bx)		# enable serial console
+		orl $(RB_MULTIPLE | RB_SERIAL), (%bx) # enable serial console
 keyb:
 #endif
 /*

==== //depot/projects/trustedbsd/priv/sys/compat/freebsd32/freebsd32_proto.h#3 (text+ko) ====

@@ -2,7 +2,7 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.60 2006/09/03 16:24:36 rwatson Exp $
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.61 2006/09/09 01:22:13 davidxu Exp $
  * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.73 2006/09/03 16:17:49 rwatson Exp 
  */
 

==== //depot/projects/trustedbsd/priv/sys/compat/freebsd32/freebsd32_syscall.h#3 (text+ko) ====

@@ -2,7 +2,7 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.58 2006/09/03 16:24:36 rwatson Exp $
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.59 2006/09/09 01:22:13 davidxu Exp $
  * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.73 2006/09/03 16:17:49 rwatson Exp 
  */
 
@@ -310,5 +310,10 @@
 #define	FREEBSD32_SYS_thr_suspend	442
 #define	FREEBSD32_SYS_thr_wake	443
 #define	FREEBSD32_SYS_kldunloadf	444
+#define	FREEBSD32_SYS_sigqueue	456
 #define	FREEBSD32_SYS_abort2	463
+#define	FREEBSD32_SYS_thr_set_name	464
+#define	FREEBSD32_SYS_thr_setscheduler	466
+#define	FREEBSD32_SYS_thr_getscheduler	467
+#define	FREEBSD32_SYS_thr_setschedparam	468
 #define	FREEBSD32_SYS_MAXSYSCALL	471

==== //depot/projects/trustedbsd/priv/sys/compat/freebsd32/freebsd32_syscalls.c#3 (text+ko) ====

@@ -2,7 +2,7 @@
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.49 2006/09/03 16:24:36 rwatson Exp $
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.50 2006/09/09 01:22:13 davidxu Exp $
  * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.73 2006/09/03 16:17:49 rwatson Exp 
  */
 
@@ -463,7 +463,7 @@
 	"#453",			/* 453 = auditctl */
 	"#454",			/* 454 = _umtx_op */
 	"#455",			/* 455 = thr_new */
-	"#456",			/* 456 = sigqueue */
+	"sigqueue",			/* 456 = sigqueue */
 	"#457",			/* 457 = kmq_open */
 	"#458",			/* 458 = kmq_setattr */
 	"#459",			/* 459 = kmq_timedreceive */
@@ -471,11 +471,11 @@
 	"#461",			/* 461 = kmq_notify */
 	"#462",			/* 462 = kmq_unlink */
 	"abort2",			/* 463 = abort2 */
-	"#464",			/* 464 = thr_set_name */
+	"thr_set_name",			/* 464 = thr_set_name */
 	"#465",			/* 465 = aio_fsync */
-	"#466",			/* 466 = thr_setscheduler */
-	"#467",			/* 467 = thr_getscheduler */
-	"#468",			/* 468 = thr_setschedparam */
+	"thr_setscheduler",			/* 466 = thr_setscheduler */
+	"thr_getscheduler",			/* 467 = thr_getscheduler */
+	"thr_setschedparam",			/* 468 = thr_setschedparam */
 	"#469",			/* 469 = __getpath_fromfd */
 	"#470",			/* 470 = __getpath_fromaddr */
 };

==== //depot/projects/trustedbsd/priv/sys/compat/freebsd32/freebsd32_sysent.c#3 (text+ko) ====

@@ -2,7 +2,7 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.59 2006/09/03 16:24:36 rwatson Exp $
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.60 2006/09/09 01:22:13 davidxu Exp $
  * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.73 2006/09/03 16:17:49 rwatson Exp 
  */
 
@@ -488,7 +488,7 @@
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 453 = auditctl */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 454 = _umtx_op */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 455 = thr_new */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 456 = sigqueue */
+	{ AS(sigqueue_args), (sy_call_t *)sigqueue, AUE_NULL, NULL, 0, 0 },	/* 456 = sigqueue */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 457 = kmq_open */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 458 = kmq_setattr */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 459 = kmq_timedreceive */
@@ -496,11 +496,11 @@
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 461 = kmq_notify */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 462 = kmq_unlink */
 	{ AS(abort2_args), (sy_call_t *)abort2, AUE_NULL, NULL, 0, 0 },	/* 463 = abort2 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 464 = thr_set_name */
+	{ AS(thr_set_name_args), (sy_call_t *)thr_set_name, AUE_NULL, NULL, 0, 0 },	/* 464 = thr_set_name */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 465 = aio_fsync */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 466 = thr_setscheduler */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 467 = thr_getscheduler */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 468 = thr_setschedparam */
+	{ AS(thr_setscheduler_args), (sy_call_t *)thr_setscheduler, AUE_NULL, NULL, 0, 0 },	/* 466 = thr_setscheduler */
+	{ AS(thr_getscheduler_args), (sy_call_t *)thr_getscheduler, AUE_NULL, NULL, 0, 0 },	/* 467 = thr_getscheduler */
+	{ AS(thr_setschedparam_args), (sy_call_t *)thr_setschedparam, AUE_NULL, NULL, 0, 0 },	/* 468 = thr_setschedparam */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 469 = __getpath_fromfd */
 	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 470 = __getpath_fromaddr */
 };

==== //depot/projects/trustedbsd/priv/sys/compat/freebsd32/syscalls.master#3 (text+ko) ====

@@ -1,4 +1,4 @@
- $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.73 2006/09/03 16:17:49 rwatson Exp $
+ $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.74 2006/09/09 01:22:13 davidxu Exp $
 ;	from: @(#)syscalls.master	8.2 (Berkeley) 1/13/94
 ;	from: src/sys/kern/syscalls.master 1.107
 ;
@@ -743,7 +743,8 @@
 453	AUE_AUDITCTL	UNIMPL	auditctl
 454	AUE_NULL	UNIMPL	_umtx_op
 455	AUE_NULL	UNIMPL	thr_new
-456	AUE_NULL	UNIMPL	sigqueue
+456	AUE_NULL	NOPROTO	{ int sigqueue(pid_t pid, int signum, \
+				    void *value); }
 457	AUE_NULL	UNIMPL	kmq_open
 458	AUE_NULL	UNIMPL	kmq_setattr
 459	AUE_NULL	UNIMPL	kmq_timedreceive
@@ -751,10 +752,16 @@
 461	AUE_NULL	UNIMPL	kmq_notify
 462	AUE_NULL	UNIMPL	kmq_unlink
 463	AUE_NULL	NOPROTO	{ int abort2(const char *why, int nargs, void **args); }
-464	AUE_NULL	UNIMPL	thr_set_name
+464	AUE_NULL 	NOPROTO	{ int thr_set_name(long id, const char *name); }
 465	AUE_NULL	UNIMPL	aio_fsync
-466	AUE_NULL	UNIMPL	thr_setscheduler
-467	AUE_NULL	UNIMPL	thr_getscheduler
-468	AUE_NULL	UNIMPL	thr_setschedparam
+466	AUE_NULL	NOPROTO	{ int thr_setscheduler(long id, int policy,\
+				    const struct sched_param *param, \
+				    int param_size); }
+467	AUE_NULL	NOPROTO { int thr_getscheduler(long id, int *policy,\
+				    struct sched_param *param, \
+				    int param_size); }
+468	AUE_NULL	NOPROTO	{ int thr_setschedparam(long id, \
+				    const struct sched_param *param, \
+				    int param_size); }
 469	AUE_NULL	UNIMPL	__getpath_fromfd
 470	AUE_NULL	UNIMPL	__getpath_fromaddr

==== //depot/projects/trustedbsd/priv/sys/compat/linux/linux_futex.c#2 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_futex.c,v 1.4 2006/08/26 10:36:16 netchild Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_futex.c,v 1.6 2006/09/09 16:25:25 netchild Exp $");
 #if 0
  __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.5 2005/11/23 16:14:57 manu Exp $");
 #endif
@@ -47,6 +47,7 @@
 #include <sys/queue.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
+#include <sys/sx.h>
 #include <sys/malloc.h>
 
 #ifdef COMPAT_LINUX32
@@ -73,10 +74,10 @@
 };
 
 LIST_HEAD(futex_list, futex) futex_list;
-struct mtx futex_mtx;		/* this protects the LIST of futexes */
+struct sx futex_sx;		/* this protects the LIST of futexes */
 
-#define FUTEX_LOCK mtx_lock(&futex_mtx)
-#define FUTEX_UNLOCK mtx_unlock(&futex_mtx)
+#define FUTEX_LOCK sx_xlock(&futex_sx)
+#define FUTEX_UNLOCK sx_xunlock(&futex_sx)
 
 #define FUTEX_LOCKED	1
 #define FUTEX_UNLOCKED	0
@@ -302,9 +303,6 @@
 		ret = futex_wake(f, args->val, NULL);
 		futex_put(f);
 		if (op_ret > 0) {
-#ifdef	DEBUG
-		   	printf("second wakeup\n");
-#endif
 		   	op_ret = 0;
 		   	/*
 			 * Linux uses the address of the timespec parameter
@@ -346,16 +344,11 @@
 			return f;
 		}
 	}
-	if (locked == FUTEX_UNLOCKED)
-   	   	FUTEX_UNLOCK;
 
-	/* Not found, create it */
 	f = malloc(sizeof(*f), M_LINUX, M_WAITOK);
 	f->f_uaddr = uaddr;
 	f->f_refcount = 1;
 	TAILQ_INIT(&f->f_waiting_proc);
-	if (locked == FUTEX_UNLOCKED)
-   	   	FUTEX_LOCK;
 	LIST_INSERT_HEAD(&futex_list, f, f_list);
 	if (locked == FUTEX_UNLOCKED)
    	   	FUTEX_UNLOCK;
@@ -421,13 +414,13 @@
 	FUTEX_LOCK;
 	TAILQ_FOREACH(wp, &f->f_waiting_proc, wp_list) {
 		if (count <= n) {
-			wakeup(wp);
+			wakeup_one(wp);
 			count++;
 		} else {
 			if (newf != NULL) {
 				/* futex_put called after tsleep */
 				wp->wp_new_futex = futex_get(newf->f_uaddr, FUTEX_LOCKED);
-				wakeup(wp);
+				wakeup_one(wp);
 			}
 		}
 	}

==== //depot/projects/trustedbsd/priv/sys/conf/files.amd64#2 (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.amd64,v 1.92 2006/08/15 12:54:28 netchild Exp $
+# $FreeBSD: src/sys/conf/files.amd64,v 1.93 2006/09/05 16:55:12 anholt Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -208,6 +208,7 @@
 isa/vga_isa.c			optional	vga
 kern/link_elf_obj.c		standard
 pci/agp_amd64.c			optional	agp
+pci/agp_i810.c			optional	agp
 pci/agp_intel.c			optional	agp
 #
 # IA32 binary support

==== //depot/projects/trustedbsd/priv/sys/contrib/pf/net/pf_ioctl.c#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.25 2006/07/21 09:48:13 mlaier Exp $	*/
+/*	$FreeBSD: src/sys/contrib/pf/net/pf_ioctl.c,v 1.26 2006/09/06 17:19:45 mlaier Exp $	*/
 /*	$OpenBSD: pf_ioctl.c,v 1.139 2005/03/03 07:13:39 dhartmei Exp $	*/
 /* add:	$OpenBSD: pf_ioctl.c,v 1.168 2006/07/21 01:21:17 dhartmei Exp $ */
 
@@ -3438,11 +3438,17 @@
     struct inpcb *inp)
 {
 	/*
-	 * IPv6 does not affected ip_len/ip_off byte order changes.
+	 * IPv6 is not affected by ip_len/ip_off byte order changes.
 	 */
 	int chk;
 
-	chk = pf_test6(PF_IN, ifp, m, NULL, inp);
+	/*
+	 * In case of loopback traffic IPv6 uses the real interface in
+	 * order to support scoped addresses. In order to support stateful
+	 * filtering we have change this to lo0 as it is the case in IPv4.
+	 */
+	chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? &loif[0] : ifp, m,
+	    NULL, inp);
 	if (chk && *m) {
 		m_freem(*m);
 		*m = NULL;

==== //depot/projects/trustedbsd/priv/sys/dev/aic7xxx/aic7xxx_osm.c#2 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic7xxx_osm.c,v 1.44 2005/12/04 02:12:40 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic7xxx_osm.c,v 1.45 2006/09/05 20:28:28 mjacob Exp $");
 
 #include <dev/aic7xxx/aic7xxx_osm.h>
 #include <dev/aic7xxx/aic7xxx_inline.h>
@@ -158,6 +158,8 @@
 	count = 0;
 	sim = NULL;
 	sim2 = NULL;
+	path = NULL;
+	path2 = NULL;
 
 	/*
 	 * Create a thread to perform all recovery.

==== //depot/projects/trustedbsd/priv/sys/dev/bge/if_bge.c#3 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.143 2006/09/03 00:27:41 jmg Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.144 2006/09/09 03:36:57 ambrisko Exp $");
 
 /*
  * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -326,6 +326,7 @@
 static void bge_txeof(struct bge_softc *);
 static void bge_rxeof(struct bge_softc *);
 
+static void bge_asf_driver_up (struct bge_softc *);
 static void bge_tick_locked(struct bge_softc *);
 static void bge_tick(void *);
 static void bge_stats_update(struct bge_softc *);
@@ -376,7 +377,12 @@
 static void bge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count);
 #endif
 
-static void bge_reset(struct bge_softc *);
+#define BGE_RESET_START 1
+#define BGE_RESET_STOP  2
+static void bge_sig_post_reset(struct bge_softc *, int);
+static void bge_sig_legacy(struct bge_softc *, int);
+static void bge_sig_pre_reset(struct bge_softc *, int);
+static int bge_reset(struct bge_softc *);
 static void bge_link_upd(struct bge_softc *);
 
 static device_method_t bge_methods[] = {
@@ -646,7 +652,6 @@
 {
 	struct bge_softc *sc;
 	struct mii_data *mii;
-
 	sc = device_get_softc(dev);
 	mii = device_get_softc(sc->bge_miibus);
 
@@ -968,6 +973,84 @@
 		CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]);
 }
 
+static void
+bge_sig_pre_reset(sc, type)
+	struct bge_softc *sc;
+	int type;
+{
+	/*
+	 * Some chips don't like this so only do this if ASF is enabled
+	 */
+	if (sc->bge_asf_mode)
+		bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
+
+	if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) {
+		switch (type) {
+		case BGE_RESET_START:
+			bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */
+			break;
+		case BGE_RESET_STOP:
+			bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */
+			break;
+		}
+	}
+}
+
+static void
+bge_sig_post_reset(sc, type)
+	struct bge_softc *sc;
+	int type;
+{
+	if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) {
+		switch (type) {
+		case BGE_RESET_START:
+			bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000001); 
+			/* START DONE */
+			break;
+		case BGE_RESET_STOP:
+			bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000002); 
+			break;
+		}
+	}
+}
+
+static void
+bge_sig_legacy(sc, type)
+	struct bge_softc *sc;
+	int type;
+{
+	if (sc->bge_asf_mode) {
+		switch (type) {
+		case BGE_RESET_START:
+			bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */
+			break;
+		case BGE_RESET_STOP:
+			bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */
+			break;
+		}
+	}
+}
+
+void bge_stop_fw(struct bge_softc *);
+void
+bge_stop_fw(sc)
+	struct bge_softc *sc;
+{
+	int i;
+
+	if (sc->bge_asf_mode) {
+		bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_PAUSE);
+		CSR_WRITE_4(sc, BGE_CPU_EVENT,
+			    CSR_READ_4(sc, BGE_CPU_EVENT) != (1 << 14));
+
+		for (i = 0; i < 100; i++ ) {
+			if (!(CSR_READ_4(sc, BGE_CPU_EVENT) & (1 << 14)))
+				break;
+			DELAY(10);
+		}
+	}
+}
+
 /*
  * Do endian, PCI and DMA initialization. Also check the on-board ROM
  * self-test results.
@@ -978,7 +1061,7 @@
 	uint32_t dma_rw_ctl;
 	int i;
 
-	/* Set endian type before we access any non-PCI registers. */
+	/* Set endianness before we access any non-PCI registers. */
 	pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, BGE_INIT, 4);
 
 	/*
@@ -1070,6 +1153,12 @@
 	    BGE_MODECTL_TX_NO_PHDR_CSUM);
 
 	/*
+	 * Tell the firmware the driver is running
+	 */
+	if (sc->bge_asf_mode & ASF_STACKUP)
+		BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
+
+	/*
 	 * Disable memory write invalidate.  Apparently it is not supported
 	 * properly by these devices.
 	 */
@@ -1992,6 +2081,7 @@
 	uint32_t mac_tmp = 0;
 	u_char eaddr[6];
 	int error = 0, rid;
+	int trys;
 
 	sc = device_get_softc(dev);
 	sc->bge_dev = dev;
@@ -2059,7 +2149,38 @@
 		sc->bge_flags |= BGE_FLAG_PCIX;
 
 	/* Try to reset the chip. */
-	bge_reset(sc);
+	if (bge_reset(sc)) {
+		device_printf(sc->bge_dev, "chip reset failed\n");
+		bge_release_resources(sc);
+		error = ENXIO;
+		goto fail;
+	}
+
+	sc->bge_asf_mode = 0;
+	if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG)
+	    == BGE_MAGIC_NUMBER) {
+		if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG)
+		    & BGE_HWCFG_ASF) {
+			sc->bge_asf_mode |= ASF_ENABLE;
+			sc->bge_asf_mode |= ASF_STACKUP;
+			if (sc->bge_asicrev == BGE_ASICREV_BCM5750) {
+				sc->bge_asf_mode |= ASF_NEW_HANDSHAKE;
+			}
+		}
+	}
+
+	/* Try to reset the chip again the nice way. */
+	bge_stop_fw(sc);
+	bge_sig_pre_reset(sc, BGE_RESET_STOP);
+	if (bge_reset(sc)) {
+		device_printf(sc->bge_dev, "chip reset failed\n");
+		bge_release_resources(sc);
+		error = ENXIO;
+		goto fail;
+	}
+
+	bge_sig_legacy(sc, BGE_RESET_STOP);
+	bge_sig_post_reset(sc, BGE_RESET_STOP);
 
 	if (bge_chipinit(sc)) {
 		device_printf(sc->bge_dev, "chip initialization failed\n");
@@ -2186,15 +2307,36 @@
 		sc->bge_ifmedia.ifm_media = sc->bge_ifmedia.ifm_cur->ifm_media;
 	} else {
 		/*
-		 * Do transceiver setup.
+		 * Do transceiver setup and tell the firmware the
+		 * driver is down so we can try to get access the
+		 * probe if ASF is running.  Retry a couple of times
+		 * if we get a conflict with the ASF firmware accessing
+		 * the PHY.
 		 */
+		BGE_CLRBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
+again:
+		bge_asf_driver_up(sc);
+
+		trys = 0;
 		if (mii_phy_probe(dev, &sc->bge_miibus,
 		    bge_ifmedia_upd, bge_ifmedia_sts)) {
+			if (trys++ < 4) {
+				device_printf(sc->bge_dev, "Try again\n");
+				bge_miibus_writereg(sc->bge_dev, 1, MII_BMCR, BMCR_RESET);
+				goto again;
+			}
+
 			device_printf(sc->bge_dev, "MII without any PHY!\n");
 			bge_release_resources(sc);
 			error = ENXIO;
 			goto fail;
 		}
+
+		/*
+		 * Now tell the firmware we are going up after probing the PHY
+		 */
+		if (sc->bge_asf_mode & ASF_STACKUP)
+			BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
 	}
 

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


More information about the p4-projects mailing list