Subject: pckbc patch
To: None <tech-kern@netbsd.org>
From: Jaromír <jdolecek@netbsd.org>
List: tech-kern
Date: 05/17/2001 22:59:03
Hi,
I'd like to change the pckbc and i386 pccons code to change interrupt
level to spltty during console keyboard poll (cnpollc(1); ...
cngetc(); ... cnpollc(0); e.g. in dev/cons.c:cngetsn() or
dev/isa/fd.c:fd_mountroot_hook()).
More detailed description of the exact problem I'm trying to solve is
at followup to kern/8702 (also cc-ed tech-kern@ with the e-mail),
though I'm not quite sure kern/8702  is actually same problem.

I'm not quite sure this is the right thing to do here, but it seems
to be, and fixes the problem I have with keyboard in my PS/2.
I have not tested the change on other system yet, would do before
the change would go into tree.

The diff is like this:

Index: arch/i386/isa/pccons.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/isa/pccons.c,v
retrieving revision 1.145
diff -u -p -u -r1.145 pccons.c
--- arch/i386/isa/pccons.c	2001/05/02 10:32:17	1.145
+++ arch/i386/isa/pccons.c	2001/05/17 19:35:50
@@ -1160,6 +1160,16 @@ pccnpollc(dev, on)
 #if (NPCCONSKBD > 0)
 	pckbc_set_poll(kbctag, kbcslot, on);
 #else
+
+	if (!cold) {
+		static int s;
+
+		if (on)
+			s = spltty();
+		else
+			splx(s);
+	}
+
 	if (!on) {
 		int unit;
 		struct pc_softc *sc;
Index: dev/ic/pckbc.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/pckbc.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 pckbc.c
--- dev/ic/pckbc.c	2001/05/15 22:01:07	1.7
+++ dev/ic/pckbc.c	2001/05/17 19:35:52
@@ -544,6 +544,15 @@ pckbc_set_poll(self, slot, on)
 
 	t->t_slotdata[slot]->polling = on;
 
+	if (!cold) {
+		static int s;
+
+		if (on)
+			s = spltty();
+		else
+			splx(s);
+	}
+
 	if (!on) {
                 int s;
 
Unless someone would like to comment or suggest anything better,
I'd probably commit it in couple of days. This change fixes last
PS/2 support bug I'm aware of :)

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!