[Midnightbsd-cvs] src: dev/sio: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Dec 1 22:13:23 EST 2008


Log Message:
-----------
sync with freebsd

Modified Files:
--------------
    src/sys/dev/sio:
        sio.c (r1.2 -> r1.3)
        sio_pccard.c (r1.1.1.1 -> r1.2)
        sio_pci.c (r1.1.1.1 -> r1.2)
        sio_puc.c (r1.1.1.1 -> r1.2)

-------------- next part --------------
Index: sio_pci.c
===================================================================
RCS file: /home/cvs/src/sys/dev/sio/sio_pci.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/dev/sio/sio_pci.c -L sys/dev/sio/sio_pci.c -u -r1.1.1.1 -r1.2
--- sys/dev/sio/sio_pci.c
+++ sys/dev/sio/sio_pci.c
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sio/sio_pci.c,v 1.21 2005/05/29 04:42:25 nyan Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sio/sio_pci.c,v 1.23 2007/03/29 04:26:52 maxim Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
Index: sio_pccard.c
===================================================================
RCS file: /home/cvs/src/sys/dev/sio/sio_pccard.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/dev/sio/sio_pccard.c -L sys/dev/sio/sio_pccard.c -u -r1.1.1.1 -r1.2
--- sys/dev/sio/sio_pccard.c
+++ sys/dev/sio/sio_pccard.c
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sio/sio_pccard.c,v 1.15 2005/05/29 04:42:25 nyan Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sio/sio_pccard.c,v 1.18 2006/09/14 03:47:59 jmg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,23 +44,15 @@
 
 #include <dev/sio/siovar.h>
 
-#include "pccarddevs.h"
-
 static	int	sio_pccard_attach(device_t dev);
-static	int	sio_pccard_match(device_t self);
 static	int	sio_pccard_probe(device_t dev);
 
 static device_method_t sio_pccard_methods[] = {
 	/* Device interface */
-	DEVMETHOD(device_probe,		pccard_compat_probe),
-	DEVMETHOD(device_attach,	pccard_compat_attach),
+	DEVMETHOD(device_probe,		sio_pccard_probe),
+	DEVMETHOD(device_attach,	sio_pccard_attach),
 	DEVMETHOD(device_detach,	siodetach),
 
-	/* Card interface */
-	DEVMETHOD(card_compat_match,	sio_pccard_match),
-	DEVMETHOD(card_compat_probe,	sio_pccard_probe),
-	DEVMETHOD(card_compat_attach,	sio_pccard_attach),
-
 	{ 0, 0 }
 };
 
@@ -71,7 +63,7 @@
 };
 
 static int
-sio_pccard_match(device_t dev)
+sio_pccard_probe(device_t dev)
 {
 	int		error = 0;
 	u_int32_t	fcn = PCCARD_FUNCTION_UNSPEC;
@@ -79,6 +71,7 @@
 	error = pccard_get_function(dev, &fcn);
 	if (error != 0)
 		return (error);
+
 	/*
 	 * If a serial card, we are likely the right driver.  However,
 	 * some serial cards are better servered by other drivers, so
@@ -86,27 +79,21 @@
 	 */
 	if (fcn == PCCARD_FUNCTION_SERIAL)
 		return (-100);
-
-	return(ENXIO);
+	return (ENXIO);
 }
 
 static int
-sio_pccard_probe(dev)
-	device_t	dev;
+sio_pccard_attach(device_t dev)
 {
+	int err;
 
 #ifdef PC98
 	SET_FLAG(dev, SET_IFTYPE(COM_IF_MODEM_CARD));
 #endif
 	/* Do not probe IRQ - pccard doesn't turn on the interrupt line */
 	/* until bus_setup_intr */
-	return (sioprobe(dev, 0, 0UL, 1));
-}
-
-static int
-sio_pccard_attach(dev)
-	device_t	dev;
-{
+	if ((err = sioprobe(dev, 0, 0UL, 1)) > 0)
+		return (err);
 	return (sioattach(dev, 0, 0UL));
 }
 
Index: sio_puc.c
===================================================================
RCS file: /home/cvs/src/sys/dev/sio/sio_puc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/dev/sio/sio_puc.c -L sys/dev/sio/sio_puc.c -u -r1.1.1.1 -r1.2
--- sys/dev/sio/sio_puc.c
+++ sys/dev/sio/sio_puc.c
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sio/sio_puc.c,v 1.9 2005/05/29 04:42:25 nyan Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sio/sio_puc.c,v 1.10 2006/04/28 21:21:52 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -39,8 +39,8 @@
 #include <machine/bus.h>
 #include <sys/timepps.h>
 
