Subject: Re: PC engine WRAP
To: Ian Zagorskih <ianzag@megasignal.com>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: netbsd-users
Date: 06/20/2005 21:31:22
Emmanuel Dreyfus <manu@netbsd.org> wrote:

> > Also MMCR registers hold usefull info too. I have several Elan SC520 based
> > boards so if you'r gonna try it i can run tests.
> 
> Try this one:

Sorry, I overlooked it. Here is a better patch:

Index: gatea20.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/gatea20.c,v
retrieving revision 1.5
diff -U2 -r1.5 gatea20.c
--- gatea20.c   12 Aug 2002 14:27:34 -0000      1.5
+++ gatea20.c   20 Jun 2005 19:29:11 -0000
@@ -40,20 +40,29 @@
        if (
 #ifdef SUPPORT_PS2
-           biosmca_ps2model == 0xf82 ||
+           (biosmca_ps2model == 0xf82) ||
 #endif
-           /* XXX How to check for AMD Elan SC520? */
-           0) {
-               outb(0x92, 0x2);
+           (inb(K_STATUS) == 0xff && inb(K_RDWR) == 0xff)) {
+               int data;
+
+               data = inb(0x92);
+               outb(0x92, data | 0x2);
        } else {
        while (inb(K_STATUS) & K_IBUF_FUL);
+
                while (inb(K_STATUS) & K_OBUF_FUL)
                        (void)inb(K_RDWR);
 
                outb(K_CMD, KC_CMD_WOUT);
+
                delay(100);
                while (inb(K_STATUS) & K_IBUF_FUL);
+
                outb(K_RDWR, x_20);
+
                delay(100);
                while (inb(K_STATUS) & K_IBUF_FUL);
+
+               while (inb(K_STATUS) & K_OBUF_FUL)
+                       (void)inb(K_RDWR);
        }
        __asm("popfl");
-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@netbsd.org