Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2005 20:51:52 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 81075 for review
Message-ID:  <200507272051.j6RKpqxc080871@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=81075

Change 81075 by peter@peter_overcee on 2005/07/27 20:50:59

	IFC @81071

Affected files ...

.. //depot/projects/hammer/lib/libc/net/inet_pton.c#3 integrate
.. //depot/projects/hammer/lib/libz/inftrees.h#3 integrate
.. //depot/projects/hammer/sbin/dhclient/bpf.c#2 integrate
.. //depot/projects/hammer/sys/arm/include/atomic.h#10 integrate
.. //depot/projects/hammer/sys/arm/include/endian.h#10 integrate
.. //depot/projects/hammer/sys/boot/i386/libi386/smbios.c#2 integrate
.. //depot/projects/hammer/sys/dev/acpica/acpi_pci_link.c#28 integrate
.. //depot/projects/hammer/sys/geom/raid3/g_raid3.c#17 integrate
.. //depot/projects/hammer/sys/geom/raid3/g_raid3.h#9 integrate
.. //depot/projects/hammer/sys/netinet6/ah_aesxcbcmac.c#3 integrate
.. //depot/projects/hammer/sys/nfsclient/nfs_node.c#21 integrate
.. //depot/projects/hammer/sys/nfsclient/nfs_socket.c#29 integrate
.. //depot/projects/hammer/sys/pci/if_de.c#25 integrate
.. //depot/projects/hammer/sys/pci/if_devar.h#9 integrate
.. //depot/projects/hammer/sys/pci/if_sis.c#36 integrate
.. //depot/projects/hammer/sys/pci/if_xl.c#53 integrate
.. //depot/projects/hammer/sys/sparc64/include/cpufunc.h#7 integrate
.. //depot/projects/hammer/usr.sbin/pkg_install/version/main.c#6 integrate
.. //depot/projects/hammer/usr.sbin/pkg_install/version/perform.c#8 integrate
.. //depot/projects/hammer/usr.sbin/pkg_install/version/pkg_version.1#11 integrate
.. //depot/projects/hammer/usr.sbin/pkg_install/version/version.h#5 integrate

Differences ...

==== //depot/projects/hammer/lib/libc/net/inet_pton.c#3 (text+ko) ====

