From f5c0ce4a292a41aeee7cca238ceffc66ed4b0de6 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sat, 14 May 2022 13:15:17 +0200 Subject: parisc/lasips2: Fix lasips2_kbd_in() to return early without input lasips2_kbd_in() is used to read input from an emulated PS/2 keyboard. Since there is no interrupt support durig PDC/IODC we need to poll the PS/2 status flags to see if a new key was pressed. In order to be able to poll regularily, exit the loop to read already pressed chars as soon as possible. This can be done by calling handle_16() with register ah = 0x11 to check if keys are queued up and exit if none are available. This patch fixes the problem that keys couldn't be read when using a graphical output (artist graphics). This patch fixes palo and other bootloaders to be able to use input from the emulated PS/2 keyboard. Signed-off-by: Helge Deller --- src/parisc/lasips2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/parisc/lasips2.c b/src/parisc/lasips2.c index 119c214..e86cbff 100644 --- a/src/parisc/lasips2.c +++ b/src/parisc/lasips2.c @@ -19,12 +19,19 @@ int lasips2_kbd_in(char *c, int max) struct bregs regs; volatile int count = 0; + // check if PS2 reported new keys, if so queue them up. while((readl(LASIPS2_KBD_STATUS) & LASIPS2_KBD_STATUS_RBNE)) { process_key(readb(LASIPS2_KBD_DATA)); } while(count < max) { - memset(®s, 0, sizeof(regs)); + // check if some key is queued up already + regs.ah = 0x11; + regs.flags = 0; + handle_16(®s); + if (regs.flags & F_ZF) // return if no key queued + break; + // read key from keyboard queue regs.ah = 0x10; handle_16(®s); if (!regs.ah) -- cgit v1.1