| @@ -1,293 +1,295 @@ | | | @@ -1,293 +1,295 @@ |
1 | /* $NetBSD: cpu.h,v 1.131 2020/08/17 03:19:35 mrg Exp $ */ | | 1 | /* $NetBSD: cpu.h,v 1.132 2021/03/29 01:47:45 simonb Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1992, 1993 | | 4 | * Copyright (c) 1992, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Ralph Campbell and Rick Macklem. | | 8 | * Ralph Campbell and Rick Macklem. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
15 | * 2. Redistributions in binary form must reproduce the above copyright | | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in the | | 16 | * notice, this list of conditions and the following disclaimer in the |
17 | * documentation and/or other materials provided with the distribution. | | 17 | * documentation and/or other materials provided with the distribution. |
18 | * 3. Neither the name of the University nor the names of its contributors | | 18 | * 3. Neither the name of the University nor the names of its contributors |
19 | * may be used to endorse or promote products derived from this software | | 19 | * may be used to endorse or promote products derived from this software |
20 | * without specific prior written permission. | | 20 | * without specific prior written permission. |
21 | * | | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | | 22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | * | | 33 | * |
34 | * @(#)cpu.h 8.4 (Berkeley) 1/4/94 | | 34 | * @(#)cpu.h 8.4 (Berkeley) 1/4/94 |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #ifndef _CPU_H_ | | 37 | #ifndef _CPU_H_ |
38 | #define _CPU_H_ | | 38 | #define _CPU_H_ |
39 | | | 39 | |
40 | /* | | 40 | /* |
41 | * Exported definitions unique to NetBSD/mips cpu support. | | 41 | * Exported definitions unique to NetBSD/mips cpu support. |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #ifdef _LOCORE | | 44 | #ifdef _LOCORE |
45 | #error Use assym.h to get definitions from <mips/cpu.h> | | 45 | #error Use assym.h to get definitions from <mips/cpu.h> |
46 | #endif | | 46 | #endif |
47 | | | 47 | |
48 | #if defined(_KERNEL) || defined(_KMEMUSER) | | 48 | #if defined(_KERNEL) || defined(_KMEMUSER) |
49 | | | 49 | |
50 | #if defined(_KERNEL_OPT) | | 50 | #if defined(_KERNEL_OPT) |
51 | #include "opt_cputype.h" | | 51 | #include "opt_cputype.h" |
52 | #include "opt_lockdebug.h" | | 52 | #include "opt_lockdebug.h" |
53 | #include "opt_multiprocessor.h" | | 53 | #include "opt_multiprocessor.h" |
54 | #endif | | 54 | #endif |
55 | | | 55 | |
| | | 56 | #include <mips/frame.h> |
| | | 57 | |
56 | #include <sys/cpu_data.h> | | 58 | #include <sys/cpu_data.h> |
57 | #include <sys/device_if.h> | | 59 | #include <sys/device_if.h> |
58 | #include <sys/evcnt.h> | | 60 | #include <sys/evcnt.h> |
59 | #include <sys/kcpuset.h> | | 61 | #include <sys/kcpuset.h> |
60 | #include <sys/intr.h> | | 62 | #include <sys/intr.h> |
61 | | | 63 | |
62 | typedef struct cpu_watchpoint { | | 64 | typedef struct cpu_watchpoint { |
63 | register_t cw_addr; | | 65 | register_t cw_addr; |
64 | register_t cw_mask; | | 66 | register_t cw_mask; |
65 | uint32_t cw_asid; | | 67 | uint32_t cw_asid; |
66 | uint32_t cw_mode; | | 68 | uint32_t cw_mode; |
67 | } cpu_watchpoint_t; | | 69 | } cpu_watchpoint_t; |
68 | | | 70 | |
69 | /* (abstract) mode bits */ | | 71 | /* (abstract) mode bits */ |
70 | #define CPUWATCH_WRITE __BIT(0) | | 72 | #define CPUWATCH_WRITE __BIT(0) |
71 | #define CPUWATCH_READ __BIT(1) | | 73 | #define CPUWATCH_READ __BIT(1) |
72 | #define CPUWATCH_EXEC __BIT(2) | | 74 | #define CPUWATCH_EXEC __BIT(2) |
73 | #define CPUWATCH_MASK __BIT(3) | | 75 | #define CPUWATCH_MASK __BIT(3) |
74 | #define CPUWATCH_ASID __BIT(4) | | 76 | #define CPUWATCH_ASID __BIT(4) |
75 | #define CPUWATCH_RWX (CPUWATCH_EXEC|CPUWATCH_READ|CPUWATCH_WRITE) | | 77 | #define CPUWATCH_RWX (CPUWATCH_EXEC|CPUWATCH_READ|CPUWATCH_WRITE) |
76 | | | 78 | |
77 | #define CPUWATCH_MAX 8 /* max possible number of watchpoints */ | | 79 | #define CPUWATCH_MAX 8 /* max possible number of watchpoints */ |
78 | | | 80 | |
79 | u_int cpuwatch_discover(void); | | 81 | u_int cpuwatch_discover(void); |
80 | void cpuwatch_free(cpu_watchpoint_t *); | | 82 | void cpuwatch_free(cpu_watchpoint_t *); |
81 | cpu_watchpoint_t *cpuwatch_alloc(void); | | 83 | cpu_watchpoint_t *cpuwatch_alloc(void); |
82 | void cpuwatch_set_all(void); | | 84 | void cpuwatch_set_all(void); |
83 | void cpuwatch_clr_all(void); | | 85 | void cpuwatch_clr_all(void); |
84 | void cpuwatch_set(cpu_watchpoint_t *); | | 86 | void cpuwatch_set(cpu_watchpoint_t *); |
85 | void cpuwatch_clr(cpu_watchpoint_t *); | | 87 | void cpuwatch_clr(cpu_watchpoint_t *); |
86 | | | 88 | |
87 | struct cpu_info { | | 89 | struct cpu_info { |
88 | struct cpu_data ci_data; /* MI per-cpu data */ | | 90 | struct cpu_data ci_data; /* MI per-cpu data */ |
89 | void *ci_nmi_stack; /* NMI exception stack */ | | 91 | void *ci_nmi_stack; /* NMI exception stack */ |
90 | struct cpu_softc *ci_softc; /* chip-dependent hook */ | | 92 | struct cpu_softc *ci_softc; /* chip-dependent hook */ |
91 | device_t ci_dev; /* owning device */ | | 93 | device_t ci_dev; /* owning device */ |
92 | cpuid_t ci_cpuid; /* Machine-level identifier */ | | 94 | cpuid_t ci_cpuid; /* Machine-level identifier */ |
93 | u_long ci_cctr_freq; /* cycle counter frequency */ | | 95 | u_long ci_cctr_freq; /* cycle counter frequency */ |
94 | u_long ci_cpu_freq; /* CPU frequency */ | | 96 | u_long ci_cpu_freq; /* CPU frequency */ |
95 | u_long ci_cycles_per_hz; /* CPU freq / hz */ | | 97 | u_long ci_cycles_per_hz; /* CPU freq / hz */ |
96 | u_long ci_divisor_delay; /* for delay/DELAY */ | | 98 | u_long ci_divisor_delay; /* for delay/DELAY */ |
97 | u_long ci_divisor_recip; /* unused, for obsolete microtime(9) */ | | 99 | u_long ci_divisor_recip; /* unused, for obsolete microtime(9) */ |
98 | struct lwp *ci_curlwp; /* currently running lwp */ | | 100 | struct lwp *ci_curlwp; /* currently running lwp */ |
99 | struct lwp *ci_onproc; /* current user LWP / kthread */ | | 101 | struct lwp *ci_onproc; /* current user LWP / kthread */ |
100 | volatile int ci_want_resched; /* user preemption pending */ | | 102 | volatile int ci_want_resched; /* user preemption pending */ |
101 | int ci_mtx_count; /* negative count of held mutexes */ | | 103 | int ci_mtx_count; /* negative count of held mutexes */ |
102 | int ci_mtx_oldspl; /* saved SPL value */ | | 104 | int ci_mtx_oldspl; /* saved SPL value */ |
103 | int ci_idepth; /* hardware interrupt depth */ | | 105 | int ci_idepth; /* hardware interrupt depth */ |
104 | int ci_cpl; /* current [interrupt] priority level */ | | 106 | int ci_cpl; /* current [interrupt] priority level */ |
105 | uint32_t ci_next_cp0_clk_intr; /* for hard clock intr scheduling */ | | 107 | uint32_t ci_next_cp0_clk_intr; /* for hard clock intr scheduling */ |
106 | struct evcnt ci_ev_count_compare; /* hard clock intr counter */ | | 108 | struct evcnt ci_ev_count_compare; /* hard clock intr counter */ |
107 | struct evcnt ci_ev_count_compare_missed; /* hard clock miss counter */ | | 109 | struct evcnt ci_ev_count_compare_missed; /* hard clock miss counter */ |
108 | struct lwp *ci_softlwps[SOFTINT_COUNT]; | | 110 | struct lwp *ci_softlwps[SOFTINT_COUNT]; |
109 | volatile u_int ci_softints; | | 111 | volatile u_int ci_softints; |
110 | struct evcnt ci_ev_fpu_loads; /* fpu load counter */ | | 112 | struct evcnt ci_ev_fpu_loads; /* fpu load counter */ |
111 | struct evcnt ci_ev_fpu_saves; /* fpu save counter */ | | 113 | struct evcnt ci_ev_fpu_saves; /* fpu save counter */ |
112 | struct evcnt ci_ev_dsp_loads; /* dsp load counter */ | | 114 | struct evcnt ci_ev_dsp_loads; /* dsp load counter */ |
113 | struct evcnt ci_ev_dsp_saves; /* dsp save counter */ | | 115 | struct evcnt ci_ev_dsp_saves; /* dsp save counter */ |
114 | struct evcnt ci_ev_tlbmisses; | | 116 | struct evcnt ci_ev_tlbmisses; |
115 | | | 117 | |
116 | /* | | 118 | /* |
117 | * Per-cpu pmap information | | 119 | * Per-cpu pmap information |
118 | */ | | 120 | */ |
119 | int ci_tlb_slot; /* reserved tlb entry for cpu_info */ | | 121 | int ci_tlb_slot; /* reserved tlb entry for cpu_info */ |
120 | u_int ci_pmap_asid_cur; /* current ASID */ | | 122 | u_int ci_pmap_asid_cur; /* current ASID */ |
121 | struct pmap_tlb_info *ci_tlb_info; /* tlb information for this cpu */ | | 123 | struct pmap_tlb_info *ci_tlb_info; /* tlb information for this cpu */ |
122 | union pmap_segtab *ci_pmap_segtabs[2]; | | 124 | union pmap_segtab *ci_pmap_segtabs[2]; |
123 | #define ci_pmap_user_segtab ci_pmap_segtabs[0] | | 125 | #define ci_pmap_user_segtab ci_pmap_segtabs[0] |
124 | #define ci_pmap_kern_segtab ci_pmap_segtabs[1] | | 126 | #define ci_pmap_kern_segtab ci_pmap_segtabs[1] |
125 | #ifdef _LP64 | | 127 | #ifdef _LP64 |
126 | union pmap_segtab *ci_pmap_seg0tabs[2]; | | 128 | union pmap_segtab *ci_pmap_seg0tabs[2]; |
127 | #define ci_pmap_user_seg0tab ci_pmap_seg0tabs[0] | | 129 | #define ci_pmap_user_seg0tab ci_pmap_seg0tabs[0] |
128 | #define ci_pmap_kern_seg0tab ci_pmap_seg0tabs[1] | | 130 | #define ci_pmap_kern_seg0tab ci_pmap_seg0tabs[1] |
129 | #endif | | 131 | #endif |
130 | vaddr_t ci_pmap_srcbase; /* starting VA of ephemeral src space */ | | 132 | vaddr_t ci_pmap_srcbase; /* starting VA of ephemeral src space */ |
131 | vaddr_t ci_pmap_dstbase; /* starting VA of ephemeral dst space */ | | 133 | vaddr_t ci_pmap_dstbase; /* starting VA of ephemeral dst space */ |
132 | | | 134 | |
133 | u_int ci_cpuwatch_count; /* number of watchpoints on this CPU */ | | 135 | u_int ci_cpuwatch_count; /* number of watchpoints on this CPU */ |
134 | cpu_watchpoint_t ci_cpuwatch_tab[CPUWATCH_MAX]; | | 136 | cpu_watchpoint_t ci_cpuwatch_tab[CPUWATCH_MAX]; |
135 | | | 137 | |
136 | #ifdef MULTIPROCESSOR | | 138 | #ifdef MULTIPROCESSOR |
137 | volatile u_long ci_flags; | | 139 | volatile u_long ci_flags; |
138 | volatile uint64_t ci_request_ipis; | | 140 | volatile uint64_t ci_request_ipis; |
139 | /* bitmask of IPIs requested */ | | 141 | /* bitmask of IPIs requested */ |
140 | /* use on chips where hw cannot pass tag */ | | 142 | /* use on chips where hw cannot pass tag */ |
141 | uint64_t ci_active_ipis; /* bitmask of IPIs being serviced */ | | 143 | uint64_t ci_active_ipis; /* bitmask of IPIs being serviced */ |
142 | uint32_t ci_ksp_tlb_slot; /* tlb entry for kernel stack */ | | 144 | uint32_t ci_ksp_tlb_slot; /* tlb entry for kernel stack */ |
143 | struct evcnt ci_evcnt_all_ipis; /* aggregated IPI counter */ | | 145 | struct evcnt ci_evcnt_all_ipis; /* aggregated IPI counter */ |
144 | struct evcnt ci_evcnt_per_ipi[NIPIS]; /* individual IPI counters*/ | | 146 | struct evcnt ci_evcnt_per_ipi[NIPIS]; /* individual IPI counters*/ |
145 | struct evcnt ci_evcnt_synci_activate_rqst; | | 147 | struct evcnt ci_evcnt_synci_activate_rqst; |
146 | struct evcnt ci_evcnt_synci_onproc_rqst; | | 148 | struct evcnt ci_evcnt_synci_onproc_rqst; |
147 | struct evcnt ci_evcnt_synci_deferred_rqst; | | 149 | struct evcnt ci_evcnt_synci_deferred_rqst; |
148 | struct evcnt ci_evcnt_synci_ipi_rqst; | | 150 | struct evcnt ci_evcnt_synci_ipi_rqst; |
149 | | | 151 | |
150 | #define CPUF_PRIMARY 0x01 /* CPU is primary CPU */ | | 152 | #define CPUF_PRIMARY 0x01 /* CPU is primary CPU */ |
151 | #define CPUF_PRESENT 0x02 /* CPU is present */ | | 153 | #define CPUF_PRESENT 0x02 /* CPU is present */ |
152 | #define CPUF_RUNNING 0x04 /* CPU is running */ | | 154 | #define CPUF_RUNNING 0x04 /* CPU is running */ |
153 | #define CPUF_PAUSED 0x08 /* CPU is paused */ | | 155 | #define CPUF_PAUSED 0x08 /* CPU is paused */ |
154 | #define CPUF_USERPMAP 0x20 /* CPU has a user pmap activated */ | | 156 | #define CPUF_USERPMAP 0x20 /* CPU has a user pmap activated */ |
155 | kcpuset_t *ci_shootdowncpus; | | 157 | kcpuset_t *ci_shootdowncpus; |
156 | kcpuset_t *ci_multicastcpus; | | 158 | kcpuset_t *ci_multicastcpus; |
157 | kcpuset_t *ci_watchcpus; | | 159 | kcpuset_t *ci_watchcpus; |
158 | kcpuset_t *ci_ddbcpus; | | 160 | kcpuset_t *ci_ddbcpus; |
159 | #endif | | 161 | #endif |
160 | | | 162 | |
161 | }; | | 163 | }; |
162 | #endif /* _KERNEL || _KMEMUSER */ | | 164 | #endif /* _KERNEL || _KMEMUSER */ |
163 | | | 165 | |
164 | #ifdef _KERNEL | | 166 | #ifdef _KERNEL |
165 | | | 167 | |
166 | #ifdef MULTIPROCESSOR | | 168 | #ifdef MULTIPROCESSOR |
167 | #define CPU_INFO_ITERATOR int | | 169 | #define CPU_INFO_ITERATOR int |
168 | #define CPU_INFO_FOREACH(cii, ci) \ | | 170 | #define CPU_INFO_FOREACH(cii, ci) \ |
169 | cii = 0, ci = &cpu_info_store; \ | | 171 | cii = 0, ci = &cpu_info_store; \ |
170 | ci != NULL; \ | | 172 | ci != NULL; \ |
171 | cii++, \ | | 173 | cii++, \ |
172 | ncpu ? (ci = cpu_infos[cii]) \ | | 174 | ncpu ? (ci = cpu_infos[cii]) \ |
173 | : (ci = NULL) | | 175 | : (ci = NULL) |
174 | #else | | 176 | #else |
175 | #define CPU_INFO_ITERATOR int __unused | | 177 | #define CPU_INFO_ITERATOR int __unused |
176 | #define CPU_INFO_FOREACH(cii, ci) \ | | 178 | #define CPU_INFO_FOREACH(cii, ci) \ |
177 | ci = &cpu_info_store; ci != NULL; ci = NULL | | 179 | ci = &cpu_info_store; ci != NULL; ci = NULL |
178 | #endif | | 180 | #endif |
179 | | | 181 | |
180 | /* Note: must be kept in sync with -ffixed-?? Makefile.mips. */ | | 182 | /* Note: must be kept in sync with -ffixed-?? Makefile.mips. */ |
181 | // MIPS_CURLWP moved to <mips/regdef.h> | | 183 | // MIPS_CURLWP moved to <mips/regdef.h> |
182 | #define MIPS_CURLWP_QUOTED "$24" | | 184 | #define MIPS_CURLWP_QUOTED "$24" |
183 | #define MIPS_CURLWP_LABEL _L_T8 | | 185 | #define MIPS_CURLWP_LABEL _L_T8 |
184 | #define MIPS_CURLWP_REG _R_T8 | | 186 | #define MIPS_CURLWP_REG _R_T8 |
185 | | | 187 | |
186 | extern struct cpu_info cpu_info_store; | | 188 | extern struct cpu_info cpu_info_store; |
187 | #ifdef MULTIPROCESSOR | | 189 | #ifdef MULTIPROCESSOR |
188 | extern struct cpu_info *cpuid_infos[]; | | 190 | extern struct cpu_info *cpuid_infos[]; |
189 | #endif | | 191 | #endif |
190 | register struct lwp *mips_curlwp asm(MIPS_CURLWP_QUOTED); | | 192 | register struct lwp *mips_curlwp asm(MIPS_CURLWP_QUOTED); |
191 | | | 193 | |
192 | #define curlwp mips_curlwp | | 194 | #define curlwp mips_curlwp |
193 | #define curcpu() lwp_getcpu(curlwp) | | 195 | #define curcpu() lwp_getcpu(curlwp) |
194 | #define curpcb ((struct pcb *)lwp_getpcb(curlwp)) | | 196 | #define curpcb ((struct pcb *)lwp_getpcb(curlwp)) |
195 | #ifdef MULTIPROCESSOR | | 197 | #ifdef MULTIPROCESSOR |
196 | #define cpu_number() (curcpu()->ci_index) | | 198 | #define cpu_number() (curcpu()->ci_index) |
197 | #define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY) | | 199 | #define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY) |
198 | #else | | 200 | #else |
199 | #define cpu_number() (0) | | 201 | #define cpu_number() (0) |
200 | #define CPU_IS_PRIMARY(ci) (true) | | 202 | #define CPU_IS_PRIMARY(ci) (true) |
201 | #endif | | 203 | #endif |
202 | | | 204 | |
203 | /* | | 205 | /* |
204 | * definitions of cpu-dependent requirements | | 206 | * definitions of cpu-dependent requirements |
205 | * referenced in generic code | | 207 | * referenced in generic code |
206 | */ | | 208 | */ |
207 | | | 209 | |
208 | /* | | 210 | /* |
209 | * Send an inter-processor interrupt to each other CPU (excludes curcpu()) | | 211 | * Send an inter-processor interrupt to each other CPU (excludes curcpu()) |
210 | */ | | 212 | */ |
211 | void cpu_broadcast_ipi(int); | | 213 | void cpu_broadcast_ipi(int); |
212 | | | 214 | |
213 | /* | | 215 | /* |
214 | * Send an inter-processor interrupt to CPUs in kcpuset (excludes curcpu()) | | 216 | * Send an inter-processor interrupt to CPUs in kcpuset (excludes curcpu()) |
215 | */ | | 217 | */ |
216 | void cpu_multicast_ipi(const kcpuset_t *, int); | | 218 | void cpu_multicast_ipi(const kcpuset_t *, int); |
217 | | | 219 | |
218 | /* | | 220 | /* |
219 | * Send an inter-processor interrupt to another CPU. | | 221 | * Send an inter-processor interrupt to another CPU. |
220 | */ | | 222 | */ |
221 | int cpu_send_ipi(struct cpu_info *, int); | | 223 | int cpu_send_ipi(struct cpu_info *, int); |
222 | | | 224 | |
223 | /* | | 225 | /* |
224 | * cpu_intr(ppl, pc, status); (most state needed by clockframe) | | 226 | * cpu_intr(ppl, pc, status); (most state needed by clockframe) |
225 | */ | | 227 | */ |
226 | void cpu_intr(int, vaddr_t, uint32_t); | | 228 | void cpu_intr(int, vaddr_t, uint32_t); |
227 | | | 229 | |
228 | /* | | 230 | /* |
229 | * Arguments to hardclock and gatherstats encapsulate the previous | | 231 | * Arguments to hardclock and gatherstats encapsulate the previous |
230 | * machine state in an opaque clockframe. | | 232 | * machine state in an opaque clockframe. |
231 | */ | | 233 | */ |
232 | struct clockframe { | | 234 | struct clockframe { |
233 | vaddr_t pc; /* program counter at time of interrupt */ | | 235 | vaddr_t pc; /* program counter at time of interrupt */ |
234 | uint32_t sr; /* status register at time of interrupt */ | | 236 | uint32_t sr; /* status register at time of interrupt */ |
235 | bool intr; /* interrupted a interrupt */ | | 237 | bool intr; /* interrupted a interrupt */ |
236 | }; | | 238 | }; |
237 | | | 239 | |
238 | /* | | 240 | /* |
239 | * A port must provde CLKF_USERMODE() for use in machine-independent code. | | 241 | * A port must provde CLKF_USERMODE() for use in machine-independent code. |
240 | * These differ on r4000 and r3000 systems; provide them in the | | 242 | * These differ on r4000 and r3000 systems; provide them in the |
241 | * port-dependent file that includes this one, using the macros below. | | 243 | * port-dependent file that includes this one, using the macros below. |
242 | */ | | 244 | */ |
243 | uint32_t cpu_clkf_usermode_mask(void); | | 245 | uint32_t cpu_clkf_usermode_mask(void); |
244 | | | 246 | |
245 | #define CLKF_USERMODE(framep) ((framep)->sr & cpu_clkf_usermode_mask()) | | 247 | #define CLKF_USERMODE(framep) ((framep)->sr & cpu_clkf_usermode_mask()) |
246 | #define CLKF_PC(framep) ((framep)->pc + 0) | | 248 | #define CLKF_PC(framep) ((framep)->pc + 0) |
247 | #define CLKF_INTR(framep) ((framep)->intr + 0) | | 249 | #define CLKF_INTR(framep) ((framep)->intr + 0) |
248 | | | 250 | |
249 | /* | | 251 | /* |
250 | * Misc prototypes and variable declarations. | | 252 | * Misc prototypes and variable declarations. |
251 | */ | | 253 | */ |
252 | #define LWP_PC(l) cpu_lwp_pc(l) | | 254 | #define LWP_PC(l) cpu_lwp_pc(l) |
253 | | | 255 | |
254 | struct proc; | | 256 | struct proc; |
255 | struct lwp; | | 257 | struct lwp; |
256 | struct pcb; | | 258 | struct pcb; |
257 | struct reg; | | 259 | struct reg; |
258 | | | 260 | |
259 | /* | | 261 | /* |
260 | * Notify the current lwp (l) that it has a signal pending, | | 262 | * Notify the current lwp (l) that it has a signal pending, |
261 | * process as soon as possible. | | 263 | * process as soon as possible. |
262 | */ | | 264 | */ |
263 | void cpu_signotify(struct lwp *); | | 265 | void cpu_signotify(struct lwp *); |
264 | | | 266 | |
265 | /* | | 267 | /* |
266 | * Give a profiling tick to the current process when the user profiling | | 268 | * Give a profiling tick to the current process when the user profiling |
267 | * buffer pages are invalid. On the MIPS, request an ast to send us | | 269 | * buffer pages are invalid. On the MIPS, request an ast to send us |
268 | * through trap, marking the proc as needing a profiling tick. | | 270 | * through trap, marking the proc as needing a profiling tick. |
269 | */ | | 271 | */ |
270 | void cpu_need_proftick(struct lwp *); | | 272 | void cpu_need_proftick(struct lwp *); |
271 | | | 273 | |
272 | /* VM related hooks */ | | 274 | /* VM related hooks */ |
273 | void cpu_boot_secondary_processors(void); | | 275 | void cpu_boot_secondary_processors(void); |
274 | void * cpu_uarea_alloc(bool); | | 276 | void * cpu_uarea_alloc(bool); |
275 | bool cpu_uarea_free(void *); | | 277 | bool cpu_uarea_free(void *); |
276 | void cpu_proc_fork(struct proc *, struct proc *); | | 278 | void cpu_proc_fork(struct proc *, struct proc *); |
277 | vaddr_t cpu_lwp_pc(struct lwp *); | | 279 | vaddr_t cpu_lwp_pc(struct lwp *); |
278 | #ifdef _LP64 | | 280 | #ifdef _LP64 |
279 | void cpu_vmspace_exec(struct lwp *, vaddr_t, vaddr_t); | | 281 | void cpu_vmspace_exec(struct lwp *, vaddr_t, vaddr_t); |
280 | #endif | | 282 | #endif |
281 | | | 283 | |
282 | #endif /* _KERNEL */ | | 284 | #endif /* _KERNEL */ |
283 | | | 285 | |
284 | /* | | 286 | /* |
285 | * CTL_MACHDEP definitions. | | 287 | * CTL_MACHDEP definitions. |
286 | */ | | 288 | */ |
287 | #define CPU_CONSDEV 1 /* dev_t: console terminal device */ | | 289 | #define CPU_CONSDEV 1 /* dev_t: console terminal device */ |
288 | #define CPU_BOOTED_KERNEL 2 /* string: booted kernel name */ | | 290 | #define CPU_BOOTED_KERNEL 2 /* string: booted kernel name */ |
289 | #define CPU_ROOT_DEVICE 3 /* string: root device name */ | | 291 | #define CPU_ROOT_DEVICE 3 /* string: root device name */ |
290 | #define CPU_LLSC 4 /* OS/CPU supports LL/SC instruction */ | | 292 | #define CPU_LLSC 4 /* OS/CPU supports LL/SC instruction */ |
291 | #define CPU_LMMI 5 /* Loongson multimedia instructions */ | | 293 | #define CPU_LMMI 5 /* Loongson multimedia instructions */ |
292 | | | 294 | |
293 | #endif /* _CPU_H_ */ | | 295 | #endif /* _CPU_H_ */ |