From marks@otor.digex.net  Tue Jan  7 15:37:52 1997
Received: from otor.digex.net (otor.digex.net [205.197.249.64])
          by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id PAA23497
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 7 Jan 1997 15:37:50 -0800 (PST)
Received: (from marks@localhost)
          by otor.digex.net (8.8.4/8.8.4)
	  id SAA00529; Tue, 7 Jan 1997 18:37:38 -0500 (EST)
Message-Id: <199701072337.SAA00529@otor.digex.net>
Date: Tue, 7 Jan 1997 18:37:38 -0500 (EST)
From: Mark Schleifer <marks@digex.net>
Reply-To: marks@digex.net
To: FreeBSD-gnats-submit@freebsd.org
Cc: marks@otor.digex.net
Subject: psm0: unable to set the command byte. psm0 not found at 0x60
X-Send-Pr-Version: 3.2

>Number:         2409
>Category:       kern
>Synopsis:       psm0: unable to set the command byte. psm0 not found at 0x60
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan  7 15:40:03 PST 1997
>Closed-Date:    Sun Jan 19 15:51:32 PST 1997
>Last-Modified:  Sun Jan 19 15:52:44 PST 1997
>Originator:     Mark Schleifer
>Release:        FreeBSD 2.2-BETA_A i386
>Organization:
DIGEX
>Environment:

DEC HiNote Ultra II Laptop
Pentium 133MHz
32 MB Ram

>Description:

On Boot: 

psm0: unable to set the command byte. 
psm0 not found at 0x60

Worked under SNAPs and ALPHA.  Seems to be root cause of moused and 
X crashing system.

>How-To-Repeat:

Kernel made with following config file.  This file worked with SNAPs and 
ALPHA after applying PAO patches. Also tried with PSM_NO_RESET with BETA
but that caused the keyboard to lockup at first input request.


#
# GENERIC -- Generic machine with WD/AHx/NCR/BTx family disks
#
#	$Id: GENERIC,v 1.70 1996/05/13 04:29:13 nate Exp $
#

machine		"i386"
cpu		"I586_CPU"
ident		OTOR-SCSI
maxusers	32

options		INET			#InterNETworking
options		FFS			#Berkeley Fast Filesystem
options		NFS			#Network Filesystem
options		NFS_NOSERVER		#Disable the NFS-server code.
options		MSDOSFS			#MSDOS Filesystem
options		"CD9660"		#ISO 9660 Filesystem
options		PROCFS			#Process filesystem
options		"COMPAT_43"		#Compatible with BSD 4.3 [KEEP THIS!]
#options	SCSI_DELAY=15		#Be pessimistic about Joe SCSI device
options		BOUNCE_BUFFERS		#include support for DMA bounce buffers
options		UCONSOLE		#Allow users to grab the console
options		FAILSAFE		#Be conservative
options		COMPAT_LINUX

# These three options provide support for System V Interface
# Definition-style interprocess communication, in the form of shared
# memory, semaphores, and message queues, respectively.
#
options		SYSVSHM
options		SYSVSEM
options		SYSVMSG

#
# PERFMON causes the driver for Pentium/Pentium Pro performance counters
# to be compiled.  See perfmon(4) for more information.
#
options		PERFMON

options		MROUTING		# Multicast routing


# laptop-specific configuration
options		LAPTOP

#

# If your laptop have not had Windoze95-Ready BIOS, please update it.
# Such old BIOS'es sometimes have critical bugs at 32-bit protected
# mode APM BIOS interface (which have not used by Windoze 3.1).

# PC-card suspend/resume support (experimental)
options		APM_PCCARD_RESUME
options		PCIC_RESUME_RESET

# Keep power for serial cards when the system suspends
# (If your machine hangs up when you try to suspend the system with 
#  FAX/Modem PCMCIA card, uncomment this option).
#options	SIO_SUSP_KEEP_PWR

# 0: silence
# 1: simple beep (same as 960414)
# 2: (default) new beep
options		"PCCARD_BEEP=2"

config		kernel	root on wd0

controller	isa0
controller	pci0

controller	fdc0	at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
disk		fd0	at fdc0 drive 0
#disk		fd1	at fdc0 drive 1
#tape		ft0	at fdc0 drive 2

controller	wdc0	at isa? port "IO_WD1" bio irq 14 vector wdintr
disk		wd0	at wdc0 drive 0
disk		wd1	at wdc0 drive 1

options		ATAPI		#Enable ATAPI support for IDE bus
options		ATAPI_STATIC	#Don't do it as an LKM
device		wcd0		#IDE CD-ROM

# A single entry for any of these controllers (ncr, ahb, ahc) is sufficient
# for any number of installed devices.



controller	scbus0
device          sd0     #SCSI disks
device		cd0	#Only need one of these, the code dynamically grows

controller      aic0    at isa? port 0x340 bio irq 11 vector aicintr

# syscons is the default console driver, resembling an SCO console
device		sc0	at isa? port "IO_KBD" tty irq 1 vector scintr
# Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver
#device		vt0	at isa? port "IO_KBD" tty irq 1 vector pcrint
#options		PCVT_FREEBSD=210	# pcvt running on FreeBSD >= 2.0.5
options		XSERVER			# include code for XFree86
#options		FAT_CURSOR		# start with block cursor
# If you have a ThinkPAD, uncomment this along with the rest of the PCVT lines
#options		PCVT_SCANSET=2		# IBM keyboards are non-std

# Mandatory, don't remove
device		npx0	at isa? port "IO_NPX" irq 13 vector npxintr

controller	crd0
device		pcic0	at crd?
device		pcic1	at crd?

controller	crd1
device		pcic2	at crd?
device		pcic3	at crd?

