From 1b5059791e18ddddcdcbd8857a6d8ab94c5e0ce1 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sun, 30 Jan 2011 17:44:26 +0800 Subject: [PATCH] icu: Split out icu/icu.c --- sys/platform/pc32/acpica5/acpi_wakeup.c | 2 +- sys/platform/pc32/conf/files | 1 + sys/platform/pc32/i386/ipl_funcs.c | 2 +- sys/platform/pc32/i386/nexus.c | 1 + .../pc32/{isa/intr_machdep.c => icu/icu.c} | 163 +++++------------- .../acpi_wakeup.c => pc32/icu/icu_var.h} | 51 ++---- sys/platform/pc32/isa/clock.c | 1 + sys/platform/pc32/isa/intr_machdep.c | 118 +------------ sys/platform/pc32/isa/intr_machdep.h | 12 +- sys/platform/pc64/acpica5/acpi_wakeup.c | 2 +- sys/platform/pc64/conf/files | 1 + .../isa/intr_machdep.c => pc64/icu/icu.c} | 163 +++++------------- .../{acpica5/acpi_wakeup.c => icu/icu_var.h} | 51 ++---- sys/platform/pc64/isa/clock.c | 1 + sys/platform/pc64/isa/intr_machdep.c | 118 +------------ sys/platform/pc64/isa/intr_machdep.h | 12 +- sys/platform/pc64/x86_64/nexus.c | 1 + 17 files changed, 149 insertions(+), 551 deletions(-) copy sys/platform/pc32/{isa/intr_machdep.c => icu/icu.c} (70%) copy sys/platform/{pc64/acpica5/acpi_wakeup.c => pc32/icu/icu_var.h} (57%) copy sys/platform/{pc32/isa/intr_machdep.c => pc64/icu/icu.c} (69%) copy sys/platform/pc64/{acpica5/acpi_wakeup.c => icu/icu_var.h} (57%) diff --git a/sys/platform/pc32/acpica5/acpi_wakeup.c b/sys/platform/pc32/acpica5/acpi_wakeup.c index c6a39ac4e2..53806a6539 100644 --- a/sys/platform/pc32/acpica5/acpi_wakeup.c +++ b/sys/platform/pc32/acpica5/acpi_wakeup.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include "acpi.h" #include diff --git a/sys/platform/pc32/conf/files b/sys/platform/pc32/conf/files index 800c3f5e34..05f519acca 100644 --- a/sys/platform/pc32/conf/files +++ b/sys/platform/pc32/conf/files @@ -185,6 +185,7 @@ platform/pc32/i386/tls.c standard # arch/i386/i386/locore.s standard platform/pc32/i386/machdep.c standard platform/pc32/i386/math_emulate.c optional math_emulate +platform/pc32/icu/icu.c standard platform/pc32/icu/icu_abi.c standard platform/pc32/icu/icu_ipl.s standard platform/pc32/icu/icu_vector.s standard diff --git a/sys/platform/pc32/i386/ipl_funcs.c b/sys/platform/pc32/i386/ipl_funcs.c index 82535ff352..faff588410 100644 --- a/sys/platform/pc32/i386/ipl_funcs.c +++ b/sys/platform/pc32/i386/ipl_funcs.c @@ -31,11 +31,11 @@ #include #include #include +#include #include #include #include #include -#include /* * Bits in the spending bitmap variable must be set atomically because diff --git a/sys/platform/pc32/i386/nexus.c b/sys/platform/pc32/i386/nexus.c index a414546136..49d1cfdf89 100644 --- a/sys/platform/pc32/i386/nexus.c +++ b/sys/platform/pc32/i386/nexus.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include diff --git a/sys/platform/pc32/isa/intr_machdep.c b/sys/platform/pc32/icu/icu.c similarity index 70% copy from sys/platform/pc32/isa/intr_machdep.c copy to sys/platform/pc32/icu/icu.c index 3731cebfa7..56a6bd4a62 100644 --- a/sys/platform/pc32/isa/intr_machdep.c +++ b/sys/platform/pc32/icu/icu.c @@ -44,134 +44,21 @@ * See the notice for details. */ -#include "use_isa.h" #include "opt_auto_eoi.h" #include -#ifndef SMP -#include -#endif #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include - +#include +#include +#include #include -#include -#include - -#if NISA > 0 -#include -#endif #include -#include -#include -#include +#include +#include static void icu_init(void); -#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); -} - -/* - * ICU reinitialize when ICU configuration has lost. - */ -void -icu_reinit(void) -{ - int i; - - icu_init(); - for (i = 0; i < MAX_HARDINTS; ++i) { - if (count_registered_ints(i)) - machintr_intren(i); - } -} - -/* - * Fill in default interrupt table (in case of spurious interrupt - * during configuration of kernel, setup interrupt control unit - */ -void -isa_defaultirq(void) -{ - u_long ef; - - KKASSERT(MachIntrABI.type == MACHINTR_ICU); - - ef = read_eflags(); - cpu_disable_intr(); - - /* Leave interrupts masked */ - outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); - outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); - - MachIntrABI.setdefault(); - icu_init(); - - write_eflags(ef); -} - static void icu_init(void) { @@ -217,13 +104,47 @@ icu_init(void) outb(IO_ICU2, 0x0a); /* default to IRR on read */ } -#if NISA > 0 +void +icu_definit(void) +{ + u_long ef; + + KKASSERT(MachIntrABI.type == MACHINTR_ICU); + + ef = read_eflags(); + cpu_disable_intr(); + + /* Leave interrupts masked */ + outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); + outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); + + MachIntrABI.setdefault(); + icu_init(); + + write_eflags(ef); +} + +/* + * ICU reinitialize when ICU configuration has lost. + */ +void +icu_reinit(void) +{ + int i; + + icu_init(); + for (i = 0; i < MAX_HARDINTS; ++i) { + if (count_registered_ints(i)) + machintr_intren(i); + } +} + /* * Return a bitmap of the current interrupt requests. This is 8259-specific * and is only suitable for use at probe time. */ intrmask_t -isa_irq_pending(void) +icu_irq_pending(void) { u_char irr1; u_char irr2; @@ -232,5 +153,3 @@ isa_irq_pending(void) irr2 = inb(IO_ICU2); return ((irr2 << 8) | irr1); } - -#endif diff --git a/sys/platform/pc64/acpica5/acpi_wakeup.c b/sys/platform/pc32/icu/icu_var.h similarity index 57% copy from sys/platform/pc64/acpica5/acpi_wakeup.c copy to sys/platform/pc32/icu/icu_var.h index e2535ce8a2..05ed83ac3e 100644 --- a/sys/platform/pc64/acpica5/acpi_wakeup.c +++ b/sys/platform/pc32/icu/icu_var.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001 Doug Rabson + * Copyright (c) 1991 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -10,11 +10,18 @@ * 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * 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) @@ -22,38 +29,18 @@ * 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/ia64/acpica/acpi_wakeup.c,v 1.4 2009/06/05 18:44:36 jkim Exp $ */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include +#ifndef _ARCH_ICU_ICU_VAR_H_ +#define _ARCH_ICU_ICU_VAR_H_ -#include -#include -#include +#ifndef _SYS_TYPES_H_ +#include +#endif -#include "acpi.h" -#include +void icu_definit(void); +void icu_reinit(void); -int -acpi_sleep_machdep(struct acpi_softc *sc, int state) -{ - return (0); -} +intrmask_t icu_irq_pending(void); -void -acpi_install_wakeup_handler(struct acpi_softc *sc) -{ -} +#endif /* !_ARCH_ICU_ICU_VAR_H_ */ diff --git a/sys/platform/pc32/isa/clock.c b/sys/platform/pc32/isa/clock.c index 076a77e5aa..4d04d5598f 100644 --- a/sys/platform/pc32/isa/clock.c +++ b/sys/platform/pc32/isa/clock.c @@ -67,6 +67,7 @@ #include #include #include +#include #include #ifdef CLK_CALIBRATION_LOOP diff --git a/sys/platform/pc32/isa/intr_machdep.c b/sys/platform/pc32/isa/intr_machdep.c index 3731cebfa7..b168176695 100644 --- a/sys/platform/pc32/isa/intr_machdep.c +++ b/sys/platform/pc32/isa/intr_machdep.c @@ -45,39 +45,15 @@ */ #include "use_isa.h" -#include "opt_auto_eoi.h" #include -#ifndef SMP -#include -#endif #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#if NISA > 0 +#include #include -#endif -#include -#include -#include -#include -static void icu_init(void); +#include +#include #define NMI_PARITY (1 << 7) #define NMI_IOCHAN (1 << 6) @@ -133,21 +109,6 @@ isa_nmi(int cd) return(retval); } -/* - * ICU reinitialize when ICU configuration has lost. - */ -void -icu_reinit(void) -{ - int i; - - icu_init(); - for (i = 0; i < MAX_HARDINTS; ++i) { - if (count_registered_ints(i)) - machintr_intren(i); - } -} - /* * Fill in default interrupt table (in case of spurious interrupt * during configuration of kernel, setup interrupt control unit @@ -155,82 +116,15 @@ icu_reinit(void) void isa_defaultirq(void) { - u_long ef; - - KKASSERT(MachIntrABI.type == MACHINTR_ICU); - - ef = read_eflags(); - cpu_disable_intr(); - - /* Leave interrupts masked */ - outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); - outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); - - MachIntrABI.setdefault(); - icu_init(); - - write_eflags(ef); -} - -static void -icu_init(void) -{ -#ifdef AUTO_EOI_1 - int auto_eoi = 2; /* auto EOI, 8086 mode */ -#else - int auto_eoi = 0; /* 8086 mode */ -#endif - -#ifdef SMP - if (apic_io_enable) - auto_eoi = 2; /* auto EOI, 8086 mode */ -#endif - - /* - * Program master - */ - outb(IO_ICU1, 0x11); /* reset; program device, four bytes */ - outb(IO_ICU1 + ICU_IMR_OFFSET, IDT_OFFSET); - /* starting at this vector index */ - outb(IO_ICU1 + ICU_IMR_OFFSET, 1 << ICU_IRQ_SLAVE); - /* slave on line 2 */ - outb(IO_ICU1 + ICU_IMR_OFFSET, auto_eoi | 1); /* 8086 mode */ - - outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); /* leave interrupts masked */ - outb(IO_ICU1, 0x0a); /* default to IRR on read */ - outb(IO_ICU1, 0xc0 | (3 - 1)); /* pri order 3-7, 0-2 (com2 first) */ - - /* - * Program slave - */ - outb(IO_ICU2, 0x11); /* reset; program device, four bytes */ - outb(IO_ICU2 + ICU_IMR_OFFSET, IDT_OFFSET + 8); - /* staring at this vector index */ - outb(IO_ICU2 + ICU_IMR_OFFSET, ICU_IRQ_SLAVE); -#ifdef AUTO_EOI_2 - outb(IO_ICU2 + ICU_IMR_OFFSET, 2 | 1); /* auto EOI, 8086 mode */ -#else - outb(IO_ICU2 + ICU_IMR_OFFSET, 1); /* 8086 mode */ -#endif - - outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); /* leave interrupts masked */ - outb(IO_ICU2, 0x0a); /* default to IRR on read */ + icu_definit(); } #if NISA > 0 -/* - * Return a bitmap of the current interrupt requests. This is 8259-specific - * and is only suitable for use at probe time. - */ + intrmask_t isa_irq_pending(void) { - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1); - irr2 = inb(IO_ICU2); - return ((irr2 << 8) | irr1); + return icu_irq_pending(); } #endif diff --git a/sys/platform/pc32/isa/intr_machdep.h b/sys/platform/pc32/isa/intr_machdep.h index 16b396b29b..69d0d44ff1 100644 --- a/sys/platform/pc32/isa/intr_machdep.h +++ b/sys/platform/pc32/isa/intr_machdep.h @@ -38,11 +38,8 @@ #define _ARCH_ISA_INTR_MACHDEP_H_ #ifndef LOCORE -#ifndef _SYS_INTERRUPT_H_ -#include -#endif -#ifndef _SYS_SERIALIZE_H_ -#include +#ifndef _SYS_TYPES_H_ +#include #endif #endif @@ -156,9 +153,8 @@ inthand_t Xipiq; /* handle lwkt_send_ipiq() requests */ #endif /* SMP */ -void isa_defaultirq (void); -int isa_nmi (int cd); -void icu_reinit (void); +void isa_defaultirq(void); +int isa_nmi(int); #endif /* LOCORE */ diff --git a/sys/platform/pc64/acpica5/acpi_wakeup.c b/sys/platform/pc64/acpica5/acpi_wakeup.c index e2535ce8a2..b97683a472 100644 --- a/sys/platform/pc64/acpica5/acpi_wakeup.c +++ b/sys/platform/pc64/acpica5/acpi_wakeup.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include "acpi.h" #include diff --git a/sys/platform/pc64/conf/files b/sys/platform/pc64/conf/files index 91a5bca17f..d44fd835aa 100644 --- a/sys/platform/pc64/conf/files +++ b/sys/platform/pc64/conf/files @@ -177,6 +177,7 @@ bus/isa/x86_64/isa_dma.c optional isa platform/pc64/x86_64/nexus.c standard +platform/pc64/icu/icu.c standard platform/pc64/icu/icu_abi.c standard platform/pc64/icu/icu_ipl.s standard platform/pc64/icu/icu_vector.s standard diff --git a/sys/platform/pc32/isa/intr_machdep.c b/sys/platform/pc64/icu/icu.c similarity index 69% copy from sys/platform/pc32/isa/intr_machdep.c copy to sys/platform/pc64/icu/icu.c index 3731cebfa7..6727405ad8 100644 --- a/sys/platform/pc32/isa/intr_machdep.c +++ b/sys/platform/pc64/icu/icu.c @@ -44,134 +44,21 @@ * See the notice for details. */ -#include "use_isa.h" #include "opt_auto_eoi.h" #include -#ifndef SMP -#include -#endif #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include - +#include +#include +#include #include -#include -#include - -#if NISA > 0 -#include -#endif #include -#include -#include -#include +#include +#include static void icu_init(void); -#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); -} - -/* - * ICU reinitialize when ICU configuration has lost. - */ -void -icu_reinit(void) -{ - int i; - - icu_init(); - for (i = 0; i < MAX_HARDINTS; ++i) { - if (count_registered_ints(i)) - machintr_intren(i); - } -} - -/* - * Fill in default interrupt table (in case of spurious interrupt - * during configuration of kernel, setup interrupt control unit - */ -void -isa_defaultirq(void) -{ - u_long ef; - - KKASSERT(MachIntrABI.type == MACHINTR_ICU); - - ef = read_eflags(); - cpu_disable_intr(); - - /* Leave interrupts masked */ - outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); - outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); - - MachIntrABI.setdefault(); - icu_init(); - - write_eflags(ef); -} - static void icu_init(void) { @@ -217,13 +104,47 @@ icu_init(void) outb(IO_ICU2, 0x0a); /* default to IRR on read */ } -#if NISA > 0 +void +icu_definit(void) +{ + register_t ef; + + KKASSERT(MachIntrABI.type == MACHINTR_ICU); + + ef = read_rflags(); + cpu_disable_intr(); + + /* Leave interrupts masked */ + outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); + outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); + + MachIntrABI.setdefault(); + icu_init(); + + write_rflags(ef); +} + +/* + * ICU reinitialize when ICU configuration has lost. + */ +void +icu_reinit(void) +{ + int i; + + icu_init(); + for (i = 0; i < MAX_HARDINTS; ++i) { + if (count_registered_ints(i)) + machintr_intren(i); + } +} + /* * Return a bitmap of the current interrupt requests. This is 8259-specific * and is only suitable for use at probe time. */ intrmask_t -isa_irq_pending(void) +icu_irq_pending(void) { u_char irr1; u_char irr2; @@ -232,5 +153,3 @@ isa_irq_pending(void) irr2 = inb(IO_ICU2); return ((irr2 << 8) | irr1); } - -#endif diff --git a/sys/platform/pc64/acpica5/acpi_wakeup.c b/sys/platform/pc64/icu/icu_var.h similarity index 57% copy from sys/platform/pc64/acpica5/acpi_wakeup.c copy to sys/platform/pc64/icu/icu_var.h index e2535ce8a2..05ed83ac3e 100644 --- a/sys/platform/pc64/acpica5/acpi_wakeup.c +++ b/sys/platform/pc64/icu/icu_var.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001 Doug Rabson + * Copyright (c) 1991 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -10,11 +10,18 @@ * 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * 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) @@ -22,38 +29,18 @@ * 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/ia64/acpica/acpi_wakeup.c,v 1.4 2009/06/05 18:44:36 jkim Exp $ */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include +#ifndef _ARCH_ICU_ICU_VAR_H_ +#define _ARCH_ICU_ICU_VAR_H_ -#include -#include -#include +#ifndef _SYS_TYPES_H_ +#include +#endif -#include "acpi.h" -#include +void icu_definit(void); +void icu_reinit(void); -int -acpi_sleep_machdep(struct acpi_softc *sc, int state) -{ - return (0); -} +intrmask_t icu_irq_pending(void); -void -acpi_install_wakeup_handler(struct acpi_softc *sc) -{ -} +#endif /* !_ARCH_ICU_ICU_VAR_H_ */ diff --git a/sys/platform/pc64/isa/clock.c b/sys/platform/pc64/isa/clock.c index 5602176bbf..f315811632 100644 --- a/sys/platform/pc64/isa/clock.c +++ b/sys/platform/pc64/isa/clock.c @@ -70,6 +70,7 @@ #include #include #include +#include #include #ifdef CLK_CALIBRATION_LOOP diff --git a/sys/platform/pc64/isa/intr_machdep.c b/sys/platform/pc64/isa/intr_machdep.c index ac54fe55a0..9640819761 100644 --- a/sys/platform/pc64/isa/intr_machdep.c +++ b/sys/platform/pc64/isa/intr_machdep.c @@ -46,39 +46,15 @@ */ #include "use_isa.h" -//#include "opt_auto_eoi.h" #include -#ifndef SMP -#include -#endif #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#if NISA > 0 +#include #include -#endif -#include -#include -#include -#include -static void icu_init(void); +#include +#include #define NMI_PARITY (1 << 7) #define NMI_IOCHAN (1 << 6) @@ -134,21 +110,6 @@ isa_nmi(int cd) return(retval); } -/* - * ICU reinitialize when ICU configuration has lost. - */ -void -icu_reinit(void) -{ - int i; - - icu_init(); - for (i = 0; i < MAX_HARDINTS; ++i) { - if (count_registered_ints(i)) - machintr_intren(i); - } -} - /* * Fill in default interrupt table (in case of spurious interrupt * during configuration of kernel, setup interrupt control unit @@ -156,82 +117,15 @@ icu_reinit(void) void isa_defaultirq(void) { - register_t ef; - - KKASSERT(MachIntrABI.type == MACHINTR_ICU); - - ef = read_rflags(); - cpu_disable_intr(); - - /* Leave interrupts masked */ - outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); - outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); - - MachIntrABI.setdefault(); - icu_init(); - - write_rflags(ef); -} - -static void -icu_init(void) -{ -#ifdef AUTO_EOI_1 - int auto_eoi = 2; /* auto EOI, 8086 mode */ -#else - int auto_eoi = 0; /* 8086 mode */ -#endif - -#ifdef SMP - if (apic_io_enable) - auto_eoi = 2; /* auto EOI, 8086 mode */ -#endif - - /* - * Program master - */ - outb(IO_ICU1, 0x11); /* reset; program device, four bytes */ - outb(IO_ICU1 + ICU_IMR_OFFSET, IDT_OFFSET); - /* starting at this vector index */ - outb(IO_ICU1 + ICU_IMR_OFFSET, 1 << ICU_IRQ_SLAVE); - /* slave on line 2 */ - outb(IO_ICU1 + ICU_IMR_OFFSET, auto_eoi | 1); /* 8086 mode */ - - outb(IO_ICU1 + ICU_IMR_OFFSET, 0xff); /* leave interrupts masked */ - outb(IO_ICU1, 0x0a); /* default to IRR on read */ - outb(IO_ICU1, 0xc0 | (3 - 1)); /* pri order 3-7, 0-2 (com2 first) */ - - /* - * Program slave - */ - outb(IO_ICU2, 0x11); /* reset; program device, four bytes */ - outb(IO_ICU2 + ICU_IMR_OFFSET, IDT_OFFSET + 8); - /* staring at this vector index */ - outb(IO_ICU2 + ICU_IMR_OFFSET, ICU_IRQ_SLAVE); -#ifdef AUTO_EOI_2 - outb(IO_ICU2 + ICU_IMR_OFFSET, 2 | 1); /* auto EOI, 8086 mode */ -#else - outb(IO_ICU2 + ICU_IMR_OFFSET, 1); /* 8086 mode */ -#endif - - outb(IO_ICU2 + ICU_IMR_OFFSET, 0xff); /* leave interrupts masked */ - outb(IO_ICU2, 0x0a); /* default to IRR on read */ + icu_definit(); } #if NISA > 0 -/* - * Return a bitmap of the current interrupt requests. This is 8259-specific - * and is only suitable for use at probe time. - */ + intrmask_t isa_irq_pending(void) { - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1); - irr2 = inb(IO_ICU2); - return ((irr2 << 8) | irr1); + return icu_irq_pending(); } #endif diff --git a/sys/platform/pc64/isa/intr_machdep.h b/sys/platform/pc64/isa/intr_machdep.h index ba41717003..bc77056d60 100644 --- a/sys/platform/pc64/isa/intr_machdep.h +++ b/sys/platform/pc64/isa/intr_machdep.h @@ -39,11 +39,8 @@ #define _ARCH_ISA_INTR_MACHDEP_H_ #ifndef LOCORE -#ifndef _SYS_INTERRUPT_H_ -#include -#endif -#ifndef _SYS_SERIALIZE_H_ -#include +#ifndef _SYS_TYPES_H_ +#include #endif #endif @@ -160,9 +157,8 @@ inthand_t Xipiq; /* handle lwkt_send_ipiq() requests */ #endif /* SMP */ -void isa_defaultirq (void); -int isa_nmi (int cd); -void icu_reinit (void); +void isa_defaultirq(void); +int isa_nmi(int); #endif /* LOCORE */ diff --git a/sys/platform/pc64/x86_64/nexus.c b/sys/platform/pc64/x86_64/nexus.c index 05038cc535..8cdcfa5ab7 100644 --- a/sys/platform/pc64/x86_64/nexus.c +++ b/sys/platform/pc64/x86_64/nexus.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include -- 2.41.0