Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2013 06:22:30 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r257944 - in projects/altix2/sys/ia64: include sgisn
Message-ID:  <201311110622.rAB6MU5x014962@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Mon Nov 11 06:22:29 2013
New Revision: 257944
URL: http://svnweb.freebsd.org/changeset/base/257944

Log:
  Fix the L1 console, broken for the Altix 450. Using POLL and GETC
  apparently does return any characters. Special SAL calls exists
  for when the console is asynchronous. Replace the poll call with
  getting the interrupt status and replace the getc call with an
  interrupt read.
  
  It is not known if this change breaks the Altix 350, but it is
  assumed that it will not harm. testing will tell us...

Modified:
  projects/altix2/sys/ia64/include/sgisn.h
  projects/altix2/sys/ia64/sgisn/sgisn_console.c

Modified: projects/altix2/sys/ia64/include/sgisn.h
==============================================================================
--- projects/altix2/sys/ia64/include/sgisn.h	Mon Nov 11 05:39:42 2013	(r257943)
+++ projects/altix2/sys/ia64/include/sgisn.h	Mon Nov 11 06:22:29 2013	(r257944)
@@ -38,6 +38,7 @@
 #define	SAL_SGISN_POLL			0x02000026
 #define	SAL_SGISN_CON_INTR		0x02000027
 #define	SAL_SGISN_TXBUF			0x02000028
+#define	SAL_SGISN_CON_IREAD		0x0200002b
 #define	SAL_SGISN_IOHUB_INFO		0x02000055
 #define	SAL_SGISN_IOBUS_INFO		0x02000056
 #define	SAL_SGISN_IODEV_INFO		0x02000057

Modified: projects/altix2/sys/ia64/sgisn/sgisn_console.c
==============================================================================
--- projects/altix2/sys/ia64/sgisn/sgisn_console.c	Mon Nov 11 05:39:42 2013	(r257943)
+++ projects/altix2/sys/ia64/sgisn/sgisn_console.c	Mon Nov 11 06:22:29 2013	(r257944)
@@ -247,23 +247,21 @@ sncon_rx_intr(void *arg)
 	struct sncon_softc *sc = arg;
 	struct tty *tp = sc->sc_tp;
 	struct ia64_sal_result r;
-	int ch, count;
+	int ch, cnt;
 #if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
 	int kdb;
 #endif
 
 	tty_lock(tp);
 
-	count = 0;
-	do {
-		r = ia64_sal_entry(SAL_SGISN_POLL, 0, 0, 0, 0, 0, 0, 0);
-		if (r.sal_status || r.sal_result[0] == 0)
-			break;
-
-		r = ia64_sal_entry(SAL_SGISN_GETC, 0, 0, 0, 0, 0, 0, 0);
-		if (r.sal_status != 0)
+	cnt = 0;
+	r = ia64_sal_entry(SAL_SGISN_CON_INTR, 0, 2 /* status */,
+	    0, 0, 0, 0, 0);
+	while (cnt < 128 && r.sal_status == 0 && (r.sal_result[0] & 2) == 2) {
+		r.sal_result[0] = ~0UL;
+		r = ia64_sal_entry(SAL_SGISN_CON_IREAD, 0, 0, 0, 0, 0, 0, 0);
+		if (r.sal_result[0] == ~0UL)
 			break;
-
 		ch = r.sal_result[0];
 
 #if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
@@ -285,9 +283,11 @@ sncon_rx_intr(void *arg)
 #endif
 
 		ttydisc_rint(tp, ch, 0);
-		count++;
-	} while (count < 128);
-	if (count > 0)
+		cnt++;
+		r = ia64_sal_entry(SAL_SGISN_CON_INTR, 0, 2 /* status */,
+		    0, 0, 0, 0, 0);
+	}
+	if (cnt > 0)
 		ttydisc_rint_done(tp);
 	tty_unlock(tp);
 }
@@ -321,8 +321,8 @@ sncon_attach(device_t dev)
 	} while (0);
 
 	/* Enable or disable RX interrupts appropriately. */
-	r = ia64_sal_entry(SAL_SGISN_CON_INTR, 2,
-	    (sc->sc_ires != NULL) ? 1 : 0, 0, 0, 0, 0, 0);
+	r = ia64_sal_entry(SAL_SGISN_CON_INTR, 2 /* recv */,
+	    (sc->sc_ires != NULL) ? 1 : 0 /* on/off */, 0, 0, 0, 0, 0);
 
 	sc->sc_tp = tty_alloc(&sncon_tty_class, sc);
 	if (sncon_is_console)
@@ -346,7 +346,8 @@ sncon_detach(device_t dev)
 
 	if (sc->sc_ires != NULL) {
 		/* Disable RX interrupts. */
-		r = ia64_sal_entry(SAL_SGISN_CON_INTR, 2, 0, 0, 0, 0, 0, 0);
+		r = ia64_sal_entry(SAL_SGISN_CON_INTR, 2 /* recv */,
+		    0 /* off */, 0, 0, 0, 0, 0);
 
 		bus_teardown_intr(dev, sc->sc_ires, sc->sc_icookie);
 		bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irid,



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