Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jul 2003 02:37:30 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 34011 for review
Message-ID:  <200307030937.h639bUwY080028@repoman.freebsd.org>

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

Change 34011 by marcel@marcel_nfs on 2003/07/03 02:36:37

	Add method ipend() to the UART hardware interface. The
	ipend() method returns a bitmask of pending interrupt
	priority levels and is called by the interrupt handler.
	The low-level UART driver is free to map the levels
	onto actual interrupt sources. The levels are created
	based on the ns8250 UART. The interface is created to
	also allow puc(4) to get the same information so that
	it can call devices on a priority basis. This has to be
	worked out later. We very likely need functions per
	interrupt level for that.

Affected files ...

.. //depot/projects/uart/dev/uart/uart_bus.h#2 edit
.. //depot/projects/uart/dev/uart/uart_core.c#2 edit
.. //depot/projects/uart/dev/uart/uart_if.m#2 edit

Differences ...

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

@@ -30,6 +30,18 @@
 #define _DEV_UART_BUS_H_
 
 /*
+ * Interrupt sources (in priority order):
+ * line - line errors (overrun, framing)
+ * recv - received data
+ * xmit - transmitter idle
+ * ctrl - line- and modem signals
+ */
+#define	UART_IPEND_LINE		0x01
+#define	UART_IPEND_RECV		0x02
+#define	UART_IPEND_XMIT		0x04
+#define	UART_IPEND_CTRL		0x08
+
+/*
  * UART class & instance (=softc)
  */
 struct uart_class {

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

@@ -54,10 +54,48 @@
 
 MALLOC_DEFINE(M_UART, "UART", "UART driver");
 
+static int
+uart_intr_line(struct uart_softc *sc)
+{
+	return (0);
+}
+
+static int
+uart_intr_recv(struct uart_softc *sc)
+{
+	return (0);
+}
+
+static int
+uart_intr_xmit(struct uart_softc *sc)
+{
+	return (0);
+}
+
+static int
+uart_intr_ctrl(struct uart_softc *sc)
+{
+	return (0);
+}
+
 static void
 uart_intr(void *arg)
 {
-	/* struct uart_softc *sc = arg; */
+	struct uart_softc *sc = arg;
+	int ipend;
+
+	ipend = UART_IPEND(sc);
+	while (ipend != 0) {
+		if (ipend & UART_IPEND_LINE)
+			uart_intr_line(sc);
+		if (ipend & UART_IPEND_RECV)
+			uart_intr_recv(sc);
+		if (ipend & UART_IPEND_XMIT)
+			uart_intr_xmit(sc);
+		if (ipend & UART_IPEND_CTRL)
+			uart_intr_ctrl(sc);
+		ipend = UART_IPEND(sc);
+	}
 }
 
 int

==== //depot/projects/uart/dev/uart/uart_if.m#2 (text+ko) ====

@@ -45,7 +45,7 @@
 };
 
 # initfifo() - detect and size FIFOs
-# This method is called after the UART is reset and is responsible to find
+# This method is called after the UART is reset and is responsible for finding
 # out the size of the transmitter and receiver FIFOs. The method is allowed
 # to reprogram the UART, but should not permanently disrupt console or debug
 # port operation.
@@ -53,6 +53,19 @@
 	struct uart_softc *this;
 };
 
+# ipend() - query UART for pending interrupts
+# When an interrupt is signalled, the handler will call this method to find
+# out which of the interrupt sources needs attention. The handler will use
+# this information to dispatch service routines that deal with each of the
+# interrupt sources. An advantage of this approach is that it allows multi-
+# port drivers (like puc(4)) to query multiple devices concurrently and
+# service them on an interrupt priority basis. If the hardware cannot provide
+# the information reliably, it is free to service the interrupt and return 0,
+# meaning that no attention is required.
+METHOD int ipend {
+	struct uart_softc *this;
+}
+
 # probe() - first level device probing.
 # The intend of probe() is to perform a non-destructive probe that's simple
 # in nature and does not (in theory) program the device in order to find out



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