Newer
Older
AMI-Aptio-BIOS-Reversed / AmiModulePkg / KbcEmulation / KbcEmul / README.md
@Ajax Dong Ajax Dong 7 days ago 1 KB Recovering names

KbcEmul

Index: 0209
Size: 14,532 bytes (38C4h)
Phase: SMM (DXE_SMM_DRIVER)
Source Package: AmiModulePkg\KbcEmulation\KbcEmul

Overview

SMM-based Keyboard Controller (KBC) emulation driver. Emulates legacy PS/2 keyboard controller functionality (ports 0x60/0x64) from within SMM context on platforms that lack a physical KBC (e.g., Intel Purley server platforms). Traps IO accesses to the legacy KBC IO ports via SMI and provides emulated responses for keyboard, mouse, and AUX device commands. Includes a DXE counterpart (KbcEmulDxe) for boot-time initialization. Has a .reloc section for runtime relocation.

Key Functions

  • ModuleEntryPoint -- Main entry: calls KbcEmulInitialize, then KbcEmulRegisterPortEmulation for KBC emulation setup
  • KbcEmulInitialize (recovered from sub_4E8) -- UEFI driver init; caches ImageHandle/SystemTable and runtime context
  • KbcEmulRegisterPortEmulation (recovered from sub_628) -- Core KBC emulation: registers SMI I/O trap handlers for ports 0x60/0x64
  • KbcEmulContextNeedsSetup / KbcEmulCleanupContext / KbcEmulUnregisterPortTraps (recovered from sub_2C0 / sub_1F94 / sub_360) -- KBC emulation context and notification teardown callbacks
  • KbcEmulAssert (recovered from sub_2074) -- Debug ASSERT handler referencing AutoGen.c

Symbol Recovery Notes

  • Context variable: qword_31E8 was recovered as ModuleStatus.
  • Context handle: unk_30F0 was recovered as KbcEmulationContext.

Module Split

  • SMM runtime module in this folder: KbcEmul (KbcEmul.c + KbcEmul.h).
  • Boot-stage counterpart referenced by docs: KbcEmulDxe (outside this folder).

Protocols

  • EFI_SMM_SYSTEM_TABLE2 for SMM services
  • EFI_SMM_CPU_IO2 protocol for IO trap registration
  • EFI_SMM_BASE2_PROTOCOL
  • Legacy 8042/Keyboard controller emulation interfaces

Platform

HR650X (Purley), built from AmiModulePkg\KbcEmulation, DEBUG VS2015 X64