mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: linux-kernel@vger.kernel.org
Cc: akpm@digeo.com
Subject: [PATCH] Eat keys on panic
Date: Sat, 31 May 2003 13:56:53 +0200	[thread overview]
Message-ID: <20030531115653.GA11119@wotan.suse.de> (raw)

[forgot to cc linux-kernel with the other mail]

I have a weird KVM that refuses to switch consoles when the keyboard
controller doesn't process key presses. Actually it switches, but only
after a long delay which usually drives me crazy.

This patch changes the panic loop to eat keys from the keyboard controller
on i386 boxes. With that I can switch consoles after a panic.

The ioport should be available on all PC like boxes, the reset code also
depends on it being at a fixed place.

ioport.c is not the best place in the world to place the function,
but I didn't find a better one. It cannot be inlined to avoid include
hell.

-Andi

Index: linux/arch/i386/kernel/ioport.c
===================================================================
RCS file: /home/cvs/linux-2.5/arch/i386/kernel/ioport.c,v
retrieving revision 1.17
diff -u -u -r1.17 ioport.c
--- linux/arch/i386/kernel/ioport.c	30 May 2003 20:12:29 -0000	1.17
+++ linux/arch/i386/kernel/ioport.c	31 May 2003 10:24:18 -0000
@@ -15,6 +15,7 @@
 #include <linux/stddef.h>
 #include <linux/slab.h>
 #include <linux/thread_info.h>
+#include <asm/io.h>
 
 /* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
 static void set_bitmap(unsigned long *bitmap, short base, short extent, int new_value)
@@ -128,4 +129,10 @@
 	/* Make sure we return the long way (not sysenter) */
 	set_thread_flag(TIF_IRET);
 	return 0;
+}
+
+void eat_key(void)
+{
+        if (inb(0x60) & 1) 
+                inb(0x64);
 }
Index: linux/include/asm-i386/system.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/asm-i386/system.h,v
retrieving revision 1.37
diff -u -u -r1.37 system.h
--- linux/include/asm-i386/system.h	30 May 2003 20:10:39 -0000	1.37
+++ linux/include/asm-i386/system.h	31 May 2003 10:24:24 -0000
@@ -476,4 +476,7 @@
 #define BROKEN_PNP_BIOS		0x0004
 #define BROKEN_CPUFREQ		0x0008
 
+#define HAVE_EAT_KEY
+void eat_key(void);
+
 #endif
Index: linux/kernel/panic.c
===================================================================
RCS file: /home/cvs/linux-2.5/kernel/panic.c,v
retrieving revision 1.20
diff -u -u -r1.20 panic.c
--- linux/kernel/panic.c	30 May 2003 20:14:20 -0000	1.20
+++ linux/kernel/panic.c	31 May 2003 10:24:26 -0000
@@ -96,8 +96,11 @@
         disabled_wait(caller);
 #endif
 	local_irq_enable();
-	for (;;)
-		;
+	for (;;) { 
+#ifdef HAVE_EAT_KEY
+		eat_key();
+#endif
+	} 
 }
 
 /**

             reply	other threads:[~2003-05-31 11:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-31 11:56 Andi Kleen [this message]
2003-05-31 14:14 ` Alan Cox
2003-05-31 15:45   ` Andi Kleen
2003-05-31 15:58     ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030531115653.GA11119@wotan.suse.de \
    --to=ak@suse.de \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®