Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/sommerfeld_i386mp_1]: src/sys/arch/i386/i386 Inter-Processor Interrupt d...
details: https://anonhg.NetBSD.org/src/rev/97664153a2e1
branches: sommerfeld_i386mp_1
changeset: 482158:97664153a2e1
user: sommerfeld <sommerfeld%NetBSD.org@localhost>
date: Sun Feb 20 17:09:54 2000 +0000
description:
Inter-Processor Interrupt dispatching.
diffstat:
sys/arch/i386/i386/ipifuncs.c | 159 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 159 insertions(+), 0 deletions(-)
diffs (163 lines):
diff -r e64194244555 -r 97664153a2e1 sys/arch/i386/i386/ipifuncs.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/i386/ipifuncs.c Sun Feb 20 17:09:54 2000 +0000
@@ -0,0 +1,159 @@
+/* $NetBSD */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by RedBack Networks Inc.
+ *
+ * Author: Bill Sommerfeld
+ *
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+
+#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
+
+/*
+ * Interprocessor interrupt handlers.
+ */
+
+#include "opt_ddb.h"
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <vm/vm.h>
+
+#include <machine/intr.h>
+#include <machine/atomic.h>
+#include <machine/cpuvar.h>
+#include <machine/i82093var.h>
+
+void i386_ipi_halt(void);
+void i386_ipi_gmtb(void);
+void i386_ipi_nychi(void);
+
+void (*ipifunc[I386_NIPI])(void) =
+{
+ i386_ipi_halt,
+ pmap_do_tlb_shootdown,
+ 0,
+ 0,
+ i386_ipi_gmtb,
+ i386_ipi_nychi
+};
+
+void
+i386_ipi_halt(void)
+{
+ struct cpu_info *ci = curcpu();
+
+ disable_intr();
+
+ printf("%s: shutting down\n", ci->ci_dev.dv_xname);
+ for(;;) {
+ asm volatile("hlt");
+ }
+}
+
+void
+i386_ipi_gmtb(void)
+{
+#if 0
+ struct cpu_info *ci = curcpu();
+ printf("%s: we were asked for the brain.\n", ci->ci_dev.dv_xname);
+#endif
+ i386_send_ipi(1, I386_IPI_NYCHI);
+}
+
+void
+i386_ipi_nychi(void)
+{
+#if 0
+ struct cpu_info *ci = curcpu();
+ printf("%s: we were asked for the brain.\n", ci->ci_dev.dv_xname);
+#endif
+}
+
+void
+i386_spurious (void)
+{
+ printf("spurious intr\n");
+}
+
+
+void
+i386_send_ipi (int cpu_id, int ipimask)
+{
+ struct cpu_info *ci = cpu_info[cpu_id];
+
+ i386_atomic_setbits_l(&ci->ci_ipis, ipimask);
+ i386_ipi(LAPIC_IPI_VECTOR, cpu_id, LAPIC_DLMODE_FIXED);
+}
+
+void
+i386_self_ipi (int vector)
+{
+ i82489_writereg(LAPIC_ICRLO,
+ vector | LAPIC_DLMODE_FIXED | LAPIC_LVL_ASSERT | LAPIC_DEST_SELF);
+}
+
+
+void
+i386_broadcast_ipi (int ipimask)
+{
+ panic("broadcast_ipi not implemented");
+}
+
+void
+i386_ipi_handler(void)
+{
+ struct cpu_info *ci = curcpu();
+ u_int32_t pending;
+ int bit;
+
+ pending = i386_atomic_testset_ul(&ci->ci_ipis, 0);
+#if 0
+ printf("%s: pending IPIs: %x\n", ci->ci_dev.dv_xname, pending);
+#endif
+
+ for (bit = 0; bit < I386_NIPI && pending; bit++) {
+ if (pending & (1<<bit)) {
+ pending &= ~(1<<bit);
+ (*ipifunc[bit])();
+ }
+ }
+
+#if 0
+ Debugger();
+#endif
+}
Home |
Main Index |
Thread Index |
Old Index