Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Oct 2008 05:04:51 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 151201 for review
Message-ID:  <200810100504.m9A54pUU086130@repoman.freebsd.org>

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

Change 151201 by imp@imp_paco-paco on 2008/10/10 05:03:50

	loopback the cfe and siba fixes with -i

Affected files ...

.. //depot/projects/mips2/src/sys/dev/cfe/cfe_api.c#2 integrate
.. //depot/projects/mips2/src/sys/dev/cfe/cfe_api.h#2 integrate
.. //depot/projects/mips2/src/sys/dev/cfe/cfe_api_int.h#2 integrate
.. //depot/projects/mips2/src/sys/dev/cfe/cfe_console.c#3 integrate
.. //depot/projects/mips2/src/sys/dev/cfe/cfe_error.h#2 integrate
.. //depot/projects/mips2/src/sys/dev/cfe/cfe_ioctl.h#2 integrate
.. //depot/projects/mips2/src/sys/dev/cfe/cfe_resource.c#3 integrate
.. //depot/projects/mips2/src/sys/dev/siba/siba.c#7 integrate
.. //depot/projects/mips2/src/sys/dev/siba/siba_ids.h#3 integrate
.. //depot/projects/mips2/src/sys/dev/siba/siba_pcib.c#5 integrate
.. //depot/projects/mips2/src/sys/dev/siba/siba_pcibvar.h#3 integrate
.. //depot/projects/mips2/src/sys/dev/siba/sibareg.h#3 integrate
.. //depot/projects/mips2/src/sys/dev/siba/sibavar.h#4 integrate

Differences ...

==== //depot/projects/mips2/src/sys/dev/cfe/cfe_api.c#2 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/cfe/cfe_api.h#2 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/cfe/cfe_api_int.h#2 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/cfe/cfe_console.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/sys/dev/cfe/cfe_console.c,v 1.4 2008/09/28 03:33:01 imp Exp $");
 
 #include "opt_comconsole.h"
 
@@ -46,19 +46,19 @@
 #include <ddb/ddb.h>
 
 #ifndef	CFECONS_POLL_HZ
-#define	CFECONS_POLL_HZ	4	/* 50-100 works best on Ultra2 */
+#define	CFECONS_POLL_HZ	4
 #endif
 #define CFEBURSTLEN	128	/* max number of bytes to write in one chunk */
 
-static d_open_t		cfe_dev_open;
-static d_close_t	cfe_dev_close;
+static tsw_open_t cfe_tty_open;
+static tsw_close_t cfe_tty_close;
+static tsw_outwakeup_t cfe_tty_outwakeup;
 