#
# Laptop support (see LINT for more options)
#
# apm: Laptop Advanced Power Management (experimental)
# Notes on APM
#  Some APM implementations will not work with the `statistics clock'
#  enabled, so it's disabled by default if the APM driver is enabled.
#  However, this is not true for all laptops.  Try removing the option
#  APM_BROKEN_STATCLOCK and see if suspend/resume work

device		apm0	at isa?		# Advanced Power Management
options		APM_BROKEN_STATCLOCK	# Workaround some buggy APM BIOS


#
# Miscellaneous hardware:
#
# For older notebooks that signal a powerfail condition (external
# power supply dropped, or battery state low) by issuing an NMI:

options		POWERFAIL_NMI	# make it beep instead of panicing


device		sio0	at isa? port "IO_COM1" tty irq 4 vector siointr
device		sio1	at isa? port "IO_COM2" tty irq 3 vector siointr
#device		sio2	at isa? port "IO_COM3" tty irq 5 vector siointr
#device		sio3	at isa? disable port "IO_COM4" tty irq 9 vector siointr

device		lpt0	at isa? port? tty irq 7 vector lptintr
device		lpt1	at isa? port? tty
#device		lpt2	at isa? port? tty

device		psm0	at isa? port "IO_KBD" conflicts tty irq 12 vector psmintr



device ep0 at isa? port 0x300 net irq 7 vector epintr
device wlp0 at isa? port 0x300 net irq 11 vector wlpintr

#device zp0 at isa? port 0x300 net irq 7 iomem 0xd8000 vector zpintr

# joy: joystick

device		joy0	at isa? port "IO_GAME"


# Audio drivers: `snd', `sb', `pas', `gus', `pca'
#
# snd: Voxware sound support code
# sb: SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum
# sbxvi: SoundBlaster 16
# sbmidi: SoundBlaster 16 MIDI interface

# opl: Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum
#
# pca: PCM audio through your PC speaker
#
# The i386/isa/sound/sound.doc has more information.

controller	snd0
device sb0      at isa? port 0x220 irq 5 conflicts drq 1 vector sbintr
#device sbxvi0   at isa? drq 5
#device sbmidi0  at isa? port 0x330
device opl0     at isa? port 0x388 conflicts
#device uart0 at isa? port 0x330 irq 5 vector "m6850intr"

# Not controlled by `snd'
device pca0 at isa? port IO_TIMER1 tty

pseudo-device	bpfilter	4	#Berkeley packet filter
pseudo-device	loop
pseudo-device	ether
pseudo-device	log
pseudo-device	sl	1
# ijppp uses tun instead of ppp device
pseudo-device	ppp	1
pseudo-device	tun	1
pseudo-device	pty	64
# keep this if you want to be able to continue to use /stand/sysinstall
pseudo-device	gzip		# Exec gzipped a.out's
pseudo-device	speaker		#Play IBM BASIC-style noises out your speaker



>Fix:
	
	

>Release-Note:
>Audit-Trail:

From: Nate Williams <nate@mt.sri.com>
To: marks@digex.net
Cc: FreeBSD-gnats-submit@freebsd.org, marks@otor.digex.net
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found at 0x60
Date: Tue, 7 Jan 1997 17:18:11 -0700 (MST)

 > >Number:         2409
 > >Category:       kern
 > >Synopsis:       psm0: unable to set the command byte. psm0 not found at 0x60
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       high
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Tue Jan  7 15:40:03 PST 1997
 > >Last-Modified:
 > >Originator:     Mark Schleifer
 > >Organization:
 > DIGEX
 > >Release:        FreeBSD 2.2-BETA_A i386
 > >Environment:
 > 
 > DEC HiNote Ultra II Laptop
 > Pentium 133MHz
 > 32 MB Ram
 > 
 > >Description:
 > 
 > On Boot: 
 > 
 > psm0: unable to set the command byte. 
 > psm0 not found at 0x60
 > 
 > Worked under SNAPs and ALPHA.  Seems to be root cause of moused and 
 > X crashing system.
 
 Try removing all of the PAO patches and see if it makes any difference.
 
 
 
 Nate

From: Mark Schleifer <marks@roto.digex.net>
To: Nate Williams <nate@mt.sri.com>
Cc: marks@digex.net, FreeBSD-gnats-submit@freebsd.org, marks@otor.digex.net
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found at 0x60
Date: Tue, 7 Jan 1997 21:02:54 -0500 (EST)

 On 1/7/1997 (17:18:11 -0700), Nate Williams wrote:
 ] > >Number:         2409
 ] > >Category:       kern
 ] > >Synopsis:       psm0: unable to set the command byte. psm0 not found at 0x60
 ] > >Confidential:   no
 ] > >Severity:       serious
 ] > >Priority:       high
 ] > >Responsible:    freebsd-bugs
 ] > >State:          open
 ] > >Class:          sw-bug
 ] > >Submitter-Id:   current-users
 ] > >Arrival-Date:   Tue Jan  7 15:40:03 PST 1997
 ] > >Last-Modified:
 ] > >Originator:     Mark Schleifer
 ] > >Organization:
 ] > DIGEX
 ] > >Release:        FreeBSD 2.2-BETA_A i386
 ] > >Environment:
 ] > 
 ] > DEC HiNote Ultra II Laptop
 ] > Pentium 133MHz
 ] > 32 MB Ram
 ] > 
 ] > >Description:
 ] > 
 ] > On Boot: 
 ] > 
 ] > psm0: unable to set the command byte. 
 ] > psm0 not found at 0x60
 ] > 
 ] > Worked under SNAPs and ALPHA.  Seems to be root cause of moused and 
 ] > X crashing system.
 ] 
 ] Try removing all of the PAO patches and see if it makes any difference.
 
 Same problem with kernel.GENERIC...Worse in fact.  If psm0 is enabled
 in the kernel it doesn't accepts keyboard input.  If moused is enabled
 in sysconfig, the system crashes (blaming moused) during boot.
 
 	- Mark
 
 

