Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PERFORCE change 90467 for review



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

Change 90467 by alc@alc_home on 2006/01/27 08:48:47

	IFC for macro changes

Affected files ...

.. //depot/projects/superpages/src/sys/dev/ed/if_ed.c#3 integrate
.. //depot/projects/superpages/src/sys/dev/ed/if_ed_3c503.c#2 integrate
.. //depot/projects/superpages/src/sys/dev/ed/if_ed_hpp.c#2 integrate
.. //depot/projects/superpages/src/sys/dev/ed/if_edvar.h#3 integrate
.. //depot/projects/superpages/src/sys/kern/vfs_aio.c#6 integrate
.. //depot/projects/superpages/src/sys/vm/vm_fault.c#5 integrate

Differences ...

==== //depot/projects/superpages/src/sys/dev/ed/if_ed.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ed/if_ed.c,v 1.266 2005/11/11 16:04:51 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ed/if_ed.c,v 1.268 2006/01/27 08:25:46 imp Exp $");
 
 /*
  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -310,13 +310,17 @@
 				    dot3ChipSetNational8390);
 	sc->mibdata.dot3Compliance = DOT3COMPLIANCE_COLLS;
 
+	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	/*
-	 * Set default state for ALTPHYS flag (used to disable the 
+	 * Set default state for LINK2 flag (used to disable the 
 	 * tranceiver for AUI operation), based on config option.
+	 * We only set this flag before we attach the device, so there's
+	 * no race.  It is convenient to allow users to turn this off
+	 * by default in the kernel config, but given our more advanced
+	 * boot time configuration options, this might no longer be needed.
 	 */
-	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	if (device_get_flags(dev) & ED_FLAGS_DISABLE_TRANCEIVER)
-		ifp->if_flags |= IFF_ALTPHYS;
+		ifp->if_flags |= IFF_LINK2;
 
 	/*
 	 * Attach the interface
@@ -338,12 +342,12 @@
 			    sc->hpp_mem_start ? "memory mapped" : "regular");
 		else
 #endif
-			printf("%s ", sc->isa16bit ? "(16 bit)" : "(8 bit)");
+			printf("%s", sc->isa16bit ? "(16 bit)" : "(8 bit)");
 
 #if defined(ED_HPP) || defined(ED_3C503)
 		printf("%s", (((sc->vendor == ED_VENDOR_3COM) ||
 				    (sc->vendor == ED_VENDOR_HP)) &&
-			   (ifp->if_flags & IFF_ALTPHYS)) ?
+			   (ifp->if_flags & IFF_LINK2)) ?
 		    " tranceiver disabled" : "");
 #endif
 		printf("\n");
@@ -569,20 +573,8 @@
 	 */
 	ed_nic_outb(sc, ED_P0_TCR, 0);
 
-#ifdef ED_3C503
-	/*
-	 * If this is a 3Com board, the tranceiver must be software enabled
-	 * (there is no settable hardware default).
-	 */
-	if (sc->vendor == ED_VENDOR_3COM) {
-		if (ifp->if_flags & IFF_ALTPHYS)
-			ed_asic_outb(sc, ED_3COM_CR, 0);
-		else
-			ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
-	}
-#endif
 	if (sc->sc_mediachg)