@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/inet_pton.c,v 1.11 2002/09/06 11:23:49 tjr Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/net/inet_pton.c,v 1.12 2005/07/27 14:33:36 ume Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -88,6 +88,8 @@
 		if ((pch = strchr(digits, ch)) != NULL) {
 			u_int new = *tp * 10 + (pch - digits);
 
+			if (saw_digit && *tp == 0)
+				return (0);
 			if (new > 255)
 				return (0);
 			*tp = new;
@@ -195,6 +197,8 @@
 		const int n = tp - colonp;
 		int i;
 
+		if (tp == endp)
+			return (0);
 		for (i = 1; i <= n; i++) {
 			endp[- i] = colonp[n - i];
 			colonp[n - i] = 0;

==== //depot/projects/hammer/lib/libz/inftrees.h#3 (text+ko) ====

@@ -36,12 +36,12 @@
  */
 
 /* Maximum size of dynamic tree.  The maximum found in a long but non-
-   exhaustive search was 1004 code structures (850 for length/literals
-   and 154 for distances, the latter actually the result of an
+   exhaustive search was 1444 code structures (852 for length/literals
+   and 592 for distances, the latter actually the result of an
    exhaustive search).  The true maximum is not known, but the value
    below is more than safe. */
-#define ENOUGH 1440
-#define MAXD 154
+#define ENOUGH 2048
+#define MAXD 592
 
 /* Type of code to build for inftable() */
 typedef enum {

==== //depot/projects/hammer/sbin/dhclient/bpf.c#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*	$OpenBSD: bpf.c,v 1.13 2004/05/05 14:28:58 deraadt Exp $	*/
-/*	$FreeBSD: src/sbin/dhclient/bpf.c,v 1.2 2005/06/07 04:13:52 brooks Exp $	*/
+/*	$FreeBSD: src/sbin/dhclient/bpf.c,v 1.3 2005/07/27 19:25:46 brooks Exp $	*/
 
 /* BPF socket interface code, originally contributed by Archie Cobbs. */
 
@@ -316,19 +316,19 @@
 			continue;
 		}
 
+		/* Skip over the BPF header... */
+		interface->rbuf_offset += hdr.bh_hdrlen;
+
 		/*
 		 * If the captured data wasn't the whole packet, or if
 		 * the packet won't fit in the input buffer, all we can
 		 * do is drop it.
 		 */
 		if (hdr.bh_caplen != hdr.bh_datalen) {
-			interface->rbuf_offset += hdr.bh_hdrlen = hdr.bh_caplen;
+			interface->rbuf_offset += hdr.bh_caplen;
 			continue;
 		}
 
-		/* Skip over the BPF header... */
-		interface->rbuf_offset += hdr.bh_hdrlen;
-
 		/* Decode the physical header... */
 		offset = decode_hw_header(interface->rbuf,
 		    interface->rbuf_offset, hfrom);

==== //depot/projects/hammer/sys/arm/include/atomic.h#10 (text+ko) ====

@@ -33,7 +33,7 @@
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/arm/include/atomic.h,v 1.9 2005/07/15 18:17:57 jhb Exp $
+ * $FreeBSD: src/sys/arm/include/atomic.h,v 1.10 2005/07/27 20:01:44 jhb Exp $
  */
 
 #ifndef	_MACHINE_ATOMIC_H_
@@ -77,8 +77,10 @@
 static __inline uint32_t
 __swp(uint32_t val, volatile uint32_t *ptr)
 {
-	__asm __volatile("swp	%0, %1, [%2]"
-	    : "=&r" (val) : "r" (val) , "r" (ptr) : "memory");
+	__asm __volatile("swp	%0, %2, [%3]"
+	    : "=&r" (val), "=m" (*ptr)
+	    : "r" (val) , "r" (ptr), "m" (*ptr)
+	    : "memory");
 	return (val);
 }
 

==== //depot/projects/hammer/sys/arm/include/endian.h#10 (text+ko) ====

@@ -27,7 +27,7 @@
  *
  *	@(#)endian.h	8.1 (Berkeley) 6/10/93
  * $NetBSD: endian.h,v 1.7 1999/08/21 05:53:51 simonb Exp $
- * $FreeBSD: src/sys/arm/include/endian.h,v 1.9 2005/05/24 21:43:16 cognet Exp $
+ * $FreeBSD: src/sys/arm/include/endian.h,v 1.10 2005/07/27 19:59:21 jhb Exp $
  */
 
 #ifndef _ENDIAN_H_
@@ -100,11 +100,10 @@
 __bswap16_var(__uint16_t v)
 {
 	__asm __volatile(
-	    "mov    %0, %1, ror #8\n"
+	    "mov    %0, %0, ror #8\n"
 	    "orr    %0, %0, %0, lsr #16\n"
 	    "bic    %0, %0, %0, lsl #16"
-	    : "=r" (v)
-	    : "0" (v));
+	    : "+r" (v));
 	
 	return (v);
 }		

==== //depot/projects/hammer/sys/boot/i386/libi386/smbios.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/smbios.c,v 1.1 2005/07/14 19:52:22 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/smbios.c,v 1.2 2005/07/27 19:11:10 jkim Exp $");
 
 #include <stand.h>
 #include <bootstrap.h>
@@ -72,9 +72,6 @@
 	if (smbios == NULL)
 		return;
 
-	/* export values from the SMBIOS */
-	setenv("hint.smbios.0.enabled", "YES", 1);
-
 	length = *(u_int16_t *)(smbios + 0x16);	/* Structure Table Length */
 	paddr = *(u_int32_t *)(smbios + 0x18);	/* Structure Table Address */
 	count = *(u_int16_t *)(smbios + 0x1c);	/* No of SMBIOS Structures */
@@ -91,26 +88,26 @@
 
 	switch(dmi[0]) {
 	case 0:		/* Type 0: BIOS */
-		smbios_setenv("hint.smbios.0.bios.vendor", dmi, 0x04);
-		smbios_setenv("hint.smbios.0.bios.version", dmi, 0x05);
-		smbios_setenv("hint.smbios.0.bios.reldate", dmi, 0x08);
+		smbios_setenv("smbios.bios.vendor", dmi, 0x04);
+		smbios_setenv("smbios.bios.version", dmi, 0x05);
+		smbios_setenv("smbios.bios.reldate", dmi, 0x08);
 		break;
 
 	case 1:		/* Type 1: System */
-		smbios_setenv("hint.smbios.0.system.maker", dmi, 0x04);
-		smbios_setenv("hint.smbios.0.system.product", dmi, 0x05);
-		smbios_setenv("hint.smbios.0.system.version", dmi, 0x06);
+		smbios_setenv("smbios.system.maker", dmi, 0x04);
+		smbios_setenv("smbios.system.product", dmi, 0x05);
+		smbios_setenv("smbios.system.version", dmi, 0x06);
 		break;
 
 	case 2:		/* Type 2: Base Board (or Module) */
-		smbios_setenv("hint.smbios.0.planar.maker", dmi, 0x04);
-		smbios_setenv("hint.smbios.0.planar.product", dmi, 0x05);
-		smbios_setenv("hint.smbios.0.planar.version", dmi, 0x06);
+		smbios_setenv("smbios.planar.maker", dmi, 0x04);
+		smbios_setenv("smbios.planar.product", dmi, 0x05);
+		smbios_setenv("smbios.planar.version", dmi, 0x06);
 		break;
 
 	case 3:		/* Type 3: System Enclosure or Chassis */
-		smbios_setenv("hint.smbios.0.chassis.maker", dmi, 0x04);
-		smbios_setenv("hint.smbios.0.chassis.version", dmi, 0x06);
+		smbios_setenv("smbios.chassis.maker", dmi, 0x04);
+		smbios_setenv("smbios.chassis.version", dmi, 0x06);
 		break;
 
 	default: /* skip other types */

==== //depot/projects/hammer/sys/dev/acpica/acpi_pci_link.c#28 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.44 2005/01/18 20:18:46 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.45 2005/07/27 15:21:32 jhb Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -955,8 +955,8 @@
 		}
 	}
 
-	if (bootverbose) {
-		if (PCI_INTERRUPT_VALID(best_irq))
+	if (PCI_INTERRUPT_VALID(best_irq)) {
+		if (bootverbose)
 			device_printf(dev, "Picked IRQ %u with weight %d\n",
 			    best_irq, best_weight);
 	} else

==== //depot/projects/hammer/sys/geom/raid3/g_raid3.c#17 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/raid3/g_raid3.c,v 1.40 2005/03/26 17:24:19 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/raid3/g_raid3.c,v 1.41 2005/07/27 09:03:51 pjd Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1688,6 +1688,13 @@
 g_raid3_try_destroy(struct g_raid3_softc *sc)
 {
  
+	if (sc->sc_rootmount != NULL) {
+		G_RAID3_DEBUG(1, "root_mount_rel[%u] %p", __LINE__,
+		    sc->sc_rootmount);
+		root_mount_rel(sc->sc_rootmount);
+		sc->sc_rootmount = NULL;
+	}
+
 	g_topology_lock();
 	if (!g_raid3_can_destroy(sc)) {
 		g_topology_unlock();
@@ -2149,6 +2156,10 @@
 				 * Timeout expired, so destroy device.
 				 */
 				sc->sc_flags |= G_RAID3_DEVICE_FLAG_DESTROY;
+				G_RAID3_DEBUG(1, "root_mount_rel[%u] %p",
+				    __LINE__, sc->sc_rootmount);
+				root_mount_rel(sc->sc_rootmount);
+				sc->sc_rootmount = NULL;
 			}
 			return;
 		}
@@ -2291,6 +2302,12 @@
 		}
 		if (sc->sc_provider == NULL)
 			g_raid3_launch_provider(sc);
+		if (sc->sc_rootmount != NULL) {
+			G_RAID3_DEBUG(1, "root_mount_rel[%u] %p", __LINE__,
+			    sc->sc_rootmount);
+			root_mount_rel(sc->sc_rootmount);
+			sc->sc_rootmount = NULL;
+		}
 		break;
 	case G_RAID3_DEVICE_STATE_COMPLETE:
 		/*
@@ -2318,6 +2335,12 @@
 		}
 		if (sc->sc_provider == NULL)
 			g_raid3_launch_provider(sc);
+		if (sc->sc_rootmount != NULL) {
+			G_RAID3_DEBUG(1, "root_mount_rel[%u] %p", __LINE__,
+			    sc->sc_rootmount);
+			root_mount_rel(sc->sc_rootmount);
+			sc->sc_rootmount = NULL;
+		}
 		break;
 	default:
 		KASSERT(1 == 0, ("Wrong device state (%s, %s).", sc->sc_name,
@@ -2810,6 +2833,9 @@
 
 	G_RAID3_DEBUG(0, "Device %s created (id=%u).", sc->sc_name, sc->sc_id);
 
+	sc->sc_rootmount = root_mount_hold("GRAID3");
+	G_RAID3_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount);
+
 	/*
 	 * Run timeout.
 	 */

==== //depot/projects/hammer/sys/geom/raid3/g_raid3.h#9 (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/geom/raid3/g_raid3.h,v 1.11 2005/02/27 23:07:47 pjd Exp $
+ * $FreeBSD: src/sys/geom/raid3/g_raid3.h,v 1.12 2005/07/27 09:03:51 pjd Exp $
  */
 
 #ifndef	_G_RAID3_H_
@@ -202,6 +202,8 @@
 	struct mtx	sc_events_mtx;
 
 	struct callout	sc_callout;
+
+	struct root_hold_token *sc_rootmount;
 };
 #define	sc_name	sc_geom->name
 

