diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-13 16:59:33 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-13 16:59:33 -0400 |
commit | d9b9361f496d5a64a98bbf1335377a8b9573c818 (patch) | |
tree | ef91e225b6f3a9d6775bee35ea620349e2b5c565 | |
parent | 2a93cf52e5386eb1b3586565af6a06ade4d32a66 (diff) |
kernel/amd64: Add I8042_POLL kconf(9) option
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/arch/amd64/conf/GENERIC | 1 | ||||
-rw-r--r-- | sys/arch/amd64/isa/i8042.c | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index 95fe2e0..e407fa9 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -10,6 +10,7 @@ option SERIAL_DEBUG yes // Enable kmsg serial logging option USER_KMSG no // Show kmsg in user consoles option CPU_SMEP yes // Supervisor Memory Exec Protection option PANIC_SCR no // Clear screen on panic +option I8042_POLL yes // Use polling for the i8042 // Kernel constants setval SCHED_NQUEUE 4 // Number of scheduler queues (for MLFQ) diff --git a/sys/arch/amd64/isa/i8042.c b/sys/arch/amd64/isa/i8042.c index cde70ff..3ae645d 100644 --- a/sys/arch/amd64/isa/i8042.c +++ b/sys/arch/amd64/isa/i8042.c @@ -53,6 +53,13 @@ #include <string.h> #include <assert.h> +/* From kconf(9) */ +#if !defined(__I8042_POLL) +#define I8042_POLL 0 +#else +#define I8042_POLL __I8042_POLL +#endif + #define KEY_REP_MAX 2 #define pr_trace(fmt, ...) kprintf("i8042: " fmt, ##__VA_ARGS__) @@ -424,13 +431,20 @@ i8042_init(void) quirks |= I8042_HOSTILE; pr_trace("ThinkPad T420s detected, assuming hostile\n"); pr_trace("disabling irq 1, polling as fallback\n"); - spawn(&polltd, i8042_sync_loop, NULL, 0, NULL); } - if (!ISSET(quirks, I8042_HOSTILE)) { + /* + * If the i8042 has the hostile quirk or we are + * configured to poll for events, spawn the polling + * thread. + */ + if (!ISSET(quirks, I8042_HOSTILE) && !I8042_POLL) { /* Enable interrupts */ i8042_drain(); i8042_en_intr(); + } else if (ISSET(quirks, I8042_HOSTILE) || I8042_POLL) { + spawn(&polltd, i8042_sync_loop, NULL, 0, NULL); + pr_trace("polling events\n"); } i8042_write(I8042_CMD, I8042_ENABLE_PORT0); |