Re: How to create hard reboots through software

From: Jamie Lokier (lkd@tantalophile.demon.co.uk)
Date: Tue Feb 08 2000 - 06:56:47 EST


Robert Johannes wrote:
> In what situations would you use this code? When there's a system
> lockup?
>
> > main() {
> > ioperm(0x64,1,1);
> > while (1) outb(0xfe, 0x64);
> > }
> >
> > it basically outputs the value 0xFE to the KB controller at port 0x64 which
> > will perform a hardware bus reset.

It's the standard method for rebooting a PC. *But*, that's not
complete. That only waggles the reset line (after a long time), and not
always.

There's CMOS register 0x0f which tells the BIOS what kind of reboot to
do, as well as the 16 bit word at memory location 0x472. They exist
because you can do various levels of boot, right down to "very soft"
which is used for task switching on 286 boxes. Of course no-one here is
using a 286, but the system supports that kind of reset so it will run
old 286 software.

If you don't set those registers, who knows what kind of reboot you will
get.

You should also disable interrupts, including NMIs. Maybe the BIOS will
do this when it restarts, but maybe it won't. Maybe the hardware will
turn these things off when the keyboard controller waggles the reset
line, or maybe it won't.

Some 486 boards don't reset when you send 0xfe to the keyboard
controller. Actually, they do but not in Linux -- it is a mystery why
not. But anyway, they can be rebooted by code that simulates a
processor reset

A 386 can also be reset if you triple fault the processor. That shuts
down the processor and then the motherboard hardware detects that and
asserts the reset line. (But there's probably a board somewhere that
doesn't do that). That's actually faster than the keyboard controller
method on a 386.

Check out the code in arch/i386/kernel/process.c, machine_restart().

enjoy,
-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:12 EST