==== //depot/projects/hammer/sys/netinet6/ah_aesxcbcmac.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/netinet6/ah_aesxcbcmac.c,v 1.2 2005/01/07 02:30:34 imp Exp $
+ * $FreeBSD: src/sys/netinet6/ah_aesxcbcmac.c,v 1.3 2005/07/27 08:41:17 cperciva Exp $
  */
 
 #include <sys/param.h>
@@ -78,6 +78,7 @@
 	u_int8_t k3seed[AES_BLOCKSIZE] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 };
 	u_int32_t r_ks[(RIJNDAEL_MAXNR+1)*4];
 	aesxcbc_ctx *ctx;
+	u_int8_t k1[AES_BLOCKSIZE];
 
 	if (!state)
 		panic("ah_aes_xcbc_mac_init: what?");
@@ -93,14 +94,15 @@
 	if ((ctx->r_nr = rijndaelKeySetupEnc(r_ks,
 	    (char *)_KEYBUF(sav->key_auth), AES_BLOCKSIZE * 8)) == 0)
 		return -1;
-	if (rijndaelKeySetupEnc(ctx->r_k1s, k1seed, AES_BLOCKSIZE * 8) == 0)
+	rijndaelEncrypt(r_ks, ctx->r_nr, k1seed, k1);
+	rijndaelEncrypt(r_ks, ctx->r_nr, k2seed, ctx->k2);
+	rijndaelEncrypt(r_ks, ctx->r_nr, k3seed, ctx->k3);
+	if (rijndaelKeySetupEnc(ctx->r_k1s, k1, AES_BLOCKSIZE * 8) == 0)
 		return -1;
