OSDev.org
https://forum.osdev.org/

Initializing the PS/2 controller: yes or no?
https://forum.osdev.org/viewtopic.php?f=1&t=33663
Page 1 of 1

Author:  DaviUnic [ Fri Apr 26, 2019 4:03 am ]
Post subject:  Initializing the PS/2 controller: yes or no?

Looking at some existing code and posts here on the forum, it seems that the BIOS or GRUB will initialize the PS/2 controller and keyboard, so there's not much left for you to do in order to use the keyboard, aside from setting up interrupts and writing a keyboard handler.

But the wiki page says the controller could be left in an unreliable state and it's thus better to (re)initialize it yourself.

I'm working on a simple kernel for a college assignment that requires the keyboard to work and boots with GRUB. Should I bother with the controller or not?

Author:  nullplan [ Fri Apr 26, 2019 4:15 am ]
Post subject:  Re: Initializing the PS/2 controller: yes or no?

Yes, you should reinitialize the controller. By the time you gain control of the machine, you don't know what the thing has been initialized to do, or if it was initialized at all. You should probably initialize the USB controllers before that, though, due to USB legacy support (without initializing the USB controllers, you can never be sure if you actually are speaking to a PS/2 controller or to the BIOS via SMIs. You can't even tell the difference without asking the chipset itself, and even then, some chipsets won't even let themselves be asked about these things).

For instance, is the controller set up for translation or not? If you have a BIOS computer, chances are it is. With UEFI, who knows? And GRUB does something new each version.

Also, you need to initialize the controller to be able to tell which ports it has and which of these ports have devices attached to them. And which devices they have. Unless you're cool with just assuming the user will have done the right thing.

Typing this on a PS/2 keyboard, by the way, because I have discovered that's just how the keyboard of this laptop is wired up. So that's a thing as well: Statically attached peripherals.

Author:  DaviUnic [ Sat Apr 27, 2019 6:56 am ]
Post subject:  Re: Initializing the PS/2 controller: yes or no?

Well, I got it working. Thanks. :)

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/