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

@ -50,6 +50,7 @@
#include <uacpi/utilities.h>
#include <uacpi/namespace.h>
#include <uacpi/resources.h>
#include "gmmos/gmmos.h"
// Each step said before it is taken, in a verbose boot: a machine that stops
// here stops with the step it was on as the last line on the screen.
@ -653,6 +654,30 @@ i2c_hid_main(void *arg)
}
}
// For GMMOS. Read without a lock: `ndev` only ever grows, and only before the
// polling loop starts, so a panic sees a list that was finished or not begun.
int
i2c_hid_keyboards(struct gmmos_i2c_kbd *out, int max)
{
int i, n = 0;
for(i = 0; i < ndev && n < max; i++){
struct i2chid *d = &devs[i];
if(!hid_is_keyboard(d->hid))
continue;
out[n].regs = d->c->regs;
out[n].txdepth = d->c->txdepth;
out[n].rxdepth = d->c->rxdepth;
out[n].addr = d->addr;
out[n].maxin = d->maxin;
out[n].pin = d->pin;
out[n].active_low = d->active_low;
out[n].hid = d->hid;
n++;
}
return n;
}
static void
i2c_hid_thread(void)
{