-#include <dev/pci/pcivar.h>
-#include <dev/puc/pucvar.h>
+#include <dev/puc/puc_bus.h>
+
 #include <dev/sio/siovar.h>
 #include <dev/sio/sioreg.h>
 
@@ -63,30 +63,37 @@
 };
 
 static int
-sio_puc_attach(dev)
-	device_t	dev;
+sio_puc_attach(device_t dev)
 {
 	uintptr_t rclk;
 
-	if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ,
+	if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_CLOCK,
 	    &rclk) != 0)
 		rclk = DEFAULT_RCLK;
 	return (sioattach(dev, 0, rclk));
 }
 
 static int
-sio_puc_probe(dev)
-	device_t	dev;
+sio_puc_probe(device_t dev)
 {
-	uintptr_t rclk;
+	device_t parent;
+	uintptr_t rclk, type;
+	int error;
+
+	parent = device_get_parent(dev);
+
+	if (BUS_READ_IVAR(parent, dev, PUC_IVAR_TYPE, &type))
+		return (ENXIO);
+	if (type != PUC_TYPE_SERIAL)
+		return (ENXIO);
 
-	if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_FREQ,
-	    &rclk) != 0)
+	if (BUS_READ_IVAR(parent, dev, PUC_IVAR_CLOCK, &rclk))
 		rclk = DEFAULT_RCLK;
 #ifdef PC98
 	SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550));
 #endif
-	return (sioprobe(dev, 0, rclk, 1));
+	error = sioprobe(dev, 0, rclk, 1);
+	return ((error > 0) ? error : BUS_PROBE_LOW_PRIORITY);
 }
 
 DRIVER_MODULE(sio, puc, sio_puc_driver, sio_devclass, 0, 0);
Index: sio.c
===================================================================
RCS file: /home/cvs/src/sys/dev/sio/sio.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/dev/sio/sio.c -L sys/dev/sio/sio.c -u -r1.2 -r1.3
--- sys/dev/sio/sio.c
+++ sys/dev/sio/sio.c
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sio/sio.c,v 1.459.2.1 2006/03/10 19:37:32 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sio/sio.c,v 1.470 2007/02/23 12:18:53 piso Exp $");
 
 #include "opt_comconsole.h"
 #include "opt_compat.h"
@@ -45,8 +45,8 @@
  * Works for National Semiconductor NS8250-NS16550AF UARTs.
  * COM driver, based on HP dca driver.
  *
- * Changes for PC-Card integration:
- *	- Added PC-Card driver table and handlers
+ * Changes for PC Card integration:
+ *	- Added PC Card driver table and handlers
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -263,7 +263,7 @@
 static	int	comopen(struct tty *tp, struct cdev *dev);
 static	void	sioinput(struct com_s *com);
 static	void	siointr1(struct com_s *com);
-static	void	siointr(void *arg);
+static	int	siointr(void *arg);
 static	int	commodem(struct tty *tp, int sigon, int sigoff);
 static	int	comparam(struct tty *tp, struct termios *t);
 static	void	siopoll(void *);
@@ -370,7 +370,7 @@
 
 SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW,
 	    0, 0, sysctl_machdep_comdefaultrate, "I", "");
-/* TUNABLE_INT("machdep.conspeed", &comdefaultrate); */
+TUNABLE_INT("machdep.conspeed", __DEVOLATILE(int *, &comdefaultrate));
 
 #define SET_FLAG(dev, bit) device_set_flags(dev, device_get_flags(dev) | (bit))
 #define CLR_FLAG(dev, bit) device_set_flags(dev, device_get_flags(dev) & ~(bit))
@@ -700,7 +700,7 @@
 			device_set_softc(dev, NULL);
 			free(com, M_DEVBUF);
 		}
-		return (result);
+		return (result == 0 ? BUS_PROBE_DEFAULT + 1 : result);
 	}
 
 	/*
@@ -777,7 +777,7 @@
 		device_set_softc(dev, NULL);
 		free(com, M_DEVBUF);
 	}
-	return (result);
+	return (result == 0 ? BUS_PROBE_DEFAULT + 1 : result);
 }
 
 #ifdef COM_ESP
@@ -1074,13 +1074,14 @@
 	rid = 0;
 	com->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
 	if (com->irqres) {
-		ret = BUS_SETUP_INTR(device_get_parent(dev), dev, com->irqres,
-				     INTR_TYPE_TTY | INTR_FAST,
-				     siointr, com, &com->cookie);
+		ret = bus_setup_intr(dev, com->irqres,
+				     INTR_TYPE_TTY,
+				     siointr, NULL, com, 
+				     &com->cookie);
 		if (ret) {
-			ret = BUS_SETUP_INTR(device_get_parent(dev), dev,
+			ret = bus_setup_intr(dev,
 					     com->irqres, INTR_TYPE_TTY,
-					     siointr, com, &com->cookie);
+					     NULL, (driver_intr_t *)siointr, com, &com->cookie);
 			if (ret == 0)
 				device_printf(dev, "unable to activate interrupt in fast mode - using normal mode\n");
 		}
@@ -1099,7 +1100,7 @@
 	}
 
 	/* We're ready, open the doors... */
