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?

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.

Who is online

Users browsing this forum: No registered users and 10 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum