PERFORCE change 34540 for review

Marcel Moolenaar marcel at FreeBSD.org
Tue Jul 15 03:32:39 PDT 2003


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

Change 34540 by marcel at marcel_nfs on 2003/07/15 03:31:52

	Delay calling makedev() until after we called make_dev().
	That way we can use MAJOR_AUTO even though we can be the
	console.
	
	While here, obsolete uart_tty.h. It only contains three
	prototypes now, which is not worth a seperate header file.

Affected files ...

.. //depot/projects/uart/dev/uart/uart_bus.h#5 edit
.. //depot/projects/uart/dev/uart/uart_core.c#6 edit
.. //depot/projects/uart/dev/uart/uart_cpu.h#2 edit
.. //depot/projects/uart/dev/uart/uart_tty.c#4 edit

Differences ...

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

@@ -107,6 +107,10 @@
 int uart_bus_detach(device_t dev);
 int uart_bus_probe(device_t dev, int regshft, int rclk, int rid);
 
+int uart_tty_attach(struct uart_softc *);
+int uart_tty_detach(struct uart_softc *);
+void uart_tty_intr(void *arg);
+
 static __inline int
 uart_rx_put(struct uart_softc *sc, int xc)
 {

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

@@ -31,7 +31,6 @@
 #include <sys/systm.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
-#include <sys/cons.h>
 #include <sys/interrupt.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
@@ -45,13 +44,9 @@
 #include <dev/uart/uart.h>
 #include <dev/uart/uart_bus.h>
 #include <dev/uart/uart_cpu.h>
-#include <dev/uart/uart_tty.h>
 
 #include "uart_if.h"
 
-extern struct uart_devinfo uart_console;
-extern struct uart_devinfo uart_dbgport;
-
 devclass_t uart_devclass;
 char uart_driver_name[] = "uart";
 
@@ -299,8 +294,6 @@
 		sep = "";
 		device_print_prettyname(dev);
 		if (sc->sc_console) {
-			((struct consdev *)uart_console.consdev)->cn_dev =
-			    makedev(UART_CDEV_MAJOR, device_get_unit(dev));
 			printf("%sconsole", sep);
 			sep = ", ";
 		}

==== //depot/projects/uart/dev/uart/uart_cpu.h#2 (text+ko) ====

@@ -66,6 +66,9 @@
 	void	*consdev;		/* Yedi trick. See uart_cons.c */
 };
 
+extern struct uart_devinfo uart_console;
+extern struct uart_devinfo uart_dbgport;
+
 #define	UART_DEV_CONSOLE	0
 #define	UART_DEV_DBGPORT	1
 

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

@@ -36,13 +36,14 @@
 #include <machine/bus.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
+#include <sys/cons.h>
 #include <sys/interrupt.h>
 #include <sys/kobj.h>
 #include <sys/tty.h>
 
 #include <dev/uart/uart.h>
 #include <dev/uart/uart_bus.h>
-#include <dev/uart/uart_tty.h>
+#include <dev/uart/uart_cpu.h>
 
 #define	CALLOUT_MASK		0x80
 #define	CONTROL_MASK		0x60
@@ -61,7 +62,7 @@
 	.d_ioctl =	uart_ioctl,
 	.d_poll =	ttypoll,
 	.d_name =	uart_driver_name,
-	.d_maj =	UART_CDEV_MAJOR,
+	.d_maj =	MAJOR_AUTO,
 	.d_flags =	D_TTY,
 	.d_kqfilter =	ttykqfilter,
 };
@@ -169,6 +170,11 @@
 
 	tp->t_dev = sc->sc_si;
 
+	if (sc->sc_console) {
+		((struct consdev *)uart_console.consdev)->cn_dev =
+		    makedev(uart_cdevsw.d_maj, device_get_unit(sc->sc_dev));
+	}
+
 	swi_add(&tty_ithd, uart_driver_name, uart_tty_intr, sc, SWI_TTY,
 	    INTR_TYPE_TTY, &sc->sc_softih);
 


More information about the p4-projects mailing list