Solution for NEC D80C42C kbd ctrl bug #2790
Replies: 4 comments 17 replies
|
Hello @EC1842, Thank you for these technical suggestions. Getting A20 turned on has been difficult as some published methods don't work, and finally we have settled on a method that works on many systems, but apparently not all. So I would like to ask a few more questions to fully understand what you are seeing so we can develop a better solution. Is all your testing on same system, a PC/XT with an AT keyboard?
I will need to find a technical manual to know why we need to set bit4=1, as I don't know what it is supposed to do. Are you saying on your system bit 4 reads as 0 but must be set to 1 to work? Then this routine works?
I don't fully understand your explanation as to whether bits 1 and 5 are different on your machine than others? But nonetheless, I used to use USE_HIMEM_AT and it did not work on various systems, so we finally removed it and replaced it with USE_A20_ASM. It sounds like what may be required will be to be able to support having both USE_A20_ASM turned on, and also have USE_HIMEM_AT turned on, and called if USE_BIOS and USE_A20_ASM do not pass the verify_a20 check. Will that work for you, or does USE_A20_ASM cause your machine to stop working?
Will fix, thanks.
This was left in for the case of very old BIOS or incompatible BIOS that does not bother to return CF flag for unknown INT 15h calls.
Agreed, but how will we know when to automatically decide to attempt programming the keyboard controller? It was figured that the driver should not attempt programming LEDs with OUTB instructions unless it is known for sure there is an AT keyboard attached. We could add an option to the keyboard controller source code to force program the LEDs, but that would require a kernel recompilation. |
|
I have had a long hard look at the issue it's likely cause is that the read-modify-write in USE_A20ASM trusts command D0 to return the real output port latch, and on many 8042 variants it does not. Bits 4 and 5 are It also explains why himem.sys is reliable: it never reads. DF and DD assert bits 0, 2, 3, 4, 6 and 7 unconditionally and vary only bit 1, so the keyboard critical lines are always driven On keyboard type, BDA 40:96 bit 4 is set by POST when a 101/102 key keyboard is present, and 40:97 holds the LED state. That is independent of CPU, so it covers both a 286 card in an XT |
|
In that case, my fix checking BIOS data area won't work. At this point, I am quite confused as to what the difference is between an 83 key keyboard, a 101/102 key keyboard, an XT keyboard and an AT keyboard. Can you explain the differences so I can understand more exactly what we're talking about?
I will go ahead and replace BIOS 40:96 bit 4 check with looking at whether BIOS ID (machine type) is FCh; if so, then set keyboard LEDs. This is easy to do and seems to be the fix for your problem, even though I don't fully understand exactly what the differences between keyboard and/or keyboard types are.
Yes: the A20 code should be fixed, and I will replace the incorrect bit 5 BDA detection with using BIOS machine type == FCh instead. This should fix all problems in this issue. I will push that commit later today, thank you. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
the problem is in a20-ibm.inc, section USE_A20ASM. For some reason it reads bit4=0 from port 60h but has to be written back as "1". Solution is
But I strongly recommend you use USE_HIMEM_AT way, it works well on all my kbd cntrls. I have PC/XT compatible machine with AT keyboard controller, but bits reading from port 60h are different. bits 1 and 5 (a20,not define) are known and same on 8086 mashine with AT kbd(should be 0 in my case). So DFh and DDh to enable/disable a20 line is best way.
PS small things should be fixed:
1.
If option #define USE_BIOS only is chosen, set_a20 is not defined anymore. And we don't need to call verify_a20, if bios_set_a20 returns CF flag (err or AH=86h means not supported)
All reactions