2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* arch/i386/mach-generic/mach_reboot.h
|
|
|
|
*
|
|
|
|
* Machine specific reboot functions for generic.
|
|
|
|
* Split out from reboot.c by Osamu Tomita <tomita@cinet.co.jp>
|
|
|
|
*/
|
|
|
|
#ifndef _MACH_REBOOT_H
|
|
|
|
#define _MACH_REBOOT_H
|
|
|
|
|
|
|
|
static inline void kb_wait(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 0x10000; i++)
|
|
|
|
if ((inb_p(0x64) & 0x02) == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void mach_reboot(void)
|
|
|
|
{
|
|
|
|
int i;
|
2007-07-21 09:10:38 -06:00
|
|
|
|
|
|
|
/* old method, works on most machines */
|
2005-11-05 09:25:54 -07:00
|
|
|
for (i = 0; i < 10; i++) {
|
2007-07-21 09:10:38 -06:00
|
|
|
kb_wait();
|
|
|
|
udelay(50);
|
|
|
|
outb(0xfe, 0x64); /* pulse reset low */
|
|
|
|
udelay(50);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* New method: sets the "System flag" which, when set, indicates
|
|
|
|
* successful completion of the keyboard controller self-test (Basic
|
|
|
|
* Assurance Test, BAT). This is needed for some machines with no
|
|
|
|
* keyboard plugged in. This read-modify-write sequence sets only the
|
|
|
|
* system flag
|
|
|
|
*/
|
|
|
|
for (i = 0; i < 10; i++) {
|
|
|
|
int cmd;
|
|
|
|
|
|
|
|
outb(0x20, 0x64); /* read Controller Command Byte */
|
|
|
|
udelay(50);
|
|
|
|
kb_wait();
|
|
|
|
udelay(50);
|
|
|
|
cmd = inb(0x60);
|
|
|
|
udelay(50);
|
2005-04-16 16:20:36 -06:00
|
|
|
kb_wait();
|
|
|
|
udelay(50);
|
2005-09-09 14:02:18 -06:00
|
|
|
outb(0x60, 0x64); /* write Controller Command Byte */
|
|
|
|
udelay(50);
|
|
|
|
kb_wait();
|
|
|
|
udelay(50);
|
x86: fix reboot with no keyboard attached
Attempt to fix http://bugzilla.kernel.org/show_bug.cgi?id=8378
Hiroto Shibuya wrote to tell me that he has a VIA EPIA-EK10000 which
suffers from the reboot problem when no keyboard is attached. My first
patch works for him:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=59f4e7d572980a521b7bdba74ab71b21f5995538
But the latest patch does not work for him :
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b93789808756bcc1e5c90c99f1b1ef52f839a51
We found that it was necessary to also set the "disable keyboard" flag in
the command byte, as the first patch was doing. The second patch tries to
minimally modify the command byte, but it is not enough.
Please consider this simple one-line patch to help people with low end VIA
motherboards reboot when no keyboard is attached. Hiroto Shibuya has
verified that this works for him (as I no longer have an afflicted
machine).
Additional discussion:
Note that original patch from Truxton DOES
disable keyboard and this has been in main tree since 2.6.14, thus it must have
quite a bit of air time already.
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.14.y.git;a=commit;h=59f4e7d572980a521b7bdba74ab71b21f5995538
Note that he only mention "System flag" in the description and comment, but
in the code, "disable keyboard" flag is set.
outb(0x14, 0x60); /* set "System flag" */
In 2.6.23, he made a change to read the current byte and then mask the flags,
but along this change, he only set the "System flag" and dropped the setting
of "disable keyboard" flag.
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.23.y.git;a=commit;h=8b93789808756bcc1e5c90c99f1b1ef52f839a51
outb(cmd | 0x04, 0x60); /* set "System flag" */
So my request is to restore the setting of disable keyboard flag which has been
there since 2.6.14 but disappeared in 2.6.23.
Cc: Lee Garrett <lee-in-berlin@web.de>
Cc: "Hiroto Shibuya" <hiroto.shibuya@gmail.com>
Cc: Natalie Protasevich <protasnb@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Aristeu Rozanski <aris@ruivo.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2007-11-17 08:27:01 -07:00
|
|
|
outb(cmd | 0x14, 0x60); /* set "System flag" and "Keyboard Disabled" */
|
2005-09-09 14:02:18 -06:00
|
|
|
udelay(50);
|
|
|
|
kb_wait();
|
|
|
|
udelay(50);
|
|
|
|
outb(0xfe, 0x64); /* pulse reset low */
|
2005-04-16 16:20:36 -06:00
|
|
|
udelay(50);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !_MACH_REBOOT_H */
|