1 1.125 mrg /* $NetBSD: cpu.h,v 1.125 2025/09/20 06:54:52 mrg Exp $ */ 2 1.1 ws 3 1.1 ws /* 4 1.5 ws * Copyright (C) 1999 Wolfgang Solfrank. 5 1.5 ws * Copyright (C) 1999 TooLs GmbH. 6 1.9 matt * Copyright (C) 1995-1997 Wolfgang Solfrank. 7 1.9 matt * Copyright (C) 1995-1997 TooLs GmbH. 8 1.1 ws * All rights reserved. 9 1.1 ws * 10 1.1 ws * Redistribution and use in source and binary forms, with or without 11 1.1 ws * modification, are permitted provided that the following conditions 12 1.1 ws * are met: 13 1.1 ws * 1. Redistributions of source code must retain the above copyright 14 1.1 ws * notice, this list of conditions and the following disclaimer. 15 1.1 ws * 2. Redistributions in binary form must reproduce the above copyright 16 1.1 ws * notice, this list of conditions and the following disclaimer in the 17 1.1 ws * documentation and/or other materials provided with the distribution. 18 1.1 ws * 3. All advertising materials mentioning features or use of this software 19 1.1 ws * must display the following acknowledgement: 20 1.1 ws * This product includes software developed by TooLs GmbH. 21 1.1 ws * 4. The name of TooLs GmbH may not be used to endorse or promote products 22 1.1 ws * derived from this software without specific prior written permission. 23 1.1 ws * 24 1.1 ws * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 25 1.1 ws * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26 1.1 ws * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 1.1 ws * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 1.1 ws * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 1.1 ws * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 30 1.1 ws * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 1.1 ws * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 1.1 ws * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 33 1.1 ws * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 1.1 ws */ 35 1.103 chs 36 1.5 ws #ifndef _POWERPC_CPU_H_ 37 1.5 ws #define _POWERPC_CPU_H_ 38 1.1 ws 39 1.27 matt struct cache_info { 40 1.27 matt int dcache_size; 41 1.27 matt int dcache_line_size; 42 1.27 matt int icache_size; 43 1.27 matt int icache_line_size; 44 1.27 matt }; 45 1.27 matt 46 1.73 phx #if defined(_KERNEL) || defined(_KMEMUSER) 47 1.9 matt #if defined(_KERNEL_OPT) 48 1.119 ryo #include "opt_gprof.h" 49 1.83 matt #include "opt_modular.h" 50 1.9 matt #include "opt_multiprocessor.h" 51 1.16 matt #include "opt_ppcarch.h" 52 1.121 rin #include "opt_ppcopts.h" 53 1.9 matt #endif 54 1.9 matt 55 1.73 phx #ifdef _KERNEL 56 1.102 nonaka #include <sys/intr.h> 57 1.72 uebayasi #include <sys/device_if.h> 58 1.72 uebayasi #include <sys/evcnt.h> 59 1.103 chs #include <sys/param.h> 60 1.103 chs #include <sys/kernel.h> 61 1.73 phx #endif 62 1.9 matt 63 1.42 yamt #include <sys/cpu_data.h> 64 1.14 eeh 65 1.116 rin #ifdef _KERNEL 66 1.116 rin #define CI_SAVETEMP (0*CPUSAVE_LEN) 67 1.116 rin #define CI_SAVEDDB (1*CPUSAVE_LEN) 68 1.116 rin #define CI_SAVEIPKDB (2*CPUSAVE_LEN) /* obsolete */ 69 1.116 rin #define CI_SAVEMMU (3*CPUSAVE_LEN) 70 1.116 rin #define CI_SAVEMAX (4*CPUSAVE_LEN) 71 1.116 rin #define CPUSAVE_LEN 8 72 1.116 rin #if defined(PPC_BOOKE) && !defined(MODULAR) && !defined(_MODULE) 73 1.116 rin #define CPUSAVE_SIZE 128 74 1.116 rin #else 75 1.116 rin #define CPUSAVE_SIZE (CI_SAVEMAX*CPUSAVE_LEN) 76 1.116 rin CTASSERT(CPUSAVE_SIZE >= 128); 77 1.116 rin #endif 78 1.116 rin #define CPUSAVE_R28 0 /* where r28 gets saved */ 79 1.116 rin #define CPUSAVE_R29 1 /* where r29 gets saved */ 80 1.116 rin #define CPUSAVE_R30 2 /* where r30 gets saved */ 81 1.116 rin #define CPUSAVE_R31 3 /* where r31 gets saved */ 82 1.116 rin #define CPUSAVE_DEAR 4 /* where IBM4XX SPR_DEAR gets saved */ 83 1.116 rin #define CPUSAVE_DAR 4 /* where OEA SPR_DAR gets saved */ 84 1.116 rin #define CPUSAVE_ESR 5 /* where IBM4XX SPR_ESR gets saved */ 85 1.116 rin #define CPUSAVE_DSISR 5 /* where OEA SPR_DSISR gets saved */ 86 1.116 rin #define CPUSAVE_SRR0 6 /* where SRR0 gets saved */ 87 1.116 rin #define CPUSAVE_SRR1 7 /* where SRR1 gets saved */ 88 1.116 rin #endif /* _KERNEL */ 89 1.116 rin 90 1.9 matt struct cpu_info { 91 1.42 yamt struct cpu_data ci_data; /* MI per-cpu data */ 92 1.73 phx #ifdef _KERNEL 93 1.74 matt device_t ci_dev; /* device of corresponding cpu */ 94 1.74 matt struct cpu_softc *ci_softc; /* private cpu info */ 95 1.23 thorpej struct lwp *ci_curlwp; /* current owner of the processor */ 96 1.110 ad struct lwp *ci_onproc; /* current user LWP / kthread */ 97 1.9 matt struct pcb *ci_curpcb; 98 1.38 matt struct pmap *ci_curpm; 99 1.117 thorpej #if defined(PPC_OEA) || defined(PPC_OEA601) || defined(PPC_OEA64) || \ 100 1.117 thorpej defined(PPC_OEA64_BRIDGE) || defined(MODULAR) || defined(_MODULE) 101 1.117 thorpej void *ci_battable; /* BAT table in use by this CPU */ 102 1.117 thorpej #endif 103 1.80 matt struct lwp *ci_softlwps[SOFTINT_COUNT]; 104 1.77 matt int ci_cpuid; /* from SPR_PIR */ 105 1.9 matt 106 1.57 rjs int ci_want_resched; 107 1.74 matt volatile uint64_t ci_lastintr; 108 1.28 matt volatile u_long ci_lasttb; 109 1.28 matt volatile int ci_tickspending; 110 1.50 freza volatile int ci_cpl; 111 1.50 freza volatile int ci_iactive; 112 1.60 ad volatile int ci_idepth; 113 1.84 matt union { 114 1.84 matt #if !defined(PPC_BOOKE) && !defined(_MODULE) 115 1.84 matt volatile imask_t un1_ipending; 116 1.84 matt #define ci_ipending ci_un1.un1_ipending 117 1.74 matt #endif 118 1.84 matt uint64_t un1_pad64; 119 1.84 matt } ci_un1; 120 1.77 matt volatile uint32_t ci_pending_ipis; 121 1.53 ad int ci_mtx_oldspl; 122 1.53 ad int ci_mtx_count; 123 1.118 rin #if defined(PPC_IBM4XX) || \ 124 1.118 rin ((defined(MODULAR) || defined(_MODULE)) && !defined(_LP64)) 125 1.9 matt char *ci_intstk; 126 1.68 matt #endif 127 1.116 rin 128 1.84 matt register_t ci_savearea[CPUSAVE_SIZE]; 129 1.118 rin #if defined(PPC_BOOKE) || \ 130 1.118 rin ((defined(MODULAR) || defined(_MODULE)) && !defined(_LP64)) 131 1.86 matt uint32_t ci_pmap_asid_cur; 132 1.92 matt union pmap_segtab *ci_pmap_segtabs[2]; 133 1.74 matt #define ci_pmap_kern_segtab ci_pmap_segtabs[0] 134 1.74 matt #define ci_pmap_user_segtab ci_pmap_segtabs[1] 135 1.74 matt struct pmap_tlb_info *ci_tlb_info; 136 1.118 rin #endif /* PPC_BOOKE || ((MODULAR || _MODULE) && !_LP64) */ 137 1.124 skrll struct cache_info ci_ci; 138 1.40 matt void *ci_sysmon_cookie; 139 1.43 matt void (*ci_idlespin)(void); 140 1.44 briggs uint32_t ci_khz; 141 1.25 matt struct evcnt ci_ev_clock; /* clock intrs */ 142 1.50 freza struct evcnt ci_ev_statclock; /* stat clock */ 143 1.9 matt struct evcnt ci_ev_traps; /* calls to trap() */ 144 1.9 matt struct evcnt ci_ev_kdsi; /* kernel DSI traps */ 145 1.9 matt struct evcnt ci_ev_udsi; /* user DSI traps */ 146 1.9 matt struct evcnt ci_ev_udsi_fatal; /* user DSI trap failures */ 147 1.33 matt struct evcnt ci_ev_kisi; /* kernel ISI traps */ 148 1.9 matt struct evcnt ci_ev_isi; /* user ISI traps */ 149 1.9 matt struct evcnt ci_ev_isi_fatal; /* user ISI trap failures */ 150 1.9 matt struct evcnt ci_ev_pgm; /* user PGM traps */ 151 1.75 matt struct evcnt ci_ev_debug; /* user debug traps */ 152 1.9 matt struct evcnt ci_ev_fpu; /* FPU traps */ 153 1.9 matt struct evcnt ci_ev_fpusw; /* FPU context switch */ 154 1.9 matt struct evcnt ci_ev_ali; /* Alignment traps */ 155 1.9 matt struct evcnt ci_ev_ali_fatal; /* Alignment fatal trap */ 156 1.9 matt struct evcnt ci_ev_scalls; /* system call traps */ 157 1.9 matt struct evcnt ci_ev_vec; /* Altivec traps */ 158 1.9 matt struct evcnt ci_ev_vecsw; /* Altivec context switches */ 159 1.16 matt struct evcnt ci_ev_umchk; /* user MCHK events */ 160 1.59 garbled struct evcnt ci_ev_ipi; /* IPIs received */ 161 1.74 matt struct evcnt ci_ev_tlbmiss_soft; /* tlb miss (no trap) */ 162 1.74 matt struct evcnt ci_ev_dtlbmiss_hard; /* data tlb miss (trap) */ 163 1.74 matt struct evcnt ci_ev_itlbmiss_hard; /* instruction tlb miss (trap) */ 164 1.119 ryo #if defined(GPROF) && defined(MULTIPROCESSOR) 165 1.119 ryo struct gmonparam *ci_gmon; /* MI per-cpu GPROF */ 166 1.119 ryo #endif 167 1.73 phx #endif /* _KERNEL */ 168 1.9 matt }; 169 1.73 phx #endif /* _KERNEL || _KMEMUSER */ 170 1.73 phx 171 1.73 phx #ifdef _KERNEL 172 1.9 matt 173 1.83 matt #if defined(MULTIPROCESSOR) && !defined(_MODULE) 174 1.59 garbled struct cpu_hatch_data { 175 1.87 matt int hatch_running; 176 1.87 matt device_t hatch_self; 177 1.87 matt struct cpu_info *hatch_ci; 178 1.87 matt uint32_t hatch_tbu; 179 1.87 matt uint32_t hatch_tbl; 180 1.104 macallan #if defined(PPC_OEA64_BRIDGE) || defined (_ARCH_PPC64) 181 1.104 macallan uint64_t hatch_hid0; 182 1.106 macallan uint64_t hatch_hid1; 183 1.105 macallan uint64_t hatch_hid4; 184 1.105 macallan uint64_t hatch_hid5; 185 1.104 macallan #else 186 1.87 matt uint32_t hatch_hid0; 187 1.104 macallan #endif 188 1.87 matt uint32_t hatch_pir; 189 1.87 matt #if defined(PPC_OEA) || defined(PPC_OEA64_BRIDGE) 190 1.87 matt uintptr_t hatch_asr; 191 1.87 matt uintptr_t hatch_sdr1; 192 1.87 matt uint32_t hatch_sr[16]; 193 1.94 kiyohara uintptr_t hatch_ibatu[8], hatch_ibatl[8]; 194 1.94 kiyohara uintptr_t hatch_dbatu[8], hatch_dbatl[8]; 195 1.87 matt #endif 196 1.87 matt #if defined(PPC_BOOKE) 197 1.87 matt vaddr_t hatch_sp; 198 1.95 matt u_int hatch_tlbidx; 199 1.87 matt #endif 200 1.87 matt }; 201 1.87 matt 202 1.87 matt struct cpuset_info { 203 1.97 matt kcpuset_t *cpus_running; 204 1.97 matt kcpuset_t *cpus_hatched; 205 1.97 matt kcpuset_t *cpus_paused; 206 1.97 matt kcpuset_t *cpus_resumed; 207 1.97 matt kcpuset_t *cpus_halted; 208 1.59 garbled }; 209 1.87 matt 210 1.97 matt extern struct cpuset_info cpuset_info; 211 1.83 matt #endif /* MULTIPROCESSOR && !_MODULE */ 212 1.59 garbled 213 1.83 matt #if defined(MULTIPROCESSOR) || defined(_MODULE) 214 1.83 matt #define cpu_number() (curcpu()->ci_index + 0) 215 1.9 matt 216 1.9 matt #define CPU_IS_PRIMARY(ci) ((ci)->ci_cpuid == 0) 217 1.83 matt #define CPU_INFO_ITERATOR int 218 1.83 matt #define CPU_INFO_FOREACH(cii, ci) \ 219 1.103 chs cii = 0, ci = &cpu_info[0]; cii < (ncpu ? ncpu : 1); cii++, ci++ 220 1.18 chs 221 1.9 matt #else 222 1.9 matt #define cpu_number() 0 223 1.9 matt 224 1.83 matt #define CPU_IS_PRIMARY(ci) true 225 1.83 matt #define CPU_INFO_ITERATOR int 226 1.83 matt #define CPU_INFO_FOREACH(cii, ci) \ 227 1.98 nisimura (void)cii, ci = curcpu(); ci != NULL; ci = NULL 228 1.18 chs 229 1.83 matt #endif /* MULTIPROCESSOR || _MODULE */ 230 1.9 matt 231 1.25 matt extern struct cpu_info cpu_info[]; 232 1.25 matt 233 1.77 matt static __inline struct cpu_info * curcpu(void) __pure; 234 1.120 ryo static __inline __always_inline struct cpu_info * 235 1.25 matt curcpu(void) 236 1.25 matt { 237 1.25 matt struct cpu_info *ci; 238 1.25 matt 239 1.78 matt __asm volatile ("mfsprg0 %0" : "=r"(ci)); 240 1.25 matt return ci; 241 1.25 matt } 242 1.25 matt 243 1.77 matt register struct lwp *powerpc_curlwp __asm("r13"); 244 1.77 matt #define curlwp powerpc_curlwp 245 1.25 matt #define curpcb (curcpu()->ci_curpcb) 246 1.38 matt #define curpm (curcpu()->ci_curpm) 247 1.25 matt 248 1.47 perry static __inline register_t 249 1.18 chs mfmsr(void) 250 1.18 chs { 251 1.20 matt register_t msr; 252 1.18 chs 253 1.46 perry __asm volatile ("mfmsr %0" : "=r"(msr)); 254 1.18 chs return msr; 255 1.18 chs } 256 1.18 chs 257 1.47 perry static __inline void 258 1.20 matt mtmsr(register_t msr) 259 1.18 chs { 260 1.74 matt //KASSERT(msr & PSL_CE); 261 1.74 matt //KASSERT(msr & PSL_DE); 262 1.46 perry __asm volatile ("mtmsr %0" : : "r"(msr)); 263 1.19 chs } 264 1.19 chs 265 1.84 matt #if !defined(_MODULE) 266 1.47 perry static __inline uint32_t 267 1.19 chs mftbl(void) 268 1.19 chs { 269 1.19 chs uint32_t tbl; 270 1.19 chs 271 1.46 perry __asm volatile ( 272 1.29 hannken #ifdef PPC_IBM403 273 1.74 matt " mftblo %[tbl]" "\n" 274 1.74 matt #elif defined(PPC_BOOKE) 275 1.74 matt " mfspr %[tbl],268" "\n" 276 1.29 hannken #else 277 1.74 matt " mftbl %[tbl]" "\n" 278 1.29 hannken #endif 279 1.74 matt : [tbl] "=r" (tbl)); 280 1.29 hannken 281 1.19 chs return tbl; 282 1.19 chs } 283 1.19 chs 284 1.47 perry static __inline uint64_t 285 1.19 chs mftb(void) 286 1.19 chs { 287 1.19 chs uint64_t tb; 288 1.32 matt 289 1.96 macallan #ifdef _ARCH_PPC64 290 1.46 perry __asm volatile ("mftb %0" : "=r"(tb)); 291 1.32 matt #else 292 1.19 chs int tmp; 293 1.19 chs 294 1.46 perry __asm volatile ( 295 1.29 hannken #ifdef PPC_IBM403 296 1.74 matt "1: mftbhi %[tb]" "\n" 297 1.74 matt " mftblo %L[tb]" "\n" 298 1.74 matt " mftbhi %[tmp]" "\n" 299 1.74 matt #elif defined(PPC_BOOKE) 300 1.74 matt "1: mfspr %[tb],269" "\n" 301 1.74 matt " mfspr %L[tb],268" "\n" 302 1.74 matt " mfspr %[tmp],269" "\n" 303 1.29 hannken #else 304 1.74 matt "1: mftbu %[tb]" "\n" 305 1.74 matt " mftb %L[tb]" "\n" 306 1.74 matt " mftbu %[tmp]" "\n" 307 1.74 matt #endif 308 1.74 matt " cmplw %[tb],%[tmp]" "\n" 309 1.74 matt " bne- 1b" "\n" 310 1.74 matt : [tb] "=r" (tb), [tmp] "=r"(tmp) 311 1.74 matt :: "cr0"); 312 1.32 matt #endif 313 1.29 hannken 314 1.19 chs return tb; 315 1.24 kleink } 316 1.24 kleink 317 1.47 perry static __inline uint32_t 318 1.24 kleink mfrtcl(void) 319 1.24 kleink { 320 1.24 kleink uint32_t rtcl; 321 1.24 kleink 322 1.46 perry __asm volatile ("mfrtcl %0" : "=r"(rtcl)); 323 1.24 kleink return rtcl; 324 1.24 kleink } 325 1.24 kleink 326 1.47 perry static __inline void 327 1.24 kleink mfrtc(uint32_t *rtcp) 328 1.24 kleink { 329 1.24 kleink uint32_t tmp; 330 1.24 kleink 331 1.46 perry __asm volatile ( 332 1.74 matt "1: mfrtcu %[rtcu]" "\n" 333 1.74 matt " mfrtcl %[rtcl]" "\n" 334 1.74 matt " mfrtcu %[tmp]" "\n" 335 1.74 matt " cmplw %[rtcu],%[tmp]" "\n" 336 1.74 matt " bne- 1b" 337 1.74 matt : [rtcu] "=r"(rtcp[0]), [rtcl] "=r"(rtcp[1]), [tmp] "=r"(tmp) 338 1.74 matt :: "cr0"); 339 1.19 chs } 340 1.99 macallan 341 1.99 macallan static __inline uint64_t 342 1.99 macallan rtc_nanosecs(void) 343 1.99 macallan { 344 1.124 skrll /* 345 1.99 macallan * 601 RTC/DEC registers share clock of 7.8125 MHz, 128 ns per tick. 346 1.99 macallan * DEC has max of 25 bits, FFFFFF => 2.14748352 seconds. 347 1.99 macallan * RTCU is seconds, 32 bits. 348 1.99 macallan * RTCL is nano-seconds, 23 bit counter from 0 - 999,999,872 (999,999,999 - 128 ns) 349 1.99 macallan */ 350 1.99 macallan uint64_t cycles; 351 1.99 macallan uint32_t tmp[2]; 352 1.99 macallan 353 1.99 macallan mfrtc(tmp); 354 1.99 macallan 355 1.99 macallan cycles = tmp[0] * 1000000000; 356 1.99 macallan cycles += (tmp[1] >> 7); 357 1.99 macallan 358 1.99 macallan return cycles; 359 1.99 macallan } 360 1.84 matt #endif /* !_MODULE */ 361 1.19 chs 362 1.47 perry static __inline uint32_t 363 1.19 chs mfpvr(void) 364 1.19 chs { 365 1.19 chs uint32_t pvr; 366 1.19 chs 367 1.46 perry __asm volatile ("mfpvr %0" : "=r"(pvr)); 368 1.19 chs return (pvr); 369 1.18 chs } 370 1.18 chs 371 1.84 matt #ifdef _MODULE 372 1.84 matt extern const char __CPU_MAXNUM; 373 1.84 matt /* 374 1.84 matt * Make with 0xffff to force a R_PPC_ADDR16_LO without the 375 1.84 matt * corresponding R_PPC_ADDR16_HI relocation. 376 1.84 matt */ 377 1.84 matt #define CPU_MAXNUM (((uintptr_t)&__CPU_MAXNUM)&0xffff) 378 1.84 matt #endif /* _MODULE */ 379 1.84 matt 380 1.83 matt #if !defined(_MODULE) 381 1.93 matt extern char *booted_kernel; 382 1.9 matt extern int powersave; 383 1.9 matt extern int cpu_timebase; 384 1.9 matt extern int cpu_printfataltraps; 385 1.16 matt 386 1.83 matt struct cpu_info * 387 1.83 matt cpu_attach_common(device_t, int); 388 1.83 matt void cpu_setup(device_t, struct cpu_info *); 389 1.83 matt void cpu_identify(char *, size_t); 390 1.83 matt void cpu_probe_cache(void); 391 1.85 matt 392 1.83 matt void dcache_wb_page(vaddr_t); 393 1.83 matt void dcache_wbinv_page(vaddr_t); 394 1.83 matt void dcache_inv_page(vaddr_t); 395 1.83 matt void dcache_zero_page(vaddr_t); 396 1.83 matt void icache_inv_page(vaddr_t); 397 1.83 matt void dcache_wb(vaddr_t, vsize_t); 398 1.83 matt void dcache_wbinv(vaddr_t, vsize_t); 399 1.83 matt void dcache_inv(vaddr_t, vsize_t); 400 1.83 matt void icache_inv(vaddr_t, vsize_t); 401 1.85 matt 402 1.88 matt void * mapiodev(paddr_t, psize_t, bool); 403 1.83 matt void unmapiodev(vaddr_t, vsize_t); 404 1.9 matt 405 1.125 mrg struct trapframe; 406 1.115 rin int emulate_mxmsr(struct lwp *, struct trapframe *, uint32_t); 407 1.115 rin 408 1.59 garbled #ifdef MULTIPROCESSOR 409 1.83 matt int md_setup_trampoline(volatile struct cpu_hatch_data *, 410 1.83 matt struct cpu_info *); 411 1.83 matt void md_presync_timebase(volatile struct cpu_hatch_data *); 412 1.83 matt void md_start_timebase(volatile struct cpu_hatch_data *); 413 1.83 matt void md_sync_timebase(volatile struct cpu_hatch_data *); 414 1.83 matt void md_setup_interrupts(void); 415 1.83 matt int cpu_spinup(device_t, struct cpu_info *); 416 1.83 matt register_t 417 1.83 matt cpu_hatch(void); 418 1.83 matt void cpu_spinup_trampoline(void); 419 1.83 matt void cpu_boot_secondary_processors(void); 420 1.101 nonaka void cpu_halt(void); 421 1.101 nonaka void cpu_halt_others(void); 422 1.101 nonaka void cpu_pause(struct trapframe *); 423 1.101 nonaka void cpu_pause_others(void); 424 1.101 nonaka void cpu_resume(cpuid_t); 425 1.101 nonaka void cpu_resume_others(void); 426 1.101 nonaka int cpu_is_paused(int); 427 1.101 nonaka void cpu_debug_dump(void); 428 1.83 matt #endif /* MULTIPROCESSOR */ 429 1.83 matt #endif /* !_MODULE */ 430 1.83 matt 431 1.83 matt #define cpu_proc_fork(p1, p2) 432 1.59 garbled 433 1.111 macallan #ifndef __HIDE_DELAY 434 1.9 matt #define DELAY(n) delay(n) 435 1.83 matt void delay(unsigned int); 436 1.111 macallan #endif /* __HIDE_DELAY */ 437 1.83 matt 438 1.83 matt #define CLKF_USERMODE(cf) cpu_clkf_usermode(cf) 439 1.83 matt #define CLKF_PC(cf) cpu_clkf_pc(cf) 440 1.83 matt #define CLKF_INTR(cf) cpu_clkf_intr(cf) 441 1.83 matt 442 1.83 matt bool cpu_clkf_usermode(const struct clockframe *); 443 1.83 matt vaddr_t cpu_clkf_pc(const struct clockframe *); 444 1.83 matt bool cpu_clkf_intr(const struct clockframe *); 445 1.83 matt 446 1.83 matt #define LWP_PC(l) cpu_lwp_pc(l) 447 1.83 matt 448 1.83 matt vaddr_t cpu_lwp_pc(struct lwp *); 449 1.9 matt 450 1.86 matt void cpu_ast(struct lwp *, struct cpu_info *); 451 1.79 matt void * cpu_uarea_alloc(bool); 452 1.79 matt bool cpu_uarea_free(void *); 453 1.77 matt void cpu_signotify(struct lwp *); 454 1.77 matt void cpu_need_proftick(struct lwp *); 455 1.9 matt 456 1.81 matt void cpu_fixup_stubs(void); 457 1.81 matt 458 1.83 matt #if !defined(PPC_IBM4XX) && !defined(PPC_BOOKE) && !defined(_MODULE) 459 1.85 matt int cpu_get_dfs(void); 460 1.85 matt void cpu_set_dfs(int); 461 1.85 matt 462 1.83 matt void oea_init(void (*)(void)); 463 1.83 matt void oea_startup(const char *); 464 1.83 matt void oea_dumpsys(void); 465 1.83 matt void oea_install_extint(void (*)(void)); 466 1.89 kiyohara paddr_t kvtop(void *); 467 1.16 matt 468 1.16 matt extern paddr_t msgbuf_paddr; 469 1.16 matt extern int cpu_altivec; 470 1.16 matt #endif 471 1.16 matt 472 1.121 rin #ifdef PPC_NO_UNALIGNED 473 1.121 rin bool fix_unaligned(struct trapframe *, ksiginfo_t *); 474 1.121 rin #endif 475 1.121 rin 476 1.9 matt #endif /* _KERNEL */ 477 1.9 matt 478 1.61 garbled /* XXX The below breaks unified pmap on ppc32 */ 479 1.61 garbled 480 1.83 matt #if !defined(CACHELINESIZE) && !defined(_MODULE) \ 481 1.83 matt && (defined(_KERNEL) || defined(_STANDALONE)) 482 1.83 matt #if defined(PPC_IBM403) 483 1.62 garbled #define CACHELINESIZE 16 484 1.62 garbled #define MAXCACHELINESIZE 16 485 1.83 matt #elif defined (PPC_OEA64_BRIDGE) 486 1.62 garbled #define CACHELINESIZE 128 487 1.62 garbled #define MAXCACHELINESIZE 128 488 1.51 sanjayl #else 489 1.62 garbled #define CACHELINESIZE 32 490 1.62 garbled #define MAXCACHELINESIZE 32 491 1.51 sanjayl #endif /* PPC_OEA64_BRIDGE */ 492 1.29 hannken #endif 493 1.10 matt 494 1.83 matt void __syncicache(void *, size_t); 495 1.14 eeh 496 1.5 ws /* 497 1.5 ws * CTL_MACHDEP definitions. 498 1.5 ws */ 499 1.9 matt #define CPU_CACHELINE 1 500 1.9 matt #define CPU_TIMEBASE 2 501 1.9 matt #define CPU_CPUTEMP 3 502 1.9 matt #define CPU_PRINTFATALTRAPS 4 503 1.14 eeh #define CPU_CACHEINFO 5 504 1.16 matt #define CPU_ALTIVEC 6 505 1.16 matt #define CPU_MODEL 7 506 1.58 nisimura #define CPU_POWERSAVE 8 /* int: use CPU powersave mode */ 507 1.58 nisimura #define CPU_BOOTED_DEVICE 9 /* string: device we booted from */ 508 1.58 nisimura #define CPU_BOOTED_KERNEL 10 /* string: kernel we booted */ 509 1.90 matt #define CPU_EXECPROT 11 /* bool: PROT_EXEC works */ 510 1.114 rin #define CPU_FPU 12 511 1.122 rin #define CPU_NO_UNALIGNED 13 /* No HW support for unaligned access */ 512 1.1 ws 513 1.5 ws #endif /* _POWERPC_CPU_H_ */ 514