Annotation of sys/arch/amd64/amd64/ipifuncs.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: ipifuncs.c,v 1.7 2007/05/25 16:22:11 art Exp $ */
2: /* $NetBSD: ipifuncs.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
3:
4: /*-
5: * Copyright (c) 2000 The NetBSD Foundation, Inc.
6: * All rights reserved.
7: *
8: * This code is derived from software contributed to The NetBSD Foundation
9: * by RedBack Networks Inc.
10: *
11: * Author: Bill Sommerfeld
12: *
13: * Redistribution and use in source and binary forms, with or without
14: * modification, are permitted provided that the following conditions
15: * are met:
16: * 1. Redistributions of source code must retain the above copyright
17: * notice, this list of conditions and the following disclaimer.
18: * 2. Redistributions in binary form must reproduce the above copyright
19: * notice, this list of conditions and the following disclaimer in the
20: * documentation and/or other materials provided with the distribution.
21: * 3. All advertising materials mentioning features or use of this software
22: * must display the following acknowledgement:
23: * This product includes software developed by the NetBSD
24: * Foundation, Inc. and its contributors.
25: * 4. Neither the name of The NetBSD Foundation nor the names of its
26: * contributors may be used to endorse or promote products derived
27: * from this software without specific prior written permission.
28: *
29: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
30: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
31: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
33: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
36: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
37: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39: * POSSIBILITY OF SUCH DAMAGE.
40: */
41:
42: #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
43:
44: /*
45: * Interprocessor interrupt handlers.
46: */
47:
48: #include <sys/param.h>
49: #include <sys/device.h>
50: #include <sys/systm.h>
51:
52: #include <uvm/uvm_extern.h>
53:
54: #include <machine/intr.h>
55: #include <machine/atomic.h>
56: #include <machine/cpuvar.h>
57: #include <machine/i82093var.h>
58: #include <machine/i82489reg.h>
59: #include <machine/i82489var.h>
60: #include <machine/mtrr.h>
61: #include <machine/gdt.h>
62: #include <machine/fpu.h>
63:
64: #include <ddb/db_output.h>
65: #include <machine/db_machdep.h>
66:
67: void x86_64_ipi_halt(struct cpu_info *);
68:
69: void x86_64_ipi_synch_fpu(struct cpu_info *);
70: void x86_64_ipi_flush_fpu(struct cpu_info *);
71:
72: void x86_64_ipi_nop(struct cpu_info *);
73:
74: #ifdef MTRR
75: void x86_64_reload_mtrr(struct cpu_info *);
76: #else
77: #define x86_64_reload_mtrr NULL
78: #endif
79:
80: void (*ipifunc[X86_NIPI])(struct cpu_info *) =
81: {
82: x86_64_ipi_halt,
83: x86_64_ipi_nop,
84: x86_64_ipi_flush_fpu,
85: x86_64_ipi_synch_fpu,
86: NULL,
87: x86_64_reload_mtrr,
88: gdt_reload_cpu,
89: #ifdef DDB
90: x86_ipi_db,
91: #else
92: NULL,
93: #endif
94: x86_setperf_ipi,
95: };
96:
97: void
98: x86_64_ipi_nop(struct cpu_info *ci)
99: {
100: }
101:
102: void
103: x86_64_ipi_halt(struct cpu_info *ci)
104: {
105: disable_intr();
106:
107: for(;;) {
108: __asm __volatile("hlt");
109: }
110: }
111:
112: void
113: x86_64_ipi_flush_fpu(struct cpu_info *ci)
114: {
115: fpusave_cpu(ci, 0);
116: }
117:
118: void
119: x86_64_ipi_synch_fpu(struct cpu_info *ci)
120: {
121: fpusave_cpu(ci, 1);
122: }
123:
124: #ifdef MTRR
125:
126: /*
127: * mtrr_reload_cpu() is a macro in mtrr.h which picks the appropriate
128: * function to use..
129: */
130:
131: void
132: x86_64_reload_mtrr(struct cpu_info *ci)
133: {
134: if (mtrr_funcs != NULL)
135: mtrr_reload_cpu(ci);
136: }
137: #endif
CVSweb