diff --git a/doc/developer-guides/hld/atkbdc-virt-hld.rst b/doc/developer-guides/hld/atkbdc-virt-hld.rst new file mode 100644 index 000000000..249f4b00b --- /dev/null +++ b/doc/developer-guides/hld/atkbdc-virt-hld.rst @@ -0,0 +1,77 @@ +.. _atkbdc_virt_hld: + +AT keyboard controller emulation +################################ + +This document describes AT keyboard controller emulation implementation in ACRN device model. Atkbdc device emulates a PS2 keyboard and mouse. + +Overview +******** + +The PS2 port is a 6-pin mini-Din connector used for connecting keyboards and mice to a PC compatible computer system. Its name comes from the IBM Personal System/2 series of personal computers, with which it was introduced in 1987. PS2 keyboard/mouse emulation is based on ACPI Emulation. We can add ACPI description of PS2 keyboard/mouse into virtual DSDT table to emulate keyboard/mouse in the User VM. + +.. figure:: images/atkbdc-virt-hld.png + :align: center + :name: atkbdc-virt-arch + + AT keyboard controller emulation architecture + +PS2 keyboard emulation +********************** + +ACRN supports AT keyboard controller for PS2 keyboard that can be accessed through I/O ports(0x60 and 0x64). 0x60 is used to access AT keyboard controller data register, 0x64 is used to access AT keyboard controller address register. + +The PS2 keyboard ACPI description as below:: + + Device (KBD) + { + Name (_HID, EisaId ("PNP0303") /* IBM Enhanced Keyboard (101/102-key, PS/2 Mouse) */) // _HID: Hardware ID + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings + { + IO (Decode16, + 0x0060, // Range Minimum + 0x0060, // Range Maximum + 0x01, // Alignment + 0x01, // Length + ) + IO (Decode16, + 0x0064, // Range Minimum + 0x0064, // Range Maximum + 0x01, // Alignment + 0x01, // Length + ) + IRQNoFlags () + {1} + }) + } + +PS2 mouse emulation +******************* + +ACRN supports AT keyboard controller for PS2 mouse that can be accessed through I/O ports(0x60 and 0x64). +0x60 is used to access AT keyboard controller data register, 0x64 is used to access AT keyboard controller address register. + +The PS2 mouse ACPI description as below:: + + Device (MOU) + { + Name (_HID, EisaId ("PNP0F13") /* PS/2 Mouse */) // _HID: Hardware ID + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings + { + IO (Decode16, + 0x0060, // Range Minimum + 0x0060, // Range Maximum + 0x01, // Alignment + 0x01, // Length + ) + IO (Decode16, + 0x0064, // Range Minimum + 0x0064, // Range Maximum + 0x01, // Alignment + 0x01, // Length + ) + IRQNoFlags () + {12} + }) + } + diff --git a/doc/developer-guides/hld/hld-emulated-devices.rst b/doc/developer-guides/hld/hld-emulated-devices.rst index 5c5338205..d16c86f6d 100644 --- a/doc/developer-guides/hld/hld-emulated-devices.rst +++ b/doc/developer-guides/hld/hld-emulated-devices.rst @@ -20,3 +20,4 @@ documented in this section. UART emulation in hypervisor RTC emulation in hypervisor Hostbridge emulation + AT keyboard controller emulation diff --git a/doc/developer-guides/hld/images/atkbdc-virt-hld.png b/doc/developer-guides/hld/images/atkbdc-virt-hld.png new file mode 100755 index 000000000..4c54806db Binary files /dev/null and b/doc/developer-guides/hld/images/atkbdc-virt-hld.png differ