2 * PowerPC CPU initialization for qemu.
4 * Copyright (c) 2003-2007 Jocelyn Mayer
5 * Copyright 2011 Freescale Semiconductor, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #include "qemu/osdep.h"
22 #include "disas/dis-asm.h"
23 #include "exec/gdbstub.h"
25 #include "sysemu/cpus.h"
26 #include "sysemu/hw_accel.h"
27 #include "sysemu/tcg.h"
28 #include "cpu-models.h"
29 #include "mmu-hash32.h"
30 #include "mmu-hash64.h"
31 #include "qemu/error-report.h"
32 #include "qemu/module.h"
33 #include "qemu/qemu-print.h"
34 #include "qapi/error.h"
35 #include "qapi/qmp/qnull.h"
36 #include "qapi/visitor.h"
37 #include "hw/qdev-properties.h"
38 #include "hw/ppc/ppc.h"
39 #include "mmu-book3s-v3.h"
40 #include "qemu/cutils.h"
41 #include "disas/capstone.h"
42 #include "fpu/softfloat.h"
43 #include "qapi/qapi-commands-machine-target.h"
45 #include "helper_regs.h"
48 #include "power8-pmu.h"
50 /* #define PPC_DEBUG_SPR */
51 /* #define USE_APPLE_GDB */
53 static inline void vscr_init(CPUPPCState
*env
, uint32_t val
)
55 /* Altivec always uses round-to-nearest */
56 set_float_rounding_mode(float_round_nearest_even
, &env
->vec_status
);
57 ppc_store_vscr(env
, val
);
63 * Register an SPR with all the callbacks required for tcg,
64 * and the ID number for KVM.
66 * The reason for the conditional compilation is that the tcg functions
67 * may be compiled out, and the system kvm header may not be available
68 * for supplying the ID numbers. This is ugly, but the best we can do.
72 # define USR_ARG(X) X,
73 # ifdef CONFIG_USER_ONLY
76 # define SYS_ARG(X) X,
83 # define KVM_ARG(X) X,
88 typedef void spr_callback(DisasContext
*, int, int);
90 static void _spr_register(CPUPPCState
*env
, int num
, const char *name
,
91 USR_ARG(spr_callback
*uea_read
)
92 USR_ARG(spr_callback
*uea_write
)
93 SYS_ARG(spr_callback
*oea_read
)
94 SYS_ARG(spr_callback
*oea_write
)
95 SYS_ARG(spr_callback
*hea_read
)
96 SYS_ARG(spr_callback
*hea_write
)
97 KVM_ARG(uint64_t one_reg_id
)
98 target_ulong initial_value
)
100 ppc_spr_t
*spr
= &env
->spr_cb
[num
];
102 /* No SPR should be registered twice. */
103 assert(spr
->name
== NULL
);
104 assert(name
!= NULL
);
107 spr
->default_value
= initial_value
;
108 env
->spr
[num
] = initial_value
;
111 spr
->uea_read
= uea_read
;
112 spr
->uea_write
= uea_write
;
113 # ifndef CONFIG_USER_ONLY
114 spr
->oea_read
= oea_read
;
115 spr
->oea_write
= oea_write
;
116 spr
->hea_read
= hea_read
;
117 spr
->hea_write
= hea_write
;
121 spr
->one_reg_id
= one_reg_id
;
125 /* spr_register_kvm_hv passes all required arguments. */
126 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
127 oea_read, oea_write, hea_read, hea_write, \
128 one_reg_id, initial_value) \
129 _spr_register(env, num, name, \
130 USR_ARG(uea_read) USR_ARG(uea_write) \
131 SYS_ARG(oea_read) SYS_ARG(oea_write) \
132 SYS_ARG(hea_read) SYS_ARG(hea_write) \
133 KVM_ARG(one_reg_id) initial_value)
135 /* spr_register_kvm duplicates the oea callbacks to the hea callbacks. */
136 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
137 oea_read, oea_write, one_reg_id, ival) \
138 spr_register_kvm_hv(env, num, name, uea_read, uea_write, oea_read, \
139 oea_write, oea_read, oea_write, one_reg_id, ival)
141 /* spr_register_hv and spr_register are similar, except there is no kvm id. */
142 #define spr_register_hv(env, num, name, uea_read, uea_write, \
143 oea_read, oea_write, hea_read, hea_write, ival) \
144 spr_register_kvm_hv(env, num, name, uea_read, uea_write, oea_read, \
145 oea_write, hea_read, hea_write, 0, ival)
147 #define spr_register(env, num, name, uea_read, uea_write, \
148 oea_read, oea_write, ival) \
149 spr_register_kvm(env, num, name, uea_read, uea_write, \
150 oea_read, oea_write, 0, ival)
152 /* Generic PowerPC SPRs */
153 static void register_generic_sprs(PowerPCCPU
*cpu
)
155 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
156 CPUPPCState
*env
= &cpu
->env
;
158 /* Integer processing */
159 spr_register(env
, SPR_XER
, "XER",
160 &spr_read_xer
, &spr_write_xer
,
161 &spr_read_xer
, &spr_write_xer
,
164 spr_register(env
, SPR_LR
, "LR",
165 &spr_read_lr
, &spr_write_lr
,
166 &spr_read_lr
, &spr_write_lr
,
168 spr_register(env
, SPR_CTR
, "CTR",
169 &spr_read_ctr
, &spr_write_ctr
,
170 &spr_read_ctr
, &spr_write_ctr
,
172 /* Interrupt processing */
173 spr_register(env
, SPR_SRR0
, "SRR0",
174 SPR_NOACCESS
, SPR_NOACCESS
,
175 &spr_read_generic
, &spr_write_generic
,
177 spr_register(env
, SPR_SRR1
, "SRR1",
178 SPR_NOACCESS
, SPR_NOACCESS
,
179 &spr_read_generic
, &spr_write_generic
,
181 /* Processor control */
182 spr_register(env
, SPR_SPRG0
, "SPRG0",
183 SPR_NOACCESS
, SPR_NOACCESS
,
184 &spr_read_generic
, &spr_write_generic
,
186 spr_register(env
, SPR_SPRG1
, "SPRG1",
187 SPR_NOACCESS
, SPR_NOACCESS
,
188 &spr_read_generic
, &spr_write_generic
,
190 spr_register(env
, SPR_SPRG2
, "SPRG2",
191 SPR_NOACCESS
, SPR_NOACCESS
,
192 &spr_read_generic
, &spr_write_generic
,
194 spr_register(env
, SPR_SPRG3
, "SPRG3",
195 SPR_NOACCESS
, SPR_NOACCESS
,
196 &spr_read_generic
, &spr_write_generic
,
199 spr_register(env
, SPR_PVR
, "PVR",
200 /* Linux permits userspace to read PVR */
201 #if defined(CONFIG_LINUX_USER)
207 &spr_read_generic
, SPR_NOACCESS
,
210 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
211 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
212 if (pcc
->svr
& POWERPC_SVR_E500
) {
213 spr_register(env
, SPR_E500_SVR
, "SVR",
214 SPR_NOACCESS
, SPR_NOACCESS
,
215 &spr_read_generic
, SPR_NOACCESS
,
216 pcc
->svr
& ~POWERPC_SVR_E500
);
218 spr_register(env
, SPR_SVR
, "SVR",
219 SPR_NOACCESS
, SPR_NOACCESS
,
220 &spr_read_generic
, SPR_NOACCESS
,
226 spr_register(env
, SPR_VTBL
, "TBL",
227 &spr_read_tbl
, SPR_NOACCESS
,
228 &spr_read_tbl
, SPR_NOACCESS
,
230 spr_register(env
, SPR_TBL
, "TBL",
231 &spr_read_tbl
, SPR_NOACCESS
,
232 &spr_read_tbl
, &spr_write_tbl
,
234 spr_register(env
, SPR_VTBU
, "TBU",
235 &spr_read_tbu
, SPR_NOACCESS
,
236 &spr_read_tbu
, SPR_NOACCESS
,
238 spr_register(env
, SPR_TBU
, "TBU",
239 &spr_read_tbu
, SPR_NOACCESS
,
240 &spr_read_tbu
, &spr_write_tbu
,
244 /* SPR common to all non-embedded PowerPC, including 601 */
245 static void register_ne_601_sprs(CPUPPCState
*env
)
247 /* Exception processing */
248 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
249 SPR_NOACCESS
, SPR_NOACCESS
,
250 &spr_read_generic
, &spr_write_generic
,
251 KVM_REG_PPC_DSISR
, 0x00000000);
252 spr_register_kvm(env
, SPR_DAR
, "DAR",
253 SPR_NOACCESS
, SPR_NOACCESS
,
254 &spr_read_generic
, &spr_write_generic
,
255 KVM_REG_PPC_DAR
, 0x00000000);
257 spr_register(env
, SPR_DECR
, "DECR",
258 SPR_NOACCESS
, SPR_NOACCESS
,
259 &spr_read_decr
, &spr_write_decr
,
263 /* Storage Description Register 1 */
264 static void register_sdr1_sprs(CPUPPCState
*env
)
266 #ifndef CONFIG_USER_ONLY
267 if (env
->has_hv_mode
) {
269 * SDR1 is a hypervisor resource on CPUs which have a
272 spr_register_hv(env
, SPR_SDR1
, "SDR1",
273 SPR_NOACCESS
, SPR_NOACCESS
,
274 SPR_NOACCESS
, SPR_NOACCESS
,
275 &spr_read_generic
, &spr_write_sdr1
,
278 spr_register(env
, SPR_SDR1
, "SDR1",
279 SPR_NOACCESS
, SPR_NOACCESS
,
280 &spr_read_generic
, &spr_write_sdr1
,
287 static void register_low_BATs(CPUPPCState
*env
)
289 #if !defined(CONFIG_USER_ONLY)
290 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
291 SPR_NOACCESS
, SPR_NOACCESS
,
292 &spr_read_ibat
, &spr_write_ibatu
,
294 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
295 SPR_NOACCESS
, SPR_NOACCESS
,
296 &spr_read_ibat
, &spr_write_ibatl
,
298 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
299 SPR_NOACCESS
, SPR_NOACCESS
,
300 &spr_read_ibat
, &spr_write_ibatu
,
302 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
303 SPR_NOACCESS
, SPR_NOACCESS
,
304 &spr_read_ibat
, &spr_write_ibatl
,
306 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
307 SPR_NOACCESS
, SPR_NOACCESS
,
308 &spr_read_ibat
, &spr_write_ibatu
,
310 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
311 SPR_NOACCESS
, SPR_NOACCESS
,
312 &spr_read_ibat
, &spr_write_ibatl
,
314 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
315 SPR_NOACCESS
, SPR_NOACCESS
,
316 &spr_read_ibat
, &spr_write_ibatu
,
318 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
319 SPR_NOACCESS
, SPR_NOACCESS
,
320 &spr_read_ibat
, &spr_write_ibatl
,
322 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
323 SPR_NOACCESS
, SPR_NOACCESS
,
324 &spr_read_dbat
, &spr_write_dbatu
,
326 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
327 SPR_NOACCESS
, SPR_NOACCESS
,
328 &spr_read_dbat
, &spr_write_dbatl
,
330 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
331 SPR_NOACCESS
, SPR_NOACCESS
,
332 &spr_read_dbat
, &spr_write_dbatu
,
334 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
335 SPR_NOACCESS
, SPR_NOACCESS
,
336 &spr_read_dbat
, &spr_write_dbatl
,
338 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
339 SPR_NOACCESS
, SPR_NOACCESS
,
340 &spr_read_dbat
, &spr_write_dbatu
,
342 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
343 SPR_NOACCESS
, SPR_NOACCESS
,
344 &spr_read_dbat
, &spr_write_dbatl
,
346 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
347 SPR_NOACCESS
, SPR_NOACCESS
,
348 &spr_read_dbat
, &spr_write_dbatu
,
350 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
351 SPR_NOACCESS
, SPR_NOACCESS
,
352 &spr_read_dbat
, &spr_write_dbatl
,
359 static void register_high_BATs(CPUPPCState
*env
)
361 #if !defined(CONFIG_USER_ONLY)
362 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
363 SPR_NOACCESS
, SPR_NOACCESS
,
364 &spr_read_ibat_h
, &spr_write_ibatu_h
,
366 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
367 SPR_NOACCESS
, SPR_NOACCESS
,
368 &spr_read_ibat_h
, &spr_write_ibatl_h
,
370 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
371 SPR_NOACCESS
, SPR_NOACCESS
,
372 &spr_read_ibat_h
, &spr_write_ibatu_h
,
374 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
375 SPR_NOACCESS
, SPR_NOACCESS
,
376 &spr_read_ibat_h
, &spr_write_ibatl_h
,
378 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
379 SPR_NOACCESS
, SPR_NOACCESS
,
380 &spr_read_ibat_h
, &spr_write_ibatu_h
,
382 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
383 SPR_NOACCESS
, SPR_NOACCESS
,
384 &spr_read_ibat_h
, &spr_write_ibatl_h
,
386 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
387 SPR_NOACCESS
, SPR_NOACCESS
,
388 &spr_read_ibat_h
, &spr_write_ibatu_h
,
390 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
391 SPR_NOACCESS
, SPR_NOACCESS
,
392 &spr_read_ibat_h
, &spr_write_ibatl_h
,
394 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
395 SPR_NOACCESS
, SPR_NOACCESS
,
396 &spr_read_dbat_h
, &spr_write_dbatu_h
,
398 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
399 SPR_NOACCESS
, SPR_NOACCESS
,
400 &spr_read_dbat_h
, &spr_write_dbatl_h
,
402 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
403 SPR_NOACCESS
, SPR_NOACCESS
,
404 &spr_read_dbat_h
, &spr_write_dbatu_h
,
406 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
407 SPR_NOACCESS
, SPR_NOACCESS
,
408 &spr_read_dbat_h
, &spr_write_dbatl_h
,
410 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
411 SPR_NOACCESS
, SPR_NOACCESS
,
412 &spr_read_dbat_h
, &spr_write_dbatu_h
,
414 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
415 SPR_NOACCESS
, SPR_NOACCESS
,
416 &spr_read_dbat_h
, &spr_write_dbatl_h
,
418 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
419 SPR_NOACCESS
, SPR_NOACCESS
,
420 &spr_read_dbat_h
, &spr_write_dbatu_h
,
422 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
423 SPR_NOACCESS
, SPR_NOACCESS
,
424 &spr_read_dbat_h
, &spr_write_dbatl_h
,
430 /* Softare table search registers */
431 static void register_6xx_7xx_soft_tlb(CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
433 #if !defined(CONFIG_USER_ONLY)
434 env
->nb_tlb
= nb_tlbs
;
435 env
->nb_ways
= nb_ways
;
437 env
->tlb_type
= TLB_6XX
;
438 spr_register(env
, SPR_DMISS
, "DMISS",
439 SPR_NOACCESS
, SPR_NOACCESS
,
440 &spr_read_generic
, SPR_NOACCESS
,
442 spr_register(env
, SPR_DCMP
, "DCMP",
443 SPR_NOACCESS
, SPR_NOACCESS
,
444 &spr_read_generic
, SPR_NOACCESS
,
446 spr_register(env
, SPR_HASH1
, "HASH1",
447 SPR_NOACCESS
, SPR_NOACCESS
,
448 &spr_read_generic
, SPR_NOACCESS
,
450 spr_register(env
, SPR_HASH2
, "HASH2",
451 SPR_NOACCESS
, SPR_NOACCESS
,
452 &spr_read_generic
, SPR_NOACCESS
,
454 spr_register(env
, SPR_IMISS
, "IMISS",
455 SPR_NOACCESS
, SPR_NOACCESS
,
456 &spr_read_generic
, SPR_NOACCESS
,
458 spr_register(env
, SPR_ICMP
, "ICMP",
459 SPR_NOACCESS
, SPR_NOACCESS
,
460 &spr_read_generic
, SPR_NOACCESS
,
462 spr_register(env
, SPR_RPA
, "RPA",
463 SPR_NOACCESS
, SPR_NOACCESS
,
464 &spr_read_generic
, &spr_write_generic
,
469 static void register_745_sprs(CPUPPCState
*env
)
472 spr_register(env
, SPR_SPRG4
, "SPRG4",
473 SPR_NOACCESS
, SPR_NOACCESS
,
474 &spr_read_generic
, &spr_write_generic
,
476 spr_register(env
, SPR_SPRG5
, "SPRG5",
477 SPR_NOACCESS
, SPR_NOACCESS
,
478 &spr_read_generic
, &spr_write_generic
,
480 spr_register(env
, SPR_SPRG6
, "SPRG6",
481 SPR_NOACCESS
, SPR_NOACCESS
,
482 &spr_read_generic
, &spr_write_generic
,
484 spr_register(env
, SPR_SPRG7
, "SPRG7",
485 SPR_NOACCESS
, SPR_NOACCESS
,
486 &spr_read_generic
, &spr_write_generic
,
489 /* Hardware implementation registers */
490 spr_register(env
, SPR_HID0
, "HID0",
491 SPR_NOACCESS
, SPR_NOACCESS
,
492 &spr_read_generic
, &spr_write_generic
,
495 spr_register(env
, SPR_HID1
, "HID1",
496 SPR_NOACCESS
, SPR_NOACCESS
,
497 &spr_read_generic
, &spr_write_generic
,
500 spr_register(env
, SPR_HID2
, "HID2",
501 SPR_NOACCESS
, SPR_NOACCESS
,
502 &spr_read_generic
, &spr_write_generic
,
506 static void register_755_sprs(CPUPPCState
*env
)
508 /* L2 cache control */
509 spr_register(env
, SPR_L2CR
, "L2CR",
510 SPR_NOACCESS
, SPR_NOACCESS
,
511 &spr_read_generic
, spr_access_nop
,
514 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
515 SPR_NOACCESS
, SPR_NOACCESS
,
516 &spr_read_generic
, &spr_write_generic
,
520 /* SPR common to all 7xx PowerPC implementations */
521 static void register_7xx_sprs(CPUPPCState
*env
)
524 spr_register_kvm(env
, SPR_DABR
, "DABR",
525 SPR_NOACCESS
, SPR_NOACCESS
,
526 &spr_read_generic
, &spr_write_generic
,
527 KVM_REG_PPC_DABR
, 0x00000000);
529 spr_register(env
, SPR_IABR
, "IABR",
530 SPR_NOACCESS
, SPR_NOACCESS
,
531 &spr_read_generic
, &spr_write_generic
,
533 /* Cache management */
534 spr_register(env
, SPR_ICTC
, "ICTC",
535 SPR_NOACCESS
, SPR_NOACCESS
,
536 &spr_read_generic
, &spr_write_generic
,
538 /* Performance monitors */
539 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
540 SPR_NOACCESS
, SPR_NOACCESS
,
541 &spr_read_generic
, &spr_write_generic
,
544 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
545 SPR_NOACCESS
, SPR_NOACCESS
,
546 &spr_read_generic
, &spr_write_generic
,
549 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
550 SPR_NOACCESS
, SPR_NOACCESS
,
551 &spr_read_generic
, &spr_write_generic
,
554 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
555 SPR_NOACCESS
, SPR_NOACCESS
,
556 &spr_read_generic
, &spr_write_generic
,
559 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
560 SPR_NOACCESS
, SPR_NOACCESS
,
561 &spr_read_generic
, &spr_write_generic
,
564 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
565 SPR_NOACCESS
, SPR_NOACCESS
,
566 &spr_read_generic
, &spr_write_generic
,
569 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
570 SPR_NOACCESS
, SPR_NOACCESS
,
571 &spr_read_generic
, SPR_NOACCESS
,
574 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
575 &spr_read_ureg
, SPR_NOACCESS
,
576 &spr_read_ureg
, SPR_NOACCESS
,
579 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
580 &spr_read_ureg
, SPR_NOACCESS
,
581 &spr_read_ureg
, SPR_NOACCESS
,
584 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
585 &spr_read_ureg
, SPR_NOACCESS
,
586 &spr_read_ureg
, SPR_NOACCESS
,
589 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
590 &spr_read_ureg
, SPR_NOACCESS
,
591 &spr_read_ureg
, SPR_NOACCESS
,
594 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
595 &spr_read_ureg
, SPR_NOACCESS
,
596 &spr_read_ureg
, SPR_NOACCESS
,
599 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
600 &spr_read_ureg
, SPR_NOACCESS
,
601 &spr_read_ureg
, SPR_NOACCESS
,
604 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
605 &spr_read_ureg
, SPR_NOACCESS
,
606 &spr_read_ureg
, SPR_NOACCESS
,
608 /* External access control */
609 spr_register(env
, SPR_EAR
, "EAR",
610 SPR_NOACCESS
, SPR_NOACCESS
,
611 &spr_read_generic
, &spr_write_generic
,
614 /* Hardware implementation registers */
615 spr_register(env
, SPR_HID0
, "HID0",
616 SPR_NOACCESS
, SPR_NOACCESS
,
617 &spr_read_generic
, &spr_write_generic
,
620 spr_register(env
, SPR_HID1
, "HID1",
621 SPR_NOACCESS
, SPR_NOACCESS
,
622 &spr_read_generic
, &spr_write_generic
,
627 static void register_amr_sprs(CPUPPCState
*env
)
629 #ifndef CONFIG_USER_ONLY
631 * Virtual Page Class Key protection
633 * The AMR is accessible either via SPR 13 or SPR 29. 13 is
634 * userspace accessible, 29 is privileged. So we only need to set
635 * the kvm ONE_REG id on one of them, we use 29
637 spr_register(env
, SPR_UAMR
, "UAMR",
638 &spr_read_generic
, &spr_write_amr
,
639 &spr_read_generic
, &spr_write_amr
,
641 spr_register_kvm_hv(env
, SPR_AMR
, "AMR",
642 SPR_NOACCESS
, SPR_NOACCESS
,
643 &spr_read_generic
, &spr_write_amr
,
644 &spr_read_generic
, &spr_write_generic
,
646 spr_register_kvm_hv(env
, SPR_UAMOR
, "UAMOR",
647 SPR_NOACCESS
, SPR_NOACCESS
,
648 &spr_read_generic
, &spr_write_uamor
,
649 &spr_read_generic
, &spr_write_generic
,
650 KVM_REG_PPC_UAMOR
, 0);
651 spr_register_hv(env
, SPR_AMOR
, "AMOR",
652 SPR_NOACCESS
, SPR_NOACCESS
,
653 SPR_NOACCESS
, SPR_NOACCESS
,
654 &spr_read_generic
, &spr_write_generic
,
656 #endif /* !CONFIG_USER_ONLY */
659 static void register_iamr_sprs(CPUPPCState
*env
)
661 #ifndef CONFIG_USER_ONLY
662 spr_register_kvm_hv(env
, SPR_IAMR
, "IAMR",
663 SPR_NOACCESS
, SPR_NOACCESS
,
664 &spr_read_generic
, &spr_write_iamr
,
665 &spr_read_generic
, &spr_write_generic
,
666 KVM_REG_PPC_IAMR
, 0);
667 #endif /* !CONFIG_USER_ONLY */
669 #endif /* TARGET_PPC64 */
671 static void register_thrm_sprs(CPUPPCState
*env
)
673 /* Thermal management */
674 spr_register(env
, SPR_THRM1
, "THRM1",
675 SPR_NOACCESS
, SPR_NOACCESS
,
676 &spr_read_thrm
, &spr_write_generic
,
679 spr_register(env
, SPR_THRM2
, "THRM2",
680 SPR_NOACCESS
, SPR_NOACCESS
,
681 &spr_read_thrm
, &spr_write_generic
,
684 spr_register(env
, SPR_THRM3
, "THRM3",
685 SPR_NOACCESS
, SPR_NOACCESS
,
686 &spr_read_thrm
, &spr_write_generic
,
690 /* SPR specific to PowerPC 604 implementation */
691 static void register_604_sprs(CPUPPCState
*env
)
693 /* Processor identification */
694 spr_register(env
, SPR_PIR
, "PIR",
695 SPR_NOACCESS
, SPR_NOACCESS
,
696 &spr_read_generic
, &spr_write_pir
,
699 spr_register(env
, SPR_IABR
, "IABR",
700 SPR_NOACCESS
, SPR_NOACCESS
,
701 &spr_read_generic
, &spr_write_generic
,
704 spr_register_kvm(env
, SPR_DABR
, "DABR",
705 SPR_NOACCESS
, SPR_NOACCESS
,
706 &spr_read_generic
, &spr_write_generic
,
707 KVM_REG_PPC_DABR
, 0x00000000);
708 /* Performance counters */
709 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
710 SPR_NOACCESS
, SPR_NOACCESS
,
711 &spr_read_generic
, &spr_write_generic
,
714 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
715 SPR_NOACCESS
, SPR_NOACCESS
,
716 &spr_read_generic
, &spr_write_generic
,
719 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
720 SPR_NOACCESS
, SPR_NOACCESS
,
721 &spr_read_generic
, &spr_write_generic
,
724 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
725 SPR_NOACCESS
, SPR_NOACCESS
,
726 &spr_read_generic
, SPR_NOACCESS
,
729 spr_register(env
, SPR_SDA
, "SDA",
730 SPR_NOACCESS
, SPR_NOACCESS
,
731 &spr_read_generic
, SPR_NOACCESS
,
733 /* External access control */
734 spr_register(env
, SPR_EAR
, "EAR",
735 SPR_NOACCESS
, SPR_NOACCESS
,
736 &spr_read_generic
, &spr_write_generic
,
739 /* Hardware implementation registers */
740 spr_register(env
, SPR_HID0
, "HID0",
741 SPR_NOACCESS
, SPR_NOACCESS
,
742 &spr_read_generic
, &spr_write_generic
,
746 static void register_604e_sprs(CPUPPCState
*env
)
748 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
749 SPR_NOACCESS
, SPR_NOACCESS
,
750 &spr_read_generic
, &spr_write_generic
,
753 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
754 SPR_NOACCESS
, SPR_NOACCESS
,
755 &spr_read_generic
, &spr_write_generic
,
758 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
759 SPR_NOACCESS
, SPR_NOACCESS
,
760 &spr_read_generic
, &spr_write_generic
,
762 /* Hardware implementation registers */
763 spr_register(env
, SPR_HID1
, "HID1",
764 SPR_NOACCESS
, SPR_NOACCESS
,
765 &spr_read_generic
, &spr_write_generic
,
769 /* SPR specific to PowerPC 603 implementation */
770 static void register_603_sprs(CPUPPCState
*env
)
772 /* External access control */
773 spr_register(env
, SPR_EAR
, "EAR",
774 SPR_NOACCESS
, SPR_NOACCESS
,
775 &spr_read_generic
, &spr_write_generic
,
778 spr_register(env
, SPR_IABR
, "IABR",
779 SPR_NOACCESS
, SPR_NOACCESS
,
780 &spr_read_generic
, &spr_write_generic
,
783 spr_register(env
, SPR_HID0
, "HID0",
784 SPR_NOACCESS
, SPR_NOACCESS
,
785 &spr_read_generic
, &spr_write_generic
,
788 spr_register(env
, SPR_HID1
, "HID1",
789 SPR_NOACCESS
, SPR_NOACCESS
,
790 &spr_read_generic
, &spr_write_generic
,
794 static void register_e300_sprs(CPUPPCState
*env
)
796 /* hardware implementation registers */
797 spr_register(env
, SPR_HID2
, "HID2",
798 SPR_NOACCESS
, SPR_NOACCESS
,
799 &spr_read_generic
, &spr_write_generic
,
802 spr_register(env
, SPR_DABR
, "DABR",
803 SPR_NOACCESS
, SPR_NOACCESS
,
804 &spr_read_generic
, &spr_write_generic
,
807 spr_register(env
, SPR_DABR2
, "DABR2",
808 SPR_NOACCESS
, SPR_NOACCESS
,
809 &spr_read_generic
, &spr_write_generic
,
812 spr_register(env
, SPR_IABR2
, "IABR2",
813 SPR_NOACCESS
, SPR_NOACCESS
,
814 &spr_read_generic
, &spr_write_generic
,
817 spr_register(env
, SPR_IBCR
, "IBCR",
818 SPR_NOACCESS
, SPR_NOACCESS
,
819 &spr_read_generic
, &spr_write_generic
,
822 spr_register(env
, SPR_DBCR
, "DBCR",
823 SPR_NOACCESS
, SPR_NOACCESS
,
824 &spr_read_generic
, &spr_write_generic
,
828 /* SPR specific to PowerPC G2 implementation */
829 static void register_G2_sprs(CPUPPCState
*env
)
831 /* Memory base address */
833 spr_register(env
, SPR_MBAR
, "MBAR",
834 SPR_NOACCESS
, SPR_NOACCESS
,
835 &spr_read_generic
, &spr_write_generic
,
837 /* Exception processing */
838 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
839 SPR_NOACCESS
, SPR_NOACCESS
,
840 &spr_read_generic
, &spr_write_generic
,
842 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
843 SPR_NOACCESS
, SPR_NOACCESS
,
844 &spr_read_generic
, &spr_write_generic
,
847 spr_register(env
, SPR_DABR
, "DABR",
848 SPR_NOACCESS
, SPR_NOACCESS
,
849 &spr_read_generic
, &spr_write_generic
,
852 spr_register(env
, SPR_DABR2
, "DABR2",
853 SPR_NOACCESS
, SPR_NOACCESS
,
854 &spr_read_generic
, &spr_write_generic
,
857 spr_register(env
, SPR_IABR
, "IABR",
858 SPR_NOACCESS
, SPR_NOACCESS
,
859 &spr_read_generic
, &spr_write_generic
,
862 spr_register(env
, SPR_IABR2
, "IABR2",
863 SPR_NOACCESS
, SPR_NOACCESS
,
864 &spr_read_generic
, &spr_write_generic
,
867 spr_register(env
, SPR_IBCR
, "IBCR",
868 SPR_NOACCESS
, SPR_NOACCESS
,
869 &spr_read_generic
, &spr_write_generic
,
872 spr_register(env
, SPR_DBCR
, "DBCR",
873 SPR_NOACCESS
, SPR_NOACCESS
,
874 &spr_read_generic
, &spr_write_generic
,
877 /* External access control */
878 spr_register(env
, SPR_EAR
, "EAR",
879 SPR_NOACCESS
, SPR_NOACCESS
,
880 &spr_read_generic
, &spr_write_generic
,
882 /* Hardware implementation register */
883 spr_register(env
, SPR_HID0
, "HID0",
884 SPR_NOACCESS
, SPR_NOACCESS
,
885 &spr_read_generic
, &spr_write_generic
,
888 spr_register(env
, SPR_HID1
, "HID1",
889 SPR_NOACCESS
, SPR_NOACCESS
,
890 &spr_read_generic
, &spr_write_generic
,
893 spr_register(env
, SPR_HID2
, "HID2",
894 SPR_NOACCESS
, SPR_NOACCESS
,
895 &spr_read_generic
, &spr_write_generic
,
899 spr_register(env
, SPR_SPRG4
, "SPRG4",
900 SPR_NOACCESS
, SPR_NOACCESS
,
901 &spr_read_generic
, &spr_write_generic
,
903 spr_register(env
, SPR_SPRG5
, "SPRG5",
904 SPR_NOACCESS
, SPR_NOACCESS
,
905 &spr_read_generic
, &spr_write_generic
,
907 spr_register(env
, SPR_SPRG6
, "SPRG6",
908 SPR_NOACCESS
, SPR_NOACCESS
,
909 &spr_read_generic
, &spr_write_generic
,
911 spr_register(env
, SPR_SPRG7
, "SPRG7",
912 SPR_NOACCESS
, SPR_NOACCESS
,
913 &spr_read_generic
, &spr_write_generic
,
917 static void register_74xx_sprs(CPUPPCState
*env
)
920 spr_register_kvm(env
, SPR_DABR
, "DABR",
921 SPR_NOACCESS
, SPR_NOACCESS
,
922 &spr_read_generic
, &spr_write_generic
,
923 KVM_REG_PPC_DABR
, 0x00000000);
925 spr_register(env
, SPR_IABR
, "IABR",
926 SPR_NOACCESS
, SPR_NOACCESS
,
927 &spr_read_generic
, &spr_write_generic
,
929 /* Cache management */
930 spr_register(env
, SPR_ICTC
, "ICTC",
931 SPR_NOACCESS
, SPR_NOACCESS
,
932 &spr_read_generic
, &spr_write_generic
,
934 /* Performance monitors */
935 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
936 SPR_NOACCESS
, SPR_NOACCESS
,
937 &spr_read_generic
, &spr_write_generic
,
940 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
941 SPR_NOACCESS
, SPR_NOACCESS
,
942 &spr_read_generic
, &spr_write_generic
,
945 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
946 SPR_NOACCESS
, SPR_NOACCESS
,
947 &spr_read_generic
, &spr_write_generic
,
950 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
951 SPR_NOACCESS
, SPR_NOACCESS
,
952 &spr_read_generic
, &spr_write_generic
,
955 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
956 SPR_NOACCESS
, SPR_NOACCESS
,
957 &spr_read_generic
, &spr_write_generic
,
960 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
961 SPR_NOACCESS
, SPR_NOACCESS
,
962 &spr_read_generic
, &spr_write_generic
,
965 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
966 SPR_NOACCESS
, SPR_NOACCESS
,
967 &spr_read_generic
, SPR_NOACCESS
,
970 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
971 &spr_read_ureg
, SPR_NOACCESS
,
972 &spr_read_ureg
, SPR_NOACCESS
,
975 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
976 &spr_read_ureg
, SPR_NOACCESS
,
977 &spr_read_ureg
, SPR_NOACCESS
,
980 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
981 &spr_read_ureg
, SPR_NOACCESS
,
982 &spr_read_ureg
, SPR_NOACCESS
,
985 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
986 &spr_read_ureg
, SPR_NOACCESS
,
987 &spr_read_ureg
, SPR_NOACCESS
,
990 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
991 &spr_read_ureg
, SPR_NOACCESS
,
992 &spr_read_ureg
, SPR_NOACCESS
,
995 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
996 &spr_read_ureg
, SPR_NOACCESS
,
997 &spr_read_ureg
, SPR_NOACCESS
,
1000 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
1001 &spr_read_ureg
, SPR_NOACCESS
,
1002 &spr_read_ureg
, SPR_NOACCESS
,
1004 /* External access control */
1005 spr_register(env
, SPR_EAR
, "EAR",
1006 SPR_NOACCESS
, SPR_NOACCESS
,
1007 &spr_read_generic
, &spr_write_generic
,
1010 /* Processor identification */
1011 spr_register(env
, SPR_PIR
, "PIR",
1012 SPR_NOACCESS
, SPR_NOACCESS
,
1013 &spr_read_generic
, &spr_write_pir
,
1016 spr_register(env
, SPR_74XX_MMCR2
, "MMCR2",
1017 SPR_NOACCESS
, SPR_NOACCESS
,
1018 &spr_read_generic
, &spr_write_generic
,
1021 spr_register(env
, SPR_74XX_UMMCR2
, "UMMCR2",
1022 &spr_read_ureg
, SPR_NOACCESS
,
1023 &spr_read_ureg
, SPR_NOACCESS
,
1026 spr_register(env
, SPR_BAMR
, "BAMR",
1027 SPR_NOACCESS
, SPR_NOACCESS
,
1028 &spr_read_generic
, &spr_write_generic
,
1031 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1032 SPR_NOACCESS
, SPR_NOACCESS
,
1033 &spr_read_generic
, &spr_write_generic
,
1035 /* Hardware implementation registers */
1036 spr_register(env
, SPR_HID0
, "HID0",
1037 SPR_NOACCESS
, SPR_NOACCESS
,
1038 &spr_read_generic
, &spr_write_generic
,
1041 spr_register(env
, SPR_HID1
, "HID1",
1042 SPR_NOACCESS
, SPR_NOACCESS
,
1043 &spr_read_generic
, &spr_write_generic
,
1046 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1047 &spr_read_generic
, &spr_write_generic
,
1048 &spr_read_generic
, &spr_write_generic
,
1051 spr_register(env
, SPR_L2CR
, "L2CR",
1052 SPR_NOACCESS
, SPR_NOACCESS
,
1053 &spr_read_generic
, spr_access_nop
,
1057 static void register_l3_ctrl(CPUPPCState
*env
)
1060 spr_register(env
, SPR_L3CR
, "L3CR",
1061 SPR_NOACCESS
, SPR_NOACCESS
,
1062 &spr_read_generic
, &spr_write_generic
,
1065 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1066 SPR_NOACCESS
, SPR_NOACCESS
,
1067 &spr_read_generic
, &spr_write_generic
,
1070 spr_register(env
, SPR_L3PM
, "L3PM",
1071 SPR_NOACCESS
, SPR_NOACCESS
,
1072 &spr_read_generic
, &spr_write_generic
,
1076 static void register_usprg3_sprs(CPUPPCState
*env
)
1078 spr_register(env
, SPR_USPRG3
, "USPRG3",
1079 &spr_read_ureg
, SPR_NOACCESS
,
1080 &spr_read_ureg
, SPR_NOACCESS
,
1084 static void register_usprgh_sprs(CPUPPCState
*env
)
1086 spr_register(env
, SPR_USPRG4
, "USPRG4",
1087 &spr_read_ureg
, SPR_NOACCESS
,
1088 &spr_read_ureg
, SPR_NOACCESS
,
1090 spr_register(env
, SPR_USPRG5
, "USPRG5",
1091 &spr_read_ureg
, SPR_NOACCESS
,
1092 &spr_read_ureg
, SPR_NOACCESS
,
1094 spr_register(env
, SPR_USPRG6
, "USPRG6",
1095 &spr_read_ureg
, SPR_NOACCESS
,
1096 &spr_read_ureg
, SPR_NOACCESS
,
1098 spr_register(env
, SPR_USPRG7
, "USPRG7",
1099 &spr_read_ureg
, SPR_NOACCESS
,
1100 &spr_read_ureg
, SPR_NOACCESS
,
1104 /* PowerPC BookE SPR */
1105 static void register_BookE_sprs(CPUPPCState
*env
, uint64_t ivor_mask
)
1107 const char *ivor_names
[64] = {
1108 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1109 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1110 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1111 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1112 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1113 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1114 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1115 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1116 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1117 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1118 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1119 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1120 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1121 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1122 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1123 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1125 #define SPR_BOOKE_IVORxx (-1)
1126 int ivor_sprn
[64] = {
1127 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1128 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1129 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1130 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1131 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1132 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1133 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1134 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1135 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1136 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1137 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1138 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1139 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1140 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1141 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1142 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1146 /* Interrupt processing */
1147 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1148 SPR_NOACCESS
, SPR_NOACCESS
,
1149 &spr_read_generic
, &spr_write_generic
,
1151 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1152 SPR_NOACCESS
, SPR_NOACCESS
,
1153 &spr_read_generic
, &spr_write_generic
,
1156 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1157 SPR_NOACCESS
, SPR_NOACCESS
,
1158 &spr_read_generic
, &spr_write_generic
,
1161 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1162 SPR_NOACCESS
, SPR_NOACCESS
,
1163 &spr_read_generic
, &spr_write_generic
,
1166 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1167 SPR_NOACCESS
, SPR_NOACCESS
,
1168 &spr_read_generic
, &spr_write_generic
,
1171 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1172 SPR_NOACCESS
, SPR_NOACCESS
,
1173 &spr_read_generic
, &spr_write_generic
,
1176 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1177 SPR_NOACCESS
, SPR_NOACCESS
,
1178 &spr_read_generic
, &spr_write_40x_dbcr0
,
1181 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1182 SPR_NOACCESS
, SPR_NOACCESS
,
1183 &spr_read_generic
, &spr_write_generic
,
1186 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1187 SPR_NOACCESS
, SPR_NOACCESS
,
1188 &spr_read_generic
, &spr_write_generic
,
1190 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
1191 SPR_NOACCESS
, SPR_NOACCESS
,
1192 &spr_read_generic
, &spr_write_generic
,
1194 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
1195 SPR_NOACCESS
, SPR_NOACCESS
,
1196 &spr_read_generic
, &spr_write_generic
,
1199 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1200 SPR_NOACCESS
, SPR_NOACCESS
,
1201 &spr_read_generic
, &spr_write_clear
,
1203 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1204 SPR_NOACCESS
, SPR_NOACCESS
,
1205 &spr_read_generic
, &spr_write_generic
,
1207 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1208 SPR_NOACCESS
, SPR_NOACCESS
,
1209 &spr_read_generic
, &spr_write_generic
,
1211 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1212 SPR_NOACCESS
, SPR_NOACCESS
,
1213 &spr_read_generic
, &spr_write_excp_prefix
,
1215 /* Exception vectors */
1216 for (i
= 0; i
< 64; i
++) {
1217 if (ivor_mask
& (1ULL << i
)) {
1218 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1219 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1222 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1223 SPR_NOACCESS
, SPR_NOACCESS
,
1224 &spr_read_generic
, &spr_write_excp_vector
,
1228 spr_register(env
, SPR_BOOKE_PID
, "PID",
1229 SPR_NOACCESS
, SPR_NOACCESS
,
1230 &spr_read_generic
, &spr_write_booke_pid
,
1232 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1233 SPR_NOACCESS
, SPR_NOACCESS
,
1234 &spr_read_generic
, &spr_write_booke_tcr
,
1236 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1237 SPR_NOACCESS
, SPR_NOACCESS
,
1238 &spr_read_generic
, &spr_write_booke_tsr
,
1241 spr_register(env
, SPR_DECR
, "DECR",
1242 SPR_NOACCESS
, SPR_NOACCESS
,
1243 &spr_read_decr
, &spr_write_decr
,
1245 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1246 SPR_NOACCESS
, SPR_NOACCESS
,
1247 SPR_NOACCESS
, &spr_write_generic
,
1250 spr_register(env
, SPR_USPRG0
, "USPRG0",
1251 &spr_read_generic
, &spr_write_generic
,
1252 &spr_read_generic
, &spr_write_generic
,
1254 spr_register(env
, SPR_SPRG4
, "SPRG4",
1255 SPR_NOACCESS
, SPR_NOACCESS
,
1256 &spr_read_generic
, &spr_write_generic
,
1258 spr_register(env
, SPR_SPRG5
, "SPRG5",
1259 SPR_NOACCESS
, SPR_NOACCESS
,
1260 &spr_read_generic
, &spr_write_generic
,
1262 spr_register(env
, SPR_SPRG6
, "SPRG6",
1263 SPR_NOACCESS
, SPR_NOACCESS
,
1264 &spr_read_generic
, &spr_write_generic
,
1266 spr_register(env
, SPR_SPRG7
, "SPRG7",
1267 SPR_NOACCESS
, SPR_NOACCESS
,
1268 &spr_read_generic
, &spr_write_generic
,
1270 spr_register(env
, SPR_BOOKE_SPRG8
, "SPRG8",
1271 SPR_NOACCESS
, SPR_NOACCESS
,
1272 &spr_read_generic
, &spr_write_generic
,
1274 spr_register(env
, SPR_BOOKE_SPRG9
, "SPRG9",
1275 SPR_NOACCESS
, SPR_NOACCESS
,
1276 &spr_read_generic
, &spr_write_generic
,
1280 #if !defined(CONFIG_USER_ONLY)
1281 static inline uint32_t register_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1282 uint32_t maxsize
, uint32_t flags
,
1285 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1286 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1287 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1290 #endif /* !CONFIG_USER_ONLY */
1292 /* BookE 2.06 storage control registers */
1293 static void register_BookE206_sprs(CPUPPCState
*env
, uint32_t mas_mask
,
1294 uint32_t *tlbncfg
, uint32_t mmucfg
)
1296 #if !defined(CONFIG_USER_ONLY)
1297 const char *mas_names
[8] = {
1298 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1301 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1302 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1306 /* TLB assist registers */
1307 for (i
= 0; i
< 8; i
++) {
1308 if (mas_mask
& (1 << i
)) {
1309 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1310 SPR_NOACCESS
, SPR_NOACCESS
,
1312 (i
== 2 && (env
->insns_flags
& PPC_64B
))
1313 ? &spr_write_generic
: &spr_write_generic32
,
1317 if (env
->nb_pids
> 1) {
1318 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1319 SPR_NOACCESS
, SPR_NOACCESS
,
1320 &spr_read_generic
, &spr_write_booke_pid
,
1323 if (env
->nb_pids
> 2) {
1324 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1325 SPR_NOACCESS
, SPR_NOACCESS
,
1326 &spr_read_generic
, &spr_write_booke_pid
,
1330 spr_register(env
, SPR_BOOKE_EPLC
, "EPLC",
1331 SPR_NOACCESS
, SPR_NOACCESS
,
1332 &spr_read_generic
, &spr_write_eplc
,
1334 spr_register(env
, SPR_BOOKE_EPSC
, "EPSC",
1335 SPR_NOACCESS
, SPR_NOACCESS
,
1336 &spr_read_generic
, &spr_write_epsc
,
1339 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
1340 SPR_NOACCESS
, SPR_NOACCESS
,
1341 &spr_read_generic
, SPR_NOACCESS
,
1343 switch (env
->nb_ways
) {
1345 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
1346 SPR_NOACCESS
, SPR_NOACCESS
,
1347 &spr_read_generic
, SPR_NOACCESS
,
1351 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
1352 SPR_NOACCESS
, SPR_NOACCESS
,
1353 &spr_read_generic
, SPR_NOACCESS
,
1357 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
1358 SPR_NOACCESS
, SPR_NOACCESS
,
1359 &spr_read_generic
, SPR_NOACCESS
,
1363 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
1364 SPR_NOACCESS
, SPR_NOACCESS
,
1365 &spr_read_generic
, SPR_NOACCESS
,
1375 /* SPR specific to PowerPC 440 implementation */
1376 static void register_440_sprs(CPUPPCState
*env
)
1379 spr_register(env
, SPR_440_DNV0
, "DNV0",
1380 SPR_NOACCESS
, SPR_NOACCESS
,
1381 &spr_read_generic
, &spr_write_generic
,
1384 spr_register(env
, SPR_440_DNV1
, "DNV1",
1385 SPR_NOACCESS
, SPR_NOACCESS
,
1386 &spr_read_generic
, &spr_write_generic
,
1389 spr_register(env
, SPR_440_DNV2
, "DNV2",
1390 SPR_NOACCESS
, SPR_NOACCESS
,
1391 &spr_read_generic
, &spr_write_generic
,
1394 spr_register(env
, SPR_440_DNV3
, "DNV3",
1395 SPR_NOACCESS
, SPR_NOACCESS
,
1396 &spr_read_generic
, &spr_write_generic
,
1399 spr_register(env
, SPR_440_DTV0
, "DTV0",
1400 SPR_NOACCESS
, SPR_NOACCESS
,
1401 &spr_read_generic
, &spr_write_generic
,
1404 spr_register(env
, SPR_440_DTV1
, "DTV1",
1405 SPR_NOACCESS
, SPR_NOACCESS
,
1406 &spr_read_generic
, &spr_write_generic
,
1409 spr_register(env
, SPR_440_DTV2
, "DTV2",
1410 SPR_NOACCESS
, SPR_NOACCESS
,
1411 &spr_read_generic
, &spr_write_generic
,
1414 spr_register(env
, SPR_440_DTV3
, "DTV3",
1415 SPR_NOACCESS
, SPR_NOACCESS
,
1416 &spr_read_generic
, &spr_write_generic
,
1419 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
1420 SPR_NOACCESS
, SPR_NOACCESS
,
1421 &spr_read_generic
, &spr_write_generic
,
1424 spr_register(env
, SPR_440_INV0
, "INV0",
1425 SPR_NOACCESS
, SPR_NOACCESS
,
1426 &spr_read_generic
, &spr_write_generic
,
1429 spr_register(env
, SPR_440_INV1
, "INV1",
1430 SPR_NOACCESS
, SPR_NOACCESS
,
1431 &spr_read_generic
, &spr_write_generic
,
1434 spr_register(env
, SPR_440_INV2
, "INV2",
1435 SPR_NOACCESS
, SPR_NOACCESS
,
1436 &spr_read_generic
, &spr_write_generic
,
1439 spr_register(env
, SPR_440_INV3
, "INV3",
1440 SPR_NOACCESS
, SPR_NOACCESS
,
1441 &spr_read_generic
, &spr_write_generic
,
1444 spr_register(env
, SPR_440_ITV0
, "ITV0",
1445 SPR_NOACCESS
, SPR_NOACCESS
,
1446 &spr_read_generic
, &spr_write_generic
,
1449 spr_register(env
, SPR_440_ITV1
, "ITV1",
1450 SPR_NOACCESS
, SPR_NOACCESS
,
1451 &spr_read_generic
, &spr_write_generic
,
1454 spr_register(env
, SPR_440_ITV2
, "ITV2",
1455 SPR_NOACCESS
, SPR_NOACCESS
,
1456 &spr_read_generic
, &spr_write_generic
,
1459 spr_register(env
, SPR_440_ITV3
, "ITV3",
1460 SPR_NOACCESS
, SPR_NOACCESS
,
1461 &spr_read_generic
, &spr_write_generic
,
1464 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
1465 SPR_NOACCESS
, SPR_NOACCESS
,
1466 &spr_read_generic
, &spr_write_generic
,
1469 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
1470 SPR_NOACCESS
, SPR_NOACCESS
,
1471 &spr_read_generic
, SPR_NOACCESS
,
1474 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
1475 SPR_NOACCESS
, SPR_NOACCESS
,
1476 &spr_read_generic
, SPR_NOACCESS
,
1479 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1480 SPR_NOACCESS
, SPR_NOACCESS
,
1481 &spr_read_generic
, SPR_NOACCESS
,
1484 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
1485 SPR_NOACCESS
, SPR_NOACCESS
,
1486 &spr_read_generic
, SPR_NOACCESS
,
1489 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
1490 SPR_NOACCESS
, SPR_NOACCESS
,
1491 &spr_read_generic
, SPR_NOACCESS
,
1494 spr_register(env
, SPR_440_DBDR
, "DBDR",
1495 SPR_NOACCESS
, SPR_NOACCESS
,
1496 &spr_read_generic
, &spr_write_generic
,
1498 /* Processor control */
1499 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1500 SPR_NOACCESS
, SPR_NOACCESS
,
1501 &spr_read_generic
, &spr_write_generic
,
1503 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
1504 SPR_NOACCESS
, SPR_NOACCESS
,
1505 &spr_read_generic
, SPR_NOACCESS
,
1507 /* Storage control */
1508 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
1509 SPR_NOACCESS
, SPR_NOACCESS
,
1510 &spr_read_generic
, &spr_write_generic
,
1513 /* Processor identification */
1514 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
1515 SPR_NOACCESS
, SPR_NOACCESS
,
1516 &spr_read_generic
, &spr_write_pir
,
1519 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
1520 SPR_NOACCESS
, SPR_NOACCESS
,
1521 &spr_read_generic
, &spr_write_generic
,
1524 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
1525 SPR_NOACCESS
, SPR_NOACCESS
,
1526 &spr_read_generic
, &spr_write_generic
,
1529 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
1530 SPR_NOACCESS
, SPR_NOACCESS
,
1531 &spr_read_generic
, &spr_write_generic
,
1534 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
1535 SPR_NOACCESS
, SPR_NOACCESS
,
1536 &spr_read_generic
, &spr_write_generic
,
1540 /* SPR shared between PowerPC 40x implementations */
1541 static void register_40x_sprs(CPUPPCState
*env
)
1544 /* not emulated, as QEMU do not emulate caches */
1545 spr_register(env
, SPR_40x_DCCR
, "DCCR",
1546 SPR_NOACCESS
, SPR_NOACCESS
,
1547 &spr_read_generic
, &spr_write_generic
,
1549 /* not emulated, as QEMU do not emulate caches */
1550 spr_register(env
, SPR_40x_ICCR
, "ICCR",
1551 SPR_NOACCESS
, SPR_NOACCESS
,
1552 &spr_read_generic
, &spr_write_generic
,
1554 /* not emulated, as QEMU do not emulate caches */
1555 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1556 SPR_NOACCESS
, SPR_NOACCESS
,
1557 &spr_read_generic
, SPR_NOACCESS
,
1560 spr_register(env
, SPR_40x_DEAR
, "DEAR",
1561 SPR_NOACCESS
, SPR_NOACCESS
,
1562 &spr_read_generic
, &spr_write_generic
,
1564 spr_register(env
, SPR_40x_ESR
, "ESR",
1565 SPR_NOACCESS
, SPR_NOACCESS
,
1566 &spr_read_generic
, &spr_write_generic
,
1568 spr_register(env
, SPR_40x_EVPR
, "EVPR",
1569 SPR_NOACCESS
, SPR_NOACCESS
,
1570 &spr_read_generic
, &spr_write_excp_prefix
,
1572 spr_register(env
, SPR_40x_SRR2
, "SRR2",
1573 &spr_read_generic
, &spr_write_generic
,
1574 &spr_read_generic
, &spr_write_generic
,
1576 spr_register(env
, SPR_40x_SRR3
, "SRR3",
1577 &spr_read_generic
, &spr_write_generic
,
1578 &spr_read_generic
, &spr_write_generic
,
1581 spr_register(env
, SPR_40x_PIT
, "PIT",
1582 SPR_NOACCESS
, SPR_NOACCESS
,
1583 &spr_read_40x_pit
, &spr_write_40x_pit
,
1585 spr_register(env
, SPR_40x_TCR
, "TCR",
1586 SPR_NOACCESS
, SPR_NOACCESS
,
1587 &spr_read_generic
, &spr_write_40x_tcr
,
1589 spr_register(env
, SPR_40x_TSR
, "TSR",
1590 SPR_NOACCESS
, SPR_NOACCESS
,
1591 &spr_read_generic
, &spr_write_40x_tsr
,
1595 /* SPR specific to PowerPC 405 implementation */
1596 static void register_405_sprs(CPUPPCState
*env
)
1599 spr_register(env
, SPR_40x_PID
, "PID",
1600 SPR_NOACCESS
, SPR_NOACCESS
,
1601 &spr_read_generic
, &spr_write_40x_pid
,
1603 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1604 SPR_NOACCESS
, SPR_NOACCESS
,
1605 &spr_read_generic
, &spr_write_generic
,
1607 /* Debug interface */
1608 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
1609 SPR_NOACCESS
, SPR_NOACCESS
,
1610 &spr_read_generic
, &spr_write_40x_dbcr0
,
1613 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
1614 SPR_NOACCESS
, SPR_NOACCESS
,
1615 &spr_read_generic
, &spr_write_generic
,
1618 spr_register(env
, SPR_40x_DBSR
, "DBSR",
1619 SPR_NOACCESS
, SPR_NOACCESS
,
1620 &spr_read_generic
, &spr_write_clear
,
1621 /* Last reset was system reset */
1624 spr_register(env
, SPR_40x_DAC1
, "DAC1",
1625 SPR_NOACCESS
, SPR_NOACCESS
,
1626 &spr_read_generic
, &spr_write_generic
,
1628 spr_register(env
, SPR_40x_DAC2
, "DAC2",
1629 SPR_NOACCESS
, SPR_NOACCESS
,
1630 &spr_read_generic
, &spr_write_generic
,
1633 spr_register(env
, SPR_405_DVC1
, "DVC1",
1634 SPR_NOACCESS
, SPR_NOACCESS
,
1635 &spr_read_generic
, &spr_write_generic
,
1638 spr_register(env
, SPR_405_DVC2
, "DVC2",
1639 SPR_NOACCESS
, SPR_NOACCESS
,
1640 &spr_read_generic
, &spr_write_generic
,
1643 spr_register(env
, SPR_40x_IAC1
, "IAC1",
1644 SPR_NOACCESS
, SPR_NOACCESS
,
1645 &spr_read_generic
, &spr_write_generic
,
1647 spr_register(env
, SPR_40x_IAC2
, "IAC2",
1648 SPR_NOACCESS
, SPR_NOACCESS
,
1649 &spr_read_generic
, &spr_write_generic
,
1652 spr_register(env
, SPR_405_IAC3
, "IAC3",
1653 SPR_NOACCESS
, SPR_NOACCESS
,
1654 &spr_read_generic
, &spr_write_generic
,
1657 spr_register(env
, SPR_405_IAC4
, "IAC4",
1658 SPR_NOACCESS
, SPR_NOACCESS
,
1659 &spr_read_generic
, &spr_write_generic
,
1661 /* Storage control */
1662 spr_register(env
, SPR_405_SLER
, "SLER",
1663 SPR_NOACCESS
, SPR_NOACCESS
,
1664 &spr_read_generic
, &spr_write_40x_sler
,
1666 spr_register(env
, SPR_40x_ZPR
, "ZPR",
1667 SPR_NOACCESS
, SPR_NOACCESS
,
1668 &spr_read_generic
, &spr_write_generic
,
1671 spr_register(env
, SPR_405_SU0R
, "SU0R",
1672 SPR_NOACCESS
, SPR_NOACCESS
,
1673 &spr_read_generic
, &spr_write_generic
,
1676 spr_register(env
, SPR_USPRG0
, "USPRG0",
1677 &spr_read_ureg
, SPR_NOACCESS
,
1678 &spr_read_ureg
, SPR_NOACCESS
,
1680 spr_register(env
, SPR_SPRG4
, "SPRG4",
1681 SPR_NOACCESS
, SPR_NOACCESS
,
1682 &spr_read_generic
, &spr_write_generic
,
1684 spr_register(env
, SPR_SPRG5
, "SPRG5",
1685 SPR_NOACCESS
, SPR_NOACCESS
,
1686 spr_read_generic
, &spr_write_generic
,
1688 spr_register(env
, SPR_SPRG6
, "SPRG6",
1689 SPR_NOACCESS
, SPR_NOACCESS
,
1690 spr_read_generic
, &spr_write_generic
,
1692 spr_register(env
, SPR_SPRG7
, "SPRG7",
1693 SPR_NOACCESS
, SPR_NOACCESS
,
1694 spr_read_generic
, &spr_write_generic
,
1697 /* Bus access control */
1698 /* not emulated, as QEMU never does speculative access */
1699 spr_register(env
, SPR_40x_SGR
, "SGR",
1700 SPR_NOACCESS
, SPR_NOACCESS
,
1701 &spr_read_generic
, &spr_write_generic
,
1703 /* not emulated, as QEMU do not emulate caches */
1704 spr_register(env
, SPR_40x_DCWR
, "DCWR",
1705 SPR_NOACCESS
, SPR_NOACCESS
,
1706 &spr_read_generic
, &spr_write_generic
,
1711 static void register_5xx_8xx_sprs(CPUPPCState
*env
)
1713 /* Exception processing */
1714 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
1715 SPR_NOACCESS
, SPR_NOACCESS
,
1716 &spr_read_generic
, &spr_write_generic
,
1717 KVM_REG_PPC_DSISR
, 0x00000000);
1718 spr_register_kvm(env
, SPR_DAR
, "DAR",
1719 SPR_NOACCESS
, SPR_NOACCESS
,
1720 &spr_read_generic
, &spr_write_generic
,
1721 KVM_REG_PPC_DAR
, 0x00000000);
1723 spr_register(env
, SPR_DECR
, "DECR",
1724 SPR_NOACCESS
, SPR_NOACCESS
,
1725 &spr_read_decr
, &spr_write_decr
,
1728 spr_register(env
, SPR_MPC_EIE
, "EIE",
1729 SPR_NOACCESS
, SPR_NOACCESS
,
1730 &spr_read_generic
, &spr_write_generic
,
1733 spr_register(env
, SPR_MPC_EID
, "EID",
1734 SPR_NOACCESS
, SPR_NOACCESS
,
1735 &spr_read_generic
, &spr_write_generic
,
1738 spr_register(env
, SPR_MPC_NRI
, "NRI",
1739 SPR_NOACCESS
, SPR_NOACCESS
,
1740 &spr_read_generic
, &spr_write_generic
,
1743 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
1744 SPR_NOACCESS
, SPR_NOACCESS
,
1745 &spr_read_generic
, &spr_write_generic
,
1748 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
1749 SPR_NOACCESS
, SPR_NOACCESS
,
1750 &spr_read_generic
, &spr_write_generic
,
1753 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
1754 SPR_NOACCESS
, SPR_NOACCESS
,
1755 &spr_read_generic
, &spr_write_generic
,
1758 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
1759 SPR_NOACCESS
, SPR_NOACCESS
,
1760 &spr_read_generic
, &spr_write_generic
,
1763 spr_register(env
, SPR_MPC_ECR
, "ECR",
1764 SPR_NOACCESS
, SPR_NOACCESS
,
1765 &spr_read_generic
, &spr_write_generic
,
1768 spr_register(env
, SPR_MPC_DER
, "DER",
1769 SPR_NOACCESS
, SPR_NOACCESS
,
1770 &spr_read_generic
, &spr_write_generic
,
1773 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
1774 SPR_NOACCESS
, SPR_NOACCESS
,
1775 &spr_read_generic
, &spr_write_generic
,
1778 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
1779 SPR_NOACCESS
, SPR_NOACCESS
,
1780 &spr_read_generic
, &spr_write_generic
,
1783 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
1784 SPR_NOACCESS
, SPR_NOACCESS
,
1785 &spr_read_generic
, &spr_write_generic
,
1788 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
1789 SPR_NOACCESS
, SPR_NOACCESS
,
1790 &spr_read_generic
, &spr_write_generic
,
1793 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
1794 SPR_NOACCESS
, SPR_NOACCESS
,
1795 &spr_read_generic
, &spr_write_generic
,
1798 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
1799 SPR_NOACCESS
, SPR_NOACCESS
,
1800 &spr_read_generic
, &spr_write_generic
,
1803 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
1804 SPR_NOACCESS
, SPR_NOACCESS
,
1805 &spr_read_generic
, &spr_write_generic
,
1808 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
1809 SPR_NOACCESS
, SPR_NOACCESS
,
1810 &spr_read_generic
, &spr_write_generic
,
1813 spr_register(env
, SPR_MPC_BAR
, "BAR",
1814 SPR_NOACCESS
, SPR_NOACCESS
,
1815 &spr_read_generic
, &spr_write_generic
,
1818 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
1819 SPR_NOACCESS
, SPR_NOACCESS
,
1820 &spr_read_generic
, &spr_write_generic
,
1823 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
1824 SPR_NOACCESS
, SPR_NOACCESS
,
1825 &spr_read_generic
, &spr_write_generic
,
1829 static void register_5xx_sprs(CPUPPCState
*env
)
1831 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
1832 SPR_NOACCESS
, SPR_NOACCESS
,
1833 &spr_read_generic
, &spr_write_generic
,
1836 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
1837 SPR_NOACCESS
, SPR_NOACCESS
,
1838 &spr_read_generic
, &spr_write_generic
,
1841 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
1842 SPR_NOACCESS
, SPR_NOACCESS
,
1843 &spr_read_generic
, &spr_write_generic
,
1846 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
1847 SPR_NOACCESS
, SPR_NOACCESS
,
1848 &spr_read_generic
, &spr_write_generic
,
1851 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
1852 SPR_NOACCESS
, SPR_NOACCESS
,
1853 &spr_read_generic
, &spr_write_generic
,
1856 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
1857 SPR_NOACCESS
, SPR_NOACCESS
,
1858 &spr_read_generic
, &spr_write_generic
,
1861 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
1862 SPR_NOACCESS
, SPR_NOACCESS
,
1863 &spr_read_generic
, &spr_write_generic
,
1866 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
1867 SPR_NOACCESS
, SPR_NOACCESS
,
1868 &spr_read_generic
, &spr_write_generic
,
1871 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
1872 SPR_NOACCESS
, SPR_NOACCESS
,
1873 &spr_read_generic
, &spr_write_generic
,
1876 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
1877 SPR_NOACCESS
, SPR_NOACCESS
,
1878 &spr_read_generic
, &spr_write_generic
,
1881 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
1882 SPR_NOACCESS
, SPR_NOACCESS
,
1883 &spr_read_generic
, &spr_write_generic
,
1886 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
1887 SPR_NOACCESS
, SPR_NOACCESS
,
1888 &spr_read_generic
, &spr_write_generic
,
1891 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
1892 SPR_NOACCESS
, SPR_NOACCESS
,
1893 &spr_read_generic
, &spr_write_generic
,
1896 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
1897 SPR_NOACCESS
, SPR_NOACCESS
,
1898 &spr_read_generic
, &spr_write_generic
,
1901 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
1902 SPR_NOACCESS
, SPR_NOACCESS
,
1903 &spr_read_generic
, &spr_write_generic
,
1906 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
1907 SPR_NOACCESS
, SPR_NOACCESS
,
1908 &spr_read_generic
, &spr_write_generic
,
1911 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
1912 SPR_NOACCESS
, SPR_NOACCESS
,
1913 &spr_read_generic
, &spr_write_generic
,
1916 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
1917 SPR_NOACCESS
, SPR_NOACCESS
,
1918 &spr_read_generic
, &spr_write_generic
,
1921 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
1922 SPR_NOACCESS
, SPR_NOACCESS
,
1923 &spr_read_generic
, &spr_write_generic
,
1926 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
1927 SPR_NOACCESS
, SPR_NOACCESS
,
1928 &spr_read_generic
, &spr_write_generic
,
1931 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
1932 SPR_NOACCESS
, SPR_NOACCESS
,
1933 &spr_read_generic
, &spr_write_generic
,
1937 static void register_8xx_sprs(CPUPPCState
*env
)
1940 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
1941 SPR_NOACCESS
, SPR_NOACCESS
,
1942 &spr_read_generic
, &spr_write_generic
,
1945 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
1946 SPR_NOACCESS
, SPR_NOACCESS
,
1947 &spr_read_generic
, &spr_write_generic
,
1950 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
1951 SPR_NOACCESS
, SPR_NOACCESS
,
1952 &spr_read_generic
, &spr_write_generic
,
1955 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
1956 SPR_NOACCESS
, SPR_NOACCESS
,
1957 &spr_read_generic
, &spr_write_generic
,
1960 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
1961 SPR_NOACCESS
, SPR_NOACCESS
,
1962 &spr_read_generic
, &spr_write_generic
,
1965 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
1966 SPR_NOACCESS
, SPR_NOACCESS
,
1967 &spr_read_generic
, &spr_write_generic
,
1970 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
1971 SPR_NOACCESS
, SPR_NOACCESS
,
1972 &spr_read_generic
, &spr_write_generic
,
1975 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
1976 SPR_NOACCESS
, SPR_NOACCESS
,
1977 &spr_read_generic
, &spr_write_generic
,
1980 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
1981 SPR_NOACCESS
, SPR_NOACCESS
,
1982 &spr_read_generic
, &spr_write_generic
,
1985 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
1986 SPR_NOACCESS
, SPR_NOACCESS
,
1987 &spr_read_generic
, &spr_write_generic
,
1990 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
1991 SPR_NOACCESS
, SPR_NOACCESS
,
1992 &spr_read_generic
, &spr_write_generic
,
1995 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
1996 SPR_NOACCESS
, SPR_NOACCESS
,
1997 &spr_read_generic
, &spr_write_generic
,
2000 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2001 SPR_NOACCESS
, SPR_NOACCESS
,
2002 &spr_read_generic
, &spr_write_generic
,
2005 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2006 SPR_NOACCESS
, SPR_NOACCESS
,
2007 &spr_read_generic
, &spr_write_generic
,
2010 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2011 SPR_NOACCESS
, SPR_NOACCESS
,
2012 &spr_read_generic
, &spr_write_generic
,
2015 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2016 SPR_NOACCESS
, SPR_NOACCESS
,
2017 &spr_read_generic
, &spr_write_generic
,
2020 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2021 SPR_NOACCESS
, SPR_NOACCESS
,
2022 &spr_read_generic
, &spr_write_generic
,
2025 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2026 SPR_NOACCESS
, SPR_NOACCESS
,
2027 &spr_read_generic
, &spr_write_generic
,
2030 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2031 SPR_NOACCESS
, SPR_NOACCESS
,
2032 &spr_read_generic
, &spr_write_generic
,
2035 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2036 SPR_NOACCESS
, SPR_NOACCESS
,
2037 &spr_read_generic
, &spr_write_generic
,
2040 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2041 SPR_NOACCESS
, SPR_NOACCESS
,
2042 &spr_read_generic
, &spr_write_generic
,
2045 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2046 SPR_NOACCESS
, SPR_NOACCESS
,
2047 &spr_read_generic
, &spr_write_generic
,
2050 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2051 SPR_NOACCESS
, SPR_NOACCESS
,
2052 &spr_read_generic
, &spr_write_generic
,
2055 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2056 SPR_NOACCESS
, SPR_NOACCESS
,
2057 &spr_read_generic
, &spr_write_generic
,
2060 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2061 SPR_NOACCESS
, SPR_NOACCESS
,
2062 &spr_read_generic
, &spr_write_generic
,
2067 * AMR => SPR 29 (Power 2.04)
2068 * CTRL => SPR 136 (Power 2.04)
2069 * CTRL => SPR 152 (Power 2.04)
2070 * SCOMC => SPR 276 (64 bits ?)
2071 * SCOMD => SPR 277 (64 bits ?)
2072 * TBU40 => SPR 286 (Power 2.04 hypv)
2073 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2074 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2075 * HDSISR => SPR 306 (Power 2.04 hypv)
2076 * HDAR => SPR 307 (Power 2.04 hypv)
2077 * PURR => SPR 309 (Power 2.04 hypv)
2078 * HDEC => SPR 310 (Power 2.04 hypv)
2079 * HIOR => SPR 311 (hypv)
2080 * RMOR => SPR 312 (970)
2081 * HRMOR => SPR 313 (Power 2.04 hypv)
2082 * HSRR0 => SPR 314 (Power 2.04 hypv)
2083 * HSRR1 => SPR 315 (Power 2.04 hypv)
2084 * LPIDR => SPR 317 (970)
2085 * EPR => SPR 702 (Power 2.04 emb)
2086 * perf => 768-783 (Power 2.04)
2087 * perf => 784-799 (Power 2.04)
2088 * PPR => SPR 896 (Power 2.04)
2089 * DABRX => 1015 (Power 2.04 hypv)
2090 * FPECR => SPR 1022 (?)
2091 * ... and more (thermal management, performance counters, ...)
2094 /*****************************************************************************/
2095 /* Exception vectors models */
2096 static void init_excp_4xx_softmmu(CPUPPCState
*env
)
2098 #if !defined(CONFIG_USER_ONLY)
2099 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2100 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2101 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2102 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2103 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2104 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2105 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2106 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2107 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2108 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2109 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2110 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2111 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2112 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2113 env
->ivor_mask
= 0x0000FFF0UL
;
2114 env
->ivpr_mask
= 0xFFFF0000UL
;
2115 /* Hardware reset vector */
2116 env
->hreset_vector
= 0xFFFFFFFCUL
;
2120 static void init_excp_MPC5xx(CPUPPCState
*env
)
2122 #if !defined(CONFIG_USER_ONLY)
2123 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2124 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2125 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2126 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2127 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2128 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2129 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2130 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2131 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2132 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2133 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2134 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2135 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2136 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2137 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2138 env
->ivor_mask
= 0x0000FFF0UL
;
2139 env
->ivpr_mask
= 0xFFFF0000UL
;
2140 /* Hardware reset vector */
2141 env
->hreset_vector
= 0x00000100UL
;
2145 static void init_excp_MPC8xx(CPUPPCState
*env
)
2147 #if !defined(CONFIG_USER_ONLY)
2148 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2149 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2150 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2151 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2152 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2153 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2154 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2155 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2156 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2157 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2158 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2159 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2160 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2161 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2162 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2163 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2164 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2165 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2166 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2167 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2168 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2169 env
->ivor_mask
= 0x0000FFF0UL
;
2170 env
->ivpr_mask
= 0xFFFF0000UL
;
2171 /* Hardware reset vector */
2172 env
->hreset_vector
= 0x00000100UL
;
2176 static void init_excp_G2(CPUPPCState
*env
)
2178 #if !defined(CONFIG_USER_ONLY)
2179 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2180 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2181 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2182 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2183 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2184 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2185 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2186 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2187 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2188 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
2189 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2190 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2191 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2192 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2193 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2194 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2195 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2196 /* Hardware reset vector */
2197 env
->hreset_vector
= 0x00000100UL
;
2201 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
2203 #if !defined(CONFIG_USER_ONLY)
2204 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
2205 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2206 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2207 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2208 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2209 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2210 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2211 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2212 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2213 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2214 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2215 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2216 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2217 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2218 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2219 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2220 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2222 * These two are the same IVOR as POWERPC_EXCP_VPU and
2223 * POWERPC_EXCP_VPUA. We deal with that when dispatching at
2226 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
2227 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
2229 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
2230 env
->ivor_mask
= 0x0000FFF7UL
;
2231 env
->ivpr_mask
= ivpr_mask
;
2232 /* Hardware reset vector */
2233 env
->hreset_vector
= 0xFFFFFFFCUL
;
2237 static void init_excp_BookE(CPUPPCState
*env
)
2239 #if !defined(CONFIG_USER_ONLY)
2240 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2241 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2242 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2243 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2244 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2245 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2246 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2247 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2248 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2249 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2250 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2251 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2252 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2253 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2254 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2255 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2256 env
->ivor_mask
= 0x0000FFF0UL
;
2257 env
->ivpr_mask
= 0xFFFF0000UL
;
2258 /* Hardware reset vector */
2259 env
->hreset_vector
= 0xFFFFFFFCUL
;
2263 static void init_excp_603(CPUPPCState
*env
)
2265 #if !defined(CONFIG_USER_ONLY)
2266 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2267 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2268 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2269 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2270 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2271 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2272 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2273 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2274 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2275 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2276 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2277 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2278 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2279 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2280 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2281 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2282 /* Hardware reset vector */
2283 env
->hreset_vector
= 0x00000100UL
;
2287 static void init_excp_604(CPUPPCState
*env
)
2289 #if !defined(CONFIG_USER_ONLY)
2290 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2291 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2292 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2293 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2294 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2295 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2296 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2297 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2298 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2299 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2300 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2301 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2302 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2303 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2304 /* Hardware reset vector */
2305 env
->hreset_vector
= 0x00000100UL
;
2309 static void init_excp_7x0(CPUPPCState
*env
)
2311 #if !defined(CONFIG_USER_ONLY)
2312 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2313 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2314 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2315 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2316 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2317 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2318 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2319 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2320 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2321 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2322 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2323 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2324 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2325 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2326 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2327 /* Hardware reset vector */
2328 env
->hreset_vector
= 0x00000100UL
;
2332 static void init_excp_750cl(CPUPPCState
*env
)
2334 #if !defined(CONFIG_USER_ONLY)
2335 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2336 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2337 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2338 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2339 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2340 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2341 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2342 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2343 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2344 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2345 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2346 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2347 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2348 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2349 /* Hardware reset vector */
2350 env
->hreset_vector
= 0x00000100UL
;
2354 static void init_excp_750cx(CPUPPCState
*env
)
2356 #if !defined(CONFIG_USER_ONLY)
2357 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2358 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2359 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2360 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2361 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2362 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2363 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2364 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2365 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2366 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2367 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2368 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2369 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2370 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2371 /* Hardware reset vector */
2372 env
->hreset_vector
= 0x00000100UL
;
2376 /* XXX: Check if this is correct */
2377 static void init_excp_7x5(CPUPPCState
*env
)
2379 #if !defined(CONFIG_USER_ONLY)
2380 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2381 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2382 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2383 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2384 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2385 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2386 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2387 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2388 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2389 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2390 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2391 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2392 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2393 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2394 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2395 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2396 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2397 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2398 /* Hardware reset vector */
2399 env
->hreset_vector
= 0x00000100UL
;
2403 static void init_excp_7400(CPUPPCState
*env
)
2405 #if !defined(CONFIG_USER_ONLY)
2406 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2407 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2408 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2409 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2410 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2411 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2412 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2413 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2414 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2415 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2416 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2417 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2418 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
2419 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2420 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2421 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
2422 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2423 /* Hardware reset vector */
2424 env
->hreset_vector
= 0x00000100UL
;
2428 static void init_excp_7450(CPUPPCState
*env
)
2430 #if !defined(CONFIG_USER_ONLY)
2431 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2432 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2433 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2434 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2435 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2436 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2437 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2438 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2439 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2440 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2441 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2442 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2443 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
2444 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2445 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2446 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
2447 /* Hardware reset vector */
2448 env
->hreset_vector
= 0x00000100UL
;
2452 #if defined(TARGET_PPC64)
2453 static void init_excp_970(CPUPPCState
*env
)
2455 #if !defined(CONFIG_USER_ONLY)
2456 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2457 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2458 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2459 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
2460 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2461 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
2462 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2463 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2464 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2465 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2466 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2467 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
2468 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2469 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2470 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2471 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
2472 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2473 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
2474 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
2475 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
2476 /* Hardware reset vector */
2477 env
->hreset_vector
= 0x0000000000000100ULL
;
2481 static void init_excp_POWER7(CPUPPCState
*env
)
2483 #if !defined(CONFIG_USER_ONLY)
2484 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2485 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2486 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2487 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
2488 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2489 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
2490 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2491 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2492 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2493 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2494 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2495 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
2496 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2497 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2498 env
->excp_vectors
[POWERPC_EXCP_HDSI
] = 0x00000E00;
2499 env
->excp_vectors
[POWERPC_EXCP_HISI
] = 0x00000E20;
2500 env
->excp_vectors
[POWERPC_EXCP_HV_EMU
] = 0x00000E40;
2501 env
->excp_vectors
[POWERPC_EXCP_HV_MAINT
] = 0x00000E60;
2502 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2503 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
2504 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
2505 /* Hardware reset vector */
2506 env
->hreset_vector
= 0x0000000000000100ULL
;
2510 static void init_excp_POWER8(CPUPPCState
*env
)
2512 init_excp_POWER7(env
);
2514 #if !defined(CONFIG_USER_ONLY)
2515 env
->excp_vectors
[POWERPC_EXCP_SDOOR
] = 0x00000A00;
2516 env
->excp_vectors
[POWERPC_EXCP_FU
] = 0x00000F60;
2517 env
->excp_vectors
[POWERPC_EXCP_HV_FU
] = 0x00000F80;
2518 env
->excp_vectors
[POWERPC_EXCP_SDOOR_HV
] = 0x00000E80;
2522 static void init_excp_POWER9(CPUPPCState
*env
)
2524 init_excp_POWER8(env
);
2526 #if !defined(CONFIG_USER_ONLY)
2527 env
->excp_vectors
[POWERPC_EXCP_HVIRT
] = 0x00000EA0;
2528 env
->excp_vectors
[POWERPC_EXCP_SYSCALL_VECTORED
] = 0x00017000;
2532 static void init_excp_POWER10(CPUPPCState
*env
)
2534 init_excp_POWER9(env
);
2539 /*****************************************************************************/
2540 /* Power management enable checks */
2541 static int check_pow_none(CPUPPCState
*env
)
2546 static int check_pow_nocheck(CPUPPCState
*env
)
2551 static int check_pow_hid0(CPUPPCState
*env
)
2553 if (env
->spr
[SPR_HID0
] & 0x00E00000) {
2560 static int check_pow_hid0_74xx(CPUPPCState
*env
)
2562 if (env
->spr
[SPR_HID0
] & 0x00600000) {
2569 /*****************************************************************************/
2570 /* PowerPC implementations definitions */
2572 #define POWERPC_FAMILY(_name) \
2574 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
2576 static const TypeInfo \
2577 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
2578 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
2579 .parent = TYPE_POWERPC_CPU, \
2581 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
2584 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
2586 type_register_static( \
2587 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
2590 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
2592 static void glue(glue(ppc_, _name), _cpu_family_class_init)
2594 static void init_proc_405(CPUPPCState
*env
)
2596 register_40x_sprs(env
);
2597 register_405_sprs(env
);
2598 register_usprgh_sprs(env
);
2600 /* Memory management */
2601 #if !defined(CONFIG_USER_ONLY)
2605 env
->tlb_type
= TLB_EMB
;
2607 init_excp_4xx_softmmu(env
);
2608 env
->dcache_line_size
= 32;
2609 env
->icache_line_size
= 32;
2610 /* Allocate hardware IRQ controller */
2611 ppc40x_irq_init(env_archcpu(env
));
2613 SET_FIT_PERIOD(8, 12, 16, 20);
2614 SET_WDT_PERIOD(16, 20, 24, 28);
2617 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
2619 DeviceClass
*dc
= DEVICE_CLASS(oc
);
2620 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
2622 dc
->desc
= "PowerPC 405";
2623 pcc
->init_proc
= init_proc_405
;
2624 pcc
->check_pow
= check_pow_nocheck
;
2625 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
2626 PPC_DCR
| PPC_WRTEE
|
2627 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
2628 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
2629 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
2630 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
2631 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
2632 pcc
->msr_mask
= (1ull << MSR_WE
) |
2642 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
2643 pcc
->excp_model
= POWERPC_EXCP_40x
;
2644 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
2645 pcc
->bfd_mach
= bfd_mach_ppc_403
;
2646 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
2647 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
2650 static void init_proc_440EP(CPUPPCState
*env
)
2652 register_BookE_sprs(env
, 0x000000000000FFFFULL
);
2653 register_440_sprs(env
);
2654 register_usprgh_sprs(env
);
2656 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
2657 SPR_NOACCESS
, SPR_NOACCESS
,
2658 &spr_read_generic
, &spr_write_generic
,
2660 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
2661 SPR_NOACCESS
, SPR_NOACCESS
,
2662 &spr_read_generic
, &spr_write_generic
,
2664 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
2665 SPR_NOACCESS
, SPR_NOACCESS
,
2666 &spr_read_generic
, &spr_write_generic
,
2669 spr_register(env
, SPR_440_CCR1
, "CCR1",
2670 SPR_NOACCESS
, SPR_NOACCESS
,
2671 &spr_read_generic
, &spr_write_generic
,
2673 /* Memory management */
2674 #if !defined(CONFIG_USER_ONLY)
2678 env
->tlb_type
= TLB_EMB
;
2680 init_excp_BookE(env
);
2681 env
->dcache_line_size
= 32;
2682 env
->icache_line_size
= 32;
2683 ppc40x_irq_init(env_archcpu(env
));
2685 SET_FIT_PERIOD(12, 16, 20, 24);
2686 SET_WDT_PERIOD(20, 24, 28, 32);
2689 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
2691 DeviceClass
*dc
= DEVICE_CLASS(oc
);
2692 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
2694 dc
->desc
= "PowerPC 440 EP";
2695 pcc
->init_proc
= init_proc_440EP
;
2696 pcc
->check_pow
= check_pow_nocheck
;
2697 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
2698 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
2699 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
2701 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
2702 PPC_CACHE
| PPC_CACHE_ICBI
|
2703 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
2704 PPC_MEM_TLBSYNC
| PPC_MFTB
|
2705 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
2707 pcc
->msr_mask
= (1ull << MSR_POW
) |
2719 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
2720 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
2721 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
2722 pcc
->bfd_mach
= bfd_mach_ppc_403
;
2723 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
2724 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
2727 POWERPC_FAMILY(460EX
)(ObjectClass
*oc
, void *data
)
2729 DeviceClass
*dc
= DEVICE_CLASS(oc
);
2730 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
2732 dc
->desc
= "PowerPC 460 EX";
2733 pcc
->init_proc
= init_proc_440EP
;
2734 pcc
->check_pow
= check_pow_nocheck
;
2735 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
2736 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
2737 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
2739 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_RFMCI
|
2740 PPC_CACHE
| PPC_CACHE_ICBI
|
2741 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
2742 PPC_MEM_TLBSYNC
| PPC_MFTB
|
2743 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
2745 pcc
->msr_mask
= (1ull << MSR_POW
) |
2757 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
2758 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
2759 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
2760 pcc
->bfd_mach
= bfd_mach_ppc_403
;
2761 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
2762 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
2765 static void init_proc_440GP(CPUPPCState
*env
)
2767 register_BookE_sprs(env
, 0x000000000000FFFFULL
);
2768 register_440_sprs(env
);
2769 register_usprgh_sprs(env
);
2771 /* Memory management */
2772 #if !defined(CONFIG_USER_ONLY)
2776 env
->tlb_type
= TLB_EMB
;
2778 init_excp_BookE(env
);
2779 env
->dcache_line_size
= 32;
2780 env
->icache_line_size
= 32;
2781 /* XXX: TODO: allocate internal IRQ controller */
2783 SET_FIT_PERIOD(12, 16, 20, 24);
2784 SET_WDT_PERIOD(20, 24, 28, 32);
2787 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
2789 DeviceClass
*dc
= DEVICE_CLASS(oc
);
2790 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
2792 dc
->desc
= "PowerPC 440 GP";
2793 pcc
->init_proc
= init_proc_440GP
;
2794 pcc
->check_pow
= check_pow_nocheck
;
2795 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
2796 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
2797 PPC_CACHE
| PPC_CACHE_ICBI
|
2798 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
2799 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
2800 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
2802 pcc
->msr_mask
= (1ull << MSR_POW
) |
2814 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
2815 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
2816 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
2817 pcc
->bfd_mach
= bfd_mach_ppc_403
;
2818 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
2819 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
2822 static void init_proc_440x5(CPUPPCState
*env
)
2824 register_BookE_sprs(env
, 0x000000000000FFFFULL
);
2825 register_440_sprs(env
);
2826 register_usprgh_sprs(env
);
2828 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
2829 SPR_NOACCESS
, SPR_NOACCESS
,
2830 &spr_read_generic
, &spr_write_generic
,
2832 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
2833 SPR_NOACCESS
, SPR_NOACCESS
,
2834 &spr_read_generic
, &spr_write_generic
,
2836 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
2837 SPR_NOACCESS
, SPR_NOACCESS
,
2838 &spr_read_generic
, &spr_write_generic
,
2841 spr_register(env
, SPR_440_CCR1
, "CCR1",
2842 SPR_NOACCESS
, SPR_NOACCESS
,
2843 &spr_read_generic
, &spr_write_generic
,
2845 /* Memory management */
2846 #if !defined(CONFIG_USER_ONLY)
2850 env
->tlb_type
= TLB_EMB
;
2852 init_excp_BookE(env
);
2853 env
->dcache_line_size
= 32;
2854 env
->icache_line_size
= 32;
2855 ppc40x_irq_init(env_archcpu(env
));
2857 SET_FIT_PERIOD(12, 16, 20, 24);
2858 SET_WDT_PERIOD(20, 24, 28, 32);
2861 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
2863 DeviceClass
*dc
= DEVICE_CLASS(oc
);
2864 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
2866 dc
->desc
= "PowerPC 440x5";
2867 pcc
->init_proc
= init_proc_440x5
;
2868 pcc
->check_pow
= check_pow_nocheck
;
2869 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
2870 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
2871 PPC_CACHE
| PPC_CACHE_ICBI
|
2872 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
2873 PPC_MEM_TLBSYNC
| PPC_MFTB
|
2874 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
2876 pcc
->msr_mask
= (1ull << MSR_POW
) |
2888 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
2889 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
2890 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
2891 pcc
->bfd_mach
= bfd_mach_ppc_403
;
2892 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
2893 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
2896 POWERPC_FAMILY(440x5wDFPU
)(ObjectClass
*oc
, void *data
)
2898 DeviceClass
*dc
= DEVICE_CLASS(oc
);
2899 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
2901 dc
->desc
= "PowerPC 440x5 with double precision FPU";
2902 pcc
->init_proc
= init_proc_440x5
;
2903 pcc
->check_pow
= check_pow_nocheck
;
2904 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
2905 PPC_FLOAT
| PPC_FLOAT_FSQRT
|
2907 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
2908 PPC_CACHE
| PPC_CACHE_ICBI
|
2909 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
2910 PPC_MEM_TLBSYNC
| PPC_MFTB
|
2911 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
2913 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
2914 pcc
->msr_mask
= (1ull << MSR_POW
) |
2926 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
2927 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
2928 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
2929 pcc
->bfd_mach
= bfd_mach_ppc_403
;
2930 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
2931 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
2934 static void init_proc_MPC5xx(CPUPPCState
*env
)
2936 register_5xx_8xx_sprs(env
);
2937 register_5xx_sprs(env
);
2938 init_excp_MPC5xx(env
);
2939 env
->dcache_line_size
= 32;
2940 env
->icache_line_size
= 32;
2941 /* XXX: TODO: allocate internal IRQ controller */
2944 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
2946 DeviceClass
*dc
= DEVICE_CLASS(oc
);
2947 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
2949 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
2950 pcc
->init_proc
= init_proc_MPC5xx
;
2951 pcc
->check_pow
= check_pow_none
;
2952 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
2953 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
2954 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
2956 pcc
->msr_mask
= (1ull << MSR_ILE
) |
2968 pcc
->mmu_model
= POWERPC_MMU_REAL
;
2969 pcc
->excp_model
= POWERPC_EXCP_6xx
;
2970 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
2971 pcc
->bfd_mach
= bfd_mach_ppc_505
;
2972 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
2973 POWERPC_FLAG_BUS_CLK
;
2976 static void init_proc_MPC8xx(CPUPPCState
*env
)
2978 register_5xx_8xx_sprs(env
);
2979 register_8xx_sprs(env
);
2980 init_excp_MPC8xx(env
);
2981 env
->dcache_line_size
= 32;
2982 env
->icache_line_size
= 32;
2983 /* XXX: TODO: allocate internal IRQ controller */
2986 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
2988 DeviceClass
*dc
= DEVICE_CLASS(oc
);
2989 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
2991 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
2992 pcc
->init_proc
= init_proc_MPC8xx
;
2993 pcc
->check_pow
= check_pow_none
;
2994 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
2995 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
2996 PPC_CACHE_ICBI
| PPC_MFTB
;
2997 pcc
->msr_mask
= (1ull << MSR_ILE
) |
3009 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
3010 pcc
->excp_model
= POWERPC_EXCP_6xx
;
3011 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
3012 pcc
->bfd_mach
= bfd_mach_ppc_860
;
3013 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
3014 POWERPC_FLAG_BUS_CLK
;
3017 /* Freescale 82xx cores (aka PowerQUICC-II) */
3019 static void init_proc_G2(CPUPPCState
*env
)
3021 register_ne_601_sprs(env
);
3022 register_sdr1_sprs(env
);
3023 register_G2_sprs(env
);
3025 /* Memory management */
3026 register_low_BATs(env
);
3027 register_high_BATs(env
);
3028 register_6xx_7xx_soft_tlb(env
, 64, 2);
3030 env
->dcache_line_size
= 32;
3031 env
->icache_line_size
= 32;
3032 /* Allocate hardware IRQ controller */
3033 ppc6xx_irq_init(env_archcpu(env
));
3036 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
3038 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3039 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3041 dc
->desc
= "PowerPC G2";
3042 pcc
->init_proc
= init_proc_G2
;
3043 pcc
->check_pow
= check_pow_hid0
;
3044 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3045 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
3047 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
3048 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3049 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
3050 PPC_SEGMENT
| PPC_EXTERN
;
3051 pcc
->msr_mask
= (1ull << MSR_POW
) |
3052 (1ull << MSR_TGPR
) |
3066 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
3067 pcc
->excp_model
= POWERPC_EXCP_6xx
;
3068 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
3069 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
3070 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
3071 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
3074 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
3076 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3077 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3079 dc
->desc
= "PowerPC G2LE";
3080 pcc
->init_proc
= init_proc_G2
;
3081 pcc
->check_pow
= check_pow_hid0
;
3082 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3083 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
3085 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
3086 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3087 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
3088 PPC_SEGMENT
| PPC_EXTERN
;
3089 pcc
->msr_mask
= (1ull << MSR_POW
) |
3090 (1ull << MSR_TGPR
) |
3106 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
3107 pcc
->excp_model
= POWERPC_EXCP_6xx
;
3108 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
3109 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
3110 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
3111 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
3114 static void init_proc_e200(CPUPPCState
*env
)
3116 register_BookE_sprs(env
, 0x000000070000FFFFULL
);
3118 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
3119 &spr_read_spefscr
, &spr_write_spefscr
,
3120 &spr_read_spefscr
, &spr_write_spefscr
,
3122 /* Memory management */
3123 register_BookE206_sprs(env
, 0x0000005D, NULL
, 0);
3124 register_usprgh_sprs(env
);
3126 spr_register(env
, SPR_HID0
, "HID0",
3127 SPR_NOACCESS
, SPR_NOACCESS
,
3128 &spr_read_generic
, &spr_write_generic
,
3131 spr_register(env
, SPR_HID1
, "HID1",
3132 SPR_NOACCESS
, SPR_NOACCESS
,
3133 &spr_read_generic
, &spr_write_generic
,
3136 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
3137 SPR_NOACCESS
, SPR_NOACCESS
,
3138 &spr_read_generic
, &spr_write_generic
,
3141 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
3142 SPR_NOACCESS
, SPR_NOACCESS
,
3143 &spr_read_generic
, &spr_write_generic
,
3146 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
3147 SPR_NOACCESS
, SPR_NOACCESS
,
3148 &spr_read_generic
, &spr_write_generic
,
3151 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
3152 SPR_NOACCESS
, SPR_NOACCESS
,
3153 &spr_read_generic
, &spr_write_generic
,
3156 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
3157 SPR_NOACCESS
, SPR_NOACCESS
,
3158 &spr_read_generic
, &spr_write_generic
,
3161 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
3162 &spr_read_generic
, SPR_NOACCESS
,
3163 &spr_read_generic
, SPR_NOACCESS
,
3166 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
3167 SPR_NOACCESS
, SPR_NOACCESS
,
3168 &spr_read_generic
, &spr_write_generic
,
3171 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
3172 SPR_NOACCESS
, SPR_NOACCESS
,
3173 &spr_read_generic
, &spr_write_generic
,
3176 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
3177 SPR_NOACCESS
, SPR_NOACCESS
,
3178 &spr_read_generic
, &spr_write_generic
,
3181 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
3182 SPR_NOACCESS
, SPR_NOACCESS
,
3183 &spr_read_generic
, &spr_write_generic
,
3186 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3187 SPR_NOACCESS
, SPR_NOACCESS
,
3188 &spr_read_generic
, &spr_write_generic
,
3191 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3192 SPR_NOACCESS
, SPR_NOACCESS
,
3193 &spr_read_generic
, &spr_write_generic
,
3196 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
3197 SPR_NOACCESS
, SPR_NOACCESS
,
3198 &spr_read_generic
, &spr_write_generic
,
3199 0x00000000); /* TOFIX */
3200 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
3201 SPR_NOACCESS
, SPR_NOACCESS
,
3202 &spr_read_generic
, &spr_write_generic
,
3204 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
3205 SPR_NOACCESS
, SPR_NOACCESS
,
3206 &spr_read_generic
, &spr_write_generic
,
3208 #if !defined(CONFIG_USER_ONLY)
3212 env
->tlb_type
= TLB_EMB
;
3214 init_excp_e200(env
, 0xFFFF0000UL
);
3215 env
->dcache_line_size
= 32;
3216 env
->icache_line_size
= 32;
3217 /* XXX: TODO: allocate internal IRQ controller */
3220 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
3222 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3223 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3225 dc
->desc
= "e200 core";
3226 pcc
->init_proc
= init_proc_e200
;
3227 pcc
->check_pow
= check_pow_hid0
;
3229 * XXX: unimplemented instructions:
3236 * all SPE multiply-accumulate instructions
3238 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
3239 PPC_SPE
| PPC_SPE_SINGLE
|
3240 PPC_WRTEE
| PPC_RFDI
|
3241 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
3242 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3243 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
3245 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
3259 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
3260 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3261 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3262 pcc
->bfd_mach
= bfd_mach_ppc_860
;
3263 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
3264 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
3265 POWERPC_FLAG_BUS_CLK
;
3268 enum fsl_e500_version
{
3276 static void init_proc_e500(CPUPPCState
*env
, int version
)
3278 uint32_t tlbncfg
[2];
3280 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
3281 uint32_t l1cfg0
= 0x3800 /* 8 ways */
3282 | 0x0020; /* 32 kb */
3283 uint32_t l1cfg1
= 0x3800 /* 8 ways */
3284 | 0x0020; /* 32 kb */
3285 uint32_t mmucfg
= 0;
3286 #if !defined(CONFIG_USER_ONLY)
3291 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
3292 * complain when accessing them.
3293 * register_BookE_sprs(env, 0x0000000F0000FD7FULL);
3299 ivor_mask
= 0x0000000F0000FFFFULL
;
3303 ivor_mask
= 0x000003FE0000FFFFULL
;
3306 ivor_mask
= 0x000003FF0000FFFFULL
;
3309 register_BookE_sprs(env
, ivor_mask
);
3310 register_usprg3_sprs(env
);
3311 /* Processor identification */
3312 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3313 SPR_NOACCESS
, SPR_NOACCESS
,
3314 &spr_read_generic
, &spr_write_pir
,
3317 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
3318 &spr_read_spefscr
, &spr_write_spefscr
,
3319 &spr_read_spefscr
, &spr_write_spefscr
,
3321 #if !defined(CONFIG_USER_ONLY)
3322 /* Memory management */
3328 tlbncfg
[0] = register_tlbncfg(2, 1, 1, 0, 256);
3329 tlbncfg
[1] = register_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
3332 tlbncfg
[0] = register_tlbncfg(4, 1, 1, 0, 512);
3333 tlbncfg
[1] = register_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
3337 tlbncfg
[0] = register_tlbncfg(4, 1, 1, 0, 512);
3338 tlbncfg
[1] = register_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
3343 tlbncfg
[0] = 0x08052400;
3344 tlbncfg
[1] = 0x40028040;
3347 cpu_abort(env_cpu(env
), "Unknown CPU: " TARGET_FMT_lx
"\n",
3355 env
->dcache_line_size
= 32;
3356 env
->icache_line_size
= 32;
3360 env
->dcache_line_size
= 64;
3361 env
->icache_line_size
= 64;
3362 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
3363 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
3366 env
->dcache_line_size
= 32;
3367 env
->icache_line_size
= 32;
3368 l1cfg0
|= 0x0F83820;
3369 l1cfg1
|= 0x0B83820;
3372 cpu_abort(env_cpu(env
), "Unknown CPU: " TARGET_FMT_lx
"\n",
3375 register_BookE206_sprs(env
, 0x000000DF, tlbncfg
, mmucfg
);
3376 register_usprgh_sprs(env
);
3378 spr_register(env
, SPR_HID0
, "HID0",
3379 SPR_NOACCESS
, SPR_NOACCESS
,
3380 &spr_read_generic
, &spr_write_generic
,
3383 spr_register(env
, SPR_HID1
, "HID1",
3384 SPR_NOACCESS
, SPR_NOACCESS
,
3385 &spr_read_generic
, &spr_write_generic
,
3388 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
3389 SPR_NOACCESS
, SPR_NOACCESS
,
3390 &spr_read_generic
, &spr_write_generic
,
3393 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
3394 SPR_NOACCESS
, SPR_NOACCESS
,
3395 &spr_read_generic
, &spr_write_generic
,
3398 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
3399 SPR_NOACCESS
, SPR_NOACCESS
,
3400 &spr_read_generic
, &spr_write_generic
,
3403 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3404 SPR_NOACCESS
, SPR_NOACCESS
,
3405 &spr_read_generic
, &spr_write_generic
,
3408 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
3409 SPR_NOACCESS
, SPR_NOACCESS
,
3410 &spr_read_generic
, &spr_write_generic
,
3413 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
3414 SPR_NOACCESS
, SPR_NOACCESS
,
3415 &spr_read_generic
, &spr_write_generic
,
3418 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
3419 &spr_read_generic
, SPR_NOACCESS
,
3420 &spr_read_generic
, SPR_NOACCESS
,
3422 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
3423 &spr_read_generic
, SPR_NOACCESS
,
3424 &spr_read_generic
, SPR_NOACCESS
,
3426 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
3427 SPR_NOACCESS
, SPR_NOACCESS
,
3428 &spr_read_generic
, &spr_write_e500_l1csr0
,
3430 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
3431 SPR_NOACCESS
, SPR_NOACCESS
,
3432 &spr_read_generic
, &spr_write_e500_l1csr1
,
3434 if (version
!= fsl_e500v1
&& version
!= fsl_e500v2
) {
3435 spr_register(env
, SPR_Exxx_L2CSR0
, "L2CSR0",
3436 SPR_NOACCESS
, SPR_NOACCESS
,
3437 &spr_read_generic
, &spr_write_e500_l2csr0
,
3440 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3441 SPR_NOACCESS
, SPR_NOACCESS
,
3442 &spr_read_generic
, &spr_write_generic
,
3444 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3445 SPR_NOACCESS
, SPR_NOACCESS
,
3446 &spr_read_generic
, &spr_write_generic
,
3448 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
3449 SPR_NOACCESS
, SPR_NOACCESS
,
3450 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
3452 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
3453 SPR_NOACCESS
, SPR_NOACCESS
,
3454 &spr_read_generic
, SPR_NOACCESS
,
3456 /* XXX better abstract into Emb.xxx features */
3457 if ((version
== fsl_e5500
) || (version
== fsl_e6500
)) {
3458 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
3459 SPR_NOACCESS
, SPR_NOACCESS
,
3460 &spr_read_generic
, &spr_write_generic
,
3462 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
3463 SPR_NOACCESS
, SPR_NOACCESS
,
3464 &spr_read_mas73
, &spr_write_mas73
,
3466 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
3469 if (version
== fsl_e6500
) {
3470 /* Thread identification */
3471 spr_register(env
, SPR_TIR
, "TIR",
3472 SPR_NOACCESS
, SPR_NOACCESS
,
3473 &spr_read_generic
, SPR_NOACCESS
,
3475 spr_register(env
, SPR_BOOKE_TLB0PS
, "TLB0PS",
3476 SPR_NOACCESS
, SPR_NOACCESS
,
3477 &spr_read_generic
, SPR_NOACCESS
,
3479 spr_register(env
, SPR_BOOKE_TLB1PS
, "TLB1PS",
3480 SPR_NOACCESS
, SPR_NOACCESS
,
3481 &spr_read_generic
, SPR_NOACCESS
,
3485 #if !defined(CONFIG_USER_ONLY)
3487 env
->tlb_type
= TLB_MAS
;
3488 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
3489 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
3493 init_excp_e200(env
, ivpr_mask
);
3494 /* Allocate hardware IRQ controller */
3495 ppce500_irq_init(env_archcpu(env
));
3498 static void init_proc_e500v1(CPUPPCState
*env
)
3500 init_proc_e500(env
, fsl_e500v1
);
3503 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
3505 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3506 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3508 dc
->desc
= "e500v1 core";
3509 pcc
->init_proc
= init_proc_e500v1
;
3510 pcc
->check_pow
= check_pow_hid0
;
3511 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
3512 PPC_SPE
| PPC_SPE_SINGLE
|
3513 PPC_WRTEE
| PPC_RFDI
|
3514 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
3515 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3516 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
3517 pcc
->insns_flags2
= PPC2_BOOKE206
;
3518 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
3532 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
3533 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3534 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3535 pcc
->bfd_mach
= bfd_mach_ppc_860
;
3536 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
3537 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
3538 POWERPC_FLAG_BUS_CLK
;
3541 static void init_proc_e500v2(CPUPPCState
*env
)
3543 init_proc_e500(env
, fsl_e500v2
);
3546 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
3548 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3549 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3551 dc
->desc
= "e500v2 core";
3552 pcc
->init_proc
= init_proc_e500v2
;
3553 pcc
->check_pow
= check_pow_hid0
;
3554 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
3555 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
3556 PPC_WRTEE
| PPC_RFDI
|
3557 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
3558 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3559 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
3560 pcc
->insns_flags2
= PPC2_BOOKE206
;
3561 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
3575 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
3576 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3577 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3578 pcc
->bfd_mach
= bfd_mach_ppc_860
;
3579 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
3580 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
3581 POWERPC_FLAG_BUS_CLK
;
3584 static void init_proc_e500mc(CPUPPCState
*env
)
3586 init_proc_e500(env
, fsl_e500mc
);
3589 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
3591 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3592 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3594 dc
->desc
= "e500mc core";
3595 pcc
->init_proc
= init_proc_e500mc
;
3596 pcc
->check_pow
= check_pow_none
;
3597 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
3598 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
3599 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
3600 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3601 PPC_FLOAT
| PPC_FLOAT_FRES
|
3602 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
3603 PPC_FLOAT_STFIWX
| PPC_WAIT
|
3604 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
3605 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
3606 pcc
->msr_mask
= (1ull << MSR_GS
) |
3607 (1ull << MSR_UCLE
) |
3620 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
3621 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3622 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3623 /* FIXME: figure out the correct flag for e500mc */
3624 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
3625 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3626 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
3630 static void init_proc_e5500(CPUPPCState
*env
)
3632 init_proc_e500(env
, fsl_e5500
);
3635 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
3637 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3638 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3640 dc
->desc
= "e5500 core";
3641 pcc
->init_proc
= init_proc_e5500
;
3642 pcc
->check_pow
= check_pow_none
;
3643 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
3644 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
3645 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
3646 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3647 PPC_FLOAT
| PPC_FLOAT_FRES
|
3648 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
3649 PPC_FLOAT_STFIWX
| PPC_WAIT
|
3650 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
3651 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
3652 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
|
3654 pcc
->msr_mask
= (1ull << MSR_CM
) |
3656 (1ull << MSR_UCLE
) |
3669 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
3670 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3671 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3672 /* FIXME: figure out the correct flag for e5500 */
3673 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
3674 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3675 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
3678 static void init_proc_e6500(CPUPPCState
*env
)
3680 init_proc_e500(env
, fsl_e6500
);
3683 POWERPC_FAMILY(e6500
)(ObjectClass
*oc
, void *data
)
3685 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3686 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3688 dc
->desc
= "e6500 core";
3689 pcc
->init_proc
= init_proc_e6500
;
3690 pcc
->check_pow
= check_pow_none
;
3691 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
3692 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
3693 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
3694 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3695 PPC_FLOAT
| PPC_FLOAT_FRES
|
3696 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
3697 PPC_FLOAT_STFIWX
| PPC_WAIT
|
3698 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
3699 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
| PPC_ALTIVEC
;
3700 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
|
3701 PPC2_FP_CVT_S64
| PPC2_ATOMIC_ISA206
;
3702 pcc
->msr_mask
= (1ull << MSR_CM
) |
3704 (1ull << MSR_UCLE
) |
3718 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
3719 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3720 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3721 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
3722 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3723 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_VRE
;
3728 /* Non-embedded PowerPC */
3729 static void init_proc_603(CPUPPCState
*env
)
3731 register_ne_601_sprs(env
);
3732 register_sdr1_sprs(env
);
3733 register_603_sprs(env
);
3735 /* Memory management */
3736 register_low_BATs(env
);
3737 register_6xx_7xx_soft_tlb(env
, 64, 2);
3739 env
->dcache_line_size
= 32;
3740 env
->icache_line_size
= 32;
3741 /* Allocate hardware IRQ controller */
3742 ppc6xx_irq_init(env_archcpu(env
));
3745 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
3747 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3748 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3750 dc
->desc
= "PowerPC 603";
3751 pcc
->init_proc
= init_proc_603
;
3752 pcc
->check_pow
= check_pow_hid0
;
3753 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3754 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
3755 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
3756 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
3757 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3758 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
3759 PPC_SEGMENT
| PPC_EXTERN
;
3760 pcc
->msr_mask
= (1ull << MSR_POW
) |
3761 (1ull << MSR_TGPR
) |
3776 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
3777 pcc
->excp_model
= POWERPC_EXCP_6xx
;
3778 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
3779 pcc
->bfd_mach
= bfd_mach_ppc_603
;
3780 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
3781 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
3784 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
3786 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3787 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3789 dc
->desc
= "PowerPC 603e";
3790 pcc
->init_proc
= init_proc_603
;
3791 pcc
->check_pow
= check_pow_hid0
;
3792 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3793 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
3794 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
3795 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
3796 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3797 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
3798 PPC_SEGMENT
| PPC_EXTERN
;
3799 pcc
->msr_mask
= (1ull << MSR_POW
) |
3800 (1ull << MSR_TGPR
) |
3815 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
3816 pcc
->excp_model
= POWERPC_EXCP_6xx
;
3817 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
3818 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
3819 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
3820 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
3823 static void init_proc_e300(CPUPPCState
*env
)
3826 register_e300_sprs(env
);
3829 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
3831 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3832 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3834 dc
->desc
= "e300 core";
3835 pcc
->init_proc
= init_proc_e300
;
3836 pcc
->check_pow
= check_pow_hid0
;
3837 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3838 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
3840 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
3841 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3842 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
3843 PPC_SEGMENT
| PPC_EXTERN
;
3844 pcc
->msr_mask
= (1ull << MSR_POW
) |
3845 (1ull << MSR_TGPR
) |
3861 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
3862 pcc
->excp_model
= POWERPC_EXCP_6xx
;
3863 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
3864 pcc
->bfd_mach
= bfd_mach_ppc_603
;
3865 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
3866 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
3869 static void init_proc_604(CPUPPCState
*env
)
3871 register_ne_601_sprs(env
);
3872 register_sdr1_sprs(env
);
3873 register_604_sprs(env
);
3875 /* Memory management */
3876 register_low_BATs(env
);
3878 env
->dcache_line_size
= 32;
3879 env
->icache_line_size
= 32;
3880 /* Allocate hardware IRQ controller */
3881 ppc6xx_irq_init(env_archcpu(env
));
3884 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
3886 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3887 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3889 dc
->desc
= "PowerPC 604";
3890 pcc
->init_proc
= init_proc_604
;
3891 pcc
->check_pow
= check_pow_nocheck
;
3892 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3893 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
3894 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
3895 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
3896 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3897 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
3898 PPC_SEGMENT
| PPC_EXTERN
;
3899 pcc
->msr_mask
= (1ull << MSR_POW
) |
3915 pcc
->mmu_model
= POWERPC_MMU_32B
;
3916 pcc
->excp_model
= POWERPC_EXCP_6xx
;
3917 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
3918 pcc
->bfd_mach
= bfd_mach_ppc_604
;
3919 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
3920 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
3923 static void init_proc_604E(CPUPPCState
*env
)
3926 register_604e_sprs(env
);
3929 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
3931 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3932 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3934 dc
->desc
= "PowerPC 604E";
3935 pcc
->init_proc
= init_proc_604E
;
3936 pcc
->check_pow
= check_pow_nocheck
;
3937 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3938 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
3939 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
3940 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
3941 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3942 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
3943 PPC_SEGMENT
| PPC_EXTERN
;
3944 pcc
->msr_mask
= (1ull << MSR_POW
) |
3960 pcc
->mmu_model
= POWERPC_MMU_32B
;
3961 pcc
->excp_model
= POWERPC_EXCP_6xx
;
3962 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
3963 pcc
->bfd_mach
= bfd_mach_ppc_604
;
3964 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
3965 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
3968 static void init_proc_740(CPUPPCState
*env
)
3970 register_ne_601_sprs(env
);
3971 register_sdr1_sprs(env
);
3972 register_7xx_sprs(env
);
3973 /* Thermal management */
3974 register_thrm_sprs(env
);
3976 /* Memory management */
3977 register_low_BATs(env
);
3979 env
->dcache_line_size
= 32;
3980 env
->icache_line_size
= 32;
3981 /* Allocate hardware IRQ controller */
3982 ppc6xx_irq_init(env_archcpu(env
));
3985 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
3987 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3988 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3990 dc
->desc
= "PowerPC 740";
3991 pcc
->init_proc
= init_proc_740
;
3992 pcc
->check_pow
= check_pow_hid0
;
3993 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3994 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
3995 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
3996 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
3997 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3998 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
3999 PPC_SEGMENT
| PPC_EXTERN
;
4000 pcc
->msr_mask
= (1ull << MSR_POW
) |
4016 pcc
->mmu_model
= POWERPC_MMU_32B
;
4017 pcc
->excp_model
= POWERPC_EXCP_7xx
;
4018 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4019 pcc
->bfd_mach
= bfd_mach_ppc_750
;
4020 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4021 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4024 static void init_proc_750(CPUPPCState
*env
)
4026 register_ne_601_sprs(env
);
4027 register_sdr1_sprs(env
);
4028 register_7xx_sprs(env
);
4030 spr_register(env
, SPR_L2CR
, "L2CR",
4031 SPR_NOACCESS
, SPR_NOACCESS
,
4032 &spr_read_generic
, spr_access_nop
,
4034 /* Thermal management */
4035 register_thrm_sprs(env
);
4037 /* Memory management */
4038 register_low_BATs(env
);
4040 * XXX: high BATs are also present but are known to be bugged on
4044 env
->dcache_line_size
= 32;
4045 env
->icache_line_size
= 32;
4046 /* Allocate hardware IRQ controller */
4047 ppc6xx_irq_init(env_archcpu(env
));
4050 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
4052 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4053 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4055 dc
->desc
= "PowerPC 750";
4056 pcc
->init_proc
= init_proc_750
;
4057 pcc
->check_pow
= check_pow_hid0
;
4058 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4059 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4060 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
4061 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4062 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4063 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4064 PPC_SEGMENT
| PPC_EXTERN
;
4065 pcc
->msr_mask
= (1ull << MSR_POW
) |
4081 pcc
->mmu_model
= POWERPC_MMU_32B
;
4082 pcc
->excp_model
= POWERPC_EXCP_7xx
;
4083 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4084 pcc
->bfd_mach
= bfd_mach_ppc_750
;
4085 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4086 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4089 static void init_proc_750cl(CPUPPCState
*env
)
4091 register_ne_601_sprs(env
);
4092 register_sdr1_sprs(env
);
4093 register_7xx_sprs(env
);
4095 spr_register(env
, SPR_L2CR
, "L2CR",
4096 SPR_NOACCESS
, SPR_NOACCESS
,
4097 &spr_read_generic
, spr_access_nop
,
4099 /* Thermal management */
4100 /* Those registers are fake on 750CL */
4101 spr_register(env
, SPR_THRM1
, "THRM1",
4102 SPR_NOACCESS
, SPR_NOACCESS
,
4103 &spr_read_generic
, &spr_write_generic
,
4105 spr_register(env
, SPR_THRM2
, "THRM2",
4106 SPR_NOACCESS
, SPR_NOACCESS
,
4107 &spr_read_generic
, &spr_write_generic
,
4109 spr_register(env
, SPR_THRM3
, "THRM3",
4110 SPR_NOACCESS
, SPR_NOACCESS
,
4111 &spr_read_generic
, &spr_write_generic
,
4114 spr_register(env
, SPR_750_TDCL
, "TDCL",
4115 SPR_NOACCESS
, SPR_NOACCESS
,
4116 &spr_read_generic
, &spr_write_generic
,
4118 spr_register(env
, SPR_750_TDCH
, "TDCH",
4119 SPR_NOACCESS
, SPR_NOACCESS
,
4120 &spr_read_generic
, &spr_write_generic
,
4123 spr_register(env
, SPR_750_WPAR
, "WPAR",
4124 SPR_NOACCESS
, SPR_NOACCESS
,
4125 &spr_read_generic
, &spr_write_generic
,
4127 spr_register(env
, SPR_750_DMAL
, "DMAL",
4128 SPR_NOACCESS
, SPR_NOACCESS
,
4129 &spr_read_generic
, &spr_write_generic
,
4131 spr_register(env
, SPR_750_DMAU
, "DMAU",
4132 SPR_NOACCESS
, SPR_NOACCESS
,
4133 &spr_read_generic
, &spr_write_generic
,
4135 /* Hardware implementation registers */
4136 spr_register(env
, SPR_750CL_HID2
, "HID2",
4137 SPR_NOACCESS
, SPR_NOACCESS
,
4138 &spr_read_generic
, &spr_write_generic
,
4141 spr_register(env
, SPR_750CL_HID4
, "HID4",
4142 SPR_NOACCESS
, SPR_NOACCESS
,
4143 &spr_read_generic
, &spr_write_generic
,
4145 /* Quantization registers */
4146 spr_register(env
, SPR_750_GQR0
, "GQR0",
4147 SPR_NOACCESS
, SPR_NOACCESS
,
4148 &spr_read_generic
, &spr_write_generic
,
4151 spr_register(env
, SPR_750_GQR1
, "GQR1",
4152 SPR_NOACCESS
, SPR_NOACCESS
,
4153 &spr_read_generic
, &spr_write_generic
,
4156 spr_register(env
, SPR_750_GQR2
, "GQR2",
4157 SPR_NOACCESS
, SPR_NOACCESS
,
4158 &spr_read_generic
, &spr_write_generic
,
4161 spr_register(env
, SPR_750_GQR3
, "GQR3",
4162 SPR_NOACCESS
, SPR_NOACCESS
,
4163 &spr_read_generic
, &spr_write_generic
,
4166 spr_register(env
, SPR_750_GQR4
, "GQR4",
4167 SPR_NOACCESS
, SPR_NOACCESS
,
4168 &spr_read_generic
, &spr_write_generic
,
4171 spr_register(env
, SPR_750_GQR5
, "GQR5",
4172 SPR_NOACCESS
, SPR_NOACCESS
,
4173 &spr_read_generic
, &spr_write_generic
,
4176 spr_register(env
, SPR_750_GQR6
, "GQR6",
4177 SPR_NOACCESS
, SPR_NOACCESS
,
4178 &spr_read_generic
, &spr_write_generic
,
4181 spr_register(env
, SPR_750_GQR7
, "GQR7",
4182 SPR_NOACCESS
, SPR_NOACCESS
,
4183 &spr_read_generic
, &spr_write_generic
,
4185 /* Memory management */
4186 register_low_BATs(env
);
4187 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
4188 register_high_BATs(env
);
4189 init_excp_750cl(env
);
4190 env
->dcache_line_size
= 32;
4191 env
->icache_line_size
= 32;
4192 /* Allocate hardware IRQ controller */
4193 ppc6xx_irq_init(env_archcpu(env
));
4196 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
4198 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4199 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4201 dc
->desc
= "PowerPC 750 CL";
4202 pcc
->init_proc
= init_proc_750cl
;
4203 pcc
->check_pow
= check_pow_hid0
;
4205 * XXX: not implemented:
4206 * cache lock instructions:
4208 * floating point paired instructions
4243 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4244 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4245 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
4246 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4247 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4248 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4249 PPC_SEGMENT
| PPC_EXTERN
;
4250 pcc
->msr_mask
= (1ull << MSR_POW
) |
4266 pcc
->mmu_model
= POWERPC_MMU_32B
;
4267 pcc
->excp_model
= POWERPC_EXCP_7xx
;
4268 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4269 pcc
->bfd_mach
= bfd_mach_ppc_750
;
4270 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4271 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4274 static void init_proc_750cx(CPUPPCState
*env
)
4276 register_ne_601_sprs(env
);
4277 register_sdr1_sprs(env
);
4278 register_7xx_sprs(env
);
4280 spr_register(env
, SPR_L2CR
, "L2CR",
4281 SPR_NOACCESS
, SPR_NOACCESS
,
4282 &spr_read_generic
, spr_access_nop
,
4284 /* Thermal management */
4285 register_thrm_sprs(env
);
4287 spr_register(env
, SPR_SDA
, "SDA",
4288 SPR_NOACCESS
, SPR_NOACCESS
,
4289 &spr_read_generic
, &spr_write_generic
,
4292 /* Memory management */
4293 register_low_BATs(env
);
4294 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
4295 register_high_BATs(env
);
4296 init_excp_750cx(env
);
4297 env
->dcache_line_size
= 32;
4298 env
->icache_line_size
= 32;
4299 /* Allocate hardware IRQ controller */
4300 ppc6xx_irq_init(env_archcpu(env
));
4303 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
4305 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4306 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4308 dc
->desc
= "PowerPC 750CX";
4309 pcc
->init_proc
= init_proc_750cx
;
4310 pcc
->check_pow
= check_pow_hid0
;
4311 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4312 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4313 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
4314 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4315 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4316 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4317 PPC_SEGMENT
| PPC_EXTERN
;
4318 pcc
->msr_mask
= (1ull << MSR_POW
) |
4334 pcc
->mmu_model
= POWERPC_MMU_32B
;
4335 pcc
->excp_model
= POWERPC_EXCP_7xx
;
4336 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4337 pcc
->bfd_mach
= bfd_mach_ppc_750
;
4338 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4339 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4342 static void init_proc_750fx(CPUPPCState
*env
)
4344 register_ne_601_sprs(env
);
4345 register_sdr1_sprs(env
);
4346 register_7xx_sprs(env
);
4348 spr_register(env
, SPR_L2CR
, "L2CR",
4349 SPR_NOACCESS
, SPR_NOACCESS
,
4350 &spr_read_generic
, spr_access_nop
,
4352 /* Thermal management */
4353 register_thrm_sprs(env
);
4355 spr_register(env
, SPR_750_THRM4
, "THRM4",
4356 SPR_NOACCESS
, SPR_NOACCESS
,
4357 &spr_read_generic
, &spr_write_generic
,
4359 /* Hardware implementation registers */
4360 spr_register(env
, SPR_750FX_HID2
, "HID2",
4361 SPR_NOACCESS
, SPR_NOACCESS
,
4362 &spr_read_generic
, &spr_write_generic
,
4364 /* Memory management */
4365 register_low_BATs(env
);
4366 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
4367 register_high_BATs(env
);
4369 env
->dcache_line_size
= 32;
4370 env
->icache_line_size
= 32;
4371 /* Allocate hardware IRQ controller */
4372 ppc6xx_irq_init(env_archcpu(env
));
4375 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
4377 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4378 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4380 dc
->desc
= "PowerPC 750FX";
4381 pcc
->init_proc
= init_proc_750fx
;
4382 pcc
->check_pow
= check_pow_hid0
;
4383 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4384 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4385 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
4386 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4387 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4388 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4389 PPC_SEGMENT
| PPC_EXTERN
;
4390 pcc
->msr_mask
= (1ull << MSR_POW
) |
4406 pcc
->mmu_model
= POWERPC_MMU_32B
;
4407 pcc
->excp_model
= POWERPC_EXCP_7xx
;
4408 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4409 pcc
->bfd_mach
= bfd_mach_ppc_750
;
4410 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4411 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4414 static void init_proc_750gx(CPUPPCState
*env
)
4416 register_ne_601_sprs(env
);
4417 register_sdr1_sprs(env
);
4418 register_7xx_sprs(env
);
4420 spr_register(env
, SPR_L2CR
, "L2CR",
4421 SPR_NOACCESS
, SPR_NOACCESS
,
4422 &spr_read_generic
, spr_access_nop
,
4424 /* Thermal management */
4425 register_thrm_sprs(env
);
4427 spr_register(env
, SPR_750_THRM4
, "THRM4",
4428 SPR_NOACCESS
, SPR_NOACCESS
,
4429 &spr_read_generic
, &spr_write_generic
,
4431 /* Hardware implementation registers */
4432 spr_register(env
, SPR_750FX_HID2
, "HID2",
4433 SPR_NOACCESS
, SPR_NOACCESS
,
4434 &spr_read_generic
, &spr_write_generic
,
4436 /* Memory management */
4437 register_low_BATs(env
);
4438 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
4439 register_high_BATs(env
);
4441 env
->dcache_line_size
= 32;
4442 env
->icache_line_size
= 32;
4443 /* Allocate hardware IRQ controller */
4444 ppc6xx_irq_init(env_archcpu(env
));
4447 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
4449 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4450 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4452 dc
->desc
= "PowerPC 750GX";
4453 pcc
->init_proc
= init_proc_750gx
;
4454 pcc
->check_pow
= check_pow_hid0
;
4455 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4456 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4457 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
4458 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4459 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4460 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4461 PPC_SEGMENT
| PPC_EXTERN
;
4462 pcc
->msr_mask
= (1ull << MSR_POW
) |
4478 pcc
->mmu_model
= POWERPC_MMU_32B
;
4479 pcc
->excp_model
= POWERPC_EXCP_7xx
;
4480 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4481 pcc
->bfd_mach
= bfd_mach_ppc_750
;
4482 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4483 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4486 static void init_proc_745(CPUPPCState
*env
)
4488 register_ne_601_sprs(env
);
4489 register_sdr1_sprs(env
);
4490 register_7xx_sprs(env
);
4491 register_745_sprs(env
);
4492 /* Thermal management */
4493 register_thrm_sprs(env
);
4495 /* Memory management */
4496 register_low_BATs(env
);
4497 register_high_BATs(env
);
4498 register_6xx_7xx_soft_tlb(env
, 64, 2);
4500 env
->dcache_line_size
= 32;
4501 env
->icache_line_size
= 32;
4502 /* Allocate hardware IRQ controller */
4503 ppc6xx_irq_init(env_archcpu(env
));
4506 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
4508 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4509 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4511 dc
->desc
= "PowerPC 745";
4512 pcc
->init_proc
= init_proc_745
;
4513 pcc
->check_pow
= check_pow_hid0
;
4514 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4515 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4516 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
4517 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4518 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4519 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4520 PPC_SEGMENT
| PPC_EXTERN
;
4521 pcc
->msr_mask
= (1ull << MSR_POW
) |
4537 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4538 pcc
->excp_model
= POWERPC_EXCP_7xx
;
4539 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4540 pcc
->bfd_mach
= bfd_mach_ppc_750
;
4541 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4542 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4545 static void init_proc_755(CPUPPCState
*env
)
4547 register_ne_601_sprs(env
);
4548 register_sdr1_sprs(env
);
4549 register_7xx_sprs(env
);
4550 register_745_sprs(env
);
4551 register_755_sprs(env
);
4553 /* Thermal management */
4554 register_thrm_sprs(env
);
4556 /* Memory management */
4557 register_low_BATs(env
);
4558 register_high_BATs(env
);
4559 register_6xx_7xx_soft_tlb(env
, 64, 2);
4561 env
->dcache_line_size
= 32;
4562 env
->icache_line_size
= 32;
4563 /* Allocate hardware IRQ controller */
4564 ppc6xx_irq_init(env_archcpu(env
));
4567 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
4569 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4570 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4572 dc
->desc
= "PowerPC 755";
4573 pcc
->init_proc
= init_proc_755
;
4574 pcc
->check_pow
= check_pow_hid0
;
4575 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4576 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4577 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
4578 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4579 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4580 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4581 PPC_SEGMENT
| PPC_EXTERN
;
4582 pcc
->msr_mask
= (1ull << MSR_POW
) |
4598 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4599 pcc
->excp_model
= POWERPC_EXCP_7xx
;
4600 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4601 pcc
->bfd_mach
= bfd_mach_ppc_750
;
4602 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4603 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4606 static void init_proc_7400(CPUPPCState
*env
)
4608 register_ne_601_sprs(env
);
4609 register_sdr1_sprs(env
);
4610 register_74xx_sprs(env
);
4611 vscr_init(env
, 0x00010000);
4613 spr_register(env
, SPR_UBAMR
, "UBAMR",
4614 &spr_read_ureg
, SPR_NOACCESS
,
4615 &spr_read_ureg
, SPR_NOACCESS
,
4618 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
4619 SPR_NOACCESS
, SPR_NOACCESS
,
4620 &spr_read_generic
, &spr_write_generic
,
4622 /* Thermal management */
4623 register_thrm_sprs(env
);
4624 /* Memory management */
4625 register_low_BATs(env
);
4626 init_excp_7400(env
);
4627 env
->dcache_line_size
= 32;
4628 env
->icache_line_size
= 32;
4629 /* Allocate hardware IRQ controller */
4630 ppc6xx_irq_init(env_archcpu(env
));
4633 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
4635 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4636 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4638 dc
->desc
= "PowerPC 7400 (aka G4)";
4639 pcc
->init_proc
= init_proc_7400
;
4640 pcc
->check_pow
= check_pow_hid0
;
4641 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4642 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4643 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4645 PPC_CACHE
| PPC_CACHE_ICBI
|
4646 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
4647 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4648 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4650 PPC_SEGMENT
| PPC_EXTERN
|
4652 pcc
->msr_mask
= (1ull << MSR_VR
) |
4669 pcc
->mmu_model
= POWERPC_MMU_32B
;
4670 pcc
->excp_model
= POWERPC_EXCP_74xx
;
4671 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4672 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
4673 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
4674 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
4675 POWERPC_FLAG_BUS_CLK
;
4678 static void init_proc_7410(CPUPPCState
*env
)
4680 register_ne_601_sprs(env
);
4681 register_sdr1_sprs(env
);
4682 register_74xx_sprs(env
);
4683 vscr_init(env
, 0x00010000);
4685 spr_register(env
, SPR_UBAMR
, "UBAMR",
4686 &spr_read_ureg
, SPR_NOACCESS
,
4687 &spr_read_ureg
, SPR_NOACCESS
,
4689 /* Thermal management */
4690 register_thrm_sprs(env
);
4693 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
4694 SPR_NOACCESS
, SPR_NOACCESS
,
4695 &spr_read_generic
, &spr_write_generic
,
4699 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
4700 SPR_NOACCESS
, SPR_NOACCESS
,
4701 &spr_read_generic
, &spr_write_generic
,
4703 /* Memory management */
4704 register_low_BATs(env
);
4705 init_excp_7400(env
);
4706 env
->dcache_line_size
= 32;
4707 env
->icache_line_size
= 32;
4708 /* Allocate hardware IRQ controller */
4709 ppc6xx_irq_init(env_archcpu(env
));
4712 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
4714 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4715 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4717 dc
->desc
= "PowerPC 7410 (aka G4)";
4718 pcc
->init_proc
= init_proc_7410
;
4719 pcc
->check_pow
= check_pow_hid0
;
4720 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4721 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4722 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4724 PPC_CACHE
| PPC_CACHE_ICBI
|
4725 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
4726 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4727 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4729 PPC_SEGMENT
| PPC_EXTERN
|
4731 pcc
->msr_mask
= (1ull << MSR_VR
) |
4748 pcc
->mmu_model
= POWERPC_MMU_32B
;
4749 pcc
->excp_model
= POWERPC_EXCP_74xx
;
4750 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4751 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
4752 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
4753 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
4754 POWERPC_FLAG_BUS_CLK
;
4757 static void init_proc_7440(CPUPPCState
*env
)
4759 register_ne_601_sprs(env
);
4760 register_sdr1_sprs(env
);
4761 register_74xx_sprs(env
);
4762 vscr_init(env
, 0x00010000);
4764 spr_register(env
, SPR_UBAMR
, "UBAMR",
4765 &spr_read_ureg
, SPR_NOACCESS
,
4766 &spr_read_ureg
, SPR_NOACCESS
,
4769 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
4770 SPR_NOACCESS
, SPR_NOACCESS
,
4771 &spr_read_generic
, &spr_write_generic
,
4774 spr_register(env
, SPR_ICTRL
, "ICTRL",
4775 SPR_NOACCESS
, SPR_NOACCESS
,
4776 &spr_read_generic
, &spr_write_generic
,
4779 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
4780 SPR_NOACCESS
, SPR_NOACCESS
,
4781 &spr_read_generic
, &spr_write_generic
,
4784 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
4785 SPR_NOACCESS
, SPR_NOACCESS
,
4786 &spr_read_generic
, &spr_write_generic
,
4789 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
4790 &spr_read_ureg
, SPR_NOACCESS
,
4791 &spr_read_ureg
, SPR_NOACCESS
,
4794 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
4795 SPR_NOACCESS
, SPR_NOACCESS
,
4796 &spr_read_generic
, &spr_write_generic
,
4799 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
4800 &spr_read_ureg
, SPR_NOACCESS
,
4801 &spr_read_ureg
, SPR_NOACCESS
,
4803 /* Memory management */
4804 register_low_BATs(env
);
4805 init_excp_7450(env
);
4806 env
->dcache_line_size
= 32;
4807 env
->icache_line_size
= 32;
4808 /* Allocate hardware IRQ controller */
4809 ppc6xx_irq_init(env_archcpu(env
));
4812 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
4814 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4815 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4817 dc
->desc
= "PowerPC 7440 (aka G4)";
4818 pcc
->init_proc
= init_proc_7440
;
4819 pcc
->check_pow
= check_pow_hid0_74xx
;
4820 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4821 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4822 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4824 PPC_CACHE
| PPC_CACHE_ICBI
|
4825 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
4826 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4827 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4829 PPC_SEGMENT
| PPC_EXTERN
|
4831 pcc
->msr_mask
= (1ull << MSR_VR
) |
4848 pcc
->mmu_model
= POWERPC_MMU_32B
;
4849 pcc
->excp_model
= POWERPC_EXCP_74xx
;
4850 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4851 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
4852 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
4853 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
4854 POWERPC_FLAG_BUS_CLK
;
4857 static void init_proc_7450(CPUPPCState
*env
)
4859 register_ne_601_sprs(env
);
4860 register_sdr1_sprs(env
);
4861 register_74xx_sprs(env
);
4862 vscr_init(env
, 0x00010000);
4863 /* Level 3 cache control */
4864 register_l3_ctrl(env
);
4866 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
4867 SPR_NOACCESS
, SPR_NOACCESS
,
4868 &spr_read_generic
, &spr_write_generic
,
4871 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
4872 SPR_NOACCESS
, SPR_NOACCESS
,
4873 &spr_read_generic
, &spr_write_generic
,
4876 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
4877 SPR_NOACCESS
, SPR_NOACCESS
,
4878 &spr_read_generic
, &spr_write_generic
,
4881 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
4882 SPR_NOACCESS
, SPR_NOACCESS
,
4883 &spr_read_generic
, &spr_write_generic
,
4886 spr_register(env
, SPR_UBAMR
, "UBAMR",
4887 &spr_read_ureg
, SPR_NOACCESS
,
4888 &spr_read_ureg
, SPR_NOACCESS
,
4891 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
4892 SPR_NOACCESS
, SPR_NOACCESS
,
4893 &spr_read_generic
, &spr_write_generic
,
4896 spr_register(env
, SPR_ICTRL
, "ICTRL",
4897 SPR_NOACCESS
, SPR_NOACCESS
,
4898 &spr_read_generic
, &spr_write_generic
,
4901 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
4902 SPR_NOACCESS
, SPR_NOACCESS
,
4903 &spr_read_generic
, &spr_write_generic
,
4906 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
4907 SPR_NOACCESS
, SPR_NOACCESS
,
4908 &spr_read_generic
, &spr_write_generic
,
4911 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
4912 &spr_read_ureg
, SPR_NOACCESS
,
4913 &spr_read_ureg
, SPR_NOACCESS
,
4916 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
4917 SPR_NOACCESS
, SPR_NOACCESS
,
4918 &spr_read_generic
, &spr_write_generic
,
4921 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
4922 &spr_read_ureg
, SPR_NOACCESS
,
4923 &spr_read_ureg
, SPR_NOACCESS
,
4925 /* Memory management */
4926 register_low_BATs(env
);
4927 init_excp_7450(env
);
4928 env
->dcache_line_size
= 32;
4929 env
->icache_line_size
= 32;
4930 /* Allocate hardware IRQ controller */
4931 ppc6xx_irq_init(env_archcpu(env
));
4934 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
4936 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4937 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4939 dc
->desc
= "PowerPC 7450 (aka G4)";
4940 pcc
->init_proc
= init_proc_7450
;
4941 pcc
->check_pow
= check_pow_hid0_74xx
;
4942 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4943 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4944 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4946 PPC_CACHE
| PPC_CACHE_ICBI
|
4947 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
4948 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4949 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
4951 PPC_SEGMENT
| PPC_EXTERN
|
4953 pcc
->msr_mask
= (1ull << MSR_VR
) |
4970 pcc
->mmu_model
= POWERPC_MMU_32B
;
4971 pcc
->excp_model
= POWERPC_EXCP_74xx
;
4972 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4973 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
4974 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
4975 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
4976 POWERPC_FLAG_BUS_CLK
;
4979 static void init_proc_7445(CPUPPCState
*env
)
4981 register_ne_601_sprs(env
);
4982 register_sdr1_sprs(env
);
4983 register_74xx_sprs(env
);
4984 vscr_init(env
, 0x00010000);
4986 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
4987 SPR_NOACCESS
, SPR_NOACCESS
,
4988 &spr_read_generic
, &spr_write_generic
,
4991 spr_register(env
, SPR_ICTRL
, "ICTRL",
4992 SPR_NOACCESS
, SPR_NOACCESS
,
4993 &spr_read_generic
, &spr_write_generic
,
4996 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
4997 SPR_NOACCESS
, SPR_NOACCESS
,
4998 &spr_read_generic
, &spr_write_generic
,
5001 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
5002 SPR_NOACCESS
, SPR_NOACCESS
,
5003 &spr_read_generic
, &spr_write_generic
,
5006 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
5007 &spr_read_ureg
, SPR_NOACCESS
,
5008 &spr_read_ureg
, SPR_NOACCESS
,
5011 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
5012 SPR_NOACCESS
, SPR_NOACCESS
,
5013 &spr_read_generic
, &spr_write_generic
,
5016 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
5017 &spr_read_ureg
, SPR_NOACCESS
,
5018 &spr_read_ureg
, SPR_NOACCESS
,
5021 spr_register(env
, SPR_SPRG4
, "SPRG4",
5022 SPR_NOACCESS
, SPR_NOACCESS
,
5023 &spr_read_generic
, &spr_write_generic
,
5025 spr_register(env
, SPR_USPRG4
, "USPRG4",
5026 &spr_read_ureg
, SPR_NOACCESS
,
5027 &spr_read_ureg
, SPR_NOACCESS
,
5029 spr_register(env
, SPR_SPRG5
, "SPRG5",
5030 SPR_NOACCESS
, SPR_NOACCESS
,
5031 &spr_read_generic
, &spr_write_generic
,
5033 spr_register(env
, SPR_USPRG5
, "USPRG5",
5034 &spr_read_ureg
, SPR_NOACCESS
,
5035 &spr_read_ureg
, SPR_NOACCESS
,
5037 spr_register(env
, SPR_SPRG6
, "SPRG6",
5038 SPR_NOACCESS
, SPR_NOACCESS
,
5039 &spr_read_generic
, &spr_write_generic
,
5041 spr_register(env
, SPR_USPRG6
, "USPRG6",
5042 &spr_read_ureg
, SPR_NOACCESS
,
5043 &spr_read_ureg
, SPR_NOACCESS
,
5045 spr_register(env
, SPR_SPRG7
, "SPRG7",
5046 SPR_NOACCESS
, SPR_NOACCESS
,
5047 &spr_read_generic
, &spr_write_generic
,
5049 spr_register(env
, SPR_USPRG7
, "USPRG7",
5050 &spr_read_ureg
, SPR_NOACCESS
,
5051 &spr_read_ureg
, SPR_NOACCESS
,
5053 /* Memory management */
5054 register_low_BATs(env
);
5055 register_high_BATs(env
);
5056 init_excp_7450(env
);
5057 env
->dcache_line_size
= 32;
5058 env
->icache_line_size
= 32;
5059 /* Allocate hardware IRQ controller */
5060 ppc6xx_irq_init(env_archcpu(env
));
5063 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
5065 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5066 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5068 dc
->desc
= "PowerPC 7445 (aka G4)";
5069 pcc
->init_proc
= init_proc_7445
;
5070 pcc
->check_pow
= check_pow_hid0_74xx
;
5071 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5072 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5073 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
5075 PPC_CACHE
| PPC_CACHE_ICBI
|
5076 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
5077 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5078 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5080 PPC_SEGMENT
| PPC_EXTERN
|
5082 pcc
->msr_mask
= (1ull << MSR_VR
) |
5099 pcc
->mmu_model
= POWERPC_MMU_32B
;
5100 pcc
->excp_model
= POWERPC_EXCP_74xx
;
5101 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5102 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
5103 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
5104 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
5105 POWERPC_FLAG_BUS_CLK
;
5108 static void init_proc_7455(CPUPPCState
*env
)
5110 register_ne_601_sprs(env
);
5111 register_sdr1_sprs(env
);
5112 register_74xx_sprs(env
);
5113 vscr_init(env
, 0x00010000);
5114 /* Level 3 cache control */
5115 register_l3_ctrl(env
);
5117 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
5118 SPR_NOACCESS
, SPR_NOACCESS
,
5119 &spr_read_generic
, &spr_write_generic
,
5122 spr_register(env
, SPR_ICTRL
, "ICTRL",
5123 SPR_NOACCESS
, SPR_NOACCESS
,
5124 &spr_read_generic
, &spr_write_generic
,
5127 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
5128 SPR_NOACCESS
, SPR_NOACCESS
,
5129 &spr_read_generic
, &spr_write_generic
,
5132 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
5133 SPR_NOACCESS
, SPR_NOACCESS
,
5134 &spr_read_generic
, &spr_write_generic
,
5137 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
5138 &spr_read_ureg
, SPR_NOACCESS
,
5139 &spr_read_ureg
, SPR_NOACCESS
,
5142 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
5143 SPR_NOACCESS
, SPR_NOACCESS
,
5144 &spr_read_generic
, &spr_write_generic
,
5147 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
5148 &spr_read_ureg
, SPR_NOACCESS
,
5149 &spr_read_ureg
, SPR_NOACCESS
,
5152 spr_register(env
, SPR_SPRG4
, "SPRG4",
5153 SPR_NOACCESS
, SPR_NOACCESS
,
5154 &spr_read_generic
, &spr_write_generic
,
5156 spr_register(env
, SPR_USPRG4
, "USPRG4",
5157 &spr_read_ureg
, SPR_NOACCESS
,
5158 &spr_read_ureg
, SPR_NOACCESS
,
5160 spr_register(env
, SPR_SPRG5
, "SPRG5",
5161 SPR_NOACCESS
, SPR_NOACCESS
,
5162 &spr_read_generic
, &spr_write_generic
,
5164 spr_register(env
, SPR_USPRG5
, "USPRG5",
5165 &spr_read_ureg
, SPR_NOACCESS
,
5166 &spr_read_ureg
, SPR_NOACCESS
,
5168 spr_register(env
, SPR_SPRG6
, "SPRG6",
5169 SPR_NOACCESS
, SPR_NOACCESS
,
5170 &spr_read_generic
, &spr_write_generic
,
5172 spr_register(env
, SPR_USPRG6
, "USPRG6",
5173 &spr_read_ureg
, SPR_NOACCESS
,
5174 &spr_read_ureg
, SPR_NOACCESS
,
5176 spr_register(env
, SPR_SPRG7
, "SPRG7",
5177 SPR_NOACCESS
, SPR_NOACCESS
,
5178 &spr_read_generic
, &spr_write_generic
,
5180 spr_register(env
, SPR_USPRG7
, "USPRG7",
5181 &spr_read_ureg
, SPR_NOACCESS
,
5182 &spr_read_ureg
, SPR_NOACCESS
,
5184 /* Memory management */
5185 register_low_BATs(env
);
5186 register_high_BATs(env
);
5187 init_excp_7450(env
);
5188 env
->dcache_line_size
= 32;
5189 env
->icache_line_size
= 32;
5190 /* Allocate hardware IRQ controller */
5191 ppc6xx_irq_init(env_archcpu(env
));
5194 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
5196 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5197 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5199 dc
->desc
= "PowerPC 7455 (aka G4)";
5200 pcc
->init_proc
= init_proc_7455
;
5201 pcc
->check_pow
= check_pow_hid0_74xx
;
5202 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5203 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5204 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
5206 PPC_CACHE
| PPC_CACHE_ICBI
|
5207 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
5208 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5209 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5211 PPC_SEGMENT
| PPC_EXTERN
|
5213 pcc
->msr_mask
= (1ull << MSR_VR
) |
5230 pcc
->mmu_model
= POWERPC_MMU_32B
;
5231 pcc
->excp_model
= POWERPC_EXCP_74xx
;
5232 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5233 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
5234 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
5235 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
5236 POWERPC_FLAG_BUS_CLK
;
5239 static void init_proc_7457(CPUPPCState
*env
)
5241 register_ne_601_sprs(env
);
5242 register_sdr1_sprs(env
);
5243 register_74xx_sprs(env
);
5244 vscr_init(env
, 0x00010000);
5245 /* Level 3 cache control */
5246 register_l3_ctrl(env
);
5248 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
5249 SPR_NOACCESS
, SPR_NOACCESS
,
5250 &spr_read_generic
, &spr_write_generic
,
5253 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
5254 SPR_NOACCESS
, SPR_NOACCESS
,
5255 &spr_read_generic
, &spr_write_generic
,
5258 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
5259 SPR_NOACCESS
, SPR_NOACCESS
,
5260 &spr_read_generic
, &spr_write_generic
,
5263 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
5264 SPR_NOACCESS
, SPR_NOACCESS
,
5265 &spr_read_generic
, &spr_write_generic
,
5268 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
5269 SPR_NOACCESS
, SPR_NOACCESS
,
5270 &spr_read_generic
, &spr_write_generic
,
5273 spr_register(env
, SPR_ICTRL
, "ICTRL",
5274 SPR_NOACCESS
, SPR_NOACCESS
,
5275 &spr_read_generic
, &spr_write_generic
,
5278 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
5279 SPR_NOACCESS
, SPR_NOACCESS
,
5280 &spr_read_generic
, &spr_write_generic
,
5283 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
5284 SPR_NOACCESS
, SPR_NOACCESS
,
5285 &spr_read_generic
, &spr_write_generic
,
5288 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
5289 &spr_read_ureg
, SPR_NOACCESS
,
5290 &spr_read_ureg
, SPR_NOACCESS
,
5293 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
5294 SPR_NOACCESS
, SPR_NOACCESS
,
5295 &spr_read_generic
, &spr_write_generic
,
5298 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
5299 &spr_read_ureg
, SPR_NOACCESS
,
5300 &spr_read_ureg
, SPR_NOACCESS
,
5303 spr_register(env
, SPR_SPRG4
, "SPRG4",
5304 SPR_NOACCESS
, SPR_NOACCESS
,
5305 &spr_read_generic
, &spr_write_generic
,
5307 spr_register(env
, SPR_USPRG4
, "USPRG4",
5308 &spr_read_ureg
, SPR_NOACCESS
,
5309 &spr_read_ureg
, SPR_NOACCESS
,
5311 spr_register(env
, SPR_SPRG5
, "SPRG5",
5312 SPR_NOACCESS
, SPR_NOACCESS
,
5313 &spr_read_generic
, &spr_write_generic
,
5315 spr_register(env
, SPR_USPRG5
, "USPRG5",
5316 &spr_read_ureg
, SPR_NOACCESS
,
5317 &spr_read_ureg
, SPR_NOACCESS
,
5319 spr_register(env
, SPR_SPRG6
, "SPRG6",
5320 SPR_NOACCESS
, SPR_NOACCESS
,
5321 &spr_read_generic
, &spr_write_generic
,
5323 spr_register(env
, SPR_USPRG6
, "USPRG6",
5324 &spr_read_ureg
, SPR_NOACCESS
,
5325 &spr_read_ureg
, SPR_NOACCESS
,
5327 spr_register(env
, SPR_SPRG7
, "SPRG7",
5328 SPR_NOACCESS
, SPR_NOACCESS
,
5329 &spr_read_generic
, &spr_write_generic
,
5331 spr_register(env
, SPR_USPRG7
, "USPRG7",
5332 &spr_read_ureg
, SPR_NOACCESS
,
5333 &spr_read_ureg
, SPR_NOACCESS
,
5335 /* Memory management */
5336 register_low_BATs(env
);
5337 register_high_BATs(env
);
5338 init_excp_7450(env
);
5339 env
->dcache_line_size
= 32;
5340 env
->icache_line_size
= 32;
5341 /* Allocate hardware IRQ controller */
5342 ppc6xx_irq_init(env_archcpu(env
));
5345 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
5347 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5348 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5350 dc
->desc
= "PowerPC 7457 (aka G4)";
5351 pcc
->init_proc
= init_proc_7457
;
5352 pcc
->check_pow
= check_pow_hid0_74xx
;
5353 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5354 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5355 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
5357 PPC_CACHE
| PPC_CACHE_ICBI
|
5358 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
5359 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5360 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5362 PPC_SEGMENT
| PPC_EXTERN
|
5364 pcc
->msr_mask
= (1ull << MSR_VR
) |
5381 pcc
->mmu_model
= POWERPC_MMU_32B
;
5382 pcc
->excp_model
= POWERPC_EXCP_74xx
;
5383 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5384 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
5385 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
5386 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
5387 POWERPC_FLAG_BUS_CLK
;
5390 static void init_proc_e600(CPUPPCState
*env
)
5392 register_ne_601_sprs(env
);
5393 register_sdr1_sprs(env
);
5394 register_74xx_sprs(env
);
5395 vscr_init(env
, 0x00010000);
5397 spr_register(env
, SPR_UBAMR
, "UBAMR",
5398 &spr_read_ureg
, SPR_NOACCESS
,
5399 &spr_read_ureg
, SPR_NOACCESS
,
5402 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
5403 SPR_NOACCESS
, SPR_NOACCESS
,
5404 &spr_read_generic
, &spr_write_generic
,
5407 spr_register(env
, SPR_ICTRL
, "ICTRL",
5408 SPR_NOACCESS
, SPR_NOACCESS
,
5409 &spr_read_generic
, &spr_write_generic
,
5412 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
5413 SPR_NOACCESS
, SPR_NOACCESS
,
5414 &spr_read_generic
, &spr_write_generic
,
5417 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
5418 SPR_NOACCESS
, SPR_NOACCESS
,
5419 &spr_read_generic
, &spr_write_generic
,
5422 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
5423 &spr_read_ureg
, SPR_NOACCESS
,
5424 &spr_read_ureg
, SPR_NOACCESS
,
5427 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
5428 SPR_NOACCESS
, SPR_NOACCESS
,
5429 &spr_read_generic
, &spr_write_generic
,
5432 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
5433 &spr_read_ureg
, SPR_NOACCESS
,
5434 &spr_read_ureg
, SPR_NOACCESS
,
5437 spr_register(env
, SPR_SPRG4
, "SPRG4",
5438 SPR_NOACCESS
, SPR_NOACCESS
,
5439 &spr_read_generic
, &spr_write_generic
,
5441 spr_register(env
, SPR_USPRG4
, "USPRG4",
5442 &spr_read_ureg
, SPR_NOACCESS
,
5443 &spr_read_ureg
, SPR_NOACCESS
,
5445 spr_register(env
, SPR_SPRG5
, "SPRG5",
5446 SPR_NOACCESS
, SPR_NOACCESS
,
5447 &spr_read_generic
, &spr_write_generic
,
5449 spr_register(env
, SPR_USPRG5
, "USPRG5",
5450 &spr_read_ureg
, SPR_NOACCESS
,
5451 &spr_read_ureg
, SPR_NOACCESS
,
5453 spr_register(env
, SPR_SPRG6
, "SPRG6",
5454 SPR_NOACCESS
, SPR_NOACCESS
,
5455 &spr_read_generic
, &spr_write_generic
,
5457 spr_register(env
, SPR_USPRG6
, "USPRG6",
5458 &spr_read_ureg
, SPR_NOACCESS
,
5459 &spr_read_ureg
, SPR_NOACCESS
,
5461 spr_register(env
, SPR_SPRG7
, "SPRG7",
5462 SPR_NOACCESS
, SPR_NOACCESS
,
5463 &spr_read_generic
, &spr_write_generic
,
5465 spr_register(env
, SPR_USPRG7
, "USPRG7",
5466 &spr_read_ureg
, SPR_NOACCESS
,
5467 &spr_read_ureg
, SPR_NOACCESS
,
5469 /* Memory management */
5470 register_low_BATs(env
);
5471 register_high_BATs(env
);
5472 init_excp_7450(env
);
5473 env
->dcache_line_size
= 32;
5474 env
->icache_line_size
= 32;
5475 /* Allocate hardware IRQ controller */
5476 ppc6xx_irq_init(env_archcpu(env
));
5479 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
5481 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5482 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5484 dc
->desc
= "PowerPC e600";
5485 pcc
->init_proc
= init_proc_e600
;
5486 pcc
->check_pow
= check_pow_hid0_74xx
;
5487 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5488 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5489 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
5491 PPC_CACHE
| PPC_CACHE_ICBI
|
5492 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
5493 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5494 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5496 PPC_SEGMENT
| PPC_EXTERN
|
5498 pcc
->insns_flags2
= PPC_NONE
;
5499 pcc
->msr_mask
= (1ull << MSR_VR
) |
5516 pcc
->mmu_model
= POWERPC_MMU_32B
;
5517 pcc
->excp_model
= POWERPC_EXCP_74xx
;
5518 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5519 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
5520 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
5521 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
5522 POWERPC_FLAG_BUS_CLK
;
5525 #if defined(TARGET_PPC64)
5526 #if defined(CONFIG_USER_ONLY)
5527 #define POWERPC970_HID5_INIT 0x00000080
5529 #define POWERPC970_HID5_INIT 0x00000000
5532 static int check_pow_970(CPUPPCState
*env
)
5534 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
5541 static void register_970_hid_sprs(CPUPPCState
*env
)
5543 /* Hardware implementation registers */
5544 spr_register(env
, SPR_HID0
, "HID0",
5545 SPR_NOACCESS
, SPR_NOACCESS
,
5546 &spr_read_generic
, &spr_write_clear
,
5548 spr_register(env
, SPR_HID1
, "HID1",
5549 SPR_NOACCESS
, SPR_NOACCESS
,
5550 &spr_read_generic
, &spr_write_generic
,
5552 spr_register(env
, SPR_970_HID5
, "HID5",
5553 SPR_NOACCESS
, SPR_NOACCESS
,
5554 &spr_read_generic
, &spr_write_generic
,
5555 POWERPC970_HID5_INIT
);
5558 static void register_970_hior_sprs(CPUPPCState
*env
)
5560 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
5561 SPR_NOACCESS
, SPR_NOACCESS
,
5562 &spr_read_hior
, &spr_write_hior
,
5566 static void register_book3s_ctrl_sprs(CPUPPCState
*env
)
5568 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
5569 SPR_NOACCESS
, SPR_NOACCESS
,
5570 SPR_NOACCESS
, &spr_write_CTRL
,
5572 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
5573 &spr_read_ureg
, SPR_NOACCESS
,
5574 &spr_read_ureg
, SPR_NOACCESS
,
5578 static void register_book3s_altivec_sprs(CPUPPCState
*env
)
5580 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
5584 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
5585 &spr_read_generic
, &spr_write_generic
,
5586 &spr_read_generic
, &spr_write_generic
,
5587 KVM_REG_PPC_VRSAVE
, 0x00000000);
5591 static void register_book3s_dbg_sprs(CPUPPCState
*env
)
5594 * TODO: different specs define different scopes for these,
5595 * will have to address this:
5596 * 970: super/write and super/read
5597 * powerisa 2.03..2.04: hypv/write and super/read.
5598 * powerisa 2.05 and newer: hypv/write and hypv/read.
5600 spr_register_kvm(env
, SPR_DABR
, "DABR",
5601 SPR_NOACCESS
, SPR_NOACCESS
,
5602 &spr_read_generic
, &spr_write_generic
,
5603 KVM_REG_PPC_DABR
, 0x00000000);
5604 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
5605 SPR_NOACCESS
, SPR_NOACCESS
,
5606 &spr_read_generic
, &spr_write_generic
,
5607 KVM_REG_PPC_DABRX
, 0x00000000);
5610 static void register_book3s_207_dbg_sprs(CPUPPCState
*env
)
5612 spr_register_kvm_hv(env
, SPR_DAWR0
, "DAWR0",
5613 SPR_NOACCESS
, SPR_NOACCESS
,
5614 SPR_NOACCESS
, SPR_NOACCESS
,
5615 &spr_read_generic
, &spr_write_generic
,
5616 KVM_REG_PPC_DAWR
, 0x00000000);
5617 spr_register_kvm_hv(env
, SPR_DAWRX0
, "DAWRX0",
5618 SPR_NOACCESS
, SPR_NOACCESS
,
5619 SPR_NOACCESS
, SPR_NOACCESS
,
5620 &spr_read_generic
, &spr_write_generic
,
5621 KVM_REG_PPC_DAWRX
, 0x00000000);
5622 spr_register_kvm_hv(env
, SPR_CIABR
, "CIABR",
5623 SPR_NOACCESS
, SPR_NOACCESS
,
5624 SPR_NOACCESS
, SPR_NOACCESS
,
5625 &spr_read_generic
, &spr_write_generic
,
5626 KVM_REG_PPC_CIABR
, 0x00000000);
5629 static void register_970_dbg_sprs(CPUPPCState
*env
)
5632 spr_register(env
, SPR_IABR
, "IABR",
5633 SPR_NOACCESS
, SPR_NOACCESS
,
5634 &spr_read_generic
, &spr_write_generic
,
5638 static void register_book3s_pmu_sup_sprs(CPUPPCState
*env
)
5640 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
5641 SPR_NOACCESS
, SPR_NOACCESS
,
5642 &spr_read_generic
, &spr_write_MMCR0
,
5643 KVM_REG_PPC_MMCR0
, 0x80000000);
5644 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
5645 SPR_NOACCESS
, SPR_NOACCESS
,
5646 &spr_read_generic
, &spr_write_MMCR1
,
5647 KVM_REG_PPC_MMCR1
, 0x00000000);
5648 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
5649 SPR_NOACCESS
, SPR_NOACCESS
,
5650 &spr_read_generic
, &spr_write_generic
,
5651 KVM_REG_PPC_MMCRA
, 0x00000000);
5652 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
5653 SPR_NOACCESS
, SPR_NOACCESS
,
5654 &spr_read_PMC
, &spr_write_PMC
,
5655 KVM_REG_PPC_PMC1
, 0x00000000);
5656 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
5657 SPR_NOACCESS
, SPR_NOACCESS
,
5658 &spr_read_PMC
, &spr_write_PMC
,
5659 KVM_REG_PPC_PMC2
, 0x00000000);
5660 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
5661 SPR_NOACCESS
, SPR_NOACCESS
,
5662 &spr_read_PMC
, &spr_write_PMC
,
5663 KVM_REG_PPC_PMC3
, 0x00000000);
5664 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
5665 SPR_NOACCESS
, SPR_NOACCESS
,
5666 &spr_read_PMC
, &spr_write_PMC
,
5667 KVM_REG_PPC_PMC4
, 0x00000000);
5668 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
5669 SPR_NOACCESS
, SPR_NOACCESS
,
5670 &spr_read_PMC
, &spr_write_PMC
,
5671 KVM_REG_PPC_PMC5
, 0x00000000);
5672 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
5673 SPR_NOACCESS
, SPR_NOACCESS
,
5674 &spr_read_PMC
, &spr_write_PMC
,
5675 KVM_REG_PPC_PMC6
, 0x00000000);
5676 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
5677 SPR_NOACCESS
, SPR_NOACCESS
,
5678 &spr_read_generic
, &spr_write_generic
,
5679 KVM_REG_PPC_SIAR
, 0x00000000);
5680 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
5681 SPR_NOACCESS
, SPR_NOACCESS
,
5682 &spr_read_generic
, &spr_write_generic
,
5683 KVM_REG_PPC_SDAR
, 0x00000000);
5686 static void register_book3s_pmu_user_sprs(CPUPPCState
*env
)
5688 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
5689 &spr_read_MMCR0_ureg
, &spr_write_MMCR0_ureg
,
5690 &spr_read_ureg
, &spr_write_ureg
,
5692 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
5693 &spr_read_ureg
, SPR_NOACCESS
,
5694 &spr_read_ureg
, &spr_write_ureg
,
5696 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
5697 &spr_read_ureg
, SPR_NOACCESS
,
5698 &spr_read_ureg
, &spr_write_ureg
,
5700 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
5701 &spr_read_PMC14_ureg
, &spr_write_PMC14_ureg
,
5702 &spr_read_ureg
, &spr_write_ureg
,
5704 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
5705 &spr_read_PMC14_ureg
, &spr_write_PMC14_ureg
,
5706 &spr_read_ureg
, &spr_write_ureg
,
5708 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
5709 &spr_read_PMC14_ureg
, &spr_write_PMC14_ureg
,
5710 &spr_read_ureg
, &spr_write_ureg
,
5712 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
5713 &spr_read_PMC14_ureg
, &spr_write_PMC14_ureg
,
5714 &spr_read_ureg
, &spr_write_ureg
,
5716 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
5717 &spr_read_PMC56_ureg
, &spr_write_PMC56_ureg
,
5718 &spr_read_ureg
, &spr_write_ureg
,
5720 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
5721 &spr_read_PMC56_ureg
, &spr_write_PMC56_ureg
,
5722 &spr_read_ureg
, &spr_write_ureg
,
5724 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
5725 &spr_read_ureg
, SPR_NOACCESS
,
5726 &spr_read_ureg
, &spr_write_ureg
,
5728 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
5729 &spr_read_ureg
, SPR_NOACCESS
,
5730 &spr_read_ureg
, &spr_write_ureg
,
5734 static void register_970_pmu_sup_sprs(CPUPPCState
*env
)
5736 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
5737 SPR_NOACCESS
, SPR_NOACCESS
,
5738 &spr_read_generic
, &spr_write_generic
,
5739 KVM_REG_PPC_PMC7
, 0x00000000);
5740 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
5741 SPR_NOACCESS
, SPR_NOACCESS
,
5742 &spr_read_generic
, &spr_write_generic
,
5743 KVM_REG_PPC_PMC8
, 0x00000000);
5746 static void register_970_pmu_user_sprs(CPUPPCState
*env
)
5748 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
5749 &spr_read_ureg
, SPR_NOACCESS
,
5750 &spr_read_ureg
, &spr_write_ureg
,
5752 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
5753 &spr_read_ureg
, SPR_NOACCESS
,
5754 &spr_read_ureg
, &spr_write_ureg
,
5758 static void register_power8_pmu_sup_sprs(CPUPPCState
*env
)
5760 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
5761 SPR_NOACCESS
, SPR_NOACCESS
,
5762 &spr_read_generic
, &spr_write_generic
,
5763 KVM_REG_PPC_MMCR2
, 0x00000000);
5764 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
5765 SPR_NOACCESS
, SPR_NOACCESS
,
5766 &spr_read_generic
, &spr_write_generic
,
5767 KVM_REG_PPC_MMCRS
, 0x00000000);
5768 spr_register_kvm(env
, SPR_POWER_SIER
, "SIER",
5769 SPR_NOACCESS
, SPR_NOACCESS
,
5770 &spr_read_generic
, &spr_write_generic
,
5771 KVM_REG_PPC_SIER
, 0x00000000);
5772 spr_register_kvm(env
, SPR_POWER_SPMC1
, "SPMC1",
5773 SPR_NOACCESS
, SPR_NOACCESS
,
5774 &spr_read_generic
, &spr_write_generic
,
5775 KVM_REG_PPC_SPMC1
, 0x00000000);
5776 spr_register_kvm(env
, SPR_POWER_SPMC2
, "SPMC2",
5777 SPR_NOACCESS
, SPR_NOACCESS
,
5778 &spr_read_generic
, &spr_write_generic
,
5779 KVM_REG_PPC_SPMC2
, 0x00000000);
5780 spr_register_kvm(env
, SPR_TACR
, "TACR",
5781 SPR_NOACCESS
, SPR_NOACCESS
,
5782 &spr_read_generic
, &spr_write_generic
,
5783 KVM_REG_PPC_TACR
, 0x00000000);
5784 spr_register_kvm(env
, SPR_TCSCR
, "TCSCR",
5785 SPR_NOACCESS
, SPR_NOACCESS
,
5786 &spr_read_generic
, &spr_write_generic
,
5787 KVM_REG_PPC_TCSCR
, 0x00000000);
5788 spr_register_kvm(env
, SPR_CSIGR
, "CSIGR",
5789 SPR_NOACCESS
, SPR_NOACCESS
,
5790 &spr_read_generic
, &spr_write_generic
,
5791 KVM_REG_PPC_CSIGR
, 0x00000000);
5794 static void register_power8_pmu_user_sprs(CPUPPCState
*env
)
5796 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
5797 &spr_read_MMCR2_ureg
, &spr_write_MMCR2_ureg
,
5798 &spr_read_ureg
, &spr_write_ureg
,
5800 spr_register(env
, SPR_POWER_USIER
, "USIER",
5801 &spr_read_generic
, SPR_NOACCESS
,
5802 &spr_read_generic
, &spr_write_generic
,
5806 static void register_power5p_ear_sprs(CPUPPCState
*env
)
5808 /* External access control */
5809 spr_register(env
, SPR_EAR
, "EAR",
5810 SPR_NOACCESS
, SPR_NOACCESS
,
5811 &spr_read_generic
, &spr_write_generic
,
5815 static void register_power5p_tb_sprs(CPUPPCState
*env
)
5817 /* TBU40 (High 40 bits of the Timebase register */
5818 spr_register_hv(env
, SPR_TBU40
, "TBU40",
5819 SPR_NOACCESS
, SPR_NOACCESS
,
5820 SPR_NOACCESS
, SPR_NOACCESS
,
5821 SPR_NOACCESS
, &spr_write_tbu40
,
5825 static void register_970_lpar_sprs(CPUPPCState
*env
)
5827 #if !defined(CONFIG_USER_ONLY)
5829 * PPC970: HID4 covers things later controlled by the LPCR and
5830 * RMOR in later CPUs, but with a different encoding. We only
5831 * support the 970 in "Apple mode" which has all hypervisor
5832 * facilities disabled by strapping, so we can basically just
5835 spr_register(env
, SPR_970_HID4
, "HID4",
5836 SPR_NOACCESS
, SPR_NOACCESS
,
5837 &spr_read_generic
, &spr_write_generic
,
5842 static void register_power5p_lpar_sprs(CPUPPCState
*env
)
5844 #if !defined(CONFIG_USER_ONLY)
5845 /* Logical partitionning */
5846 spr_register_kvm_hv(env
, SPR_LPCR
, "LPCR",
5847 SPR_NOACCESS
, SPR_NOACCESS
,
5848 SPR_NOACCESS
, SPR_NOACCESS
,
5849 &spr_read_generic
, &spr_write_lpcr
,
5850 KVM_REG_PPC_LPCR
, LPCR_LPES0
| LPCR_LPES1
);
5851 spr_register_hv(env
, SPR_HDEC
, "HDEC",
5852 SPR_NOACCESS
, SPR_NOACCESS
,
5853 SPR_NOACCESS
, SPR_NOACCESS
,
5854 &spr_read_hdecr
, &spr_write_hdecr
, 0);
5858 static void register_book3s_ids_sprs(CPUPPCState
*env
)
5860 /* FIXME: Will need to deal with thread vs core only SPRs */
5862 /* Processor identification */
5863 spr_register_hv(env
, SPR_PIR
, "PIR",
5864 SPR_NOACCESS
, SPR_NOACCESS
,
5865 &spr_read_generic
, SPR_NOACCESS
,
5866 &spr_read_generic
, NULL
,
5868 spr_register_hv(env
, SPR_HID0
, "HID0",
5869 SPR_NOACCESS
, SPR_NOACCESS
,
5870 SPR_NOACCESS
, SPR_NOACCESS
,
5871 &spr_read_generic
, &spr_write_generic
,
5873 spr_register_hv(env
, SPR_TSCR
, "TSCR",
5874 SPR_NOACCESS
, SPR_NOACCESS
,
5875 SPR_NOACCESS
, SPR_NOACCESS
,
5876 &spr_read_generic
, &spr_write_generic
,
5878 spr_register_hv(env
, SPR_HMER
, "HMER",
5879 SPR_NOACCESS
, SPR_NOACCESS
,
5880 SPR_NOACCESS
, SPR_NOACCESS
,
5881 &spr_read_generic
, &spr_write_hmer
,
5883 spr_register_hv(env
, SPR_HMEER
, "HMEER",
5884 SPR_NOACCESS
, SPR_NOACCESS
,
5885 SPR_NOACCESS
, SPR_NOACCESS
,
5886 &spr_read_generic
, &spr_write_generic
,
5888 spr_register_hv(env
, SPR_TFMR
, "TFMR",
5889 SPR_NOACCESS
, SPR_NOACCESS
,
5890 SPR_NOACCESS
, SPR_NOACCESS
,
5891 &spr_read_generic
, &spr_write_generic
,
5893 spr_register_hv(env
, SPR_LPIDR
, "LPIDR",
5894 SPR_NOACCESS
, SPR_NOACCESS
,
5895 SPR_NOACCESS
, SPR_NOACCESS
,
5896 &spr_read_generic
, &spr_write_lpidr
,
5898 spr_register_hv(env
, SPR_HFSCR
, "HFSCR",
5899 SPR_NOACCESS
, SPR_NOACCESS
,
5900 SPR_NOACCESS
, SPR_NOACCESS
,
5901 &spr_read_generic
, &spr_write_generic
,
5903 spr_register_hv(env
, SPR_MMCRC
, "MMCRC",
5904 SPR_NOACCESS
, SPR_NOACCESS
,
5905 SPR_NOACCESS
, SPR_NOACCESS
,
5906 &spr_read_generic
, &spr_write_generic
,
5908 spr_register_hv(env
, SPR_MMCRH
, "MMCRH",
5909 SPR_NOACCESS
, SPR_NOACCESS
,
5910 SPR_NOACCESS
, SPR_NOACCESS
,
5911 &spr_read_generic
, &spr_write_generic
,
5913 spr_register_hv(env
, SPR_HSPRG0
, "HSPRG0",
5914 SPR_NOACCESS
, SPR_NOACCESS
,
5915 SPR_NOACCESS
, SPR_NOACCESS
,
5916 &spr_read_generic
, &spr_write_generic
,
5918 spr_register_hv(env
, SPR_HSPRG1
, "HSPRG1",
5919 SPR_NOACCESS
, SPR_NOACCESS
,
5920 SPR_NOACCESS
, SPR_NOACCESS
,
5921 &spr_read_generic
, &spr_write_generic
,
5923 spr_register_hv(env
, SPR_HSRR0
, "HSRR0",
5924 SPR_NOACCESS
, SPR_NOACCESS
,
5925 SPR_NOACCESS
, SPR_NOACCESS
,
5926 &spr_read_generic
, &spr_write_generic
,
5928 spr_register_hv(env
, SPR_HSRR1
, "HSRR1",
5929 SPR_NOACCESS
, SPR_NOACCESS
,
5930 SPR_NOACCESS
, SPR_NOACCESS
,
5931 &spr_read_generic
, &spr_write_generic
,
5933 spr_register_hv(env
, SPR_HDAR
, "HDAR",
5934 SPR_NOACCESS
, SPR_NOACCESS
,
5935 SPR_NOACCESS
, SPR_NOACCESS
,
5936 &spr_read_generic
, &spr_write_generic
,
5938 spr_register_hv(env
, SPR_HDSISR
, "HDSISR",
5939 SPR_NOACCESS
, SPR_NOACCESS
,
5940 SPR_NOACCESS
, SPR_NOACCESS
,
5941 &spr_read_generic
, &spr_write_generic
,
5943 spr_register_hv(env
, SPR_HRMOR
, "HRMOR",
5944 SPR_NOACCESS
, SPR_NOACCESS
,
5945 SPR_NOACCESS
, SPR_NOACCESS
,
5946 &spr_read_generic
, &spr_write_generic
,
5950 static void register_rmor_sprs(CPUPPCState
*env
)
5952 spr_register_hv(env
, SPR_RMOR
, "RMOR",
5953 SPR_NOACCESS
, SPR_NOACCESS
,
5954 SPR_NOACCESS
, SPR_NOACCESS
,
5955 &spr_read_generic
, &spr_write_generic
,
5959 static void register_power8_ids_sprs(CPUPPCState
*env
)
5961 /* Thread identification */
5962 spr_register(env
, SPR_TIR
, "TIR",
5963 SPR_NOACCESS
, SPR_NOACCESS
,
5964 &spr_read_generic
, SPR_NOACCESS
,
5968 static void register_book3s_purr_sprs(CPUPPCState
*env
)
5970 #if !defined(CONFIG_USER_ONLY)
5971 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
5972 spr_register_kvm_hv(env
, SPR_PURR
, "PURR",
5973 &spr_read_purr
, SPR_NOACCESS
,
5974 &spr_read_purr
, SPR_NOACCESS
,
5975 &spr_read_purr
, &spr_write_purr
,
5976 KVM_REG_PPC_PURR
, 0x00000000);
5977 spr_register_kvm_hv(env
, SPR_SPURR
, "SPURR",
5978 &spr_read_purr
, SPR_NOACCESS
,
5979 &spr_read_purr
, SPR_NOACCESS
,
5980 &spr_read_purr
, &spr_write_purr
,
5981 KVM_REG_PPC_SPURR
, 0x00000000);
5985 static void register_power6_dbg_sprs(CPUPPCState
*env
)
5987 #if !defined(CONFIG_USER_ONLY)
5988 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
5989 SPR_NOACCESS
, SPR_NOACCESS
,
5990 &spr_read_cfar
, &spr_write_cfar
,
5995 static void register_power5p_common_sprs(CPUPPCState
*env
)
5997 spr_register_kvm(env
, SPR_PPR
, "PPR",
5998 &spr_read_generic
, &spr_write_generic
,
5999 &spr_read_generic
, &spr_write_generic
,
6000 KVM_REG_PPC_PPR
, 0x00000000);
6003 static void register_power6_common_sprs(CPUPPCState
*env
)
6005 #if !defined(CONFIG_USER_ONLY)
6006 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
6007 SPR_NOACCESS
, SPR_NOACCESS
,
6008 &spr_read_generic
, &spr_write_generic
,
6009 KVM_REG_PPC_DSCR
, 0x00000000);
6012 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
6013 * POWERPC_EXCP_INVAL_SPR in userspace. Permit hypervisor access.
6015 spr_register_hv(env
, SPR_PCR
, "PCR",
6016 SPR_NOACCESS
, SPR_NOACCESS
,
6017 SPR_NOACCESS
, SPR_NOACCESS
,
6018 &spr_read_generic
, &spr_write_pcr
,
6022 static void register_power8_tce_address_control_sprs(CPUPPCState
*env
)
6024 spr_register_kvm(env
, SPR_TAR
, "TAR",
6025 &spr_read_tar
, &spr_write_tar
,
6026 &spr_read_generic
, &spr_write_generic
,
6027 KVM_REG_PPC_TAR
, 0x00000000);
6030 static void register_power8_tm_sprs(CPUPPCState
*env
)
6032 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
6033 &spr_read_tm
, &spr_write_tm
,
6034 &spr_read_tm
, &spr_write_tm
,
6035 KVM_REG_PPC_TFHAR
, 0x00000000);
6036 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
6037 &spr_read_tm
, &spr_write_tm
,
6038 &spr_read_tm
, &spr_write_tm
,
6039 KVM_REG_PPC_TFIAR
, 0x00000000);
6040 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
6041 &spr_read_tm
, &spr_write_tm
,
6042 &spr_read_tm
, &spr_write_tm
,
6043 KVM_REG_PPC_TEXASR
, 0x00000000);
6044 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
6045 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
6046 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
6050 static void register_power8_ebb_sprs(CPUPPCState
*env
)
6052 spr_register(env
, SPR_BESCRS
, "BESCRS",
6053 &spr_read_ebb
, &spr_write_ebb
,
6054 &spr_read_generic
, &spr_write_generic
,
6056 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
6057 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
6058 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
6060 spr_register(env
, SPR_BESCRR
, "BESCRR",
6061 &spr_read_ebb
, &spr_write_ebb
,
6062 &spr_read_generic
, &spr_write_generic
,
6064 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
6065 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
6066 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
6068 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
6069 &spr_read_ebb
, &spr_write_ebb
,
6070 &spr_read_generic
, &spr_write_generic
,
6071 KVM_REG_PPC_EBBHR
, 0x00000000);
6072 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
6073 &spr_read_ebb
, &spr_write_ebb
,
6074 &spr_read_generic
, &spr_write_generic
,
6075 KVM_REG_PPC_EBBRR
, 0x00000000);
6076 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
6077 &spr_read_ebb
, &spr_write_ebb
,
6078 &spr_read_generic
, &spr_write_generic
,
6079 KVM_REG_PPC_BESCR
, 0x00000000);
6082 /* Virtual Time Base */
6083 static void register_vtb_sprs(CPUPPCState
*env
)
6085 spr_register_kvm_hv(env
, SPR_VTB
, "VTB",
6086 SPR_NOACCESS
, SPR_NOACCESS
,
6087 &spr_read_vtb
, SPR_NOACCESS
,
6088 &spr_read_vtb
, &spr_write_vtb
,
6089 KVM_REG_PPC_VTB
, 0x00000000);
6092 static void register_power8_fscr_sprs(CPUPPCState
*env
)
6094 #if defined(CONFIG_USER_ONLY)
6095 target_ulong initval
= 1ULL << FSCR_TAR
;
6097 target_ulong initval
= 0;
6099 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
6100 SPR_NOACCESS
, SPR_NOACCESS
,
6101 &spr_read_generic
, &spr_write_generic
,
6102 KVM_REG_PPC_FSCR
, initval
);
6105 static void register_power8_pspb_sprs(CPUPPCState
*env
)
6107 spr_register_kvm(env
, SPR_PSPB
, "PSPB",
6108 SPR_NOACCESS
, SPR_NOACCESS
,
6109 &spr_read_generic
, &spr_write_generic32
,
6110 KVM_REG_PPC_PSPB
, 0);
6113 static void register_power8_dpdes_sprs(CPUPPCState
*env
)
6115 #if !defined(CONFIG_USER_ONLY)
6116 /* Directed Privileged Door-bell Exception State, used for IPI */
6117 spr_register_kvm_hv(env
, SPR_DPDES
, "DPDES",
6118 SPR_NOACCESS
, SPR_NOACCESS
,
6119 &spr_read_dpdes
, SPR_NOACCESS
,
6120 &spr_read_dpdes
, &spr_write_dpdes
,
6121 KVM_REG_PPC_DPDES
, 0x00000000);
6125 static void register_power8_ic_sprs(CPUPPCState
*env
)
6127 #if !defined(CONFIG_USER_ONLY)
6128 spr_register_hv(env
, SPR_IC
, "IC",
6129 SPR_NOACCESS
, SPR_NOACCESS
,
6130 &spr_read_generic
, SPR_NOACCESS
,
6131 &spr_read_generic
, &spr_write_generic
,
6136 static void register_power8_book4_sprs(CPUPPCState
*env
)
6138 /* Add a number of P8 book4 registers */
6139 #if !defined(CONFIG_USER_ONLY)
6140 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
6141 SPR_NOACCESS
, SPR_NOACCESS
,
6142 &spr_read_generic
, &spr_write_generic
,
6143 KVM_REG_PPC_ACOP
, 0);
6144 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
6145 SPR_NOACCESS
, SPR_NOACCESS
,
6146 &spr_read_generic
, &spr_write_pidr
,
6147 KVM_REG_PPC_PID
, 0);
6148 spr_register_kvm(env
, SPR_WORT
, "WORT",
6149 SPR_NOACCESS
, SPR_NOACCESS
,
6150 &spr_read_generic
, &spr_write_generic
,
6151 KVM_REG_PPC_WORT
, 0);
6155 static void register_power7_book4_sprs(CPUPPCState
*env
)
6157 /* Add a number of P7 book4 registers */
6158 #if !defined(CONFIG_USER_ONLY)
6159 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
6160 SPR_NOACCESS
, SPR_NOACCESS
,
6161 &spr_read_generic
, &spr_write_generic
,
6162 KVM_REG_PPC_ACOP
, 0);
6163 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
6164 SPR_NOACCESS
, SPR_NOACCESS
,
6165 &spr_read_generic
, &spr_write_generic
,
6166 KVM_REG_PPC_PID
, 0);
6170 static void register_power8_rpr_sprs(CPUPPCState
*env
)
6172 #if !defined(CONFIG_USER_ONLY)
6173 spr_register_hv(env
, SPR_RPR
, "RPR",
6174 SPR_NOACCESS
, SPR_NOACCESS
,
6175 SPR_NOACCESS
, SPR_NOACCESS
,
6176 &spr_read_generic
, &spr_write_generic
,
6177 0x00000103070F1F3F);
6181 static void register_power9_mmu_sprs(CPUPPCState
*env
)
6183 #if !defined(CONFIG_USER_ONLY)
6184 /* Partition Table Control */
6185 spr_register_kvm_hv(env
, SPR_PTCR
, "PTCR",
6186 SPR_NOACCESS
, SPR_NOACCESS
,
6187 SPR_NOACCESS
, SPR_NOACCESS
,
6188 &spr_read_generic
, &spr_write_ptcr
,
6189 KVM_REG_PPC_PTCR
, 0x00000000);
6190 /* Address Segment Descriptor Register */
6191 spr_register_hv(env
, SPR_ASDR
, "ASDR",
6192 SPR_NOACCESS
, SPR_NOACCESS
,
6193 SPR_NOACCESS
, SPR_NOACCESS
,
6194 &spr_read_generic
, &spr_write_generic
,
6195 0x0000000000000000);
6200 * Initialize PMU counter overflow timers for Power8 and
6201 * newer Power chips when using TCG.
6203 static void init_tcg_pmu_power8(CPUPPCState
*env
)
6205 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
6206 /* Init PMU overflow timers */
6207 if (!kvm_enabled()) {
6208 cpu_ppc_pmu_init(env
);
6213 static void init_proc_book3s_common(CPUPPCState
*env
)
6215 register_ne_601_sprs(env
);
6216 register_usprg3_sprs(env
);
6217 register_book3s_altivec_sprs(env
);
6218 register_book3s_pmu_sup_sprs(env
);
6219 register_book3s_pmu_user_sprs(env
);
6220 register_book3s_ctrl_sprs(env
);
6222 * Can't find information on what this should be on reset. This
6223 * value is the one used by 74xx processors.
6225 vscr_init(env
, 0x00010000);
6228 static void init_proc_970(CPUPPCState
*env
)
6230 /* Common Registers */
6231 init_proc_book3s_common(env
);
6232 register_sdr1_sprs(env
);
6233 register_book3s_dbg_sprs(env
);
6235 /* 970 Specific Registers */
6236 register_970_hid_sprs(env
);
6237 register_970_hior_sprs(env
);
6238 register_low_BATs(env
);
6239 register_970_pmu_sup_sprs(env
);
6240 register_970_pmu_user_sprs(env
);
6241 register_970_lpar_sprs(env
);
6242 register_970_dbg_sprs(env
);
6245 env
->dcache_line_size
= 128;
6246 env
->icache_line_size
= 128;
6248 /* Allocate hardware IRQ controller */
6250 ppc970_irq_init(env_archcpu(env
));
6253 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
6255 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6256 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6258 dc
->desc
= "PowerPC 970";
6259 pcc
->init_proc
= init_proc_970
;
6260 pcc
->check_pow
= check_pow_970
;
6261 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6262 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6263 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6265 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6266 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6267 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6268 PPC_64B
| PPC_ALTIVEC
|
6269 PPC_SEGMENT_64B
| PPC_SLBI
;
6270 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
6271 pcc
->msr_mask
= (1ull << MSR_SF
) |
6286 pcc
->mmu_model
= POWERPC_MMU_64B
;
6287 #if defined(CONFIG_SOFTMMU)
6288 pcc
->hash64_opts
= &ppc_hash64_opts_basic
;
6290 pcc
->excp_model
= POWERPC_EXCP_970
;
6291 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
6292 pcc
->bfd_mach
= bfd_mach_ppc64
;
6293 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6294 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6295 POWERPC_FLAG_BUS_CLK
;
6296 pcc
->l1_dcache_size
= 0x8000;
6297 pcc
->l1_icache_size
= 0x10000;
6300 static void init_proc_power5plus(CPUPPCState
*env
)
6302 /* Common Registers */
6303 init_proc_book3s_common(env
);
6304 register_sdr1_sprs(env
);
6305 register_book3s_dbg_sprs(env
);
6307 /* POWER5+ Specific Registers */
6308 register_970_hid_sprs(env
);
6309 register_970_hior_sprs(env
);
6310 register_low_BATs(env
);
6311 register_970_pmu_sup_sprs(env
);
6312 register_970_pmu_user_sprs(env
);
6313 register_power5p_common_sprs(env
);
6314 register_power5p_lpar_sprs(env
);
6315 register_power5p_ear_sprs(env
);
6316 register_power5p_tb_sprs(env
);
6319 env
->dcache_line_size
= 128;
6320 env
->icache_line_size
= 128;
6322 /* Allocate hardware IRQ controller */
6324 ppc970_irq_init(env_archcpu(env
));
6327 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
6329 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6330 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6332 dc
->fw_name
= "PowerPC,POWER5";
6333 dc
->desc
= "POWER5+";
6334 pcc
->init_proc
= init_proc_power5plus
;
6335 pcc
->check_pow
= check_pow_970
;
6336 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6337 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6338 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6341 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6342 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6343 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6346 PPC_SEGMENT_64B
| PPC_SLBI
;
6347 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
6348 pcc
->msr_mask
= (1ull << MSR_SF
) |
6363 pcc
->lpcr_mask
= LPCR_RMLS
| LPCR_ILE
| LPCR_LPES0
| LPCR_LPES1
|
6364 LPCR_RMI
| LPCR_HDICE
;
6365 pcc
->mmu_model
= POWERPC_MMU_2_03
;
6366 #if defined(CONFIG_SOFTMMU)
6367 pcc
->hash64_opts
= &ppc_hash64_opts_basic
;
6368 pcc
->lrg_decr_bits
= 32;
6370 pcc
->excp_model
= POWERPC_EXCP_970
;
6371 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
6372 pcc
->bfd_mach
= bfd_mach_ppc64
;
6373 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6374 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6375 POWERPC_FLAG_BUS_CLK
;
6376 pcc
->l1_dcache_size
= 0x8000;
6377 pcc
->l1_icache_size
= 0x10000;
6380 static void init_proc_POWER7(CPUPPCState
*env
)
6382 /* Common Registers */
6383 init_proc_book3s_common(env
);
6384 register_sdr1_sprs(env
);
6385 register_book3s_dbg_sprs(env
);
6387 /* POWER7 Specific Registers */
6388 register_book3s_ids_sprs(env
);
6389 register_rmor_sprs(env
);
6390 register_amr_sprs(env
);
6391 register_book3s_purr_sprs(env
);
6392 register_power5p_common_sprs(env
);
6393 register_power5p_lpar_sprs(env
);
6394 register_power5p_ear_sprs(env
);
6395 register_power5p_tb_sprs(env
);
6396 register_power6_common_sprs(env
);
6397 register_power6_dbg_sprs(env
);
6398 register_power7_book4_sprs(env
);
6401 env
->dcache_line_size
= 128;
6402 env
->icache_line_size
= 128;
6404 /* Allocate hardware IRQ controller */
6405 init_excp_POWER7(env
);
6406 ppcPOWER7_irq_init(env_archcpu(env
));
6409 static bool ppc_pvr_match_power7(PowerPCCPUClass
*pcc
, uint32_t pvr
)
6411 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7P_BASE
) {
6414 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7_BASE
) {
6420 static bool cpu_has_work_POWER7(CPUState
*cs
)
6422 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
6423 CPUPPCState
*env
= &cpu
->env
;
6426 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
6429 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
6430 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE0
)) {
6433 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
6434 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE1
)) {
6437 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
6438 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
6441 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
6442 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
6445 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
6450 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
6454 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
6456 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6457 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6458 CPUClass
*cc
= CPU_CLASS(oc
);
6460 dc
->fw_name
= "PowerPC,POWER7";
6461 dc
->desc
= "POWER7";
6462 pcc
->pvr_match
= ppc_pvr_match_power7
;
6463 pcc
->pcr_mask
= PCR_VEC_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_05
;
6464 pcc
->pcr_supported
= PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
6465 pcc
->init_proc
= init_proc_POWER7
;
6466 pcc
->check_pow
= check_pow_nocheck
;
6467 cc
->has_work
= cpu_has_work_POWER7
;
6468 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
6469 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6470 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6471 PPC_FLOAT_FRSQRTES
|
6474 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6475 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6476 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6477 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
6478 PPC_SEGMENT_64B
| PPC_SLBI
|
6479 PPC_POPCNTB
| PPC_POPCNTWD
|
6481 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
6482 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
6483 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
6484 PPC2_FP_TST_ISA206
| PPC2_FP_CVT_S64
|
6486 pcc
->msr_mask
= (1ull << MSR_SF
) |
6502 pcc
->lpcr_mask
= LPCR_VPM0
| LPCR_VPM1
| LPCR_ISL
| LPCR_DPFD
|
6503 LPCR_VRMASD
| LPCR_RMLS
| LPCR_ILE
|
6504 LPCR_P7_PECE0
| LPCR_P7_PECE1
| LPCR_P7_PECE2
|
6505 LPCR_MER
| LPCR_TC
|
6506 LPCR_LPES0
| LPCR_LPES1
| LPCR_HDICE
;
6507 pcc
->lpcr_pm
= LPCR_P7_PECE0
| LPCR_P7_PECE1
| LPCR_P7_PECE2
;
6508 pcc
->mmu_model
= POWERPC_MMU_2_06
;
6509 #if defined(CONFIG_SOFTMMU)
6510 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
6511 pcc
->lrg_decr_bits
= 32;
6513 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
6514 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
6515 pcc
->bfd_mach
= bfd_mach_ppc64
;
6516 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6517 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6518 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
6520 pcc
->l1_dcache_size
= 0x8000;
6521 pcc
->l1_icache_size
= 0x8000;
6524 static void init_proc_POWER8(CPUPPCState
*env
)
6526 /* Common Registers */
6527 init_proc_book3s_common(env
);
6528 register_sdr1_sprs(env
);
6529 register_book3s_207_dbg_sprs(env
);
6531 /* Common TCG PMU */
6532 init_tcg_pmu_power8(env
);
6534 /* POWER8 Specific Registers */
6535 register_book3s_ids_sprs(env
);
6536 register_rmor_sprs(env
);
6537 register_amr_sprs(env
);
6538 register_iamr_sprs(env
);
6539 register_book3s_purr_sprs(env
);
6540 register_power5p_common_sprs(env
);
6541 register_power5p_lpar_sprs(env
);
6542 register_power5p_ear_sprs(env
);
6543 register_power5p_tb_sprs(env
);
6544 register_power6_common_sprs(env
);
6545 register_power6_dbg_sprs(env
);
6546 register_power8_tce_address_control_sprs(env
);
6547 register_power8_ids_sprs(env
);
6548 register_power8_ebb_sprs(env
);
6549 register_power8_fscr_sprs(env
);
6550 register_power8_pmu_sup_sprs(env
);
6551 register_power8_pmu_user_sprs(env
);
6552 register_power8_tm_sprs(env
);
6553 register_power8_pspb_sprs(env
);
6554 register_power8_dpdes_sprs(env
);
6555 register_vtb_sprs(env
);
6556 register_power8_ic_sprs(env
);
6557 register_power8_book4_sprs(env
);
6558 register_power8_rpr_sprs(env
);
6561 env
->dcache_line_size
= 128;
6562 env
->icache_line_size
= 128;
6564 /* Allocate hardware IRQ controller */
6565 init_excp_POWER8(env
);
6566 ppcPOWER7_irq_init(env_archcpu(env
));
6569 static bool ppc_pvr_match_power8(PowerPCCPUClass
*pcc
, uint32_t pvr
)
6571 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8NVL_BASE
) {
6574 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8E_BASE
) {
6577 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8_BASE
) {
6583 static bool cpu_has_work_POWER8(CPUState
*cs
)
6585 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
6586 CPUPPCState
*env
= &cpu
->env
;
6589 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
6592 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
6593 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE2
)) {
6596 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
6597 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE3
)) {
6600 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
6601 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
6604 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
6605 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
6608 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
6609 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE0
)) {
6612 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
6613 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE1
)) {
6616 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
6621 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
6625 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
6627 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6628 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6629 CPUClass
*cc
= CPU_CLASS(oc
);
6631 dc
->fw_name
= "PowerPC,POWER8";
6632 dc
->desc
= "POWER8";
6633 pcc
->pvr_match
= ppc_pvr_match_power8
;
6634 pcc
->pcr_mask
= PCR_TM_DIS
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
6635 pcc
->pcr_supported
= PCR_COMPAT_2_07
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
6636 pcc
->init_proc
= init_proc_POWER8
;
6637 pcc
->check_pow
= check_pow_nocheck
;
6638 cc
->has_work
= cpu_has_work_POWER8
;
6639 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
6640 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6641 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6642 PPC_FLOAT_FRSQRTES
|
6645 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6646 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6647 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6648 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
6649 PPC_SEGMENT_64B
| PPC_SLBI
|
6650 PPC_POPCNTB
| PPC_POPCNTWD
|
6652 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
6653 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
6654 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
6655 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
6656 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
6657 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
6658 PPC2_TM
| PPC2_PM_ISA206
;
6659 pcc
->msr_mask
= (1ull << MSR_SF
) |
6679 pcc
->lpcr_mask
= LPCR_VPM0
| LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
|
6680 LPCR_DPFD
| LPCR_VRMASD
| LPCR_RMLS
| LPCR_ILE
|
6681 LPCR_AIL
| LPCR_ONL
| LPCR_P8_PECE0
| LPCR_P8_PECE1
|
6682 LPCR_P8_PECE2
| LPCR_P8_PECE3
| LPCR_P8_PECE4
|
6683 LPCR_MER
| LPCR_TC
| LPCR_LPES0
| LPCR_HDICE
;
6684 pcc
->lpcr_pm
= LPCR_P8_PECE0
| LPCR_P8_PECE1
| LPCR_P8_PECE2
|
6685 LPCR_P8_PECE3
| LPCR_P8_PECE4
;
6686 pcc
->mmu_model
= POWERPC_MMU_2_07
;
6687 #if defined(CONFIG_SOFTMMU)
6688 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
6689 pcc
->lrg_decr_bits
= 32;
6690 pcc
->n_host_threads
= 8;
6692 pcc
->excp_model
= POWERPC_EXCP_POWER8
;
6693 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
6694 pcc
->bfd_mach
= bfd_mach_ppc64
;
6695 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6696 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6697 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
6698 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
6699 pcc
->l1_dcache_size
= 0x8000;
6700 pcc
->l1_icache_size
= 0x8000;
6703 #ifdef CONFIG_SOFTMMU
6705 * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
6706 * Encoded as array of int_32s in the form:
6707 * 0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
6709 * y -> radix mode supported page size (encoded as a shift)
6711 static struct ppc_radix_page_info POWER9_radix_page_info
= {
6714 0x0000000c, /* 4K - enc: 0x0 */
6715 0xa0000010, /* 64K - enc: 0x5 */
6716 0x20000015, /* 2M - enc: 0x1 */
6717 0x4000001e /* 1G - enc: 0x2 */
6720 #endif /* CONFIG_SOFTMMU */
6722 static void init_proc_POWER9(CPUPPCState
*env
)
6724 /* Common Registers */
6725 init_proc_book3s_common(env
);
6726 register_book3s_207_dbg_sprs(env
);
6728 /* Common TCG PMU */
6729 init_tcg_pmu_power8(env
);
6731 /* POWER8 Specific Registers */
6732 register_book3s_ids_sprs(env
);
6733 register_amr_sprs(env
);
6734 register_iamr_sprs(env
);
6735 register_book3s_purr_sprs(env
);
6736 register_power5p_common_sprs(env
);
6737 register_power5p_lpar_sprs(env
);
6738 register_power5p_ear_sprs(env
);
6739 register_power5p_tb_sprs(env
);
6740 register_power6_common_sprs(env
);
6741 register_power6_dbg_sprs(env
);
6742 register_power8_tce_address_control_sprs(env
);
6743 register_power8_ids_sprs(env
);
6744 register_power8_ebb_sprs(env
);
6745 register_power8_fscr_sprs(env
);
6746 register_power8_pmu_sup_sprs(env
);
6747 register_power8_pmu_user_sprs(env
);
6748 register_power8_tm_sprs(env
);
6749 register_power8_pspb_sprs(env
);
6750 register_power8_dpdes_sprs(env
);
6751 register_vtb_sprs(env
);
6752 register_power8_ic_sprs(env
);
6753 register_power8_book4_sprs(env
);
6754 register_power8_rpr_sprs(env
);
6755 register_power9_mmu_sprs(env
);
6757 /* POWER9 Specific registers */
6758 spr_register_kvm(env
, SPR_TIDR
, "TIDR", NULL
, NULL
,
6759 spr_read_generic
, spr_write_generic
,
6760 KVM_REG_PPC_TIDR
, 0);
6762 /* FIXME: Filter fields properly based on privilege level */
6763 spr_register_kvm_hv(env
, SPR_PSSCR
, "PSSCR", NULL
, NULL
, NULL
, NULL
,
6764 spr_read_generic
, spr_write_generic
,
6765 KVM_REG_PPC_PSSCR
, 0);
6768 env
->dcache_line_size
= 128;
6769 env
->icache_line_size
= 128;
6771 /* Allocate hardware IRQ controller */
6772 init_excp_POWER9(env
);
6773 ppcPOWER9_irq_init(env_archcpu(env
));
6776 static bool ppc_pvr_match_power9(PowerPCCPUClass
*pcc
, uint32_t pvr
)
6778 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER9_BASE
) {
6784 static bool cpu_has_work_POWER9(CPUState
*cs
)
6786 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
6787 CPUPPCState
*env
= &cpu
->env
;
6790 uint64_t psscr
= env
->spr
[SPR_PSSCR
];
6792 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
6796 /* If EC is clear, just return true on any pending interrupt */
6797 if (!(psscr
& PSSCR_EC
)) {
6800 /* External Exception */
6801 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
6802 (env
->spr
[SPR_LPCR
] & LPCR_EEE
)) {
6803 bool heic
= !!(env
->spr
[SPR_LPCR
] & LPCR_HEIC
);
6804 if (heic
== 0 || !msr_hv
|| msr_pr
) {
6808 /* Decrementer Exception */
6809 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
6810 (env
->spr
[SPR_LPCR
] & LPCR_DEE
)) {
6813 /* Machine Check or Hypervisor Maintenance Exception */
6814 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
|
6815 1u << PPC_INTERRUPT_HMI
)) && (env
->spr
[SPR_LPCR
] & LPCR_OEE
)) {
6818 /* Privileged Doorbell Exception */
6819 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
6820 (env
->spr
[SPR_LPCR
] & LPCR_PDEE
)) {
6823 /* Hypervisor Doorbell Exception */
6824 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
6825 (env
->spr
[SPR_LPCR
] & LPCR_HDEE
)) {
6828 /* Hypervisor virtualization exception */
6829 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HVIRT
)) &&
6830 (env
->spr
[SPR_LPCR
] & LPCR_HVEE
)) {
6833 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
6838 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
6842 POWERPC_FAMILY(POWER9
)(ObjectClass
*oc
, void *data
)
6844 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6845 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6846 CPUClass
*cc
= CPU_CLASS(oc
);
6848 dc
->fw_name
= "PowerPC,POWER9";
6849 dc
->desc
= "POWER9";
6850 pcc
->pvr_match
= ppc_pvr_match_power9
;
6851 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
| PCR_COMPAT_2_07
;
6852 pcc
->pcr_supported
= PCR_COMPAT_3_00
| PCR_COMPAT_2_07
| PCR_COMPAT_2_06
|
6854 pcc
->init_proc
= init_proc_POWER9
;
6855 pcc
->check_pow
= check_pow_nocheck
;
6856 cc
->has_work
= cpu_has_work_POWER9
;
6857 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
6858 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6859 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6860 PPC_FLOAT_FRSQRTES
|
6863 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6864 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6866 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
6867 PPC_SEGMENT_64B
| PPC_SLBI
|
6868 PPC_POPCNTB
| PPC_POPCNTWD
|
6870 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
6871 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
6872 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
6873 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
6874 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
6875 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
6876 PPC2_TM
| PPC2_ISA300
| PPC2_PRCNTL
;
6877 pcc
->msr_mask
= (1ull << MSR_SF
) |
6895 pcc
->lpcr_mask
= LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
| LPCR_DPFD
|
6896 (LPCR_PECE_U_MASK
& LPCR_HVEE
) | LPCR_ILE
| LPCR_AIL
|
6897 LPCR_UPRT
| LPCR_EVIRT
| LPCR_ONL
| LPCR_HR
| LPCR_LD
|
6898 (LPCR_PECE_L_MASK
& (LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
|
6899 LPCR_DEE
| LPCR_OEE
))
6900 | LPCR_MER
| LPCR_GTSE
| LPCR_TC
|
6901 LPCR_HEIC
| LPCR_LPES0
| LPCR_HVICE
| LPCR_HDICE
;
6902 pcc
->lpcr_pm
= LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
| LPCR_DEE
| LPCR_OEE
;
6903 pcc
->mmu_model
= POWERPC_MMU_3_00
;
6904 #if defined(CONFIG_SOFTMMU)
6905 /* segment page size remain the same */
6906 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
6907 pcc
->radix_page_info
= &POWER9_radix_page_info
;
6908 pcc
->lrg_decr_bits
= 56;
6909 pcc
->n_host_threads
= 4;
6911 pcc
->excp_model
= POWERPC_EXCP_POWER9
;
6912 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER9
;
6913 pcc
->bfd_mach
= bfd_mach_ppc64
;
6914 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6915 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6916 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
6917 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
| POWERPC_FLAG_SCV
;
6918 pcc
->l1_dcache_size
= 0x8000;
6919 pcc
->l1_icache_size
= 0x8000;
6922 #ifdef CONFIG_SOFTMMU
6924 * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
6925 * Encoded as array of int_32s in the form:
6926 * 0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
6928 * y -> radix mode supported page size (encoded as a shift)
6930 static struct ppc_radix_page_info POWER10_radix_page_info
= {
6933 0x0000000c, /* 4K - enc: 0x0 */
6934 0xa0000010, /* 64K - enc: 0x5 */
6935 0x20000015, /* 2M - enc: 0x1 */
6936 0x4000001e /* 1G - enc: 0x2 */
6939 #endif /* CONFIG_SOFTMMU */
6941 static void init_proc_POWER10(CPUPPCState
*env
)
6943 /* Common Registers */
6944 init_proc_book3s_common(env
);
6945 register_book3s_207_dbg_sprs(env
);
6947 /* Common TCG PMU */
6948 init_tcg_pmu_power8(env
);
6950 /* POWER8 Specific Registers */
6951 register_book3s_ids_sprs(env
);
6952 register_amr_sprs(env
);
6953 register_iamr_sprs(env
);
6954 register_book3s_purr_sprs(env
);
6955 register_power5p_common_sprs(env
);
6956 register_power5p_lpar_sprs(env
);
6957 register_power5p_ear_sprs(env
);
6958 register_power6_common_sprs(env
);
6959 register_power6_dbg_sprs(env
);
6960 register_power8_tce_address_control_sprs(env
);
6961 register_power8_ids_sprs(env
);
6962 register_power8_ebb_sprs(env
);
6963 register_power8_fscr_sprs(env
);
6964 register_power8_pmu_sup_sprs(env
);
6965 register_power8_pmu_user_sprs(env
);
6966 register_power8_tm_sprs(env
);
6967 register_power8_pspb_sprs(env
);
6968 register_vtb_sprs(env
);
6969 register_power8_ic_sprs(env
);
6970 register_power8_book4_sprs(env
);
6971 register_power8_rpr_sprs(env
);
6972 register_power9_mmu_sprs(env
);
6974 /* FIXME: Filter fields properly based on privilege level */
6975 spr_register_kvm_hv(env
, SPR_PSSCR
, "PSSCR", NULL
, NULL
, NULL
, NULL
,
6976 spr_read_generic
, spr_write_generic
,
6977 KVM_REG_PPC_PSSCR
, 0);
6980 env
->dcache_line_size
= 128;
6981 env
->icache_line_size
= 128;
6983 /* Allocate hardware IRQ controller */
6984 init_excp_POWER10(env
);
6985 ppcPOWER9_irq_init(env_archcpu(env
));
6988 static bool ppc_pvr_match_power10(PowerPCCPUClass
*pcc
, uint32_t pvr
)
6990 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER10_BASE
) {
6996 static bool cpu_has_work_POWER10(CPUState
*cs
)
6998 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
6999 CPUPPCState
*env
= &cpu
->env
;
7002 uint64_t psscr
= env
->spr
[SPR_PSSCR
];
7004 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
7008 /* If EC is clear, just return true on any pending interrupt */
7009 if (!(psscr
& PSSCR_EC
)) {
7012 /* External Exception */
7013 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
7014 (env
->spr
[SPR_LPCR
] & LPCR_EEE
)) {
7015 bool heic
= !!(env
->spr
[SPR_LPCR
] & LPCR_HEIC
);
7016 if (heic
== 0 || !msr_hv
|| msr_pr
) {
7020 /* Decrementer Exception */
7021 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
7022 (env
->spr
[SPR_LPCR
] & LPCR_DEE
)) {
7025 /* Machine Check or Hypervisor Maintenance Exception */
7026 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
|
7027 1u << PPC_INTERRUPT_HMI
)) && (env
->spr
[SPR_LPCR
] & LPCR_OEE
)) {
7030 /* Privileged Doorbell Exception */
7031 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
7032 (env
->spr
[SPR_LPCR
] & LPCR_PDEE
)) {
7035 /* Hypervisor Doorbell Exception */
7036 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
7037 (env
->spr
[SPR_LPCR
] & LPCR_HDEE
)) {
7040 /* Hypervisor virtualization exception */
7041 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HVIRT
)) &&
7042 (env
->spr
[SPR_LPCR
] & LPCR_HVEE
)) {
7045 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
7050 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
7054 POWERPC_FAMILY(POWER10
)(ObjectClass
*oc
, void *data
)
7056 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7057 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7058 CPUClass
*cc
= CPU_CLASS(oc
);
7060 dc
->fw_name
= "PowerPC,POWER10";
7061 dc
->desc
= "POWER10";
7062 pcc
->pvr_match
= ppc_pvr_match_power10
;
7063 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
| PCR_COMPAT_2_07
|
7065 pcc
->pcr_supported
= PCR_COMPAT_3_10
| PCR_COMPAT_3_00
| PCR_COMPAT_2_07
|
7066 PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
7067 pcc
->init_proc
= init_proc_POWER10
;
7068 pcc
->check_pow
= check_pow_nocheck
;
7069 cc
->has_work
= cpu_has_work_POWER10
;
7070 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
7071 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7072 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7073 PPC_FLOAT_FRSQRTES
|
7076 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7077 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7079 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
7080 PPC_SEGMENT_64B
| PPC_SLBI
|
7081 PPC_POPCNTB
| PPC_POPCNTWD
|
7083 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
7084 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
7085 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
7086 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
7087 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
7088 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
7089 PPC2_TM
| PPC2_ISA300
| PPC2_PRCNTL
| PPC2_ISA310
;
7090 pcc
->msr_mask
= (1ull << MSR_SF
) |
7108 pcc
->lpcr_mask
= LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
| LPCR_DPFD
|
7109 (LPCR_PECE_U_MASK
& LPCR_HVEE
) | LPCR_ILE
| LPCR_AIL
|
7110 LPCR_UPRT
| LPCR_EVIRT
| LPCR_ONL
| LPCR_HR
| LPCR_LD
|
7111 (LPCR_PECE_L_MASK
& (LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
|
7112 LPCR_DEE
| LPCR_OEE
))
7113 | LPCR_MER
| LPCR_GTSE
| LPCR_TC
|
7114 LPCR_HEIC
| LPCR_LPES0
| LPCR_HVICE
| LPCR_HDICE
;
7115 /* DD2 adds an extra HAIL bit */
7116 pcc
->lpcr_mask
|= LPCR_HAIL
;
7118 pcc
->lpcr_pm
= LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
| LPCR_DEE
| LPCR_OEE
;
7119 pcc
->mmu_model
= POWERPC_MMU_3_00
;
7120 #if defined(CONFIG_SOFTMMU)
7121 /* segment page size remain the same */
7122 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
7123 pcc
->radix_page_info
= &POWER10_radix_page_info
;
7124 pcc
->lrg_decr_bits
= 56;
7126 pcc
->excp_model
= POWERPC_EXCP_POWER10
;
7127 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER9
;
7128 pcc
->bfd_mach
= bfd_mach_ppc64
;
7129 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7130 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7131 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
7132 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
| POWERPC_FLAG_SCV
;
7133 pcc
->l1_dcache_size
= 0x8000;
7134 pcc
->l1_icache_size
= 0x8000;
7137 #if !defined(CONFIG_USER_ONLY)
7138 void cpu_ppc_set_vhyp(PowerPCCPU
*cpu
, PPCVirtualHypervisor
*vhyp
)
7140 CPUPPCState
*env
= &cpu
->env
;
7145 * With a virtual hypervisor mode we never allow the CPU to go
7146 * hypervisor mode itself
7148 env
->msr_mask
&= ~MSR_HVB
;
7151 #endif /* !defined(CONFIG_USER_ONLY) */
7153 #endif /* defined(TARGET_PPC64) */
7155 /*****************************************************************************/
7156 /* Generic CPU instantiation routine */
7157 static void init_ppc_proc(PowerPCCPU
*cpu
)
7159 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
7160 CPUPPCState
*env
= &cpu
->env
;
7161 #if !defined(CONFIG_USER_ONLY)
7164 env
->irq_inputs
= NULL
;
7165 /* Set all exception vectors to an invalid address */
7166 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++) {
7167 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
7169 env
->ivor_mask
= 0x00000000;
7170 env
->ivpr_mask
= 0x00000000;
7171 /* Default MMU definitions */
7175 env
->tlb_type
= TLB_NONE
;
7177 /* Register SPR common to all PowerPC implementations */
7178 register_generic_sprs(cpu
);
7180 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
7181 (*pcc
->init_proc
)(env
);
7183 #if !defined(CONFIG_USER_ONLY)
7184 ppc_gdb_gen_spr_xml(cpu
);
7187 /* MSR bits & flags consistency checks */
7188 if (env
->msr_mask
& (1 << 25)) {
7189 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
7190 case POWERPC_FLAG_SPE
:
7191 case POWERPC_FLAG_VRE
:
7194 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7195 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
7198 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
7199 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7200 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
7203 if (env
->msr_mask
& (1 << 17)) {
7204 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
7205 case POWERPC_FLAG_TGPR
:
7206 case POWERPC_FLAG_CE
:
7209 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7210 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
7213 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
7214 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7215 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
7218 if (env
->msr_mask
& (1 << 10)) {
7219 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
7220 POWERPC_FLAG_UBLE
)) {
7221 case POWERPC_FLAG_SE
:
7222 case POWERPC_FLAG_DWE
:
7223 case POWERPC_FLAG_UBLE
:
7226 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7227 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
7228 "POWERPC_FLAG_UBLE\n");
7231 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
7232 POWERPC_FLAG_UBLE
)) {
7233 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7234 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
7235 "POWERPC_FLAG_UBLE\n");
7238 if (env
->msr_mask
& (1 << 9)) {
7239 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
7240 case POWERPC_FLAG_BE
:
7241 case POWERPC_FLAG_DE
:
7244 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7245 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
7248 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
7249 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7250 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
7253 if (env
->msr_mask
& (1 << 2)) {
7254 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
7255 case POWERPC_FLAG_PX
:
7256 case POWERPC_FLAG_PMM
:
7259 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7260 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
7263 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
7264 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7265 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
7268 if ((env
->flags
& POWERPC_FLAG_BUS_CLK
) == 0) {
7269 fprintf(stderr
, "PowerPC flags inconsistency\n"
7270 "Should define the time-base and decrementer clock source\n");
7273 /* Allocate TLBs buffer when needed */
7274 #if !defined(CONFIG_USER_ONLY)
7275 if (env
->nb_tlb
!= 0) {
7276 int nb_tlb
= env
->nb_tlb
;
7277 if (env
->id_tlbs
!= 0) {
7280 switch (env
->tlb_type
) {
7282 env
->tlb
.tlb6
= g_new0(ppc6xx_tlb_t
, nb_tlb
);
7285 env
->tlb
.tlbe
= g_new0(ppcemb_tlb_t
, nb_tlb
);
7288 env
->tlb
.tlbm
= g_new0(ppcmas_tlb_t
, nb_tlb
);
7291 /* Pre-compute some useful values */
7292 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
7294 if (env
->irq_inputs
== NULL
) {
7295 warn_report("no internal IRQ controller registered."
7296 " Attempt QEMU to crash very soon !");
7299 if (env
->check_pow
== NULL
) {
7300 warn_report("no power management check handler registered."
7301 " Attempt QEMU to crash very soon !");
7306 static void ppc_cpu_realize(DeviceState
*dev
, Error
**errp
)
7308 CPUState
*cs
= CPU(dev
);
7309 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
7310 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
7311 Error
*local_err
= NULL
;
7313 cpu_exec_realizefn(cs
, &local_err
);
7314 if (local_err
!= NULL
) {
7315 error_propagate(errp
, local_err
);
7318 if (cpu
->vcpu_id
== UNASSIGNED_CPU_INDEX
) {
7319 cpu
->vcpu_id
= cs
->cpu_index
;
7322 if (tcg_enabled()) {
7323 if (ppc_fixup_cpu(cpu
) != 0) {
7324 error_setg(errp
, "Unable to emulate selected CPU with TCG");
7329 create_ppc_opcodes(cpu
, &local_err
);
7330 if (local_err
!= NULL
) {
7331 error_propagate(errp
, local_err
);
7336 ppc_gdb_init(cs
, pcc
);
7339 pcc
->parent_realize(dev
, errp
);
7344 cpu_exec_unrealizefn(cs
);
7347 static void ppc_cpu_unrealize(DeviceState
*dev
)
7349 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
7350 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
7352 pcc
->parent_unrealize(dev
);
7354 cpu_remove_sync(CPU(cpu
));
7356 destroy_ppc_opcodes(cpu
);
7359 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
7361 ObjectClass
*oc
= (ObjectClass
*)a
;
7362 uint32_t pvr
= *(uint32_t *)b
;
7363 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
7365 /* -cpu host does a PVR lookup during construction */
7366 if (unlikely(strcmp(object_class_get_name(oc
),
7367 TYPE_HOST_POWERPC_CPU
) == 0)) {
7371 return pcc
->pvr
== pvr
? 0 : -1;
7374 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
7376 GSList
*list
, *item
;
7377 PowerPCCPUClass
*pcc
= NULL
;
7379 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
7380 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
7382 pcc
= POWERPC_CPU_CLASS(item
->data
);
7389 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
7391 ObjectClass
*oc
= (ObjectClass
*)a
;
7392 uint32_t pvr
= *(uint32_t *)b
;
7393 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
7395 /* -cpu host does a PVR lookup during construction */
7396 if (unlikely(strcmp(object_class_get_name(oc
),
7397 TYPE_HOST_POWERPC_CPU
) == 0)) {
7401 if (pcc
->pvr_match(pcc
, pvr
)) {
7408 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
7410 GSList
*list
, *item
;
7411 PowerPCCPUClass
*pcc
= NULL
;
7413 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
7414 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
7416 pcc
= POWERPC_CPU_CLASS(item
->data
);
7423 static const char *ppc_cpu_lookup_alias(const char *alias
)
7427 for (ai
= 0; ppc_cpu_aliases
[ai
].alias
!= NULL
; ai
++) {
7428 if (strcmp(ppc_cpu_aliases
[ai
].alias
, alias
) == 0) {
7429 return ppc_cpu_aliases
[ai
].model
;
7436 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
7438 char *cpu_model
, *typename
;
7444 * Lookup by PVR if cpu_model is valid 8 digit hex number (excl:
7445 * 0x prefix if present)
7447 if (!qemu_strtoul(name
, &p
, 16, &pvr
)) {
7449 len
= (len
== 10) && (name
[1] == 'x') ? len
- 2 : len
;
7450 if ((len
== 8) && (*p
== '\0')) {
7451 return OBJECT_CLASS(ppc_cpu_class_by_pvr(pvr
));
7455 cpu_model
= g_ascii_strdown(name
, -1);
7456 p
= ppc_cpu_lookup_alias(cpu_model
);
7459 cpu_model
= g_strdup(p
);
7462 typename
= g_strdup_printf("%s" POWERPC_CPU_TYPE_SUFFIX
, cpu_model
);
7463 oc
= object_class_by_name(typename
);
7470 PowerPCCPUClass
*ppc_cpu_get_family_class(PowerPCCPUClass
*pcc
)
7472 ObjectClass
*oc
= OBJECT_CLASS(pcc
);
7474 while (oc
&& !object_class_is_abstract(oc
)) {
7475 oc
= object_class_get_parent(oc
);
7479 return POWERPC_CPU_CLASS(oc
);
7482 /* Sort by PVR, ordering special case "host" last. */
7483 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
7485 ObjectClass
*oc_a
= (ObjectClass
*)a
;
7486 ObjectClass
*oc_b
= (ObjectClass
*)b
;
7487 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
7488 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
7489 const char *name_a
= object_class_get_name(oc_a
);
7490 const char *name_b
= object_class_get_name(oc_b
);
7492 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
7494 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
7497 /* Avoid an integer overflow during subtraction */
7498 if (pcc_a
->pvr
< pcc_b
->pvr
) {
7500 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
7508 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
7510 ObjectClass
*oc
= data
;
7511 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7512 DeviceClass
*family
= DEVICE_CLASS(ppc_cpu_get_family_class(pcc
));
7513 const char *typename
= object_class_get_name(oc
);
7517 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
7521 name
= g_strndup(typename
,
7522 strlen(typename
) - strlen(POWERPC_CPU_TYPE_SUFFIX
));
7523 qemu_printf("PowerPC %-16s PVR %08x\n", name
, pcc
->pvr
);
7524 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
7525 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
7526 ObjectClass
*alias_oc
= ppc_cpu_class_by_name(alias
->model
);
7528 if (alias_oc
!= oc
) {
7532 * If running with KVM, we might update the family alias later, so
7533 * avoid printing the wrong alias here and use "preferred" instead
7535 if (strcmp(alias
->alias
, family
->desc
) == 0) {
7536 qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n",
7537 alias
->alias
, family
->desc
);
7539 qemu_printf("PowerPC %-16s (alias for %s)\n",
7540 alias
->alias
, name
);
7546 void ppc_cpu_list(void)
7550 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
7551 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
7552 g_slist_foreach(list
, ppc_cpu_list_entry
, NULL
);
7557 qemu_printf("PowerPC %s\n", "host");
7561 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
7563 ObjectClass
*oc
= data
;
7564 CpuDefinitionInfoList
**first
= user_data
;
7565 const char *typename
;
7566 CpuDefinitionInfo
*info
;
7568 typename
= object_class_get_name(oc
);
7569 info
= g_malloc0(sizeof(*info
));
7570 info
->name
= g_strndup(typename
,
7571 strlen(typename
) - strlen(POWERPC_CPU_TYPE_SUFFIX
));
7573 QAPI_LIST_PREPEND(*first
, info
);
7576 CpuDefinitionInfoList
*qmp_query_cpu_definitions(Error
**errp
)
7578 CpuDefinitionInfoList
*cpu_list
= NULL
;
7582 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
7583 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
7586 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
7587 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
7589 CpuDefinitionInfo
*info
;
7591 oc
= ppc_cpu_class_by_name(alias
->model
);
7596 info
= g_malloc0(sizeof(*info
));
7597 info
->name
= g_strdup(alias
->alias
);
7598 info
->q_typename
= g_strdup(object_class_get_name(oc
));
7600 QAPI_LIST_PREPEND(cpu_list
, info
);
7606 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
7608 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
7610 cpu
->env
.nip
= value
;
7613 static bool ppc_cpu_has_work(CPUState
*cs
)
7615 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
7616 CPUPPCState
*env
= &cpu
->env
;
7618 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
7621 static void ppc_cpu_reset(DeviceState
*dev
)
7623 CPUState
*s
= CPU(dev
);
7624 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
7625 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
7626 CPUPPCState
*env
= &cpu
->env
;
7630 pcc
->parent_reset(dev
);
7632 msr
= (target_ulong
)0;
7633 msr
|= (target_ulong
)MSR_HVB
;
7634 msr
|= (target_ulong
)1 << MSR_EP
;
7635 #if defined(DO_SINGLE_STEP) && 0
7636 /* Single step trace mode */
7637 msr
|= (target_ulong
)1 << MSR_SE
;
7638 msr
|= (target_ulong
)1 << MSR_BE
;
7640 #if defined(CONFIG_USER_ONLY)
7641 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
7642 msr
|= (target_ulong
)1 << MSR_FE0
; /* Allow floating point exceptions */
7643 msr
|= (target_ulong
)1 << MSR_FE1
;
7644 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
7645 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
7646 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
7647 msr
|= (target_ulong
)1 << MSR_PR
;
7648 #if defined(TARGET_PPC64)
7649 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
7651 #if !defined(TARGET_WORDS_BIGENDIAN)
7652 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
7653 if (!((env
->msr_mask
>> MSR_LE
) & 1)) {
7654 fprintf(stderr
, "Selected CPU does not support little-endian.\n");
7660 #if defined(TARGET_PPC64)
7661 if (mmu_is_64bit(env
->mmu_model
)) {
7662 msr
|= (1ULL << MSR_SF
);
7666 hreg_store_msr(env
, msr
, 1);
7668 #if !defined(CONFIG_USER_ONLY)
7669 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
7670 #if defined(CONFIG_TCG)
7671 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
7672 ppc_tlb_invalidate_all(env
);
7674 #endif /* CONFIG_TCG */
7677 pmu_update_summaries(env
);
7678 hreg_compute_hflags(env
);
7679 env
->reserve_addr
= (target_ulong
)-1ULL;
7680 /* Be sure no exception or interrupt is pending */
7681 env
->pending_interrupts
= 0;
7682 s
->exception_index
= POWERPC_EXCP_NONE
;
7683 env
->error_code
= 0;
7686 /* tininess for underflow is detected before rounding */
7687 set_float_detect_tininess(float_tininess_before_rounding
,
7690 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
7691 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
7696 env
->spr
[i
] = spr
->default_value
;
7700 #ifndef CONFIG_USER_ONLY
7702 static bool ppc_cpu_is_big_endian(CPUState
*cs
)
7704 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
7705 CPUPPCState
*env
= &cpu
->env
;
7707 cpu_synchronize_state(cs
);
7713 static void ppc_cpu_exec_enter(CPUState
*cs
)
7715 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
7718 PPCVirtualHypervisorClass
*vhc
=
7719 PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu
->vhyp
);
7720 vhc
->cpu_exec_enter(cpu
->vhyp
, cpu
);
7724 static void ppc_cpu_exec_exit(CPUState
*cs
)
7726 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
7729 PPCVirtualHypervisorClass
*vhc
=
7730 PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu
->vhyp
);
7731 vhc
->cpu_exec_exit(cpu
->vhyp
, cpu
);
7734 #endif /* CONFIG_TCG */
7736 #endif /* !CONFIG_USER_ONLY */
7738 static void ppc_cpu_instance_init(Object
*obj
)
7740 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
7741 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
7742 CPUPPCState
*env
= &cpu
->env
;
7744 cpu_set_cpustate_pointers(cpu
);
7745 cpu
->vcpu_id
= UNASSIGNED_CPU_INDEX
;
7747 env
->msr_mask
= pcc
->msr_mask
;
7748 env
->mmu_model
= pcc
->mmu_model
;
7749 env
->excp_model
= pcc
->excp_model
;
7750 env
->bus_model
= pcc
->bus_model
;
7751 env
->insns_flags
= pcc
->insns_flags
;
7752 env
->insns_flags2
= pcc
->insns_flags2
;
7753 env
->flags
= pcc
->flags
;
7754 env
->bfd_mach
= pcc
->bfd_mach
;
7755 env
->check_pow
= pcc
->check_pow
;
7758 * Mark HV mode as supported if the CPU has an MSR_HV bit in the
7759 * msr_mask. The mask can later be cleared by PAPR mode but the hv
7760 * mode support will remain, thus enforcing that we cannot use
7761 * priv. instructions in guest in PAPR mode. For 970 we currently
7762 * simply don't set HV in msr_mask thus simulating an "Apple mode"
7763 * 970. If we ever want to support 970 HV mode, we'll have to add
7764 * a processor attribute of some sort.
7766 #if !defined(CONFIG_USER_ONLY)
7767 env
->has_hv_mode
= !!(env
->msr_mask
& MSR_HVB
);
7770 ppc_hash64_init(cpu
);
7773 static void ppc_cpu_instance_finalize(Object
*obj
)
7775 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
7777 ppc_hash64_finalize(cpu
);
7780 static bool ppc_pvr_match_default(PowerPCCPUClass
*pcc
, uint32_t pvr
)
7782 return pcc
->pvr
== pvr
;
7785 static void ppc_disas_set_info(CPUState
*cs
, disassemble_info
*info
)
7787 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
7788 CPUPPCState
*env
= &cpu
->env
;
7790 if ((env
->hflags
>> MSR_LE
) & 1) {
7791 info
->endian
= BFD_ENDIAN_LITTLE
;
7793 info
->mach
= env
->bfd_mach
;
7794 if (!env
->bfd_mach
) {
7796 info
->mach
= bfd_mach_ppc64
;
7798 info
->mach
= bfd_mach_ppc
;
7801 info
->disassembler_options
= (char *)"any";
7802 info
->print_insn
= print_insn_ppc
;
7804 info
->cap_arch
= CS_ARCH_PPC
;
7806 info
->cap_mode
= CS_MODE_64
;
7810 static Property ppc_cpu_properties
[] = {
7811 DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU
, pre_2_8_migration
, false),
7812 DEFINE_PROP_BOOL("pre-2.10-migration", PowerPCCPU
, pre_2_10_migration
,
7814 DEFINE_PROP_BOOL("pre-3.0-migration", PowerPCCPU
, pre_3_0_migration
,
7816 DEFINE_PROP_END_OF_LIST(),
7819 #ifndef CONFIG_USER_ONLY
7820 #include "hw/core/sysemu-cpu-ops.h"
7822 static const struct SysemuCPUOps ppc_sysemu_ops
= {
7823 .get_phys_page_debug
= ppc_cpu_get_phys_page_debug
,
7824 .write_elf32_note
= ppc32_cpu_write_elf32_note
,
7825 .write_elf64_note
= ppc64_cpu_write_elf64_note
,
7826 .virtio_is_big_endian
= ppc_cpu_is_big_endian
,
7827 .legacy_vmsd
= &vmstate_ppc_cpu
,
7832 #include "hw/core/tcg-cpu-ops.h"
7834 static const struct TCGCPUOps ppc_tcg_ops
= {
7835 .initialize
= ppc_translate_init
,
7837 #ifdef CONFIG_USER_ONLY
7838 .record_sigsegv
= ppc_cpu_record_sigsegv
,
7840 .tlb_fill
= ppc_cpu_tlb_fill
,
7841 .cpu_exec_interrupt
= ppc_cpu_exec_interrupt
,
7842 .do_interrupt
= ppc_cpu_do_interrupt
,
7843 .cpu_exec_enter
= ppc_cpu_exec_enter
,
7844 .cpu_exec_exit
= ppc_cpu_exec_exit
,
7845 .do_unaligned_access
= ppc_cpu_do_unaligned_access
,
7846 #endif /* !CONFIG_USER_ONLY */
7848 #endif /* CONFIG_TCG */
7850 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
7852 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7853 CPUClass
*cc
= CPU_CLASS(oc
);
7854 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7856 device_class_set_parent_realize(dc
, ppc_cpu_realize
,
7857 &pcc
->parent_realize
);
7858 device_class_set_parent_unrealize(dc
, ppc_cpu_unrealize
,
7859 &pcc
->parent_unrealize
);
7860 pcc
->pvr_match
= ppc_pvr_match_default
;
7861 device_class_set_props(dc
, ppc_cpu_properties
);
7863 device_class_set_parent_reset(dc
, ppc_cpu_reset
, &pcc
->parent_reset
);
7865 cc
->class_by_name
= ppc_cpu_class_by_name
;
7866 cc
->has_work
= ppc_cpu_has_work
;
7867 cc
->dump_state
= ppc_cpu_dump_state
;
7868 cc
->set_pc
= ppc_cpu_set_pc
;
7869 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
7870 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
7871 #ifndef CONFIG_USER_ONLY
7872 cc
->sysemu_ops
= &ppc_sysemu_ops
;
7875 cc
->gdb_num_core_regs
= 71;
7876 #ifndef CONFIG_USER_ONLY
7877 cc
->gdb_get_dynamic_xml
= ppc_gdb_get_dynamic_xml
;
7879 #ifdef USE_APPLE_GDB
7880 cc
->gdb_read_register
= ppc_cpu_gdb_read_register_apple
;
7881 cc
->gdb_write_register
= ppc_cpu_gdb_write_register_apple
;
7882 cc
->gdb_num_core_regs
= 71 + 32;
7885 cc
->gdb_arch_name
= ppc_gdb_arch_name
;
7886 #if defined(TARGET_PPC64)
7887 cc
->gdb_core_xml_file
= "power64-core.xml";
7889 cc
->gdb_core_xml_file
= "power-core.xml";
7891 cc
->disas_set_info
= ppc_disas_set_info
;
7893 dc
->fw_name
= "PowerPC,UNKNOWN";
7896 cc
->tcg_ops
= &ppc_tcg_ops
;
7897 #endif /* CONFIG_TCG */
7900 static const TypeInfo ppc_cpu_type_info
= {
7901 .name
= TYPE_POWERPC_CPU
,
7903 .instance_size
= sizeof(PowerPCCPU
),
7904 .instance_align
= __alignof__(PowerPCCPU
),
7905 .instance_init
= ppc_cpu_instance_init
,
7906 .instance_finalize
= ppc_cpu_instance_finalize
,
7908 .class_size
= sizeof(PowerPCCPUClass
),
7909 .class_init
= ppc_cpu_class_init
,
7912 #ifndef CONFIG_USER_ONLY
7913 static const TypeInfo ppc_vhyp_type_info
= {
7914 .name
= TYPE_PPC_VIRTUAL_HYPERVISOR
,
7915 .parent
= TYPE_INTERFACE
,
7916 .class_size
= sizeof(PPCVirtualHypervisorClass
),
7920 static void ppc_cpu_register_types(void)
7922 type_register_static(&ppc_cpu_type_info
);
7923 #ifndef CONFIG_USER_ONLY
7924 type_register_static(&ppc_vhyp_type_info
);
7928 void ppc_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
7933 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
7934 CPUPPCState
*env
= &cpu
->env
;
7937 qemu_fprintf(f
, "NIP " TARGET_FMT_lx
" LR " TARGET_FMT_lx
" CTR "
7938 TARGET_FMT_lx
" XER " TARGET_FMT_lx
" CPU#%d\n",
7939 env
->nip
, env
->lr
, env
->ctr
, cpu_read_xer(env
),
7941 qemu_fprintf(f
, "MSR " TARGET_FMT_lx
" HID0 " TARGET_FMT_lx
" HF "
7942 "%08x iidx %d didx %d\n",
7943 env
->msr
, env
->spr
[SPR_HID0
], env
->hflags
,
7944 cpu_mmu_index(env
, true), cpu_mmu_index(env
, false));
7945 #if !defined(NO_TIMER_DUMP)
7946 qemu_fprintf(f
, "TB %08" PRIu32
" %08" PRIu64
7947 #if !defined(CONFIG_USER_ONLY)
7948 " DECR " TARGET_FMT_lu
7951 cpu_ppc_load_tbu(env
), cpu_ppc_load_tbl(env
)
7952 #if !defined(CONFIG_USER_ONLY)
7953 , cpu_ppc_load_decr(env
)
7957 for (i
= 0; i
< 32; i
++) {
7958 if ((i
& (RGPL
- 1)) == 0) {
7959 qemu_fprintf(f
, "GPR%02d", i
);
7961 qemu_fprintf(f
, " %016" PRIx64
, ppc_dump_gpr(env
, i
));
7962 if ((i
& (RGPL
- 1)) == (RGPL
- 1)) {
7963 qemu_fprintf(f
, "\n");
7966 qemu_fprintf(f
, "CR ");
7967 for (i
= 0; i
< 8; i
++)
7968 qemu_fprintf(f
, "%01x", env
->crf
[i
]);
7969 qemu_fprintf(f
, " [");
7970 for (i
= 0; i
< 8; i
++) {
7972 if (env
->crf
[i
] & 0x08) {
7974 } else if (env
->crf
[i
] & 0x04) {
7976 } else if (env
->crf
[i
] & 0x02) {
7979 qemu_fprintf(f
, " %c%c", a
, env
->crf
[i
] & 0x01 ? 'O' : ' ');
7981 qemu_fprintf(f
, " ] RES " TARGET_FMT_lx
"\n",
7984 if (flags
& CPU_DUMP_FPU
) {
7985 for (i
= 0; i
< 32; i
++) {
7986 if ((i
& (RFPL
- 1)) == 0) {
7987 qemu_fprintf(f
, "FPR%02d", i
);
7989 qemu_fprintf(f
, " %016" PRIx64
, *cpu_fpr_ptr(env
, i
));
7990 if ((i
& (RFPL
- 1)) == (RFPL
- 1)) {
7991 qemu_fprintf(f
, "\n");
7994 qemu_fprintf(f
, "FPSCR " TARGET_FMT_lx
"\n", env
->fpscr
);
7997 #if !defined(CONFIG_USER_ONLY)
7998 qemu_fprintf(f
, " SRR0 " TARGET_FMT_lx
" SRR1 " TARGET_FMT_lx
7999 " PVR " TARGET_FMT_lx
" VRSAVE " TARGET_FMT_lx
"\n",
8000 env
->spr
[SPR_SRR0
], env
->spr
[SPR_SRR1
],
8001 env
->spr
[SPR_PVR
], env
->spr
[SPR_VRSAVE
]);
8003 qemu_fprintf(f
, "SPRG0 " TARGET_FMT_lx
" SPRG1 " TARGET_FMT_lx
8004 " SPRG2 " TARGET_FMT_lx
" SPRG3 " TARGET_FMT_lx
"\n",
8005 env
->spr
[SPR_SPRG0
], env
->spr
[SPR_SPRG1
],
8006 env
->spr
[SPR_SPRG2
], env
->spr
[SPR_SPRG3
]);
8008 qemu_fprintf(f
, "SPRG4 " TARGET_FMT_lx
" SPRG5 " TARGET_FMT_lx
8009 " SPRG6 " TARGET_FMT_lx
" SPRG7 " TARGET_FMT_lx
"\n",
8010 env
->spr
[SPR_SPRG4
], env
->spr
[SPR_SPRG5
],
8011 env
->spr
[SPR_SPRG6
], env
->spr
[SPR_SPRG7
]);
8013 switch (env
->excp_model
) {
8014 #if defined(TARGET_PPC64)
8015 case POWERPC_EXCP_POWER7
:
8016 case POWERPC_EXCP_POWER8
:
8017 case POWERPC_EXCP_POWER9
:
8018 case POWERPC_EXCP_POWER10
:
8019 qemu_fprintf(f
, "HSRR0 " TARGET_FMT_lx
" HSRR1 " TARGET_FMT_lx
"\n",
8020 env
->spr
[SPR_HSRR0
], env
->spr
[SPR_HSRR1
]);
8023 case POWERPC_EXCP_BOOKE
:
8024 qemu_fprintf(f
, "CSRR0 " TARGET_FMT_lx
" CSRR1 " TARGET_FMT_lx
8025 " MCSRR0 " TARGET_FMT_lx
" MCSRR1 " TARGET_FMT_lx
"\n",
8026 env
->spr
[SPR_BOOKE_CSRR0
], env
->spr
[SPR_BOOKE_CSRR1
],
8027 env
->spr
[SPR_BOOKE_MCSRR0
], env
->spr
[SPR_BOOKE_MCSRR1
]);
8029 qemu_fprintf(f
, " TCR " TARGET_FMT_lx
" TSR " TARGET_FMT_lx
8030 " ESR " TARGET_FMT_lx
" DEAR " TARGET_FMT_lx
"\n",
8031 env
->spr
[SPR_BOOKE_TCR
], env
->spr
[SPR_BOOKE_TSR
],
8032 env
->spr
[SPR_BOOKE_ESR
], env
->spr
[SPR_BOOKE_DEAR
]);
8034 qemu_fprintf(f
, " PIR " TARGET_FMT_lx
" DECAR " TARGET_FMT_lx
8035 " IVPR " TARGET_FMT_lx
" EPCR " TARGET_FMT_lx
"\n",
8036 env
->spr
[SPR_BOOKE_PIR
], env
->spr
[SPR_BOOKE_DECAR
],
8037 env
->spr
[SPR_BOOKE_IVPR
], env
->spr
[SPR_BOOKE_EPCR
]);
8039 qemu_fprintf(f
, " MCSR " TARGET_FMT_lx
" SPRG8 " TARGET_FMT_lx
8040 " EPR " TARGET_FMT_lx
"\n",
8041 env
->spr
[SPR_BOOKE_MCSR
], env
->spr
[SPR_BOOKE_SPRG8
],
8042 env
->spr
[SPR_BOOKE_EPR
]);
8045 qemu_fprintf(f
, " MCAR " TARGET_FMT_lx
" PID1 " TARGET_FMT_lx
8046 " PID2 " TARGET_FMT_lx
" SVR " TARGET_FMT_lx
"\n",
8047 env
->spr
[SPR_Exxx_MCAR
], env
->spr
[SPR_BOOKE_PID1
],
8048 env
->spr
[SPR_BOOKE_PID2
], env
->spr
[SPR_E500_SVR
]);
8051 * IVORs are left out as they are large and do not change often --
8052 * they can be read with "p $ivor0", "p $ivor1", etc.
8055 case POWERPC_EXCP_40x
:
8056 qemu_fprintf(f
, " TCR " TARGET_FMT_lx
" TSR " TARGET_FMT_lx
8057 " ESR " TARGET_FMT_lx
" DEAR " TARGET_FMT_lx
"\n",
8058 env
->spr
[SPR_40x_TCR
], env
->spr
[SPR_40x_TSR
],
8059 env
->spr
[SPR_40x_ESR
], env
->spr
[SPR_40x_DEAR
]);
8061 qemu_fprintf(f
, " EVPR " TARGET_FMT_lx
" SRR2 " TARGET_FMT_lx
8062 " SRR3 " TARGET_FMT_lx
" PID " TARGET_FMT_lx
"\n",
8063 env
->spr
[SPR_40x_EVPR
], env
->spr
[SPR_40x_SRR2
],
8064 env
->spr
[SPR_40x_SRR3
], env
->spr
[SPR_40x_PID
]);
8070 #if defined(TARGET_PPC64)
8071 if (env
->flags
& POWERPC_FLAG_CFAR
) {
8072 qemu_fprintf(f
, " CFAR " TARGET_FMT_lx
"\n", env
->cfar
);
8076 if (env
->spr_cb
[SPR_LPCR
].name
) {
8077 qemu_fprintf(f
, " LPCR " TARGET_FMT_lx
"\n", env
->spr
[SPR_LPCR
]);
8080 switch (env
->mmu_model
) {
8081 case POWERPC_MMU_32B
:
8082 case POWERPC_MMU_SOFT_6xx
:
8083 #if defined(TARGET_PPC64)
8084 case POWERPC_MMU_64B
:
8085 case POWERPC_MMU_2_03
:
8086 case POWERPC_MMU_2_06
:
8087 case POWERPC_MMU_2_07
:
8088 case POWERPC_MMU_3_00
:
8090 if (env
->spr_cb
[SPR_SDR1
].name
) { /* SDR1 Exists */
8091 qemu_fprintf(f
, " SDR1 " TARGET_FMT_lx
" ", env
->spr
[SPR_SDR1
]);
8093 if (env
->spr_cb
[SPR_PTCR
].name
) { /* PTCR Exists */
8094 qemu_fprintf(f
, " PTCR " TARGET_FMT_lx
" ", env
->spr
[SPR_PTCR
]);
8096 qemu_fprintf(f
, " DAR " TARGET_FMT_lx
" DSISR " TARGET_FMT_lx
"\n",
8097 env
->spr
[SPR_DAR
], env
->spr
[SPR_DSISR
]);
8099 case POWERPC_MMU_BOOKE206
:
8100 qemu_fprintf(f
, " MAS0 " TARGET_FMT_lx
" MAS1 " TARGET_FMT_lx
8101 " MAS2 " TARGET_FMT_lx
" MAS3 " TARGET_FMT_lx
"\n",
8102 env
->spr
[SPR_BOOKE_MAS0
], env
->spr
[SPR_BOOKE_MAS1
],
8103 env
->spr
[SPR_BOOKE_MAS2
], env
->spr
[SPR_BOOKE_MAS3
]);
8105 qemu_fprintf(f
, " MAS4 " TARGET_FMT_lx
" MAS6 " TARGET_FMT_lx
8106 " MAS7 " TARGET_FMT_lx
" PID " TARGET_FMT_lx
"\n",
8107 env
->spr
[SPR_BOOKE_MAS4
], env
->spr
[SPR_BOOKE_MAS6
],
8108 env
->spr
[SPR_BOOKE_MAS7
], env
->spr
[SPR_BOOKE_PID
]);
8110 qemu_fprintf(f
, "MMUCFG " TARGET_FMT_lx
" TLB0CFG " TARGET_FMT_lx
8111 " TLB1CFG " TARGET_FMT_lx
"\n",
8112 env
->spr
[SPR_MMUCFG
], env
->spr
[SPR_BOOKE_TLB0CFG
],
8113 env
->spr
[SPR_BOOKE_TLB1CFG
]);
8123 type_init(ppc_cpu_register_types
)