From 87cf68272394d5f8607f09b8fa5b30af2901b1b4 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 1 Feb 2011 22:32:52 +0800 Subject: [PATCH] pc32: Split out isa_intr.h and move isa/intr_machdep.h to include/ --- sys/platform/pc32/apic/apic_abi.c | 2 +- sys/platform/pc32/apic/apic_vector.s | 2 +- sys/platform/pc32/apic/mpapic.c | 2 +- sys/platform/pc32/conf/files | 2 +- sys/platform/pc32/i386/identcpu.c | 3 +- sys/platform/pc32/i386/machdep.c | 3 +- sys/platform/pc32/i386/mp_machdep.c | 4 +- sys/platform/pc32/i386/nexus.c | 1 - sys/platform/pc32/i386/trap.c | 3 +- sys/platform/pc32/icu/icu.c | 2 +- sys/platform/pc32/icu/icu_abi.c | 2 +- sys/platform/pc32/include/intr_machdep.h | 160 +++++++++++++++++++++++++++++ sys/platform/pc32/isa/clock.c | 2 +- sys/platform/pc32/isa/intr_machdep.c | 130 ------------------------ sys/platform/pc32/isa/intr_machdep.h | 163 ------------------------------ sys/platform/pc32/isa/isa_intr.c | 130 ++++++++++++++++++++++++ sys/platform/pc32/isa/isa_intr.h | 43 ++++++++ sys/platform/pc32/isa/npx.c | 2 +- 18 files changed, 348 insertions(+), 308 deletions(-) create mode 100644 sys/platform/pc32/include/intr_machdep.h delete mode 100644 sys/platform/pc32/isa/intr_machdep.c delete mode 100644 sys/platform/pc32/isa/intr_machdep.h create mode 100644 sys/platform/pc32/isa/isa_intr.c create mode 100644 sys/platform/pc32/isa/isa_intr.h diff --git a/sys/platform/pc32/apic/apic_abi.c b/sys/platform/pc32/apic/apic_abi.c index 332595e..68d79d0 100644 --- a/sys/platform/pc32/apic/apic_abi.c +++ b/sys/platform/pc32/apic/apic_abi.c @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include diff --git a/sys/platform/pc32/apic/apic_vector.s b/sys/platform/pc32/apic/apic_vector.s index de515db..c571d30 100644 --- a/sys/platform/pc32/apic/apic_vector.s +++ b/sys/platform/pc32/apic/apic_vector.s @@ -18,7 +18,7 @@ #include "apicreg.h" #include "apic_ipl.h" #include -#include +#include /* convert an absolute IRQ# into bitmask */ #define IRQ_LBIT(irq_num) (1 << ((irq_num) & 0x1f)) diff --git a/sys/platform/pc32/apic/mpapic.c b/sys/platform/pc32/apic/mpapic.c index f7c3f5d..488dce2 100644 --- a/sys/platform/pc32/apic/mpapic.c +++ b/sys/platform/pc32/apic/mpapic.c @@ -37,7 +37,7 @@ #include #include -#include /* Xspuriousint() */ +#include /* XXX */ extern pt_entry_t *SMPpt; diff --git a/sys/platform/pc32/conf/files b/sys/platform/pc32/conf/files index d6b1321..64a6586 100644 --- a/sys/platform/pc32/conf/files +++ b/sys/platform/pc32/conf/files @@ -235,7 +235,7 @@ dev/netif/el/if_el.c optional el dev/netif/le/if_le.c optional le dev/netif/rdp/if_rdp.c optional nowerror rdp dev/netif/wl/if_wl.c optional wl -platform/pc32/isa/intr_machdep.c standard +platform/pc32/isa/isa_intr.c standard bus/isa/i386/isa.c optional isa bus/isa/i386/isa_compat.c optional nowerror isa compat_oldisa bus/isa/i386/isa_dma.c optional isa diff --git a/sys/platform/pc32/i386/identcpu.c b/sys/platform/pc32/i386/identcpu.c index 9d90e37..ea8a6d9 100644 --- a/sys/platform/pc32/i386/identcpu.c +++ b/sys/platform/pc32/i386/identcpu.c @@ -52,8 +52,7 @@ #include #include #include - -#include +#include #define IDENTBLUE_CYRIX486 0 #define IDENTBLUE_IBMCPU 1 diff --git a/sys/platform/pc32/i386/machdep.c b/sys/platform/pc32/i386/machdep.c index eb9cc66..df36dcb 100644 --- a/sys/platform/pc32/i386/machdep.c +++ b/sys/platform/pc32/i386/machdep.c @@ -106,11 +106,12 @@ #include #endif #include +#include #ifdef OLD_BUS_ARCH #include #endif -#include +#include #include #include #include diff --git a/sys/platform/pc32/i386/mp_machdep.c b/sys/platform/pc32/i386/mp_machdep.c index 24ec767..a4f85ad 100644 --- a/sys/platform/pc32/i386/mp_machdep.c +++ b/sys/platform/pc32/i386/mp_machdep.c @@ -65,8 +65,8 @@ #include #include /* setidt() */ -#include /* IPIs */ -#include /* IPIs */ +#include /* IPIs */ +#include /* IPIs */ #define FIXUP_EXTRA_APIC_INTS 8 /* additional entries we may create */ diff --git a/sys/platform/pc32/i386/nexus.c b/sys/platform/pc32/i386/nexus.c index 49d1cfd..765fedc 100644 --- a/sys/platform/pc32/i386/nexus.c +++ b/sys/platform/pc32/i386/nexus.c @@ -57,7 +57,6 @@ #include #include #include -#include #include #include diff --git a/sys/platform/pc32/i386/trap.c b/sys/platform/pc32/i386/trap.c index 18ed5e2..1e51fbd 100644 --- a/sys/platform/pc32/i386/trap.c +++ b/sys/platform/pc32/i386/trap.c @@ -92,8 +92,9 @@ #include #include #include +#include -#include +#include #ifdef POWERFAIL_NMI #include diff --git a/sys/platform/pc32/icu/icu.c b/sys/platform/pc32/icu/icu.c index 56a6bd4..e302907 100644 --- a/sys/platform/pc32/icu/icu.c +++ b/sys/platform/pc32/icu/icu.c @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include diff --git a/sys/platform/pc32/icu/icu_abi.c b/sys/platform/pc32/icu/icu_abi.c index 024737c..3953c5c 100644 --- a/sys/platform/pc32/icu/icu_abi.c +++ b/sys/platform/pc32/icu/icu_abi.c @@ -48,7 +48,7 @@ #include #include -#include +#include #include #include diff --git a/sys/platform/pc32/include/intr_machdep.h b/sys/platform/pc32/include/intr_machdep.h new file mode 100644 index 0000000..2f03813 --- /dev/null +++ b/sys/platform/pc32/include/intr_machdep.h @@ -0,0 +1,160 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/isa/intr_machdep.h,v 1.19.2.2 2001/10/14 20:05:50 luigi Exp $ + * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.h,v 1.25 2006/10/23 21:50:31 dillon Exp $ + */ + +#ifndef _ARCH_ISA_INTR_MACHDEP_H_ +#define _ARCH_ISA_INTR_MACHDEP_H_ + +#ifndef LOCORE +#ifndef _SYS_TYPES_H_ +#include +#endif +#endif + +/* + * Low level interrupt code. + */ + +#ifdef _KERNEL + +#define IDT_OFFSET 0x20 +#define IDT_OFFSET_SYSCALL 0x80 +#define IDT_OFFSET_IPI 0xe0 + +#if defined(SMP) + +/* + * Local APIC TPR priority vector levels: + * + * 0xff (255) +-------------+ + * | | 15 (IPIs: Xcpustop, Xspuriousint) + * 0xf0 (240) +-------------+ + * | | 14 (IPIs: Xinvltlb, Xipiq, Xtimer) + * 0xe0 (224) +-------------+ + * | | 13 + * 0xd0 (208) +-------------+ + * | | 12 + * 0xc0 (192) +-------------+ + * | | 11 + * 0xb0 (176) +-------------+ + * | | 10 + * 0xa0 (160) +-------------+ + * | | 9 + * 0x90 (144) +-------------+ + * | | 8 (syscall at 0x80) + * 0x80 (128) +-------------+ + * | | 7 + * 0x70 (112) +-------------+ + * | | 6 + * 0x60 (96) +-------------+ + * | | 5 + * 0x50 (80) +-------------+ + * | | 4 + * 0x40 (64) +-------------+ + * | | 3 + * 0x30 (48) +-------------+ + * | | 2 (hardware INTs) + * 0x20 (32) +-------------+ + * | | 1 (exceptions, traps, etc.) + * 0x10 (16) +-------------+ + * | | 0 (exceptions, traps, etc.) + * 0x00 (0) +-------------+ + */ +#define TPR_STEP 0x10 + +/* Local APIC Task Priority Register */ +#define TPR_IPI (IDT_OFFSET_IPI - 1) + + +/* + * IPI group1 + */ +#define IDT_OFFSET_IPIG1 IDT_OFFSET_IPI + +/* TLB shootdowns */ +#define XINVLTLB_OFFSET (IDT_OFFSET_IPIG1 + 0) + +/* IPI group1 1: unused (was inter-cpu clock handling) */ +/* IPI group1 2: unused (was inter-cpu rendezvous) */ + +/* IPIQ */ +#define XIPIQ_OFFSET (IDT_OFFSET_IPIG1 + 3) + +/* Local APIC TIMER */ +#define XTIMER_OFFSET (IDT_OFFSET_IPIG1 + 4) + +/* IPI group1 5 ~ 15: unused */ + + +/* + * IPI group2 + */ +#define IDT_OFFSET_IPIG2 (IDT_OFFSET_IPIG1 + TPR_STEP) + +/* IPI to signal CPUs to stop and wait for another CPU to restart them */ +#define XCPUSTOP_OFFSET (IDT_OFFSET_IPIG2 + 0) + +/* IPI group2 1 ~ 14: unused */ + +/* NOTE: this vector MUST be xxxx1111 */ +#define XSPURIOUSINT_OFFSET (IDT_OFFSET_IPIG2 + 15) + +#endif /* SMP */ + +#ifndef LOCORE + +/* + * Type of the first (asm) part of an interrupt handler. + */ +typedef void inthand_t(u_int cs, u_int ef, u_int esp, u_int ss); + +#define IDTVEC(name) __CONCAT(X,name) + +#if defined(SMP) +inthand_t + Xinvltlb, /* TLB shootdowns */ + Xcpuast, /* Additional software trap on other cpu */ + Xforward_irq, /* Forward irq to cpu holding ISR lock */ + Xcpustop, /* CPU stops & waits for another CPU to restart it */ + Xspuriousint, /* handle APIC "spurious INTs" */ + Xtimer, /* handle LAPIC timer INT */ + Xipiq; /* handle lwkt_send_ipiq() requests */ +#endif /* SMP */ + +#endif /* LOCORE */ + +#endif /* _KERNEL */ + +#endif /* !_ARCH_ISA_INTR_MACHDEP_H_ */ diff --git a/sys/platform/pc32/isa/clock.c b/sys/platform/pc32/isa/clock.c index 4d04d55..71434a2 100644 --- a/sys/platform/pc32/isa/clock.c +++ b/sys/platform/pc32/isa/clock.c @@ -87,7 +87,7 @@ #include #include -#include +#include #ifdef SMP /* APIC-IO */ /* The interrupt triggered by the 8254 (timer) chip */ diff --git a/sys/platform/pc32/isa/intr_machdep.c b/sys/platform/pc32/isa/intr_machdep.c deleted file mode 100644 index b168176..0000000 --- a/sys/platform/pc32/isa/intr_machdep.c +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $FreeBSD: src/sys/i386/isa/intr_machdep.c,v 1.29.2.5 2001/10/14 06:54:27 luigi Exp $ - * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.c,v 1.48 2008/08/02 01:14:43 dillon Exp $ - */ -/* - * This file contains an aggregated module marked: - * Copyright (c) 1997, Stefan Esser - * All rights reserved. - * See the notice for details. - */ - -#include "use_isa.h" - -#include -#include -#include -#include -#include - -#include -#include - -#define NMI_PARITY (1 << 7) -#define NMI_IOCHAN (1 << 6) -#define ENMI_WATCHDOG (1 << 7) -#define ENMI_BUSTIMER (1 << 6) -#define ENMI_IOSTATUS (1 << 5) - -/* - * Handle a NMI, possibly a machine check. - * return true to panic system, false to ignore. - */ -int -isa_nmi(int cd) -{ - int retval = 0; - int isa_port = inb(0x61); - int eisa_port = inb(0x461); - - log(LOG_CRIT, "NMI ISA %x, EISA %x\n", isa_port, eisa_port); - - if (isa_port & NMI_PARITY) { - log(LOG_CRIT, "RAM parity error, likely hardware failure."); - retval = 1; - } - - if (isa_port & NMI_IOCHAN) { - log(LOG_CRIT, "I/O channel check, likely hardware failure."); - retval = 1; - } - - /* - * On a real EISA machine, this will never happen. However it can - * happen on ISA machines which implement XT style floating point - * error handling (very rare). Save them from a meaningless panic. - */ - if (eisa_port == 0xff) - return(retval); - - if (eisa_port & ENMI_WATCHDOG) { - log(LOG_CRIT, "EISA watchdog timer expired, likely hardware failure."); - retval = 1; - } - - if (eisa_port & ENMI_BUSTIMER) { - log(LOG_CRIT, "EISA bus timeout, likely hardware failure."); - retval = 1; - } - - if (eisa_port & ENMI_IOSTATUS) { - log(LOG_CRIT, "EISA I/O port status error."); - retval = 1; - } - return(retval); -} - -/* - * Fill in default interrupt table (in case of spurious interrupt - * during configuration of kernel, setup interrupt control unit - */ -void -isa_defaultirq(void) -{ - icu_definit(); -} - -#if NISA > 0 - -intrmask_t -isa_irq_pending(void) -{ - return icu_irq_pending(); -} - -#endif diff --git a/sys/platform/pc32/isa/intr_machdep.h b/sys/platform/pc32/isa/intr_machdep.h deleted file mode 100644 index 69d0d44..0000000 --- a/sys/platform/pc32/isa/intr_machdep.h +++ /dev/null @@ -1,163 +0,0 @@ -/*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/i386/isa/intr_machdep.h,v 1.19.2.2 2001/10/14 20:05:50 luigi Exp $ - * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.h,v 1.25 2006/10/23 21:50:31 dillon Exp $ - */ - -#ifndef _ARCH_ISA_INTR_MACHDEP_H_ -#define _ARCH_ISA_INTR_MACHDEP_H_ - -#ifndef LOCORE -#ifndef _SYS_TYPES_H_ -#include -#endif -#endif - -/* - * Low level interrupt code. - */ - -#ifdef _KERNEL - -#define IDT_OFFSET 0x20 -#define IDT_OFFSET_SYSCALL 0x80 -#define IDT_OFFSET_IPI 0xe0 - -#if defined(SMP) - -/* - * Local APIC TPR priority vector levels: - * - * 0xff (255) +-------------+ - * | | 15 (IPIs: Xcpustop, Xspuriousint) - * 0xf0 (240) +-------------+ - * | | 14 (IPIs: Xinvltlb, Xipiq, Xtimer) - * 0xe0 (224) +-------------+ - * | | 13 - * 0xd0 (208) +-------------+ - * | | 12 - * 0xc0 (192) +-------------+ - * | | 11 - * 0xb0 (176) +-------------+ - * | | 10 - * 0xa0 (160) +-------------+ - * | | 9 - * 0x90 (144) +-------------+ - * | | 8 (syscall at 0x80) - * 0x80 (128) +-------------+ - * | | 7 - * 0x70 (112) +-------------+ - * | | 6 - * 0x60 (96) +-------------+ - * | | 5 - * 0x50 (80) +-------------+ - * | | 4 - * 0x40 (64) +-------------+ - * | | 3 - * 0x30 (48) +-------------+ - * | | 2 (hardware INTs) - * 0x20 (32) +-------------+ - * | | 1 (exceptions, traps, etc.) - * 0x10 (16) +-------------+ - * | | 0 (exceptions, traps, etc.) - * 0x00 (0) +-------------+ - */ -#define TPR_STEP 0x10 - -/* Local APIC Task Priority Register */ -#define TPR_IPI (IDT_OFFSET_IPI - 1) - - -/* - * IPI group1 - */ -#define IDT_OFFSET_IPIG1 IDT_OFFSET_IPI - -/* TLB shootdowns */ -#define XINVLTLB_OFFSET (IDT_OFFSET_IPIG1 + 0) - -/* IPI group1 1: unused (was inter-cpu clock handling) */ -/* IPI group1 2: unused (was inter-cpu rendezvous) */ - -/* IPIQ */ -#define XIPIQ_OFFSET (IDT_OFFSET_IPIG1 + 3) - -/* Local APIC TIMER */ -#define XTIMER_OFFSET (IDT_OFFSET_IPIG1 + 4) - -/* IPI group1 5 ~ 15: unused */ - - -/* - * IPI group2 - */ -#define IDT_OFFSET_IPIG2 (IDT_OFFSET_IPIG1 + TPR_STEP) - -/* IPI to signal CPUs to stop and wait for another CPU to restart them */ -#define XCPUSTOP_OFFSET (IDT_OFFSET_IPIG2 + 0) - -/* IPI group2 1 ~ 14: unused */ - -/* NOTE: this vector MUST be xxxx1111 */ -#define XSPURIOUSINT_OFFSET (IDT_OFFSET_IPIG2 + 15) - -#endif /* SMP */ - -#ifndef LOCORE - -/* - * Type of the first (asm) part of an interrupt handler. - */ -typedef void inthand_t(u_int cs, u_int ef, u_int esp, u_int ss); - -#define IDTVEC(name) __CONCAT(X,name) - -#if defined(SMP) -inthand_t - Xinvltlb, /* TLB shootdowns */ - Xcpuast, /* Additional software trap on other cpu */ - Xforward_irq, /* Forward irq to cpu holding ISR lock */ - Xcpustop, /* CPU stops & waits for another CPU to restart it */ - Xspuriousint, /* handle APIC "spurious INTs" */ - Xtimer, /* handle LAPIC timer INT */ - Xipiq; /* handle lwkt_send_ipiq() requests */ -#endif /* SMP */ - -void isa_defaultirq(void); -int isa_nmi(int); - -#endif /* LOCORE */ - -#endif /* _KERNEL */ - -#endif /* !_ARCH_ISA_INTR_MACHDEP_H_ */ diff --git a/sys/platform/pc32/isa/isa_intr.c b/sys/platform/pc32/isa/isa_intr.c new file mode 100644 index 0000000..04fb58d --- /dev/null +++ b/sys/platform/pc32/isa/isa_intr.c @@ -0,0 +1,130 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 + * $FreeBSD: src/sys/i386/isa/intr_machdep.c,v 1.29.2.5 2001/10/14 06:54:27 luigi Exp $ + * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.c,v 1.48 2008/08/02 01:14:43 dillon Exp $ + */ +/* + * This file contains an aggregated module marked: + * Copyright (c) 1997, Stefan Esser + * All rights reserved. + * See the notice for details. + */ + +#include "use_isa.h" + +#include +#include +#include +#include +#include + +#include +#include + +#define NMI_PARITY (1 << 7) +#define NMI_IOCHAN (1 << 6) +#define ENMI_WATCHDOG (1 << 7) +#define ENMI_BUSTIMER (1 << 6) +#define ENMI_IOSTATUS (1 << 5) + +/* + * Handle a NMI, possibly a machine check. + * return true to panic system, false to ignore. + */ +int +isa_nmi(int cd) +{ + int retval = 0; + int isa_port = inb(0x61); + int eisa_port = inb(0x461); + + log(LOG_CRIT, "NMI ISA %x, EISA %x\n", isa_port, eisa_port); + + if (isa_port & NMI_PARITY) { + log(LOG_CRIT, "RAM parity error, likely hardware failure."); + retval = 1; + } + + if (isa_port & NMI_IOCHAN) { + log(LOG_CRIT, "I/O channel check, likely hardware failure."); + retval = 1; + } + + /* + * On a real EISA machine, this will never happen. However it can + * happen on ISA machines which implement XT style floating point + * error handling (very rare). Save them from a meaningless panic. + */ + if (eisa_port == 0xff) + return(retval); + + if (eisa_port & ENMI_WATCHDOG) { + log(LOG_CRIT, "EISA watchdog timer expired, likely hardware failure."); + retval = 1; + } + + if (eisa_port & ENMI_BUSTIMER) { + log(LOG_CRIT, "EISA bus timeout, likely hardware failure."); + retval = 1; + } + + if (eisa_port & ENMI_IOSTATUS) { + log(LOG_CRIT, "EISA I/O port status error."); + retval = 1; + } + return(retval); +} + +/* + * Fill in default interrupt table (in case of spurious interrupt + * during configuration of kernel, setup interrupt control unit + */ +void +isa_defaultirq(void) +{ + icu_definit(); +} + +#if NISA > 0 + +intrmask_t +isa_irq_pending(void) +{ + return icu_irq_pending(); +} + +#endif diff --git a/sys/platform/pc32/isa/isa_intr.h b/sys/platform/pc32/isa/isa_intr.h new file mode 100644 index 0000000..d587572 --- /dev/null +++ b/sys/platform/pc32/isa/isa_intr.h @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/isa/intr_machdep.h,v 1.19.2.2 2001/10/14 20:05:50 luigi Exp $ + * $DragonFly: src/sys/platform/pc32/isa/intr_machdep.h,v 1.25 2006/10/23 21:50:31 dillon Exp $ + */ + +#ifndef _ARCH_ISA_ISA_INTR_H_ +#define _ARCH_ISA_ISA_INTR_H_ + +void isa_defaultirq(void); +int isa_nmi(int); + +#endif /* !_ARCH_ISA_ISA_INTR_H_ */ diff --git a/sys/platform/pc32/isa/npx.c b/sys/platform/pc32/isa/npx.c index 6c3033f..6cdedd5 100644 --- a/sys/platform/pc32/isa/npx.c +++ b/sys/platform/pc32/isa/npx.c @@ -75,7 +75,7 @@ #ifndef SMP #include -#include +#include #include #endif -- 1.7.7.2