Re: Why reassert ix86 NMI?

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Tue Jun 06 2000 - 08:25:02 EST


On Tue, 6 Jun 2000, Maciej W. Rozycki wrote:

> On Tue, 6 Jun 2000, Keith Owens wrote:
>
> > At the end of do_nmi are these instructions
> >
> > outb(0x8f, 0x70);
> > inb(0x71); /* dummy */
> > outb(0x0f, 0x70);
> > inb(0x71); /* dummy */
> >
> > If the NMI is for the watchdog, these instructions are bypassed.
> >
> > (1) Why do we need these instructions?
[SNIPPED...]
>
> Bit 7 of a port at 0x70 controls the gate that interfaces to the CPU's
> NMI line. By disabling and then enabling the gate we regenerate an NMI
> edge if it is active. Otherwise it's a nop. We will not recurse into the
> NMI handler forever because the CPU disables further NMIs upon receiving
> one until an iret instruction is executed.
>
[SNIPPED...]

The reads (marked dummy) of the CMOS data port don't do anything useful
because there is already a long delay caused by the two index selections.

Leaving the CMOS index at 0x0f (the shutdown-byte offset) is not a
really good idea. A power-failure can (read will) corrupt the byte
at which the index is pointing. The result may be that upon subsequent
boot, you may have to manually boot because the BIOS can get confused if
the shutdown byte was any of the 'return-from-protected' mode bytes and it
wasn't really what happened.

The de-facto standard is to leave the index at 0 so only the seconds-count
can get corrupted. Since we don't know the maximum offset available
in a particular machine, we can't otherwise find a safe place to leave
it.

If anybody is modifying the existing software in that file, I suggest:

         outb(0x80, 0x70); /* Wiggle NMI enable bit */
         outb(0x00, 0x70);

Cheers,
Dick Johnson

Penguin : Linux version 2.3.41 on an i686 machine (800.63 BogoMips).

-
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 : Wed Jun 07 2000 - 21:00:25 EST