-	ttycreate(tp, NULL, unit, MINOR_CALLOUT, "d%r", unit);
+	ttycreate(tp, TS_CALLOUT, "d%r", unit);
 
 	return (0);
 }
@@ -1378,7 +1379,7 @@
 		outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
 }
 
-static void
+static int
 siointr(arg)
 	void		*arg;
 {
@@ -1422,6 +1423,7 @@
 	} while (possibly_more_intrs);
 	mtx_unlock_spin(&sio_lock);
 #endif /* COM_MULTIPORT */
+	return(FILTER_HANDLED);
 }
 
 static struct timespec siots[8];
@@ -2273,15 +2275,13 @@
 static void siocnopen(struct siocnstate *sp, Port_t iobase, int speed);
 static void siocntxwait(Port_t iobase);
 
-static cn_probe_t siocnprobe;
-static cn_init_t siocninit;
-static cn_term_t siocnterm;
-static cn_checkc_t siocncheckc;
-static cn_getc_t siocngetc;
-static cn_putc_t siocnputc;
+static cn_probe_t sio_cnprobe;
+static cn_init_t sio_cninit;
+static cn_term_t sio_cnterm;
+static cn_getc_t sio_cngetc;
+static cn_putc_t sio_cnputc;
 
-CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc,
-	    siocnputc, NULL);
+CONSOLE_DRIVER(sio);
 
 static void
 siocntxwait(iobase)
@@ -2403,7 +2403,7 @@
 }
 
 static void
-siocnprobe(cp)
+sio_cnprobe(cp)
 	struct consdev	*cp;
 {
 	speed_t			boot_speed;
@@ -2486,21 +2486,21 @@
 }
 
 static void
-siocninit(cp)
+sio_cninit(cp)
 	struct consdev	*cp;
 {
 	comconsole = cp->cn_unit;
 }
 
 static void
-siocnterm(cp)
+sio_cnterm(cp)
 	struct consdev	*cp;
 {
 	comconsole = -1;
 }
 
 static int
-siocncheckc(struct consdev *cd)
+sio_cngetc(struct consdev *cd)
 {
 	int	c;
 	Port_t	iobase;
@@ -2530,38 +2530,8 @@
 	return (c);
 }
 
-static int
-siocngetc(struct consdev *cd)
-{
-	int	c;
-	Port_t	iobase;
-	int	s;
-	struct siocnstate	sp;
-	speed_t	speed;
-
-	if (cd != NULL && cd->cn_unit == siocnunit) {
-		iobase = siocniobase;
-		speed = comdefaultrate;
-	} else {
-#ifdef GDB
-		iobase = siogdbiobase;
-		speed = gdbdefaultrate;
-#else
-		return (-1);
-#endif
-	}
-	s = spltty();
-	siocnopen(&sp, iobase, speed);
-	while (!(inb(iobase + com_lsr) & LSR_RXRDY))
-		;
-	c = inb(iobase + com_data);
-	siocnclose(&sp, iobase);
-	splx(s);
-	return (c);
-}
-
 static void
-siocnputc(struct consdev *cd, int c)
+sio_cnputc(struct consdev *cd, int c)
 {
 	int	need_unlock;
 	int	s;
@@ -2607,11 +2577,9 @@
 static gdb_init_f siogdbinit;
 static gdb_term_f siogdbterm;
 static gdb_getc_f siogdbgetc;
-static gdb_checkc_f siogdbcheckc;
 static gdb_putc_f siogdbputc;
 
-GDB_DBGPORT(sio, siogdbprobe, siogdbinit, siogdbterm, siogdbcheckc,
-    siogdbgetc, siogdbputc);
+GDB_DBGPORT(sio, siogdbprobe, siogdbinit, siogdbterm, siogdbgetc, siogdbputc);
 
 static int
 siogdbprobe(void)
@@ -2632,19 +2600,13 @@
 static void
 siogdbputc(int c)
 {
-	siocnputc(NULL, c);
-}
-
-static int
-siogdbcheckc(void)
-{
-	return (siocncheckc(NULL));
+	sio_cnputc(NULL, c);
 }
 
 static int
 siogdbgetc(void)
 {
-	return (siocngetc(NULL));
+	return (sio_cngetc(NULL));
 }
 
 #endif


More information about the Midnightbsd-cvs mailing list