GMMOS: I2C keyboards, and every keyboard at once

The second micro driver: i2c_hid.c with everything but reading a
keyboard's input reports taken out. No ACPI -- AML cannot run on a dead
kernel -- so the live driver hands over what it found at boot
(i2c_hid_keyboards): the DesignWare controller, the address, the report
size, the AMD GPIO pin if there is one, and the parsed report descriptor.
No power commands, no reset, a read-only transfer.

usb_hid.c's report-protocol rewrite is split out as hid_boot_report(),
which does nothing but rewrite, and kernel/gmmos/hidkeys.c turns boot
reports into keys for this and the USB micro drivers to come.

GMMOS now probes every micro driver and polls all that answer.

Not run: QEMU has no DesignWare I2C, and the laptops at hand have PS/2
keyboards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
Nexoniarz 2026-10-25 01:15:50 +02:00
commit c6d90e69fa
8 changed files with 387 additions and 17 deletions

View file

@ -12,6 +12,13 @@ void *hid_attach(const uchar *desc, int n, const char *what);
// One input report, report ID included when the device uses them.
void hid_attached_input(void *h, const uchar *rep, int len);
// For GMMOS, after a panic: whether a device is a keyboard, and one of its
// reports rewritten into the 8-byte boot layout (modifiers, reserved, six
// usages) with nothing else done -- no queue, no lock, no events. 0 when the
// report was not a keyboard's.
int hid_is_keyboard(void *h);
int hid_boot_report(void *h, const uchar *rep, int len, uchar *boot);
// I2C-HID: the touchpads (and some keyboards) of laptops. Started once ACPI
// and kernel threads are up; see kernel/drivers/i2c/i2c_hid.c.
void i2c_hid_start(void);