Page 1 of 1

Detecting PS/2 controller

Posted: Sun Feb 14, 2021 6:38 am
by md37
Hi. I am working on a PS/2 driver for laptop.
I am trying to detect if PS/2 controller is present, so I found FACP. Here it is:

Code: Select all

FACP @ 0x0127492800000003
    0000: 46 41 43 50 0C 01 00 00 05 D6 44 45 4C 4C 20 20  FACP......DELL
    0010: 43 42 58 33 20 20 20 00 09 20 07 01 41 4D 49 20  CBX3   .. ..AMI
    0020: 13 00 01 00 80 B1 EE 7A 70 82 5A 7A 01 02 09 00  .......zp.Zz....
    0030: B2 00 00 00 D1 D2 00 00 00 18 00 00 00 00 00 00  ................
    0040: 04 18 00 00 00 00 00 00 50 18 00 00 08 18 00 00  ........P.......
    0050: 80 18 00 00 00 00 00 00 04 02 01 04 20 00 10 00  ............ ...
    0060: 65 00 39 00 00 04 10 00 00 00 0D 00 32 00 00 00  e.9.........2...
    0070: A5 86 03 00 01 08 00 01 B2 00 00 00 00 00 00 00  ................
    0080: 73 00 00 00 00 00 00 00 00 00 00 00 70 82 5A 7A  s...........p.Zz
    0090: 00 00 00 00 01 20 00 02 00 18 00 00 00 00 00 00  ..... ..........
    00A0: 01 00 00 02 00 00 00 00 00 00 00 00 01 10 00 02  ................
    00B0: 04 18 00 00 00 00 00 00 01 00 00 02 00 00 00 00  ................
    00C0: 00 00 00 00 01 08 00 01 50 18 00 00 00 00 00 00  ........P.......
    00D0: 01 20 00 03 08 18 00 00 00 00 00 00 01 80 00 01  . ..............
    00E0: 80 18 00 00 00 00 00 00 01 00 00 01 00 00 00 00  ................
    00F0: 00 00 00 00 01 08 00 03 04 18 00 00 00 00 00 00  ................
    0100: 01 08 00 03 00 18 00 00 00 00 00 00              ............
As you can see, FADT revision is 5, so IAPC_BOOT_ARCH is present, but it is equal to 0, saying that there isn't any PS/2 controller. But Linux detects PS/2 controller, and internally connected keyboard and touchpad. Here is the output of dmesg | grep i8042:

Code: Select all

i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M] at 0x60,0x64 irg 1,12
i8042: Warning: Keylock active
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input4
input: AlpsPS/2 ALPS GlidePoint as /devices/platform/i8042/serio1/input/input6
So, how Linux detected PS/2 controller even though FADT says that there is no PS/2 controller? Is Linux probing 0x60 and 0x64 ports? Wiki says that it can cause a crash.

Re: Detecting PS/2 controller

Posted: Sun Feb 14, 2021 12:24 pm
by Gigasoft
The specification says:
If set, indicates that the motherboard contains support for a
port 60 and 64 based keyboard controller, usually implemented
as an 8042 or equivalent micro-controller.
It does not say that if the bit is cleared, the system does not contain a PS/2 controller. Use the DSDT and SSDTs to find out for sure what devices are present.