From Tor.Egge@idt.ntnu.no  Thu Nov  7 17:45:23 1996
Received: from pat.idt.unit.no (pat.idt.unit.no [129.241.103.5])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id RAA26349
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 7 Nov 1996 17:45:21 -0800 (PST)
Received: from ikke.idt.unit.no (ikke.idt.unit.no [129.241.111.65]) by pat.idt.unit.no (8.7.5/8.7.3) with ESMTP id CAA23945 for <FreeBSD-gnats-submit@freebsd.org>; Fri, 8 Nov 1996 02:45:18 +0100 (MET)
Received: (from tegge@localhost) by ikke.idt.unit.no (8.7.6/8.7.3) id CAA27772; Fri, 8 Nov 1996 02:45:17 +0100 (MET)
Message-Id: <199611080145.CAA27772@ikke.idt.unit.no>
Date: Fri, 8 Nov 1996 02:45:17 +0100 (MET)
From: Tor Egge <Tor.Egge@idt.ntnu.no>
Reply-To: Tor.Egge@idt.ntnu.no
To: FreeBSD-gnats-submit@freebsd.org
Subject: psm and syscons conflicts have escalated
X-Send-Pr-Version: 3.2

>Number:         1976
>Category:       kern
>Synopsis:       psm and syscons conflicts have escalated
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov  7 17:50:02 PST 1996
>Closed-Date:    Sat Feb 22 19:17:15 PST 1997
>Last-Modified:  Sat Feb 22 19:17:59 PST 1997
>Originator:     Tor Egge
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
Norwegian University of Science and Technology, Trondheim, Norway
>Environment:

FreeBSD ikke.idt.unit.no 3.0-CURRENT FreeBSD 3.0-CURRENT #0: Fri Nov  8 01:18:21 MET 1996     root@ikke.idt.unit.no:/usr/src/sys-UP/compile/TEGGE  i386

   revision 1.183 of syscons.c
   revision 1.25 of psm.c

>Description:

	Moving a psm mouse, generating lot's of psm interrupts,
	causes false key *and* mouse events. 

>How-To-Repeat:

	Move a psm mouse, generating lot's of psm interrupts.

>Fix:

	psm interrupt must block clock software interrupt to be able to block
	the keyboard polling.

	This might mean that tty_imask must block the clock software 
	interrupt :-(


>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@FreeBSD.org, Tor.Egge@idt.ntnu.no
Cc:  Subject: Re: kern/1976: psm and syscons conflicts have escalated
Date: Fri, 8 Nov 1996 18:38:44 +1100

 >>Fix:
 >
 >	psm interrupt must block clock software interrupt to be able to block
 >	the keyboard polling.
 >
 >	This might mean that tty_imask must block the clock software 
 >	interrupt :-(
 
 It already does :-)  (all h/w interrupts and all splnnn()s block
 softclock()).
 
 psmintr() and psm_poll_status() and the keyboard <-> psm interface seem
 to be too simple to work.  psmintr() assumes that the interrupt is always
 for it and that exactly one scancode is delivered.  If the configuration
 in GENERIC is correct:
 
 1. psm_poll_status() steals keyboard scancodes.
 
 2. Now equality is restored - the syscons timeout routine steals psm
    scancodes :-).
 
 3. The different irq for psm is the only thing that separates psm
    scancodes from keyboard scancodes.  Polling cannot work.
    psm_poll_status() tests the magic bits 0x03.  0x01 is KB_BUF_FULL and
    0x02 is KB_READY.  Actually, psm_poll_status() is not so magic, just
    badly written and probably broken.  0x02 is also PSM_OUTPUT_ACK.
    psm_poll_status() bogusly reads the input to ack output and loops
    forever unless the (ack) input happens to be ready then or interrupts
    are bogusly enabled so that an interrupt can clear the input.
 
 4. psm_poll_status() is sometimes (e.g. in psmopen()) used without
    blocking tty interrupt.  This bug makes the bugs in 1) and 3) less
    serious.
 
 Summary: equality isn't quite restored.  psm_poll_status() is actually a
 broken version of kbd_wait(), and it is only used to issue commands, not
 to poll for input, so it only hangs the system sometimes :-].  However,
 syscons now polls for input, and this cannot work.
 
 Bruce
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Sat Feb 22 19:17:15 PST 1997 
State-Changed-Why:  
The originator said this could be closed. 
>Unformatted:
