PERFORCE change 65139 for review

Marcel Moolenaar marcel at FreeBSD.org
Sun Nov 14 19:06:22 PST 2004


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

Change 65139 by marcel at marcel_nfs on 2004/11/15 03:05:56

	IFC @65138

Affected files ...

.. //depot/projects/uart/dev/acpica/acpi_snc.c#2 integrate
.. //depot/projects/uart/dev/em/if_em.c#10 integrate
.. //depot/projects/uart/dev/puc/puc_sbus.c#7 integrate
.. //depot/projects/uart/dev/uart/uart_bus.h#33 integrate
.. //depot/projects/uart/dev/uart/uart_core.c#37 integrate
.. //depot/projects/uart/dev/uart/uart_dev_ns8250.c#31 integrate
.. //depot/projects/uart/dev/uart/uart_subr.c#4 integrate
.. //depot/projects/uart/ia64/conf/GENERIC.hints#5 integrate
.. //depot/projects/uart/modules/acpi/Makefile#8 integrate
.. //depot/projects/uart/pci/if_sk.c#8 integrate

Differences ...

==== //depot/projects/uart/dev/acpica/acpi_snc.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/acpica/acpi_snc.c,v 1.2 2004/11/13 23:39:56 imp Exp $
+ *	$FreeBSD: src/sys/dev/acpica/acpi_snc.c,v 1.3 2004/11/14 20:37:41 truckman Exp $
  */
 
 #include "opt_acpi.h"
@@ -125,20 +125,20 @@
 		    acpi_snc_oids[i].comment);
 	}
 	
-	return_VALUE(0);
+	return (0);
 }
 
 static int 
 acpi_snc_detach(device_t dev)
 {
-	return_VALUE(0);
+	return (0);
 }
 #if 0
 static int
 acpi_snc_suspend(device_t dev)
 {
 	struct acpi_snc_softc *sc = device_get_softc(dev);
-	return_VALUE(0);
+	return (0);
 }
 
 static int

==== //depot/projects/uart/dev/em/if_em.c#10 (text+ko) ====

@@ -31,7 +31,7 @@
 
 ***************************************************************************/
 
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.53 2004/11/12 11:03:07 rwatson Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.54 2004/11/14 20:20:28 rwatson Exp $*/
 
 #include <dev/em/if_em.h>
 
@@ -598,8 +598,14 @@
                 IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
                 
                 if (m_head == NULL) break;
