"8042" PS/2 Controller: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(Continuation of PS/2 controller vs.protocol vs. device restructuring)
 
m ("see also" fixes)
Line 73: Line 73:


==See Also==
==See Also==
*[[PS/2]]
*[[PS/2 Keyboard]]
*[[PS/2 Mouse]]
===Threads===
===Threads===
*[[Post:69151|PS/2 controller initialisation]]
*[[Post:69151|PS/2 controller initialisation]]

Revision as of 03:36, 25 March 2012

This page is a stub.
You can help the wiki by accurately adding more contents to it.

Overview

The PS/2 Controller (often called a "Keyboard controller") is located on the mainboard. In the early days the controller was a single chip (8042). As of today it is part of the Advanced Integrated Peripheral.

The name is misleading because the controller does more than controlling communication with PS/2 devices.

Overview of the PS/2-Controller


History

The PS/2 controller supersedes an older (uni-directional, single channel) XT controller. The XT controller is only partly compatible (but is 100% obsolete).

Overview of the XT-Controller

To reduce costs, IBM originally used some of the general purpose input/output capabilities of the XT controller to control various unrelated parts of the system. This includes:

When IBM upgraded to the (bi-directional) PS/2 controller, they intended it to be used to control a keyboard and a mouse, and therefore added support for controlling a second PS/2 channel. Unfortunately, at the time most people were using mice connected to Serial Ports (the PS/2 mouse didn't catch on until later) and several clone manufacturers created PS/2 controllers that only support a single PS/2 channel. Eventually (around the late 80486 and early Pentium time frame) PS/2 mice became more popular, and PS/2 controllers have supported two PS/2 channels since then.

Translation

The original keyboards (using the old XT interface) used "scan code set 1". When the original interface was superseded, IBM wanted to use a newer scan code, "scan code set 2". This change would have created compatibility problems for older software that was expecting different scan codes from the keyboard. To avoid the compatibility problem, for the first PS/2 channel, the PS/2 controller supports a translation mode. If translation is enabled the PS/2 controller will translate "scan code set 2" into "scan code set 1". This translation is enabled by default. To actually use "scan code set 2" (or "scan code set 3"), or to allow different types of PS/2 devices to be used in the first PS/2 port, you need to disable this translation.


USB Legacy Support

By modern standards you will find many PCs bundled with USB input devices. Some PCs may not even have PS/2 connectors at all. To remain compatible with old software, the mainboard emulates USB Keyboards and Mice as PS/2 devices. This is called USB Legacy Support.

Because the implementation differ by manufacturer and mainboard there are flaws and sometimes even bugs:

  • Some emulation layers also handle the communication with the real PS/2 connectors regardless of any connected USB device. So maybe not all capabilities of the PS/2 connectors and devices can be used. For example extended mouse modes needed to use the scroll wheel won't work or the keyboard only works on the first PS/2 connector and the mouse only on the second connector.
  • The SMM BIOS that's providing the PS/2 USB Legacy Support may not support extended memory techniques or Long Mode and may cause system crashes.

This USB Legacy Support should be disabled by the OS as soon as the OS initialises the USB Controller, and this should be done before the OS attempts to initialise the real PS/2 controller. Otherwise the OS would only be initialising the emulated PS/2 controller and there's a large risk of problems caused by deficiencies in the firmware's emulation.


PS/2 Controller Commands

TODO Note: this is Controller commands and NOT Device commands


Initialising the PS/2 Controller

TODO Note: this is Controller initialisation and NOT Device initialisation


Detecting PS/2 Devices

TODO


Hot Plug PS/2 Devices

TODO


Sending Bytes To Device/s

TODO


Recieving Bytes From Device/s

TODO


See Also

Threads

External Links