Just did some more tests on the Caps lock issue. It seems that it affects Num lock and Scroll lock as well. Pressing any of those three modifier keys makes the BIOS send a 0xED(Set LEDs) command, but never the second parameter required to finish the command? That causes the PS/2 keyboard controller to continue to block any keys pressed(putting them in the response buffer), causing it to be unresponsive to any following keys pressed.
Anyone can tell me if they know why the BIOS isn't sending the actual data byte(the LED state to be applied for Num/Caps/Scroll lock)?
Edit: Managed to find and fix the bug: The PS/2 keyboard was giving infinite 0xFA(ACN) responses when receiving the Set/Reset LED(0xED) command. The same problem for 0xF0(Set/Get active scancode set). That was causing the BIOS to finish the command before sending the actual parameter required to finish the command, causing the PS/2 keyboard to think it still needs to inhabit keyboard input(because it's needed to be inhabited during commands being sent).
Now the Scroll lock works: I see it (re)setting the LED. But Caps Lock doesn't set any LEDs and Num lock sets Caps Lock and Num lock together. Although that might be a bug in the LED display routine intead(unlikely). Probably another bug in the PS/2 keyboard controller.
Edit: After some simple debugging I found out that the LEDs were being displayed incorrectly: Num Lock and Scroll Lock were working properly, but Caps Lock had it's light turned on based on the Num Lock LED instead of the Caps Lock LED(bit 1 instead of bit 2 in the LEDs being displayed).
Now the keyboard should be working without problems again 😁