-	    sc->sc_mediachg(sc);
+		sc->sc_mediachg(sc);
 
 	/*
 	 * Set 'running' flag, and clear output active flag.
@@ -1223,12 +1215,15 @@
 	case SIOCSIFFLAGS:
 		/*
 		 * If the interface is marked up and stopped, then start it.
+		 * If we're up and already running, then it may be a mediachg.
 		 * If it is marked down and running, then stop it.
 		 */
 		ED_LOCK(sc);
 		if (ifp->if_flags & IFF_UP) {
 			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 				ed_init_locked(sc);
+			else if (sc->sc_mediachg)
+				sc->sc_mediachg(sc);
 		} else {
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 				ed_stop(sc);
@@ -1241,23 +1236,6 @@
 		 */
 		ed_setrcr(sc);
 
-		/*
-		 * An unfortunate hack to provide the (required) software
-		 * control of the tranceiver for 3Com/HP boards.
-		 * The ALTPHYS flag disables the tranceiver if set.
-		 */
-#ifdef ED_3C503
-		if (sc->vendor == ED_VENDOR_3COM) {
-			if (ifp->if_flags & IFF_ALTPHYS)
-				ed_asic_outb(sc, ED_3COM_CR, 0);
-			else
-				ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
-		}
-#endif
-#ifdef ED_HPP
-		if (sc->vendor == ED_VENDOR_HP) 
-			ed_hpp_set_physical_link(sc);
-#endif
 		ED_UNLOCK(sc);
 		break;
 

==== //depot/projects/superpages/src/sys/dev/ed/if_ed_3c503.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ed/if_ed_3c503.c,v 1.3 2005/08/28 23:56:25 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ed/if_ed_3c503.c,v 1.4 2006/01/27 08:25:47 imp Exp $");
 
 #include "opt_ed.h"
 
@@ -60,6 +60,8 @@
 #include <dev/ed/if_edreg.h>
 #include <dev/ed/if_edvar.h>
 
+static void ed_3c503_mediachg(struct ed_softc *sc);
+
 /*
  * Probe and vendor-specific initialization routine for 3Com 3c503 boards
  */
@@ -335,7 +337,25 @@
 	ed_asic_outb(sc, ED_3COM_VPTR1, 0xff);
 	ed_asic_outb(sc, ED_3COM_VPTR0, 0x00);
 
-	return (ed_clear_memory(dev));
+	error = ed_clear_memory(dev);
+	if (error == 0)
+		sc->sc_mediachg = ed_3c503_mediachg;
+	return (error);
+}
+
+static void
+ed_3c503_mediachg(struct ed_softc *sc)
+{
+	struct ifnet *ifp = sc->ifp;
+
+	/*
+	 * If this is a 3Com board, the tranceiver must be software enabled
+	 * (there is no settable hardware default).
+	 */
+	if (ifp->if_flags & IFF_LINK2)
+		ed_asic_outb(sc, ED_3COM_CR, 0);
+	else
+		ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
 }
 
 #endif /* ED_3C503 */

==== //depot/projects/superpages/src/sys/dev/ed/if_ed_hpp.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ed/if_ed_hpp.c,v 1.3 2005/08/28 23:56:25 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ed/if_ed_hpp.c,v 1.6 2006/01/27 08:25:47 imp Exp $");
 
 #include "opt_ed.h"
 
@@ -62,6 +62,7 @@
 
 static void	ed_hpp_writemem(struct ed_softc *, uint8_t *, uint16_t,
 		    uint16_t);
+static void	ed_hpp_set_physical_link(struct ed_softc *sc);
 
 /*
  * Interrupt conversion table for the HP PC LAN+
@@ -141,7 +142,7 @@
 	    (ed_asic_inb(sc, ED_HPP_ID + 1) != 0x48) ||
 	    ((ed_asic_inb(sc, ED_HPP_ID + 2) & 0xF0) != 0) ||
 	    (ed_asic_inb(sc, ED_HPP_ID + 3) != 0x53))
-		return ENXIO;
+		return (ENXIO);
 
 	/* 
 	 * Read the MAC address and verify checksum on the address.
@@ -155,7 +156,7 @@
 	checksum += ed_asic_inb(sc, ED_HPP_MAC_ADDR + ETHER_ADDR_LEN);
 
 	if (checksum != 0xFF)
-		return ENXIO;
+		return (ENXIO);
 
 	/*
 	 * Verify that the software model number is 0.
@@ -164,7 +165,7 @@
 	ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_ID);
 	if (((sc->hpp_id = ed_asic_inw(sc, ED_HPP_PAGE_4)) & 
 		ED_HPP_ID_SOFT_MODEL_MASK) != 0x0000)
-		return ENXIO;
+		return (ENXIO);
 
 	/*
 	 * Read in and save the current options configured on card.
@@ -194,7 +195,7 @@
 	DELAY(5000);
 
 	if (!(ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RST))
-		return ENXIO;	/* reset did not complete */
+		return (ENXIO);	/* reset did not complete */
 
 	/*
 	 * Read out configuration information.
@@ -209,7 +210,7 @@
 	 */
 
 	if (irq >= (sizeof(ed_hpp_intr_val) / sizeof(ed_hpp_intr_val[0])))
