NetBSD Problem Report #20433

Received: (qmail 29883 invoked by uid 605); 19 Feb 2003 22:08:48 -0000
Message-Id: <>
Date: Wed, 19 Feb 2003 14:08:47 -0800 (PST)
Subject: PC Kbd works in BIOS/Console but fails during boot
X-Send-Pr-Version: www-1.0

>Number:         20433
>Category:       kern
>Synopsis:       PC Kbd works in BIOS/Console but fails during boot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 19 22:09:01 +0000 2003
>Last-Modified:  Sun Sep 03 01:14:20 +0000 2006
>Originator:     Dave Barnes
>Release:        1.5, 1.6, 1.6-current Alpha and I386
PC style keyboard works fine in BIOS (or on Alpha in the SRM console) but fails during boot with a variety of keyboard error codes.  Seems to be worse on some systems than others.  The failure can occur suddenly on systems that had been working just fine.  The keyboard error codes appear to be random.
This is a hard problem to repeat since it seems to depend on exact timing between the host processor and the keyboard interface controller. On a system with just the right conditions it will fail just about every time.  A change in temp is enough to change the timing relationship just enough to make the problem go away on some systems and to show up on others.
The following diff appears to catch and clear up the keyboard error enough to make the keyboard work.  I've been using the diff on the Alpha Multia system for several months and only recently had the problem show up with an i386 system.  This diff seems to work in both cases.

*** dev/pckbc/pckbd.c.orig	Sun Mar 17 13:41:00 2002
--- dev/pckbc/pckbd.c	Wed Nov 27 17:47:25 2002
*** 284,289 ****
--- 284,301 ----
  	/* Reset the keyboard. */
  	cmd[0] = KBC_RESET;
  	res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 1, resp, 1);
+ 	/* Hack by djb.....
+ 	 * If we get bad stuff from the keyboard, reset it again just
+ 	 * in case.
+ 	*/ 
+ 	if (res || (resp[0] != KBR_RSTDONE)) {
+ 		printf("pckbdprobe: DJB Hack!, res=%d; resp=0x%x\n", res, resp[0]);
+ 		/* Let's try again:) */	
+ 		pckbc_flush(pa->pa_tag, pa->pa_slot);
+ 		cmd[0] = KBC_RESET;
+ 		res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 1, resp, 1);
+ 	}
  	if (res) {
  #ifdef DEBUG
  		printf("pckbdprobe: reset error %d\n", res);

Responsible-Changed-From-To: kern-bug-people->mycroft 
Responsible-Changed-By: mycroft 
Responsible-Changed-When: Thu Jul 8 20:32:52 UTC 2004 

From: "Charles M. Hannum" <>
Subject: Re: kern/20433: PC Kbd works in BIOS/Console but fails during boot
Date: Thu, 8 Jul 2004 20:45:10 +0000

 I think I see what the problem is here.  It occured during the switch to 
 "pckbport".  Can you try replacing the guts of 
 sys/dev/pckbport:pckbport_flush() with:

 	int c, count;

 	for (count = 20; count; count--) {
 		c = pckbport_poll_data1(t, slot);
 		if (c == -1)

 and see if that fixes the problem?
Responsible-Changed-From-To: mycroft->kern-bug-people
Responsible-Changed-When: Sun, 03 Sep 2006 01:14:20 +0000
Back to role account, mycroft doesn't have commit access any longer.


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.