Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2007 07:22:54 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 132160 for review
Message-ID:  <200712310722.lBV7MsTa035120@repoman.freebsd.org>

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

Change 132160 by kmacy@pandemonium:kmacy:xen31 on 2007/12/31 07:22:44

	make console input polling work for the first time ever
	so that ddb and the mountroot prompt will behave correctly

Affected files ...

.. //depot/projects/xen31/sys/dev/xen/console/console.c#4 edit
.. //depot/projects/xen31/sys/dev/xen/console/xencons_ring.c#4 edit
.. //depot/projects/xen31/sys/dev/xen/console/xencons_ring.h#2 edit

Differences ...

==== //depot/projects/xen31/sys/dev/xen/console/console.c#4 (text+ko) ====

@@ -146,6 +146,9 @@
 xccncheckc(struct consdev *dev)
 {
 	int ret = (xc_mute ? 0 : -1);
+	if (xencons_has_input()) 
+			xencons_handle_input(NULL);
+	
 	CN_LOCK(cn_mtx);
 	if ((rp - rc)) {
 		/* we need to return only one char */

==== //depot/projects/xen31/sys/dev/xen/console/xencons_ring.c#4 (text+ko) ====

@@ -33,6 +33,18 @@
 	return (struct xencons_interface *)console_page;
 }
 
+
+int
+xencons_has_input(void)
+{
+	struct xencons_interface *intf; 
+
+	intf = xencons_interface();		
+
+	return (intf->in_cons != intf->in_prod);
+}
+
+
 int 
 xencons_ring_send(const char *data, unsigned len)
 {
@@ -63,8 +75,8 @@
 
 static xencons_receiver_func *xencons_receiver;
 
-static void 
-handle_input(void *unused)
+void 
+xencons_handle_input(void *unused)
 {
 	struct xencons_interface *intf;
 	XENCONS_RING_IDX cons, prod;
@@ -74,6 +86,7 @@
 	cons = intf->in_cons;
 	prod = intf->in_prod;
 
+	/* XXX needs locking */
 	while (cons != prod) {
 		xencons_rx(intf->in + MASK_XENCONS_IDX(cons, intf->in), 1);
 		cons++;
@@ -102,7 +115,7 @@
 		return 0;
 
 	err = bind_caller_port_to_irqhandler(xen_start_info->console_evtchn,
-					"xencons", handle_input, NULL,
+					"xencons", xencons_handle_input, NULL,
 					INTR_TYPE_MISC | INTR_MPSAFE, NULL);
 	if (err) {
 		XENPRINTF("XEN console request irq failed %i\n", err);

==== //depot/projects/xen31/sys/dev/xen/console/xencons_ring.h#2 (text+ko) ====

@@ -10,4 +10,7 @@
 typedef void (xencons_receiver_func)(char *buf, unsigned len);
 void xencons_ring_register_receiver(xencons_receiver_func *f);
 
+void xencons_handle_input(void *unused);
+int xencons_has_input(void);
+
 #endif /* _XENCONS_RING_H */



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