-		return ENXIO;
+		return (ENXIO);
 
 	/* 
 	 * If the kernel IRQ was specified with a '?' use the cards idea
@@ -267,7 +268,7 @@
 			return (error);
 		
 		if (mem_addr != conf_maddr)
-			return ENXIO;
+			return (ENXIO);
 
 		error = ed_alloc_memory(dev, 0, memsize);
 		if (error)
@@ -352,9 +353,10 @@
 
 		if (bcmp(test_pattern, test_buffer, 
 			sizeof(test_pattern)))
-			return ENXIO;
+			return (ENXIO);
 	}
 
+	sc->sc_mediachg = ed_hpp_set_physical_link;
 	return (0);
 }
 
@@ -362,7 +364,7 @@
  * HP PC Lan+ : Set the physical link to use AUI or TP/TL.
  */
 
-void
+static void
 ed_hpp_set_physical_link(struct ed_softc *sc)
 {
 	struct ifnet *ifp = sc->ifp;
@@ -371,7 +373,7 @@
 	ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_LAN);
 	lan_page = ed_asic_inw(sc, ED_HPP_PAGE_0);
 
-	if (ifp->if_flags & IFF_ALTPHYS) {
+	if (ifp->if_flags & IFF_LINK2) {
 		/*
 		 * Use the AUI port.
 		 */

==== //depot/projects/superpages/src/sys/dev/ed/if_edvar.h#3 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/ed/if_edvar.h,v 1.38 2005/10/05 05:21:07 imp Exp $
+ * $FreeBSD: src/sys/dev/ed/if_edvar.h,v 1.40 2006/01/27 08:25:47 imp Exp $
  */
 
 #ifndef SYS_DEV_ED_IF_EDVAR_H
@@ -220,7 +220,6 @@
 
 /* The following is unsatisfying XXX */
 #ifdef ED_HPP
-void	ed_hpp_set_physical_link(struct ed_softc *);
 void	ed_hpp_readmem(struct ed_softc *, bus_size_t, uint8_t *, uint16_t);
 u_short	ed_hpp_write_mbufs(struct ed_softc *, struct mbuf *, int);
 #endif
@@ -243,7 +242,7 @@
 #define ED_VENDOR_SIC		0x04		/* Allied-Telesis SIC */
 
 /*
- * Compile-time config flags
+ * Configure time flags
  */
 /*
  * this sets the default for enabling/disabling the transceiver

==== //depot/projects/superpages/src/sys/kern/vfs_aio.c#6 (text+ko) ====

@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_aio.c,v 1.217 2006/01/27 04:14:16 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_aio.c,v 1.218 2006/01/27 08:02:25 davidxu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -763,6 +763,8 @@
 		auio.uio_rw = UIO_READ;
 		error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET, td);
 	} else {
+		if (fp->f_type == DTYPE_VNODE)
+			bwillwrite();
 		auio.uio_rw = UIO_WRITE;
 		error = fo_write(fp, &auio, fp->f_cred, FOF_OFFSET, td);
 	}

==== //depot/projects/superpages/src/sys/vm/vm_fault.c#5 (text+ko) ====

@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/vm/vm_fault.c,v 1.211 2005/12/31 14:39:20 netchild Exp $");
+__FBSDID("$FreeBSD: src/sys/vm/vm_fault.c,v 1.212 2006/01/27 08:35:32 alc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -410,7 +410,8 @@
 
 			vm_pageq_remove_nowakeup(fs.m);
 
-			if (queue == PQ_CACHE && vm_page_count_severe()) {
+			if (VM_PAGE_RESOLVEQUEUE(fs.m, queue) == PQ_CACHE &&
+			    vm_page_count_severe()) {
 				vm_page_activate(fs.m);
 				vm_page_unlock_queues();
 				unlock_and_deallocate(&fs);