-	if (rijndaelKeySetupEnc(ctx->r_k2s, k2seed, AES_BLOCKSIZE * 8) == 0)
+	if (rijndaelKeySetupEnc(ctx->r_k2s, ctx->k2, AES_BLOCKSIZE * 8) == 0)
 		return -1;
-	if (rijndaelKeySetupEnc(ctx->r_k3s, k3seed, AES_BLOCKSIZE * 8) == 0)
+	if (rijndaelKeySetupEnc(ctx->r_k3s, ctx->k3, AES_BLOCKSIZE * 8) == 0)
 		return -1;
-	rijndaelEncrypt(r_ks, ctx->r_nr, k2seed, ctx->k2);
-	rijndaelEncrypt(r_ks, ctx->r_nr, k3seed, ctx->k3);
 
 	return 0;
 }
@@ -151,8 +153,8 @@
 		addr += AES_BLOCKSIZE;
 	}
 	if (addr < ep) {
-		bcopy(addr, ctx->buf, ep - addr);
-		ctx->buflen = ep - addr;
+		bcopy(addr, ctx->buf + ctx->buflen, ep - addr);
+		ctx->buflen += ep - addr;
 	}
 }
 

==== //depot/projects/hammer/sys/nfsclient/nfs_node.c#21 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_node.c,v 1.77 2005/07/21 22:46:56 ps Exp $");
+__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_node.c,v 1.78 2005/07/27 15:05:31 ps Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -154,7 +154,8 @@
 		return (error);
 	if (nvp != NULL) {
 		*npp = VTONFS(nvp);
-		/* XXX I wonder of nfs_reclaim will survive the unused vnode */
+		/* vrele() the duplicate allocated here, to get it recycled */
+		vrele(vp);
 		return (0);
 	}
 	if (fhsize > NFS_SMALLFH) {

==== //depot/projects/hammer/sys/nfsclient/nfs_socket.c#29 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_socket.c,v 1.128 2005/07/19 21:27:25 ps Exp $");
+__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_socket.c,v 1.129 2005/07/27 15:06:26 ps Exp $");
 
 /*
  * Socket operations for use by nfs
@@ -1255,12 +1255,14 @@
 			 */
 			rep->r_flags |= R_REXMIT_INPROG;
 			mtx_unlock(&nfs_reqq_mtx);
+			NET_LOCK_GIANT();
 			if ((nmp->nm_flag & NFSMNT_NOCONN) == 0)
 			    error = (*so->so_proto->pr_usrreqs->pru_send)
 				    (so, 0, m, NULL, NULL, curthread);
 			else
 			    error = (*so->so_proto->pr_usrreqs->pru_send)
 				    (so, 0, m, nmp->nm_nam, NULL, curthread);
+			NET_UNLOCK_GIANT();
 			mtx_lock(&nfs_reqq_mtx);
 			rep->r_flags &= ~R_REXMIT_INPROG;
 			wakeup((caddr_t)&rep->r_flags);

==== //depot/projects/hammer/sys/pci/if_de.c#25 (text+ko) ====

@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/pci/if_de.c,v 1.165 2005/07/21 16:43:07 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/pci/if_de.c,v 1.166 2005/07/27 13:51:01 jhb Exp $");
 
 #define	TULIP_HDR_DATA
 
@@ -128,6 +128,7 @@
 static void	tulip_reset(tulip_softc_t * const sc);
 static void	tulip_rx_intr(tulip_softc_t * const sc);
 static int	tulip_srom_decode(tulip_softc_t * const sc);
+static void	tulip_start(tulip_softc_t * const sc);
 static struct mbuf *
 		tulip_txput(tulip_softc_t * const sc, struct mbuf *m);
 static void	tulip_txput_setup(tulip_softc_t * const sc);
@@ -137,26 +138,28 @@
     void *arg)
 {
     tulip_softc_t * const sc = arg;
-    int s = splimp();
 
     TULIP_PERFSTART(timeout)
+    TULIP_LOCK(sc);
 
     sc->tulip_flags &= ~TULIP_TIMEOUTPENDING;
     sc->tulip_probe_timeout -= 1000 / TULIP_HZ;
     (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_TIMER);
 
     TULIP_PERFEND(timeout);
-    splx(s);
+    TULIP_UNLOCK(sc);
 }
 
 static void
 tulip_timeout(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     if (sc->tulip_flags & TULIP_TIMEOUTPENDING)
 	return;
     sc->tulip_flags |= TULIP_TIMEOUTPENDING;
-    timeout(tulip_timeout_callback, sc, (hz + TULIP_HZ / 2) / TULIP_HZ);
+    callout_reset(&sc->tulip_callout, (hz + TULIP_HZ / 2) / TULIP_HZ,
+	tulip_timeout_callback, sc);
 }
 
 
