NetBSD Problem Report #42108

From www@NetBSD.org  Tue Sep 22 01:52:55 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id DF57663BFE3
	for <gnats-bugs@gnats.netbsd.org>; Tue, 22 Sep 2009 01:52:55 +0000 (UTC)
Message-Id: <20090922015255.AE92263B877@www.NetBSD.org>
Date: Tue, 22 Sep 2009 01:52:55 +0000 (UTC)
From: djb.netbsd@gmail.com
Reply-To: djb.netbsd@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Old Compaq Presario: Keyboard trouble with ACPI
X-Send-Pr-Version: www-1.0

>Number:         42108
>Category:       kern
>Synopsis:       Old Compaq Presario: Keyboard trouble with ACPI
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 22 01:55:00 +0000 2009
>Originator:     Dave J. Barnes
>Release:        netbsd-5.0.1
>Organization:
Eng Consultant
>Environment:
NetBSD djb-cp 5.0.1 NetBSD 5.0.1 (i386/DJB-laptop 2009/08/26) #47: Mon Sep 21 20:07:53 CDT 2009  root@Shakeys:/Shakeys/NetBSD/src/usr/src/sys/arch/i386/compile/DJB i386


>Description:
With NetBSD 5.0.1 laptop keyboard does not function.  Keyboard worked
fine with 4.0.


With debugging code added and a test fix applied:
...
attimer1: attached to pcppi0
pckbport_poll: loops 10 response: fa
pckbport_poll2: loops 99 response: fe
pckbdprobe: reset response 0xfe
pckbport_poll: loops 10 response: fa
pckbport_poll2: loops 99 response: aa
pckbport_poll: loops 10 response: fa
pckbport_poll2: loops 99 response: aa
pckbdprobe again: reset response 0xaa
...

First response from the keyboard controller is 0xfe not 0xaa as expected. A retry
that resets the keyboard controller twice gets correct value.

Diff for dev/pckbport/pckbd.c attached:
>How-To-Repeat:
No keyboard with ACPI with generic kernel.  Disable ACPI then no interrupts for PCMCIA thus no network.  boot -c and disable 
"pckbc* at acpi" has additional problems.
>Fix:
diff:
-------------------------------
--- dev/pckbport/pckbd.c.orig	2009-09-20 19:42:01.000000000 -0500
+++ dev/pckbport/pckbd.c	2009-09-20 21:24:14.000000000 -0500
@@ -329,7 +329,23 @@
 	}
 	if (resp[0] != KBR_RSTDONE) {
 		printf("pckbdprobe: reset response 0x%x\n", resp[0]);
-		return 0;
+/*		return 0; */
+
+/* XXX Should we check the return codes more carefully? */
+		if (resp[0] == KBR_RESEND) {
+			/* Damn Intel chip -- let's try again */
+			pckbport_flush(pa->pa_tag, pa->pa_slot);
+			cmd[0] = KBC_RESET;
+			res = pckbport_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 1, resp, 1);
+
+			pckbport_flush(pa->pa_tag, pa->pa_slot);
+			cmd[0] = KBC_RESET;
+			res = pckbport_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 1, resp, 1);
+
+			printf("pckbdprobe again: reset response 0x%x\n", resp[0]);
+			if (resp[0] != KBR_RSTDONE) return 0;
+		}
+
 	}

 	/*
======================================

May not need to check the return code, just hammer the keyboard controller again if the response isn't right.  The code retries only if we get a resend from the controller (to a reset command?!?).  Second time I've seen this problem, see PR/20433.

BTW: I tried mycroft's fix as in 20433:
pckbport_poll: loops 10 response: fa
pckbport_poll2: loops 99 response: fe
pckbdprobe: reset response 0xfe
pckbport_poll: loops 10 response: fa
pckbport_poll2: loops 99 response: aa
pckbport_poll: loops 10 response: fa
pckbport_poll2: loops 99 response: aa
pckbdprobe again: reset response 0xaa

Got the exact same thing, 0xfe.  The only way out is to hit the controller with reset a couple of times if it messes up. Argh!

NetBSD Home
NetBSD PR Database Search

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