-static struct cdevsw cfe_cdevsw = {
-	.d_version =	D_VERSION,
-	.d_open =	cfe_dev_open,
-	.d_close =	cfe_dev_close,
-	.d_name =	"cfe",
-	.d_flags =	D_TTY | D_NEEDGIANT,
+static struct ttydevsw cfe_ttydevsw = {
+	.tsw_flags	= TF_NOPREFIX,
+	.tsw_open	= cfe_tty_open,
+	.tsw_close	= cfe_tty_close,
+	.tsw_outwakeup	= cfe_tty_outwakeup,
 };
 
 static int			conhandle = -1;
@@ -72,9 +72,6 @@
 static int			alt_break_state;
 #endif
 
-static void	cfe_tty_start(struct tty *);
-static int	cfe_tty_param(struct tty *, struct termios *);
-static void	cfe_tty_stop(struct tty *, int);
 static void	cfe_timeout(void *);
 
 static cn_probe_t	cfe_cnprobe;
@@ -89,123 +86,47 @@
 cn_drvinit(void *unused)
 {
 	char output[32];
-	struct cdev *dev;
+	struct tty *tp;
 
 	if (cfe_consdev.cn_pri != CN_DEAD &&
 	    cfe_consdev.cn_name[0] != '\0') {
-		dev = make_dev(&cfe_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s",
-		    output);
-		make_dev_alias(dev, "cfecons");
+		tp = tty_alloc(&cfe_ttydevsw, NULL, NULL);
+		tty_makedev(tp, NULL, "%s", output);
+		tty_makealias(tp, "cfecons");
 	}
 }
 
 static int
-cfe_dev_open(struct cdev *dev, int flag, int mode, struct thread *td)
+cfe_tty_open(struct tty *tp)
 {
-	struct	tty *tp;
-	int	unit;
-	int	error, setuptimeout;
+	polltime = hz / CFECONS_POLL_HZ;
+	if (polltime < 1)
+		polltime = 1;
+	cfe_timeouthandle = timeout(cfe_timeout, tp, polltime);
 
-	error = 0;
-	setuptimeout = 0;
-	unit = minor(dev);
-
-	/*
-	 * XXX: BAD, should happen at attach time
-	 */
-	if (dev->si_tty == NULL) {
-		cfe_tp = ttyalloc();
-		dev->si_tty = cfe_tp;
-		cfe_tp->t_dev = dev;
-	}
-	tp = dev->si_tty;
-
-	tp->t_oproc = cfe_tty_start;
-	tp->t_param = cfe_tty_param;
-	tp->t_stop = cfe_tty_stop;
-	tp->t_dev = dev;
-
-	if ((tp->t_state & TS_ISOPEN) == 0) {
-		tp->t_state |= TS_CARR_ON;
-		ttyconsolemode(tp, 0);
-
-		setuptimeout = 1;
-	} else if ((tp->t_state & TS_XCLUDE) &&
-	    priv_check(td, PRIV_TTY_EXCLUSIVE)) {
-		return (EBUSY);
-	}
-
-	error = ttyld_open(tp, dev);
-
-	if (error == 0 && setuptimeout) {
-		polltime = hz / CFECONS_POLL_HZ;
-		if (polltime < 1) {
-			polltime = 1;
-		}
-
-		cfe_timeouthandle = timeout(cfe_timeout, tp, polltime);
-	}
-
-	return (error);
+	return (0);
 }
 
-static int
-cfe_dev_close(struct cdev *dev, int flag, int mode, struct thread *td)
+static void
+cfe_tty_close(struct tty *tp)
 {
-	int	unit;
-	struct	tty *tp;
-
-	unit = minor(dev);
-	tp = dev->si_tty;
 
-	if (unit != 0) {
-		return (ENXIO);
-	}
-
 	/* XXX Should be replaced with callout_stop(9) */
 	untimeout(cfe_timeout, tp, cfe_timeouthandle);
-	ttyld_close(tp, flag);
-	tty_close(tp);
-
-	return (0);
 }
 
-
-static int
-cfe_tty_param(struct tty *tp, struct termios *t)
-{
-
-	return (0);
-}
-
 static void
-cfe_tty_start(struct tty *tp)
+cfe_tty_outwakeup(struct tty *tp)
 {
-	struct clist *cl;
 	int len;
 	u_char buf[CFEBURSTLEN];
 
-	if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
-		return;
-
-	tp->t_state |= TS_BUSY;
-	cl = &tp->t_outq;
-	len = q_to_b(cl, buf, CFEBURSTLEN);
-	while (cfe_write(conhandle, buf, len) == 0)
-		;
-	tp->t_state &= ~TS_BUSY;
-
-	ttwwakeup(tp);
-}
-
-static void
-cfe_tty_stop(struct tty *tp, int flag)
-{
-
-	if (tp->t_state & TS_BUSY) {
-		if ((tp->t_state & TS_TTSTOP) == 0) {
-			tp->t_state |= TS_FLUSH;
-		}
+	for (;;) {
+		len = ttydisc_getc(tp, buf, sizeof buf);
+		if (len == 0)
+			break;
+		while (cfe_write(conhandle, buf, len) == 0)
+			continue;
 	}
 }
 
@@ -217,11 +138,11 @@
 
 	tp = (struct tty *)v;
 
-	while ((c = cfe_cngetc(NULL)) != -1) {
-		if (tp->t_state & TS_ISOPEN) {
-			ttyld_rint(tp, c);
-		}
-	}
+	tty_lock(tp);
+	while ((c = cfe_cngetc(NULL)) != -1)
+		ttydisc_rint(tp, c, 0);
+	ttydisc_rint_done(tp);
+	tty_unlock(tp);
 
 	cfe_timeouthandle = timeout(cfe_timeout, tp, polltime);
 }
@@ -269,12 +190,27 @@
 	unsigned char ch;
 
 	while ((result = cfe_read(conhandle, &ch, 1)) == 0)
-		;
+		continue;
 
 	if (result > 0) {
 #if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
-		if (kdb_alt_break(ch, &alt_break_state))
-			kdb_enter(KDB_WHY_BREAK, "Break sequence on console");
+		int kdb_brk;
+
+		if ((kdb_brk = kdb_alt_break(ch, &alt_break_state)) != 0) {
+			switch (kdb_brk) {
+			case KDB_REQ_DEBUGGER:
+				kdb_enter(KDB_WHY_BREAK,
+				    "Break sequence on console");
+				break;
+			case KDB_REQ_PANIC:
+				kdb_panic("Panic sequence on console");
+				break;
+			case KDB_REQ_REBOOT:
+				kdb_reboot();
+				break;
+
+			}
+		}
 #endif
 		return (ch);
 	}
@@ -292,7 +228,7 @@
 
 	cbuf = c;
 	while (cfe_write(conhandle, &cbuf, 1) == 0)
-		;
+		continue;
 }
 
-SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, cn_drvinit, NULL)
+SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, cn_drvinit, NULL);

==== //depot/projects/mips2/src/sys/dev/cfe/cfe_error.h#2 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/cfe/cfe_ioctl.h#2 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/cfe/cfe_resource.c#3 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/siba/siba.c#7 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/siba/siba_ids.h#3 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/siba/siba_pcib.c#5 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/sys/dev/siba/siba_pcib.c,v 1.2 2008/09/26 05:40:56 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -157,7 +157,7 @@
 	sc->sc_bh = rman_get_bushandle(sc->sc_mem);
 
 	device_printf(dev, "bridge registers addr 0x%08x vaddr %p\n",
-	    sc->sc_bh, rman_get_virtual(sc->sc_mem));
+	    (uint32_t)sc->sc_bh, rman_get_virtual(sc->sc_mem));
 
 	SBPCI_WRITE_4(sc, 0x0000, 0x05);
 	SBPCI_WRITE_4(sc, 0x0000, 0x0D);
@@ -179,7 +179,8 @@
 		device_printf(dev, "cannot map PCI configuration space\n");
 		return (ENXIO);
 	}
-	device_printf(dev, "mapped pci config space at 0x%08x\n", sc_cfg_hand);
+	device_printf(dev, "mapped pci config space at 0x%08x\n",
+	    (uint32_t)sc_cfg_hand);
 
 	/*
 	 * Setup configuration, io, and dma space windows.

==== //depot/projects/mips2/src/sys/dev/siba/siba_pcibvar.h#3 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/siba/sibareg.h#3 (text+ko) ====


==== //depot/projects/mips2/src/sys/dev/siba/sibavar.h#4 (text+ko) ====




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