@@ -172,6 +175,7 @@
      * either is connected so the transmit is the only way
      * to verify the connectivity.
      */
+    TULIP_LOCK_ASSERT(sc);
     MGETHDR(m, M_DONTWAIT, MT_DATA);
     if (m == NULL)
 	return 0;
@@ -207,6 +211,7 @@
 {
     const tulip_media_info_t *mi = sc->tulip_mediums[media];
 
+    TULIP_LOCK_ASSERT(sc);
     if (mi == NULL)
 	return;
 
@@ -299,6 +304,7 @@
     tulip_softc_t * const sc,
     tulip_media_t media)
 {
+    TULIP_LOCK_ASSERT(sc);
     if ((sc->tulip_flags & TULIP_LINKUP) == 0)
 	sc->tulip_flags |= TULIP_PRINTLINKUP;
     sc->tulip_flags |= TULIP_LINKUP;
@@ -354,6 +360,7 @@
 {
     struct ifnet *ifp = sc->tulip_ifp;
 
+    TULIP_LOCK_ASSERT(sc);
     if ((sc->tulip_flags & TULIP_LINKUP) == 0)
 	return;
     if (sc->tulip_flags & TULIP_PRINTMEDIA) {
@@ -376,6 +383,8 @@
     tulip_media_t last_media = TULIP_MEDIA_UNKNOWN;
     tulip_media_t media;
 
+    TULIP_LOCK_ASSERT(sc);
+
     /*
      * If one of the media blocks contained a default media flag,
      * use that.
@@ -438,6 +447,7 @@
     const tulip_media_info_t * const mi = sc->tulip_mediums[sc->tulip_media];
     tulip_link_status_t linkup = TULIP_LINK_DOWN;
 
+    TULIP_LOCK_ASSERT(sc);
     if (mi == NULL) {
 #if defined(DIAGNOSTIC) || defined(TULIP_DEBUG)
 	panic("tulip_media_link_monitor: %s: botch at line %d\n",
@@ -548,6 +558,7 @@
 {
     struct ifnet *ifp = sc->tulip_ifp;
 
+    TULIP_LOCK_ASSERT(sc);
 #if defined(TULIP_DEBUG)
     sc->tulip_dbg.dbg_events[event]++;
 #endif
@@ -835,6 +846,7 @@
 tulip_media_select(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     if (sc->tulip_features & TULIP_HAVE_GPR) {
 	TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_PINSET|sc->tulip_gpinit);
 	DELAY(10);
@@ -859,6 +871,7 @@
     tulip_softc_t * const sc,
     tulip_media_t media)
 {
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_cmdmode |= TULIP_CMD_CAPTREFFCT|TULIP_CMD_THRSHLD160
 	|TULIP_CMD_BACKOFFCTR;
     sc->tulip_ifp->if_baudrate = 10000000;
@@ -882,6 +895,7 @@
 tulip_21040_media_probe(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     tulip_21040_mediainfo_init(sc, TULIP_MEDIA_UNKNOWN);
     return;
 }
@@ -890,6 +904,7 @@
 tulip_21040_10baset_only_media_probe(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     tulip_21040_mediainfo_init(sc, TULIP_MEDIA_10BASET);
     tulip_media_set(sc, TULIP_MEDIA_10BASET);
     sc->tulip_media = TULIP_MEDIA_10BASET;
@@ -899,6 +914,7 @@
 tulip_21040_10baset_only_media_select(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_flags |= TULIP_LINKUP;
     if (sc->tulip_media == TULIP_MEDIA_10BASET_FD) {
 	sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX;
@@ -914,6 +930,7 @@
 tulip_21040_auibnc_only_media_probe(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     tulip_21040_mediainfo_init(sc, TULIP_MEDIA_AUIBNC);
     sc->tulip_flags |= TULIP_SQETEST|TULIP_LINKUP;
     tulip_media_set(sc, TULIP_MEDIA_AUIBNC);
@@ -924,6 +941,7 @@
 tulip_21040_auibnc_only_media_select(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     tulip_media_set(sc, TULIP_MEDIA_AUIBNC);
     sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX;
 }
@@ -955,6 +973,7 @@
 {
     tulip_media_info_t * const mi = sc->tulip_mediainfo;
 
+    TULIP_LOCK_ASSERT(sc);
 #ifdef notyet
     if (sc->tulip_revinfo >= 0x20) {
 	TULIP_MEDIAINFO_SIA_INIT(sc, &mi[0], 21041P2, 10BASET);
@@ -974,6 +993,7 @@
 tulip_21041_media_probe(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_ifp->if_baudrate = 10000000;
     sc->tulip_cmdmode |= TULIP_CMD_CAPTREFFCT|TULIP_CMD_ENHCAPTEFFCT
 	|TULIP_CMD_THRSHLD160|TULIP_CMD_BACKOFFCTR;
@@ -988,6 +1008,7 @@
 {
     u_int32_t sia_status;
 
+    TULIP_LOCK_ASSERT(sc);
 #if defined(TULIP_DEBUG)
     sc->tulip_dbg.dbg_events[event]++;
 #endif
@@ -1209,6 +1230,8 @@
 	TULIP_MEDIA_UNKNOWN
     };
 
+    TULIP_LOCK_ASSERT(sc);
+
     /*
      * Don't read phy specific registers if link is not up.
      */
@@ -1258,6 +1281,7 @@
 {
     unsigned phyaddr;
 
+    TULIP_LOCK_ASSERT(sc);
     for (phyaddr = 1; phyaddr < 32; phyaddr++) {
 	unsigned status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS);
 	if (status == 0 || status == 0xFFFF || status < PHYSTS_10BASET)
@@ -1280,6 +1304,7 @@
     tulip_softc_t * const sc,
     unsigned abilities)
 {
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_abilities = abilities;
     if (abilities & PHYSTS_100BASETX_FD) {
 	sc->tulip_probe_media = TULIP_MEDIA_100BASETX_FD;
@@ -1306,6 +1331,7 @@
 {
     struct ifnet *ifp = sc->tulip_ifp;
 
+    TULIP_LOCK_ASSERT(sc);
     switch (sc->tulip_probe_state) {
         case TULIP_PROBE_MEDIATEST:
         case TULIP_PROBE_INACTIVE: {
@@ -1406,6 +1432,7 @@
     const tulip_media_info_t *mi = NULL;
     tulip_media_t media = sc->tulip_media;
 
+    TULIP_LOCK_ASSERT(sc);
     if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE)
 	media = sc->tulip_media;
     else
@@ -1496,6 +1523,7 @@
     unsigned gpdata,
     unsigned cmdmode)
 {
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_mediums[media] = mip;
     mip->mi_type = TULIP_MEDIAINFO_GPR;
     mip->mi_cmdmode = cmdmode;
@@ -1508,6 +1536,7 @@
 {
     tulip_media_info_t *mip = sc->tulip_mediainfo;
 
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_gpinit = TULIP_GP_EB_PINS;
     sc->tulip_gpdata = TULIP_GP_EB_INIT;
     TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_PINS);
@@ -1554,6 +1583,7 @@
     tulip_media_info_t *mip = sc->tulip_mediainfo;
     unsigned gpdata;
 
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_gpinit = TULIP_GP_EB_PINS;
     sc->tulip_gpdata = TULIP_GP_EB_INIT;
     TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_PINS);
@@ -1608,6 +1638,7 @@
     tulip_media_info_t *mip = sc->tulip_mediainfo;
     int idx, cnt = 0;
 
+    TULIP_LOCK_ASSERT(sc);
     TULIP_CSR_WRITE(sc, csr_command, TULIP_CMD_PORTSELECT|TULIP_CMD_MUSTBEONE);
     TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
     DELAY(10);	/* Wait 10 microseconds (actually 50 PCI cycles but at 
@@ -1664,6 +1695,7 @@
     tulip_media_info_t *mip = sc->tulip_mediainfo;
     u_int32_t cmdmode = TULIP_CSR_READ(sc, csr_command);
 
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_gpinit = TULIP_GP_EM100_PINS;
     sc->tulip_gpdata = TULIP_GP_EM100_INIT;
     TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EM100_PINS);
@@ -1711,6 +1743,7 @@
     tulip_media_info_t *mip = sc->tulip_mediainfo;
     int cnt10 = 0, cnt100 = 0, idx;
 
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_gpinit = TULIP_GP_ZX34X_PINS;
     sc->tulip_gpdata = TULIP_GP_ZX34X_INIT;
     TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ZX34X_PINS);
@@ -1765,6 +1798,7 @@
 tulip_2114x_media_probe(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_cmdmode |= TULIP_CMD_MUSTBEONE
 	|TULIP_CMD_BACKOFFCTR|TULIP_CMD_THRSHLD72;
 }
@@ -1869,6 +1903,7 @@
     unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
     unsigned lastbit = (csr & MII_DOUT) ? msb : 0;
 
+    TULIP_LOCK_ASSERT(sc);
     csr |= MII_WR; MII_EMIT;  		/* clock low; assert write */
 
     for (; bits > 0; bits--, data <<= 1) {
@@ -1889,6 +1924,7 @@
 {
     unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
 
+    TULIP_LOCK_ASSERT(sc);
     if (cmd == MII_WRCMD) {
 	csr |= MII_DOUT; MII_EMIT;	/* clock low; change data */
 	csr ^= MII_CLKON; MII_EMIT;	/* clock high; data valid */
@@ -1909,6 +1945,7 @@
     unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
     int idx;
 
+    TULIP_LOCK_ASSERT(sc);
     for (idx = 0, data = 0; idx < 16; idx++) {
 	data <<= 1;	/* this is NOOP on the first pass through */
 	csr ^= MII_CLKON; MII_EMIT;	/* clock high; data valid */
@@ -1930,6 +1967,7 @@
     unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
     unsigned data;
 
+    TULIP_LOCK_ASSERT(sc);
     csr &= ~(MII_RD|MII_CLK); MII_EMIT;
     tulip_mii_writebits(sc, MII_PREAMBLE, 32);
     tulip_mii_writebits(sc, MII_RDCMD, 8);
@@ -1953,6 +1991,8 @@
     unsigned data)
 {
     unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
+
+    TULIP_LOCK_ASSERT(sc);
     csr &= ~(MII_RD|MII_CLK); MII_EMIT;
     tulip_mii_writebits(sc, MII_PREAMBLE, 32);
     tulip_mii_writebits(sc, MII_WRCMD, 8);
@@ -1975,6 +2015,7 @@
 tulip_identify_dec_nic(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     strcpy(sc->tulip_boardid, "DEC ");
 #define D0	4
     if (sc->tulip_chipid <= TULIP_21040)
@@ -1992,6 +2033,8 @@
     tulip_softc_t * const sc)
 {
     unsigned id = 0;
+
+    TULIP_LOCK_ASSERT(sc);
     strcpy(sc->tulip_boardid, "ZNYX ZX3XX ");
     if (sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A) {
 	unsigned znyx_ptr;
@@ -2088,6 +2131,7 @@
     int auibnc = 0, utp = 0;
     char *cp;
 
+    TULIP_LOCK_ASSERT(sc);
     strcpy(sc->tulip_boardid, "SMC ");
     if (sc->tulip_chipid == TULIP_21041)
 	return;
@@ -2133,6 +2177,7 @@
 tulip_identify_cogent_nic(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     strcpy(sc->tulip_boardid, "Cogent ");
     if (sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A) {
 	if (sc->tulip_rombuf[32] == TULIP_COGENT_EM100TX_ID) {
@@ -2169,6 +2214,7 @@
 tulip_identify_accton_nic(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     strcpy(sc->tulip_boardid, "ACCTON ");
     switch (sc->tulip_chipid) {
 	case TULIP_21140A:
@@ -2199,6 +2245,7 @@
 tulip_identify_asante_nic(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     strcpy(sc->tulip_boardid, "Asante ");
     if ((sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A)
 	    && sc->tulip_boardsw != &tulip_2114x_isv_boardsw) {
@@ -2255,6 +2302,7 @@
 tulip_identify_compex_nic(
     tulip_softc_t * const sc)
 {
+    TULIP_LOCK_ASSERT(sc);
     strcpy(sc->tulip_boardid, "COMPEX ");
     if (sc->tulip_chipid == TULIP_21140A) {
 	int root_unit;
@@ -2303,6 +2351,7 @@
     const u_int8_t *dp;
     u_int32_t leaf_offset, blocks, data;
 
+    TULIP_LOCK_ASSERT(sc);
     for (idx1 = 0; idx1 < shp->sh_adapter_count; idx1++, saip++) {
 	if (shp->sh_adapter_count == 1)
 	    break;
@@ -2882,6 +2931,7 @@
     tulip_media_t media;
     int medias = 0;
 
+    TULIP_LOCK_ASSERT(sc);
     for (media = TULIP_MEDIA_UNKNOWN; media < TULIP_MEDIA_MAX; media++) {
 	if (sc->tulip_mediums[media] != NULL) {
 	    ifmedia_add(&sc->tulip_ifmedia, tulip_media_to_ifmedia[media],
@@ -2909,6 +2959,7 @@
 {
     tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc;
 
+    TULIP_LOCK(sc);
     sc->tulip_flags |= TULIP_NEEDRESET;
     sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
     sc->tulip_media = TULIP_MEDIA_UNKNOWN;
@@ -2920,6 +2971,7 @@
 		sc->tulip_flags |= TULIP_PRINTMEDIA;
 		sc->tulip_flags &= ~TULIP_DIDNWAY;
 		tulip_linkup(sc, media);
+		TULIP_UNLOCK(sc);
 		return 0;
 	    }
 	}
@@ -2927,6 +2979,7 @@
     sc->tulip_flags &= ~(TULIP_TXPROBE_ACTIVE|TULIP_WANTRXACT);
     tulip_reset(sc);
     tulip_init(sc);
+    TULIP_UNLOCK(sc);
     return 0;
 }
 
@@ -2940,14 +2993,18 @@
 {
     tulip_softc_t *sc = (tulip_softc_t *)ifp->if_softc;
 
-    if (sc->tulip_media == TULIP_MEDIA_UNKNOWN)
+    TULIP_LOCK(sc);
+    if (sc->tulip_media == TULIP_MEDIA_UNKNOWN) {
+	TULIP_UNLOCK(sc);
 	return;
+    }
 
     req->ifm_status = IFM_AVALID;
     if (sc->tulip_flags & TULIP_LINKUP)
 	req->ifm_status |= IFM_ACTIVE;
 
     req->ifm_active = tulip_media_to_ifmedia[sc->tulip_media];
+    TULIP_UNLOCK(sc);
 }
 
 static void
@@ -2958,6 +3015,7 @@
     u_char *addrp;
     int multicnt;
 
+    TULIP_LOCK_ASSERT(sc);
     sc->tulip_flags &= ~(TULIP_WANTHASHPERFECT|TULIP_WANTHASHONLY|TULIP_ALLMULTI);
     sc->tulip_flags |= TULIP_WANTSETUP|TULIP_WANTTXSTART;
     sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN;
@@ -3103,6 +3161,8 @@
     tulip_desc_t *di;
     u_int32_t inreset = (sc->tulip_flags & TULIP_INRESET);
 
+    TULIP_LOCK_ASSERT(sc);
+
     /*
      * Brilliant.  Simply brilliant.  When switching modes/speeds
      * on a 2114*, you need to set the appriopriate MII/PCS/SCL/PS
@@ -3242,9 +3302,13 @@
 
 static void
 tulip_ifinit(
-    void * sc)
+    void *arg)
 {
-	tulip_init((tulip_softc_t *)sc);
+    tulip_softc_t *sc = (tulip_softc_t *)arg;
+
+    TULIP_LOCK(sc);
+    tulip_init(sc);
+    TULIP_UNLOCK(sc);
 }
 
 static void
@@ -3302,6 +3366,7 @@
     int cnt = 0;
 #endif
 
+    TULIP_LOCK_ASSERT(sc);
     for (;;) {
 	TULIP_PERFSTART(rxget)
 	tulip_desc_t *eop = ri->ri_nextin;
@@ -3499,6 +3564,7 @@
 		&& m0 != NULL
 #endif
 		) {
+		TULIP_UNLOCK(sc);
 #if !defined(TULIP_COPY_RXDATA)
 		ms->m_pkthdr.len = total_len;
 		ms->m_pkthdr.rcvif = ifp;
@@ -3511,6 +3577,7 @@
 		(*ifp->if_input)(ifp, m0);
 		m0 = ms;
 #endif /* ! TULIP_COPY_RXDATA */
+		TULIP_LOCK(sc);
 	    }
 	    ms = m0;
 	}
@@ -3597,6 +3664,7 @@
     int xmits = 0;
     int descs = 0;
 
+    TULIP_LOCK_ASSERT(sc);
     while (ri->ri_free < ri->ri_max) {
 	u_int32_t d_flag;
 
@@ -3729,6 +3797,7 @@
     u_int32_t mask;
     const char thrsh[] = "72|128\0\0\0" "96|256\0\0\0" "128|512\0\0" "160|1024";
 
+    TULIP_LOCK_ASSERT(sc);
     csr &= (1 << (sizeof(tulip_status_bits)/sizeof(tulip_status_bits[0]))) - 1;
     if_printf(sc->tulip_ifp, "abnormal interrupt:");
     for (sep = " ", mask = 1; mask <= csr; mask <<= 1, msgp++) {
@@ -3756,6 +3825,7 @@
     TULIP_PERFSTART(intr)
     u_int32_t csr;
 
+    TULIP_LOCK_ASSERT(sc);
     while ((csr = TULIP_CSR_READ(sc, csr_status)) & sc->tulip_intrmask) {
 	TULIP_CSR_WRITE(sc, csr_status, csr);
 
@@ -3852,10 +3922,12 @@
     tulip_softc_t * sc = arg;
 
     for (; sc != NULL; sc = sc->tulip_slaves) {
+	TULIP_LOCK(sc);
 #if defined(TULIP_DEBUG)
 	sc->tulip_dbg.dbg_intrs++;
 #endif
 	tulip_intr_handler(sc);
+	TULIP_UNLOCK(sc);
     }
 }
 
@@ -3865,10 +3937,12 @@
 {
     tulip_softc_t * sc = (tulip_softc_t *) arg;
 
+    TULIP_LOCK(sc);
 #if defined(TULIP_DEBUG)
     sc->tulip_dbg.dbg_intrs++;
 #endif
     tulip_intr_handler(sc);
+    TULIP_UNLOCK(sc);
 }
 
 static struct mbuf *
@@ -3946,6 +4020,7 @@
     struct mbuf *m0;
 #endif
 
+    TULIP_LOCK_ASSERT(sc);
 #if defined(TULIP_DEBUG)
     if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) {

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507272051.j6RKpqxc080871>