-                        
+
+		/*
+		 * em_encap() can modify our pointer, and or make it NULL on
+		 * failure.  In that event, we can't requeue.
+		 */
 		if (em_encap(adapter, &m_head)) { 
+			if (m_head == NULL)
+				break;
 			ifp->if_flags |= IFF_OACTIVE;
 			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
 			break;
@@ -1248,15 +1254,24 @@
 		struct ether_header eh;
 
 		m_head = m_pullup(m_head, sizeof(eh));
-		if (m_head == NULL)
+		if (m_head == NULL) {
+			*m_headp = NULL;
+                	bus_dmamap_destroy(adapter->txtag, q.map);
 			return (ENOBUFS);
+		}
 		eh = *mtod(m_head, struct ether_header *);
 		M_PREPEND(m_head, sizeof(*evl), M_DONTWAIT);
-		if (m_head == NULL)
+		if (m_head == NULL) {
+			*m_headp = NULL;
+                	bus_dmamap_destroy(adapter->txtag, q.map);
 			return (ENOBUFS);
+		}
 		m_head = m_pullup(m_head, sizeof(*evl));
-		if (m_head == NULL)
+		if (m_head == NULL) {
+			*m_headp = NULL;
+                	bus_dmamap_destroy(adapter->txtag, q.map);
 			return (ENOBUFS);
+		}
 		evl = mtod(m_head, struct ether_vlan_header *);
 		bcopy(&eh, evl, sizeof(*evl));
 		evl->evl_proto = evl->evl_encap_proto;

==== //depot/projects/uart/dev/puc/puc_sbus.c#7 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/puc/puc_sbus.c,v 1.4 2004/08/12 17:41:30 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/puc/puc_sbus.c,v 1.5 2004/11/15 02:47:37 marcel Exp $");
 
 #include "opt_puc.h"
 
@@ -51,7 +51,7 @@
 	const char *nm;
 
 	nm = ofw_bus_get_name(dev);
-	if (!strcmp(nm, "zs")) {
+	if (!strcmp(nm, "zs") && device_get_unit(dev) == 0) {
 		device_set_desc(dev, "Zilog Z8530 dual channel SCC");
 		return (0);
 	}

==== //depot/projects/uart/dev/uart/uart_bus.h#33 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/uart/uart_bus.h,v 1.7 2004/10/12 08:22:31 phk Exp $
+ * $FreeBSD: src/sys/dev/uart/uart_bus.h,v 1.8 2004/11/14 23:12:14 marcel Exp $
  */
 
 #ifndef _DEV_UART_BUS_H_
@@ -80,6 +80,7 @@
 #define	UART_IOCTL_BREAK	1
 #define	UART_IOCTL_IFLOW	2
 #define	UART_IOCTL_OFLOW	3
+#define	UART_IOCTL_BAUD		4
 
 /*
  * UART class & instance (=softc)

==== //depot/projects/uart/dev/uart/uart_core.c#37 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_core.c,v 1.10 2004/07/10 21:16:01 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_core.c,v 1.11 2004/11/14 23:12:14 marcel Exp $");
 
 #ifndef KLD_MODULE
 #include "opt_comconsole.h"
@@ -404,6 +404,11 @@
 	}
 
 	if (sc->sc_sysdev != NULL) {
+		if (sc->sc_sysdev->baudrate == 0) {
+			if (UART_IOCTL(sc, UART_IOCTL_BAUD,
+			    (intptr_t)&sc->sc_sysdev->baudrate) != 0)
+				sc->sc_sysdev->baudrate = -1;
+		}
 		switch (sc->sc_sysdev->type) {
 		case UART_DEV_CONSOLE:
 			device_printf(dev, "console");

==== //depot/projects/uart/dev/uart/uart_dev_ns8250.c#31 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_ns8250.c,v 1.10 2004/08/06 15:51:31 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_ns8250.c,v 1.12 2004/11/15 00:00:24 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -468,7 +468,7 @@
 ns8250_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
 {
 	struct uart_bas *bas;
-	int error;
+	int baudrate, divisor, error;
 	uint8_t efr, lcr;
 
 	bas = &sc->sc_bas;
@@ -514,6 +514,20 @@
 		uart_setreg(bas, REG_LCR, lcr);
 		uart_barrier(bas);
 		break;
+	case UART_IOCTL_BAUD:
+		lcr = uart_getreg(bas, REG_LCR);
+		uart_setreg(bas, REG_LCR, lcr | LCR_DLAB);
+		uart_barrier(bas);
+		divisor = uart_getdreg(bas, REG_DL);
+		uart_barrier(bas);
+		uart_setreg(bas, REG_LCR, lcr);
+		uart_barrier(bas);
+		baudrate = (divisor > 0) ? bas->rclk / divisor / 16 : 0;
+		if (baudrate > 0)
+			*(int*)data = baudrate;
+		else
+			error = ENXIO;
+		break;
 	default:
 		error = EINVAL;
 		break;

==== //depot/projects/uart/dev/uart/uart_subr.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_subr.c,v 1.2 2004/03/20 08:38:33 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_subr.c,v 1.3 2004/11/14 21:38:22 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -242,6 +242,26 @@
 	 */
 	if (addr == ~0U)
 		return (EINVAL);
+
+	/*
+	 * Accept only the well-known baudrates. Any invalid baudrate
+	 * is silently replaced with a 0-valued baudrate. The 0 baudrate
+	 * has special meaning. It means that we're not supposed to
+	 * program the baudrate and simply communicate with whatever
+	 * speed the hardware is currently programmed for.
+	 */
+	if (di->baudrate >= 19200) {
+		if (di->baudrate % 19200)
+			di->baudrate = 0;
+	} else if (di->baudrate >= 1200) {
+		if (di->baudrate % 1200)
+			di->baudrate = 0;
+	} else if (di->baudrate > 0) {
+		if (di->baudrate % 75)
+			di->baudrate = 0;
+	} else
+		di->baudrate = 0;
+
 	/* XXX the size of the mapping depends on the UART class. */
 	if (bus_space_map(di->bas.bst, addr, 8, 0, &di->bas.bsh) != 0)
 		return (EINVAL);

==== //depot/projects/uart/ia64/conf/GENERIC.hints#5 (text+ko) ====

@@ -1,2 +1,2 @@
-# $FreeBSD: src/sys/ia64/conf/GENERIC.hints,v 1.7 2004/03/20 04:23:03 marcel Exp $
-hw.uart.console="io:0x3f8,br:115200"
+# $FreeBSD: src/sys/ia64/conf/GENERIC.hints,v 1.8 2004/11/14 23:42:48 marcel Exp $
+hw.uart.console="io:0x3f8"

==== //depot/projects/uart/modules/acpi/Makefile#8 (text+ko) ====

@@ -1,4 +1,12 @@
-# $FreeBSD: src/sys/modules/acpi/Makefile,v 1.41 2004/11/11 22:54:57 imp Exp $
+# $FreeBSD: src/sys/modules/acpi/Makefile,v 1.42 2004/11/14 20:53:17 scottl Exp $
+
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64"
+.error "ACPI can only be compiled into the kernel on the amd64 and ia64 platforms"
+.endif
+
+.if ${MACHINE_ARCH} != "i386"
+.error "The ACPI module is only for i386"
+.endif
 
 SUBDIR=		acpi acpi_asus acpi_panasonic acpi_snc acpi_toshiba acpi_video
 

==== //depot/projects/uart/pci/if_sk.c#8 (text+ko) ====

@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/pci/if_sk.c,v 1.88 2004/11/13 20:21:57 bz Exp $");
+__FBSDID("$FreeBSD: src/sys/pci/if_sk.c,v 1.89 2004/11/14 20:17:01 obrien Exp $");
 
 /*
  * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports
@@ -136,7 +136,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-  "$FreeBSD: src/sys/pci/if_sk.c,v 1.88 2004/11/13 20:21:57 bz Exp $";
+  "$FreeBSD: src/sys/pci/if_sk.c,v 1.89 2004/11/14 20:17:01 obrien Exp $";
 #endif
 
 static struct sk_type sk_devs[] = {
@@ -1598,6 +1598,10 @@
 		}
 		sc->sk_rboff = SK_RBOFF_0;
 	}
+	device_printf(dev, "type = %s\n",
+	    (sc->sk_type == SK_GENESIS) ? "GENESIS" : "YUKON");
+	device_printf(dev, "SK_EPROM0 = 0x%02x\n", skrs);
+	device_printf(dev, "SRAM size = 0x%06x\n", sc->sk_ramsize);
 
 	/* Read and save physical media type */
 	switch(sk_win_read_1(sc, SK_PMDTYPE)) {
@@ -1650,6 +1654,12 @@
 			}
 		}
 	}
+
+	/* read CHIPVER 0xb1. */
+	device_printf(dev, "chip ver  0x%02x\n", sk_win_read_1(sc, SK_CHIPVER));
+	/* read CONFIG 0x73. */
+	device_printf(dev, "chip conf 0x%02x\n", sk_win_read_1(sc, SK_CONFIG));
+
 	sc->sk_devs[SK_PORT_A] = device_add_child(dev, "sk", -1);
 	port = malloc(sizeof(int), M_DEVBUF, M_NOWAIT);
 	*port = SK_PORT_A;


More information about the p4-projects mailing list