On Thu, 2002-10-24 at 09:58, Adam Sulmicki wrote:
> > Is it possible that your BIOS reprogrammed the keyboard controller
> > in the wrong way ??
> 
> it is possible, in fact it the only unchecked list on my To Check
> List:
>       PIC not getting (re) programmed         CHECK
>       PIC interrupt mask is wrong             CHECK
>       IF  flag being cleared                  CHECK
>       keyboard controller                     ????
> 
> so I guess that leaves the keyboard controller only.
> That brings me to the point, what sort of references did you
> use to write
> 
>       cvs-freebios/freebios/src/pc80/keyboard.c
>

Here is the more solid and well documented version which is used in our 
internal version of etherboot.

void pc_keyboard_init()
{
        volatile unsigned char regval;

        /* ------------------- controller side ----------------------*/
        printf("reset keyboard \n");
        /* send cmd = 0xAA, self test 8042 */
        outb(0xaa, 0x64);

        /* empty input buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x02))
                post_code(0);
        /* empty output buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x01) == 0)
                post_code(1);

        /* read self-test result, 0x55 should be returned form 0x60 */
        if ((regval = inb(0x60) != 0x55))
                printf("self test failed\n");

        /* send cmd = 0xAA, keyboard interface test */
        outb(0xab, 0x64);

        /* empty input buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x02))
                post_code(0);
        /* empty output buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x01) == 0)
                post_code(1);

        /* read keyboard interface test result, 0x00 should be returned form
0x60 */
        if ((regval = inb(0x60) != 0x00))
                printf("keyboard interface test failed\n");

        /* Enable Keyboard clock */
        outb(0xae, 0x64);
        outb(0xa8, 0x64);

        /* ------------------- keyboard side ------------------------*/
        /* reset kerboard and self test  (keyboard side) */
        outb(0xff, 0x60);
        /* empty inut buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x02))
                post_code(4);
        /* empty output buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x01) == 0)
                post_code(5);
        /* keyboard should return ACK */
        if ((regval = inb(0x60) != 0xfa))
                printf("keyboard self test failed\n");

        while ((inb(0x64) & 0x01) == 0)
                post_code(6);
        if ((regval = inb(0x60) != 0xaa))
                printf("keyboard self test failed\n");

        /* Disable keyboard */
        outb(0xf5, 0x60);
        /* empty inut buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x02))
                post_code(4);
        /* empty output buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x01) == 0)
                post_code(5);
        /* keyboard should return ACK */
        if ((regval = inb(0x60) != 0xfa))
                printf("disable keyboard failed\n");

        /* Write Keyboard Mode */
        outb(0x60, 0x64);
        while ((inb(0x64) & 0x02))
                post_code(2);
        /* send cmd: scan code convert, disable mouse, enable IRQ 1 */
        outb(0x61, 0x60);
        while ((inb(0x64) & 0x02))
                post_code(3);

        /* Enable keyboard */
        outb(0xf4, 0x60);
        /* empty inut buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x02))
                post_code(4);
        /* empty output buffer or any other command/data will be lost */
        while ((inb(0x64) & 0x01) == 0)
                post_code(5);
        /* keyboard should return ACK */
        if ((regval = inb(0x60) != 0xfa))
                printf("enable keyboard failed\n");
}


_______________________________________________
Linuxbios mailing list
[EMAIL PROTECTED]
http://www.clustermatic.org/mailman/listinfo/linuxbios

Reply via email to