From: Mark Schleifer <marks@roto.digex.net>
To: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
Cc: FreeBSD-gnats-submit@freebsd.org, marks@digex.net
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found
	 at 0x60 
Date: Tue, 7 Jan 1997 22:18:42 -0500 (EST)

 On 1/8/1997 (10:23:25 +0900), Kazutaka YOKOTA wrote:
 ] 
 ] >>Number:         2409
 ] >>Category:       kern
 ] >>Synopsis:       psm0: unable to set the command byte. psm0 not found at 0x60
 ] >>Confidential:   no
 ] >>Severity:       serious
 ] >>Priority:       high
 ] >>Responsible:    freebsd-bugs
 ] >>State:          open
 ] >>Class:          sw-bug
 ] >>Submitter-Id:   current-users
 ] >>Arrival-Date:   Tue Jan  7 15:40:03 PST 1997
 ] >>Last-Modified:
 ] >>Originator:     Mark Schleifer
 ] >>Organization:
 ] >DIGEX
 ] >>Release:        FreeBSD 2.2-BETA_A i386
 ] >>Environment:
 ] >
 ] >DEC HiNote Ultra II Laptop
 ] >Pentium 133MHz
 ] >32 MB Ram
 ] >
 ] >>Description:
 ] >
 ] >On Boot: 
 ] >
 ] >psm0: unable to set the command byte. 
 ] >psm0 not found at 0x60
 ] 
 ] The message means that the `psm' driver has difficulty with the
 ] keyboard controller, and gives up probing the PS/2 mouse device. As
 ] far as the driver is concerned, no PS/2 mouse exists in the system.
 ] 
 ] >Worked under SNAPs and ALPHA.  Seems to be root cause of moused and 
 ] >X crashing system.
 ] 
 ] There recently was a patch to the `psm' driver. It cures system
 ] crash occurring when the `psm' driver thinks there is no PS/2 mouse
 ] attached, and someone, such as moused or X, tries to open `psm'. (See
 ] the end of this mail.)
 ] 
 ] But, this patch doesn't solve the problem of your built-in(?) PS/2
 ] pointing device not detected...
 
 Yes, it's a 2-button track ball that shows up as a PS/2 mouse
 
 ] 
 ] BTW, did `moused' work properly to access the PS/2 mouse under SNAPs
 ] and ALPHA in your system? How did X access the mouse, directly or via
 ] `moused'?
 
 I don't remember trying moused before this BETA.  X talked to the
 mouse (/dev/psm0) directly.
 
 
 ] >>How-To-Repeat:
 ] >
 ] >Kernel made with following config file.  This file worked with SNAPs and 
 ] >ALPHA after applying PAO patches. Also tried with PSM_NO_RESET with BETA
 ] >but that caused the keyboard to lockup at first input request.
 ] 
 ] PSM_NO_RESET is no longer available in 2.2-BETA, thus, has nothing to do
 ] with the keyboard lockup; the lockup which shouldn't be happening *sigh*
 
 Interesting...It was just giving me the errors until I added that
 config option (which it didn't complain about).  With that option in,
 it doesn't allow keyboard input. 
 
 ] Did you see any message from the `sc' (syscons) driver on boot?
 
 sc had no errors during boot.  Just the usual:
 
 Jan  7 22:13:07 otor /kernel: sc0 at 0x60-0x6f irq 1 on motherboard
 Jan  7 22:13:07 otor /kernel: sc0: VGA color <16 virtual consoles, flags=0x0>
 
 
 ] I would also ask you to add 
 ]     options "KBDIO_DEBUG=2"
 ] to your config file. With this option `sc' and `psm' drivers will log
 ] quite a few messages via `syslogd' on boot and later. The messages are
 ] marked with "kbdio: blugh blugh". 
 
 I did this but saw nothing in the syslogs.  What does it log them
 under? kern.debug?
 
 Just for grins, I tried starting moused again, which crashed immediately:
 
 # moused -p /dev/psm0 -t ps/2
 
 Fault trap 12: page fault while in kernel mode
 fault virtual address		= 0x8
 fault code			= supervisor read, page not present
 instruction pointer		= 0x8:0xf01b880b
 stack pointer			= 0x10:0xefbffdb4
 frame pointer			= 0x10:0xefbffdcc
 code segment			= base 0x0, limit 0xfffff, type 0x1b
 				= DPL 0, pres 1, def32 1, gran 1
 processor eflags		= interrupt enabled, resume, IOPL = 0
 current process			= 208 (moused)
 interrupt mask			= 
 panic: page fault
 
 syncing disks... 4 4 2 done
 
 
 Any ideas?
 
 	- Mark
 
 
 
 ] -- patch to psm.c ---
 ] 
 ] RCS file: /home/ncvs/src/sys/i386/isa/psm.c,v
 ] retrieving revision 1.25.2.3
 ] retrieving revision 1.25.2.4
 ] diff -u -r1.25.2.3 -r1.25.2.4
 ] --- src/sys/i386/isa/psm.c	1996/12/03 10:47:24	1.25.2.3
 ] +++ src/sys/i386/isa/psm.c	1997/01/05 06:34:11	1.25.2.4
 ] @@ -19,7 +19,7 @@
 ]   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 ]   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ]   *
 ] - * $Id: psm.c,v 1.25.2.3 1996/12/03 10:47:24 phk Exp $
 ] + * $Id: psm.c,v 1.25.2.4 1997/01/05 06:34:11 nate Exp $
 ]   */
 ]  
 ]  /*
 ] @@ -508,6 +508,8 @@
 ]      if (unit >= NPSM)
 ]          return (0);
 ]  
 ] +    psm_softc[unit] = NULL; 
 ] +
 ]      sc =  malloc(sizeof *sc, M_DEVBUF, M_NOWAIT);
 ]  
 ]      bzero(sc, sizeof *sc);
 ] @@ -745,6 +747,9 @@
 ]      int unit = dvp->id_unit;
 ]      struct psm_softc *sc = psm_softc[unit];
 ]  
 ] +    if (sc == NULL)    /* shouldn't happen */ 
 ] +	return (0); 
 ] +
 ]      /* initial operation mode */
 ]      sc->mode.accelfactor = PSM_ACCEL;
 ]      sc->mode.protocol = MOUSE_PROTO_PS2;
 ] @@ -786,7 +791,7 @@
 ]  
 ]      /* Get device data */
 ]      sc = psm_softc[unit];
 ] -    if ((sc->state & PSM_VALID) == 0)
 ] +    if ((sc == NULL) || (sc->state & PSM_VALID) == 0)
 ]  	/* the device is no longer valid/functioning */
 ]          return (ENXIO);
 ]      ioport = sc->addr;

From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc: marks@digex.net, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found
	 at 0x60 
Date: Wed, 08 Jan 1997 10:23:25 +0900

 >>Number:         2409
 >>Category:       kern
 >>Synopsis:       psm0: unable to set the command byte. psm0 not found at 0x60
 >>Confidential:   no
 >>Severity:       serious
 >>Priority:       high
 >>Responsible:    freebsd-bugs
 >>State:          open
 >>Class:          sw-bug
 >>Submitter-Id:   current-users
 >>Arrival-Date:   Tue Jan  7 15:40:03 PST 1997
 >>Last-Modified:
 >>Originator:     Mark Schleifer
 >>Organization:
 >DIGEX
 >>Release:        FreeBSD 2.2-BETA_A i386
 >>Environment:
 >
 >DEC HiNote Ultra II Laptop
 >Pentium 133MHz
 >32 MB Ram
 >
 >>Description:
 >
 >On Boot: 
 >
 >psm0: unable to set the command byte. 
 >psm0 not found at 0x60
 
 The message means that the `psm' driver has difficulty with the
 keyboard controller, and gives up probing the PS/2 mouse device. As
 far as the driver is concerned, no PS/2 mouse exists in the system.
 
 >Worked under SNAPs and ALPHA.  Seems to be root cause of moused and 
 >X crashing system.
 
 There recently was a patch to the `psm' driver. It cures system
 crash occurring when the `psm' driver thinks there is no PS/2 mouse
 attached, and someone, such as moused or X, tries to open `psm'. (See
 the end of this mail.)
 
 But, this patch doesn't solve the problem of your built-in(?) PS/2
 pointing device not detected...
 
 BTW, did `moused' work properly to access the PS/2 mouse under SNAPs
 and ALPHA in your system? How did X access the mouse, directly or via
 `moused'?
 
 >>How-To-Repeat:
 >
 >Kernel made with following config file.  This file worked with SNAPs and 
 >ALPHA after applying PAO patches. Also tried with PSM_NO_RESET with BETA
 >but that caused the keyboard to lockup at first input request.
 
 PSM_NO_RESET is no longer available in 2.2-BETA, thus, has nothing to do
 with the keyboard lockup; the lockup which shouldn't be happening *sigh*
 
 Did you see any message from the `sc' (syscons) driver on boot?
 
 I would also ask you to add 
     options "KBDIO_DEBUG=2"
 to your config file. With this option `sc' and `psm' drivers will log
 quite a few messages via `syslogd' on boot and later. The messages are
 marked with "kbdio: blugh blugh". 
 
 Kazu
 
 -- patch to psm.c ---
 
 RCS file: /home/ncvs/src/sys/i386/isa/psm.c,v
 retrieving revision 1.25.2.3
 retrieving revision 1.25.2.4
 diff -u -r1.25.2.3 -r1.25.2.4
 --- src/sys/i386/isa/psm.c	1996/12/03 10:47:24	1.25.2.3
 +++ src/sys/i386/isa/psm.c	1997/01/05 06:34:11	1.25.2.4
 @@ -19,7 +19,7 @@
   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
 - * $Id: psm.c,v 1.25.2.3 1996/12/03 10:47:24 phk Exp $
 + * $Id: psm.c,v 1.25.2.4 1997/01/05 06:34:11 nate Exp $
   */
  
  /*
 @@ -508,6 +508,8 @@
      if (unit >= NPSM)
          return (0);
  
 +    psm_softc[unit] = NULL; 
 +
      sc =  malloc(sizeof *sc, M_DEVBUF, M_NOWAIT);
  
      bzero(sc, sizeof *sc);
 @@ -745,6 +747,9 @@
      int unit = dvp->id_unit;
      struct psm_softc *sc = psm_softc[unit];
  
 +    if (sc == NULL)    /* shouldn't happen */ 
 +	return (0); 
 +
      /* initial operation mode */
      sc->mode.accelfactor = PSM_ACCEL;
      sc->mode.protocol = MOUSE_PROTO_PS2;
 @@ -786,7 +791,7 @@
  
      /* Get device data */
      sc = psm_softc[unit];
 -    if ((sc->state & PSM_VALID) == 0)
 +    if ((sc == NULL) || (sc->state & PSM_VALID) == 0)
  	/* the device is no longer valid/functioning */
          return (ENXIO);
      ioport = sc->addr;

From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To: Mark Schleifer <marks@roto.digex.net>
Cc: FreeBSD-gnats-submit@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found
	 at 0x60 
Date: Wed, 08 Jan 1997 14:05:08 +0900

 >] >>How-To-Repeat:
 >] >
 >] >Kernel made with following config file.  This file worked with SNAPs and 
 >] >ALPHA after applying PAO patches. Also tried with PSM_NO_RESET with BETA
 >] >but that caused the keyboard to lockup at first input request.
 >] 
 >] PSM_NO_RESET is no longer available in 2.2-BETA, thus, has nothing to do
 >] with the keyboard lockup; the lockup which shouldn't be happening *sigh*
 >
 >Interesting...It was just giving me the errors until I added that
 >config option (which it didn't complain about).  With that option in,
 >it doesn't allow keyboard input. 
 
 You mean, PSM_NO_RESET made `psm' to recognize your PS/2 mouse
 (trackball) successfully?  Strange. I am very sure that PSM_NO_RESET
 has no effect on `psm' now...
 
 >] Did you see any message from the `sc' (syscons) driver on boot?
 >
 >sc had no errors during boot.  Just the usual:
 >
 >Jan  7 22:13:07 otor /kernel: sc0 at 0x60-0x6f irq 1 on motherboard
 >Jan  7 22:13:07 otor /kernel: sc0: VGA color <16 virtual consoles, flags=0x0>
 >
 >] I would also ask you to add 
 >]     options "KBDIO_DEBUG=2"
 >] to your config file. With this option `sc' and `psm' drivers will log
 >] quite a few messages via `syslogd' on boot and later. The messages are
 >] marked with "kbdio: blugh blugh". 
 >
 >I did this but saw nothing in the syslogs.  What does it log them
 >under? kern.debug?
 
 Yes, you should find logs under kern.debug. You should see something like:
 
 ..... kbdio: X char read (empty_both_buffers)
 ..... kbdio: RESET_KBD return code:00fa
 ..... kbdio: RESET_KBD status:00aa
 ..... sc0 at 0x60-0x6f irq 1 on motherboard
 ..... sc0: VGA color <16 virtual consoles, flags=0x0>
 
 ..... kbdio: TEST_AUX_PORT status:0000
 ..... kbdio: RESET_AUX return code:00fa
 ..... kbdio: RESET_AUX status:00aa
 ..... kbdio: RESET_AUX ID:0000
 ..... psm0 at 0x60-0x64 irq 12 on motherboard
 ..... psm0: device ID 0, 3 buttons
 
 >Just for grins, I tried starting moused again, which crashed immediately:
 >
 ># moused -p /dev/psm0 -t ps/2
 
 You need to apply the patch to prevent the crash.
 
 Kazu

From: Mark Schleifer <marks@roto.digex.net>
To: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
Cc: Mark Schleifer <marks@roto.digex.net>, FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found
	 at 0x60 
Date: Wed, 8 Jan 1997 09:16:25 -0500 (EST)

 On 1/8/1997 (14:05:08 +0900), Kazutaka YOKOTA wrote:
 ] >] >>How-To-Repeat:
 ] >] >
 ] >] >Kernel made with following config file.  This file worked with SNAPs and 
 ] >] >ALPHA after applying PAO patches. Also tried with PSM_NO_RESET with BETA
 ] >] >but that caused the keyboard to lockup at first input request.
 ] >] 
 ] >] PSM_NO_RESET is no longer available in 2.2-BETA, thus, has nothing to do
 ] >] with the keyboard lockup; the lockup which shouldn't be happening *sigh*
 ] >
 ] >Interesting...It was just giving me the errors until I added that
 ] >config option (which it didn't complain about).  With that option in,
 ] >it doesn't allow keyboard input. 
 ] 
 ] You mean, PSM_NO_RESET made `psm' to recognize your PS/2 mouse
 ] (trackball) successfully?  Strange. I am very sure that PSM_NO_RESET
 ] has no effect on `psm' now...
 
 I'm sorry I wasn't clear...PSM_NO_RESET didn't make it recognize
 successfully.  Let me back up.   I've had the following results, in
 all cases psm0 is _not_ recognized successfully: 
 
 w/ kernel.GENERIC:
 
 psm0 enabled in the kernel:  System boots but doesn't take anything I 
                              type.  I have to powercycle after boot to
                              get out.
 psm0 disabled in the kernel: System works OK unless something tries to
                              open psm0.
 
 
 w/ config OTOR-SCSI (the one sent in with the bug report):
 
 psm0 enabled in the kernel: System works OK unless something tries to
                             open psm0.
 
 
 w/ config OTOR-SCSI + PSM_NO_RESET:
 
 psm0 enabled in the kernel:  System boots but doesn't take anything I 
                              type.  I have to powercycle after boot to
                              get out.
 
 
 ] [...]
 ] >
 ] >] I would also ask you to add 
 ] >]     options "KBDIO_DEBUG=2"
 ] >] to your config file. With this option `sc' and `psm' drivers will log
 ] >] quite a few messages via `syslogd' on boot and later. The messages are
 ] >] marked with "kbdio: blugh blugh". 
 ] >
 ] >I did this but saw nothing in the syslogs.  What does it log them
 ] >under? kern.debug?
 ] 
 ] Yes, you should find logs under kern.debug. You should see something like:
 ] 
 ] ..... kbdio: X char read (empty_both_buffers)
 ] ..... kbdio: RESET_KBD return code:00fa
 ] ..... kbdio: RESET_KBD status:00aa
 ] ..... sc0 at 0x60-0x6f irq 1 on motherboard
 ] ..... sc0: VGA color <16 virtual consoles, flags=0x0>
 ] 
 ] ..... kbdio: TEST_AUX_PORT status:0000
 ] ..... kbdio: RESET_AUX return code:00fa
 ] ..... kbdio: RESET_AUX status:00aa
 ] ..... kbdio: RESET_AUX ID:0000
 ] ..... psm0 at 0x60-0x64 irq 12 on motherboard
 ] ..... psm0: device ID 0, 3 buttons
 
 Hum, none of this to the screen or to syslog.  Wait, I'm sorry.  I was
 overtired last night and removed the "" from "KBDIO_DEBUG=2".  I just
 put them in and rebuilt the kernel.  Here are the results:
 
 
 Jan  8 09:03:03 otor /kernel: Probing for devices on the ISA bus:
 Jan  8 09:03:03 otor /kernel: kbdio: RESET_KBD return code:00fa
 Jan  8 09:03:04 otor /kernel: kbdio: RESET_KBD status:00aa
 Jan  8 09:03:04 otor /kernel: sc0 at 0x60-0x6f irq 1 on motherboard
 Jan  8 09:03:04 otor /kernel: sc0: VGA color <16 virtual consoles, flags=0x0>
 [...]
 Jan  8 09:03:04 otor /kernel: kbdio: TEST_AUX_PORT status:0000
 Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX return code:00fa
 Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX status:00aa
 Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX ID:0000
 Jan  8 09:03:04 otor /kernel: psm0: unable to set the command byte.
 Jan  8 09:03:04 otor /kernel: psm0 not found at 0x60
 
 
 ] >Just for grins, I tried starting moused again, which crashed immediately:
 ] >
 ] ># moused -p /dev/psm0 -t ps/2
 ] 
 ] You need to apply the patch to prevent the crash.
 
 Patch applied and it did indeed fix that problem.  For some reason
 when I first read your mail I thought you were saying that the patch
 had already been applied between the ALPHA and the BETA.  Sorry for
 the confusion. 
 
 	- Mark

From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To: Mark Schleifer <marks@roto.digex.net>
Cc: FreeBSD-gnats-submit@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found
	 at 0x60 
Date: Thu, 09 Jan 1997 12:11:18 +0900

 >w/ kernel.GENERIC:
 >
 >psm0 enabled in the kernel:  System boots but doesn't take anything I 
 >                             type.  I have to powercycle after boot to
 >                             get out.
 >psm0 disabled in the kernel: System works OK unless something tries to
 >                             open psm0.
 >
 >w/ config OTOR-SCSI (the one sent in with the bug report):
 >
 >psm0 enabled in the kernel: System works OK unless something tries to
 >                            open psm0.
 >
 >w/ config OTOR-SCSI + PSM_NO_RESET:
 >
 >psm0 enabled in the kernel:  System boots but doesn't take anything I 
 >                             type.  I have to powercycle after boot to
 >                             get out.
 >
 [...]
 >Jan  8 09:03:03 otor /kernel: Probing for devices on the ISA bus:
 >Jan  8 09:03:03 otor /kernel: kbdio: RESET_KBD return code:00fa
 >Jan  8 09:03:04 otor /kernel: kbdio: RESET_KBD status:00aa
 >Jan  8 09:03:04 otor /kernel: sc0 at 0x60-0x6f irq 1 on motherboard
 >Jan  8 09:03:04 otor /kernel: sc0: VGA color <16 virtual consoles, flags=0x0>
 >[...]
 >Jan  8 09:03:04 otor /kernel: kbdio: TEST_AUX_PORT status:0000
 >Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX return code:00fa
 >Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX status:00aa
 >Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX ID:0000
 >Jan  8 09:03:04 otor /kernel: psm0: unable to set the command byte.
 >Jan  8 09:03:04 otor /kernel: psm0 not found at 0x60
 
 I see... The probe routine of the `psm' driver successfully reset the
 PS/2 mouse, but somehow the driver failed to talk to the keyboard
 controller just before finishing the probe. This is a nasty problem.
 
 Something went wrong after the device reset. I would be very grateful
 if you could take the following steps to narrow down the problem area.
 
 1. Add the following #define to the top of /usr/src/sys/i386/isa/psm.c.
        #define PSM_DEBUG   2
    Recompile the kernel, reboot the system, and see what it gives. 
    There will be a lot of messages. Please examine `dmesg' output, 
    if possible, as well as `syslogd' output, (Some messages are logged 
    under kern.err.)
 2. Apply the following patch to `psm.c' and see if it works. The patch 
    reduces the amount of interaction between the driver and the keyboard 
    controller, and uses less variety of mouse commands, thus, there should 
    be less chance of communication failure.
 
 Thank you.
 
 Kazu
 
 --- psm.c.orig	Sat Jan  4 11:54:32 1997
 +++ psm.c	Thu Jan  9 11:15:48 1997
 @@ -695,6 +695,7 @@
  
      /* set mouse parameters */
      /* FIXME:XXX should we set them in `psmattach()' rather than here? */
 +#if 0
      if (setparams) {
          if (sc->mode.rate > 0)
              sc->mode.rate = set_mouse_sampling_rate(ioport, sc->mode.rate);
 @@ -705,6 +706,11 @@
      /* FIXME:XXX I don't know if these parameters are reasonable */
      set_mouse_scaling(ioport);    /* 1:1 scaling */
      set_mouse_mode(ioport);    /* stream mode */
 +#else
 +    i = send_aux_command(ioport, 0x00f6);
 +    if (verbose)
 +        log(LOG_DEBUG, "psm%d: SET_DEFAULT return code:%04x\n", unit, i);
 +#endif
  
      /* just check the status of the mouse */
      if (verbose) {
 

From: Mark Schleifer <marks@roto.digex.net>
To: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
Cc: Mark Schleifer <marks@roto.digex.net>, FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found
	 at 0x60 
Date: Thu, 9 Jan 1997 11:23:27 -0500 (EST)

 On 1/9/1997 (12:11:18 +0900), Kazutaka YOKOTA wrote:
 ] 
 ] >w/ kernel.GENERIC:
 ] >
 ] >psm0 enabled in the kernel:  System boots but doesn't take anything I 
 ] >                             type.  I have to powercycle after boot to
 ] >                             get out.
 ] >psm0 disabled in the kernel: System works OK unless something tries to
 ] >                             open psm0.
 ] >
 ] >w/ config OTOR-SCSI (the one sent in with the bug report):
 ] >
 ] >psm0 enabled in the kernel: System works OK unless something tries to
 ] >                            open psm0.
 ] >
 ] >w/ config OTOR-SCSI + PSM_NO_RESET:
 ] >
 ] >psm0 enabled in the kernel:  System boots but doesn't take anything I 
 ] >                             type.  I have to powercycle after boot to
 ] >                             get out.
 ] >
 ] [...]
 ] >Jan  8 09:03:03 otor /kernel: Probing for devices on the ISA bus:
 ] >Jan  8 09:03:03 otor /kernel: kbdio: RESET_KBD return code:00fa
 ] >Jan  8 09:03:04 otor /kernel: kbdio: RESET_KBD status:00aa
 ] >Jan  8 09:03:04 otor /kernel: sc0 at 0x60-0x6f irq 1 on motherboard
 ] >Jan  8 09:03:04 otor /kernel: sc0: VGA color <16 virtual consoles, flags=0x0>
 ] >[...]
 ] >Jan  8 09:03:04 otor /kernel: kbdio: TEST_AUX_PORT status:0000
 ] >Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX return code:00fa
 ] >Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX status:00aa
 ] >Jan  8 09:03:04 otor /kernel: kbdio: RESET_AUX ID:0000
 ] >Jan  8 09:03:04 otor /kernel: psm0: unable to set the command byte.
 ] >Jan  8 09:03:04 otor /kernel: psm0 not found at 0x60
 ] 
 ] I see... The probe routine of the `psm' driver successfully reset the
 ] PS/2 mouse, but somehow the driver failed to talk to the keyboard
 ] controller just before finishing the probe. This is a nasty problem.
 ] 
 ] Something went wrong after the device reset. I would be very grateful
 ] if you could take the following steps to narrow down the problem area.
 ] 
 ] 1. Add the following #define to the top of /usr/src/sys/i386/isa/psm.c.
 ]        #define PSM_DEBUG   2
 ]    Recompile the kernel, reboot the system, and see what it gives. 
 ]    There will be a lot of messages. Please examine `dmesg' output, 
 ]    if possible, as well as `syslogd' output, (Some messages are logged 
 ]    under kern.err.)
 
 Well, I did this and the messages did increase...And psm0 was found
 and operates correctly.  I was able to run X with no trouble.
 
 
 Jan  9 10:20:18 otor /kernel: psm0: current command byte:0047
 Jan  9 10:20:18 otor /kernel: kbdio: TEST_AUX_PORT status:0000
 Jan  9 10:20:18 otor /kernel: kbdio: RESET_AUX return code:00fa
 Jan  9 10:20:18 otor /kernel: kbdio: RESET_AUX status:00aa
 Jan  9 10:20:18 otor /kernel: kbdio: RESET_AUX ID:0000
 Jan  9 10:20:18 otor /kernel: psm: ENABLE_DEV return code:00fa
 Jan  9 10:20:19 otor /kernel: psm: DISABLE_DEV return code:00fa
 Jan  9 10:20:19 otor /kernel: psm: SEND_AUX_STATUS return code:00fa
 Jan  9 10:20:19 otor /kernel: psm0: status after reset 00 02 64
 Jan  9 10:20:19 otor /kernel: psm: SEND_DEV_ID return code:00fa
 Jan  9 10:20:19 otor /kernel: psm: device ID: 0000
 Jan  9 10:20:19 otor /kernel: psm: SET_RESOLUTION (0) 00fa
 Jan  9 10:20:19 otor /kernel: psm: SET_SCALING11 return code:00fa
 Jan  9 10:20:19 otor last message repeated 2 times
 Jan  9 10:20:19 otor /kernel: psm: SEND_AUX_STATUS return code:00fa
 Jan  9 10:20:19 otor /kernel: psm: status 00 00 64 (get_mouse_buttons)
 Jan  9 10:20:19 otor /kernel: psm: SET_SAMPLING_RATE (100) 00fa
 Jan  9 10:20:19 otor /kernel: psm: SET_RESOLUTION (2) 00fa
 Jan  9 10:20:19 otor /kernel: psm: SET_SCALING11 return code:00fa
 Jan  9 10:20:19 otor /kernel: psm: SET_STREAM_MODE return code:00fa
 Jan  9 10:20:19 otor /kernel: psm: SEND_AUX_STATUS return code:00fa
 Jan  9 10:20:19 otor /kernel: psm0: status 00 02 64
 Jan  9 10:20:19 otor /kernel: psm0 at 0x60-0x64 irq 12 on motherboard
 Jan  9 10:20:19 otor /kernel: psm0: device ID 0, 2 buttons?
 
 And when I ran X:
 
 Jan  9 10:23:06 otor /kernel: psm: ENABLE_DEV return code:00fa
 Jan  9 10:23:06 otor /kernel: psm: SEND_AUX_STATUS return code:00fa
 Jan  9 10:23:06 otor /kernel: psm0: status 20 02 64
 Jan  9 10:23:15 otor /kernel: psm: button 4 down (0000) (mkps2)
 Jan  9 10:23:26 otor last message repeated 167 times
 Jan  9 10:23:26 otor /kernel: psm: button 4 down (0001) (mkps2)
 Jan  9 10:23:29 otor last message repeated 69 times
 Jan  9 10:23:29 otor /kernel: psm: button 4 down (0000) (mkps2)
 Jan  9 10:23:29 otor /kernel: psm: DISABLE_DEV return code:00fa
 Jan  9 10:23:29 otor /kernel: psm0: failed to disable the aux port (psmclose).
 
 I rebooted twice just to be sure everything worked.  Then I removed
 the #define and rebooted.  The problem returned as expected
 
 
 ] 2. Apply the following patch to `psm.c' and see if it works. The patch 
 ]    reduces the amount of interaction between the driver and the keyboard 
 ]    controller, and uses less variety of mouse commands, thus, there should 
 ]    be less chance of communication failure.
 
 I added your patch without the '#define PSM_DEBUG   2' (since that by
 itself avoids the problem) and the the problem was still there:
 
 kbdio: TEST_AUX_PORT status:0000
 kbdio: RESET_AUX return code:00fa
 kbdio: RESET_AUX status:00aa
 kbdio: RESET_AUX ID:0000
 psm0: unable to set the command byte.
 psm0 not found at 0x60
 
 
 What's next to try?  Also, do you want be to remove the patch below
 before the next test?
 
 	- Mark
 
 
 ] 
 ] --- psm.c.orig	Sat Jan  4 11:54:32 1997
 ] +++ psm.c	Thu Jan  9 11:15:48 1997
 ] @@ -695,6 +695,7 @@
 ]  
 ]      /* set mouse parameters */
 ]      /* FIXME:XXX should we set them in `psmattach()' rather than here? */
 ] +#if 0
 ]      if (setparams) {
 ]          if (sc->mode.rate > 0)
 ]              sc->mode.rate = set_mouse_sampling_rate(ioport, sc->mode.rate);
 ] @@ -705,6 +706,11 @@
 ]      /* FIXME:XXX I don't know if these parameters are reasonable */
 ]      set_mouse_scaling(ioport);    /* 1:1 scaling */
 ]      set_mouse_mode(ioport);    /* stream mode */
 ] +#else
 ] +    i = send_aux_command(ioport, 0x00f6);
 ] +    if (verbose)
 ] +        log(LOG_DEBUG, "psm%d: SET_DEFAULT return code:%04x\n", unit, i);
 ] +#endif
 ]  
 ]      /* just check the status of the mouse */
 ]      if (verbose) {

From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To: Mark Schleifer <marks@roto.digex.net>
Cc: FreeBSD-gnats-submit@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found
	 at 0x60 
Date: Fri, 10 Jan 1997 17:16:09 +0900

 >Well, I did this and the messages did increase...And psm0 was found
 >and operates correctly.  I was able to run X with no trouble.
 >
 >Jan  9 10:20:18 otor /kernel: psm0: current command byte:0047
 >Jan  9 10:20:18 otor /kernel: kbdio: TEST_AUX_PORT status:0000
 >Jan  9 10:20:18 otor /kernel: kbdio: RESET_AUX return code:00fa
 >Jan  9 10:20:18 otor /kernel: kbdio: RESET_AUX status:00aa
 >Jan  9 10:20:18 otor /kernel: kbdio: RESET_AUX ID:0000
 >Jan  9 10:20:18 otor /kernel: psm: ENABLE_DEV return code:00fa
 >Jan  9 10:20:19 otor /kernel: psm: DISABLE_DEV return code:00fa
 [...]
 >Jan  9 10:20:19 otor /kernel: psm: SEND_AUX_STATUS return code:00fa
 >Jan  9 10:20:19 otor /kernel: psm0: status 00 02 64
 >Jan  9 10:20:19 otor /kernel: psm0 at 0x60-0x64 irq 12 on motherboard
 >Jan  9 10:20:19 otor /kernel: psm0: device ID 0, 2 buttons?
 
 The log looks fine. I must say the mouse and the keyboard controller are
 working perfectly.
 
 >And when I ran X:
 [...]
 >
 >I rebooted twice just to be sure everything worked.  Then I removed
 >the #define and rebooted.  The problem returned as expected
 
 *sigh* Then, this must be a very subtle timing problem. I heard from
 two other HiNote Ultra II owners about the same problem yesterday. 
 They all reported exactly the same results as yours; define PSM_DEBUG
 and KBDIO_DEBUG, and things works flawlessly, remove the definitions,
 then no luck.
 
 >I added your patch without the '#define PSM_DEBUG   2' (since that by
 >itself avoids the problem) and the the problem was still there:
 >
 >kbdio: TEST_AUX_PORT status:0000
 >kbdio: RESET_AUX return code:00fa
 >kbdio: RESET_AUX status:00aa
 >kbdio: RESET_AUX ID:0000
 >psm0: unable to set the command byte.
 >psm0 not found at 0x60
 
 I am sorry that it didn't work.
 
 >What's next to try?  Also, do you want be to remove the patch below
 >before the next test?
 
 You don't have to remove the patch. It's harmless.
 I will contact you again when I come up with some test or patch.
 
 Thank you very much for your cooperation.
 
 Kazu

From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
To: Mark Schleifer <marks@roto.digex.net>
Cc: FreeBSD-gnats-submit@freebsd.org, nate@mt.sri.com,
        yokota@zodiac.mech.utsunomiya-u.ac.jp
Subject: Re: kern/2409: psm0: unable to set the command byte. psm0 not found
	 at 0x60 
Date: Mon, 20 Jan 1997 08:08:31 +0900

 >] I wrote yet another patch which will perform the same sequence of I/O
 >] to the keyboard controller when the system starts without `-v' option 
 >] as with `-v' option.
 >] 
 >] I am very sorry to bother you again. But, I would be very grateful if
 >] you could kindly try this patch.  the patch is to be applied to the
 >] original `psm.c' in 2.2-BETA.
 >
 >
 >No problem...Glad to help (I want FreeBSD working no the Laptop).
 >With this patch, everything is working.  Both with and without the
 >KBDIO_DEBUG=2 option.  Looks like you've got a fix.  I only hope this
 >doesn't break anyone else. 
 >
 >	- Mark
 
 This patch and another fix for an arcane keyboard controller in a Dell
 laptop were committed to the 2.2 branch on 15 January.
 
 We can close this PR now :-) Thank you for your cooperation.
 
 Kazu
State-Changed-From-To: open->closed 
State-Changed-By: nate 
State-Changed-When: Sun Jan 19 15:51:32 PST 1997 
State-Changed-Why:  

The originator states that the patch (which Soren committed to the 2.2 
branch) fixed his problem. 

>Unformatted:
