Subject: port-sparc64/26121: Sun keyboard does not work on Sun Ultra 60
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jdc@coris.org.uk>
List: netbsd-bugs
Date: 06/30/2004 09:59:43
>Number:         26121
>Category:       port-sparc64
>Synopsis:       Sun keyboard does not work on Sun Ultra 60
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 30 09:00:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Julian Coleman
>Release:        NetBSD 2.0F
>Organization:
	Arjuna Technologies Limited
>Environment:
System: NetBSD sirion 2.0F NetBSD 2.0F (U60) #19: Tue Jun 29 16:50:46 BST 2004 root@anduin:/usr/obj/sys/arch/sparc64/compile/U60
Architecture: sparc64
Machine: sparc64

>Description:

Keyboard key presses are not recognised on the console of an Ultra 60 (with
Sun keyboard/monitor - not run headless).

Additions to kernel config (based on GENERIC-32):

  options 	RASTERCONSOLE
  options 	FONT_GALLANT12x22
  options 	WSEMUL_SUN
  wskbd*	at kbd
  ffb*		at mainbus0
  wsdisplay*	at ffb?

Relevant parts of dmesg:

  mainbus0 (root): SUNW,Ultra-60: hostid 80f78e80
  ebus0 at pci0 dev 1 function 0
  ebus0: Sun Microsystems, Inc. PCIO Ebus2, revision 0x01
  com0 at ebus0 addr 3083f8-3083ff ipl 41: ns16550a, working fifo
  com0: console
  kbd0 at com0 (console input)
  wskbd0 at kbd0 (mux ignored): console keyboard
  com1 at ebus0 addr 3062f8-3062ff ipl 42: ns16550a, working fifo
  ms0 at com1
  ffb0 at mainbus0 addr 0xfeb80000: Creator3D, model SUNW,501-4788
  wsdisplay0 at ffb0 (kbdmux ignored): console (sunffb, sun emulation), using wskbd0

When a key is pressed/released, com_rxsoft() in sys/dev/ic/com.c is called
but returns because the check for:

  if (!ISSET(tp->t_state, TS_ISOPEN)) {

is always true.  At attach time, sunkbd_attach() in sys/dev/sun/sunkbd.c is
called, but sunkbdiopen() and ttylopen() don't get called to set TS_ISOPEN.

Note that the keyboard also does not work in 2.0 Beta.

>How-To-Repeat:

Boot a 2.0 Beta or -current kernel on an Ultra 60 with Sun keyboard as
console input.  This probably affects other PCI machines too.

>Fix:

The following patch (from Martin) will make the keyboard work for normal
operation but not for DDB.

--- kbd.c.dist	2004-04-23 10:53:29.000000000 +0100
+++ kbd.c	2004-06-29 16:32:25.000000000 +0100
@@ -1063,5 +1063,8 @@
 	k->k_wskbd = config_found(&k->k_dev, &a, wskbddevprint);
 	k->k_wsenabled = 0;
 	callout_init(&k->k_wsbell);
+
+	if (k->k_wskbd != NULL && a.console)
+		wssunkbd_enable(k, 1);  /* in wscons the console is always enabled */
 }
 #endif
>Release-Note:
>Audit-Trail:
>Unformatted: