1227825Stheraven/*-
2227825Stheraven * Copyright (c) 1991 The Regents of the University of California.
3227825Stheraven * All rights reserved.
4227825Stheraven *
5227825Stheraven * This code is derived from software contributed to Berkeley by
6227825Stheraven * William Jolitz.
7227825Stheraven *
8227825Stheraven * Redistribution and use in source and binary forms, with or without
9227825Stheraven * modification, are permitted provided that the following conditions
10227825Stheraven * are met:
11227825Stheraven * 1. Redistributions of source code must retain the above copyright
12227825Stheraven *    notice, this list of conditions and the following disclaimer.
13227825Stheraven * 2. Redistributions in binary form must reproduce the above copyright
14227825Stheraven *    notice, this list of conditions and the following disclaimer in the
15227825Stheraven *    documentation and/or other materials provided with the distribution.
16227825Stheraven * 4. Neither the name of the University nor the names of its contributors
17227825Stheraven *    may be used to endorse or promote products derived from this software
18227825Stheraven *    without specific prior written permission.
19227825Stheraven *
20227825Stheraven * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21227825Stheraven * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22227825Stheraven * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23227825Stheraven * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24227825Stheraven * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25227825Stheraven * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26227825Stheraven * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27227825Stheraven * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28227825Stheraven * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29227825Stheraven * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30227825Stheraven * SUCH DAMAGE.
31262801Sdim *
32227825Stheraven *	from: @(#)isa.c	7.2 (Berkeley) 5/13/91
33227825Stheraven */
34227825Stheraven
35227825Stheraven#include <sys/cdefs.h>
36227825Stheraven__FBSDID("$FreeBSD$");
37227825Stheraven
38227825Stheraven#include <sys/types.h>
39227825Stheraven#include <sys/syslog.h>
40227825Stheraven#include <sys/systm.h>
41227825Stheraven
42227825Stheraven#include <machine/md_var.h>
43227825Stheraven
44227825Stheraven#define NMI_PARITY 0x04
45227825Stheraven#define NMI_EPARITY 0x02
46227825Stheraven
47227825Stheraven/*
48227825Stheraven * Handle a NMI, possibly a machine check.
49227825Stheraven * return true to panic system, false to ignore.
50227825Stheraven */
51227825Stheravenint
52227825Stheravenisa_nmi(int cd)
53227825Stheraven{
54227825Stheraven	int retval = 0;
55227825Stheraven 	int port = inb(0x33);
56227825Stheraven
57227825Stheraven	log(LOG_CRIT, "NMI PC98 port = %x\n", port);
58227825Stheraven	if (port & NMI_PARITY) {
59227825Stheraven		log(LOG_CRIT, "BASE RAM parity error, likely hardware failure.");
60227825Stheraven		retval = 1;
61227825Stheraven	} else if (port & NMI_EPARITY) {
62227825Stheraven		log(LOG_CRIT, "EXTENDED RAM parity error, likely hardware failure.");
63227825Stheraven		retval = 1;
64227825Stheraven	} else {
65227825Stheraven		log(LOG_CRIT, "\nNMI Resume ??\n");
66227825Stheraven	}
67227825Stheraven
68227825Stheraven	return(retval);
69227825Stheraven}
70227825Stheraven