Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Sep 1998 10:17:25 -0600
From:      Steve Passe <smp@csn.net>
To:        freebsd-current@FreeBSD.ORG
Subject:   recocking NMIs
Message-ID:  <199809101617.KAA05181@Ilsa.StevesCafe.com>

next in thread | raw e-mail | index | archive | help
Hi,

A while back I reported that NMIs weren't properly reset in the kernel.
I promised to send a patch, but never got around to it.  While getting
the thread patch I just sent, I stumbled across it.  I use it in an LKM,
which is proprietary code, so I can just submit the relevant chunk,
someone else will have to integrate it into the kernel.

The basic problem is that the first firing of the NMI leaves its input
latched, preventing further NMIs till its cleared.

The NMI_EDGE thingy is to allow multiple simultanious NMIs.
Note that I could NOT get the NMI_EDGE part to work on our hardware.

Note that this code is specific for NMIs coming from the ISA bus, ie NOT
from the MB sources (watchdog and parity error).  A comment marks the point
needing additional work for this.

When researching this issue I found at least 4 different descriptions
of how NMI is handled by the motherboard, most incompatable with the rest.
I suspect that they all were true for one MB or another.  The following
is based on the implimentation as defined by the PIIX chip, so it should
work on most modern MBs.

---
#define NMI_CREATE_EDGE_NOT

	/* diddle the IOCHK# NMI registers */
	inb	$0x61, %al		/* current PORT-B contents */
	/* XXX:	 need to test source bits, assume IOCHK# for now... */
	andb	$0x0f, %al		/* PIIX wants upper bits 0 on write */
	orb	$0x08, %al		/* IOCHK# high to clear */
	outb	%al, $0x61
	andb	$0x07, %al		/* IOCHK# low to enable */
	outb	%al, $0x61

#ifdef NMI_CREATE_EDGE
	/*
	 * If another NMI source fired while we run this code the
	 * line is held active by that card and the signal is 'lost'.
	 * So we disable/enable NMIs to re-create missing edge.
	 */
	inb	$0x70, %al		/* get NMI/RTC register */
	orb	$0x80, %al		/* disable NMIs */
	outb	%al, $0x70
	andb	$0x7f, %al		/* re-enable NMIs */
	outb	%al, $0x70
#endif /* NMI_CREATE_EDGE */

--
Steve Passe	| powered by 
smp@csn.net	|            Symmetric MultiProcessor FreeBSD



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809101617.KAA05181>