xref: /openbmc/qemu/target/ppc/cpu_init.c (revision e599bced)
13e770bf7SBruno Larsen (billionai) /*
23e770bf7SBruno Larsen (billionai)  *  PowerPC CPU initialization for qemu.
33e770bf7SBruno Larsen (billionai)  *
43e770bf7SBruno Larsen (billionai)  *  Copyright (c) 2003-2007 Jocelyn Mayer
53e770bf7SBruno Larsen (billionai)  *  Copyright 2011 Freescale Semiconductor, Inc.
63e770bf7SBruno Larsen (billionai)  *
73e770bf7SBruno Larsen (billionai)  * This library is free software; you can redistribute it and/or
83e770bf7SBruno Larsen (billionai)  * modify it under the terms of the GNU Lesser General Public
93e770bf7SBruno Larsen (billionai)  * License as published by the Free Software Foundation; either
103e770bf7SBruno Larsen (billionai)  * version 2.1 of the License, or (at your option) any later version.
113e770bf7SBruno Larsen (billionai)  *
123e770bf7SBruno Larsen (billionai)  * This library is distributed in the hope that it will be useful,
133e770bf7SBruno Larsen (billionai)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
143e770bf7SBruno Larsen (billionai)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
153e770bf7SBruno Larsen (billionai)  * Lesser General Public License for more details.
163e770bf7SBruno Larsen (billionai)  *
173e770bf7SBruno Larsen (billionai)  * You should have received a copy of the GNU Lesser General Public
183e770bf7SBruno Larsen (billionai)  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
193e770bf7SBruno Larsen (billionai)  */
203e770bf7SBruno Larsen (billionai) 
213e770bf7SBruno Larsen (billionai) #include "qemu/osdep.h"
223e770bf7SBruno Larsen (billionai) #include "disas/dis-asm.h"
233e770bf7SBruno Larsen (billionai) #include "exec/gdbstub.h"
243e770bf7SBruno Larsen (billionai) #include "kvm_ppc.h"
253e770bf7SBruno Larsen (billionai) #include "sysemu/cpus.h"
263e770bf7SBruno Larsen (billionai) #include "sysemu/hw_accel.h"
273e770bf7SBruno Larsen (billionai) #include "sysemu/tcg.h"
283e770bf7SBruno Larsen (billionai) #include "cpu-models.h"
293e770bf7SBruno Larsen (billionai) #include "mmu-hash32.h"
303e770bf7SBruno Larsen (billionai) #include "mmu-hash64.h"
313e770bf7SBruno Larsen (billionai) #include "qemu/error-report.h"
323e770bf7SBruno Larsen (billionai) #include "qemu/module.h"
333e770bf7SBruno Larsen (billionai) #include "qemu/qemu-print.h"
343e770bf7SBruno Larsen (billionai) #include "qapi/error.h"
353e770bf7SBruno Larsen (billionai) #include "qapi/qmp/qnull.h"
363e770bf7SBruno Larsen (billionai) #include "qapi/visitor.h"
373e770bf7SBruno Larsen (billionai) #include "hw/qdev-properties.h"
383e770bf7SBruno Larsen (billionai) #include "hw/ppc/ppc.h"
393e770bf7SBruno Larsen (billionai) #include "mmu-book3s-v3.h"
403e770bf7SBruno Larsen (billionai) #include "qemu/cutils.h"
413e770bf7SBruno Larsen (billionai) #include "disas/capstone.h"
423e770bf7SBruno Larsen (billionai) #include "fpu/softfloat.h"
433e770bf7SBruno Larsen (billionai) #include "qapi/qapi-commands-machine-target.h"
443e770bf7SBruno Larsen (billionai) 
453e770bf7SBruno Larsen (billionai) #include "helper_regs.h"
463e770bf7SBruno Larsen (billionai) #include "internal.h"
473e770bf7SBruno Larsen (billionai) #include "spr_tcg.h"
488f2e9d40SDaniel Henrique Barboza #include "power8-pmu.h"
493e770bf7SBruno Larsen (billionai) 
503e770bf7SBruno Larsen (billionai) /* #define PPC_DEBUG_SPR */
513e770bf7SBruno Larsen (billionai) /* #define USE_APPLE_GDB */
523e770bf7SBruno Larsen (billionai) 
533e770bf7SBruno Larsen (billionai) static inline void vscr_init(CPUPPCState *env, uint32_t val)
543e770bf7SBruno Larsen (billionai) {
553e770bf7SBruno Larsen (billionai)     /* Altivec always uses round-to-nearest */
563e770bf7SBruno Larsen (billionai)     set_float_rounding_mode(float_round_nearest_even, &env->vec_status);
57c19940dbSBruno Larsen (billionai)     ppc_store_vscr(env, val);
583e770bf7SBruno Larsen (billionai) }
593e770bf7SBruno Larsen (billionai) 
603e770bf7SBruno Larsen (billionai) /**
613e770bf7SBruno Larsen (billionai)  * _spr_register
623e770bf7SBruno Larsen (billionai)  *
633e770bf7SBruno Larsen (billionai)  * Register an SPR with all the callbacks required for tcg,
643e770bf7SBruno Larsen (billionai)  * and the ID number for KVM.
653e770bf7SBruno Larsen (billionai)  *
663e770bf7SBruno Larsen (billionai)  * The reason for the conditional compilation is that the tcg functions
673e770bf7SBruno Larsen (billionai)  * may be compiled out, and the system kvm header may not be available
683e770bf7SBruno Larsen (billionai)  * for supplying the ID numbers.  This is ugly, but the best we can do.
693e770bf7SBruno Larsen (billionai)  */
703e770bf7SBruno Larsen (billionai) 
713e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG
723e770bf7SBruno Larsen (billionai) # define USR_ARG(X)    X,
733e770bf7SBruno Larsen (billionai) # ifdef CONFIG_USER_ONLY
743e770bf7SBruno Larsen (billionai) #  define SYS_ARG(X)
753e770bf7SBruno Larsen (billionai) # else
763e770bf7SBruno Larsen (billionai) #  define SYS_ARG(X)   X,
773e770bf7SBruno Larsen (billionai) # endif
783e770bf7SBruno Larsen (billionai) #else
793e770bf7SBruno Larsen (billionai) # define USR_ARG(X)
803e770bf7SBruno Larsen (billionai) # define SYS_ARG(X)
813e770bf7SBruno Larsen (billionai) #endif
823e770bf7SBruno Larsen (billionai) #ifdef CONFIG_KVM
833e770bf7SBruno Larsen (billionai) # define KVM_ARG(X)    X,
843e770bf7SBruno Larsen (billionai) #else
853e770bf7SBruno Larsen (billionai) # define KVM_ARG(X)
863e770bf7SBruno Larsen (billionai) #endif
873e770bf7SBruno Larsen (billionai) 
883e770bf7SBruno Larsen (billionai) typedef void spr_callback(DisasContext *, int, int);
893e770bf7SBruno Larsen (billionai) 
903e770bf7SBruno Larsen (billionai) static void _spr_register(CPUPPCState *env, int num, const char *name,
913e770bf7SBruno Larsen (billionai)                           USR_ARG(spr_callback *uea_read)
923e770bf7SBruno Larsen (billionai)                           USR_ARG(spr_callback *uea_write)
933e770bf7SBruno Larsen (billionai)                           SYS_ARG(spr_callback *oea_read)
943e770bf7SBruno Larsen (billionai)                           SYS_ARG(spr_callback *oea_write)
953e770bf7SBruno Larsen (billionai)                           SYS_ARG(spr_callback *hea_read)
963e770bf7SBruno Larsen (billionai)                           SYS_ARG(spr_callback *hea_write)
973e770bf7SBruno Larsen (billionai)                           KVM_ARG(uint64_t one_reg_id)
983e770bf7SBruno Larsen (billionai)                           target_ulong initial_value)
993e770bf7SBruno Larsen (billionai) {
1003e770bf7SBruno Larsen (billionai)     ppc_spr_t *spr = &env->spr_cb[num];
1013e770bf7SBruno Larsen (billionai) 
1023e770bf7SBruno Larsen (billionai)     /* No SPR should be registered twice. */
1033e770bf7SBruno Larsen (billionai)     assert(spr->name == NULL);
1043e770bf7SBruno Larsen (billionai)     assert(name != NULL);
1053e770bf7SBruno Larsen (billionai) 
1063e770bf7SBruno Larsen (billionai)     spr->name = name;
1073e770bf7SBruno Larsen (billionai)     spr->default_value = initial_value;
1083e770bf7SBruno Larsen (billionai)     env->spr[num] = initial_value;
1093e770bf7SBruno Larsen (billionai) 
1103e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG
1113e770bf7SBruno Larsen (billionai)     spr->uea_read = uea_read;
1123e770bf7SBruno Larsen (billionai)     spr->uea_write = uea_write;
1133e770bf7SBruno Larsen (billionai) # ifndef CONFIG_USER_ONLY
1143e770bf7SBruno Larsen (billionai)     spr->oea_read = oea_read;
1153e770bf7SBruno Larsen (billionai)     spr->oea_write = oea_write;
1163e770bf7SBruno Larsen (billionai)     spr->hea_read = hea_read;
1173e770bf7SBruno Larsen (billionai)     spr->hea_write = hea_write;
1183e770bf7SBruno Larsen (billionai) # endif
1193e770bf7SBruno Larsen (billionai) #endif
1203e770bf7SBruno Larsen (billionai) #ifdef CONFIG_KVM
1213e770bf7SBruno Larsen (billionai)     spr->one_reg_id = one_reg_id;
1223e770bf7SBruno Larsen (billionai) #endif
1233e770bf7SBruno Larsen (billionai) }
1243e770bf7SBruno Larsen (billionai) 
1253e770bf7SBruno Larsen (billionai) /* spr_register_kvm_hv passes all required arguments. */
1263e770bf7SBruno Larsen (billionai) #define spr_register_kvm_hv(env, num, name, uea_read, uea_write,             \
1273e770bf7SBruno Larsen (billionai)                             oea_read, oea_write, hea_read, hea_write,        \
1283e770bf7SBruno Larsen (billionai)                             one_reg_id, initial_value)                       \
1293e770bf7SBruno Larsen (billionai)     _spr_register(env, num, name,                                            \
1303e770bf7SBruno Larsen (billionai)                   USR_ARG(uea_read) USR_ARG(uea_write)                       \
1313e770bf7SBruno Larsen (billionai)                   SYS_ARG(oea_read) SYS_ARG(oea_write)                       \
1323e770bf7SBruno Larsen (billionai)                   SYS_ARG(hea_read) SYS_ARG(hea_write)                       \
1333e770bf7SBruno Larsen (billionai)                   KVM_ARG(one_reg_id) initial_value)
1343e770bf7SBruno Larsen (billionai) 
1353e770bf7SBruno Larsen (billionai) /* spr_register_kvm duplicates the oea callbacks to the hea callbacks. */
1363e770bf7SBruno Larsen (billionai) #define spr_register_kvm(env, num, name, uea_read, uea_write,                \
1373e770bf7SBruno Larsen (billionai)                          oea_read, oea_write, one_reg_id, ival)              \
1383e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, num, name, uea_read, uea_write, oea_read,       \
1393e770bf7SBruno Larsen (billionai)                         oea_write, oea_read, oea_write, one_reg_id, ival)
1403e770bf7SBruno Larsen (billionai) 
1413e770bf7SBruno Larsen (billionai) /* spr_register_hv and spr_register are similar, except there is no kvm id. */
1423e770bf7SBruno Larsen (billionai) #define spr_register_hv(env, num, name, uea_read, uea_write,                 \
1433e770bf7SBruno Larsen (billionai)                         oea_read, oea_write, hea_read, hea_write, ival)      \
1443e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, num, name, uea_read, uea_write, oea_read,       \
1453e770bf7SBruno Larsen (billionai)                         oea_write, hea_read, hea_write, 0, ival)
1463e770bf7SBruno Larsen (billionai) 
1473e770bf7SBruno Larsen (billionai) #define spr_register(env, num, name, uea_read, uea_write,                    \
1483e770bf7SBruno Larsen (billionai)                      oea_read, oea_write, ival)                              \
1493e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, num, name, uea_read, uea_write,                    \
1503e770bf7SBruno Larsen (billionai)                      oea_read, oea_write, 0, ival)
1513e770bf7SBruno Larsen (billionai) 
1523e770bf7SBruno Larsen (billionai) /* Generic PowerPC SPRs */
153e78280a2SFabiano Rosas static void register_generic_sprs(PowerPCCPU *cpu)
1543e770bf7SBruno Larsen (billionai) {
155e78280a2SFabiano Rosas     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
156e78280a2SFabiano Rosas     CPUPPCState *env = &cpu->env;
157e78280a2SFabiano Rosas 
1583e770bf7SBruno Larsen (billionai)     /* Integer processing */
1593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_XER, "XER",
1603e770bf7SBruno Larsen (billionai)                  &spr_read_xer, &spr_write_xer,
1613e770bf7SBruno Larsen (billionai)                  &spr_read_xer, &spr_write_xer,
1623e770bf7SBruno Larsen (billionai)                  0x00000000);
1633e770bf7SBruno Larsen (billionai)     /* Branch control */
1643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LR, "LR",
1653e770bf7SBruno Larsen (billionai)                  &spr_read_lr, &spr_write_lr,
1663e770bf7SBruno Larsen (billionai)                  &spr_read_lr, &spr_write_lr,
1673e770bf7SBruno Larsen (billionai)                  0x00000000);
1683e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_CTR, "CTR",
1693e770bf7SBruno Larsen (billionai)                  &spr_read_ctr, &spr_write_ctr,
1703e770bf7SBruno Larsen (billionai)                  &spr_read_ctr, &spr_write_ctr,
1713e770bf7SBruno Larsen (billionai)                  0x00000000);
1723e770bf7SBruno Larsen (billionai)     /* Interrupt processing */
1733e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SRR0, "SRR0",
1743e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1753e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1763e770bf7SBruno Larsen (billionai)                  0x00000000);
1773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SRR1, "SRR1",
1783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1793e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1803e770bf7SBruno Larsen (billionai)                  0x00000000);
1813e770bf7SBruno Larsen (billionai)     /* Processor control */
1823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG0, "SPRG0",
1833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1853e770bf7SBruno Larsen (billionai)                  0x00000000);
1863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG1, "SPRG1",
1873e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1883e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1893e770bf7SBruno Larsen (billionai)                  0x00000000);
1903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG2, "SPRG2",
1913e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1923e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1933e770bf7SBruno Larsen (billionai)                  0x00000000);
1943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG3, "SPRG3",
1953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1963e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1973e770bf7SBruno Larsen (billionai)                  0x00000000);
198e78280a2SFabiano Rosas 
199e78280a2SFabiano Rosas     spr_register(env, SPR_PVR, "PVR",
200e78280a2SFabiano Rosas                  /* Linux permits userspace to read PVR */
201e78280a2SFabiano Rosas #if defined(CONFIG_LINUX_USER)
202e78280a2SFabiano Rosas                  &spr_read_generic,
203e78280a2SFabiano Rosas #else
204e78280a2SFabiano Rosas                  SPR_NOACCESS,
205e78280a2SFabiano Rosas #endif
206e78280a2SFabiano Rosas                  SPR_NOACCESS,
207e78280a2SFabiano Rosas                  &spr_read_generic, SPR_NOACCESS,
208e78280a2SFabiano Rosas                  pcc->pvr);
209e78280a2SFabiano Rosas 
210e78280a2SFabiano Rosas     /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
211e78280a2SFabiano Rosas     if (pcc->svr != POWERPC_SVR_NONE) {
212e78280a2SFabiano Rosas         if (pcc->svr & POWERPC_SVR_E500) {
213e78280a2SFabiano Rosas             spr_register(env, SPR_E500_SVR, "SVR",
214e78280a2SFabiano Rosas                          SPR_NOACCESS, SPR_NOACCESS,
215e78280a2SFabiano Rosas                          &spr_read_generic, SPR_NOACCESS,
216e78280a2SFabiano Rosas                          pcc->svr & ~POWERPC_SVR_E500);
217e78280a2SFabiano Rosas         } else {
218e78280a2SFabiano Rosas             spr_register(env, SPR_SVR, "SVR",
219e78280a2SFabiano Rosas                          SPR_NOACCESS, SPR_NOACCESS,
220e78280a2SFabiano Rosas                          &spr_read_generic, SPR_NOACCESS,
221e78280a2SFabiano Rosas                          pcc->svr);
222e78280a2SFabiano Rosas         }
223e78280a2SFabiano Rosas     }
224024b40e0SFabiano Rosas 
225024b40e0SFabiano Rosas     /* Time base */
226024b40e0SFabiano Rosas     spr_register(env, SPR_VTBL,  "TBL",
227024b40e0SFabiano Rosas                  &spr_read_tbl, SPR_NOACCESS,
228024b40e0SFabiano Rosas                  &spr_read_tbl, SPR_NOACCESS,
229024b40e0SFabiano Rosas                  0x00000000);
230024b40e0SFabiano Rosas     spr_register(env, SPR_TBL,   "TBL",
231024b40e0SFabiano Rosas                  &spr_read_tbl, SPR_NOACCESS,
232024b40e0SFabiano Rosas                  &spr_read_tbl, &spr_write_tbl,
233024b40e0SFabiano Rosas                  0x00000000);
234024b40e0SFabiano Rosas     spr_register(env, SPR_VTBU,  "TBU",
235024b40e0SFabiano Rosas                  &spr_read_tbu, SPR_NOACCESS,
236024b40e0SFabiano Rosas                  &spr_read_tbu, SPR_NOACCESS,
237024b40e0SFabiano Rosas                  0x00000000);
238024b40e0SFabiano Rosas     spr_register(env, SPR_TBU,   "TBU",
239024b40e0SFabiano Rosas                  &spr_read_tbu, SPR_NOACCESS,
240024b40e0SFabiano Rosas                  &spr_read_tbu, &spr_write_tbu,
241024b40e0SFabiano Rosas                  0x00000000);
2423e770bf7SBruno Larsen (billionai) }
2433e770bf7SBruno Larsen (billionai) 
2443e770bf7SBruno Larsen (billionai) /* SPR common to all non-embedded PowerPC, including 601 */
2453e770bf7SBruno Larsen (billionai) static void register_ne_601_sprs(CPUPPCState *env)
2463e770bf7SBruno Larsen (billionai) {
2473e770bf7SBruno Larsen (billionai)     /* Exception processing */
2483e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DSISR, "DSISR",
2493e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
2503e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
2513e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DSISR, 0x00000000);
2523e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DAR, "DAR",
2533e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
2543e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
2553e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DAR, 0x00000000);
2563e770bf7SBruno Larsen (billionai)     /* Timer */
2573e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DECR, "DECR",
2583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2593e770bf7SBruno Larsen (billionai)                  &spr_read_decr, &spr_write_decr,
2603e770bf7SBruno Larsen (billionai)                  0x00000000);
2613e770bf7SBruno Larsen (billionai) }
2623e770bf7SBruno Larsen (billionai) 
2633e770bf7SBruno Larsen (billionai) /* Storage Description Register 1 */
2643e770bf7SBruno Larsen (billionai) static void register_sdr1_sprs(CPUPPCState *env)
2653e770bf7SBruno Larsen (billionai) {
2663e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
2673e770bf7SBruno Larsen (billionai)     if (env->has_hv_mode) {
2683e770bf7SBruno Larsen (billionai)         /*
2693e770bf7SBruno Larsen (billionai)          * SDR1 is a hypervisor resource on CPUs which have a
2703e770bf7SBruno Larsen (billionai)          * hypervisor mode
2713e770bf7SBruno Larsen (billionai)          */
2723e770bf7SBruno Larsen (billionai)         spr_register_hv(env, SPR_SDR1, "SDR1",
2733e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
2743e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
2753e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_sdr1,
2763e770bf7SBruno Larsen (billionai)                         0x00000000);
2773e770bf7SBruno Larsen (billionai)     } else {
2783e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_SDR1, "SDR1",
2793e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
2803e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_sdr1,
2813e770bf7SBruno Larsen (billionai)                      0x00000000);
2823e770bf7SBruno Larsen (billionai)     }
2833e770bf7SBruno Larsen (billionai) #endif
2843e770bf7SBruno Larsen (billionai) }
2853e770bf7SBruno Larsen (billionai) 
2863e770bf7SBruno Larsen (billionai) /* BATs 0-3 */
2873e770bf7SBruno Larsen (billionai) static void register_low_BATs(CPUPPCState *env)
2883e770bf7SBruno Larsen (billionai) {
2893e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
2903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT0U, "IBAT0U",
2913e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2923e770bf7SBruno Larsen (billionai)                  &spr_read_ibat, &spr_write_ibatu,
2933e770bf7SBruno Larsen (billionai)                  0x00000000);
2943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT0L, "IBAT0L",
2953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2963e770bf7SBruno Larsen (billionai)                  &spr_read_ibat, &spr_write_ibatl,
2973e770bf7SBruno Larsen (billionai)                  0x00000000);
2983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT1U, "IBAT1U",
2993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3003e770bf7SBruno Larsen (billionai)                  &spr_read_ibat, &spr_write_ibatu,
3013e770bf7SBruno Larsen (billionai)                  0x00000000);
3023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT1L, "IBAT1L",
3033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3043e770bf7SBruno Larsen (billionai)                  &spr_read_ibat, &spr_write_ibatl,
3053e770bf7SBruno Larsen (billionai)                  0x00000000);
3063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT2U, "IBAT2U",
3073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3083e770bf7SBruno Larsen (billionai)                  &spr_read_ibat, &spr_write_ibatu,
3093e770bf7SBruno Larsen (billionai)                  0x00000000);
3103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT2L, "IBAT2L",
3113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3123e770bf7SBruno Larsen (billionai)                  &spr_read_ibat, &spr_write_ibatl,
3133e770bf7SBruno Larsen (billionai)                  0x00000000);
3143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT3U, "IBAT3U",
3153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3163e770bf7SBruno Larsen (billionai)                  &spr_read_ibat, &spr_write_ibatu,
3173e770bf7SBruno Larsen (billionai)                  0x00000000);
3183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT3L, "IBAT3L",
3193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3203e770bf7SBruno Larsen (billionai)                  &spr_read_ibat, &spr_write_ibatl,
3213e770bf7SBruno Larsen (billionai)                  0x00000000);
3223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT0U, "DBAT0U",
3233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3243e770bf7SBruno Larsen (billionai)                  &spr_read_dbat, &spr_write_dbatu,
3253e770bf7SBruno Larsen (billionai)                  0x00000000);
3263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT0L, "DBAT0L",
3273e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3283e770bf7SBruno Larsen (billionai)                  &spr_read_dbat, &spr_write_dbatl,
3293e770bf7SBruno Larsen (billionai)                  0x00000000);
3303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT1U, "DBAT1U",
3313e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3323e770bf7SBruno Larsen (billionai)                  &spr_read_dbat, &spr_write_dbatu,
3333e770bf7SBruno Larsen (billionai)                  0x00000000);
3343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT1L, "DBAT1L",
3353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3363e770bf7SBruno Larsen (billionai)                  &spr_read_dbat, &spr_write_dbatl,
3373e770bf7SBruno Larsen (billionai)                  0x00000000);
3383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT2U, "DBAT2U",
3393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3403e770bf7SBruno Larsen (billionai)                  &spr_read_dbat, &spr_write_dbatu,
3413e770bf7SBruno Larsen (billionai)                  0x00000000);
3423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT2L, "DBAT2L",
3433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3443e770bf7SBruno Larsen (billionai)                  &spr_read_dbat, &spr_write_dbatl,
3453e770bf7SBruno Larsen (billionai)                  0x00000000);
3463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT3U, "DBAT3U",
3473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3483e770bf7SBruno Larsen (billionai)                  &spr_read_dbat, &spr_write_dbatu,
3493e770bf7SBruno Larsen (billionai)                  0x00000000);
3503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT3L, "DBAT3L",
3513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3523e770bf7SBruno Larsen (billionai)                  &spr_read_dbat, &spr_write_dbatl,
3533e770bf7SBruno Larsen (billionai)                  0x00000000);
3543e770bf7SBruno Larsen (billionai)     env->nb_BATs += 4;
3553e770bf7SBruno Larsen (billionai) #endif
3563e770bf7SBruno Larsen (billionai) }
3573e770bf7SBruno Larsen (billionai) 
3583e770bf7SBruno Larsen (billionai) /* BATs 4-7 */
3593e770bf7SBruno Larsen (billionai) static void register_high_BATs(CPUPPCState *env)
3603e770bf7SBruno Larsen (billionai) {
3613e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
3623e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT4U, "IBAT4U",
3633e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3643e770bf7SBruno Larsen (billionai)                  &spr_read_ibat_h, &spr_write_ibatu_h,
3653e770bf7SBruno Larsen (billionai)                  0x00000000);
3663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT4L, "IBAT4L",
3673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3683e770bf7SBruno Larsen (billionai)                  &spr_read_ibat_h, &spr_write_ibatl_h,
3693e770bf7SBruno Larsen (billionai)                  0x00000000);
3703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT5U, "IBAT5U",
3713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3723e770bf7SBruno Larsen (billionai)                  &spr_read_ibat_h, &spr_write_ibatu_h,
3733e770bf7SBruno Larsen (billionai)                  0x00000000);
3743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT5L, "IBAT5L",
3753e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3763e770bf7SBruno Larsen (billionai)                  &spr_read_ibat_h, &spr_write_ibatl_h,
3773e770bf7SBruno Larsen (billionai)                  0x00000000);
3783e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT6U, "IBAT6U",
3793e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3803e770bf7SBruno Larsen (billionai)                  &spr_read_ibat_h, &spr_write_ibatu_h,
3813e770bf7SBruno Larsen (billionai)                  0x00000000);
3823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT6L, "IBAT6L",
3833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3843e770bf7SBruno Larsen (billionai)                  &spr_read_ibat_h, &spr_write_ibatl_h,
3853e770bf7SBruno Larsen (billionai)                  0x00000000);
3863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT7U, "IBAT7U",
3873e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3883e770bf7SBruno Larsen (billionai)                  &spr_read_ibat_h, &spr_write_ibatu_h,
3893e770bf7SBruno Larsen (billionai)                  0x00000000);
3903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBAT7L, "IBAT7L",
3913e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3923e770bf7SBruno Larsen (billionai)                  &spr_read_ibat_h, &spr_write_ibatl_h,
3933e770bf7SBruno Larsen (billionai)                  0x00000000);
3943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT4U, "DBAT4U",
3953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3963e770bf7SBruno Larsen (billionai)                  &spr_read_dbat_h, &spr_write_dbatu_h,
3973e770bf7SBruno Larsen (billionai)                  0x00000000);
3983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT4L, "DBAT4L",
3993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4003e770bf7SBruno Larsen (billionai)                  &spr_read_dbat_h, &spr_write_dbatl_h,
4013e770bf7SBruno Larsen (billionai)                  0x00000000);
4023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT5U, "DBAT5U",
4033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4043e770bf7SBruno Larsen (billionai)                  &spr_read_dbat_h, &spr_write_dbatu_h,
4053e770bf7SBruno Larsen (billionai)                  0x00000000);
4063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT5L, "DBAT5L",
4073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4083e770bf7SBruno Larsen (billionai)                  &spr_read_dbat_h, &spr_write_dbatl_h,
4093e770bf7SBruno Larsen (billionai)                  0x00000000);
4103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT6U, "DBAT6U",
4113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4123e770bf7SBruno Larsen (billionai)                  &spr_read_dbat_h, &spr_write_dbatu_h,
4133e770bf7SBruno Larsen (billionai)                  0x00000000);
4143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT6L, "DBAT6L",
4153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4163e770bf7SBruno Larsen (billionai)                  &spr_read_dbat_h, &spr_write_dbatl_h,
4173e770bf7SBruno Larsen (billionai)                  0x00000000);
4183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT7U, "DBAT7U",
4193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4203e770bf7SBruno Larsen (billionai)                  &spr_read_dbat_h, &spr_write_dbatu_h,
4213e770bf7SBruno Larsen (billionai)                  0x00000000);
4223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBAT7L, "DBAT7L",
4233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4243e770bf7SBruno Larsen (billionai)                  &spr_read_dbat_h, &spr_write_dbatl_h,
4253e770bf7SBruno Larsen (billionai)                  0x00000000);
4263e770bf7SBruno Larsen (billionai)     env->nb_BATs += 4;
4273e770bf7SBruno Larsen (billionai) #endif
4283e770bf7SBruno Larsen (billionai) }
4293e770bf7SBruno Larsen (billionai) 
4303e770bf7SBruno Larsen (billionai) /* Softare table search registers */
4313e770bf7SBruno Larsen (billionai) static void register_6xx_7xx_soft_tlb(CPUPPCState *env, int nb_tlbs, int nb_ways)
4323e770bf7SBruno Larsen (billionai) {
4333e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
4343e770bf7SBruno Larsen (billionai)     env->nb_tlb = nb_tlbs;
4353e770bf7SBruno Larsen (billionai)     env->nb_ways = nb_ways;
4363e770bf7SBruno Larsen (billionai)     env->id_tlbs = 1;
4373e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_6XX;
4383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DMISS, "DMISS",
4393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
4413e770bf7SBruno Larsen (billionai)                  0x00000000);
4423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DCMP, "DCMP",
4433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
4453e770bf7SBruno Larsen (billionai)                  0x00000000);
4463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HASH1, "HASH1",
4473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
4493e770bf7SBruno Larsen (billionai)                  0x00000000);
4503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HASH2, "HASH2",
4513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
4533e770bf7SBruno Larsen (billionai)                  0x00000000);
4543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IMISS, "IMISS",
4553e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4563e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
4573e770bf7SBruno Larsen (billionai)                  0x00000000);
4583e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICMP, "ICMP",
4593e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4603e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
4613e770bf7SBruno Larsen (billionai)                  0x00000000);
4623e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RPA, "RPA",
4633e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4643e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4653e770bf7SBruno Larsen (billionai)                  0x00000000);
4663e770bf7SBruno Larsen (billionai) #endif
4673e770bf7SBruno Larsen (billionai) }
4683e770bf7SBruno Larsen (billionai) 
4693e770bf7SBruno Larsen (billionai) /* SPR common to MPC755 and G2 */
4703e770bf7SBruno Larsen (billionai) static void register_G2_755_sprs(CPUPPCState *env)
4713e770bf7SBruno Larsen (billionai) {
4723e770bf7SBruno Larsen (billionai)     /* SGPRs */
4733e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
4743e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4753e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4763e770bf7SBruno Larsen (billionai)                  0x00000000);
4773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
4783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4793e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4803e770bf7SBruno Larsen (billionai)                  0x00000000);
4813e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
4823e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4833e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4843e770bf7SBruno Larsen (billionai)                  0x00000000);
4853e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
4863e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4873e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4883e770bf7SBruno Larsen (billionai)                  0x00000000);
4893e770bf7SBruno Larsen (billionai) }
4903e770bf7SBruno Larsen (billionai) 
4913e770bf7SBruno Larsen (billionai) /* SPR common to all 7xx PowerPC implementations */
4923e770bf7SBruno Larsen (billionai) static void register_7xx_sprs(CPUPPCState *env)
4933e770bf7SBruno Larsen (billionai) {
4943e770bf7SBruno Larsen (billionai)     /* Breakpoints */
4953e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DABR, "DABR",
4963e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
4973e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
4983e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DABR, 0x00000000);
499acf629ebSFabiano Rosas 
5003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
5013e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5023e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5033e770bf7SBruno Larsen (billionai)                  0x00000000);
5043e770bf7SBruno Larsen (billionai)     /* Cache management */
5053e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTC, "ICTC",
5063e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5073e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5083e770bf7SBruno Larsen (billionai)                  0x00000000);
5093e770bf7SBruno Larsen (billionai)     /* Performance monitors */
5103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_MMCR0, "MMCR0",
5113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5133e770bf7SBruno Larsen (billionai)                  0x00000000);
514acf629ebSFabiano Rosas 
5153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_MMCR1, "MMCR1",
5163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5183e770bf7SBruno Larsen (billionai)                  0x00000000);
519acf629ebSFabiano Rosas 
5203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC1, "PMC1",
5213e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5223e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5233e770bf7SBruno Larsen (billionai)                  0x00000000);
524acf629ebSFabiano Rosas 
5253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC2, "PMC2",
5263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5283e770bf7SBruno Larsen (billionai)                  0x00000000);
529acf629ebSFabiano Rosas 
5303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC3, "PMC3",
5313e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5323e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5333e770bf7SBruno Larsen (billionai)                  0x00000000);
534acf629ebSFabiano Rosas 
5353e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC4, "PMC4",
5363e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5373e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5383e770bf7SBruno Larsen (billionai)                  0x00000000);
539acf629ebSFabiano Rosas 
5403e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_SIAR, "SIAR",
5413e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5423e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
5433e770bf7SBruno Larsen (billionai)                  0x00000000);
544acf629ebSFabiano Rosas 
5453e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UMMCR0, "UMMCR0",
5463e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5473e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5483e770bf7SBruno Larsen (billionai)                  0x00000000);
549acf629ebSFabiano Rosas 
5503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UMMCR1, "UMMCR1",
5513e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5523e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5533e770bf7SBruno Larsen (billionai)                  0x00000000);
554acf629ebSFabiano Rosas 
5553e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC1, "UPMC1",
5563e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5573e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5583e770bf7SBruno Larsen (billionai)                  0x00000000);
559acf629ebSFabiano Rosas 
5603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC2, "UPMC2",
5613e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5623e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5633e770bf7SBruno Larsen (billionai)                  0x00000000);
564acf629ebSFabiano Rosas 
5653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC3, "UPMC3",
5663e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5673e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5683e770bf7SBruno Larsen (billionai)                  0x00000000);
569acf629ebSFabiano Rosas 
5703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC4, "UPMC4",
5713e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5723e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5733e770bf7SBruno Larsen (billionai)                  0x00000000);
574acf629ebSFabiano Rosas 
5753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_USIAR, "USIAR",
5763e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5773e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5783e770bf7SBruno Larsen (billionai)                  0x00000000);
5793e770bf7SBruno Larsen (billionai)     /* External access control */
5803e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_EAR, "EAR",
5813e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5823e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5833e770bf7SBruno Larsen (billionai)                  0x00000000);
5843e770bf7SBruno Larsen (billionai) }
5853e770bf7SBruno Larsen (billionai) 
5863e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64
5873e770bf7SBruno Larsen (billionai) static void register_amr_sprs(CPUPPCState *env)
5883e770bf7SBruno Larsen (billionai) {
5893e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
5903e770bf7SBruno Larsen (billionai)     /*
5913e770bf7SBruno Larsen (billionai)      * Virtual Page Class Key protection
5923e770bf7SBruno Larsen (billionai)      *
5933e770bf7SBruno Larsen (billionai)      * The AMR is accessible either via SPR 13 or SPR 29.  13 is
5943e770bf7SBruno Larsen (billionai)      * userspace accessible, 29 is privileged.  So we only need to set
5953e770bf7SBruno Larsen (billionai)      * the kvm ONE_REG id on one of them, we use 29
5963e770bf7SBruno Larsen (billionai)      */
5973e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UAMR, "UAMR",
5983e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_amr,
5993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_amr,
6003e770bf7SBruno Larsen (billionai)                  0);
6013e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_AMR, "AMR",
6023e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
6033e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_amr,
6043e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
6053e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_AMR, 0);
6063e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_UAMOR, "UAMOR",
6073e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
6083e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_uamor,
6093e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
6103e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_UAMOR, 0);
6113e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_AMOR, "AMOR",
6123e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
6133e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
6143e770bf7SBruno Larsen (billionai)                     &spr_read_generic, &spr_write_generic,
6153e770bf7SBruno Larsen (billionai)                     0);
6163e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
6173e770bf7SBruno Larsen (billionai) }
6183e770bf7SBruno Larsen (billionai) 
6193e770bf7SBruno Larsen (billionai) static void register_iamr_sprs(CPUPPCState *env)
6203e770bf7SBruno Larsen (billionai) {
6213e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
6223e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_IAMR, "IAMR",
6233e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
6243e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_iamr,
6253e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_generic,
6263e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_IAMR, 0);
6273e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
6283e770bf7SBruno Larsen (billionai) }
6293e770bf7SBruno Larsen (billionai) #endif /* TARGET_PPC64 */
6303e770bf7SBruno Larsen (billionai) 
6313e770bf7SBruno Larsen (billionai) static void register_thrm_sprs(CPUPPCState *env)
6323e770bf7SBruno Larsen (billionai) {
6333e770bf7SBruno Larsen (billionai)     /* Thermal management */
6343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM1, "THRM1",
6353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6363e770bf7SBruno Larsen (billionai)                  &spr_read_thrm, &spr_write_generic,
6373e770bf7SBruno Larsen (billionai)                  0x00000000);
638acf629ebSFabiano Rosas 
6393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM2, "THRM2",
6403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6413e770bf7SBruno Larsen (billionai)                  &spr_read_thrm, &spr_write_generic,
6423e770bf7SBruno Larsen (billionai)                  0x00000000);
643acf629ebSFabiano Rosas 
6443e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM3, "THRM3",
6453e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6463e770bf7SBruno Larsen (billionai)                  &spr_read_thrm, &spr_write_generic,
6473e770bf7SBruno Larsen (billionai)                  0x00000000);
6483e770bf7SBruno Larsen (billionai) }
6493e770bf7SBruno Larsen (billionai) 
6503e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 604 implementation */
6513e770bf7SBruno Larsen (billionai) static void register_604_sprs(CPUPPCState *env)
6523e770bf7SBruno Larsen (billionai) {
6533e770bf7SBruno Larsen (billionai)     /* Processor identification */
6543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_PIR, "PIR",
6553e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6563e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
6573e770bf7SBruno Larsen (billionai)                  0x00000000);
6583e770bf7SBruno Larsen (billionai)     /* Breakpoints */
6593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
6603e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6613e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6623e770bf7SBruno Larsen (billionai)                  0x00000000);
663acf629ebSFabiano Rosas 
6643e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DABR, "DABR",
6653e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
6663e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
6673e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DABR, 0x00000000);
6683e770bf7SBruno Larsen (billionai)     /* Performance counters */
6693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_MMCR0, "MMCR0",
6703e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6713e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6723e770bf7SBruno Larsen (billionai)                  0x00000000);
673acf629ebSFabiano Rosas 
6743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC1, "PMC1",
6753e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6763e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6773e770bf7SBruno Larsen (billionai)                  0x00000000);
678acf629ebSFabiano Rosas 
6793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC2, "PMC2",
6803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6823e770bf7SBruno Larsen (billionai)                  0x00000000);
683acf629ebSFabiano Rosas 
6843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_SIAR, "SIAR",
6853e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6863e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
6873e770bf7SBruno Larsen (billionai)                  0x00000000);
688acf629ebSFabiano Rosas 
6893e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SDA, "SDA",
6903e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6913e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
6923e770bf7SBruno Larsen (billionai)                  0x00000000);
6933e770bf7SBruno Larsen (billionai)     /* External access control */
6943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_EAR, "EAR",
6953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6963e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6973e770bf7SBruno Larsen (billionai)                  0x00000000);
6983e770bf7SBruno Larsen (billionai) }
6993e770bf7SBruno Larsen (billionai) 
7003e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 603 implementation */
7013e770bf7SBruno Larsen (billionai) static void register_603_sprs(CPUPPCState *env)
7023e770bf7SBruno Larsen (billionai) {
7033e770bf7SBruno Larsen (billionai)     /* External access control */
7043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_EAR, "EAR",
7053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7073e770bf7SBruno Larsen (billionai)                  0x00000000);
7083e770bf7SBruno Larsen (billionai)     /* Breakpoints */
7093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
7103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7123e770bf7SBruno Larsen (billionai)                  0x00000000);
7133e770bf7SBruno Larsen (billionai) 
7143e770bf7SBruno Larsen (billionai) }
7153e770bf7SBruno Larsen (billionai) 
7163e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC G2 implementation */
7173e770bf7SBruno Larsen (billionai) static void register_G2_sprs(CPUPPCState *env)
7183e770bf7SBruno Larsen (billionai) {
7193e770bf7SBruno Larsen (billionai)     /* Memory base address */
7203e770bf7SBruno Larsen (billionai)     /* MBAR */
7213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MBAR, "MBAR",
7223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7243e770bf7SBruno Larsen (billionai)                  0x00000000);
7253e770bf7SBruno Larsen (billionai)     /* Exception processing */
7263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_CSRR0, "CSRR0",
7273e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7283e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7293e770bf7SBruno Larsen (billionai)                  0x00000000);
7303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_CSRR1, "CSRR1",
7313e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7323e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7333e770bf7SBruno Larsen (billionai)                  0x00000000);
7343e770bf7SBruno Larsen (billionai)     /* Breakpoints */
7353e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DABR, "DABR",
7363e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7373e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7383e770bf7SBruno Larsen (billionai)                  0x00000000);
739acf629ebSFabiano Rosas 
7403e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DABR2, "DABR2",
7413e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7423e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7433e770bf7SBruno Larsen (billionai)                  0x00000000);
744acf629ebSFabiano Rosas 
7453e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
7463e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7473e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7483e770bf7SBruno Larsen (billionai)                  0x00000000);
749acf629ebSFabiano Rosas 
7503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR2, "IABR2",
7513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7533e770bf7SBruno Larsen (billionai)                  0x00000000);
754acf629ebSFabiano Rosas 
7553e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBCR, "IBCR",
7563e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7573e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7583e770bf7SBruno Larsen (billionai)                  0x00000000);
759acf629ebSFabiano Rosas 
7603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBCR, "DBCR",
7613e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7623e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7633e770bf7SBruno Larsen (billionai)                  0x00000000);
764*e599bcedSFabiano Rosas 
765*e599bcedSFabiano Rosas     /* External access control */
766*e599bcedSFabiano Rosas     spr_register(env, SPR_EAR, "EAR",
767*e599bcedSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
768*e599bcedSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
769*e599bcedSFabiano Rosas                  0x00000000);
770*e599bcedSFabiano Rosas     /* Hardware implementation register */
771*e599bcedSFabiano Rosas     spr_register(env, SPR_HID0, "HID0",
772*e599bcedSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
773*e599bcedSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
774*e599bcedSFabiano Rosas                  0x00000000);
775*e599bcedSFabiano Rosas 
776*e599bcedSFabiano Rosas     spr_register(env, SPR_HID1, "HID1",
777*e599bcedSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
778*e599bcedSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
779*e599bcedSFabiano Rosas                  0x00000000);
780*e599bcedSFabiano Rosas 
781*e599bcedSFabiano Rosas     spr_register(env, SPR_HID2, "HID2",
782*e599bcedSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
783*e599bcedSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
784*e599bcedSFabiano Rosas                  0x00000000);
785*e599bcedSFabiano Rosas 
7863e770bf7SBruno Larsen (billionai) }
7873e770bf7SBruno Larsen (billionai) 
7883e770bf7SBruno Larsen (billionai) static void register_74xx_sprs(CPUPPCState *env)
7893e770bf7SBruno Larsen (billionai) {
7903e770bf7SBruno Larsen (billionai)     /* Processor identification */
7913e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_PIR, "PIR",
7923e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7933e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
7943e770bf7SBruno Larsen (billionai)                  0x00000000);
795acf629ebSFabiano Rosas 
7963e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_74XX_MMCR2, "MMCR2",
7973e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7983e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7993e770bf7SBruno Larsen (billionai)                  0x00000000);
800acf629ebSFabiano Rosas 
8013e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_74XX_UMMCR2, "UMMCR2",
8023e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8033e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8043e770bf7SBruno Larsen (billionai)                  0x00000000);
805acf629ebSFabiano Rosas 
8063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BAMR, "BAMR",
8073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8083e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8093e770bf7SBruno Larsen (billionai)                  0x00000000);
810acf629ebSFabiano Rosas 
8113e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSCR0, "MSSCR0",
8123e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8133e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8143e770bf7SBruno Larsen (billionai)                  0x00000000);
8153e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
8163e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
8173e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8183e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8193e770bf7SBruno Larsen (billionai)                  0x00000000);
820acf629ebSFabiano Rosas 
8213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
8223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8243e770bf7SBruno Larsen (billionai)                  0x00000000);
8253e770bf7SBruno Larsen (billionai)     /* Altivec */
8263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_VRSAVE, "VRSAVE",
8273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8283e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8293e770bf7SBruno Larsen (billionai)                  0x00000000);
830acf629ebSFabiano Rosas 
8313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
8323e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
8343e770bf7SBruno Larsen (billionai)                  0x00000000);
8353e770bf7SBruno Larsen (billionai) }
8363e770bf7SBruno Larsen (billionai) 
8373e770bf7SBruno Larsen (billionai) static void register_l3_ctrl(CPUPPCState *env)
8383e770bf7SBruno Larsen (billionai) {
8393e770bf7SBruno Larsen (billionai)     /* L3CR */
8403e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3CR, "L3CR",
8413e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8423e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8433e770bf7SBruno Larsen (billionai)                  0x00000000);
8443e770bf7SBruno Larsen (billionai)     /* L3ITCR0 */
8453e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR0, "L3ITCR0",
8463e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8473e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8483e770bf7SBruno Larsen (billionai)                  0x00000000);
8493e770bf7SBruno Larsen (billionai)     /* L3PM */
8503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3PM, "L3PM",
8513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8533e770bf7SBruno Larsen (billionai)                  0x00000000);
8543e770bf7SBruno Larsen (billionai) }
8553e770bf7SBruno Larsen (billionai) 
8563e770bf7SBruno Larsen (billionai) static void register_usprg3_sprs(CPUPPCState *env)
8573e770bf7SBruno Larsen (billionai) {
8583e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG3, "USPRG3",
8593e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8603e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8613e770bf7SBruno Larsen (billionai)                  0x00000000);
8623e770bf7SBruno Larsen (billionai) }
8633e770bf7SBruno Larsen (billionai) 
8643e770bf7SBruno Larsen (billionai) static void register_usprgh_sprs(CPUPPCState *env)
8653e770bf7SBruno Larsen (billionai) {
8663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
8673e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8683e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8693e770bf7SBruno Larsen (billionai)                  0x00000000);
8703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
8713e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8723e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8733e770bf7SBruno Larsen (billionai)                  0x00000000);
8743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
8753e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8763e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8773e770bf7SBruno Larsen (billionai)                  0x00000000);
8783e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
8793e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8803e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
8813e770bf7SBruno Larsen (billionai)                  0x00000000);
8823e770bf7SBruno Larsen (billionai) }
8833e770bf7SBruno Larsen (billionai) 
8843e770bf7SBruno Larsen (billionai) /* PowerPC BookE SPR */
8853e770bf7SBruno Larsen (billionai) static void register_BookE_sprs(CPUPPCState *env, uint64_t ivor_mask)
8863e770bf7SBruno Larsen (billionai) {
8873e770bf7SBruno Larsen (billionai)     const char *ivor_names[64] = {
8883e770bf7SBruno Larsen (billionai)         "IVOR0",  "IVOR1",  "IVOR2",  "IVOR3",
8893e770bf7SBruno Larsen (billionai)         "IVOR4",  "IVOR5",  "IVOR6",  "IVOR7",
8903e770bf7SBruno Larsen (billionai)         "IVOR8",  "IVOR9",  "IVOR10", "IVOR11",
8913e770bf7SBruno Larsen (billionai)         "IVOR12", "IVOR13", "IVOR14", "IVOR15",
8923e770bf7SBruno Larsen (billionai)         "IVOR16", "IVOR17", "IVOR18", "IVOR19",
8933e770bf7SBruno Larsen (billionai)         "IVOR20", "IVOR21", "IVOR22", "IVOR23",
8943e770bf7SBruno Larsen (billionai)         "IVOR24", "IVOR25", "IVOR26", "IVOR27",
8953e770bf7SBruno Larsen (billionai)         "IVOR28", "IVOR29", "IVOR30", "IVOR31",
8963e770bf7SBruno Larsen (billionai)         "IVOR32", "IVOR33", "IVOR34", "IVOR35",
8973e770bf7SBruno Larsen (billionai)         "IVOR36", "IVOR37", "IVOR38", "IVOR39",
8983e770bf7SBruno Larsen (billionai)         "IVOR40", "IVOR41", "IVOR42", "IVOR43",
8993e770bf7SBruno Larsen (billionai)         "IVOR44", "IVOR45", "IVOR46", "IVOR47",
9003e770bf7SBruno Larsen (billionai)         "IVOR48", "IVOR49", "IVOR50", "IVOR51",
9013e770bf7SBruno Larsen (billionai)         "IVOR52", "IVOR53", "IVOR54", "IVOR55",
9023e770bf7SBruno Larsen (billionai)         "IVOR56", "IVOR57", "IVOR58", "IVOR59",
9033e770bf7SBruno Larsen (billionai)         "IVOR60", "IVOR61", "IVOR62", "IVOR63",
9043e770bf7SBruno Larsen (billionai)     };
9053e770bf7SBruno Larsen (billionai) #define SPR_BOOKE_IVORxx (-1)
9063e770bf7SBruno Larsen (billionai)     int ivor_sprn[64] = {
9073e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR0,  SPR_BOOKE_IVOR1,  SPR_BOOKE_IVOR2,  SPR_BOOKE_IVOR3,
9083e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR4,  SPR_BOOKE_IVOR5,  SPR_BOOKE_IVOR6,  SPR_BOOKE_IVOR7,
9093e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR8,  SPR_BOOKE_IVOR9,  SPR_BOOKE_IVOR10, SPR_BOOKE_IVOR11,
9103e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR12, SPR_BOOKE_IVOR13, SPR_BOOKE_IVOR14, SPR_BOOKE_IVOR15,
9113e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9123e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9133e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9143e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9153e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR32, SPR_BOOKE_IVOR33, SPR_BOOKE_IVOR34, SPR_BOOKE_IVOR35,
9163e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR36, SPR_BOOKE_IVOR37, SPR_BOOKE_IVOR38, SPR_BOOKE_IVOR39,
9173e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR40, SPR_BOOKE_IVOR41, SPR_BOOKE_IVOR42, SPR_BOOKE_IVORxx,
9183e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9193e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9203e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9213e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9223e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
9233e770bf7SBruno Larsen (billionai)     };
9243e770bf7SBruno Larsen (billionai)     int i;
9253e770bf7SBruno Larsen (billionai) 
9263e770bf7SBruno Larsen (billionai)     /* Interrupt processing */
9273e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_CSRR0, "CSRR0",
9283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9293e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9303e770bf7SBruno Larsen (billionai)                  0x00000000);
9313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_CSRR1, "CSRR1",
9323e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9343e770bf7SBruno Larsen (billionai)                  0x00000000);
9353e770bf7SBruno Larsen (billionai)     /* Debug */
9363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC1, "IAC1",
9373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9383e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9393e770bf7SBruno Larsen (billionai)                  0x00000000);
940acf629ebSFabiano Rosas 
9413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC2, "IAC2",
9423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9443e770bf7SBruno Larsen (billionai)                  0x00000000);
945acf629ebSFabiano Rosas 
9463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DAC1, "DAC1",
9473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9493e770bf7SBruno Larsen (billionai)                  0x00000000);
950acf629ebSFabiano Rosas 
9513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DAC2, "DAC2",
9523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9543e770bf7SBruno Larsen (billionai)                  0x00000000);
955acf629ebSFabiano Rosas 
9563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DBCR0, "DBCR0",
9573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_40x_dbcr0,
9593e770bf7SBruno Larsen (billionai)                  0x00000000);
960acf629ebSFabiano Rosas 
9613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DBCR1, "DBCR1",
9623e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9633e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9643e770bf7SBruno Larsen (billionai)                  0x00000000);
965acf629ebSFabiano Rosas 
9663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DBCR2, "DBCR2",
9673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9683e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9693e770bf7SBruno Larsen (billionai)                  0x00000000);
9703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DSRR0, "DSRR0",
9713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9723e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9733e770bf7SBruno Larsen (billionai)                  0x00000000);
9743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DSRR1, "DSRR1",
9753e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9763e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9773e770bf7SBruno Larsen (billionai)                  0x00000000);
978acf629ebSFabiano Rosas 
9793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DBSR, "DBSR",
9803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_clear,
9823e770bf7SBruno Larsen (billionai)                  0x00000000);
9833e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DEAR, "DEAR",
9843e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9853e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9863e770bf7SBruno Larsen (billionai)                  0x00000000);
9873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ESR, "ESR",
9883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9903e770bf7SBruno Larsen (billionai)                  0x00000000);
9913e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IVPR, "IVPR",
9923e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9933e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_excp_prefix,
9943e770bf7SBruno Larsen (billionai)                  0x00000000);
9953e770bf7SBruno Larsen (billionai)     /* Exception vectors */
9963e770bf7SBruno Larsen (billionai)     for (i = 0; i < 64; i++) {
9973e770bf7SBruno Larsen (billionai)         if (ivor_mask & (1ULL << i)) {
9983e770bf7SBruno Larsen (billionai)             if (ivor_sprn[i] == SPR_BOOKE_IVORxx) {
9993e770bf7SBruno Larsen (billionai)                 fprintf(stderr, "ERROR: IVOR %d SPR is not defined\n", i);
10003e770bf7SBruno Larsen (billionai)                 exit(1);
10013e770bf7SBruno Larsen (billionai)             }
10023e770bf7SBruno Larsen (billionai)             spr_register(env, ivor_sprn[i], ivor_names[i],
10033e770bf7SBruno Larsen (billionai)                          SPR_NOACCESS, SPR_NOACCESS,
10043e770bf7SBruno Larsen (billionai)                          &spr_read_generic, &spr_write_excp_vector,
10053e770bf7SBruno Larsen (billionai)                          0x00000000);
10063e770bf7SBruno Larsen (billionai)         }
10073e770bf7SBruno Larsen (billionai)     }
10083e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_PID, "PID",
10093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_booke_pid,
10113e770bf7SBruno Larsen (billionai)                  0x00000000);
10123e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_TCR, "TCR",
10133e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10143e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_booke_tcr,
10153e770bf7SBruno Larsen (billionai)                  0x00000000);
10163e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_TSR, "TSR",
10173e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10183e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_booke_tsr,
10193e770bf7SBruno Larsen (billionai)                  0x00000000);
10203e770bf7SBruno Larsen (billionai)     /* Timer */
10213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DECR, "DECR",
10223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10233e770bf7SBruno Larsen (billionai)                  &spr_read_decr, &spr_write_decr,
10243e770bf7SBruno Larsen (billionai)                  0x00000000);
10253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DECAR, "DECAR",
10263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10273e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, &spr_write_generic,
10283e770bf7SBruno Larsen (billionai)                  0x00000000);
10293e770bf7SBruno Larsen (billionai)     /* SPRGs */
10303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG0, "USPRG0",
10313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10323e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10333e770bf7SBruno Larsen (billionai)                  0x00000000);
10343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
10353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10373e770bf7SBruno Larsen (billionai)                  0x00000000);
10383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
10393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10413e770bf7SBruno Larsen (billionai)                  0x00000000);
10423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
10433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10453e770bf7SBruno Larsen (billionai)                  0x00000000);
10463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
10473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10493e770bf7SBruno Larsen (billionai)                  0x00000000);
10503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_SPRG8, "SPRG8",
10513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10533e770bf7SBruno Larsen (billionai)                  0x00000000);
10543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_SPRG9, "SPRG9",
10553e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10563e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10573e770bf7SBruno Larsen (billionai)                  0x00000000);
10583e770bf7SBruno Larsen (billionai) }
10593e770bf7SBruno Larsen (billionai) 
10603e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
10613e770bf7SBruno Larsen (billionai) static inline uint32_t register_tlbncfg(uint32_t assoc, uint32_t minsize,
10623e770bf7SBruno Larsen (billionai)                                    uint32_t maxsize, uint32_t flags,
10633e770bf7SBruno Larsen (billionai)                                    uint32_t nentries)
10643e770bf7SBruno Larsen (billionai) {
10653e770bf7SBruno Larsen (billionai)     return (assoc << TLBnCFG_ASSOC_SHIFT) |
10663e770bf7SBruno Larsen (billionai)            (minsize << TLBnCFG_MINSIZE_SHIFT) |
10673e770bf7SBruno Larsen (billionai)            (maxsize << TLBnCFG_MAXSIZE_SHIFT) |
10683e770bf7SBruno Larsen (billionai)            flags | nentries;
10693e770bf7SBruno Larsen (billionai) }
10703e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
10713e770bf7SBruno Larsen (billionai) 
10723e770bf7SBruno Larsen (billionai) /* BookE 2.06 storage control registers */
10733e770bf7SBruno Larsen (billionai) static void register_BookE206_sprs(CPUPPCState *env, uint32_t mas_mask,
10743e770bf7SBruno Larsen (billionai)                              uint32_t *tlbncfg, uint32_t mmucfg)
10753e770bf7SBruno Larsen (billionai) {
10763e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
10773e770bf7SBruno Larsen (billionai)     const char *mas_names[8] = {
10783e770bf7SBruno Larsen (billionai)         "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
10793e770bf7SBruno Larsen (billionai)     };
10803e770bf7SBruno Larsen (billionai)     int mas_sprn[8] = {
10813e770bf7SBruno Larsen (billionai)         SPR_BOOKE_MAS0, SPR_BOOKE_MAS1, SPR_BOOKE_MAS2, SPR_BOOKE_MAS3,
10823e770bf7SBruno Larsen (billionai)         SPR_BOOKE_MAS4, SPR_BOOKE_MAS5, SPR_BOOKE_MAS6, SPR_BOOKE_MAS7,
10833e770bf7SBruno Larsen (billionai)     };
10843e770bf7SBruno Larsen (billionai)     int i;
10853e770bf7SBruno Larsen (billionai) 
10863e770bf7SBruno Larsen (billionai)     /* TLB assist registers */
10873e770bf7SBruno Larsen (billionai)     for (i = 0; i < 8; i++) {
10883e770bf7SBruno Larsen (billionai)         if (mas_mask & (1 << i)) {
10893e770bf7SBruno Larsen (billionai)             spr_register(env, mas_sprn[i], mas_names[i],
10903e770bf7SBruno Larsen (billionai)                          SPR_NOACCESS, SPR_NOACCESS,
109152e9612eSBruno Larsen (billionai)                          &spr_read_generic,
109252e9612eSBruno Larsen (billionai)                          (i == 2 && (env->insns_flags & PPC_64B))
109352e9612eSBruno Larsen (billionai)                          ? &spr_write_generic : &spr_write_generic32,
10943e770bf7SBruno Larsen (billionai)                          0x00000000);
10953e770bf7SBruno Larsen (billionai)         }
10963e770bf7SBruno Larsen (billionai)     }
10973e770bf7SBruno Larsen (billionai)     if (env->nb_pids > 1) {
10983e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_PID1, "PID1",
10993e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
11003e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_booke_pid,
11013e770bf7SBruno Larsen (billionai)                      0x00000000);
11023e770bf7SBruno Larsen (billionai)     }
11033e770bf7SBruno Larsen (billionai)     if (env->nb_pids > 2) {
11043e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_PID2, "PID2",
11053e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
11063e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_booke_pid,
11073e770bf7SBruno Larsen (billionai)                      0x00000000);
11083e770bf7SBruno Larsen (billionai)     }
11093e770bf7SBruno Larsen (billionai) 
11103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_EPLC, "EPLC",
11113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_eplc,
11133e770bf7SBruno Larsen (billionai)                  0x00000000);
11143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_EPSC, "EPSC",
11153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_epsc,
11173e770bf7SBruno Larsen (billionai)                  0x00000000);
11183e770bf7SBruno Larsen (billionai) 
11193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MMUCFG, "MMUCFG",
11203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
11223e770bf7SBruno Larsen (billionai)                  mmucfg);
11233e770bf7SBruno Larsen (billionai)     switch (env->nb_ways) {
11243e770bf7SBruno Larsen (billionai)     case 4:
11253e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB3CFG, "TLB3CFG",
11263e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
11273e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
11283e770bf7SBruno Larsen (billionai)                      tlbncfg[3]);
11293e770bf7SBruno Larsen (billionai)         /* Fallthru */
11303e770bf7SBruno Larsen (billionai)     case 3:
11313e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB2CFG, "TLB2CFG",
11323e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
11333e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
11343e770bf7SBruno Larsen (billionai)                      tlbncfg[2]);
11353e770bf7SBruno Larsen (billionai)         /* Fallthru */
11363e770bf7SBruno Larsen (billionai)     case 2:
11373e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
11383e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
11393e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
11403e770bf7SBruno Larsen (billionai)                      tlbncfg[1]);
11413e770bf7SBruno Larsen (billionai)         /* Fallthru */
11423e770bf7SBruno Larsen (billionai)     case 1:
11433e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
11443e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
11453e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
11463e770bf7SBruno Larsen (billionai)                      tlbncfg[0]);
11473e770bf7SBruno Larsen (billionai)         /* Fallthru */
11483e770bf7SBruno Larsen (billionai)     case 0:
11493e770bf7SBruno Larsen (billionai)     default:
11503e770bf7SBruno Larsen (billionai)         break;
11513e770bf7SBruno Larsen (billionai)     }
11523e770bf7SBruno Larsen (billionai) #endif
11533e770bf7SBruno Larsen (billionai) }
11543e770bf7SBruno Larsen (billionai) 
11553e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 440 implementation */
11563e770bf7SBruno Larsen (billionai) static void register_440_sprs(CPUPPCState *env)
11573e770bf7SBruno Larsen (billionai) {
11583e770bf7SBruno Larsen (billionai)     /* Cache control */
11593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DNV0, "DNV0",
11603e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11613e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11623e770bf7SBruno Larsen (billionai)                  0x00000000);
1163acf629ebSFabiano Rosas 
11643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DNV1, "DNV1",
11653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11673e770bf7SBruno Larsen (billionai)                  0x00000000);
1168acf629ebSFabiano Rosas 
11693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DNV2, "DNV2",
11703e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11713e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11723e770bf7SBruno Larsen (billionai)                  0x00000000);
1173acf629ebSFabiano Rosas 
11743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DNV3, "DNV3",
11753e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11763e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11773e770bf7SBruno Larsen (billionai)                  0x00000000);
1178acf629ebSFabiano Rosas 
11793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DTV0, "DTV0",
11803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11823e770bf7SBruno Larsen (billionai)                  0x00000000);
1183acf629ebSFabiano Rosas 
11843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DTV1, "DTV1",
11853e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11863e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11873e770bf7SBruno Larsen (billionai)                  0x00000000);
1188acf629ebSFabiano Rosas 
11893e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DTV2, "DTV2",
11903e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11913e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11923e770bf7SBruno Larsen (billionai)                  0x00000000);
1193acf629ebSFabiano Rosas 
11943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DTV3, "DTV3",
11953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11963e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11973e770bf7SBruno Larsen (billionai)                  0x00000000);
1198acf629ebSFabiano Rosas 
11993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DVLIM, "DVLIM",
12003e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12013e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12023e770bf7SBruno Larsen (billionai)                  0x00000000);
1203acf629ebSFabiano Rosas 
12043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_INV0, "INV0",
12053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12073e770bf7SBruno Larsen (billionai)                  0x00000000);
1208acf629ebSFabiano Rosas 
12093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_INV1, "INV1",
12103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12123e770bf7SBruno Larsen (billionai)                  0x00000000);
1213acf629ebSFabiano Rosas 
12143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_INV2, "INV2",
12153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12173e770bf7SBruno Larsen (billionai)                  0x00000000);
1218acf629ebSFabiano Rosas 
12193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_INV3, "INV3",
12203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12223e770bf7SBruno Larsen (billionai)                  0x00000000);
1223acf629ebSFabiano Rosas 
12243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_ITV0, "ITV0",
12253e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12263e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12273e770bf7SBruno Larsen (billionai)                  0x00000000);
1228acf629ebSFabiano Rosas 
12293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_ITV1, "ITV1",
12303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12323e770bf7SBruno Larsen (billionai)                  0x00000000);
1233acf629ebSFabiano Rosas 
12343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_ITV2, "ITV2",
12353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12373e770bf7SBruno Larsen (billionai)                  0x00000000);
1238acf629ebSFabiano Rosas 
12393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_ITV3, "ITV3",
12403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12413e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12423e770bf7SBruno Larsen (billionai)                  0x00000000);
1243acf629ebSFabiano Rosas 
12443e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_IVLIM, "IVLIM",
12453e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12463e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12473e770bf7SBruno Larsen (billionai)                  0x00000000);
12483e770bf7SBruno Larsen (billionai)     /* Cache debug */
12493e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DCDBTRH, "DCDBTRH",
12503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12513e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
12523e770bf7SBruno Larsen (billionai)                  0x00000000);
1253acf629ebSFabiano Rosas 
12543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DCDBTRL, "DCDBTRL",
12553e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12563e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
12573e770bf7SBruno Larsen (billionai)                  0x00000000);
1258acf629ebSFabiano Rosas 
12593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR",
12603e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12613e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
12623e770bf7SBruno Larsen (billionai)                  0x00000000);
1263acf629ebSFabiano Rosas 
12643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ICDBTRH, "ICDBTRH",
12653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
12673e770bf7SBruno Larsen (billionai)                  0x00000000);
1268acf629ebSFabiano Rosas 
12693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ICDBTRL, "ICDBTRL",
12703e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12713e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
12723e770bf7SBruno Larsen (billionai)                  0x00000000);
1273acf629ebSFabiano Rosas 
12743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DBDR, "DBDR",
12753e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12763e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12773e770bf7SBruno Larsen (billionai)                  0x00000000);
12783e770bf7SBruno Larsen (billionai)     /* Processor control */
12793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_4xx_CCR0, "CCR0",
12803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12823e770bf7SBruno Larsen (billionai)                  0x00000000);
12833e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_RSTCFG, "RSTCFG",
12843e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12853e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
12863e770bf7SBruno Larsen (billionai)                  0x00000000);
12873e770bf7SBruno Larsen (billionai)     /* Storage control */
12883e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_MMUCR, "MMUCR",
12893e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12903e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12913e770bf7SBruno Larsen (billionai)                  0x00000000);
12923e770bf7SBruno Larsen (billionai) }
12933e770bf7SBruno Larsen (billionai) 
12943e770bf7SBruno Larsen (billionai) /* SPR shared between PowerPC 40x implementations */
12953e770bf7SBruno Larsen (billionai) static void register_40x_sprs(CPUPPCState *env)
12963e770bf7SBruno Larsen (billionai) {
12973e770bf7SBruno Larsen (billionai)     /* Cache */
12983e770bf7SBruno Larsen (billionai)     /* not emulated, as QEMU do not emulate caches */
12993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DCCR, "DCCR",
13003e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13013e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13023e770bf7SBruno Larsen (billionai)                  0x00000000);
13033e770bf7SBruno Larsen (billionai)     /* not emulated, as QEMU do not emulate caches */
13043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_ICCR, "ICCR",
13053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13073e770bf7SBruno Larsen (billionai)                  0x00000000);
13083e770bf7SBruno Larsen (billionai)     /* not emulated, as QEMU do not emulate caches */
13093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR",
13103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
13123e770bf7SBruno Larsen (billionai)                  0x00000000);
13133e770bf7SBruno Larsen (billionai)     /* Exception */
13143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DEAR, "DEAR",
13153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13173e770bf7SBruno Larsen (billionai)                  0x00000000);
13183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_ESR, "ESR",
13193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13213e770bf7SBruno Larsen (billionai)                  0x00000000);
13223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_EVPR, "EVPR",
13233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13243e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_excp_prefix,
13253e770bf7SBruno Larsen (billionai)                  0x00000000);
13263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_SRR2, "SRR2",
13273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13283e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13293e770bf7SBruno Larsen (billionai)                  0x00000000);
13303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_SRR3, "SRR3",
13313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13323e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13333e770bf7SBruno Larsen (billionai)                  0x00000000);
13343e770bf7SBruno Larsen (billionai)     /* Timers */
13353e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_PIT, "PIT",
13363e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13373e770bf7SBruno Larsen (billionai)                  &spr_read_40x_pit, &spr_write_40x_pit,
13383e770bf7SBruno Larsen (billionai)                  0x00000000);
13393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_TCR, "TCR",
13403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1341cbd8f17dSCédric Le Goater                  &spr_read_generic, &spr_write_40x_tcr,
13423e770bf7SBruno Larsen (billionai)                  0x00000000);
13433e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_TSR, "TSR",
13443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1345cbd8f17dSCédric Le Goater                  &spr_read_generic, &spr_write_40x_tsr,
13463e770bf7SBruno Larsen (billionai)                  0x00000000);
13473e770bf7SBruno Larsen (billionai) }
13483e770bf7SBruno Larsen (billionai) 
13493e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 405 implementation */
13503e770bf7SBruno Larsen (billionai) static void register_405_sprs(CPUPPCState *env)
13513e770bf7SBruno Larsen (billionai) {
13523e770bf7SBruno Larsen (billionai)     /* MMU */
13533e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_PID, "PID",
13543e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1355dd69d140SCédric Le Goater                  &spr_read_generic, &spr_write_40x_pid,
13563e770bf7SBruno Larsen (billionai)                  0x00000000);
13573e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_4xx_CCR0, "CCR0",
13583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13593e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13603e770bf7SBruno Larsen (billionai)                  0x00700000);
13613e770bf7SBruno Larsen (billionai)     /* Debug interface */
13623e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DBCR0, "DBCR0",
13633e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13643e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_40x_dbcr0,
13653e770bf7SBruno Larsen (billionai)                  0x00000000);
1366acf629ebSFabiano Rosas 
13673e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_DBCR1, "DBCR1",
13683e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13693e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13703e770bf7SBruno Larsen (billionai)                  0x00000000);
1371acf629ebSFabiano Rosas 
13723e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DBSR, "DBSR",
13733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13743e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_clear,
13753e770bf7SBruno Larsen (billionai)                  /* Last reset was system reset */
13763e770bf7SBruno Larsen (billionai)                  0x00000300);
1377acf629ebSFabiano Rosas 
13783e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DAC1, "DAC1",
13793e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13803e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13813e770bf7SBruno Larsen (billionai)                  0x00000000);
13823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DAC2, "DAC2",
13833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13853e770bf7SBruno Larsen (billionai)                  0x00000000);
1386acf629ebSFabiano Rosas 
13873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_DVC1, "DVC1",
13883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13903e770bf7SBruno Larsen (billionai)                  0x00000000);
1391acf629ebSFabiano Rosas 
13923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_DVC2, "DVC2",
13933e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13943e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13953e770bf7SBruno Larsen (billionai)                  0x00000000);
1396acf629ebSFabiano Rosas 
13973e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_IAC1, "IAC1",
13983e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14003e770bf7SBruno Larsen (billionai)                  0x00000000);
14013e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_IAC2, "IAC2",
14023e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14033e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14043e770bf7SBruno Larsen (billionai)                  0x00000000);
1405acf629ebSFabiano Rosas 
14063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_IAC3, "IAC3",
14073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14083e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14093e770bf7SBruno Larsen (billionai)                  0x00000000);
1410acf629ebSFabiano Rosas 
14113e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_IAC4, "IAC4",
14123e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14133e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14143e770bf7SBruno Larsen (billionai)                  0x00000000);
14153e770bf7SBruno Larsen (billionai)     /* Storage control */
14163e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_SLER, "SLER",
14173e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14183e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_40x_sler,
14193e770bf7SBruno Larsen (billionai)                  0x00000000);
14203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_ZPR, "ZPR",
14213e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14223e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14233e770bf7SBruno Larsen (billionai)                  0x00000000);
1424acf629ebSFabiano Rosas 
14253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_SU0R, "SU0R",
14263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14283e770bf7SBruno Larsen (billionai)                  0x00000000);
14293e770bf7SBruno Larsen (billionai)     /* SPRG */
14303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG0, "USPRG0",
14313e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
14323e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
14333e770bf7SBruno Larsen (billionai)                  0x00000000);
14343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
14353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14373e770bf7SBruno Larsen (billionai)                  0x00000000);
14383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
14393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14403e770bf7SBruno Larsen (billionai)                  spr_read_generic, &spr_write_generic,
14413e770bf7SBruno Larsen (billionai)                  0x00000000);
14423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
14433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14443e770bf7SBruno Larsen (billionai)                  spr_read_generic, &spr_write_generic,
14453e770bf7SBruno Larsen (billionai)                  0x00000000);
14463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
14473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14483e770bf7SBruno Larsen (billionai)                  spr_read_generic, &spr_write_generic,
14493e770bf7SBruno Larsen (billionai)                  0x00000000);
1450acd1f788SFabiano Rosas 
1451acd1f788SFabiano Rosas     /* Bus access control */
1452acd1f788SFabiano Rosas     /* not emulated, as QEMU never does speculative access */
1453acd1f788SFabiano Rosas     spr_register(env, SPR_40x_SGR, "SGR",
1454acd1f788SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
1455acd1f788SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
1456acd1f788SFabiano Rosas                  0xFFFFFFFF);
1457acd1f788SFabiano Rosas     /* not emulated, as QEMU do not emulate caches */
1458acd1f788SFabiano Rosas     spr_register(env, SPR_40x_DCWR, "DCWR",
1459acd1f788SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
1460acd1f788SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
1461acd1f788SFabiano Rosas                  0x00000000);
14623e770bf7SBruno Larsen (billionai) }
14633e770bf7SBruno Larsen (billionai) 
14643e770bf7SBruno Larsen (billionai) 
14653e770bf7SBruno Larsen (billionai) static void register_5xx_8xx_sprs(CPUPPCState *env)
14663e770bf7SBruno Larsen (billionai) {
14673e770bf7SBruno Larsen (billionai)     /* Exception processing */
14683e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DSISR, "DSISR",
14693e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
14703e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
14713e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DSISR, 0x00000000);
14723e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DAR, "DAR",
14733e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
14743e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
14753e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DAR, 0x00000000);
14763e770bf7SBruno Larsen (billionai)     /* Timer */
14773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DECR, "DECR",
14783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14793e770bf7SBruno Larsen (billionai)                  &spr_read_decr, &spr_write_decr,
14803e770bf7SBruno Larsen (billionai)                  0x00000000);
1481acf629ebSFabiano Rosas 
14823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_EIE, "EIE",
14833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14853e770bf7SBruno Larsen (billionai)                  0x00000000);
1486acf629ebSFabiano Rosas 
14873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_EID, "EID",
14883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14903e770bf7SBruno Larsen (billionai)                  0x00000000);
1491acf629ebSFabiano Rosas 
14923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_NRI, "NRI",
14933e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14943e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14953e770bf7SBruno Larsen (billionai)                  0x00000000);
1496acf629ebSFabiano Rosas 
14973e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPA, "CMPA",
14983e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15003e770bf7SBruno Larsen (billionai)                  0x00000000);
1501acf629ebSFabiano Rosas 
15023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPB, "CMPB",
15033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15043e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15053e770bf7SBruno Larsen (billionai)                  0x00000000);
1506acf629ebSFabiano Rosas 
15073e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPC, "CMPC",
15083e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15093e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15103e770bf7SBruno Larsen (billionai)                  0x00000000);
1511acf629ebSFabiano Rosas 
15123e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPD, "CMPD",
15133e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15143e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15153e770bf7SBruno Larsen (billionai)                  0x00000000);
1516acf629ebSFabiano Rosas 
15173e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_ECR, "ECR",
15183e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15193e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15203e770bf7SBruno Larsen (billionai)                  0x00000000);
1521acf629ebSFabiano Rosas 
15223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_DER, "DER",
15233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15243e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15253e770bf7SBruno Larsen (billionai)                  0x00000000);
1526acf629ebSFabiano Rosas 
15273e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_COUNTA, "COUNTA",
15283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15293e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15303e770bf7SBruno Larsen (billionai)                  0x00000000);
1531acf629ebSFabiano Rosas 
15323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_COUNTB, "COUNTB",
15333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15343e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15353e770bf7SBruno Larsen (billionai)                  0x00000000);
1536acf629ebSFabiano Rosas 
15373e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPE, "CMPE",
15383e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15393e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15403e770bf7SBruno Larsen (billionai)                  0x00000000);
1541acf629ebSFabiano Rosas 
15423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPF, "CMPF",
15433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15453e770bf7SBruno Larsen (billionai)                  0x00000000);
1546acf629ebSFabiano Rosas 
15473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPG, "CMPG",
15483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15503e770bf7SBruno Larsen (billionai)                  0x00000000);
1551acf629ebSFabiano Rosas 
15523e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPH, "CMPH",
15533e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15543e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15553e770bf7SBruno Larsen (billionai)                  0x00000000);
1556acf629ebSFabiano Rosas 
15573e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_LCTRL1, "LCTRL1",
15583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15593e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15603e770bf7SBruno Larsen (billionai)                  0x00000000);
1561acf629ebSFabiano Rosas 
15623e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_LCTRL2, "LCTRL2",
15633e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15643e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15653e770bf7SBruno Larsen (billionai)                  0x00000000);
1566acf629ebSFabiano Rosas 
15673e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_BAR, "BAR",
15683e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15693e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15703e770bf7SBruno Larsen (billionai)                  0x00000000);
1571acf629ebSFabiano Rosas 
15723e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_DPDR, "DPDR",
15733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15743e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15753e770bf7SBruno Larsen (billionai)                  0x00000000);
1576acf629ebSFabiano Rosas 
15773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_IMMR, "IMMR",
15783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15793e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15803e770bf7SBruno Larsen (billionai)                  0x00000000);
15813e770bf7SBruno Larsen (billionai) }
15823e770bf7SBruno Larsen (billionai) 
15833e770bf7SBruno Larsen (billionai) static void register_5xx_sprs(CPUPPCState *env)
15843e770bf7SBruno Larsen (billionai) {
15853e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_GRA, "MI_GRA",
15863e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15873e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15883e770bf7SBruno Larsen (billionai)                  0x00000000);
1589acf629ebSFabiano Rosas 
15903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_GRA, "L2U_GRA",
15913e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15923e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15933e770bf7SBruno Larsen (billionai)                  0x00000000);
1594acf629ebSFabiano Rosas 
15953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RPCU_BBCMCR, "L2U_BBCMCR",
15963e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15973e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15983e770bf7SBruno Larsen (billionai)                  0x00000000);
1599acf629ebSFabiano Rosas 
16003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_MCR, "L2U_MCR",
16013e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16023e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16033e770bf7SBruno Larsen (billionai)                  0x00000000);
1604acf629ebSFabiano Rosas 
16053e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RBA0, "MI_RBA0",
16063e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16073e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16083e770bf7SBruno Larsen (billionai)                  0x00000000);
1609acf629ebSFabiano Rosas 
16103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RBA1, "MI_RBA1",
16113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16133e770bf7SBruno Larsen (billionai)                  0x00000000);
1614acf629ebSFabiano Rosas 
16153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RBA2, "MI_RBA2",
16163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16183e770bf7SBruno Larsen (billionai)                  0x00000000);
1619acf629ebSFabiano Rosas 
16203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RBA3, "MI_RBA3",
16213e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16223e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16233e770bf7SBruno Larsen (billionai)                  0x00000000);
1624acf629ebSFabiano Rosas 
16253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RBA0, "L2U_RBA0",
16263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16283e770bf7SBruno Larsen (billionai)                  0x00000000);
1629acf629ebSFabiano Rosas 
16303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RBA1, "L2U_RBA1",
16313e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16323e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16333e770bf7SBruno Larsen (billionai)                  0x00000000);
1634acf629ebSFabiano Rosas 
16353e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RBA2, "L2U_RBA2",
16363e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16373e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16383e770bf7SBruno Larsen (billionai)                  0x00000000);
1639acf629ebSFabiano Rosas 
16403e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RBA3, "L2U_RBA3",
16413e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16423e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16433e770bf7SBruno Larsen (billionai)                  0x00000000);
1644acf629ebSFabiano Rosas 
16453e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RA0, "MI_RA0",
16463e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16473e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16483e770bf7SBruno Larsen (billionai)                  0x00000000);
1649acf629ebSFabiano Rosas 
16503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RA1, "MI_RA1",
16513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16533e770bf7SBruno Larsen (billionai)                  0x00000000);
1654acf629ebSFabiano Rosas 
16553e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RA2, "MI_RA2",
16563e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16573e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16583e770bf7SBruno Larsen (billionai)                  0x00000000);
1659acf629ebSFabiano Rosas 
16603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RA3, "MI_RA3",
16613e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16623e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16633e770bf7SBruno Larsen (billionai)                  0x00000000);
1664acf629ebSFabiano Rosas 
16653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RA0, "L2U_RA0",
16663e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16673e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16683e770bf7SBruno Larsen (billionai)                  0x00000000);
1669acf629ebSFabiano Rosas 
16703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RA1, "L2U_RA1",
16713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16723e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16733e770bf7SBruno Larsen (billionai)                  0x00000000);
1674acf629ebSFabiano Rosas 
16753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RA2, "L2U_RA2",
16763e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16773e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16783e770bf7SBruno Larsen (billionai)                  0x00000000);
1679acf629ebSFabiano Rosas 
16803e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RA3, "L2U_RA3",
16813e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16823e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16833e770bf7SBruno Larsen (billionai)                  0x00000000);
1684acf629ebSFabiano Rosas 
16853e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_FPECR, "FPECR",
16863e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16873e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16883e770bf7SBruno Larsen (billionai)                  0x00000000);
16893e770bf7SBruno Larsen (billionai) }
16903e770bf7SBruno Larsen (billionai) 
16913e770bf7SBruno Larsen (billionai) static void register_8xx_sprs(CPUPPCState *env)
16923e770bf7SBruno Larsen (billionai) {
1693acf629ebSFabiano Rosas 
16943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_IC_CST, "IC_CST",
16953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16963e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16973e770bf7SBruno Larsen (billionai)                  0x00000000);
1698acf629ebSFabiano Rosas 
16993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_IC_ADR, "IC_ADR",
17003e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17013e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17023e770bf7SBruno Larsen (billionai)                  0x00000000);
1703acf629ebSFabiano Rosas 
17043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_IC_DAT, "IC_DAT",
17053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17073e770bf7SBruno Larsen (billionai)                  0x00000000);
1708acf629ebSFabiano Rosas 
17093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_DC_CST, "DC_CST",
17103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17123e770bf7SBruno Larsen (billionai)                  0x00000000);
1713acf629ebSFabiano Rosas 
17143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_DC_ADR, "DC_ADR",
17153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17173e770bf7SBruno Larsen (billionai)                  0x00000000);
1718acf629ebSFabiano Rosas 
17193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_DC_DAT, "DC_DAT",
17203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17223e770bf7SBruno Larsen (billionai)                  0x00000000);
1723acf629ebSFabiano Rosas 
17243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MI_CTR, "MI_CTR",
17253e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17263e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17273e770bf7SBruno Larsen (billionai)                  0x00000000);
1728acf629ebSFabiano Rosas 
17293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MI_AP, "MI_AP",
17303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17323e770bf7SBruno Larsen (billionai)                  0x00000000);
1733acf629ebSFabiano Rosas 
17343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MI_EPN, "MI_EPN",
17353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17373e770bf7SBruno Larsen (billionai)                  0x00000000);
1738acf629ebSFabiano Rosas 
17393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MI_TWC, "MI_TWC",
17403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17413e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17423e770bf7SBruno Larsen (billionai)                  0x00000000);
1743acf629ebSFabiano Rosas 
17443e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MI_RPN, "MI_RPN",
17453e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17463e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17473e770bf7SBruno Larsen (billionai)                  0x00000000);
1748acf629ebSFabiano Rosas 
17493e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MI_DBCAM, "MI_DBCAM",
17503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17513e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17523e770bf7SBruno Larsen (billionai)                  0x00000000);
1753acf629ebSFabiano Rosas 
17543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MI_DBRAM0, "MI_DBRAM0",
17553e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17563e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17573e770bf7SBruno Larsen (billionai)                  0x00000000);
1758acf629ebSFabiano Rosas 
17593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MI_DBRAM1, "MI_DBRAM1",
17603e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17613e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17623e770bf7SBruno Larsen (billionai)                  0x00000000);
1763acf629ebSFabiano Rosas 
17643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_CTR, "MD_CTR",
17653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17673e770bf7SBruno Larsen (billionai)                  0x00000000);
1768acf629ebSFabiano Rosas 
17693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_CASID, "MD_CASID",
17703e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17713e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17723e770bf7SBruno Larsen (billionai)                  0x00000000);
1773acf629ebSFabiano Rosas 
17743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_AP, "MD_AP",
17753e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17763e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17773e770bf7SBruno Larsen (billionai)                  0x00000000);
1778acf629ebSFabiano Rosas 
17793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_EPN, "MD_EPN",
17803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17823e770bf7SBruno Larsen (billionai)                  0x00000000);
1783acf629ebSFabiano Rosas 
17843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_TWB, "MD_TWB",
17853e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17863e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17873e770bf7SBruno Larsen (billionai)                  0x00000000);
1788acf629ebSFabiano Rosas 
17893e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_TWC, "MD_TWC",
17903e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17913e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17923e770bf7SBruno Larsen (billionai)                  0x00000000);
1793acf629ebSFabiano Rosas 
17943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_RPN, "MD_RPN",
17953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
17963e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
17973e770bf7SBruno Larsen (billionai)                  0x00000000);
1798acf629ebSFabiano Rosas 
17993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_TW, "MD_TW",
18003e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
18013e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
18023e770bf7SBruno Larsen (billionai)                  0x00000000);
1803acf629ebSFabiano Rosas 
18043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_DBCAM, "MD_DBCAM",
18053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
18063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
18073e770bf7SBruno Larsen (billionai)                  0x00000000);
1808acf629ebSFabiano Rosas 
18093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_DBRAM0, "MD_DBRAM0",
18103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
18113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
18123e770bf7SBruno Larsen (billionai)                  0x00000000);
1813acf629ebSFabiano Rosas 
18143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_DBRAM1, "MD_DBRAM1",
18153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
18163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
18173e770bf7SBruno Larsen (billionai)                  0x00000000);
18183e770bf7SBruno Larsen (billionai) }
18193e770bf7SBruno Larsen (billionai) 
18203e770bf7SBruno Larsen (billionai) /*
18213e770bf7SBruno Larsen (billionai)  * AMR     => SPR 29 (Power 2.04)
18223e770bf7SBruno Larsen (billionai)  * CTRL    => SPR 136 (Power 2.04)
18233e770bf7SBruno Larsen (billionai)  * CTRL    => SPR 152 (Power 2.04)
18243e770bf7SBruno Larsen (billionai)  * SCOMC   => SPR 276 (64 bits ?)
18253e770bf7SBruno Larsen (billionai)  * SCOMD   => SPR 277 (64 bits ?)
18263e770bf7SBruno Larsen (billionai)  * TBU40   => SPR 286 (Power 2.04 hypv)
18273e770bf7SBruno Larsen (billionai)  * HSPRG0  => SPR 304 (Power 2.04 hypv)
18283e770bf7SBruno Larsen (billionai)  * HSPRG1  => SPR 305 (Power 2.04 hypv)
18293e770bf7SBruno Larsen (billionai)  * HDSISR  => SPR 306 (Power 2.04 hypv)
18303e770bf7SBruno Larsen (billionai)  * HDAR    => SPR 307 (Power 2.04 hypv)
18313e770bf7SBruno Larsen (billionai)  * PURR    => SPR 309 (Power 2.04 hypv)
18323e770bf7SBruno Larsen (billionai)  * HDEC    => SPR 310 (Power 2.04 hypv)
18333e770bf7SBruno Larsen (billionai)  * HIOR    => SPR 311 (hypv)
18343e770bf7SBruno Larsen (billionai)  * RMOR    => SPR 312 (970)
18353e770bf7SBruno Larsen (billionai)  * HRMOR   => SPR 313 (Power 2.04 hypv)
18363e770bf7SBruno Larsen (billionai)  * HSRR0   => SPR 314 (Power 2.04 hypv)
18373e770bf7SBruno Larsen (billionai)  * HSRR1   => SPR 315 (Power 2.04 hypv)
18383e770bf7SBruno Larsen (billionai)  * LPIDR   => SPR 317 (970)
18393e770bf7SBruno Larsen (billionai)  * EPR     => SPR 702 (Power 2.04 emb)
18403e770bf7SBruno Larsen (billionai)  * perf    => 768-783 (Power 2.04)
18413e770bf7SBruno Larsen (billionai)  * perf    => 784-799 (Power 2.04)
18423e770bf7SBruno Larsen (billionai)  * PPR     => SPR 896 (Power 2.04)
18433e770bf7SBruno Larsen (billionai)  * DABRX   => 1015    (Power 2.04 hypv)
18443e770bf7SBruno Larsen (billionai)  * FPECR   => SPR 1022 (?)
18453e770bf7SBruno Larsen (billionai)  * ... and more (thermal management, performance counters, ...)
18463e770bf7SBruno Larsen (billionai)  */
18473e770bf7SBruno Larsen (billionai) 
18483e770bf7SBruno Larsen (billionai) /*****************************************************************************/
18493e770bf7SBruno Larsen (billionai) /* Exception vectors models                                                  */
18503e770bf7SBruno Larsen (billionai) static void init_excp_4xx_softmmu(CPUPPCState *env)
18513e770bf7SBruno Larsen (billionai) {
18523e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
18533e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
18543e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
18553e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
18563e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
18573e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
18583e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
18593e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
18603e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
18613e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PIT]      = 0x00001000;
18623e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00001010;
18633e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00001020;
18643e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00001100;
18653e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00001200;
18663e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00002000;
18673e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF0UL;
18683e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0xFFFF0000UL;
18693e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
18703e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0xFFFFFFFCUL;
18713e770bf7SBruno Larsen (billionai) #endif
18723e770bf7SBruno Larsen (billionai) }
18733e770bf7SBruno Larsen (billionai) 
18743e770bf7SBruno Larsen (billionai) static void init_excp_MPC5xx(CPUPPCState *env)
18753e770bf7SBruno Larsen (billionai) {
18763e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
18773e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
18783e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
18793e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
18803e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
18813e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
18826328a3bbSFabiano Rosas     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
18833e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
18843e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
18853e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
18863e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPA]      = 0x00000E00;
18873e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EMUL]     = 0x00001000;
18883e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DABR]     = 0x00001C00;
18893e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001C00;
18903e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MEXTBR]   = 0x00001E00;
18913e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_NMEXTBR]  = 0x00001F00;
18923e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF0UL;
18933e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0xFFFF0000UL;
18943e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
18953e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
18963e770bf7SBruno Larsen (billionai) #endif
18973e770bf7SBruno Larsen (billionai) }
18983e770bf7SBruno Larsen (billionai) 
18993e770bf7SBruno Larsen (billionai) static void init_excp_MPC8xx(CPUPPCState *env)
19003e770bf7SBruno Larsen (billionai) {
19013e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
19023e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
19033e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
19043e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
19053e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
19063e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
19073e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
19083e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
19096328a3bbSFabiano Rosas     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
19103e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
19113e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
19123e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
19133e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPA]      = 0x00000E00;
19143e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EMUL]     = 0x00001000;
19153e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00001100;
19163e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00001200;
19173e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLBE]    = 0x00001300;
19183e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLBE]    = 0x00001400;
19193e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DABR]     = 0x00001C00;
19203e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001C00;
19213e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MEXTBR]   = 0x00001E00;
19223e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_NMEXTBR]  = 0x00001F00;
19233e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF0UL;
19243e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0xFFFF0000UL;
19253e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
19263e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
19273e770bf7SBruno Larsen (billionai) #endif
19283e770bf7SBruno Larsen (billionai) }
19293e770bf7SBruno Larsen (billionai) 
19303e770bf7SBruno Larsen (billionai) static void init_excp_G2(CPUPPCState *env)
19313e770bf7SBruno Larsen (billionai) {
19323e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
19333e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
19343e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
19353e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
19363e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
19373e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
19383e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
19393e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
19403e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
19413e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
19423e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000A00;
19433e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
19443e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
19453e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
19463e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
19473e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
19483e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
19493e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
19503e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
19513e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
19523e770bf7SBruno Larsen (billionai) #endif
19533e770bf7SBruno Larsen (billionai) }
19543e770bf7SBruno Larsen (billionai) 
19553e770bf7SBruno Larsen (billionai) static void init_excp_e200(CPUPPCState *env, target_ulong ivpr_mask)
19563e770bf7SBruno Larsen (billionai) {
19573e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
19583e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000FFC;
19593e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000;
19603e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000000;
19613e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000000;
19623e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000000;
19633e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000;
19643e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000000;
19653e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000000;
19663e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000000;
19673e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000000;
19683e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_APU]      = 0x00000000;
19693e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000000;
19703e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00000000;
19713e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00000000;
19723e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00000000;
19733e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00000000;
19743e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00000000;
19757fc1dc83SFabiano Rosas     /*
19767fc1dc83SFabiano Rosas      * These two are the same IVOR as POWERPC_EXCP_VPU and
19777fc1dc83SFabiano Rosas      * POWERPC_EXCP_VPUA. We deal with that when dispatching at
19787fc1dc83SFabiano Rosas      * powerpc_excp().
19797fc1dc83SFabiano Rosas      */
19803e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SPEU]     = 0x00000000;
19813e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EFPDI]    = 0x00000000;
19827fc1dc83SFabiano Rosas 
19833e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EFPRI]    = 0x00000000;
19843e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF7UL;
19853e770bf7SBruno Larsen (billionai)     env->ivpr_mask = ivpr_mask;
19863e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
19873e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0xFFFFFFFCUL;
19883e770bf7SBruno Larsen (billionai) #endif
19893e770bf7SBruno Larsen (billionai) }
19903e770bf7SBruno Larsen (billionai) 
19913e770bf7SBruno Larsen (billionai) static void init_excp_BookE(CPUPPCState *env)
19923e770bf7SBruno Larsen (billionai) {
19933e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
19943e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000;
19953e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000000;
19963e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000000;
19973e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000000;
19983e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000;
19993e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000000;
20003e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000000;
20013e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000000;
20023e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000000;
20033e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_APU]      = 0x00000000;
20043e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000000;
20053e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00000000;
20063e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00000000;
20073e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00000000;
20083e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00000000;
20093e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00000000;
20103e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF0UL;
20113e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0xFFFF0000UL;
20123e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
20133e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0xFFFFFFFCUL;
20143e770bf7SBruno Larsen (billionai) #endif
20153e770bf7SBruno Larsen (billionai) }
20163e770bf7SBruno Larsen (billionai) 
20173e770bf7SBruno Larsen (billionai) static void init_excp_603(CPUPPCState *env)
20183e770bf7SBruno Larsen (billionai) {
20193e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
20203e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
20213e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
20223e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
20233e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
20243e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
20253e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
20263e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
20273e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
20283e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
20293e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
20303e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
20313e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
20323e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
20333e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
20343e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
20353e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
20363e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
20373e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
20383e770bf7SBruno Larsen (billionai) #endif
20393e770bf7SBruno Larsen (billionai) }
20403e770bf7SBruno Larsen (billionai) 
20413e770bf7SBruno Larsen (billionai) static void init_excp_604(CPUPPCState *env)
20423e770bf7SBruno Larsen (billionai) {
20433e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
20443e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
20453e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
20463e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
20473e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
20483e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
20493e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
20503e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
20513e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
20523e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
20533e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
20543e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
20553e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
20563e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
20573e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
20583e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
20593e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
20603e770bf7SBruno Larsen (billionai) #endif
20613e770bf7SBruno Larsen (billionai) }
20623e770bf7SBruno Larsen (billionai) 
20633e770bf7SBruno Larsen (billionai) static void init_excp_7x0(CPUPPCState *env)
20643e770bf7SBruno Larsen (billionai) {
20653e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
20663e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
20673e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
20683e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
20693e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
20703e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
20713e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
20723e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
20733e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
20743e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
20753e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
20763e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
20773e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
20783e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
20793e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
20803e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
20813e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
20823e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
20833e770bf7SBruno Larsen (billionai) #endif
20843e770bf7SBruno Larsen (billionai) }
20853e770bf7SBruno Larsen (billionai) 
20863e770bf7SBruno Larsen (billionai) static void init_excp_750cl(CPUPPCState *env)
20873e770bf7SBruno Larsen (billionai) {
20883e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
20893e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
20903e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
20913e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
20923e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
20933e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
20943e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
20953e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
20963e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
20973e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
20983e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
20993e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
21003e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
21013e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
21023e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
21033e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
21043e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
21053e770bf7SBruno Larsen (billionai) #endif
21063e770bf7SBruno Larsen (billionai) }
21073e770bf7SBruno Larsen (billionai) 
21083e770bf7SBruno Larsen (billionai) static void init_excp_750cx(CPUPPCState *env)
21093e770bf7SBruno Larsen (billionai) {
21103e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
21113e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
21123e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
21133e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
21143e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
21153e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
21163e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
21173e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
21183e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
21193e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
21203e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
21213e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
21223e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
21233e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
21243e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
21253e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
21263e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
21273e770bf7SBruno Larsen (billionai) #endif
21283e770bf7SBruno Larsen (billionai) }
21293e770bf7SBruno Larsen (billionai) 
21303e770bf7SBruno Larsen (billionai) /* XXX: Check if this is correct */
21313e770bf7SBruno Larsen (billionai) static void init_excp_7x5(CPUPPCState *env)
21323e770bf7SBruno Larsen (billionai) {
21333e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
21343e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
21353e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
21363e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
21373e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
21383e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
21393e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
21403e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
21413e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
21423e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
21433e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
21443e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
21453e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
21463e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
21473e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
21483e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
21493e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
21503e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
21513e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
21523e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
21533e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
21543e770bf7SBruno Larsen (billionai) #endif
21553e770bf7SBruno Larsen (billionai) }
21563e770bf7SBruno Larsen (billionai) 
21573e770bf7SBruno Larsen (billionai) static void init_excp_7400(CPUPPCState *env)
21583e770bf7SBruno Larsen (billionai) {
21593e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
21603e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
21613e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
21623e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
21633e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
21643e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
21653e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
21663e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
21673e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
21683e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
21693e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
21703e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
21713e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
21723e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
21733e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
21743e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
21753e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001600;
21763e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
21773e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
21783e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
21793e770bf7SBruno Larsen (billionai) #endif
21803e770bf7SBruno Larsen (billionai) }
21813e770bf7SBruno Larsen (billionai) 
21823e770bf7SBruno Larsen (billionai) static void init_excp_7450(CPUPPCState *env)
21833e770bf7SBruno Larsen (billionai) {
21843e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
21853e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
21863e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
21873e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
21883e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
21893e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
21903e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
21913e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
21923e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
21933e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
21943e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
21953e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
21963e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
21973e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
21983e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
21993e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
22003e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001600;
22013e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
22023e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
22033e770bf7SBruno Larsen (billionai) #endif
22043e770bf7SBruno Larsen (billionai) }
22053e770bf7SBruno Larsen (billionai) 
22063e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
22073e770bf7SBruno Larsen (billionai) static void init_excp_970(CPUPPCState *env)
22083e770bf7SBruno Larsen (billionai) {
22093e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
22103e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
22113e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
22123e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
22133e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSEG]     = 0x00000380;
22143e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
22153e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISEG]     = 0x00000480;
22163e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
22173e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
22183e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
22193e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
22203e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
22213e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HDECR]    = 0x00000980;
22223e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
22233e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
22243e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
22253e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
22263e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
22273e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MAINT]    = 0x00001600;
22283e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001700;
22293e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001800;
22303e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
22313e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x0000000000000100ULL;
22323e770bf7SBruno Larsen (billionai) #endif
22333e770bf7SBruno Larsen (billionai) }
22343e770bf7SBruno Larsen (billionai) 
22353e770bf7SBruno Larsen (billionai) static void init_excp_POWER7(CPUPPCState *env)
22363e770bf7SBruno Larsen (billionai) {
22373e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
22383e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
22393e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
22403e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
22413e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSEG]     = 0x00000380;
22423e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
22433e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISEG]     = 0x00000480;
22443e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
22453e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
22463e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
22473e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
22483e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
22493e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HDECR]    = 0x00000980;
22503e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
22513e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
22523e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HDSI]     = 0x00000E00;
22533e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HISI]     = 0x00000E20;
22543e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HV_EMU]   = 0x00000E40;
22553e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HV_MAINT] = 0x00000E60;
22563e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
22573e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
22583e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VSXU]     = 0x00000F40;
22593e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
22603e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x0000000000000100ULL;
22613e770bf7SBruno Larsen (billionai) #endif
22623e770bf7SBruno Larsen (billionai) }
22633e770bf7SBruno Larsen (billionai) 
22643e770bf7SBruno Larsen (billionai) static void init_excp_POWER8(CPUPPCState *env)
22653e770bf7SBruno Larsen (billionai) {
22663e770bf7SBruno Larsen (billionai)     init_excp_POWER7(env);
22673e770bf7SBruno Larsen (billionai) 
22683e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
22693e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SDOOR]    = 0x00000A00;
22703e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FU]       = 0x00000F60;
22713e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HV_FU]    = 0x00000F80;
22723e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SDOOR_HV] = 0x00000E80;
22733e770bf7SBruno Larsen (billionai) #endif
22743e770bf7SBruno Larsen (billionai) }
22753e770bf7SBruno Larsen (billionai) 
22763e770bf7SBruno Larsen (billionai) static void init_excp_POWER9(CPUPPCState *env)
22773e770bf7SBruno Larsen (billionai) {
22783e770bf7SBruno Larsen (billionai)     init_excp_POWER8(env);
22793e770bf7SBruno Larsen (billionai) 
22803e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
22813e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HVIRT]    = 0x00000EA0;
22823e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL_VECTORED] = 0x00017000;
22833e770bf7SBruno Larsen (billionai) #endif
22843e770bf7SBruno Larsen (billionai) }
22853e770bf7SBruno Larsen (billionai) 
22863e770bf7SBruno Larsen (billionai) static void init_excp_POWER10(CPUPPCState *env)
22873e770bf7SBruno Larsen (billionai) {
22883e770bf7SBruno Larsen (billionai)     init_excp_POWER9(env);
22893e770bf7SBruno Larsen (billionai) }
22903e770bf7SBruno Larsen (billionai) 
22913e770bf7SBruno Larsen (billionai) #endif
22923e770bf7SBruno Larsen (billionai) 
22933e770bf7SBruno Larsen (billionai) /*****************************************************************************/
22943e770bf7SBruno Larsen (billionai) /* Power management enable checks                                            */
22953e770bf7SBruno Larsen (billionai) static int check_pow_none(CPUPPCState *env)
22963e770bf7SBruno Larsen (billionai) {
22973e770bf7SBruno Larsen (billionai)     return 0;
22983e770bf7SBruno Larsen (billionai) }
22993e770bf7SBruno Larsen (billionai) 
23003e770bf7SBruno Larsen (billionai) static int check_pow_nocheck(CPUPPCState *env)
23013e770bf7SBruno Larsen (billionai) {
23023e770bf7SBruno Larsen (billionai)     return 1;
23033e770bf7SBruno Larsen (billionai) }
23043e770bf7SBruno Larsen (billionai) 
23053e770bf7SBruno Larsen (billionai) static int check_pow_hid0(CPUPPCState *env)
23063e770bf7SBruno Larsen (billionai) {
23073e770bf7SBruno Larsen (billionai)     if (env->spr[SPR_HID0] & 0x00E00000) {
23083e770bf7SBruno Larsen (billionai)         return 1;
23093e770bf7SBruno Larsen (billionai)     }
23103e770bf7SBruno Larsen (billionai) 
23113e770bf7SBruno Larsen (billionai)     return 0;
23123e770bf7SBruno Larsen (billionai) }
23133e770bf7SBruno Larsen (billionai) 
23143e770bf7SBruno Larsen (billionai) static int check_pow_hid0_74xx(CPUPPCState *env)
23153e770bf7SBruno Larsen (billionai) {
23163e770bf7SBruno Larsen (billionai)     if (env->spr[SPR_HID0] & 0x00600000) {
23173e770bf7SBruno Larsen (billionai)         return 1;
23183e770bf7SBruno Larsen (billionai)     }
23193e770bf7SBruno Larsen (billionai) 
23203e770bf7SBruno Larsen (billionai)     return 0;
23213e770bf7SBruno Larsen (billionai) }
23223e770bf7SBruno Larsen (billionai) 
23233e770bf7SBruno Larsen (billionai) /*****************************************************************************/
23243e770bf7SBruno Larsen (billionai) /* PowerPC implementations definitions                                       */
23253e770bf7SBruno Larsen (billionai) 
23263e770bf7SBruno Larsen (billionai) #define POWERPC_FAMILY(_name)                                               \
23273e770bf7SBruno Larsen (billionai)     static void                                                             \
23283e770bf7SBruno Larsen (billionai)     glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
23293e770bf7SBruno Larsen (billionai)                                                                             \
23303e770bf7SBruno Larsen (billionai)     static const TypeInfo                                                   \
23313e770bf7SBruno Larsen (billionai)     glue(glue(ppc_, _name), _cpu_family_type_info) = {                      \
23323e770bf7SBruno Larsen (billionai)         .name = stringify(_name) "-family-" TYPE_POWERPC_CPU,               \
23333e770bf7SBruno Larsen (billionai)         .parent = TYPE_POWERPC_CPU,                                         \
23343e770bf7SBruno Larsen (billionai)         .abstract = true,                                                   \
23353e770bf7SBruno Larsen (billionai)         .class_init = glue(glue(ppc_, _name), _cpu_family_class_init),      \
23363e770bf7SBruno Larsen (billionai)     };                                                                      \
23373e770bf7SBruno Larsen (billionai)                                                                             \
23383e770bf7SBruno Larsen (billionai)     static void glue(glue(ppc_, _name), _cpu_family_register_types)(void)   \
23393e770bf7SBruno Larsen (billionai)     {                                                                       \
23403e770bf7SBruno Larsen (billionai)         type_register_static(                                               \
23413e770bf7SBruno Larsen (billionai)             &glue(glue(ppc_, _name), _cpu_family_type_info));               \
23423e770bf7SBruno Larsen (billionai)     }                                                                       \
23433e770bf7SBruno Larsen (billionai)                                                                             \
23443e770bf7SBruno Larsen (billionai)     type_init(glue(glue(ppc_, _name), _cpu_family_register_types))          \
23453e770bf7SBruno Larsen (billionai)                                                                             \
23463e770bf7SBruno Larsen (billionai)     static void glue(glue(ppc_, _name), _cpu_family_class_init)
23473e770bf7SBruno Larsen (billionai) 
23483e770bf7SBruno Larsen (billionai) static void init_proc_405(CPUPPCState *env)
23493e770bf7SBruno Larsen (billionai) {
23503e770bf7SBruno Larsen (billionai)     register_40x_sprs(env);
23513e770bf7SBruno Larsen (billionai)     register_405_sprs(env);
23524ffb8c5eSFabiano Rosas     register_usprgh_sprs(env);
2353acd1f788SFabiano Rosas 
23543e770bf7SBruno Larsen (billionai)     /* Memory management */
23553e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
23563e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
23573e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
23583e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
23593e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
23603e770bf7SBruno Larsen (billionai) #endif
23613e770bf7SBruno Larsen (billionai)     init_excp_4xx_softmmu(env);
23623e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
23633e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
23643e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
23653e770bf7SBruno Larsen (billionai)     ppc40x_irq_init(env_archcpu(env));
23663e770bf7SBruno Larsen (billionai) 
23673e770bf7SBruno Larsen (billionai)     SET_FIT_PERIOD(8, 12, 16, 20);
23683e770bf7SBruno Larsen (billionai)     SET_WDT_PERIOD(16, 20, 24, 28);
23693e770bf7SBruno Larsen (billionai) }
23703e770bf7SBruno Larsen (billionai) 
23713e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(405)(ObjectClass *oc, void *data)
23723e770bf7SBruno Larsen (billionai) {
23733e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
23743e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
23753e770bf7SBruno Larsen (billionai) 
23763e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 405";
23773e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_405;
23783e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
23793e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
23803e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_WRTEE |
23813e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT |
23823e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
23833e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
23843e770bf7SBruno Larsen (billionai)                        PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC |
23853e770bf7SBruno Larsen (billionai)                        PPC_4xx_COMMON | PPC_405_MAC | PPC_40x_EXCP;
2386645d843cSFabiano Rosas     pcc->msr_mask = (1ull << MSR_WE) |
23873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
23883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
23893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
23903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
2391301e5d48SFabiano Rosas                     (1ull << MSR_ME) |
23923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
23933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
23943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
23953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
23963e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_4xx;
23973e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_40x;
23983e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_405;
23993e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
24003e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
24013e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
24023e770bf7SBruno Larsen (billionai) }
24033e770bf7SBruno Larsen (billionai) 
24043e770bf7SBruno Larsen (billionai) static void init_proc_440EP(CPUPPCState *env)
24053e770bf7SBruno Larsen (billionai) {
24063e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, 0x000000000000FFFFULL);
24073e770bf7SBruno Larsen (billionai)     register_440_sprs(env);
24083e770bf7SBruno Larsen (billionai)     register_usprgh_sprs(env);
24093e770bf7SBruno Larsen (billionai)     /* Processor identification */
24103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_PIR, "PIR",
24113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
24133e770bf7SBruno Larsen (billionai)                  0x00000000);
2414acf629ebSFabiano Rosas 
24153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
24163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
24183e770bf7SBruno Larsen (billionai)                  0x00000000);
2419acf629ebSFabiano Rosas 
24203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
24213e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24223e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
24233e770bf7SBruno Larsen (billionai)                  0x00000000);
2424acf629ebSFabiano Rosas 
24253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
24263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
24283e770bf7SBruno Larsen (billionai)                  0x00000000);
2429acf629ebSFabiano Rosas 
24303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
24313e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24323e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
24333e770bf7SBruno Larsen (billionai)                  0x00000000);
2434acf629ebSFabiano Rosas 
24353e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
24363e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24373e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
24383e770bf7SBruno Larsen (billionai)                  0x00000000);
24393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
24403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24413e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
24423e770bf7SBruno Larsen (billionai)                  0x00000000);
24433e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
24443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
24463e770bf7SBruno Larsen (billionai)                  0x00000000);
2447acf629ebSFabiano Rosas 
24483e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_CCR1, "CCR1",
24493e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
24503e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
24513e770bf7SBruno Larsen (billionai)                  0x00000000);
24523e770bf7SBruno Larsen (billionai)     /* Memory management */
24533e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
24543e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
24553e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
24563e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
24573e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
24583e770bf7SBruno Larsen (billionai) #endif
24593e770bf7SBruno Larsen (billionai)     init_excp_BookE(env);
24603e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
24613e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
24623e770bf7SBruno Larsen (billionai)     ppc40x_irq_init(env_archcpu(env));
24633e770bf7SBruno Larsen (billionai) 
24643e770bf7SBruno Larsen (billionai)     SET_FIT_PERIOD(12, 16, 20, 24);
24653e770bf7SBruno Larsen (billionai)     SET_WDT_PERIOD(20, 24, 28, 32);
24663e770bf7SBruno Larsen (billionai) }
24673e770bf7SBruno Larsen (billionai) 
24683e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440EP)(ObjectClass *oc, void *data)
24693e770bf7SBruno Larsen (billionai) {
24703e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
24713e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
24723e770bf7SBruno Larsen (billionai) 
24733e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 440 EP";
24743e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440EP;
24753e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
24763e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
24773e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL |
24783e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
24793e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
24803e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_WRTEE | PPC_RFMCI |
24813e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
24823e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
24833e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_MFTB |
24843e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
24853e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
24863e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
24873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
24883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
24893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
24903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
24913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
24923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
24933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
24943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
24953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
24963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
24973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
24983e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
24993e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
25003e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
25013e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
25023e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
25033e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
25043e770bf7SBruno Larsen (billionai) }
25053e770bf7SBruno Larsen (billionai) 
25063e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(460EX)(ObjectClass *oc, void *data)
25073e770bf7SBruno Larsen (billionai) {
25083e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
25093e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
25103e770bf7SBruno Larsen (billionai) 
25113e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 460 EX";
25123e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440EP;
25133e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
25143e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
25153e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL |
25163e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
25173e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
25183e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_RFMCI |
25193e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
25203e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
25213e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_MFTB |
25223e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
25233e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
25243e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
25253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
25263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
25273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
25283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
25293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
25303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
25313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
25323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
25333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
25343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
25353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
25363e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
25373e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
25383e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
25393e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
25403e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
25413e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
25423e770bf7SBruno Larsen (billionai) }
25433e770bf7SBruno Larsen (billionai) 
25443e770bf7SBruno Larsen (billionai) static void init_proc_440GP(CPUPPCState *env)
25453e770bf7SBruno Larsen (billionai) {
25463e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, 0x000000000000FFFFULL);
25473e770bf7SBruno Larsen (billionai)     register_440_sprs(env);
25483e770bf7SBruno Larsen (billionai)     register_usprgh_sprs(env);
25493e770bf7SBruno Larsen (billionai)     /* Processor identification */
25503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_PIR, "PIR",
25513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
25523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
25533e770bf7SBruno Larsen (billionai)                  0x00000000);
2554acf629ebSFabiano Rosas 
25553e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
25563e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
25573e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
25583e770bf7SBruno Larsen (billionai)                  0x00000000);
2559acf629ebSFabiano Rosas 
25603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
25613e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
25623e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
25633e770bf7SBruno Larsen (billionai)                  0x00000000);
2564acf629ebSFabiano Rosas 
25653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
25663e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
25673e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
25683e770bf7SBruno Larsen (billionai)                  0x00000000);
2569acf629ebSFabiano Rosas 
25703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
25713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
25723e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
25733e770bf7SBruno Larsen (billionai)                  0x00000000);
25743e770bf7SBruno Larsen (billionai)     /* Memory management */
25753e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
25763e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
25773e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
25783e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
25793e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
25803e770bf7SBruno Larsen (billionai) #endif
25813e770bf7SBruno Larsen (billionai)     init_excp_BookE(env);
25823e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
25833e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
25843e770bf7SBruno Larsen (billionai)     /* XXX: TODO: allocate internal IRQ controller */
25853e770bf7SBruno Larsen (billionai) 
25863e770bf7SBruno Larsen (billionai)     SET_FIT_PERIOD(12, 16, 20, 24);
25873e770bf7SBruno Larsen (billionai)     SET_WDT_PERIOD(20, 24, 28, 32);
25883e770bf7SBruno Larsen (billionai) }
25893e770bf7SBruno Larsen (billionai) 
25903e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440GP)(ObjectClass *oc, void *data)
25913e770bf7SBruno Larsen (billionai) {
25923e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
25933e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
25943e770bf7SBruno Larsen (billionai) 
25953e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 440 GP";
25963e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440GP;
25973e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
25983e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
25993e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_MFAPIDI |
26003e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
26013e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
26023e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVA | PPC_MFTB |
26033e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
26043e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
26053e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
26063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
26073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
26083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
26093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
26103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
26113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
26123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
26133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
26143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
26153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
26163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
26173e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
26183e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
26193e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
26203e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
26213e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
26223e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
26233e770bf7SBruno Larsen (billionai) }
26243e770bf7SBruno Larsen (billionai) 
26253e770bf7SBruno Larsen (billionai) static void init_proc_440x5(CPUPPCState *env)
26263e770bf7SBruno Larsen (billionai) {
26273e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, 0x000000000000FFFFULL);
26283e770bf7SBruno Larsen (billionai)     register_440_sprs(env);
26293e770bf7SBruno Larsen (billionai)     register_usprgh_sprs(env);
26303e770bf7SBruno Larsen (billionai)     /* Processor identification */
26313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_PIR, "PIR",
26323e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
26343e770bf7SBruno Larsen (billionai)                  0x00000000);
2635acf629ebSFabiano Rosas 
26363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
26373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26383e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26393e770bf7SBruno Larsen (billionai)                  0x00000000);
2640acf629ebSFabiano Rosas 
26413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
26423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26443e770bf7SBruno Larsen (billionai)                  0x00000000);
2645acf629ebSFabiano Rosas 
26463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
26473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26493e770bf7SBruno Larsen (billionai)                  0x00000000);
2650acf629ebSFabiano Rosas 
26513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
26523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26543e770bf7SBruno Larsen (billionai)                  0x00000000);
2655acf629ebSFabiano Rosas 
26563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
26573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26593e770bf7SBruno Larsen (billionai)                  0x00000000);
26603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
26613e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26623e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26633e770bf7SBruno Larsen (billionai)                  0x00000000);
26643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
26653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26673e770bf7SBruno Larsen (billionai)                  0x00000000);
2668acf629ebSFabiano Rosas 
26693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_CCR1, "CCR1",
26703e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26713e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26723e770bf7SBruno Larsen (billionai)                  0x00000000);
26733e770bf7SBruno Larsen (billionai)     /* Memory management */
26743e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
26753e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
26763e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
26773e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
26783e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
26793e770bf7SBruno Larsen (billionai) #endif
26803e770bf7SBruno Larsen (billionai)     init_excp_BookE(env);
26813e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
26823e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
26833e770bf7SBruno Larsen (billionai)     ppc40x_irq_init(env_archcpu(env));
26843e770bf7SBruno Larsen (billionai) 
26853e770bf7SBruno Larsen (billionai)     SET_FIT_PERIOD(12, 16, 20, 24);
26863e770bf7SBruno Larsen (billionai)     SET_WDT_PERIOD(20, 24, 28, 32);
26873e770bf7SBruno Larsen (billionai) }
26883e770bf7SBruno Larsen (billionai) 
26893e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440x5)(ObjectClass *oc, void *data)
26903e770bf7SBruno Larsen (billionai) {
26913e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
26923e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
26933e770bf7SBruno Larsen (billionai) 
26943e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 440x5";
26953e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440x5;
26963e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
26973e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
26983e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_WRTEE | PPC_RFMCI |
26993e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
27003e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
27013e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_MFTB |
27023e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
27033e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
27043e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
27053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
27063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
27073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
27083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
27093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
27103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
27113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
27123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
27133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
27143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
27153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
27163e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
27173e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
27183e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
27193e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
27203e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
27213e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
27223e770bf7SBruno Larsen (billionai) }
27233e770bf7SBruno Larsen (billionai) 
27243e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440x5wDFPU)(ObjectClass *oc, void *data)
27253e770bf7SBruno Larsen (billionai) {
27263e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
27273e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
27283e770bf7SBruno Larsen (billionai) 
27293e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 440x5 with double precision FPU";
27303e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440x5;
27313e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
27323e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
27333e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSQRT |
27343e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
27353e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_WRTEE | PPC_RFMCI |
27363e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
27373e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
27383e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_MFTB |
27393e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
27403e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
27413e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_FP_CVT_S64;
27423e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
27433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
27443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
27453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
27463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
27473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
27483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
27493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
27503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
27513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
27523e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
27533e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
27543e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
27553e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
27563e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
27573e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
27583e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
27593e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
27603e770bf7SBruno Larsen (billionai) }
27613e770bf7SBruno Larsen (billionai) 
27623e770bf7SBruno Larsen (billionai) static void init_proc_MPC5xx(CPUPPCState *env)
27633e770bf7SBruno Larsen (billionai) {
27643e770bf7SBruno Larsen (billionai)     register_5xx_8xx_sprs(env);
27653e770bf7SBruno Larsen (billionai)     register_5xx_sprs(env);
27663e770bf7SBruno Larsen (billionai)     init_excp_MPC5xx(env);
27673e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
27683e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
27693e770bf7SBruno Larsen (billionai)     /* XXX: TODO: allocate internal IRQ controller */
27703e770bf7SBruno Larsen (billionai) }
27713e770bf7SBruno Larsen (billionai) 
27723e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(MPC5xx)(ObjectClass *oc, void *data)
27733e770bf7SBruno Larsen (billionai) {
27743e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
27753e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
27763e770bf7SBruno Larsen (billionai) 
27773e770bf7SBruno Larsen (billionai)     dc->desc = "Freescale 5xx cores (aka RCPU)";
27783e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_MPC5xx;
27793e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
27803e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
27813e770bf7SBruno Larsen (billionai)                        PPC_MEM_EIEIO | PPC_MEM_SYNC |
27823e770bf7SBruno Larsen (billionai)                        PPC_CACHE_ICBI | PPC_FLOAT | PPC_FLOAT_STFIWX |
27833e770bf7SBruno Larsen (billionai)                        PPC_MFTB;
27843e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_ILE) |
27853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
27863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
27873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
27883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
27893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
27903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
27913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
27923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
27933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
27943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
27953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
27963e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_REAL;
27979323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
27983e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_RCPU;
27993e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_505;
28003e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
28013e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
28023e770bf7SBruno Larsen (billionai) }
28033e770bf7SBruno Larsen (billionai) 
28043e770bf7SBruno Larsen (billionai) static void init_proc_MPC8xx(CPUPPCState *env)
28053e770bf7SBruno Larsen (billionai) {
28063e770bf7SBruno Larsen (billionai)     register_5xx_8xx_sprs(env);
28073e770bf7SBruno Larsen (billionai)     register_8xx_sprs(env);
28083e770bf7SBruno Larsen (billionai)     init_excp_MPC8xx(env);
28093e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
28103e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
28113e770bf7SBruno Larsen (billionai)     /* XXX: TODO: allocate internal IRQ controller */
28123e770bf7SBruno Larsen (billionai) }
28133e770bf7SBruno Larsen (billionai) 
28143e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(MPC8xx)(ObjectClass *oc, void *data)
28153e770bf7SBruno Larsen (billionai) {
28163e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
28173e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
28183e770bf7SBruno Larsen (billionai) 
28193e770bf7SBruno Larsen (billionai)     dc->desc = "Freescale 8xx cores (aka PowerQUICC)";
28203e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_MPC8xx;
28213e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
28223e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING  |
28233e770bf7SBruno Larsen (billionai)                        PPC_MEM_EIEIO | PPC_MEM_SYNC |
28243e770bf7SBruno Larsen (billionai)                        PPC_CACHE_ICBI | PPC_MFTB;
28253e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_ILE) |
28263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
28273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
28283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
28293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
28303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
28313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
28323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
28333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
28343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
28353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
28363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
28373e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_MPC8xx;
28389323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
28393e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_RCPU;
28403e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_860;
28413e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
28423e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
28433e770bf7SBruno Larsen (billionai) }
28443e770bf7SBruno Larsen (billionai) 
28453e770bf7SBruno Larsen (billionai) /* Freescale 82xx cores (aka PowerQUICC-II)                                  */
28463e770bf7SBruno Larsen (billionai) 
28473e770bf7SBruno Larsen (billionai) static void init_proc_G2(CPUPPCState *env)
28483e770bf7SBruno Larsen (billionai) {
28493e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
28503e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
28513e770bf7SBruno Larsen (billionai)     register_G2_755_sprs(env);
28523e770bf7SBruno Larsen (billionai)     register_G2_sprs(env);
2853acf629ebSFabiano Rosas 
28543e770bf7SBruno Larsen (billionai)     /* Memory management */
28553e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
28563e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
28573e770bf7SBruno Larsen (billionai)     register_6xx_7xx_soft_tlb(env, 64, 2);
28583e770bf7SBruno Larsen (billionai)     init_excp_G2(env);
28593e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
28603e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
28613e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
28623e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
28633e770bf7SBruno Larsen (billionai) }
28643e770bf7SBruno Larsen (billionai) 
28653e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(G2)(ObjectClass *oc, void *data)
28663e770bf7SBruno Larsen (billionai) {
28673e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
28683e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
28693e770bf7SBruno Larsen (billionai) 
28703e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC G2";
28713e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_G2;
28723e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
28733e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
28743e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
28753e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
28763e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
28773e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
28783e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
28793e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
28803e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
28813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
28823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
28833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
28843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
28853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
28863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
28873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
28883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
28893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
28903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_AL) |
28913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
28923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
28933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
28943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
28953e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
28969323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
28973e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
28983e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_ec603e;
28993e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
29003e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
29013e770bf7SBruno Larsen (billionai) }
29023e770bf7SBruno Larsen (billionai) 
29033e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(G2LE)(ObjectClass *oc, void *data)
29043e770bf7SBruno Larsen (billionai) {
29053e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
29063e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
29073e770bf7SBruno Larsen (billionai) 
29083e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC G2LE";
2909363bd7d0SFabiano Rosas     pcc->init_proc = init_proc_G2;
29103e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
29113e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
29123e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
29133e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
29143e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
29153e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
29163e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
29173e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
29183e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
29193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
29203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
29213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
29223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
29233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
29243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
29253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
29263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
29273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
29283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
29293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_AL) |
29303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
29313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
29323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
29333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
29343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
29353e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
29369323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
29373e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
29383e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_ec603e;
29393e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
29403e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
29413e770bf7SBruno Larsen (billionai) }
29423e770bf7SBruno Larsen (billionai) 
29433e770bf7SBruno Larsen (billionai) static void init_proc_e200(CPUPPCState *env)
29443e770bf7SBruno Larsen (billionai) {
29453e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, 0x000000070000FFFFULL);
2946acf629ebSFabiano Rosas 
29473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
29483e770bf7SBruno Larsen (billionai)                  &spr_read_spefscr, &spr_write_spefscr,
29493e770bf7SBruno Larsen (billionai)                  &spr_read_spefscr, &spr_write_spefscr,
29503e770bf7SBruno Larsen (billionai)                  0x00000000);
29513e770bf7SBruno Larsen (billionai)     /* Memory management */
29523e770bf7SBruno Larsen (billionai)     register_BookE206_sprs(env, 0x0000005D, NULL, 0);
29534ffb8c5eSFabiano Rosas     register_usprgh_sprs(env);
2954acf629ebSFabiano Rosas 
29553e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
29563e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29573e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29583e770bf7SBruno Larsen (billionai)                  0x00000000);
2959acf629ebSFabiano Rosas 
29603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
29613e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29623e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29633e770bf7SBruno Larsen (billionai)                  0x00000000);
2964acf629ebSFabiano Rosas 
29653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_ALTCTXCR, "ALTCTXCR",
29663e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29673e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29683e770bf7SBruno Larsen (billionai)                  0x00000000);
2969acf629ebSFabiano Rosas 
29703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_BUCSR, "BUCSR",
29713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29723e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29733e770bf7SBruno Larsen (billionai)                  0x00000000);
2974acf629ebSFabiano Rosas 
29753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_CTXCR, "CTXCR",
29763e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29773e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29783e770bf7SBruno Larsen (billionai)                  0x00000000);
2979acf629ebSFabiano Rosas 
29803e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_DBCNT, "DBCNT",
29813e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29823e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29833e770bf7SBruno Larsen (billionai)                  0x00000000);
2984acf629ebSFabiano Rosas 
29853e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_DBCR3, "DBCR3",
29863e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29873e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29883e770bf7SBruno Larsen (billionai)                  0x00000000);
2989acf629ebSFabiano Rosas 
29903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0",
29913e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
29923e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
29933e770bf7SBruno Larsen (billionai)                  0x00000000);
2994acf629ebSFabiano Rosas 
29953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0",
29963e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29973e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29983e770bf7SBruno Larsen (billionai)                  0x00000000);
2999acf629ebSFabiano Rosas 
30003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1FINV0, "L1FINV0",
30013e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
30023e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
30033e770bf7SBruno Larsen (billionai)                  0x00000000);
3004acf629ebSFabiano Rosas 
30053e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
30063e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
30073e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
30083e770bf7SBruno Larsen (billionai)                  0x00000000);
3009acf629ebSFabiano Rosas 
30103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
30113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
30123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
30133e770bf7SBruno Larsen (billionai)                  0x00000000);
3014acf629ebSFabiano Rosas 
30153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
30163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
30173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
30183e770bf7SBruno Larsen (billionai)                  0x00000000);
3019acf629ebSFabiano Rosas 
30203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
30213e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
30223e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
30233e770bf7SBruno Larsen (billionai)                  0x00000000);
3024acf629ebSFabiano Rosas 
30253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
30263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
30273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
30283e770bf7SBruno Larsen (billionai)                  0x00000000); /* TOFIX */
30293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DSRR0, "DSRR0",
30303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
30313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
30323e770bf7SBruno Larsen (billionai)                  0x00000000);
30333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DSRR1, "DSRR1",
30343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
30353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
30363e770bf7SBruno Larsen (billionai)                  0x00000000);
30373e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
30383e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
30393e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
30403e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
30413e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
30423e770bf7SBruno Larsen (billionai) #endif
30433e770bf7SBruno Larsen (billionai)     init_excp_e200(env, 0xFFFF0000UL);
30443e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
30453e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
30463e770bf7SBruno Larsen (billionai)     /* XXX: TODO: allocate internal IRQ controller */
30473e770bf7SBruno Larsen (billionai) }
30483e770bf7SBruno Larsen (billionai) 
30493e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e200)(ObjectClass *oc, void *data)
30503e770bf7SBruno Larsen (billionai) {
30513e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
30523e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
30533e770bf7SBruno Larsen (billionai) 
30543e770bf7SBruno Larsen (billionai)     dc->desc = "e200 core";
30553e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e200;
30563e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
30573e770bf7SBruno Larsen (billionai)     /*
30583e770bf7SBruno Larsen (billionai)      * XXX: unimplemented instructions:
30593e770bf7SBruno Larsen (billionai)      * dcblc
30603e770bf7SBruno Larsen (billionai)      * dcbtlst
30613e770bf7SBruno Larsen (billionai)      * dcbtstls
30623e770bf7SBruno Larsen (billionai)      * icblc
30633e770bf7SBruno Larsen (billionai)      * icbtls
30643e770bf7SBruno Larsen (billionai)      * tlbivax
30653e770bf7SBruno Larsen (billionai)      * all SPE multiply-accumulate instructions
30663e770bf7SBruno Larsen (billionai)      */
30673e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL |
30683e770bf7SBruno Larsen (billionai)                        PPC_SPE | PPC_SPE_SINGLE |
30693e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI |
30703e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
30713e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
30723e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX |
30733e770bf7SBruno Larsen (billionai)                        PPC_BOOKE;
30743e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_UCLE) |
30753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SPE) |
30763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
30773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
30783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
30793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
30803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
30813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
30823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
30833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
30843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
30853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
30863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
30873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
30883e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
30893e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
30903e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
30913e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_860;
30923e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE |
30933e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_UBLE | POWERPC_FLAG_DE |
30943e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
30953e770bf7SBruno Larsen (billionai) }
30963e770bf7SBruno Larsen (billionai) 
30973e770bf7SBruno Larsen (billionai) static void init_proc_e300(CPUPPCState *env)
30983e770bf7SBruno Larsen (billionai) {
30993e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
31003e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
31013e770bf7SBruno Larsen (billionai)     register_603_sprs(env);
31023e770bf7SBruno Larsen (billionai)     /* hardware implementation registers */
31033e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
31043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
31053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
31063e770bf7SBruno Larsen (billionai)                  0x00000000);
3107acf629ebSFabiano Rosas 
31083e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
31093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
31103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
31113e770bf7SBruno Larsen (billionai)                  0x00000000);
3112acf629ebSFabiano Rosas 
31133e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID2, "HID2",
31143e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
31153e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
31163e770bf7SBruno Larsen (billionai)                  0x00000000);
31173e770bf7SBruno Larsen (billionai)     /* Breakpoints */
31183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DABR, "DABR",
31193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
31203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
31213e770bf7SBruno Larsen (billionai)                  0x00000000);
3122acf629ebSFabiano Rosas 
31233e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DABR2, "DABR2",
31243e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
31253e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
31263e770bf7SBruno Larsen (billionai)                  0x00000000);
3127acf629ebSFabiano Rosas 
31283e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR2, "IABR2",
31293e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
31303e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
31313e770bf7SBruno Larsen (billionai)                  0x00000000);
3132acf629ebSFabiano Rosas 
31333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBCR, "IBCR",
31343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
31353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
31363e770bf7SBruno Larsen (billionai)                  0x00000000);
3137acf629ebSFabiano Rosas 
31383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBCR, "DBCR",
31393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
31403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
31413e770bf7SBruno Larsen (billionai)                  0x00000000);
31423e770bf7SBruno Larsen (billionai)     /* Memory management */
31433e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
31443e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
31453e770bf7SBruno Larsen (billionai)     register_6xx_7xx_soft_tlb(env, 64, 2);
31463e770bf7SBruno Larsen (billionai)     init_excp_603(env);
31473e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
31483e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
31493e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
31503e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
31513e770bf7SBruno Larsen (billionai) }
31523e770bf7SBruno Larsen (billionai) 
31533e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e300)(ObjectClass *oc, void *data)
31543e770bf7SBruno Larsen (billionai) {
31553e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
31563e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
31573e770bf7SBruno Larsen (billionai) 
31583e770bf7SBruno Larsen (billionai)     dc->desc = "e300 core";
31593e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e300;
31603e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
31613e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
31623e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
31633e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
31643e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
31653e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
31663e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
31673e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
31683e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
31693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
31703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
31713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
31723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
31733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
31743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
31753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
31763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
31773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
31783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
31793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_AL) |
31803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
31813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
31823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
31833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
31843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
31853e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
31869323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
31873e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
31883e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_603;
31893e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
31903e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
31913e770bf7SBruno Larsen (billionai) }
31923e770bf7SBruno Larsen (billionai) 
31933e770bf7SBruno Larsen (billionai) enum fsl_e500_version {
31943e770bf7SBruno Larsen (billionai)     fsl_e500v1,
31953e770bf7SBruno Larsen (billionai)     fsl_e500v2,
31963e770bf7SBruno Larsen (billionai)     fsl_e500mc,
31973e770bf7SBruno Larsen (billionai)     fsl_e5500,
31983e770bf7SBruno Larsen (billionai)     fsl_e6500,
31993e770bf7SBruno Larsen (billionai) };
32003e770bf7SBruno Larsen (billionai) 
32013e770bf7SBruno Larsen (billionai) static void init_proc_e500(CPUPPCState *env, int version)
32023e770bf7SBruno Larsen (billionai) {
32033e770bf7SBruno Larsen (billionai)     uint32_t tlbncfg[2];
32043e770bf7SBruno Larsen (billionai)     uint64_t ivor_mask;
32053e770bf7SBruno Larsen (billionai)     uint64_t ivpr_mask = 0xFFFF0000ULL;
32063e770bf7SBruno Larsen (billionai)     uint32_t l1cfg0 = 0x3800  /* 8 ways */
32073e770bf7SBruno Larsen (billionai)                     | 0x0020; /* 32 kb */
32083e770bf7SBruno Larsen (billionai)     uint32_t l1cfg1 = 0x3800  /* 8 ways */
32093e770bf7SBruno Larsen (billionai)                     | 0x0020; /* 32 kb */
32103e770bf7SBruno Larsen (billionai)     uint32_t mmucfg = 0;
32113e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
32123e770bf7SBruno Larsen (billionai)     int i;
32133e770bf7SBruno Larsen (billionai) #endif
32143e770bf7SBruno Larsen (billionai) 
32153e770bf7SBruno Larsen (billionai)     /*
32163e770bf7SBruno Larsen (billionai)      * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
32173e770bf7SBruno Larsen (billionai)      *     complain when accessing them.
32183e770bf7SBruno Larsen (billionai)      * register_BookE_sprs(env, 0x0000000F0000FD7FULL);
32193e770bf7SBruno Larsen (billionai)      */
32203e770bf7SBruno Larsen (billionai)     switch (version) {
32213e770bf7SBruno Larsen (billionai)     case fsl_e500v1:
32223e770bf7SBruno Larsen (billionai)     case fsl_e500v2:
32233e770bf7SBruno Larsen (billionai)     default:
32243e770bf7SBruno Larsen (billionai)         ivor_mask = 0x0000000F0000FFFFULL;
32253e770bf7SBruno Larsen (billionai)         break;
32263e770bf7SBruno Larsen (billionai)     case fsl_e500mc:
32273e770bf7SBruno Larsen (billionai)     case fsl_e5500:
32283e770bf7SBruno Larsen (billionai)         ivor_mask = 0x000003FE0000FFFFULL;
32293e770bf7SBruno Larsen (billionai)         break;
32303e770bf7SBruno Larsen (billionai)     case fsl_e6500:
32313e770bf7SBruno Larsen (billionai)         ivor_mask = 0x000003FF0000FFFFULL;
32323e770bf7SBruno Larsen (billionai)         break;
32333e770bf7SBruno Larsen (billionai)     }
32343e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, ivor_mask);
32353e770bf7SBruno Larsen (billionai)     register_usprg3_sprs(env);
32363e770bf7SBruno Larsen (billionai)     /* Processor identification */
32373e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_PIR, "PIR",
32383e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
32393e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
32403e770bf7SBruno Larsen (billionai)                  0x00000000);
3241acf629ebSFabiano Rosas 
32423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
32433e770bf7SBruno Larsen (billionai)                  &spr_read_spefscr, &spr_write_spefscr,
32443e770bf7SBruno Larsen (billionai)                  &spr_read_spefscr, &spr_write_spefscr,
32453e770bf7SBruno Larsen (billionai)                  0x00000000);
32463e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
32473e770bf7SBruno Larsen (billionai)     /* Memory management */
32483e770bf7SBruno Larsen (billionai)     env->nb_pids = 3;
32493e770bf7SBruno Larsen (billionai)     env->nb_ways = 2;
32503e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
32513e770bf7SBruno Larsen (billionai)     switch (version) {
32523e770bf7SBruno Larsen (billionai)     case fsl_e500v1:
32533e770bf7SBruno Larsen (billionai)         tlbncfg[0] = register_tlbncfg(2, 1, 1, 0, 256);
32543e770bf7SBruno Larsen (billionai)         tlbncfg[1] = register_tlbncfg(16, 1, 9, TLBnCFG_AVAIL | TLBnCFG_IPROT, 16);
32553e770bf7SBruno Larsen (billionai)         break;
32563e770bf7SBruno Larsen (billionai)     case fsl_e500v2:
32573e770bf7SBruno Larsen (billionai)         tlbncfg[0] = register_tlbncfg(4, 1, 1, 0, 512);
32583e770bf7SBruno Larsen (billionai)         tlbncfg[1] = register_tlbncfg(16, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 16);
32593e770bf7SBruno Larsen (billionai)         break;
32603e770bf7SBruno Larsen (billionai)     case fsl_e500mc:
32613e770bf7SBruno Larsen (billionai)     case fsl_e5500:
32623e770bf7SBruno Larsen (billionai)         tlbncfg[0] = register_tlbncfg(4, 1, 1, 0, 512);
32633e770bf7SBruno Larsen (billionai)         tlbncfg[1] = register_tlbncfg(64, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 64);
32643e770bf7SBruno Larsen (billionai)         break;
32653e770bf7SBruno Larsen (billionai)     case fsl_e6500:
32663e770bf7SBruno Larsen (billionai)         mmucfg = 0x6510B45;
32673e770bf7SBruno Larsen (billionai)         env->nb_pids = 1;
32683e770bf7SBruno Larsen (billionai)         tlbncfg[0] = 0x08052400;
32693e770bf7SBruno Larsen (billionai)         tlbncfg[1] = 0x40028040;
32703e770bf7SBruno Larsen (billionai)         break;
32713e770bf7SBruno Larsen (billionai)     default:
32723e770bf7SBruno Larsen (billionai)         cpu_abort(env_cpu(env), "Unknown CPU: " TARGET_FMT_lx "\n",
32733e770bf7SBruno Larsen (billionai)                   env->spr[SPR_PVR]);
32743e770bf7SBruno Larsen (billionai)     }
32753e770bf7SBruno Larsen (billionai) #endif
32763e770bf7SBruno Larsen (billionai)     /* Cache sizes */
32773e770bf7SBruno Larsen (billionai)     switch (version) {
32783e770bf7SBruno Larsen (billionai)     case fsl_e500v1:
32793e770bf7SBruno Larsen (billionai)     case fsl_e500v2:
32803e770bf7SBruno Larsen (billionai)         env->dcache_line_size = 32;
32813e770bf7SBruno Larsen (billionai)         env->icache_line_size = 32;
32823e770bf7SBruno Larsen (billionai)         break;
32833e770bf7SBruno Larsen (billionai)     case fsl_e500mc:
32843e770bf7SBruno Larsen (billionai)     case fsl_e5500:
32853e770bf7SBruno Larsen (billionai)         env->dcache_line_size = 64;
32863e770bf7SBruno Larsen (billionai)         env->icache_line_size = 64;
32873e770bf7SBruno Larsen (billionai)         l1cfg0 |= 0x1000000; /* 64 byte cache block size */
32883e770bf7SBruno Larsen (billionai)         l1cfg1 |= 0x1000000; /* 64 byte cache block size */
32893e770bf7SBruno Larsen (billionai)         break;
32903e770bf7SBruno Larsen (billionai)     case fsl_e6500:
32913e770bf7SBruno Larsen (billionai)         env->dcache_line_size = 32;
32923e770bf7SBruno Larsen (billionai)         env->icache_line_size = 32;
32933e770bf7SBruno Larsen (billionai)         l1cfg0 |= 0x0F83820;
32943e770bf7SBruno Larsen (billionai)         l1cfg1 |= 0x0B83820;
32953e770bf7SBruno Larsen (billionai)         break;
32963e770bf7SBruno Larsen (billionai)     default:
32973e770bf7SBruno Larsen (billionai)         cpu_abort(env_cpu(env), "Unknown CPU: " TARGET_FMT_lx "\n",
32983e770bf7SBruno Larsen (billionai)                   env->spr[SPR_PVR]);
32993e770bf7SBruno Larsen (billionai)     }
33003e770bf7SBruno Larsen (billionai)     register_BookE206_sprs(env, 0x000000DF, tlbncfg, mmucfg);
33014ffb8c5eSFabiano Rosas     register_usprgh_sprs(env);
3302acf629ebSFabiano Rosas 
33033e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
33043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33063e770bf7SBruno Larsen (billionai)                  0x00000000);
3307acf629ebSFabiano Rosas 
33083e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
33093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33113e770bf7SBruno Larsen (billionai)                  0x00000000);
3312acf629ebSFabiano Rosas 
33133e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_BBEAR, "BBEAR",
33143e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33153e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33163e770bf7SBruno Larsen (billionai)                  0x00000000);
3317acf629ebSFabiano Rosas 
33183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_BBTAR, "BBTAR",
33193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33213e770bf7SBruno Larsen (billionai)                  0x00000000);
3322acf629ebSFabiano Rosas 
33233e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_MCAR, "MCAR",
33243e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33253e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33263e770bf7SBruno Larsen (billionai)                  0x00000000);
3327acf629ebSFabiano Rosas 
33283e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
33293e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33303e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33313e770bf7SBruno Larsen (billionai)                  0x00000000);
3332acf629ebSFabiano Rosas 
33333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_NPIDR, "NPIDR",
33343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33363e770bf7SBruno Larsen (billionai)                  0x00000000);
3337acf629ebSFabiano Rosas 
33383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_BUCSR, "BUCSR",
33393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33413e770bf7SBruno Larsen (billionai)                  0x00000000);
3342acf629ebSFabiano Rosas 
33433e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0",
33443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
33453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
33463e770bf7SBruno Larsen (billionai)                  l1cfg0);
33473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CFG1, "L1CFG1",
33483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
33493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
33503e770bf7SBruno Larsen (billionai)                  l1cfg1);
33513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0",
33523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_e500_l1csr0,
33543e770bf7SBruno Larsen (billionai)                  0x00000000);
33553e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CSR1, "L1CSR1",
33563e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33573e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_e500_l1csr1,
33583e770bf7SBruno Larsen (billionai)                  0x00000000);
33593e770bf7SBruno Larsen (billionai)     if (version != fsl_e500v1 && version != fsl_e500v2) {
33603e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_Exxx_L2CSR0, "L2CSR0",
33613e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
33623e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_e500_l2csr0,
33633e770bf7SBruno Larsen (billionai)                      0x00000000);
33643e770bf7SBruno Larsen (billionai)     }
33653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
33663e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33673e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33683e770bf7SBruno Larsen (billionai)                  0x00000000);
33693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
33703e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33713e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
33723e770bf7SBruno Larsen (billionai)                  0x00000000);
33733e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
33743e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33753e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_booke206_mmucsr0,
33763e770bf7SBruno Larsen (billionai)                  0x00000000);
33773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_EPR, "EPR",
33783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
33793e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
33803e770bf7SBruno Larsen (billionai)                  0x00000000);
33813e770bf7SBruno Larsen (billionai)     /* XXX better abstract into Emb.xxx features */
33823e770bf7SBruno Larsen (billionai)     if ((version == fsl_e5500) || (version == fsl_e6500)) {
33833e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_EPCR, "EPCR",
33843e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
33853e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
33863e770bf7SBruno Larsen (billionai)                      0x00000000);
33873e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_MAS7_MAS3, "MAS7_MAS3",
33883e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
33893e770bf7SBruno Larsen (billionai)                      &spr_read_mas73, &spr_write_mas73,
33903e770bf7SBruno Larsen (billionai)                      0x00000000);
33913e770bf7SBruno Larsen (billionai)         ivpr_mask = (target_ulong)~0xFFFFULL;
33923e770bf7SBruno Larsen (billionai)     }
33933e770bf7SBruno Larsen (billionai) 
33943e770bf7SBruno Larsen (billionai)     if (version == fsl_e6500) {
33953e770bf7SBruno Larsen (billionai)         /* Thread identification */
33963e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_TIR, "TIR",
33973e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
33983e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
33993e770bf7SBruno Larsen (billionai)                      0x00000000);
34003e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB0PS, "TLB0PS",
34013e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
34023e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
34033e770bf7SBruno Larsen (billionai)                      0x00000004);
34043e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB1PS, "TLB1PS",
34053e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
34063e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
34073e770bf7SBruno Larsen (billionai)                      0x7FFFFFFC);
34083e770bf7SBruno Larsen (billionai)     }
34093e770bf7SBruno Larsen (billionai) 
34103e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
34113e770bf7SBruno Larsen (billionai)     env->nb_tlb = 0;
34123e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_MAS;
34133e770bf7SBruno Larsen (billionai)     for (i = 0; i < BOOKE206_MAX_TLBN; i++) {
34143e770bf7SBruno Larsen (billionai)         env->nb_tlb += booke206_tlb_size(env, i);
34153e770bf7SBruno Larsen (billionai)     }
34163e770bf7SBruno Larsen (billionai) #endif
34173e770bf7SBruno Larsen (billionai) 
34183e770bf7SBruno Larsen (billionai)     init_excp_e200(env, ivpr_mask);
34193e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
34203e770bf7SBruno Larsen (billionai)     ppce500_irq_init(env_archcpu(env));
34213e770bf7SBruno Larsen (billionai) }
34223e770bf7SBruno Larsen (billionai) 
34233e770bf7SBruno Larsen (billionai) static void init_proc_e500v1(CPUPPCState *env)
34243e770bf7SBruno Larsen (billionai) {
34253e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e500v1);
34263e770bf7SBruno Larsen (billionai) }
34273e770bf7SBruno Larsen (billionai) 
34283e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500v1)(ObjectClass *oc, void *data)
34293e770bf7SBruno Larsen (billionai) {
34303e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
34313e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
34323e770bf7SBruno Larsen (billionai) 
34333e770bf7SBruno Larsen (billionai)     dc->desc = "e500v1 core";
34343e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e500v1;
34353e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
34363e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL |
34373e770bf7SBruno Larsen (billionai)                        PPC_SPE | PPC_SPE_SINGLE |
34383e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI |
34393e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
34403e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
34413e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC;
34423e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206;
34433e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_UCLE) |
34443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SPE) |
34453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
34463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
34473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
34483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
34493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
34503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
34513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
34523e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
34533e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
34543e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
34553e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
34563e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
34573e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
34583e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
34593e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
34603e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_860;
34613e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE |
34623e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_UBLE | POWERPC_FLAG_DE |
34633e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
34643e770bf7SBruno Larsen (billionai) }
34653e770bf7SBruno Larsen (billionai) 
34663e770bf7SBruno Larsen (billionai) static void init_proc_e500v2(CPUPPCState *env)
34673e770bf7SBruno Larsen (billionai) {
34683e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e500v2);
34693e770bf7SBruno Larsen (billionai) }
34703e770bf7SBruno Larsen (billionai) 
34713e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500v2)(ObjectClass *oc, void *data)
34723e770bf7SBruno Larsen (billionai) {
34733e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
34743e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
34753e770bf7SBruno Larsen (billionai) 
34763e770bf7SBruno Larsen (billionai)     dc->desc = "e500v2 core";
34773e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e500v2;
34783e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
34793e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL |
34803e770bf7SBruno Larsen (billionai)                        PPC_SPE | PPC_SPE_SINGLE | PPC_SPE_DOUBLE |
34813e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI |
34823e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
34833e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
34843e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC;
34853e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206;
34863e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_UCLE) |
34873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SPE) |
34883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
34893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
34903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
34913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
34923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
34933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
34943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
34953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
34963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
34973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
34983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
34993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
35003e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
35013e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
35023e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
35033e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_860;
35043e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE |
35053e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_UBLE | POWERPC_FLAG_DE |
35063e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
35073e770bf7SBruno Larsen (billionai) }
35083e770bf7SBruno Larsen (billionai) 
35093e770bf7SBruno Larsen (billionai) static void init_proc_e500mc(CPUPPCState *env)
35103e770bf7SBruno Larsen (billionai) {
35113e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e500mc);
35123e770bf7SBruno Larsen (billionai) }
35133e770bf7SBruno Larsen (billionai) 
35143e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500mc)(ObjectClass *oc, void *data)
35153e770bf7SBruno Larsen (billionai) {
35163e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
35173e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
35183e770bf7SBruno Larsen (billionai) 
35193e770bf7SBruno Larsen (billionai)     dc->desc = "e500mc core";
35203e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e500mc;
35213e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
35223e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB |
35233e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI | PPC_RFMCI |
35243e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
35253e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
35263e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES |
35273e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL |
35283e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX | PPC_WAIT |
35293e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC;
35303e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL;
35313e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_GS) |
35323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_UCLE) |
35333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
35343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
35353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
35363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
35373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
35383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
35393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
35403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
35413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
35423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
35433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PX) |
35443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
35453e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
35463e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
35473e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
35483e770bf7SBruno Larsen (billionai)     /* FIXME: figure out the correct flag for e500mc */
35493e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_e500;
35503e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE |
35513e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
35523e770bf7SBruno Larsen (billionai) }
35533e770bf7SBruno Larsen (billionai) 
35543e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64
35553e770bf7SBruno Larsen (billionai) static void init_proc_e5500(CPUPPCState *env)
35563e770bf7SBruno Larsen (billionai) {
35573e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e5500);
35583e770bf7SBruno Larsen (billionai) }
35593e770bf7SBruno Larsen (billionai) 
35603e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e5500)(ObjectClass *oc, void *data)
35613e770bf7SBruno Larsen (billionai) {
35623e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
35633e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
35643e770bf7SBruno Larsen (billionai) 
35653e770bf7SBruno Larsen (billionai)     dc->desc = "e5500 core";
35663e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e5500;
35673e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
35683e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB |
35693e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI | PPC_RFMCI |
35703e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
35713e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
35723e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES |
35733e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL |
35743e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX | PPC_WAIT |
35753e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC |
35763e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_POPCNTB | PPC_POPCNTWD;
35773e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL | PPC2_PERM_ISA206 |
35783e770bf7SBruno Larsen (billionai)                         PPC2_FP_CVT_S64;
35793e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_CM) |
35803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_GS) |
35813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_UCLE) |
35823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
35833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
35843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
35853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
35863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
35873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
35883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
35893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
35903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
35913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
35923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PX) |
35933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
35943e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
35953e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
35963e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
35973e770bf7SBruno Larsen (billionai)     /* FIXME: figure out the correct flag for e5500 */
35983e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_e500;
35993e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE |
36003e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
36013e770bf7SBruno Larsen (billionai) }
36023e770bf7SBruno Larsen (billionai) 
36033e770bf7SBruno Larsen (billionai) static void init_proc_e6500(CPUPPCState *env)
36043e770bf7SBruno Larsen (billionai) {
36053e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e6500);
36063e770bf7SBruno Larsen (billionai) }
36073e770bf7SBruno Larsen (billionai) 
36083e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e6500)(ObjectClass *oc, void *data)
36093e770bf7SBruno Larsen (billionai) {
36103e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
36113e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
36123e770bf7SBruno Larsen (billionai) 
36133e770bf7SBruno Larsen (billionai)     dc->desc = "e6500 core";
36143e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e6500;
36153e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
36163e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB |
36173e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI | PPC_RFMCI |
36183e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
36193e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
36203e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES |
36213e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL |
36223e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX | PPC_WAIT |
36233e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC |
36243e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_POPCNTB | PPC_POPCNTWD | PPC_ALTIVEC;
36253e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL | PPC2_PERM_ISA206 |
36263e770bf7SBruno Larsen (billionai)                         PPC2_FP_CVT_S64 | PPC2_ATOMIC_ISA206;
36273e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_CM) |
36283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_GS) |
36293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_UCLE) |
36303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
36313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
36323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
36333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
36343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
36353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
36363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
36373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
36383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IS) |
36393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DS) |
36403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PX) |
36413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
36423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR);
36433e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
36443e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
36453e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
36463e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_e500;
36473e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE |
36483e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_VRE;
36493e770bf7SBruno Larsen (billionai) }
36503e770bf7SBruno Larsen (billionai) 
36513e770bf7SBruno Larsen (billionai) #endif
36523e770bf7SBruno Larsen (billionai) 
36533e770bf7SBruno Larsen (billionai) /* Non-embedded PowerPC                                                      */
36543e770bf7SBruno Larsen (billionai) static void init_proc_603(CPUPPCState *env)
36553e770bf7SBruno Larsen (billionai) {
36563e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
36573e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
36583e770bf7SBruno Larsen (billionai)     register_603_sprs(env);
36593e770bf7SBruno Larsen (billionai)     /* hardware implementation registers */
36603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
36613e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36623e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36633e770bf7SBruno Larsen (billionai)                  0x00000000);
3664acf629ebSFabiano Rosas 
36653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
36663e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36673e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36683e770bf7SBruno Larsen (billionai)                  0x00000000);
36693e770bf7SBruno Larsen (billionai)     /* Memory management */
36703e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
36713e770bf7SBruno Larsen (billionai)     register_6xx_7xx_soft_tlb(env, 64, 2);
36723e770bf7SBruno Larsen (billionai)     init_excp_603(env);
36733e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
36743e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
36753e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
36763e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
36773e770bf7SBruno Larsen (billionai) }
36783e770bf7SBruno Larsen (billionai) 
36793e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(603)(ObjectClass *oc, void *data)
36803e770bf7SBruno Larsen (billionai) {
36813e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
36823e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
36833e770bf7SBruno Larsen (billionai) 
36843e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 603";
36853e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_603;
36863e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
36873e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
36883e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
36893e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
36903e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
36913e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
36923e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
36933e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
36943e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
36953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
36963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
36973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
36983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
36993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
37003e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
37013e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
37023e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
37033e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
37043e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
37053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
37063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
37073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
37083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
37093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
37103e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
37119323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
37123e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
37133e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_603;
37143e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
37153e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
37163e770bf7SBruno Larsen (billionai) }
37173e770bf7SBruno Larsen (billionai) 
37183e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(603E)(ObjectClass *oc, void *data)
37193e770bf7SBruno Larsen (billionai) {
37203e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
37213e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
37223e770bf7SBruno Larsen (billionai) 
37233e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 603e";
3724fd77f757SFabiano Rosas     pcc->init_proc = init_proc_603;
37253e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
37263e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
37273e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
37283e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
37293e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
37303e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
37313e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
37323e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
37333e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
37343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
37353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
37363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
37373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
37383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
37393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
37403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
37413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
37423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
37433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
37443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
37453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
37463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
37473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
37483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
37493e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
37509323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
37513e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
37523e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_ec603e;
37533e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
37543e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
37553e770bf7SBruno Larsen (billionai) }
37563e770bf7SBruno Larsen (billionai) 
37573e770bf7SBruno Larsen (billionai) static void init_proc_604(CPUPPCState *env)
37583e770bf7SBruno Larsen (billionai) {
37593e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
37603e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
37613e770bf7SBruno Larsen (billionai)     register_604_sprs(env);
37623e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
37633e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
37643e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
37653e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
37663e770bf7SBruno Larsen (billionai)                  0x00000000);
37673e770bf7SBruno Larsen (billionai)     /* Memory management */
37683e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
37693e770bf7SBruno Larsen (billionai)     init_excp_604(env);
37703e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
37713e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
37723e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
37733e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
37743e770bf7SBruno Larsen (billionai) }
37753e770bf7SBruno Larsen (billionai) 
37763e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(604)(ObjectClass *oc, void *data)
37773e770bf7SBruno Larsen (billionai) {
37783e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
37793e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
37803e770bf7SBruno Larsen (billionai) 
37813e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 604";
37823e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_604;
37833e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
37843e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
37853e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
37863e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
37873e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
37883e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
37893e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
37903e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
37913e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
37923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
37933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
37943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
37953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
37963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
37973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
37983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
37993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
38003e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
38013e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
38023e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
38033e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
38043e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
38053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
38063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
38073e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
38089323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
38093e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
38103e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_604;
38113e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
38123e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
38133e770bf7SBruno Larsen (billionai) }
38143e770bf7SBruno Larsen (billionai) 
38153e770bf7SBruno Larsen (billionai) static void init_proc_604E(CPUPPCState *env)
38163e770bf7SBruno Larsen (billionai) {
38173e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
38183e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
38193e770bf7SBruno Larsen (billionai)     register_604_sprs(env);
3820acf629ebSFabiano Rosas 
38213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_MMCR1, "MMCR1",
38223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
38243e770bf7SBruno Larsen (billionai)                  0x00000000);
3825acf629ebSFabiano Rosas 
38263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC3, "PMC3",
38273e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38283e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
38293e770bf7SBruno Larsen (billionai)                  0x00000000);
3830acf629ebSFabiano Rosas 
38313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC4, "PMC4",
38323e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
38343e770bf7SBruno Larsen (billionai)                  0x00000000);
38353e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
38363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
38373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38383e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
38393e770bf7SBruno Larsen (billionai)                  0x00000000);
3840acf629ebSFabiano Rosas 
38413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
38423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
38443e770bf7SBruno Larsen (billionai)                  0x00000000);
38453e770bf7SBruno Larsen (billionai)     /* Memory management */
38463e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
38473e770bf7SBruno Larsen (billionai)     init_excp_604(env);
38483e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
38493e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
38503e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
38513e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
38523e770bf7SBruno Larsen (billionai) }
38533e770bf7SBruno Larsen (billionai) 
38543e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(604E)(ObjectClass *oc, void *data)
38553e770bf7SBruno Larsen (billionai) {
38563e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
38573e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
38583e770bf7SBruno Larsen (billionai) 
38593e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 604E";
38603e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_604E;
38613e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
38623e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
38633e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
38643e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
38653e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
38663e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
38673e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
38683e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
38693e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
38703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
38713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
38723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
38733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
38743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
38753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
38763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
38773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
38783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
38793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
38803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
38813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
38823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
38833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
38843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
38853e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
38869323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
38873e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
38883e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_604;
38893e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
38903e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
38913e770bf7SBruno Larsen (billionai) }
38923e770bf7SBruno Larsen (billionai) 
38933e770bf7SBruno Larsen (billionai) static void init_proc_740(CPUPPCState *env)
38943e770bf7SBruno Larsen (billionai) {
38953e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
38963e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
38973e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
38983e770bf7SBruno Larsen (billionai)     /* Thermal management */
38993e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
39003e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
39013e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
39023e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
39033e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
39043e770bf7SBruno Larsen (billionai)                  0x00000000);
3905acf629ebSFabiano Rosas 
39063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
39073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
39083e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
39093e770bf7SBruno Larsen (billionai)                  0x00000000);
39103e770bf7SBruno Larsen (billionai)     /* Memory management */
39113e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
39123e770bf7SBruno Larsen (billionai)     init_excp_7x0(env);
39133e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
39143e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
39153e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
39163e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
39173e770bf7SBruno Larsen (billionai) }
39183e770bf7SBruno Larsen (billionai) 
39193e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(740)(ObjectClass *oc, void *data)
39203e770bf7SBruno Larsen (billionai) {
39213e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
39223e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
39233e770bf7SBruno Larsen (billionai) 
39243e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 740";
39253e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_740;
39263e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
39273e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
39283e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
39293e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
39303e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
39313e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
39323e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
39333e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
39343e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
39353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
39363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
39373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
39383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
39393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
39403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
39413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
39423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
39433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
39443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
39453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
39463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
39473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
39483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
39493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
39503e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
3951fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
39523e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
39533e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
39543e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
39553e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
39563e770bf7SBruno Larsen (billionai) }
39573e770bf7SBruno Larsen (billionai) 
39583e770bf7SBruno Larsen (billionai) static void init_proc_750(CPUPPCState *env)
39593e770bf7SBruno Larsen (billionai) {
39603e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
39613e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
39623e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
3963acf629ebSFabiano Rosas 
39643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
39653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
39663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
39673e770bf7SBruno Larsen (billionai)                  0x00000000);
39683e770bf7SBruno Larsen (billionai)     /* Thermal management */
39693e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
39703e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
39713e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
39723e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
39733e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
39743e770bf7SBruno Larsen (billionai)                  0x00000000);
3975acf629ebSFabiano Rosas 
39763e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
39773e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
39783e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
39793e770bf7SBruno Larsen (billionai)                  0x00000000);
39803e770bf7SBruno Larsen (billionai)     /* Memory management */
39813e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
39823e770bf7SBruno Larsen (billionai)     /*
39833e770bf7SBruno Larsen (billionai)      * XXX: high BATs are also present but are known to be bugged on
39843e770bf7SBruno Larsen (billionai)      *      die version 1.x
39853e770bf7SBruno Larsen (billionai)      */
39863e770bf7SBruno Larsen (billionai)     init_excp_7x0(env);
39873e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
39883e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
39893e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
39903e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
39913e770bf7SBruno Larsen (billionai) }
39923e770bf7SBruno Larsen (billionai) 
39933e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750)(ObjectClass *oc, void *data)
39943e770bf7SBruno Larsen (billionai) {
39953e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
39963e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
39973e770bf7SBruno Larsen (billionai) 
39983e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750";
39993e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750;
40003e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
40013e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
40023e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
40033e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
40043e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
40053e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
40063e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
40073e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
40083e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
40093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
40103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
40113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
40123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
40133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
40143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
40153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
40163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
40173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
40183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
40193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
40203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
40213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
40223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
40233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
40243e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
4025fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
40263e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
40273e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
40283e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
40293e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
40303e770bf7SBruno Larsen (billionai) }
40313e770bf7SBruno Larsen (billionai) 
40323e770bf7SBruno Larsen (billionai) static void init_proc_750cl(CPUPPCState *env)
40333e770bf7SBruno Larsen (billionai) {
40343e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
40353e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
40363e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
4037acf629ebSFabiano Rosas 
40383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
40393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
40413e770bf7SBruno Larsen (billionai)                  0x00000000);
40423e770bf7SBruno Larsen (billionai)     /* Thermal management */
40433e770bf7SBruno Larsen (billionai)     /* Those registers are fake on 750CL */
40443e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM1, "THRM1",
40453e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40463e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40473e770bf7SBruno Larsen (billionai)                  0x00000000);
40483e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM2, "THRM2",
40493e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40503e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40513e770bf7SBruno Larsen (billionai)                  0x00000000);
40523e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM3, "THRM3",
40533e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40543e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40553e770bf7SBruno Larsen (billionai)                  0x00000000);
4056acf629ebSFabiano Rosas 
40573e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_TDCL, "TDCL",
40583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40593e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40603e770bf7SBruno Larsen (billionai)                  0x00000000);
40613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_TDCH, "TDCH",
40623e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40633e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40643e770bf7SBruno Larsen (billionai)                  0x00000000);
40653e770bf7SBruno Larsen (billionai)     /* DMA */
40663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_WPAR, "WPAR",
40673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40683e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40693e770bf7SBruno Larsen (billionai)                  0x00000000);
40703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_DMAL, "DMAL",
40713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40723e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40733e770bf7SBruno Larsen (billionai)                  0x00000000);
40743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_DMAU, "DMAU",
40753e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40763e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40773e770bf7SBruno Larsen (billionai)                  0x00000000);
40783e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
40793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
40803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40823e770bf7SBruno Larsen (billionai)                  0x00000000);
4083acf629ebSFabiano Rosas 
40843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
40853e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40863e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40873e770bf7SBruno Larsen (billionai)                  0x00000000);
4088acf629ebSFabiano Rosas 
40893e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750CL_HID2, "HID2",
40903e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40913e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40923e770bf7SBruno Larsen (billionai)                  0x00000000);
4093acf629ebSFabiano Rosas 
40943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750CL_HID4, "HID4",
40953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
40963e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
40973e770bf7SBruno Larsen (billionai)                  0x00000000);
40983e770bf7SBruno Larsen (billionai)     /* Quantization registers */
40993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR0, "GQR0",
41003e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41013e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41023e770bf7SBruno Larsen (billionai)                  0x00000000);
4103acf629ebSFabiano Rosas 
41043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR1, "GQR1",
41053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41073e770bf7SBruno Larsen (billionai)                  0x00000000);
4108acf629ebSFabiano Rosas 
41093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR2, "GQR2",
41103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41123e770bf7SBruno Larsen (billionai)                  0x00000000);
4113acf629ebSFabiano Rosas 
41143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR3, "GQR3",
41153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41173e770bf7SBruno Larsen (billionai)                  0x00000000);
4118acf629ebSFabiano Rosas 
41193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR4, "GQR4",
41203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41223e770bf7SBruno Larsen (billionai)                  0x00000000);
4123acf629ebSFabiano Rosas 
41243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR5, "GQR5",
41253e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41263e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41273e770bf7SBruno Larsen (billionai)                  0x00000000);
4128acf629ebSFabiano Rosas 
41293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR6, "GQR6",
41303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41323e770bf7SBruno Larsen (billionai)                  0x00000000);
4133acf629ebSFabiano Rosas 
41343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR7, "GQR7",
41353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41373e770bf7SBruno Larsen (billionai)                  0x00000000);
41383e770bf7SBruno Larsen (billionai)     /* Memory management */
41393e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
41403e770bf7SBruno Larsen (billionai)     /* PowerPC 750cl has 8 DBATs and 8 IBATs */
41413e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
41423e770bf7SBruno Larsen (billionai)     init_excp_750cl(env);
41433e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
41443e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
41453e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
41463e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
41473e770bf7SBruno Larsen (billionai) }
41483e770bf7SBruno Larsen (billionai) 
41493e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750cl)(ObjectClass *oc, void *data)
41503e770bf7SBruno Larsen (billionai) {
41513e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
41523e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
41533e770bf7SBruno Larsen (billionai) 
41543e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750 CL";
41553e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750cl;
41563e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
41573e770bf7SBruno Larsen (billionai)     /*
41583e770bf7SBruno Larsen (billionai)      * XXX: not implemented:
41593e770bf7SBruno Larsen (billionai)      * cache lock instructions:
41603e770bf7SBruno Larsen (billionai)      * dcbz_l
41613e770bf7SBruno Larsen (billionai)      * floating point paired instructions
41623e770bf7SBruno Larsen (billionai)      * psq_lux
41633e770bf7SBruno Larsen (billionai)      * psq_lx
41643e770bf7SBruno Larsen (billionai)      * psq_stux
41653e770bf7SBruno Larsen (billionai)      * psq_stx
41663e770bf7SBruno Larsen (billionai)      * ps_abs
41673e770bf7SBruno Larsen (billionai)      * ps_add
41683e770bf7SBruno Larsen (billionai)      * ps_cmpo0
41693e770bf7SBruno Larsen (billionai)      * ps_cmpo1
41703e770bf7SBruno Larsen (billionai)      * ps_cmpu0
41713e770bf7SBruno Larsen (billionai)      * ps_cmpu1
41723e770bf7SBruno Larsen (billionai)      * ps_div
41733e770bf7SBruno Larsen (billionai)      * ps_madd
41743e770bf7SBruno Larsen (billionai)      * ps_madds0
41753e770bf7SBruno Larsen (billionai)      * ps_madds1
41763e770bf7SBruno Larsen (billionai)      * ps_merge00
41773e770bf7SBruno Larsen (billionai)      * ps_merge01
41783e770bf7SBruno Larsen (billionai)      * ps_merge10
41793e770bf7SBruno Larsen (billionai)      * ps_merge11
41803e770bf7SBruno Larsen (billionai)      * ps_mr
41813e770bf7SBruno Larsen (billionai)      * ps_msub
41823e770bf7SBruno Larsen (billionai)      * ps_mul
41833e770bf7SBruno Larsen (billionai)      * ps_muls0
41843e770bf7SBruno Larsen (billionai)      * ps_muls1
41853e770bf7SBruno Larsen (billionai)      * ps_nabs
41863e770bf7SBruno Larsen (billionai)      * ps_neg
41873e770bf7SBruno Larsen (billionai)      * ps_nmadd
41883e770bf7SBruno Larsen (billionai)      * ps_nmsub
41893e770bf7SBruno Larsen (billionai)      * ps_res
41903e770bf7SBruno Larsen (billionai)      * ps_rsqrte
41913e770bf7SBruno Larsen (billionai)      * ps_sel
41923e770bf7SBruno Larsen (billionai)      * ps_sub
41933e770bf7SBruno Larsen (billionai)      * ps_sum0
41943e770bf7SBruno Larsen (billionai)      * ps_sum1
41953e770bf7SBruno Larsen (billionai)      */
41963e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
41973e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
41983e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
41993e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
42003e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
42013e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
42023e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
42033e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
42043e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
42053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
42063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
42073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
42083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
42093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
42103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
42113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
42123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
42133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
42143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
42153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
42163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
42173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
42183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
42193e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
4220fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
42213e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
42223e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
42233e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
42243e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
42253e770bf7SBruno Larsen (billionai) }
42263e770bf7SBruno Larsen (billionai) 
42273e770bf7SBruno Larsen (billionai) static void init_proc_750cx(CPUPPCState *env)
42283e770bf7SBruno Larsen (billionai) {
42293e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
42303e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
42313e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
4232acf629ebSFabiano Rosas 
42333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
42343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
42363e770bf7SBruno Larsen (billionai)                  0x00000000);
42373e770bf7SBruno Larsen (billionai)     /* Thermal management */
42383e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
4239acf629ebSFabiano Rosas 
42403e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SDA, "SDA",
42413e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42423e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42433e770bf7SBruno Larsen (billionai)                  0x00000000);
42443e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
42453e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
42463e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42473e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42483e770bf7SBruno Larsen (billionai)                  0x00000000);
4249acf629ebSFabiano Rosas 
42503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
42513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42533e770bf7SBruno Larsen (billionai)                  0x00000000);
42543e770bf7SBruno Larsen (billionai)     /* Memory management */
42553e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
42563e770bf7SBruno Larsen (billionai)     /* PowerPC 750cx has 8 DBATs and 8 IBATs */
42573e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
42583e770bf7SBruno Larsen (billionai)     init_excp_750cx(env);
42593e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
42603e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
42613e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
42623e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
42633e770bf7SBruno Larsen (billionai) }
42643e770bf7SBruno Larsen (billionai) 
42653e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750cx)(ObjectClass *oc, void *data)
42663e770bf7SBruno Larsen (billionai) {
42673e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
42683e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
42693e770bf7SBruno Larsen (billionai) 
42703e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750CX";
42713e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750cx;
42723e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
42733e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
42743e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
42753e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
42763e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
42773e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
42783e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
42793e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
42803e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
42813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
42823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
42833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
42843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
42853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
42863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
42873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
42883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
42893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
42903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
42913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
42923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
42933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
42943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
42953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
42963e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
4297fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
42983e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
42993e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
43003e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
43013e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
43023e770bf7SBruno Larsen (billionai) }
43033e770bf7SBruno Larsen (billionai) 
43043e770bf7SBruno Larsen (billionai) static void init_proc_750fx(CPUPPCState *env)
43053e770bf7SBruno Larsen (billionai) {
43063e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
43073e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
43083e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
4309acf629ebSFabiano Rosas 
43103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
43113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
43133e770bf7SBruno Larsen (billionai)                  0x00000000);
43143e770bf7SBruno Larsen (billionai)     /* Thermal management */
43153e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
4316acf629ebSFabiano Rosas 
43173e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_THRM4, "THRM4",
43183e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43193e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43203e770bf7SBruno Larsen (billionai)                  0x00000000);
43213e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
43223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
43233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43243e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43253e770bf7SBruno Larsen (billionai)                  0x00000000);
4326acf629ebSFabiano Rosas 
43273e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
43283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43293e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43303e770bf7SBruno Larsen (billionai)                  0x00000000);
4331acf629ebSFabiano Rosas 
43323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750FX_HID2, "HID2",
43333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43343e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43353e770bf7SBruno Larsen (billionai)                  0x00000000);
43363e770bf7SBruno Larsen (billionai)     /* Memory management */
43373e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
43383e770bf7SBruno Larsen (billionai)     /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
43393e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
43403e770bf7SBruno Larsen (billionai)     init_excp_7x0(env);
43413e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
43423e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
43433e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
43443e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
43453e770bf7SBruno Larsen (billionai) }
43463e770bf7SBruno Larsen (billionai) 
43473e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750fx)(ObjectClass *oc, void *data)
43483e770bf7SBruno Larsen (billionai) {
43493e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
43503e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
43513e770bf7SBruno Larsen (billionai) 
43523e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750FX";
43533e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750fx;
43543e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
43553e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
43563e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
43573e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
43583e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
43593e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
43603e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
43613e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
43623e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
43633e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
43643e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
43653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
43663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
43673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
43683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
43693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
43703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
43713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
43723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
43733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
43743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
43753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
43763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
43773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
43783e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
4379fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
43803e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
43813e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
43823e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
43833e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
43843e770bf7SBruno Larsen (billionai) }
43853e770bf7SBruno Larsen (billionai) 
43863e770bf7SBruno Larsen (billionai) static void init_proc_750gx(CPUPPCState *env)
43873e770bf7SBruno Larsen (billionai) {
43883e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
43893e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
43903e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
4391acf629ebSFabiano Rosas 
43923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
43933e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43943e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
43953e770bf7SBruno Larsen (billionai)                  0x00000000);
43963e770bf7SBruno Larsen (billionai)     /* Thermal management */
43973e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
4398acf629ebSFabiano Rosas 
43993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_THRM4, "THRM4",
44003e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44013e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44023e770bf7SBruno Larsen (billionai)                  0x00000000);
44033e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
44043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
44053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44073e770bf7SBruno Larsen (billionai)                  0x00000000);
4408acf629ebSFabiano Rosas 
44093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
44103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44123e770bf7SBruno Larsen (billionai)                  0x00000000);
4413acf629ebSFabiano Rosas 
44143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750FX_HID2, "HID2",
44153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44173e770bf7SBruno Larsen (billionai)                  0x00000000);
44183e770bf7SBruno Larsen (billionai)     /* Memory management */
44193e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
44203e770bf7SBruno Larsen (billionai)     /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
44213e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
44223e770bf7SBruno Larsen (billionai)     init_excp_7x0(env);
44233e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
44243e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
44253e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
44263e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
44273e770bf7SBruno Larsen (billionai) }
44283e770bf7SBruno Larsen (billionai) 
44293e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750gx)(ObjectClass *oc, void *data)
44303e770bf7SBruno Larsen (billionai) {
44313e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
44323e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
44333e770bf7SBruno Larsen (billionai) 
44343e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750GX";
44353e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750gx;
44363e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
44373e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
44383e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
44393e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
44403e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
44413e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
44423e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
44433e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
44443e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
44453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
44463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
44473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
44483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
44493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
44503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
44513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
44523e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
44533e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
44543e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
44553e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
44563e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
44573e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
44583e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
44593e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
44603e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
4461fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
44623e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
44633e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
44643e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
44653e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
44663e770bf7SBruno Larsen (billionai) }
44673e770bf7SBruno Larsen (billionai) 
44683e770bf7SBruno Larsen (billionai) static void init_proc_745(CPUPPCState *env)
44693e770bf7SBruno Larsen (billionai) {
44703e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
44713e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
44723e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
44733e770bf7SBruno Larsen (billionai)     register_G2_755_sprs(env);
44743e770bf7SBruno Larsen (billionai)     /* Thermal management */
44753e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
44763e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
44773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
44783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44793e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44803e770bf7SBruno Larsen (billionai)                  0x00000000);
4481acf629ebSFabiano Rosas 
44823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
44833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44853e770bf7SBruno Larsen (billionai)                  0x00000000);
4486acf629ebSFabiano Rosas 
44873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID2, "HID2",
44883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44903e770bf7SBruno Larsen (billionai)                  0x00000000);
44913e770bf7SBruno Larsen (billionai)     /* Memory management */
44923e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
44933e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
44943e770bf7SBruno Larsen (billionai)     register_6xx_7xx_soft_tlb(env, 64, 2);
44953e770bf7SBruno Larsen (billionai)     init_excp_7x5(env);
44963e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
44973e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
44983e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
44993e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
45003e770bf7SBruno Larsen (billionai) }
45013e770bf7SBruno Larsen (billionai) 
45023e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(745)(ObjectClass *oc, void *data)
45033e770bf7SBruno Larsen (billionai) {
45043e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
45053e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
45063e770bf7SBruno Larsen (billionai) 
45073e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 745";
45083e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_745;
45093e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
45103e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
45113e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
45123e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
45133e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
45143e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
45153e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
45163e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
45173e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
45183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
45193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
45203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
45213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
45223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
45233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
45243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
45253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
45263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
45273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
45283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
45293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
45303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
45313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
45323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
45333e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
4534fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
45353e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
45363e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
45373e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
45383e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
45393e770bf7SBruno Larsen (billionai) }
45403e770bf7SBruno Larsen (billionai) 
45413e770bf7SBruno Larsen (billionai) static void init_proc_755(CPUPPCState *env)
45423e770bf7SBruno Larsen (billionai) {
45433e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
45443e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
45453e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
45463e770bf7SBruno Larsen (billionai)     register_G2_755_sprs(env);
45473e770bf7SBruno Larsen (billionai)     /* L2 cache control */
45483e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
45493e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45503e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
45513e770bf7SBruno Larsen (billionai)                  0x00000000);
4552acf629ebSFabiano Rosas 
45533e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2PMCR, "L2PMCR",
45543e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45553e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45563e770bf7SBruno Larsen (billionai)                  0x00000000);
45573e770bf7SBruno Larsen (billionai)     /* Thermal management */
45583e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
45593e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
45603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
45613e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45623e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45633e770bf7SBruno Larsen (billionai)                  0x00000000);
4564acf629ebSFabiano Rosas 
45653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
45663e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45673e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45683e770bf7SBruno Larsen (billionai)                  0x00000000);
4569acf629ebSFabiano Rosas 
45703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID2, "HID2",
45713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45723e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45733e770bf7SBruno Larsen (billionai)                  0x00000000);
45743e770bf7SBruno Larsen (billionai)     /* Memory management */
45753e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
45763e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
45773e770bf7SBruno Larsen (billionai)     register_6xx_7xx_soft_tlb(env, 64, 2);
45783e770bf7SBruno Larsen (billionai)     init_excp_7x5(env);
45793e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
45803e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
45813e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
45823e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
45833e770bf7SBruno Larsen (billionai) }
45843e770bf7SBruno Larsen (billionai) 
45853e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(755)(ObjectClass *oc, void *data)
45863e770bf7SBruno Larsen (billionai) {
45873e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
45883e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
45893e770bf7SBruno Larsen (billionai) 
45903e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 755";
45913e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_755;
45923e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
45933e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
45943e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
45953e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
45963e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
45973e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
45983e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
45993e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
46003e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
46013e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
46023e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
46033e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
46043e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
46053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
46063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
46073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
46083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
46093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
46103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
46113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
46123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
46133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
46143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
46153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
46163e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
4617fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
46183e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
46193e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
46203e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
46213e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
46223e770bf7SBruno Larsen (billionai) }
46233e770bf7SBruno Larsen (billionai) 
46243e770bf7SBruno Larsen (billionai) static void init_proc_7400(CPUPPCState *env)
46253e770bf7SBruno Larsen (billionai) {
46263e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
46273e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
46283e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
46293e770bf7SBruno Larsen (billionai)     /* 74xx specific SPR */
46303e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
46313e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
4632acf629ebSFabiano Rosas 
46333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
46343e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46353e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46363e770bf7SBruno Larsen (billionai)                  0x00000000);
4637acf629ebSFabiano Rosas 
46383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSCR1, "MSSCR1",
46393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46413e770bf7SBruno Larsen (billionai)                  0x00000000);
46423e770bf7SBruno Larsen (billionai)     /* Thermal management */
46433e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
46443e770bf7SBruno Larsen (billionai)     /* Memory management */
46453e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
46463e770bf7SBruno Larsen (billionai)     init_excp_7400(env);
46473e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
46483e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
46493e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
46503e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
46513e770bf7SBruno Larsen (billionai) }
46523e770bf7SBruno Larsen (billionai) 
46533e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7400)(ObjectClass *oc, void *data)
46543e770bf7SBruno Larsen (billionai) {
46553e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
46563e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
46573e770bf7SBruno Larsen (billionai) 
46583e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7400 (aka G4)";
46593e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7400;
46603e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
46613e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
46623e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
46633e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
46643e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
46653e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
46663e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
46673e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
46683e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
46693e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIA |
46703e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
46713e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
46723e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
46733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
46743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
46753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
46763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
46773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
46783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
46793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
46803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
46813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
46823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
46833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
46843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
46853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
46863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
46873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
46883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
46893e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
46903e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
46913e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
46923e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
46933e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
46943e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
46953e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
46963e770bf7SBruno Larsen (billionai) }
46973e770bf7SBruno Larsen (billionai) 
46983e770bf7SBruno Larsen (billionai) static void init_proc_7410(CPUPPCState *env)
46993e770bf7SBruno Larsen (billionai) {
47003e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
47013e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
47023e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
47033e770bf7SBruno Larsen (billionai)     /* 74xx specific SPR */
47043e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
47053e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
4706acf629ebSFabiano Rosas 
47073e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
47083e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
47093e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
47103e770bf7SBruno Larsen (billionai)                  0x00000000);
47113e770bf7SBruno Larsen (billionai)     /* Thermal management */
47123e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
47133e770bf7SBruno Larsen (billionai)     /* L2PMCR */
4714acf629ebSFabiano Rosas 
47153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2PMCR, "L2PMCR",
47163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47183e770bf7SBruno Larsen (billionai)                  0x00000000);
47193e770bf7SBruno Larsen (billionai)     /* LDSTDB */
4720acf629ebSFabiano Rosas 
47213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTDB, "LDSTDB",
47223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47243e770bf7SBruno Larsen (billionai)                  0x00000000);
47253e770bf7SBruno Larsen (billionai)     /* Memory management */
47263e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
47273e770bf7SBruno Larsen (billionai)     init_excp_7400(env);
47283e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
47293e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
47303e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
47313e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
47323e770bf7SBruno Larsen (billionai) }
47333e770bf7SBruno Larsen (billionai) 
47343e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7410)(ObjectClass *oc, void *data)
47353e770bf7SBruno Larsen (billionai) {
47363e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
47373e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
47383e770bf7SBruno Larsen (billionai) 
47393e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7410 (aka G4)";
47403e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7410;
47413e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
47423e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
47433e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
47443e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
47453e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
47463e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
47473e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
47483e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
47493e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
47503e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIA |
47513e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
47523e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
47533e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
47543e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
47553e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
47563e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
47573e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
47583e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
47593e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
47603e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
47613e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
47623e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
47633e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
47643e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
47653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
47663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
47673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
47683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
47693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
47703e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
47713e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
47723e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
47733e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
47743e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
47753e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
47763e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
47773e770bf7SBruno Larsen (billionai) }
47783e770bf7SBruno Larsen (billionai) 
47793e770bf7SBruno Larsen (billionai) static void init_proc_7440(CPUPPCState *env)
47803e770bf7SBruno Larsen (billionai) {
47813e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
47823e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
47833e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
47843e770bf7SBruno Larsen (billionai)     /* 74xx specific SPR */
47853e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
47863e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
4787acf629ebSFabiano Rosas 
47883e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
47893e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
47903e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
47913e770bf7SBruno Larsen (billionai)                  0x00000000);
47923e770bf7SBruno Larsen (billionai)     /* LDSTCR */
47933e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
47943e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47953e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47963e770bf7SBruno Larsen (billionai)                  0x00000000);
47973e770bf7SBruno Larsen (billionai)     /* ICTRL */
47983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
47993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48013e770bf7SBruno Larsen (billionai)                  0x00000000);
48023e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
48033e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
48043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48063e770bf7SBruno Larsen (billionai)                  0x00000000);
48073e770bf7SBruno Larsen (billionai)     /* PMC */
48083e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
48093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48113e770bf7SBruno Larsen (billionai)                  0x00000000);
4812acf629ebSFabiano Rosas 
48133e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
48143e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48153e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48163e770bf7SBruno Larsen (billionai)                  0x00000000);
4817acf629ebSFabiano Rosas 
48183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
48193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48213e770bf7SBruno Larsen (billionai)                  0x00000000);
4822acf629ebSFabiano Rosas 
48233e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
48243e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48253e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48263e770bf7SBruno Larsen (billionai)                  0x00000000);
48273e770bf7SBruno Larsen (billionai)     /* Memory management */
48283e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
48293e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
48303e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
48313e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
48323e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
48333e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
48343e770bf7SBruno Larsen (billionai) }
48353e770bf7SBruno Larsen (billionai) 
48363e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7440)(ObjectClass *oc, void *data)
48373e770bf7SBruno Larsen (billionai) {
48383e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
48393e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
48403e770bf7SBruno Larsen (billionai) 
48413e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7440 (aka G4)";
48423e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7440;
48433e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
48443e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
48453e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
48463e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
48473e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
48483e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
48493e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
48503e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
48513e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
48521da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
48533e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
48543e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
48553e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
48563e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
48573e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
48583e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
48593e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
48603e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
48613e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
48623e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
48633e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
48643e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
48653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
48663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
48673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
48683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
48693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
48703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
48713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
48721da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
48733e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
48743e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
48753e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
48763e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
48773e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
48783e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
48793e770bf7SBruno Larsen (billionai) }
48803e770bf7SBruno Larsen (billionai) 
48813e770bf7SBruno Larsen (billionai) static void init_proc_7450(CPUPPCState *env)
48823e770bf7SBruno Larsen (billionai) {
48833e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
48843e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
48853e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
48863e770bf7SBruno Larsen (billionai)     /* 74xx specific SPR */
48873e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
48883e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
48893e770bf7SBruno Larsen (billionai)     /* Level 3 cache control */
48903e770bf7SBruno Larsen (billionai)     register_l3_ctrl(env);
48913e770bf7SBruno Larsen (billionai)     /* L3ITCR1 */
48923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR1, "L3ITCR1",
48933e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48943e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48953e770bf7SBruno Larsen (billionai)                  0x00000000);
48963e770bf7SBruno Larsen (billionai)     /* L3ITCR2 */
48973e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR2, "L3ITCR2",
48983e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49003e770bf7SBruno Larsen (billionai)                  0x00000000);
49013e770bf7SBruno Larsen (billionai)     /* L3ITCR3 */
49023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR3, "L3ITCR3",
49033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49043e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49053e770bf7SBruno Larsen (billionai)                  0x00000000);
49063e770bf7SBruno Larsen (billionai)     /* L3OHCR */
49073e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3OHCR, "L3OHCR",
49083e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49093e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49103e770bf7SBruno Larsen (billionai)                  0x00000000);
4911acf629ebSFabiano Rosas 
49123e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
49133e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49143e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49153e770bf7SBruno Larsen (billionai)                  0x00000000);
49163e770bf7SBruno Larsen (billionai)     /* LDSTCR */
49173e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
49183e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49193e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49203e770bf7SBruno Larsen (billionai)                  0x00000000);
49213e770bf7SBruno Larsen (billionai)     /* ICTRL */
49223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
49233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49243e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49253e770bf7SBruno Larsen (billionai)                  0x00000000);
49263e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
49273e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
49283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49293e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49303e770bf7SBruno Larsen (billionai)                  0x00000000);
49313e770bf7SBruno Larsen (billionai)     /* PMC */
49323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
49333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49343e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49353e770bf7SBruno Larsen (billionai)                  0x00000000);
4936acf629ebSFabiano Rosas 
49373e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
49383e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49393e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49403e770bf7SBruno Larsen (billionai)                  0x00000000);
4941acf629ebSFabiano Rosas 
49423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
49433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49453e770bf7SBruno Larsen (billionai)                  0x00000000);
4946acf629ebSFabiano Rosas 
49473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
49483e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49493e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49503e770bf7SBruno Larsen (billionai)                  0x00000000);
49513e770bf7SBruno Larsen (billionai)     /* Memory management */
49523e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
49533e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
49543e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
49553e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
49563e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
49573e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
49583e770bf7SBruno Larsen (billionai) }
49593e770bf7SBruno Larsen (billionai) 
49603e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7450)(ObjectClass *oc, void *data)
49613e770bf7SBruno Larsen (billionai) {
49623e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
49633e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
49643e770bf7SBruno Larsen (billionai) 
49653e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7450 (aka G4)";
49663e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7450;
49673e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
49683e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
49693e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
49703e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
49713e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
49723e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
49733e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
49743e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
49753e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
49761da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
49773e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
49783e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
49793e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
49803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
49813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
49823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
49833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
49843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
49853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
49863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
49873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
49883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
49893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
49903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
49913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
49923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
49933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
49943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
49953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
49961da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
49973e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
49983e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
49993e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
50003e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
50013e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
50023e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
50033e770bf7SBruno Larsen (billionai) }
50043e770bf7SBruno Larsen (billionai) 
50053e770bf7SBruno Larsen (billionai) static void init_proc_7445(CPUPPCState *env)
50063e770bf7SBruno Larsen (billionai) {
50073e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
50083e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
50093e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
50103e770bf7SBruno Larsen (billionai)     /* 74xx specific SPR */
50113e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
50123e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
50133e770bf7SBruno Larsen (billionai)     /* LDSTCR */
50143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
50153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50173e770bf7SBruno Larsen (billionai)                  0x00000000);
50183e770bf7SBruno Larsen (billionai)     /* ICTRL */
50193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
50203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50223e770bf7SBruno Larsen (billionai)                  0x00000000);
50233e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
50243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
50253e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50263e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50273e770bf7SBruno Larsen (billionai)                  0x00000000);
50283e770bf7SBruno Larsen (billionai)     /* PMC */
50293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
50303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50323e770bf7SBruno Larsen (billionai)                  0x00000000);
5033acf629ebSFabiano Rosas 
50343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
50353e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50363e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50373e770bf7SBruno Larsen (billionai)                  0x00000000);
5038acf629ebSFabiano Rosas 
50393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
50403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50413e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50423e770bf7SBruno Larsen (billionai)                  0x00000000);
5043acf629ebSFabiano Rosas 
50443e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
50453e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50463e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50473e770bf7SBruno Larsen (billionai)                  0x00000000);
50483e770bf7SBruno Larsen (billionai)     /* SPRGs */
50493e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
50503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50513e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50523e770bf7SBruno Larsen (billionai)                  0x00000000);
50533e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
50543e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50553e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50563e770bf7SBruno Larsen (billionai)                  0x00000000);
50573e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
50583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50593e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50603e770bf7SBruno Larsen (billionai)                  0x00000000);
50613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
50623e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50633e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50643e770bf7SBruno Larsen (billionai)                  0x00000000);
50653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
50663e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50673e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50683e770bf7SBruno Larsen (billionai)                  0x00000000);
50693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
50703e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50713e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50723e770bf7SBruno Larsen (billionai)                  0x00000000);
50733e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
50743e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50753e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50763e770bf7SBruno Larsen (billionai)                  0x00000000);
50773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
50783e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50793e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50803e770bf7SBruno Larsen (billionai)                  0x00000000);
50813e770bf7SBruno Larsen (billionai)     /* Memory management */
50823e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
50833e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
50843e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
50853e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
50863e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
50873e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
50883e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
50893e770bf7SBruno Larsen (billionai) }
50903e770bf7SBruno Larsen (billionai) 
50913e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7445)(ObjectClass *oc, void *data)
50923e770bf7SBruno Larsen (billionai) {
50933e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
50943e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
50953e770bf7SBruno Larsen (billionai) 
50963e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7445 (aka G4)";
50973e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7445;
50983e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
50993e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
51003e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
51013e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
51023e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
51033e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
51043e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
51053e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
51063e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
51071da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
51083e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
51093e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
51103e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
51113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
51123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
51133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
51143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
51153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
51163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
51173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
51183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
51193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
51203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
51213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
51223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
51233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
51243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
51253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
51263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
51271da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
51283e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
51293e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
51303e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
51313e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
51323e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
51333e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
51343e770bf7SBruno Larsen (billionai) }
51353e770bf7SBruno Larsen (billionai) 
51363e770bf7SBruno Larsen (billionai) static void init_proc_7455(CPUPPCState *env)
51373e770bf7SBruno Larsen (billionai) {
51383e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
51393e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
51403e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
51413e770bf7SBruno Larsen (billionai)     /* 74xx specific SPR */
51423e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
51433e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
51443e770bf7SBruno Larsen (billionai)     /* Level 3 cache control */
51453e770bf7SBruno Larsen (billionai)     register_l3_ctrl(env);
51463e770bf7SBruno Larsen (billionai)     /* LDSTCR */
51473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
51483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
51493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
51503e770bf7SBruno Larsen (billionai)                  0x00000000);
51513e770bf7SBruno Larsen (billionai)     /* ICTRL */
51523e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
51533e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
51543e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
51553e770bf7SBruno Larsen (billionai)                  0x00000000);
51563e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
51573e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
51583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
51593e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
51603e770bf7SBruno Larsen (billionai)                  0x00000000);
51613e770bf7SBruno Larsen (billionai)     /* PMC */
51623e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
51633e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
51643e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
51653e770bf7SBruno Larsen (billionai)                  0x00000000);
5166acf629ebSFabiano Rosas 
51673e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
51683e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51693e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51703e770bf7SBruno Larsen (billionai)                  0x00000000);
5171acf629ebSFabiano Rosas 
51723e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
51733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
51743e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
51753e770bf7SBruno Larsen (billionai)                  0x00000000);
5176acf629ebSFabiano Rosas 
51773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
51783e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51793e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51803e770bf7SBruno Larsen (billionai)                  0x00000000);
51813e770bf7SBruno Larsen (billionai)     /* SPRGs */
51823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
51833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
51843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
51853e770bf7SBruno Larsen (billionai)                  0x00000000);
51863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
51873e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51883e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51893e770bf7SBruno Larsen (billionai)                  0x00000000);
51903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
51913e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
51923e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
51933e770bf7SBruno Larsen (billionai)                  0x00000000);
51943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
51953e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51963e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51973e770bf7SBruno Larsen (billionai)                  0x00000000);
51983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
51993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
52003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
52013e770bf7SBruno Larsen (billionai)                  0x00000000);
52023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
52033e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52043e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52053e770bf7SBruno Larsen (billionai)                  0x00000000);
52063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
52073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
52083e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
52093e770bf7SBruno Larsen (billionai)                  0x00000000);
52103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
52113e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52123e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52133e770bf7SBruno Larsen (billionai)                  0x00000000);
52143e770bf7SBruno Larsen (billionai)     /* Memory management */
52153e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
52163e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
52173e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
52183e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
52193e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
52203e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
52213e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
52223e770bf7SBruno Larsen (billionai) }
52233e770bf7SBruno Larsen (billionai) 
52243e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7455)(ObjectClass *oc, void *data)
52253e770bf7SBruno Larsen (billionai) {
52263e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
52273e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
52283e770bf7SBruno Larsen (billionai) 
52293e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7455 (aka G4)";
52303e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7455;
52313e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
52323e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
52333e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
52343e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
52353e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
52363e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
52373e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
52383e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
52393e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
52401da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
52413e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
52423e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
52433e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
52443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
52453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
52463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
52473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
52483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
52493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
52503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
52513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
52523e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
52533e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
52543e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
52553e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
52563e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
52573e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
52583e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
52593e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
52601da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
52613e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
52623e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
52633e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
52643e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
52653e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
52663e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
52673e770bf7SBruno Larsen (billionai) }
52683e770bf7SBruno Larsen (billionai) 
52693e770bf7SBruno Larsen (billionai) static void init_proc_7457(CPUPPCState *env)
52703e770bf7SBruno Larsen (billionai) {
52713e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
52723e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
52733e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
52743e770bf7SBruno Larsen (billionai)     /* 74xx specific SPR */
52753e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
52763e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
52773e770bf7SBruno Larsen (billionai)     /* Level 3 cache control */
52783e770bf7SBruno Larsen (billionai)     register_l3_ctrl(env);
52793e770bf7SBruno Larsen (billionai)     /* L3ITCR1 */
52803e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR1, "L3ITCR1",
52813e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
52823e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
52833e770bf7SBruno Larsen (billionai)                  0x00000000);
52843e770bf7SBruno Larsen (billionai)     /* L3ITCR2 */
52853e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR2, "L3ITCR2",
52863e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
52873e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
52883e770bf7SBruno Larsen (billionai)                  0x00000000);
52893e770bf7SBruno Larsen (billionai)     /* L3ITCR3 */
52903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR3, "L3ITCR3",
52913e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
52923e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
52933e770bf7SBruno Larsen (billionai)                  0x00000000);
52943e770bf7SBruno Larsen (billionai)     /* L3OHCR */
52953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3OHCR, "L3OHCR",
52963e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
52973e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
52983e770bf7SBruno Larsen (billionai)                  0x00000000);
52993e770bf7SBruno Larsen (billionai)     /* LDSTCR */
53003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
53013e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53023e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53033e770bf7SBruno Larsen (billionai)                  0x00000000);
53043e770bf7SBruno Larsen (billionai)     /* ICTRL */
53053e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
53063e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53073e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53083e770bf7SBruno Larsen (billionai)                  0x00000000);
53093e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
53103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
53113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53133e770bf7SBruno Larsen (billionai)                  0x00000000);
53143e770bf7SBruno Larsen (billionai)     /* PMC */
53153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
53163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53183e770bf7SBruno Larsen (billionai)                  0x00000000);
5319acf629ebSFabiano Rosas 
53203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
53213e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53223e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53233e770bf7SBruno Larsen (billionai)                  0x00000000);
5324acf629ebSFabiano Rosas 
53253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
53263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53283e770bf7SBruno Larsen (billionai)                  0x00000000);
5329acf629ebSFabiano Rosas 
53303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
53313e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53323e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53333e770bf7SBruno Larsen (billionai)                  0x00000000);
53343e770bf7SBruno Larsen (billionai)     /* SPRGs */
53353e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
53363e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53373e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53383e770bf7SBruno Larsen (billionai)                  0x00000000);
53393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
53403e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53413e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53423e770bf7SBruno Larsen (billionai)                  0x00000000);
53433e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
53443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53463e770bf7SBruno Larsen (billionai)                  0x00000000);
53473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
53483e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53493e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53503e770bf7SBruno Larsen (billionai)                  0x00000000);
53513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
53523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53543e770bf7SBruno Larsen (billionai)                  0x00000000);
53553e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
53563e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53573e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53583e770bf7SBruno Larsen (billionai)                  0x00000000);
53593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
53603e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53613e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53623e770bf7SBruno Larsen (billionai)                  0x00000000);
53633e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
53643e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53653e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
53663e770bf7SBruno Larsen (billionai)                  0x00000000);
53673e770bf7SBruno Larsen (billionai)     /* Memory management */
53683e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
53693e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
53703e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
53713e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
53723e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
53733e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
53743e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
53753e770bf7SBruno Larsen (billionai) }
53763e770bf7SBruno Larsen (billionai) 
53773e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7457)(ObjectClass *oc, void *data)
53783e770bf7SBruno Larsen (billionai) {
53793e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
53803e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
53813e770bf7SBruno Larsen (billionai) 
53823e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7457 (aka G4)";
53833e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7457;
53843e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
53853e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
53863e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
53873e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
53883e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
53893e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
53903e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
53913e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
53923e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
53931da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
53943e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
53953e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
53963e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
53973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
53983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
53993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
54003e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
54013e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
54023e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
54033e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
54043e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
54053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
54063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
54073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
54083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
54093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
54103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
54113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
54123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
54131da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
54143e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
54153e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
54163e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
54173e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
54183e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
54193e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
54203e770bf7SBruno Larsen (billionai) }
54213e770bf7SBruno Larsen (billionai) 
54223e770bf7SBruno Larsen (billionai) static void init_proc_e600(CPUPPCState *env)
54233e770bf7SBruno Larsen (billionai) {
54243e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
54253e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
54263e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
54273e770bf7SBruno Larsen (billionai)     /* 74xx specific SPR */
54283e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
54293e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
5430acf629ebSFabiano Rosas 
54313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
54323e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54333e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54343e770bf7SBruno Larsen (billionai)                  0x00000000);
5435acf629ebSFabiano Rosas 
54363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
54373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54383e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54393e770bf7SBruno Larsen (billionai)                  0x00000000);
5440acf629ebSFabiano Rosas 
54413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
54423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54443e770bf7SBruno Larsen (billionai)                  0x00000000);
5445acf629ebSFabiano Rosas 
54463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
54473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54493e770bf7SBruno Larsen (billionai)                  0x00000000);
5450acf629ebSFabiano Rosas 
54513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
54523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54543e770bf7SBruno Larsen (billionai)                  0x00000000);
5455acf629ebSFabiano Rosas 
54563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
54573e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54583e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54593e770bf7SBruno Larsen (billionai)                  0x00000000);
5460acf629ebSFabiano Rosas 
54613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
54623e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54633e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54643e770bf7SBruno Larsen (billionai)                  0x00000000);
5465acf629ebSFabiano Rosas 
54663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
54673e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54683e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54693e770bf7SBruno Larsen (billionai)                  0x00000000);
54703e770bf7SBruno Larsen (billionai)     /* SPRGs */
54713e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
54723e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54733e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54743e770bf7SBruno Larsen (billionai)                  0x00000000);
54753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
54763e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54773e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54783e770bf7SBruno Larsen (billionai)                  0x00000000);
54793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
54803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54823e770bf7SBruno Larsen (billionai)                  0x00000000);
54833e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
54843e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54853e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54863e770bf7SBruno Larsen (billionai)                  0x00000000);
54873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
54883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54903e770bf7SBruno Larsen (billionai)                  0x00000000);
54913e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
54923e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54933e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
54943e770bf7SBruno Larsen (billionai)                  0x00000000);
54953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
54963e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54973e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54983e770bf7SBruno Larsen (billionai)                  0x00000000);
54993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
55003e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
55013e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
55023e770bf7SBruno Larsen (billionai)                  0x00000000);
55033e770bf7SBruno Larsen (billionai)     /* Memory management */
55043e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
55053e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
55063e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
55073e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
55083e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
55093e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
55103e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
55113e770bf7SBruno Larsen (billionai) }
55123e770bf7SBruno Larsen (billionai) 
55133e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e600)(ObjectClass *oc, void *data)
55143e770bf7SBruno Larsen (billionai) {
55153e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
55163e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
55173e770bf7SBruno Larsen (billionai) 
55183e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC e600";
55193e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e600;
55203e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
55213e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
55223e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
55233e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
55243e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
55253e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
55263e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
55273e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
55283e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
5529b137fb72SFabiano Rosas                        PPC_MEM_TLBIA |
55303e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
55313e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
55323e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC_NONE;
55333e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
55343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
55353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
55363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
55373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
55383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
55393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
55403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
55413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
55423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
55433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
55443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
55453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
55463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
55473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
55483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
55493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
55503e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
55513e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
55523e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
55533e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
55543e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
55553e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
55563e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
55573e770bf7SBruno Larsen (billionai) }
55583e770bf7SBruno Larsen (billionai) 
55593e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
55603e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY)
55613e770bf7SBruno Larsen (billionai) #define POWERPC970_HID5_INIT 0x00000080
55623e770bf7SBruno Larsen (billionai) #else
55633e770bf7SBruno Larsen (billionai) #define POWERPC970_HID5_INIT 0x00000000
55643e770bf7SBruno Larsen (billionai) #endif
55653e770bf7SBruno Larsen (billionai) 
55663e770bf7SBruno Larsen (billionai) static int check_pow_970(CPUPPCState *env)
55673e770bf7SBruno Larsen (billionai) {
55683e770bf7SBruno Larsen (billionai)     if (env->spr[SPR_HID0] & (HID0_DEEPNAP | HID0_DOZE | HID0_NAP)) {
55693e770bf7SBruno Larsen (billionai)         return 1;
55703e770bf7SBruno Larsen (billionai)     }
55713e770bf7SBruno Larsen (billionai) 
55723e770bf7SBruno Larsen (billionai)     return 0;
55733e770bf7SBruno Larsen (billionai) }
55743e770bf7SBruno Larsen (billionai) 
55753e770bf7SBruno Larsen (billionai) static void register_970_hid_sprs(CPUPPCState *env)
55763e770bf7SBruno Larsen (billionai) {
55773e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
55783e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
55793e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
55803e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_clear,
55813e770bf7SBruno Larsen (billionai)                  0x60000000);
55823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
55833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
55843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
55853e770bf7SBruno Larsen (billionai)                  0x00000000);
55863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_970_HID5, "HID5",
55873e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
55883e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
55893e770bf7SBruno Larsen (billionai)                  POWERPC970_HID5_INIT);
55903e770bf7SBruno Larsen (billionai) }
55913e770bf7SBruno Larsen (billionai) 
55923e770bf7SBruno Larsen (billionai) static void register_970_hior_sprs(CPUPPCState *env)
55933e770bf7SBruno Larsen (billionai) {
55943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HIOR, "SPR_HIOR",
55953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
55963e770bf7SBruno Larsen (billionai)                  &spr_read_hior, &spr_write_hior,
55973e770bf7SBruno Larsen (billionai)                  0x00000000);
55983e770bf7SBruno Larsen (billionai) }
55993e770bf7SBruno Larsen (billionai) 
56003e770bf7SBruno Larsen (billionai) static void register_book3s_ctrl_sprs(CPUPPCState *env)
56013e770bf7SBruno Larsen (billionai) {
56023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_CTRL, "SPR_CTRL",
56033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
56047aeac354SDaniel Henrique Barboza                  SPR_NOACCESS, &spr_write_CTRL,
56053e770bf7SBruno Larsen (billionai)                  0x00000000);
56063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UCTRL, "SPR_UCTRL",
56073e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
56083e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
56093e770bf7SBruno Larsen (billionai)                  0x00000000);
56103e770bf7SBruno Larsen (billionai) }
56113e770bf7SBruno Larsen (billionai) 
56123e770bf7SBruno Larsen (billionai) static void register_book3s_altivec_sprs(CPUPPCState *env)
56133e770bf7SBruno Larsen (billionai) {
56143e770bf7SBruno Larsen (billionai)     if (!(env->insns_flags & PPC_ALTIVEC)) {
56153e770bf7SBruno Larsen (billionai)         return;
56163e770bf7SBruno Larsen (billionai)     }
56173e770bf7SBruno Larsen (billionai) 
56183e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_VRSAVE, "VRSAVE",
56193e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56203e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56213e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_VRSAVE, 0x00000000);
56223e770bf7SBruno Larsen (billionai) 
56233e770bf7SBruno Larsen (billionai) }
56243e770bf7SBruno Larsen (billionai) 
56253e770bf7SBruno Larsen (billionai) static void register_book3s_dbg_sprs(CPUPPCState *env)
56263e770bf7SBruno Larsen (billionai) {
56273e770bf7SBruno Larsen (billionai)     /*
56283e770bf7SBruno Larsen (billionai)      * TODO: different specs define different scopes for these,
56293e770bf7SBruno Larsen (billionai)      * will have to address this:
56303e770bf7SBruno Larsen (billionai)      * 970: super/write and super/read
56313e770bf7SBruno Larsen (billionai)      * powerisa 2.03..2.04: hypv/write and super/read.
56323e770bf7SBruno Larsen (billionai)      * powerisa 2.05 and newer: hypv/write and hypv/read.
56333e770bf7SBruno Larsen (billionai)      */
56343e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DABR, "DABR",
56353e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56363e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56373e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DABR, 0x00000000);
56383e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DABRX, "DABRX",
56393e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56403e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56413e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DABRX, 0x00000000);
56423e770bf7SBruno Larsen (billionai) }
56433e770bf7SBruno Larsen (billionai) 
56443e770bf7SBruno Larsen (billionai) static void register_book3s_207_dbg_sprs(CPUPPCState *env)
56453e770bf7SBruno Larsen (billionai) {
56463e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_DAWR0, "DAWR0",
56473e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56483e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56493e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_generic,
56503e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_DAWR, 0x00000000);
56513e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_DAWRX0, "DAWRX0",
56523e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56533e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56543e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_generic,
56553e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_DAWRX, 0x00000000);
56563e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_CIABR, "CIABR",
56573e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56583e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56593e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_generic,
56603e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_CIABR, 0x00000000);
56613e770bf7SBruno Larsen (billionai) }
56623e770bf7SBruno Larsen (billionai) 
56633e770bf7SBruno Larsen (billionai) static void register_970_dbg_sprs(CPUPPCState *env)
56643e770bf7SBruno Larsen (billionai) {
56653e770bf7SBruno Larsen (billionai)     /* Breakpoints */
56663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
56673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
56683e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
56693e770bf7SBruno Larsen (billionai)                  0x00000000);
56703e770bf7SBruno Larsen (billionai) }
56713e770bf7SBruno Larsen (billionai) 
56723e770bf7SBruno Larsen (billionai) static void register_book3s_pmu_sup_sprs(CPUPPCState *env)
56733e770bf7SBruno Larsen (billionai) {
56743e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCR0, "MMCR0",
56753e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5676c2eff582SDaniel Henrique Barboza                      &spr_read_generic, &spr_write_MMCR0,
5677c2eff582SDaniel Henrique Barboza                      KVM_REG_PPC_MMCR0, 0x80000000);
56783e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCR1, "MMCR1",
56793e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5680a6f91249SDaniel Henrique Barboza                      &spr_read_generic, &spr_write_MMCR1,
56813e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_MMCR1, 0x00000000);
56823e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCRA, "MMCRA",
56833e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56843e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56853e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_MMCRA, 0x00000000);
56863e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC1, "PMC1",
56873e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5688308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
56893e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC1, 0x00000000);
56903e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC2, "PMC2",
56913e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5692308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
56933e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC2, 0x00000000);
56943e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC3, "PMC3",
56953e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5696308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
56973e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC3, 0x00000000);
56983e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC4, "PMC4",
56993e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5700308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
57013e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC4, 0x00000000);
57023e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC5, "PMC5",
57033e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5704308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
57053e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC5, 0x00000000);
57063e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC6, "PMC6",
57073e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5708308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
57093e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC6, 0x00000000);
57103e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SIAR, "SIAR",
57113e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
57123e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
57133e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SIAR, 0x00000000);
57143e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SDAR, "SDAR",
57153e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
57163e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
57173e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SDAR, 0x00000000);
57183e770bf7SBruno Larsen (billionai) }
57193e770bf7SBruno Larsen (billionai) 
57203e770bf7SBruno Larsen (billionai) static void register_book3s_pmu_user_sprs(CPUPPCState *env)
57213e770bf7SBruno Larsen (billionai) {
57223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UMMCR0, "UMMCR0",
5723565cb109SGustavo Romero                  &spr_read_MMCR0_ureg, &spr_write_MMCR0_ureg,
57243e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
5725c2eff582SDaniel Henrique Barboza                  0x80000000);
57263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UMMCR1, "UMMCR1",
57273e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
57283e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57293e770bf7SBruno Larsen (billionai)                  0x00000000);
57303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UMMCRA, "UMMCRA",
57313e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
57323e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57333e770bf7SBruno Larsen (billionai)                  0x00000000);
57343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC1, "UPMC1",
5735cedf7069SDaniel Henrique Barboza                  &spr_read_PMC14_ureg, &spr_write_PMC14_ureg,
57363e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57373e770bf7SBruno Larsen (billionai)                  0x00000000);
57383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC2, "UPMC2",
5739cedf7069SDaniel Henrique Barboza                  &spr_read_PMC14_ureg, &spr_write_PMC14_ureg,
57403e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57413e770bf7SBruno Larsen (billionai)                  0x00000000);
57423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC3, "UPMC3",
5743cedf7069SDaniel Henrique Barboza                  &spr_read_PMC14_ureg, &spr_write_PMC14_ureg,
57443e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57453e770bf7SBruno Larsen (billionai)                  0x00000000);
57463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC4, "UPMC4",
5747cedf7069SDaniel Henrique Barboza                  &spr_read_PMC14_ureg, &spr_write_PMC14_ureg,
57483e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57493e770bf7SBruno Larsen (billionai)                  0x00000000);
57503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC5, "UPMC5",
5751cedf7069SDaniel Henrique Barboza                  &spr_read_PMC56_ureg, &spr_write_PMC56_ureg,
57523e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57533e770bf7SBruno Larsen (billionai)                  0x00000000);
57543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC6, "UPMC6",
5755cedf7069SDaniel Henrique Barboza                  &spr_read_PMC56_ureg, &spr_write_PMC56_ureg,
57563e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57573e770bf7SBruno Larsen (billionai)                  0x00000000);
57583e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_USIAR, "USIAR",
57593e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
57603e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57613e770bf7SBruno Larsen (billionai)                  0x00000000);
57623e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_USDAR, "USDAR",
57633e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
57643e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57653e770bf7SBruno Larsen (billionai)                  0x00000000);
57663e770bf7SBruno Larsen (billionai) }
57673e770bf7SBruno Larsen (billionai) 
57683e770bf7SBruno Larsen (billionai) static void register_970_pmu_sup_sprs(CPUPPCState *env)
57693e770bf7SBruno Larsen (billionai) {
57703e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_970_PMC7, "PMC7",
57713e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
57723e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
57733e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC7, 0x00000000);
57743e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_970_PMC8, "PMC8",
57753e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
57763e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
57773e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC8, 0x00000000);
57783e770bf7SBruno Larsen (billionai) }
57793e770bf7SBruno Larsen (billionai) 
57803e770bf7SBruno Larsen (billionai) static void register_970_pmu_user_sprs(CPUPPCState *env)
57813e770bf7SBruno Larsen (billionai) {
57823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_970_UPMC7, "UPMC7",
57833e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
57843e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57853e770bf7SBruno Larsen (billionai)                  0x00000000);
57863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_970_UPMC8, "UPMC8",
57873e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
57883e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
57893e770bf7SBruno Larsen (billionai)                  0x00000000);
57903e770bf7SBruno Larsen (billionai) }
57913e770bf7SBruno Larsen (billionai) 
57923e770bf7SBruno Larsen (billionai) static void register_power8_pmu_sup_sprs(CPUPPCState *env)
57933e770bf7SBruno Larsen (billionai) {
57943e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCR2, "MMCR2",
57953e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
57963e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
57973e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_MMCR2, 0x00000000);
57983e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCRS, "MMCRS",
57993e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
58003e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
58013e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_MMCRS, 0x00000000);
58023e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SIER, "SIER",
58033e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
58043e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
58053e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SIER, 0x00000000);
58063e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SPMC1, "SPMC1",
58073e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
58083e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
58093e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SPMC1, 0x00000000);
58103e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SPMC2, "SPMC2",
58113e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
58123e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
58133e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SPMC2, 0x00000000);
58143e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TACR, "TACR",
58153e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
58163e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
58173e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TACR, 0x00000000);
58183e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TCSCR, "TCSCR",
58193e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
58203e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
58213e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TCSCR, 0x00000000);
58223e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_CSIGR, "CSIGR",
58233e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
58243e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
58253e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_CSIGR, 0x00000000);
58263e770bf7SBruno Larsen (billionai) }
58273e770bf7SBruno Larsen (billionai) 
58283e770bf7SBruno Larsen (billionai) static void register_power8_pmu_user_sprs(CPUPPCState *env)
58293e770bf7SBruno Larsen (billionai) {
58303e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UMMCR2, "UMMCR2",
58317b3ecf16SDaniel Henrique Barboza                  &spr_read_MMCR2_ureg, &spr_write_MMCR2_ureg,
58323e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
58333e770bf7SBruno Larsen (billionai)                  0x00000000);
58343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_USIER, "USIER",
58353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
58363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
58373e770bf7SBruno Larsen (billionai)                  0x00000000);
58383e770bf7SBruno Larsen (billionai) }
58393e770bf7SBruno Larsen (billionai) 
58403e770bf7SBruno Larsen (billionai) static void register_power5p_ear_sprs(CPUPPCState *env)
58413e770bf7SBruno Larsen (billionai) {
58423e770bf7SBruno Larsen (billionai)     /* External access control */
58433e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_EAR, "EAR",
58443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
58453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
58463e770bf7SBruno Larsen (billionai)                  0x00000000);
58473e770bf7SBruno Larsen (billionai) }
58483e770bf7SBruno Larsen (billionai) 
58493e770bf7SBruno Larsen (billionai) static void register_power5p_tb_sprs(CPUPPCState *env)
58503e770bf7SBruno Larsen (billionai) {
58513e770bf7SBruno Larsen (billionai)     /* TBU40 (High 40 bits of the Timebase register */
58523e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_TBU40, "TBU40",
58533e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
58543e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
58553e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, &spr_write_tbu40,
58563e770bf7SBruno Larsen (billionai)                     0x00000000);
58573e770bf7SBruno Larsen (billionai) }
58583e770bf7SBruno Larsen (billionai) 
58593e770bf7SBruno Larsen (billionai) static void register_970_lpar_sprs(CPUPPCState *env)
58603e770bf7SBruno Larsen (billionai) {
58613e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
58623e770bf7SBruno Larsen (billionai)     /*
58633e770bf7SBruno Larsen (billionai)      * PPC970: HID4 covers things later controlled by the LPCR and
58643e770bf7SBruno Larsen (billionai)      * RMOR in later CPUs, but with a different encoding.  We only
58653e770bf7SBruno Larsen (billionai)      * support the 970 in "Apple mode" which has all hypervisor
58663e770bf7SBruno Larsen (billionai)      * facilities disabled by strapping, so we can basically just
58673e770bf7SBruno Larsen (billionai)      * ignore it
58683e770bf7SBruno Larsen (billionai)      */
58693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_970_HID4, "HID4",
58703e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
58713e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
58723e770bf7SBruno Larsen (billionai)                  0x00000000);
58733e770bf7SBruno Larsen (billionai) #endif
58743e770bf7SBruno Larsen (billionai) }
58753e770bf7SBruno Larsen (billionai) 
58763e770bf7SBruno Larsen (billionai) static void register_power5p_lpar_sprs(CPUPPCState *env)
58773e770bf7SBruno Larsen (billionai) {
58783e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
58793e770bf7SBruno Larsen (billionai)     /* Logical partitionning */
58803e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_LPCR, "LPCR",
58813e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
58823e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
58833e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_lpcr,
58843e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_LPCR, LPCR_LPES0 | LPCR_LPES1);
58853e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HDEC, "HDEC",
58863e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
58873e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
58883e770bf7SBruno Larsen (billionai)                     &spr_read_hdecr, &spr_write_hdecr, 0);
58893e770bf7SBruno Larsen (billionai) #endif
58903e770bf7SBruno Larsen (billionai) }
58913e770bf7SBruno Larsen (billionai) 
58923e770bf7SBruno Larsen (billionai) static void register_book3s_ids_sprs(CPUPPCState *env)
58933e770bf7SBruno Larsen (billionai) {
58943e770bf7SBruno Larsen (billionai)     /* FIXME: Will need to deal with thread vs core only SPRs */
58953e770bf7SBruno Larsen (billionai) 
58963e770bf7SBruno Larsen (billionai)     /* Processor identification */
58973e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_PIR, "PIR",
58983e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
58993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
59003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, NULL,
59013e770bf7SBruno Larsen (billionai)                  0x00000000);
59023e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HID0, "HID0",
59033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59063e770bf7SBruno Larsen (billionai)                  0x00000000);
59073e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_TSCR, "TSCR",
59083e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59113e770bf7SBruno Larsen (billionai)                  0x00000000);
59123e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HMER, "HMER",
59133e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59143e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59153e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_hmer,
59163e770bf7SBruno Larsen (billionai)                  0x00000000);
59173e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HMEER, "HMEER",
59183e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59213e770bf7SBruno Larsen (billionai)                  0x00000000);
59223e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_TFMR, "TFMR",
59233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59243e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59253e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59263e770bf7SBruno Larsen (billionai)                  0x00000000);
59273e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_LPIDR, "LPIDR",
59283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59293e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59303e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_lpidr,
59313e770bf7SBruno Larsen (billionai)                  0x00000000);
59323e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HFSCR, "HFSCR",
59333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59363e770bf7SBruno Larsen (billionai)                  0x00000000);
59373e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_MMCRC, "MMCRC",
59383e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59413e770bf7SBruno Larsen (billionai)                  0x00000000);
59423e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_MMCRH, "MMCRH",
59433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59463e770bf7SBruno Larsen (billionai)                  0x00000000);
59473e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HSPRG0, "HSPRG0",
59483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59493e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59503e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59513e770bf7SBruno Larsen (billionai)                  0x00000000);
59523e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HSPRG1, "HSPRG1",
59533e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59543e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59553e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59563e770bf7SBruno Larsen (billionai)                  0x00000000);
59573e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HSRR0, "HSRR0",
59583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59593e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59603e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59613e770bf7SBruno Larsen (billionai)                  0x00000000);
59623e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HSRR1, "HSRR1",
59633e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59643e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59653e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59663e770bf7SBruno Larsen (billionai)                  0x00000000);
59673e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HDAR, "HDAR",
59683e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59693e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59703e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59713e770bf7SBruno Larsen (billionai)                  0x00000000);
59723e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HDSISR, "HDSISR",
59733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59743e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59753e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59763e770bf7SBruno Larsen (billionai)                  0x00000000);
59773e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HRMOR, "HRMOR",
59783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59793e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59803e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59813e770bf7SBruno Larsen (billionai)                  0x00000000);
59823e770bf7SBruno Larsen (billionai) }
59833e770bf7SBruno Larsen (billionai) 
59843e770bf7SBruno Larsen (billionai) static void register_rmor_sprs(CPUPPCState *env)
59853e770bf7SBruno Larsen (billionai) {
59863e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_RMOR, "RMOR",
59873e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
59903e770bf7SBruno Larsen (billionai)                  0x00000000);
59913e770bf7SBruno Larsen (billionai) }
59923e770bf7SBruno Larsen (billionai) 
59933e770bf7SBruno Larsen (billionai) static void register_power8_ids_sprs(CPUPPCState *env)
59943e770bf7SBruno Larsen (billionai) {
59953e770bf7SBruno Larsen (billionai)     /* Thread identification */
59963e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_TIR, "TIR",
59973e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
59983e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
59993e770bf7SBruno Larsen (billionai)                  0x00000000);
60003e770bf7SBruno Larsen (billionai) }
60013e770bf7SBruno Larsen (billionai) 
60023e770bf7SBruno Larsen (billionai) static void register_book3s_purr_sprs(CPUPPCState *env)
60033e770bf7SBruno Larsen (billionai) {
60043e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
60053e770bf7SBruno Larsen (billionai)     /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
60063e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_PURR,   "PURR",
60073e770bf7SBruno Larsen (billionai)                         &spr_read_purr, SPR_NOACCESS,
60083e770bf7SBruno Larsen (billionai)                         &spr_read_purr, SPR_NOACCESS,
60093e770bf7SBruno Larsen (billionai)                         &spr_read_purr, &spr_write_purr,
60103e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_PURR, 0x00000000);
60113e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_SPURR,   "SPURR",
60123e770bf7SBruno Larsen (billionai)                         &spr_read_purr, SPR_NOACCESS,
60133e770bf7SBruno Larsen (billionai)                         &spr_read_purr, SPR_NOACCESS,
60143e770bf7SBruno Larsen (billionai)                         &spr_read_purr, &spr_write_purr,
60153e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_SPURR, 0x00000000);
60163e770bf7SBruno Larsen (billionai) #endif
60173e770bf7SBruno Larsen (billionai) }
60183e770bf7SBruno Larsen (billionai) 
60193e770bf7SBruno Larsen (billionai) static void register_power6_dbg_sprs(CPUPPCState *env)
60203e770bf7SBruno Larsen (billionai) {
60213e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
60223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_CFAR, "SPR_CFAR",
60233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
60243e770bf7SBruno Larsen (billionai)                  &spr_read_cfar, &spr_write_cfar,
60253e770bf7SBruno Larsen (billionai)                  0x00000000);
60263e770bf7SBruno Larsen (billionai) #endif
60273e770bf7SBruno Larsen (billionai) }
60283e770bf7SBruno Larsen (billionai) 
60293e770bf7SBruno Larsen (billionai) static void register_power5p_common_sprs(CPUPPCState *env)
60303e770bf7SBruno Larsen (billionai) {
60313e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_PPR, "PPR",
60323e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
60333e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
60343e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PPR, 0x00000000);
60353e770bf7SBruno Larsen (billionai) }
60363e770bf7SBruno Larsen (billionai) 
60373e770bf7SBruno Larsen (billionai) static void register_power6_common_sprs(CPUPPCState *env)
60383e770bf7SBruno Larsen (billionai) {
60393e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
60403e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DSCR, "SPR_DSCR",
60413e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
60423e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
60433e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DSCR, 0x00000000);
60443e770bf7SBruno Larsen (billionai) #endif
60453e770bf7SBruno Larsen (billionai)     /*
60463e770bf7SBruno Larsen (billionai)      * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
60473e770bf7SBruno Larsen (billionai)      * POWERPC_EXCP_INVAL_SPR in userspace. Permit hypervisor access.
60483e770bf7SBruno Larsen (billionai)      */
60493e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_PCR, "PCR",
60503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
60513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
60523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pcr,
60533e770bf7SBruno Larsen (billionai)                  0x00000000);
60543e770bf7SBruno Larsen (billionai) }
60553e770bf7SBruno Larsen (billionai) 
60563e770bf7SBruno Larsen (billionai) static void register_power8_tce_address_control_sprs(CPUPPCState *env)
60573e770bf7SBruno Larsen (billionai) {
60583e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TAR, "TAR",
60593e770bf7SBruno Larsen (billionai)                      &spr_read_tar, &spr_write_tar,
60603e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
60613e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TAR, 0x00000000);
60623e770bf7SBruno Larsen (billionai) }
60633e770bf7SBruno Larsen (billionai) 
60643e770bf7SBruno Larsen (billionai) static void register_power8_tm_sprs(CPUPPCState *env)
60653e770bf7SBruno Larsen (billionai) {
60663e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TFHAR, "TFHAR",
60673e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
60683e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
60693e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TFHAR, 0x00000000);
60703e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TFIAR, "TFIAR",
60713e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
60723e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
60733e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TFIAR, 0x00000000);
60743e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TEXASR, "TEXASR",
60753e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
60763e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
60773e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TEXASR, 0x00000000);
60783e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_TEXASRU, "TEXASRU",
60793e770bf7SBruno Larsen (billionai)                  &spr_read_tm_upper32, &spr_write_tm_upper32,
60803e770bf7SBruno Larsen (billionai)                  &spr_read_tm_upper32, &spr_write_tm_upper32,
60813e770bf7SBruno Larsen (billionai)                  0x00000000);
60823e770bf7SBruno Larsen (billionai) }
60833e770bf7SBruno Larsen (billionai) 
60843e770bf7SBruno Larsen (billionai) static void register_power8_ebb_sprs(CPUPPCState *env)
60853e770bf7SBruno Larsen (billionai) {
60863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BESCRS, "BESCRS",
60873e770bf7SBruno Larsen (billionai)                  &spr_read_ebb, &spr_write_ebb,
60883e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
60893e770bf7SBruno Larsen (billionai)                  0x00000000);
60903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BESCRSU, "BESCRSU",
60913e770bf7SBruno Larsen (billionai)                  &spr_read_ebb_upper32, &spr_write_ebb_upper32,
60923e770bf7SBruno Larsen (billionai)                  &spr_read_prev_upper32, &spr_write_prev_upper32,
60933e770bf7SBruno Larsen (billionai)                  0x00000000);
60943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BESCRR, "BESCRR",
60953e770bf7SBruno Larsen (billionai)                  &spr_read_ebb, &spr_write_ebb,
60963e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
60973e770bf7SBruno Larsen (billionai)                  0x00000000);
60983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BESCRRU, "BESCRRU",
60993e770bf7SBruno Larsen (billionai)                  &spr_read_ebb_upper32, &spr_write_ebb_upper32,
61003e770bf7SBruno Larsen (billionai)                  &spr_read_prev_upper32, &spr_write_prev_upper32,
61013e770bf7SBruno Larsen (billionai)                  0x00000000);
61023e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_EBBHR, "EBBHR",
61033e770bf7SBruno Larsen (billionai)                      &spr_read_ebb, &spr_write_ebb,
61043e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
61053e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_EBBHR, 0x00000000);
61063e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_EBBRR, "EBBRR",
61073e770bf7SBruno Larsen (billionai)                      &spr_read_ebb, &spr_write_ebb,
61083e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
61093e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_EBBRR, 0x00000000);
61103e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_BESCR, "BESCR",
61113e770bf7SBruno Larsen (billionai)                      &spr_read_ebb, &spr_write_ebb,
61123e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
61133e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_BESCR, 0x00000000);
61143e770bf7SBruno Larsen (billionai) }
61153e770bf7SBruno Larsen (billionai) 
61163e770bf7SBruno Larsen (billionai) /* Virtual Time Base */
61173e770bf7SBruno Larsen (billionai) static void register_vtb_sprs(CPUPPCState *env)
61183e770bf7SBruno Larsen (billionai) {
61193e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_VTB, "VTB",
61203e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
61213e770bf7SBruno Larsen (billionai)                         &spr_read_vtb, SPR_NOACCESS,
61223e770bf7SBruno Larsen (billionai)                         &spr_read_vtb, &spr_write_vtb,
61233e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_VTB, 0x00000000);
61243e770bf7SBruno Larsen (billionai) }
61253e770bf7SBruno Larsen (billionai) 
61263e770bf7SBruno Larsen (billionai) static void register_power8_fscr_sprs(CPUPPCState *env)
61273e770bf7SBruno Larsen (billionai) {
61283e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY)
61293e770bf7SBruno Larsen (billionai)     target_ulong initval = 1ULL << FSCR_TAR;
61303e770bf7SBruno Larsen (billionai) #else
61313e770bf7SBruno Larsen (billionai)     target_ulong initval = 0;
61323e770bf7SBruno Larsen (billionai) #endif
61333e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_FSCR, "FSCR",
61343e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
61353e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
61363e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_FSCR, initval);
61373e770bf7SBruno Larsen (billionai) }
61383e770bf7SBruno Larsen (billionai) 
61393e770bf7SBruno Larsen (billionai) static void register_power8_pspb_sprs(CPUPPCState *env)
61403e770bf7SBruno Larsen (billionai) {
61413e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_PSPB, "PSPB",
61423e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
61433e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic32,
61443e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PSPB, 0);
61453e770bf7SBruno Larsen (billionai) }
61463e770bf7SBruno Larsen (billionai) 
61473e770bf7SBruno Larsen (billionai) static void register_power8_dpdes_sprs(CPUPPCState *env)
61483e770bf7SBruno Larsen (billionai) {
61493e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
61503e770bf7SBruno Larsen (billionai)     /* Directed Privileged Door-bell Exception State, used for IPI */
61513e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_DPDES, "DPDES",
61523e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
61533e770bf7SBruno Larsen (billionai)                         &spr_read_dpdes, SPR_NOACCESS,
61543e770bf7SBruno Larsen (billionai)                         &spr_read_dpdes, &spr_write_dpdes,
61553e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_DPDES, 0x00000000);
61563e770bf7SBruno Larsen (billionai) #endif
61573e770bf7SBruno Larsen (billionai) }
61583e770bf7SBruno Larsen (billionai) 
61593e770bf7SBruno Larsen (billionai) static void register_power8_ic_sprs(CPUPPCState *env)
61603e770bf7SBruno Larsen (billionai) {
61613e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
61623e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_IC, "IC",
61633e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
61643e770bf7SBruno Larsen (billionai)                     &spr_read_generic, SPR_NOACCESS,
61653e770bf7SBruno Larsen (billionai)                     &spr_read_generic, &spr_write_generic,
61663e770bf7SBruno Larsen (billionai)                     0);
61673e770bf7SBruno Larsen (billionai) #endif
61683e770bf7SBruno Larsen (billionai) }
61693e770bf7SBruno Larsen (billionai) 
61703e770bf7SBruno Larsen (billionai) static void register_power8_book4_sprs(CPUPPCState *env)
61713e770bf7SBruno Larsen (billionai) {
61723e770bf7SBruno Larsen (billionai)     /* Add a number of P8 book4 registers */
61733e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
61743e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_ACOP, "ACOP",
61753e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
61763e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
61773e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_ACOP, 0);
61783e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_BOOKS_PID, "PID",
61793e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
61803e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_pidr,
61813e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PID, 0);
61823e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_WORT, "WORT",
61833e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
61843e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
61853e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_WORT, 0);
61863e770bf7SBruno Larsen (billionai) #endif
61873e770bf7SBruno Larsen (billionai) }
61883e770bf7SBruno Larsen (billionai) 
61893e770bf7SBruno Larsen (billionai) static void register_power7_book4_sprs(CPUPPCState *env)
61903e770bf7SBruno Larsen (billionai) {
61913e770bf7SBruno Larsen (billionai)     /* Add a number of P7 book4 registers */
61923e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
61933e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_ACOP, "ACOP",
61943e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
61953e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
61963e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_ACOP, 0);
61973e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_BOOKS_PID, "PID",
61983e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
61993e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
62003e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PID, 0);
62013e770bf7SBruno Larsen (billionai) #endif
62023e770bf7SBruno Larsen (billionai) }
62033e770bf7SBruno Larsen (billionai) 
62043e770bf7SBruno Larsen (billionai) static void register_power8_rpr_sprs(CPUPPCState *env)
62053e770bf7SBruno Larsen (billionai) {
62063e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
62073e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_RPR, "RPR",
62083e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
62093e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
62103e770bf7SBruno Larsen (billionai)                     &spr_read_generic, &spr_write_generic,
62113e770bf7SBruno Larsen (billionai)                     0x00000103070F1F3F);
62123e770bf7SBruno Larsen (billionai) #endif
62133e770bf7SBruno Larsen (billionai) }
62143e770bf7SBruno Larsen (billionai) 
62153e770bf7SBruno Larsen (billionai) static void register_power9_mmu_sprs(CPUPPCState *env)
62163e770bf7SBruno Larsen (billionai) {
62173e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
62183e770bf7SBruno Larsen (billionai)     /* Partition Table Control */
62193e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_PTCR, "PTCR",
62203e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
62213e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
62223e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_ptcr,
62233e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_PTCR, 0x00000000);
62243e770bf7SBruno Larsen (billionai)     /* Address Segment Descriptor Register */
62253e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_ASDR, "ASDR",
62263e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
62273e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
62283e770bf7SBruno Larsen (billionai)                     &spr_read_generic, &spr_write_generic,
62293e770bf7SBruno Larsen (billionai)                     0x0000000000000000);
62303e770bf7SBruno Larsen (billionai) #endif
62313e770bf7SBruno Larsen (billionai) }
62323e770bf7SBruno Larsen (billionai) 
62338f2e9d40SDaniel Henrique Barboza /*
62348f2e9d40SDaniel Henrique Barboza  * Initialize PMU counter overflow timers for Power8 and
62358f2e9d40SDaniel Henrique Barboza  * newer Power chips when using TCG.
62368f2e9d40SDaniel Henrique Barboza  */
62378f2e9d40SDaniel Henrique Barboza static void init_tcg_pmu_power8(CPUPPCState *env)
62388f2e9d40SDaniel Henrique Barboza {
62398f2e9d40SDaniel Henrique Barboza #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
62408f2e9d40SDaniel Henrique Barboza     /* Init PMU overflow timers */
62418f2e9d40SDaniel Henrique Barboza     if (!kvm_enabled()) {
62428f2e9d40SDaniel Henrique Barboza         cpu_ppc_pmu_init(env);
62438f2e9d40SDaniel Henrique Barboza     }
62448f2e9d40SDaniel Henrique Barboza #endif
62458f2e9d40SDaniel Henrique Barboza }
62468f2e9d40SDaniel Henrique Barboza 
62473e770bf7SBruno Larsen (billionai) static void init_proc_book3s_common(CPUPPCState *env)
62483e770bf7SBruno Larsen (billionai) {
62493e770bf7SBruno Larsen (billionai)     register_ne_601_sprs(env);
62503e770bf7SBruno Larsen (billionai)     register_usprg3_sprs(env);
62513e770bf7SBruno Larsen (billionai)     register_book3s_altivec_sprs(env);
62523e770bf7SBruno Larsen (billionai)     register_book3s_pmu_sup_sprs(env);
62533e770bf7SBruno Larsen (billionai)     register_book3s_pmu_user_sprs(env);
62543e770bf7SBruno Larsen (billionai)     register_book3s_ctrl_sprs(env);
62553e770bf7SBruno Larsen (billionai)     /*
62563e770bf7SBruno Larsen (billionai)      * Can't find information on what this should be on reset.  This
62573e770bf7SBruno Larsen (billionai)      * value is the one used by 74xx processors.
62583e770bf7SBruno Larsen (billionai)      */
62593e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
62603e770bf7SBruno Larsen (billionai) }
62613e770bf7SBruno Larsen (billionai) 
62623e770bf7SBruno Larsen (billionai) static void init_proc_970(CPUPPCState *env)
62633e770bf7SBruno Larsen (billionai) {
62643e770bf7SBruno Larsen (billionai)     /* Common Registers */
62653e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
62663e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
62673e770bf7SBruno Larsen (billionai)     register_book3s_dbg_sprs(env);
62683e770bf7SBruno Larsen (billionai) 
62693e770bf7SBruno Larsen (billionai)     /* 970 Specific Registers */
62703e770bf7SBruno Larsen (billionai)     register_970_hid_sprs(env);
62713e770bf7SBruno Larsen (billionai)     register_970_hior_sprs(env);
62723e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
62733e770bf7SBruno Larsen (billionai)     register_970_pmu_sup_sprs(env);
62743e770bf7SBruno Larsen (billionai)     register_970_pmu_user_sprs(env);
62753e770bf7SBruno Larsen (billionai)     register_970_lpar_sprs(env);
62763e770bf7SBruno Larsen (billionai)     register_970_dbg_sprs(env);
62773e770bf7SBruno Larsen (billionai) 
62783e770bf7SBruno Larsen (billionai)     /* env variables */
62793e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
62803e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
62813e770bf7SBruno Larsen (billionai) 
62823e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
62833e770bf7SBruno Larsen (billionai)     init_excp_970(env);
62843e770bf7SBruno Larsen (billionai)     ppc970_irq_init(env_archcpu(env));
62853e770bf7SBruno Larsen (billionai) }
62863e770bf7SBruno Larsen (billionai) 
62873e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(970)(ObjectClass *oc, void *data)
62883e770bf7SBruno Larsen (billionai) {
62893e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
62903e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
62913e770bf7SBruno Larsen (billionai) 
62923e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 970";
62933e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_970;
62943e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_970;
62953e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
62963e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
62973e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
62983e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
62993e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
63003e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
63013e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
63023e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_ALTIVEC |
63033e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI;
63043e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_FP_CVT_S64;
63053e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
63063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
63073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
63083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
63093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
63103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
63113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
63123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
63133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
63143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
63153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
63163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
63173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
63183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
63193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
63203e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_64B;
63213e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
63223e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_basic;
63233e770bf7SBruno Larsen (billionai) #endif
63243e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_970;
63253e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_970;
63263e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
63273e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
63283e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
63293e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
63303e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
63313e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x10000;
63323e770bf7SBruno Larsen (billionai) }
63333e770bf7SBruno Larsen (billionai) 
63343e770bf7SBruno Larsen (billionai) static void init_proc_power5plus(CPUPPCState *env)
63353e770bf7SBruno Larsen (billionai) {
63363e770bf7SBruno Larsen (billionai)     /* Common Registers */
63373e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
63383e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
63393e770bf7SBruno Larsen (billionai)     register_book3s_dbg_sprs(env);
63403e770bf7SBruno Larsen (billionai) 
63413e770bf7SBruno Larsen (billionai)     /* POWER5+ Specific Registers */
63423e770bf7SBruno Larsen (billionai)     register_970_hid_sprs(env);
63433e770bf7SBruno Larsen (billionai)     register_970_hior_sprs(env);
63443e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
63453e770bf7SBruno Larsen (billionai)     register_970_pmu_sup_sprs(env);
63463e770bf7SBruno Larsen (billionai)     register_970_pmu_user_sprs(env);
63473e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
63483e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
63493e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
63503e770bf7SBruno Larsen (billionai)     register_power5p_tb_sprs(env);
63513e770bf7SBruno Larsen (billionai) 
63523e770bf7SBruno Larsen (billionai)     /* env variables */
63533e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
63543e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
63553e770bf7SBruno Larsen (billionai) 
63563e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
63573e770bf7SBruno Larsen (billionai)     init_excp_970(env);
63583e770bf7SBruno Larsen (billionai)     ppc970_irq_init(env_archcpu(env));
63593e770bf7SBruno Larsen (billionai) }
63603e770bf7SBruno Larsen (billionai) 
63613e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data)
63623e770bf7SBruno Larsen (billionai) {
63633e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
63643e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
63653e770bf7SBruno Larsen (billionai) 
63663e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER5";
63673e770bf7SBruno Larsen (billionai)     dc->desc = "POWER5+";
63683e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_power5plus;
63693e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_970;
63703e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
63713e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
63723e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
63733e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
637491137619SCédric Le Goater                        PPC_FLOAT_EXT |
63753e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
63763e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
63773e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
63783e770bf7SBruno Larsen (billionai)                        PPC_64B |
637923ab6d88SCédric Le Goater                        PPC_POPCNTB |
63803e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI;
63813e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_FP_CVT_S64;
63823e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
63833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
63843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
63853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
63863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
63873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
63883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
63893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
63903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
63913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
63923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
63933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
63943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
63953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
63963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
63973e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_RMLS | LPCR_ILE | LPCR_LPES0 | LPCR_LPES1 |
63983e770bf7SBruno Larsen (billionai)         LPCR_RMI | LPCR_HDICE;
63993e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_2_03;
64003e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
64013e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_basic;
64023e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 32;
64033e770bf7SBruno Larsen (billionai) #endif
64043e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_970;
64053e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_970;
64063e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
64073e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
64083e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
64093e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
64103e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
64113e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x10000;
64123e770bf7SBruno Larsen (billionai) }
64133e770bf7SBruno Larsen (billionai) 
64143e770bf7SBruno Larsen (billionai) static void init_proc_POWER7(CPUPPCState *env)
64153e770bf7SBruno Larsen (billionai) {
64163e770bf7SBruno Larsen (billionai)     /* Common Registers */
64173e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
64183e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
64193e770bf7SBruno Larsen (billionai)     register_book3s_dbg_sprs(env);
64203e770bf7SBruno Larsen (billionai) 
64213e770bf7SBruno Larsen (billionai)     /* POWER7 Specific Registers */
64223e770bf7SBruno Larsen (billionai)     register_book3s_ids_sprs(env);
64233e770bf7SBruno Larsen (billionai)     register_rmor_sprs(env);
64243e770bf7SBruno Larsen (billionai)     register_amr_sprs(env);
64253e770bf7SBruno Larsen (billionai)     register_book3s_purr_sprs(env);
64263e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
64273e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
64283e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
64293e770bf7SBruno Larsen (billionai)     register_power5p_tb_sprs(env);
64303e770bf7SBruno Larsen (billionai)     register_power6_common_sprs(env);
64313e770bf7SBruno Larsen (billionai)     register_power6_dbg_sprs(env);
64323e770bf7SBruno Larsen (billionai)     register_power7_book4_sprs(env);
64333e770bf7SBruno Larsen (billionai) 
64343e770bf7SBruno Larsen (billionai)     /* env variables */
64353e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
64363e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
64373e770bf7SBruno Larsen (billionai) 
64383e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
64393e770bf7SBruno Larsen (billionai)     init_excp_POWER7(env);
64403e770bf7SBruno Larsen (billionai)     ppcPOWER7_irq_init(env_archcpu(env));
64413e770bf7SBruno Larsen (billionai) }
64423e770bf7SBruno Larsen (billionai) 
64433e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_power7(PowerPCCPUClass *pcc, uint32_t pvr)
64443e770bf7SBruno Larsen (billionai) {
64453e770bf7SBruno Larsen (billionai)     if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER7P_BASE) {
64463e770bf7SBruno Larsen (billionai)         return true;
64473e770bf7SBruno Larsen (billionai)     }
64483e770bf7SBruno Larsen (billionai)     if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER7_BASE) {
64493e770bf7SBruno Larsen (billionai)         return true;
64503e770bf7SBruno Larsen (billionai)     }
64513e770bf7SBruno Larsen (billionai)     return false;
64523e770bf7SBruno Larsen (billionai) }
64533e770bf7SBruno Larsen (billionai) 
64543e770bf7SBruno Larsen (billionai) static bool cpu_has_work_POWER7(CPUState *cs)
64553e770bf7SBruno Larsen (billionai) {
64563e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
64573e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
64583e770bf7SBruno Larsen (billionai) 
64593e770bf7SBruno Larsen (billionai)     if (cs->halted) {
64603e770bf7SBruno Larsen (billionai)         if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
64613e770bf7SBruno Larsen (billionai)             return false;
64623e770bf7SBruno Larsen (billionai)         }
64633e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) &&
64643e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P7_PECE0)) {
64653e770bf7SBruno Larsen (billionai)             return true;
64663e770bf7SBruno Larsen (billionai)         }
64673e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) &&
64683e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P7_PECE1)) {
64693e770bf7SBruno Larsen (billionai)             return true;
64703e770bf7SBruno Larsen (billionai)         }
64713e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK)) &&
64723e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) {
64733e770bf7SBruno Larsen (billionai)             return true;
64743e770bf7SBruno Larsen (billionai)         }
64753e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HMI)) &&
64763e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) {
64773e770bf7SBruno Larsen (billionai)             return true;
64783e770bf7SBruno Larsen (billionai)         }
64793e770bf7SBruno Larsen (billionai)         if (env->pending_interrupts & (1u << PPC_INTERRUPT_RESET)) {
64803e770bf7SBruno Larsen (billionai)             return true;
64813e770bf7SBruno Larsen (billionai)         }
64823e770bf7SBruno Larsen (billionai)         return false;
64833e770bf7SBruno Larsen (billionai)     } else {
64843e770bf7SBruno Larsen (billionai)         return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD);
64853e770bf7SBruno Larsen (billionai)     }
64863e770bf7SBruno Larsen (billionai) }
64873e770bf7SBruno Larsen (billionai) 
64883e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)
64893e770bf7SBruno Larsen (billionai) {
64903e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
64913e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
64923e770bf7SBruno Larsen (billionai)     CPUClass *cc = CPU_CLASS(oc);
64933e770bf7SBruno Larsen (billionai) 
64943e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER7";
64953e770bf7SBruno Larsen (billionai)     dc->desc = "POWER7";
64963e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_power7;
64973e770bf7SBruno Larsen (billionai)     pcc->pcr_mask = PCR_VEC_DIS | PCR_VSX_DIS | PCR_COMPAT_2_05;
64983e770bf7SBruno Larsen (billionai)     pcc->pcr_supported = PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
64993e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_POWER7;
65003e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
65013e770bf7SBruno Larsen (billionai)     cc->has_work = cpu_has_work_POWER7;
65023e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
65033e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
65043e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
65053e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTES |
65063e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
65073e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_EXT |
65083e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
65093e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
65103e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
65113e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
65123e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI |
65133e770bf7SBruno Larsen (billionai)                        PPC_POPCNTB | PPC_POPCNTWD |
65143e770bf7SBruno Larsen (billionai)                        PPC_CILDST;
65153e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_VSX | PPC2_DFP | PPC2_DBRX | PPC2_ISA205 |
65163e770bf7SBruno Larsen (billionai)                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
65173e770bf7SBruno Larsen (billionai)                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
65183e770bf7SBruno Larsen (billionai)                         PPC2_FP_TST_ISA206 | PPC2_FP_CVT_S64 |
65193e770bf7SBruno Larsen (billionai)                         PPC2_PM_ISA206;
65203e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
65213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
65223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VSX) |
65233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
65243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
65253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
65263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
65273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
65283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
65293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
65303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
65313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
65323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
65333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
65343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
65353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
65363e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_VPM0 | LPCR_VPM1 | LPCR_ISL | LPCR_DPFD |
65373e770bf7SBruno Larsen (billionai)         LPCR_VRMASD | LPCR_RMLS | LPCR_ILE |
65383e770bf7SBruno Larsen (billionai)         LPCR_P7_PECE0 | LPCR_P7_PECE1 | LPCR_P7_PECE2 |
65393e770bf7SBruno Larsen (billionai)         LPCR_MER | LPCR_TC |
65403e770bf7SBruno Larsen (billionai)         LPCR_LPES0 | LPCR_LPES1 | LPCR_HDICE;
65413e770bf7SBruno Larsen (billionai)     pcc->lpcr_pm = LPCR_P7_PECE0 | LPCR_P7_PECE1 | LPCR_P7_PECE2;
65423e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_2_06;
65433e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
65443e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_POWER7;
65453e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 32;
65463e770bf7SBruno Larsen (billionai) #endif
65473e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_POWER7;
65483e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
65493e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
65503e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
65513e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
65523e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
65533e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_VSX;
65543e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
65553e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x8000;
65563e770bf7SBruno Larsen (billionai) }
65573e770bf7SBruno Larsen (billionai) 
65583e770bf7SBruno Larsen (billionai) static void init_proc_POWER8(CPUPPCState *env)
65593e770bf7SBruno Larsen (billionai) {
65603e770bf7SBruno Larsen (billionai)     /* Common Registers */
65613e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
65623e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
65633e770bf7SBruno Larsen (billionai)     register_book3s_207_dbg_sprs(env);
65643e770bf7SBruno Larsen (billionai) 
65658f2e9d40SDaniel Henrique Barboza     /* Common TCG PMU */
65668f2e9d40SDaniel Henrique Barboza     init_tcg_pmu_power8(env);
65678f2e9d40SDaniel Henrique Barboza 
65683e770bf7SBruno Larsen (billionai)     /* POWER8 Specific Registers */
65693e770bf7SBruno Larsen (billionai)     register_book3s_ids_sprs(env);
65703e770bf7SBruno Larsen (billionai)     register_rmor_sprs(env);
65713e770bf7SBruno Larsen (billionai)     register_amr_sprs(env);
65723e770bf7SBruno Larsen (billionai)     register_iamr_sprs(env);
65733e770bf7SBruno Larsen (billionai)     register_book3s_purr_sprs(env);
65743e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
65753e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
65763e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
65773e770bf7SBruno Larsen (billionai)     register_power5p_tb_sprs(env);
65783e770bf7SBruno Larsen (billionai)     register_power6_common_sprs(env);
65793e770bf7SBruno Larsen (billionai)     register_power6_dbg_sprs(env);
65803e770bf7SBruno Larsen (billionai)     register_power8_tce_address_control_sprs(env);
65813e770bf7SBruno Larsen (billionai)     register_power8_ids_sprs(env);
65823e770bf7SBruno Larsen (billionai)     register_power8_ebb_sprs(env);
65833e770bf7SBruno Larsen (billionai)     register_power8_fscr_sprs(env);
65843e770bf7SBruno Larsen (billionai)     register_power8_pmu_sup_sprs(env);
65853e770bf7SBruno Larsen (billionai)     register_power8_pmu_user_sprs(env);
65863e770bf7SBruno Larsen (billionai)     register_power8_tm_sprs(env);
65873e770bf7SBruno Larsen (billionai)     register_power8_pspb_sprs(env);
65883e770bf7SBruno Larsen (billionai)     register_power8_dpdes_sprs(env);
65893e770bf7SBruno Larsen (billionai)     register_vtb_sprs(env);
65903e770bf7SBruno Larsen (billionai)     register_power8_ic_sprs(env);
65913e770bf7SBruno Larsen (billionai)     register_power8_book4_sprs(env);
65923e770bf7SBruno Larsen (billionai)     register_power8_rpr_sprs(env);
65933e770bf7SBruno Larsen (billionai) 
65943e770bf7SBruno Larsen (billionai)     /* env variables */
65953e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
65963e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
65973e770bf7SBruno Larsen (billionai) 
65983e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
65993e770bf7SBruno Larsen (billionai)     init_excp_POWER8(env);
66003e770bf7SBruno Larsen (billionai)     ppcPOWER7_irq_init(env_archcpu(env));
66013e770bf7SBruno Larsen (billionai) }
66023e770bf7SBruno Larsen (billionai) 
66033e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_power8(PowerPCCPUClass *pcc, uint32_t pvr)
66043e770bf7SBruno Larsen (billionai) {
66053e770bf7SBruno Larsen (billionai)     if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER8NVL_BASE) {
66063e770bf7SBruno Larsen (billionai)         return true;
66073e770bf7SBruno Larsen (billionai)     }
66083e770bf7SBruno Larsen (billionai)     if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER8E_BASE) {
66093e770bf7SBruno Larsen (billionai)         return true;
66103e770bf7SBruno Larsen (billionai)     }
66113e770bf7SBruno Larsen (billionai)     if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER8_BASE) {
66123e770bf7SBruno Larsen (billionai)         return true;
66133e770bf7SBruno Larsen (billionai)     }
66143e770bf7SBruno Larsen (billionai)     return false;
66153e770bf7SBruno Larsen (billionai) }
66163e770bf7SBruno Larsen (billionai) 
66173e770bf7SBruno Larsen (billionai) static bool cpu_has_work_POWER8(CPUState *cs)
66183e770bf7SBruno Larsen (billionai) {
66193e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
66203e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
66213e770bf7SBruno Larsen (billionai) 
66223e770bf7SBruno Larsen (billionai)     if (cs->halted) {
66233e770bf7SBruno Larsen (billionai)         if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
66243e770bf7SBruno Larsen (billionai)             return false;
66253e770bf7SBruno Larsen (billionai)         }
66263e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) &&
66273e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P8_PECE2)) {
66283e770bf7SBruno Larsen (billionai)             return true;
66293e770bf7SBruno Larsen (billionai)         }
66303e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) &&
66313e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P8_PECE3)) {
66323e770bf7SBruno Larsen (billionai)             return true;
66333e770bf7SBruno Larsen (billionai)         }
66343e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK)) &&
66353e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) {
66363e770bf7SBruno Larsen (billionai)             return true;
66373e770bf7SBruno Larsen (billionai)         }
66383e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HMI)) &&
66393e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) {
66403e770bf7SBruno Larsen (billionai)             return true;
66413e770bf7SBruno Larsen (billionai)         }
66423e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DOORBELL)) &&
66433e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P8_PECE0)) {
66443e770bf7SBruno Larsen (billionai)             return true;
66453e770bf7SBruno Larsen (billionai)         }
66463e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HDOORBELL)) &&
66473e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_P8_PECE1)) {
66483e770bf7SBruno Larsen (billionai)             return true;
66493e770bf7SBruno Larsen (billionai)         }
66503e770bf7SBruno Larsen (billionai)         if (env->pending_interrupts & (1u << PPC_INTERRUPT_RESET)) {
66513e770bf7SBruno Larsen (billionai)             return true;
66523e770bf7SBruno Larsen (billionai)         }
66533e770bf7SBruno Larsen (billionai)         return false;
66543e770bf7SBruno Larsen (billionai)     } else {
66553e770bf7SBruno Larsen (billionai)         return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD);
66563e770bf7SBruno Larsen (billionai)     }
66573e770bf7SBruno Larsen (billionai) }
66583e770bf7SBruno Larsen (billionai) 
66593e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)
66603e770bf7SBruno Larsen (billionai) {
66613e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
66623e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
66633e770bf7SBruno Larsen (billionai)     CPUClass *cc = CPU_CLASS(oc);
66643e770bf7SBruno Larsen (billionai) 
66653e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER8";
66663e770bf7SBruno Larsen (billionai)     dc->desc = "POWER8";
66673e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_power8;
66683e770bf7SBruno Larsen (billionai)     pcc->pcr_mask = PCR_TM_DIS | PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
66693e770bf7SBruno Larsen (billionai)     pcc->pcr_supported = PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
66703e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_POWER8;
66713e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
66723e770bf7SBruno Larsen (billionai)     cc->has_work = cpu_has_work_POWER8;
66733e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
66743e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
66753e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
66763e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTES |
66773e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
66783e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_EXT |
66793e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
66803e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
66813e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
66823e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
66833e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI |
66843e770bf7SBruno Larsen (billionai)                        PPC_POPCNTB | PPC_POPCNTWD |
66853e770bf7SBruno Larsen (billionai)                        PPC_CILDST;
66863e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
66873e770bf7SBruno Larsen (billionai)                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
66883e770bf7SBruno Larsen (billionai)                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
66893e770bf7SBruno Larsen (billionai)                         PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
66903e770bf7SBruno Larsen (billionai)                         PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
66913e770bf7SBruno Larsen (billionai)                         PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 |
66923e770bf7SBruno Larsen (billionai)                         PPC2_TM | PPC2_PM_ISA206;
66933e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
66943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_HV) |
66953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TM) |
66963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
66973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VSX) |
66983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
66993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
67003e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
67013e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
67023e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
67033e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
67043e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
67053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
67063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
67073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
67083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
67093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
67103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TS0) |
67113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TS1) |
67123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
67133e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_VPM0 | LPCR_VPM1 | LPCR_ISL | LPCR_KBV |
67143e770bf7SBruno Larsen (billionai)         LPCR_DPFD | LPCR_VRMASD | LPCR_RMLS | LPCR_ILE |
67153e770bf7SBruno Larsen (billionai)         LPCR_AIL | LPCR_ONL | LPCR_P8_PECE0 | LPCR_P8_PECE1 |
67163e770bf7SBruno Larsen (billionai)         LPCR_P8_PECE2 | LPCR_P8_PECE3 | LPCR_P8_PECE4 |
67173e770bf7SBruno Larsen (billionai)         LPCR_MER | LPCR_TC | LPCR_LPES0 | LPCR_HDICE;
67183e770bf7SBruno Larsen (billionai)     pcc->lpcr_pm = LPCR_P8_PECE0 | LPCR_P8_PECE1 | LPCR_P8_PECE2 |
67193e770bf7SBruno Larsen (billionai)                    LPCR_P8_PECE3 | LPCR_P8_PECE4;
67203e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_2_07;
67213e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
67223e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_POWER7;
67233e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 32;
67243e770bf7SBruno Larsen (billionai)     pcc->n_host_threads = 8;
67253e770bf7SBruno Larsen (billionai) #endif
67263e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_POWER8;
67273e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
67283e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
67293e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
67303e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
67313e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
67323e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_VSX | POWERPC_FLAG_TM;
67333e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
67343e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x8000;
67353e770bf7SBruno Larsen (billionai) }
67363e770bf7SBruno Larsen (billionai) 
67373e770bf7SBruno Larsen (billionai) #ifdef CONFIG_SOFTMMU
67383e770bf7SBruno Larsen (billionai) /*
67393e770bf7SBruno Larsen (billionai)  * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
67403e770bf7SBruno Larsen (billionai)  * Encoded as array of int_32s in the form:
67413e770bf7SBruno Larsen (billionai)  *  0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
67423e770bf7SBruno Larsen (billionai)  *  x -> AP encoding
67433e770bf7SBruno Larsen (billionai)  *  y -> radix mode supported page size (encoded as a shift)
67443e770bf7SBruno Larsen (billionai)  */
67453e770bf7SBruno Larsen (billionai) static struct ppc_radix_page_info POWER9_radix_page_info = {
67463e770bf7SBruno Larsen (billionai)     .count = 4,
67473e770bf7SBruno Larsen (billionai)     .entries = {
67483e770bf7SBruno Larsen (billionai)         0x0000000c, /*  4K - enc: 0x0 */
67493e770bf7SBruno Larsen (billionai)         0xa0000010, /* 64K - enc: 0x5 */
67503e770bf7SBruno Larsen (billionai)         0x20000015, /*  2M - enc: 0x1 */
67513e770bf7SBruno Larsen (billionai)         0x4000001e  /*  1G - enc: 0x2 */
67523e770bf7SBruno Larsen (billionai)     }
67533e770bf7SBruno Larsen (billionai) };
67543e770bf7SBruno Larsen (billionai) #endif /* CONFIG_SOFTMMU */
67553e770bf7SBruno Larsen (billionai) 
67563e770bf7SBruno Larsen (billionai) static void init_proc_POWER9(CPUPPCState *env)
67573e770bf7SBruno Larsen (billionai) {
67583e770bf7SBruno Larsen (billionai)     /* Common Registers */
67593e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
67603e770bf7SBruno Larsen (billionai)     register_book3s_207_dbg_sprs(env);
67613e770bf7SBruno Larsen (billionai) 
67628f2e9d40SDaniel Henrique Barboza     /* Common TCG PMU */
67638f2e9d40SDaniel Henrique Barboza     init_tcg_pmu_power8(env);
67648f2e9d40SDaniel Henrique Barboza 
67653e770bf7SBruno Larsen (billionai)     /* POWER8 Specific Registers */
67663e770bf7SBruno Larsen (billionai)     register_book3s_ids_sprs(env);
67673e770bf7SBruno Larsen (billionai)     register_amr_sprs(env);
67683e770bf7SBruno Larsen (billionai)     register_iamr_sprs(env);
67693e770bf7SBruno Larsen (billionai)     register_book3s_purr_sprs(env);
67703e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
67713e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
67723e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
67733e770bf7SBruno Larsen (billionai)     register_power5p_tb_sprs(env);
67743e770bf7SBruno Larsen (billionai)     register_power6_common_sprs(env);
67753e770bf7SBruno Larsen (billionai)     register_power6_dbg_sprs(env);
67763e770bf7SBruno Larsen (billionai)     register_power8_tce_address_control_sprs(env);
67773e770bf7SBruno Larsen (billionai)     register_power8_ids_sprs(env);
67783e770bf7SBruno Larsen (billionai)     register_power8_ebb_sprs(env);
67793e770bf7SBruno Larsen (billionai)     register_power8_fscr_sprs(env);
67803e770bf7SBruno Larsen (billionai)     register_power8_pmu_sup_sprs(env);
67813e770bf7SBruno Larsen (billionai)     register_power8_pmu_user_sprs(env);
67823e770bf7SBruno Larsen (billionai)     register_power8_tm_sprs(env);
67833e770bf7SBruno Larsen (billionai)     register_power8_pspb_sprs(env);
67843e770bf7SBruno Larsen (billionai)     register_power8_dpdes_sprs(env);
67853e770bf7SBruno Larsen (billionai)     register_vtb_sprs(env);
67863e770bf7SBruno Larsen (billionai)     register_power8_ic_sprs(env);
67873e770bf7SBruno Larsen (billionai)     register_power8_book4_sprs(env);
67883e770bf7SBruno Larsen (billionai)     register_power8_rpr_sprs(env);
67893e770bf7SBruno Larsen (billionai)     register_power9_mmu_sprs(env);
67903e770bf7SBruno Larsen (billionai) 
67913e770bf7SBruno Larsen (billionai)     /* POWER9 Specific registers */
67923e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TIDR, "TIDR", NULL, NULL,
67933e770bf7SBruno Larsen (billionai)                      spr_read_generic, spr_write_generic,
67943e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TIDR, 0);
67953e770bf7SBruno Larsen (billionai) 
67963e770bf7SBruno Larsen (billionai)     /* FIXME: Filter fields properly based on privilege level */
67973e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL,
67983e770bf7SBruno Larsen (billionai)                         spr_read_generic, spr_write_generic,
67993e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_PSSCR, 0);
68003e770bf7SBruno Larsen (billionai) 
68013e770bf7SBruno Larsen (billionai)     /* env variables */
68023e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
68033e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
68043e770bf7SBruno Larsen (billionai) 
68053e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
68063e770bf7SBruno Larsen (billionai)     init_excp_POWER9(env);
68073e770bf7SBruno Larsen (billionai)     ppcPOWER9_irq_init(env_archcpu(env));
68083e770bf7SBruno Larsen (billionai) }
68093e770bf7SBruno Larsen (billionai) 
68103e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr)
68113e770bf7SBruno Larsen (billionai) {
68123e770bf7SBruno Larsen (billionai)     if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER9_BASE) {
68133e770bf7SBruno Larsen (billionai)         return true;
68143e770bf7SBruno Larsen (billionai)     }
68153e770bf7SBruno Larsen (billionai)     return false;
68163e770bf7SBruno Larsen (billionai) }
68173e770bf7SBruno Larsen (billionai) 
68183e770bf7SBruno Larsen (billionai) static bool cpu_has_work_POWER9(CPUState *cs)
68193e770bf7SBruno Larsen (billionai) {
68203e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
68213e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
68223e770bf7SBruno Larsen (billionai) 
68233e770bf7SBruno Larsen (billionai)     if (cs->halted) {
68243e770bf7SBruno Larsen (billionai)         uint64_t psscr = env->spr[SPR_PSSCR];
68253e770bf7SBruno Larsen (billionai) 
68263e770bf7SBruno Larsen (billionai)         if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
68273e770bf7SBruno Larsen (billionai)             return false;
68283e770bf7SBruno Larsen (billionai)         }
68293e770bf7SBruno Larsen (billionai) 
68303e770bf7SBruno Larsen (billionai)         /* If EC is clear, just return true on any pending interrupt */
68313e770bf7SBruno Larsen (billionai)         if (!(psscr & PSSCR_EC)) {
68323e770bf7SBruno Larsen (billionai)             return true;
68333e770bf7SBruno Larsen (billionai)         }
68343e770bf7SBruno Larsen (billionai)         /* External Exception */
68353e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) &&
68363e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_EEE)) {
68373e770bf7SBruno Larsen (billionai)             bool heic = !!(env->spr[SPR_LPCR] & LPCR_HEIC);
68383e770bf7SBruno Larsen (billionai)             if (heic == 0 || !msr_hv || msr_pr) {
68393e770bf7SBruno Larsen (billionai)                 return true;
68403e770bf7SBruno Larsen (billionai)             }
68413e770bf7SBruno Larsen (billionai)         }
68423e770bf7SBruno Larsen (billionai)         /* Decrementer Exception */
68433e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) &&
68443e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_DEE)) {
68453e770bf7SBruno Larsen (billionai)             return true;
68463e770bf7SBruno Larsen (billionai)         }
68473e770bf7SBruno Larsen (billionai)         /* Machine Check or Hypervisor Maintenance Exception */
68483e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK |
68493e770bf7SBruno Larsen (billionai)             1u << PPC_INTERRUPT_HMI)) && (env->spr[SPR_LPCR] & LPCR_OEE)) {
68503e770bf7SBruno Larsen (billionai)             return true;
68513e770bf7SBruno Larsen (billionai)         }
68523e770bf7SBruno Larsen (billionai)         /* Privileged Doorbell Exception */
68533e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DOORBELL)) &&
68543e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_PDEE)) {
68553e770bf7SBruno Larsen (billionai)             return true;
68563e770bf7SBruno Larsen (billionai)         }
68573e770bf7SBruno Larsen (billionai)         /* Hypervisor Doorbell Exception */
68583e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HDOORBELL)) &&
68593e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_HDEE)) {
68603e770bf7SBruno Larsen (billionai)             return true;
68613e770bf7SBruno Larsen (billionai)         }
68623e770bf7SBruno Larsen (billionai)         /* Hypervisor virtualization exception */
68633e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HVIRT)) &&
68643e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_HVEE)) {
68653e770bf7SBruno Larsen (billionai)             return true;
68663e770bf7SBruno Larsen (billionai)         }
68673e770bf7SBruno Larsen (billionai)         if (env->pending_interrupts & (1u << PPC_INTERRUPT_RESET)) {
68683e770bf7SBruno Larsen (billionai)             return true;
68693e770bf7SBruno Larsen (billionai)         }
68703e770bf7SBruno Larsen (billionai)         return false;
68713e770bf7SBruno Larsen (billionai)     } else {
68723e770bf7SBruno Larsen (billionai)         return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD);
68733e770bf7SBruno Larsen (billionai)     }
68743e770bf7SBruno Larsen (billionai) }
68753e770bf7SBruno Larsen (billionai) 
68763e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data)
68773e770bf7SBruno Larsen (billionai) {
68783e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
68793e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
68803e770bf7SBruno Larsen (billionai)     CPUClass *cc = CPU_CLASS(oc);
68813e770bf7SBruno Larsen (billionai) 
68823e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER9";
68833e770bf7SBruno Larsen (billionai)     dc->desc = "POWER9";
68843e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_power9;
68853e770bf7SBruno Larsen (billionai)     pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06 | PCR_COMPAT_2_07;
68863e770bf7SBruno Larsen (billionai)     pcc->pcr_supported = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 |
68873e770bf7SBruno Larsen (billionai)                          PCR_COMPAT_2_05;
68883e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_POWER9;
68893e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
68903e770bf7SBruno Larsen (billionai)     cc->has_work = cpu_has_work_POWER9;
68913e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
68923e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
68933e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
68943e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTES |
68953e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
68963e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_EXT |
68973e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
68983e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
68993e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC |
69003e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
69013e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI |
69023e770bf7SBruno Larsen (billionai)                        PPC_POPCNTB | PPC_POPCNTWD |
69033e770bf7SBruno Larsen (billionai)                        PPC_CILDST;
69043e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
69053e770bf7SBruno Larsen (billionai)                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
69063e770bf7SBruno Larsen (billionai)                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
69073e770bf7SBruno Larsen (billionai)                         PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
69083e770bf7SBruno Larsen (billionai)                         PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
69093e770bf7SBruno Larsen (billionai)                         PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 |
69103e770bf7SBruno Larsen (billionai)                         PPC2_TM | PPC2_ISA300 | PPC2_PRCNTL;
69113e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
69123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_HV) |
69133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TM) |
69143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
69153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VSX) |
69163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
69173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
69183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
69193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
69203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
69213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
69223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
69233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
69243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
69253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
69263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
69273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
69283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
69293e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_VPM1 | LPCR_ISL | LPCR_KBV | LPCR_DPFD |
69303e770bf7SBruno Larsen (billionai)         (LPCR_PECE_U_MASK & LPCR_HVEE) | LPCR_ILE | LPCR_AIL |
69313e770bf7SBruno Larsen (billionai)         LPCR_UPRT | LPCR_EVIRT | LPCR_ONL | LPCR_HR | LPCR_LD |
69323e770bf7SBruno Larsen (billionai)         (LPCR_PECE_L_MASK & (LPCR_PDEE | LPCR_HDEE | LPCR_EEE |
69333e770bf7SBruno Larsen (billionai)                              LPCR_DEE | LPCR_OEE))
69343e770bf7SBruno Larsen (billionai)         | LPCR_MER | LPCR_GTSE | LPCR_TC |
69353e770bf7SBruno Larsen (billionai)         LPCR_HEIC | LPCR_LPES0 | LPCR_HVICE | LPCR_HDICE;
69363e770bf7SBruno Larsen (billionai)     pcc->lpcr_pm = LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE | LPCR_OEE;
69373e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_3_00;
69383e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
69393e770bf7SBruno Larsen (billionai)     /* segment page size remain the same */
69403e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_POWER7;
69413e770bf7SBruno Larsen (billionai)     pcc->radix_page_info = &POWER9_radix_page_info;
69423e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 56;
69433e770bf7SBruno Larsen (billionai)     pcc->n_host_threads = 4;
69443e770bf7SBruno Larsen (billionai) #endif
69453e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_POWER9;
69463e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_POWER9;
69473e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
69483e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
69493e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
69503e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
69513e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_VSX | POWERPC_FLAG_TM | POWERPC_FLAG_SCV;
69523e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
69533e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x8000;
69543e770bf7SBruno Larsen (billionai) }
69553e770bf7SBruno Larsen (billionai) 
69563e770bf7SBruno Larsen (billionai) #ifdef CONFIG_SOFTMMU
69573e770bf7SBruno Larsen (billionai) /*
69583e770bf7SBruno Larsen (billionai)  * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
69593e770bf7SBruno Larsen (billionai)  * Encoded as array of int_32s in the form:
69603e770bf7SBruno Larsen (billionai)  *  0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
69613e770bf7SBruno Larsen (billionai)  *  x -> AP encoding
69623e770bf7SBruno Larsen (billionai)  *  y -> radix mode supported page size (encoded as a shift)
69633e770bf7SBruno Larsen (billionai)  */
69643e770bf7SBruno Larsen (billionai) static struct ppc_radix_page_info POWER10_radix_page_info = {
69653e770bf7SBruno Larsen (billionai)     .count = 4,
69663e770bf7SBruno Larsen (billionai)     .entries = {
69673e770bf7SBruno Larsen (billionai)         0x0000000c, /*  4K - enc: 0x0 */
69683e770bf7SBruno Larsen (billionai)         0xa0000010, /* 64K - enc: 0x5 */
69693e770bf7SBruno Larsen (billionai)         0x20000015, /*  2M - enc: 0x1 */
69703e770bf7SBruno Larsen (billionai)         0x4000001e  /*  1G - enc: 0x2 */
69713e770bf7SBruno Larsen (billionai)     }
69723e770bf7SBruno Larsen (billionai) };
69733e770bf7SBruno Larsen (billionai) #endif /* CONFIG_SOFTMMU */
69743e770bf7SBruno Larsen (billionai) 
69753e770bf7SBruno Larsen (billionai) static void init_proc_POWER10(CPUPPCState *env)
69763e770bf7SBruno Larsen (billionai) {
69773e770bf7SBruno Larsen (billionai)     /* Common Registers */
69783e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
69793e770bf7SBruno Larsen (billionai)     register_book3s_207_dbg_sprs(env);
69803e770bf7SBruno Larsen (billionai) 
69818f2e9d40SDaniel Henrique Barboza     /* Common TCG PMU */
69828f2e9d40SDaniel Henrique Barboza     init_tcg_pmu_power8(env);
69838f2e9d40SDaniel Henrique Barboza 
69843e770bf7SBruno Larsen (billionai)     /* POWER8 Specific Registers */
69853e770bf7SBruno Larsen (billionai)     register_book3s_ids_sprs(env);
69863e770bf7SBruno Larsen (billionai)     register_amr_sprs(env);
69873e770bf7SBruno Larsen (billionai)     register_iamr_sprs(env);
69883e770bf7SBruno Larsen (billionai)     register_book3s_purr_sprs(env);
69893e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
69903e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
69913e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
69923e770bf7SBruno Larsen (billionai)     register_power6_common_sprs(env);
69933e770bf7SBruno Larsen (billionai)     register_power6_dbg_sprs(env);
69943e770bf7SBruno Larsen (billionai)     register_power8_tce_address_control_sprs(env);
69953e770bf7SBruno Larsen (billionai)     register_power8_ids_sprs(env);
69963e770bf7SBruno Larsen (billionai)     register_power8_ebb_sprs(env);
69973e770bf7SBruno Larsen (billionai)     register_power8_fscr_sprs(env);
69983e770bf7SBruno Larsen (billionai)     register_power8_pmu_sup_sprs(env);
69993e770bf7SBruno Larsen (billionai)     register_power8_pmu_user_sprs(env);
70003e770bf7SBruno Larsen (billionai)     register_power8_tm_sprs(env);
70013e770bf7SBruno Larsen (billionai)     register_power8_pspb_sprs(env);
70023e770bf7SBruno Larsen (billionai)     register_vtb_sprs(env);
70033e770bf7SBruno Larsen (billionai)     register_power8_ic_sprs(env);
70043e770bf7SBruno Larsen (billionai)     register_power8_book4_sprs(env);
70053e770bf7SBruno Larsen (billionai)     register_power8_rpr_sprs(env);
70063e770bf7SBruno Larsen (billionai)     register_power9_mmu_sprs(env);
70073e770bf7SBruno Larsen (billionai) 
70083e770bf7SBruno Larsen (billionai)     /* FIXME: Filter fields properly based on privilege level */
70093e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL,
70103e770bf7SBruno Larsen (billionai)                         spr_read_generic, spr_write_generic,
70113e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_PSSCR, 0);
70123e770bf7SBruno Larsen (billionai) 
70133e770bf7SBruno Larsen (billionai)     /* env variables */
70143e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
70153e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
70163e770bf7SBruno Larsen (billionai) 
70173e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
70183e770bf7SBruno Larsen (billionai)     init_excp_POWER10(env);
70193e770bf7SBruno Larsen (billionai)     ppcPOWER9_irq_init(env_archcpu(env));
70203e770bf7SBruno Larsen (billionai) }
70213e770bf7SBruno Larsen (billionai) 
70223e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_power10(PowerPCCPUClass *pcc, uint32_t pvr)
70233e770bf7SBruno Larsen (billionai) {
70243e770bf7SBruno Larsen (billionai)     if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER10_BASE) {
70253e770bf7SBruno Larsen (billionai)         return true;
70263e770bf7SBruno Larsen (billionai)     }
70273e770bf7SBruno Larsen (billionai)     return false;
70283e770bf7SBruno Larsen (billionai) }
70293e770bf7SBruno Larsen (billionai) 
70303e770bf7SBruno Larsen (billionai) static bool cpu_has_work_POWER10(CPUState *cs)
70313e770bf7SBruno Larsen (billionai) {
70323e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
70333e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
70343e770bf7SBruno Larsen (billionai) 
70353e770bf7SBruno Larsen (billionai)     if (cs->halted) {
70363e770bf7SBruno Larsen (billionai)         uint64_t psscr = env->spr[SPR_PSSCR];
70373e770bf7SBruno Larsen (billionai) 
70383e770bf7SBruno Larsen (billionai)         if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
70393e770bf7SBruno Larsen (billionai)             return false;
70403e770bf7SBruno Larsen (billionai)         }
70413e770bf7SBruno Larsen (billionai) 
70423e770bf7SBruno Larsen (billionai)         /* If EC is clear, just return true on any pending interrupt */
70433e770bf7SBruno Larsen (billionai)         if (!(psscr & PSSCR_EC)) {
70443e770bf7SBruno Larsen (billionai)             return true;
70453e770bf7SBruno Larsen (billionai)         }
70463e770bf7SBruno Larsen (billionai)         /* External Exception */
70473e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) &&
70483e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_EEE)) {
70493e770bf7SBruno Larsen (billionai)             bool heic = !!(env->spr[SPR_LPCR] & LPCR_HEIC);
70503e770bf7SBruno Larsen (billionai)             if (heic == 0 || !msr_hv || msr_pr) {
70513e770bf7SBruno Larsen (billionai)                 return true;
70523e770bf7SBruno Larsen (billionai)             }
70533e770bf7SBruno Larsen (billionai)         }
70543e770bf7SBruno Larsen (billionai)         /* Decrementer Exception */
70553e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) &&
70563e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_DEE)) {
70573e770bf7SBruno Larsen (billionai)             return true;
70583e770bf7SBruno Larsen (billionai)         }
70593e770bf7SBruno Larsen (billionai)         /* Machine Check or Hypervisor Maintenance Exception */
70603e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK |
70613e770bf7SBruno Larsen (billionai)             1u << PPC_INTERRUPT_HMI)) && (env->spr[SPR_LPCR] & LPCR_OEE)) {
70623e770bf7SBruno Larsen (billionai)             return true;
70633e770bf7SBruno Larsen (billionai)         }
70643e770bf7SBruno Larsen (billionai)         /* Privileged Doorbell Exception */
70653e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DOORBELL)) &&
70663e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_PDEE)) {
70673e770bf7SBruno Larsen (billionai)             return true;
70683e770bf7SBruno Larsen (billionai)         }
70693e770bf7SBruno Larsen (billionai)         /* Hypervisor Doorbell Exception */
70703e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HDOORBELL)) &&
70713e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_HDEE)) {
70723e770bf7SBruno Larsen (billionai)             return true;
70733e770bf7SBruno Larsen (billionai)         }
70743e770bf7SBruno Larsen (billionai)         /* Hypervisor virtualization exception */
70753e770bf7SBruno Larsen (billionai)         if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HVIRT)) &&
70763e770bf7SBruno Larsen (billionai)             (env->spr[SPR_LPCR] & LPCR_HVEE)) {
70773e770bf7SBruno Larsen (billionai)             return true;
70783e770bf7SBruno Larsen (billionai)         }
70793e770bf7SBruno Larsen (billionai)         if (env->pending_interrupts & (1u << PPC_INTERRUPT_RESET)) {
70803e770bf7SBruno Larsen (billionai)             return true;
70813e770bf7SBruno Larsen (billionai)         }
70823e770bf7SBruno Larsen (billionai)         return false;
70833e770bf7SBruno Larsen (billionai)     } else {
70843e770bf7SBruno Larsen (billionai)         return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD);
70853e770bf7SBruno Larsen (billionai)     }
70863e770bf7SBruno Larsen (billionai) }
70873e770bf7SBruno Larsen (billionai) 
70883e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data)
70893e770bf7SBruno Larsen (billionai) {
70903e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
70913e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
70923e770bf7SBruno Larsen (billionai)     CPUClass *cc = CPU_CLASS(oc);
70933e770bf7SBruno Larsen (billionai) 
70943e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER10";
70953e770bf7SBruno Larsen (billionai)     dc->desc = "POWER10";
70963e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_power10;
70973e770bf7SBruno Larsen (billionai)     pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06 | PCR_COMPAT_2_07 |
70983e770bf7SBruno Larsen (billionai)                     PCR_COMPAT_3_00;
70993e770bf7SBruno Larsen (billionai)     pcc->pcr_supported = PCR_COMPAT_3_10 | PCR_COMPAT_3_00 | PCR_COMPAT_2_07 |
71003e770bf7SBruno Larsen (billionai)                          PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
71013e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_POWER10;
71023e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
71033e770bf7SBruno Larsen (billionai)     cc->has_work = cpu_has_work_POWER10;
71043e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
71053e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
71063e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
71073e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTES |
71083e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
71093e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_EXT |
71103e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
71113e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
71123e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC |
71133e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
71143e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI |
71153e770bf7SBruno Larsen (billionai)                        PPC_POPCNTB | PPC_POPCNTWD |
71163e770bf7SBruno Larsen (billionai)                        PPC_CILDST;
71173e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
71183e770bf7SBruno Larsen (billionai)                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
71193e770bf7SBruno Larsen (billionai)                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
71203e770bf7SBruno Larsen (billionai)                         PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
71213e770bf7SBruno Larsen (billionai)                         PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
71223e770bf7SBruno Larsen (billionai)                         PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 |
71233e770bf7SBruno Larsen (billionai)                         PPC2_TM | PPC2_ISA300 | PPC2_PRCNTL | PPC2_ISA310;
71243e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
71253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_HV) |
71263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TM) |
71273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
71283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VSX) |
71293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
71303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
71313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
71323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
71333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
71343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
71353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
71363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
71373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
71383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
71393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
71403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
71413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
71423e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_VPM1 | LPCR_ISL | LPCR_KBV | LPCR_DPFD |
71433e770bf7SBruno Larsen (billionai)         (LPCR_PECE_U_MASK & LPCR_HVEE) | LPCR_ILE | LPCR_AIL |
71443e770bf7SBruno Larsen (billionai)         LPCR_UPRT | LPCR_EVIRT | LPCR_ONL | LPCR_HR | LPCR_LD |
71453e770bf7SBruno Larsen (billionai)         (LPCR_PECE_L_MASK & (LPCR_PDEE | LPCR_HDEE | LPCR_EEE |
71463e770bf7SBruno Larsen (billionai)                              LPCR_DEE | LPCR_OEE))
71473e770bf7SBruno Larsen (billionai)         | LPCR_MER | LPCR_GTSE | LPCR_TC |
71483e770bf7SBruno Larsen (billionai)         LPCR_HEIC | LPCR_LPES0 | LPCR_HVICE | LPCR_HDICE;
7149363fd548SCédric Le Goater     /* DD2 adds an extra HAIL bit */
7150363fd548SCédric Le Goater     pcc->lpcr_mask |= LPCR_HAIL;
7151363fd548SCédric Le Goater 
71523e770bf7SBruno Larsen (billionai)     pcc->lpcr_pm = LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE | LPCR_OEE;
71533e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_3_00;
71543e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
71553e770bf7SBruno Larsen (billionai)     /* segment page size remain the same */
71563e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_POWER7;
71573e770bf7SBruno Larsen (billionai)     pcc->radix_page_info = &POWER10_radix_page_info;
71583e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 56;
71593e770bf7SBruno Larsen (billionai) #endif
71603e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_POWER10;
71613e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_POWER9;
71623e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
71633e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
71643e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
71653e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
71663e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_VSX | POWERPC_FLAG_TM | POWERPC_FLAG_SCV;
71673e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
71683e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x8000;
71693e770bf7SBruno Larsen (billionai) }
71703e770bf7SBruno Larsen (billionai) 
71713e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
71723e770bf7SBruno Larsen (billionai) void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp)
71733e770bf7SBruno Larsen (billionai) {
71743e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
71753e770bf7SBruno Larsen (billionai) 
71763e770bf7SBruno Larsen (billionai)     cpu->vhyp = vhyp;
71773e770bf7SBruno Larsen (billionai) 
71783e770bf7SBruno Larsen (billionai)     /*
71793e770bf7SBruno Larsen (billionai)      * With a virtual hypervisor mode we never allow the CPU to go
71803e770bf7SBruno Larsen (billionai)      * hypervisor mode itself
71813e770bf7SBruno Larsen (billionai)      */
71823e770bf7SBruno Larsen (billionai)     env->msr_mask &= ~MSR_HVB;
71833e770bf7SBruno Larsen (billionai) }
71843e770bf7SBruno Larsen (billionai) 
71853e770bf7SBruno Larsen (billionai) #endif /* !defined(CONFIG_USER_ONLY) */
71863e770bf7SBruno Larsen (billionai) 
71873e770bf7SBruno Larsen (billionai) #endif /* defined(TARGET_PPC64) */
71883e770bf7SBruno Larsen (billionai) 
71893e770bf7SBruno Larsen (billionai) /*****************************************************************************/
71903e770bf7SBruno Larsen (billionai) /* Generic CPU instantiation routine                                         */
71913e770bf7SBruno Larsen (billionai) static void init_ppc_proc(PowerPCCPU *cpu)
71923e770bf7SBruno Larsen (billionai) {
71933e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
71943e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
71953e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
71963e770bf7SBruno Larsen (billionai)     int i;
71973e770bf7SBruno Larsen (billionai) 
71983e770bf7SBruno Larsen (billionai)     env->irq_inputs = NULL;
71993e770bf7SBruno Larsen (billionai)     /* Set all exception vectors to an invalid address */
72003e770bf7SBruno Larsen (billionai)     for (i = 0; i < POWERPC_EXCP_NB; i++) {
72013e770bf7SBruno Larsen (billionai)         env->excp_vectors[i] = (target_ulong)(-1ULL);
72023e770bf7SBruno Larsen (billionai)     }
72033e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x00000000;
72043e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0x00000000;
72053e770bf7SBruno Larsen (billionai)     /* Default MMU definitions */
72063e770bf7SBruno Larsen (billionai)     env->nb_BATs = 0;
72073e770bf7SBruno Larsen (billionai)     env->nb_tlb = 0;
72083e770bf7SBruno Larsen (billionai)     env->nb_ways = 0;
72093e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_NONE;
72103e770bf7SBruno Larsen (billionai) #endif
72113e770bf7SBruno Larsen (billionai)     /* Register SPR common to all PowerPC implementations */
7212e78280a2SFabiano Rosas     register_generic_sprs(cpu);
7213e78280a2SFabiano Rosas 
72143e770bf7SBruno Larsen (billionai)     /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
72153e770bf7SBruno Larsen (billionai)     (*pcc->init_proc)(env);
72163e770bf7SBruno Larsen (billionai) 
72173e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
72183e770bf7SBruno Larsen (billionai)     ppc_gdb_gen_spr_xml(cpu);
72193e770bf7SBruno Larsen (billionai) #endif
72203e770bf7SBruno Larsen (billionai) 
72213e770bf7SBruno Larsen (billionai)     /* MSR bits & flags consistency checks */
72223e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 25)) {
72233e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
72243e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_SPE:
72253e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_VRE:
72263e770bf7SBruno Larsen (billionai)             break;
72273e770bf7SBruno Larsen (billionai)         default:
72283e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72293e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
72303e770bf7SBruno Larsen (billionai)             exit(1);
72313e770bf7SBruno Larsen (billionai)         }
72323e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
72333e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72343e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
72353e770bf7SBruno Larsen (billionai)         exit(1);
72363e770bf7SBruno Larsen (billionai)     }
72373e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 17)) {
72383e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
72393e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_TGPR:
72403e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_CE:
72413e770bf7SBruno Larsen (billionai)             break;
72423e770bf7SBruno Larsen (billionai)         default:
72433e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72443e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
72453e770bf7SBruno Larsen (billionai)             exit(1);
72463e770bf7SBruno Larsen (billionai)         }
72473e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
72483e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72493e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
72503e770bf7SBruno Larsen (billionai)         exit(1);
72513e770bf7SBruno Larsen (billionai)     }
72523e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 10)) {
72533e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
72543e770bf7SBruno Larsen (billionai)                               POWERPC_FLAG_UBLE)) {
72553e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_SE:
72563e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_DWE:
72573e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_UBLE:
72583e770bf7SBruno Larsen (billionai)             break;
72593e770bf7SBruno Larsen (billionai)         default:
72603e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72613e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
72623e770bf7SBruno Larsen (billionai)                     "POWERPC_FLAG_UBLE\n");
72633e770bf7SBruno Larsen (billionai)             exit(1);
72643e770bf7SBruno Larsen (billionai)         }
72653e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
72663e770bf7SBruno Larsen (billionai)                              POWERPC_FLAG_UBLE)) {
72673e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72683e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
72693e770bf7SBruno Larsen (billionai)                 "POWERPC_FLAG_UBLE\n");
72703e770bf7SBruno Larsen (billionai)             exit(1);
72713e770bf7SBruno Larsen (billionai)     }
72723e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 9)) {
72733e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
72743e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_BE:
72753e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_DE:
72763e770bf7SBruno Larsen (billionai)             break;
72773e770bf7SBruno Larsen (billionai)         default:
72783e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72793e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
72803e770bf7SBruno Larsen (billionai)             exit(1);
72813e770bf7SBruno Larsen (billionai)         }
72823e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
72833e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72843e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
72853e770bf7SBruno Larsen (billionai)         exit(1);
72863e770bf7SBruno Larsen (billionai)     }
72873e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 2)) {
72883e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
72893e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_PX:
72903e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_PMM:
72913e770bf7SBruno Larsen (billionai)             break;
72923e770bf7SBruno Larsen (billionai)         default:
72933e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72943e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
72953e770bf7SBruno Larsen (billionai)             exit(1);
72963e770bf7SBruno Larsen (billionai)         }
72973e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
72983e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
72993e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
73003e770bf7SBruno Larsen (billionai)         exit(1);
73013e770bf7SBruno Larsen (billionai)     }
7302005b69fdSCédric Le Goater     if ((env->flags & POWERPC_FLAG_BUS_CLK) == 0) {
73033e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC flags inconsistency\n"
73043e770bf7SBruno Larsen (billionai)                 "Should define the time-base and decrementer clock source\n");
73053e770bf7SBruno Larsen (billionai)         exit(1);
73063e770bf7SBruno Larsen (billionai)     }
73073e770bf7SBruno Larsen (billionai)     /* Allocate TLBs buffer when needed */
73083e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
73093e770bf7SBruno Larsen (billionai)     if (env->nb_tlb != 0) {
73103e770bf7SBruno Larsen (billionai)         int nb_tlb = env->nb_tlb;
73113e770bf7SBruno Larsen (billionai)         if (env->id_tlbs != 0) {
73123e770bf7SBruno Larsen (billionai)             nb_tlb *= 2;
73133e770bf7SBruno Larsen (billionai)         }
73143e770bf7SBruno Larsen (billionai)         switch (env->tlb_type) {
73153e770bf7SBruno Larsen (billionai)         case TLB_6XX:
73163e770bf7SBruno Larsen (billionai)             env->tlb.tlb6 = g_new0(ppc6xx_tlb_t, nb_tlb);
73173e770bf7SBruno Larsen (billionai)             break;
73183e770bf7SBruno Larsen (billionai)         case TLB_EMB:
73193e770bf7SBruno Larsen (billionai)             env->tlb.tlbe = g_new0(ppcemb_tlb_t, nb_tlb);
73203e770bf7SBruno Larsen (billionai)             break;
73213e770bf7SBruno Larsen (billionai)         case TLB_MAS:
73223e770bf7SBruno Larsen (billionai)             env->tlb.tlbm = g_new0(ppcmas_tlb_t, nb_tlb);
73233e770bf7SBruno Larsen (billionai)             break;
73243e770bf7SBruno Larsen (billionai)         }
73253e770bf7SBruno Larsen (billionai)         /* Pre-compute some useful values */
73263e770bf7SBruno Larsen (billionai)         env->tlb_per_way = env->nb_tlb / env->nb_ways;
73273e770bf7SBruno Larsen (billionai)     }
73283e770bf7SBruno Larsen (billionai)     if (env->irq_inputs == NULL) {
73293e770bf7SBruno Larsen (billionai)         warn_report("no internal IRQ controller registered."
73303e770bf7SBruno Larsen (billionai)                     " Attempt QEMU to crash very soon !");
73313e770bf7SBruno Larsen (billionai)     }
73323e770bf7SBruno Larsen (billionai) #endif
73333e770bf7SBruno Larsen (billionai)     if (env->check_pow == NULL) {
73343e770bf7SBruno Larsen (billionai)         warn_report("no power management check handler registered."
73353e770bf7SBruno Larsen (billionai)                     " Attempt QEMU to crash very soon !");
73363e770bf7SBruno Larsen (billionai)     }
73373e770bf7SBruno Larsen (billionai) }
73383e770bf7SBruno Larsen (billionai) 
73393e770bf7SBruno Larsen (billionai) 
73403e770bf7SBruno Larsen (billionai) static void ppc_cpu_realize(DeviceState *dev, Error **errp)
73413e770bf7SBruno Larsen (billionai) {
73423e770bf7SBruno Larsen (billionai)     CPUState *cs = CPU(dev);
73433e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(dev);
73443e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
73453e770bf7SBruno Larsen (billionai)     Error *local_err = NULL;
73463e770bf7SBruno Larsen (billionai) 
73473e770bf7SBruno Larsen (billionai)     cpu_exec_realizefn(cs, &local_err);
73483e770bf7SBruno Larsen (billionai)     if (local_err != NULL) {
73493e770bf7SBruno Larsen (billionai)         error_propagate(errp, local_err);
73503e770bf7SBruno Larsen (billionai)         return;
73513e770bf7SBruno Larsen (billionai)     }
73523e770bf7SBruno Larsen (billionai)     if (cpu->vcpu_id == UNASSIGNED_CPU_INDEX) {
73533e770bf7SBruno Larsen (billionai)         cpu->vcpu_id = cs->cpu_index;
73543e770bf7SBruno Larsen (billionai)     }
73553e770bf7SBruno Larsen (billionai) 
73563e770bf7SBruno Larsen (billionai)     if (tcg_enabled()) {
73573e770bf7SBruno Larsen (billionai)         if (ppc_fixup_cpu(cpu) != 0) {
73583e770bf7SBruno Larsen (billionai)             error_setg(errp, "Unable to emulate selected CPU with TCG");
73593e770bf7SBruno Larsen (billionai)             goto unrealize;
73603e770bf7SBruno Larsen (billionai)         }
73613e770bf7SBruno Larsen (billionai)     }
73623e770bf7SBruno Larsen (billionai) 
73633e770bf7SBruno Larsen (billionai)     create_ppc_opcodes(cpu, &local_err);
73643e770bf7SBruno Larsen (billionai)     if (local_err != NULL) {
73653e770bf7SBruno Larsen (billionai)         error_propagate(errp, local_err);
73663e770bf7SBruno Larsen (billionai)         goto unrealize;
73673e770bf7SBruno Larsen (billionai)     }
73683e770bf7SBruno Larsen (billionai)     init_ppc_proc(cpu);
73693e770bf7SBruno Larsen (billionai) 
73703e770bf7SBruno Larsen (billionai)     ppc_gdb_init(cs, pcc);
73713e770bf7SBruno Larsen (billionai)     qemu_init_vcpu(cs);
73723e770bf7SBruno Larsen (billionai) 
73733e770bf7SBruno Larsen (billionai)     pcc->parent_realize(dev, errp);
73743e770bf7SBruno Larsen (billionai) 
73753e770bf7SBruno Larsen (billionai)     return;
73763e770bf7SBruno Larsen (billionai) 
73773e770bf7SBruno Larsen (billionai) unrealize:
73783e770bf7SBruno Larsen (billionai)     cpu_exec_unrealizefn(cs);
73793e770bf7SBruno Larsen (billionai) }
73803e770bf7SBruno Larsen (billionai) 
73813e770bf7SBruno Larsen (billionai) static void ppc_cpu_unrealize(DeviceState *dev)
73823e770bf7SBruno Larsen (billionai) {
73833e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(dev);
73843e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
73853e770bf7SBruno Larsen (billionai) 
73863e770bf7SBruno Larsen (billionai)     pcc->parent_unrealize(dev);
73873e770bf7SBruno Larsen (billionai) 
73883e770bf7SBruno Larsen (billionai)     cpu_remove_sync(CPU(cpu));
73893e770bf7SBruno Larsen (billionai) 
73903e770bf7SBruno Larsen (billionai)     destroy_ppc_opcodes(cpu);
73913e770bf7SBruno Larsen (billionai) }
73923e770bf7SBruno Larsen (billionai) 
73933e770bf7SBruno Larsen (billionai) static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b)
73943e770bf7SBruno Larsen (billionai) {
73953e770bf7SBruno Larsen (billionai)     ObjectClass *oc = (ObjectClass *)a;
73963e770bf7SBruno Larsen (billionai)     uint32_t pvr = *(uint32_t *)b;
73973e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = (PowerPCCPUClass *)a;
73983e770bf7SBruno Larsen (billionai) 
73993e770bf7SBruno Larsen (billionai)     /* -cpu host does a PVR lookup during construction */
74003e770bf7SBruno Larsen (billionai)     if (unlikely(strcmp(object_class_get_name(oc),
74013e770bf7SBruno Larsen (billionai)                         TYPE_HOST_POWERPC_CPU) == 0)) {
74023e770bf7SBruno Larsen (billionai)         return -1;
74033e770bf7SBruno Larsen (billionai)     }
74043e770bf7SBruno Larsen (billionai) 
74053e770bf7SBruno Larsen (billionai)     return pcc->pvr == pvr ? 0 : -1;
74063e770bf7SBruno Larsen (billionai) }
74073e770bf7SBruno Larsen (billionai) 
74083e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr)
74093e770bf7SBruno Larsen (billionai) {
74103e770bf7SBruno Larsen (billionai)     GSList *list, *item;
74113e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = NULL;
74123e770bf7SBruno Larsen (billionai) 
74133e770bf7SBruno Larsen (billionai)     list = object_class_get_list(TYPE_POWERPC_CPU, false);
74143e770bf7SBruno Larsen (billionai)     item = g_slist_find_custom(list, &pvr, ppc_cpu_compare_class_pvr);
74153e770bf7SBruno Larsen (billionai)     if (item != NULL) {
74163e770bf7SBruno Larsen (billionai)         pcc = POWERPC_CPU_CLASS(item->data);
74173e770bf7SBruno Larsen (billionai)     }
74183e770bf7SBruno Larsen (billionai)     g_slist_free(list);
74193e770bf7SBruno Larsen (billionai) 
74203e770bf7SBruno Larsen (billionai)     return pcc;
74213e770bf7SBruno Larsen (billionai) }
74223e770bf7SBruno Larsen (billionai) 
74233e770bf7SBruno Larsen (billionai) static gint ppc_cpu_compare_class_pvr_mask(gconstpointer a, gconstpointer b)
74243e770bf7SBruno Larsen (billionai) {
74253e770bf7SBruno Larsen (billionai)     ObjectClass *oc = (ObjectClass *)a;
74263e770bf7SBruno Larsen (billionai)     uint32_t pvr = *(uint32_t *)b;
74273e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = (PowerPCCPUClass *)a;
74283e770bf7SBruno Larsen (billionai) 
74293e770bf7SBruno Larsen (billionai)     /* -cpu host does a PVR lookup during construction */
74303e770bf7SBruno Larsen (billionai)     if (unlikely(strcmp(object_class_get_name(oc),
74313e770bf7SBruno Larsen (billionai)                         TYPE_HOST_POWERPC_CPU) == 0)) {
74323e770bf7SBruno Larsen (billionai)         return -1;
74333e770bf7SBruno Larsen (billionai)     }
74343e770bf7SBruno Larsen (billionai) 
74353e770bf7SBruno Larsen (billionai)     if (pcc->pvr_match(pcc, pvr)) {
74363e770bf7SBruno Larsen (billionai)         return 0;
74373e770bf7SBruno Larsen (billionai)     }
74383e770bf7SBruno Larsen (billionai) 
74393e770bf7SBruno Larsen (billionai)     return -1;
74403e770bf7SBruno Larsen (billionai) }
74413e770bf7SBruno Larsen (billionai) 
74423e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr)
74433e770bf7SBruno Larsen (billionai) {
74443e770bf7SBruno Larsen (billionai)     GSList *list, *item;
74453e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = NULL;
74463e770bf7SBruno Larsen (billionai) 
74473e770bf7SBruno Larsen (billionai)     list = object_class_get_list(TYPE_POWERPC_CPU, true);
74483e770bf7SBruno Larsen (billionai)     item = g_slist_find_custom(list, &pvr, ppc_cpu_compare_class_pvr_mask);
74493e770bf7SBruno Larsen (billionai)     if (item != NULL) {
74503e770bf7SBruno Larsen (billionai)         pcc = POWERPC_CPU_CLASS(item->data);
74513e770bf7SBruno Larsen (billionai)     }
74523e770bf7SBruno Larsen (billionai)     g_slist_free(list);
74533e770bf7SBruno Larsen (billionai) 
74543e770bf7SBruno Larsen (billionai)     return pcc;
74553e770bf7SBruno Larsen (billionai) }
74563e770bf7SBruno Larsen (billionai) 
74573e770bf7SBruno Larsen (billionai) static const char *ppc_cpu_lookup_alias(const char *alias)
74583e770bf7SBruno Larsen (billionai) {
74593e770bf7SBruno Larsen (billionai)     int ai;
74603e770bf7SBruno Larsen (billionai) 
74613e770bf7SBruno Larsen (billionai)     for (ai = 0; ppc_cpu_aliases[ai].alias != NULL; ai++) {
74623e770bf7SBruno Larsen (billionai)         if (strcmp(ppc_cpu_aliases[ai].alias, alias) == 0) {
74633e770bf7SBruno Larsen (billionai)             return ppc_cpu_aliases[ai].model;
74643e770bf7SBruno Larsen (billionai)         }
74653e770bf7SBruno Larsen (billionai)     }
74663e770bf7SBruno Larsen (billionai) 
74673e770bf7SBruno Larsen (billionai)     return NULL;
74683e770bf7SBruno Larsen (billionai) }
74693e770bf7SBruno Larsen (billionai) 
74703e770bf7SBruno Larsen (billionai) static ObjectClass *ppc_cpu_class_by_name(const char *name)
74713e770bf7SBruno Larsen (billionai) {
74723e770bf7SBruno Larsen (billionai)     char *cpu_model, *typename;
74733e770bf7SBruno Larsen (billionai)     ObjectClass *oc;
74743e770bf7SBruno Larsen (billionai)     const char *p;
74753e770bf7SBruno Larsen (billionai)     unsigned long pvr;
74763e770bf7SBruno Larsen (billionai) 
74773e770bf7SBruno Larsen (billionai)     /*
74783e770bf7SBruno Larsen (billionai)      * Lookup by PVR if cpu_model is valid 8 digit hex number (excl:
74793e770bf7SBruno Larsen (billionai)      * 0x prefix if present)
74803e770bf7SBruno Larsen (billionai)      */
74813e770bf7SBruno Larsen (billionai)     if (!qemu_strtoul(name, &p, 16, &pvr)) {
74823e770bf7SBruno Larsen (billionai)         int len = p - name;
74833e770bf7SBruno Larsen (billionai)         len = (len == 10) && (name[1] == 'x') ? len - 2 : len;
74843e770bf7SBruno Larsen (billionai)         if ((len == 8) && (*p == '\0')) {
74853e770bf7SBruno Larsen (billionai)             return OBJECT_CLASS(ppc_cpu_class_by_pvr(pvr));
74863e770bf7SBruno Larsen (billionai)         }
74873e770bf7SBruno Larsen (billionai)     }
74883e770bf7SBruno Larsen (billionai) 
74893e770bf7SBruno Larsen (billionai)     cpu_model = g_ascii_strdown(name, -1);
74903e770bf7SBruno Larsen (billionai)     p = ppc_cpu_lookup_alias(cpu_model);
74913e770bf7SBruno Larsen (billionai)     if (p) {
74923e770bf7SBruno Larsen (billionai)         g_free(cpu_model);
74933e770bf7SBruno Larsen (billionai)         cpu_model = g_strdup(p);
74943e770bf7SBruno Larsen (billionai)     }
74953e770bf7SBruno Larsen (billionai) 
74963e770bf7SBruno Larsen (billionai)     typename = g_strdup_printf("%s" POWERPC_CPU_TYPE_SUFFIX, cpu_model);
74973e770bf7SBruno Larsen (billionai)     oc = object_class_by_name(typename);
74983e770bf7SBruno Larsen (billionai)     g_free(typename);
74993e770bf7SBruno Larsen (billionai)     g_free(cpu_model);
75003e770bf7SBruno Larsen (billionai) 
75013e770bf7SBruno Larsen (billionai)     return oc;
75023e770bf7SBruno Larsen (billionai) }
75033e770bf7SBruno Larsen (billionai) 
75043e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
75053e770bf7SBruno Larsen (billionai) {
75063e770bf7SBruno Larsen (billionai)     ObjectClass *oc = OBJECT_CLASS(pcc);
75073e770bf7SBruno Larsen (billionai) 
75083e770bf7SBruno Larsen (billionai)     while (oc && !object_class_is_abstract(oc)) {
75093e770bf7SBruno Larsen (billionai)         oc = object_class_get_parent(oc);
75103e770bf7SBruno Larsen (billionai)     }
75113e770bf7SBruno Larsen (billionai)     assert(oc);
75123e770bf7SBruno Larsen (billionai) 
75133e770bf7SBruno Larsen (billionai)     return POWERPC_CPU_CLASS(oc);
75143e770bf7SBruno Larsen (billionai) }
75153e770bf7SBruno Larsen (billionai) 
75163e770bf7SBruno Larsen (billionai) /* Sort by PVR, ordering special case "host" last. */
75173e770bf7SBruno Larsen (billionai) static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b)
75183e770bf7SBruno Larsen (billionai) {
75193e770bf7SBruno Larsen (billionai)     ObjectClass *oc_a = (ObjectClass *)a;
75203e770bf7SBruno Larsen (billionai)     ObjectClass *oc_b = (ObjectClass *)b;
75213e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc_a = POWERPC_CPU_CLASS(oc_a);
75223e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc_b = POWERPC_CPU_CLASS(oc_b);
75233e770bf7SBruno Larsen (billionai)     const char *name_a = object_class_get_name(oc_a);
75243e770bf7SBruno Larsen (billionai)     const char *name_b = object_class_get_name(oc_b);
75253e770bf7SBruno Larsen (billionai) 
75263e770bf7SBruno Larsen (billionai)     if (strcmp(name_a, TYPE_HOST_POWERPC_CPU) == 0) {
75273e770bf7SBruno Larsen (billionai)         return 1;
75283e770bf7SBruno Larsen (billionai)     } else if (strcmp(name_b, TYPE_HOST_POWERPC_CPU) == 0) {
75293e770bf7SBruno Larsen (billionai)         return -1;
75303e770bf7SBruno Larsen (billionai)     } else {
75313e770bf7SBruno Larsen (billionai)         /* Avoid an integer overflow during subtraction */
75323e770bf7SBruno Larsen (billionai)         if (pcc_a->pvr < pcc_b->pvr) {
75333e770bf7SBruno Larsen (billionai)             return -1;
75343e770bf7SBruno Larsen (billionai)         } else if (pcc_a->pvr > pcc_b->pvr) {
75353e770bf7SBruno Larsen (billionai)             return 1;
75363e770bf7SBruno Larsen (billionai)         } else {
75373e770bf7SBruno Larsen (billionai)             return 0;
75383e770bf7SBruno Larsen (billionai)         }
75393e770bf7SBruno Larsen (billionai)     }
75403e770bf7SBruno Larsen (billionai) }
75413e770bf7SBruno Larsen (billionai) 
75423e770bf7SBruno Larsen (billionai) static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
75433e770bf7SBruno Larsen (billionai) {
75443e770bf7SBruno Larsen (billionai)     ObjectClass *oc = data;
75453e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
75463e770bf7SBruno Larsen (billionai)     DeviceClass *family = DEVICE_CLASS(ppc_cpu_get_family_class(pcc));
75473e770bf7SBruno Larsen (billionai)     const char *typename = object_class_get_name(oc);
75483e770bf7SBruno Larsen (billionai)     char *name;
75493e770bf7SBruno Larsen (billionai)     int i;
75503e770bf7SBruno Larsen (billionai) 
75513e770bf7SBruno Larsen (billionai)     if (unlikely(strcmp(typename, TYPE_HOST_POWERPC_CPU) == 0)) {
75523e770bf7SBruno Larsen (billionai)         return;
75533e770bf7SBruno Larsen (billionai)     }
75543e770bf7SBruno Larsen (billionai) 
75553e770bf7SBruno Larsen (billionai)     name = g_strndup(typename,
75563e770bf7SBruno Larsen (billionai)                      strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
75573e770bf7SBruno Larsen (billionai)     qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr);
75583e770bf7SBruno Larsen (billionai)     for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
75593e770bf7SBruno Larsen (billionai)         PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
75603e770bf7SBruno Larsen (billionai)         ObjectClass *alias_oc = ppc_cpu_class_by_name(alias->model);
75613e770bf7SBruno Larsen (billionai) 
75623e770bf7SBruno Larsen (billionai)         if (alias_oc != oc) {
75633e770bf7SBruno Larsen (billionai)             continue;
75643e770bf7SBruno Larsen (billionai)         }
75653e770bf7SBruno Larsen (billionai)         /*
75663e770bf7SBruno Larsen (billionai)          * If running with KVM, we might update the family alias later, so
75673e770bf7SBruno Larsen (billionai)          * avoid printing the wrong alias here and use "preferred" instead
75683e770bf7SBruno Larsen (billionai)          */
75693e770bf7SBruno Larsen (billionai)         if (strcmp(alias->alias, family->desc) == 0) {
75703e770bf7SBruno Larsen (billionai)             qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n",
75713e770bf7SBruno Larsen (billionai)                         alias->alias, family->desc);
75723e770bf7SBruno Larsen (billionai)         } else {
75733e770bf7SBruno Larsen (billionai)             qemu_printf("PowerPC %-16s (alias for %s)\n",
75743e770bf7SBruno Larsen (billionai)                         alias->alias, name);
75753e770bf7SBruno Larsen (billionai)         }
75763e770bf7SBruno Larsen (billionai)     }
75773e770bf7SBruno Larsen (billionai)     g_free(name);
75783e770bf7SBruno Larsen (billionai) }
75793e770bf7SBruno Larsen (billionai) 
75803e770bf7SBruno Larsen (billionai) void ppc_cpu_list(void)
75813e770bf7SBruno Larsen (billionai) {
75823e770bf7SBruno Larsen (billionai)     GSList *list;
75833e770bf7SBruno Larsen (billionai) 
75843e770bf7SBruno Larsen (billionai)     list = object_class_get_list(TYPE_POWERPC_CPU, false);
75853e770bf7SBruno Larsen (billionai)     list = g_slist_sort(list, ppc_cpu_list_compare);
75863e770bf7SBruno Larsen (billionai)     g_slist_foreach(list, ppc_cpu_list_entry, NULL);
75873e770bf7SBruno Larsen (billionai)     g_slist_free(list);
75883e770bf7SBruno Larsen (billionai) 
75893e770bf7SBruno Larsen (billionai) #ifdef CONFIG_KVM
75903e770bf7SBruno Larsen (billionai)     qemu_printf("\n");
759161848717SMarkus Armbruster     qemu_printf("PowerPC %s\n", "host");
75923e770bf7SBruno Larsen (billionai) #endif
75933e770bf7SBruno Larsen (billionai) }
75943e770bf7SBruno Larsen (billionai) 
75953e770bf7SBruno Larsen (billionai) static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
75963e770bf7SBruno Larsen (billionai) {
75973e770bf7SBruno Larsen (billionai)     ObjectClass *oc = data;
75983e770bf7SBruno Larsen (billionai)     CpuDefinitionInfoList **first = user_data;
75993e770bf7SBruno Larsen (billionai)     const char *typename;
76003e770bf7SBruno Larsen (billionai)     CpuDefinitionInfo *info;
76013e770bf7SBruno Larsen (billionai) 
76023e770bf7SBruno Larsen (billionai)     typename = object_class_get_name(oc);
76033e770bf7SBruno Larsen (billionai)     info = g_malloc0(sizeof(*info));
76043e770bf7SBruno Larsen (billionai)     info->name = g_strndup(typename,
76053e770bf7SBruno Larsen (billionai)                            strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
76063e770bf7SBruno Larsen (billionai) 
76073e770bf7SBruno Larsen (billionai)     QAPI_LIST_PREPEND(*first, info);
76083e770bf7SBruno Larsen (billionai) }
76093e770bf7SBruno Larsen (billionai) 
76103e770bf7SBruno Larsen (billionai) CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
76113e770bf7SBruno Larsen (billionai) {
76123e770bf7SBruno Larsen (billionai)     CpuDefinitionInfoList *cpu_list = NULL;
76133e770bf7SBruno Larsen (billionai)     GSList *list;
76143e770bf7SBruno Larsen (billionai)     int i;
76153e770bf7SBruno Larsen (billionai) 
76163e770bf7SBruno Larsen (billionai)     list = object_class_get_list(TYPE_POWERPC_CPU, false);
76173e770bf7SBruno Larsen (billionai)     g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
76183e770bf7SBruno Larsen (billionai)     g_slist_free(list);
76193e770bf7SBruno Larsen (billionai) 
76203e770bf7SBruno Larsen (billionai)     for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
76213e770bf7SBruno Larsen (billionai)         PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
76223e770bf7SBruno Larsen (billionai)         ObjectClass *oc;
76233e770bf7SBruno Larsen (billionai)         CpuDefinitionInfo *info;
76243e770bf7SBruno Larsen (billionai) 
76253e770bf7SBruno Larsen (billionai)         oc = ppc_cpu_class_by_name(alias->model);
76263e770bf7SBruno Larsen (billionai)         if (oc == NULL) {
76273e770bf7SBruno Larsen (billionai)             continue;
76283e770bf7SBruno Larsen (billionai)         }
76293e770bf7SBruno Larsen (billionai) 
76303e770bf7SBruno Larsen (billionai)         info = g_malloc0(sizeof(*info));
76313e770bf7SBruno Larsen (billionai)         info->name = g_strdup(alias->alias);
76323e770bf7SBruno Larsen (billionai)         info->q_typename = g_strdup(object_class_get_name(oc));
76333e770bf7SBruno Larsen (billionai) 
76343e770bf7SBruno Larsen (billionai)         QAPI_LIST_PREPEND(cpu_list, info);
76353e770bf7SBruno Larsen (billionai)     }
76363e770bf7SBruno Larsen (billionai) 
76373e770bf7SBruno Larsen (billionai)     return cpu_list;
76383e770bf7SBruno Larsen (billionai) }
76393e770bf7SBruno Larsen (billionai) 
76403e770bf7SBruno Larsen (billionai) static void ppc_cpu_set_pc(CPUState *cs, vaddr value)
76413e770bf7SBruno Larsen (billionai) {
76423e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
76433e770bf7SBruno Larsen (billionai) 
76443e770bf7SBruno Larsen (billionai)     cpu->env.nip = value;
76453e770bf7SBruno Larsen (billionai) }
76463e770bf7SBruno Larsen (billionai) 
76473e770bf7SBruno Larsen (billionai) static bool ppc_cpu_has_work(CPUState *cs)
76483e770bf7SBruno Larsen (billionai) {
76493e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
76503e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
76513e770bf7SBruno Larsen (billionai) 
76523e770bf7SBruno Larsen (billionai)     return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD);
76533e770bf7SBruno Larsen (billionai) }
76543e770bf7SBruno Larsen (billionai) 
76553e770bf7SBruno Larsen (billionai) static void ppc_cpu_reset(DeviceState *dev)
76563e770bf7SBruno Larsen (billionai) {
76573e770bf7SBruno Larsen (billionai)     CPUState *s = CPU(dev);
76583e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(s);
76593e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
76603e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
76613e770bf7SBruno Larsen (billionai)     target_ulong msr;
76623e770bf7SBruno Larsen (billionai)     int i;
76633e770bf7SBruno Larsen (billionai) 
76643e770bf7SBruno Larsen (billionai)     pcc->parent_reset(dev);
76653e770bf7SBruno Larsen (billionai) 
76663e770bf7SBruno Larsen (billionai)     msr = (target_ulong)0;
76673e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)MSR_HVB;
76683e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_EP;
76693e770bf7SBruno Larsen (billionai) #if defined(DO_SINGLE_STEP) && 0
76703e770bf7SBruno Larsen (billionai)     /* Single step trace mode */
76713e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_SE;
76723e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_BE;
76733e770bf7SBruno Larsen (billionai) #endif
76743e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY)
76753e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_FP; /* Allow floating point usage */
76763e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_FE0; /* Allow floating point exceptions */
76773e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_FE1;
76783e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_VR; /* Allow altivec usage */
76793e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_VSX; /* Allow VSX usage */
76803e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_SPE; /* Allow SPE usage */
76813e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_PR;
76823e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
76833e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_TM; /* Transactional memory */
76843e770bf7SBruno Larsen (billionai) #endif
76853e770bf7SBruno Larsen (billionai) #if !defined(TARGET_WORDS_BIGENDIAN)
76863e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */
76873e770bf7SBruno Larsen (billionai)     if (!((env->msr_mask >> MSR_LE) & 1)) {
76883e770bf7SBruno Larsen (billionai)         fprintf(stderr, "Selected CPU does not support little-endian.\n");
76893e770bf7SBruno Larsen (billionai)         exit(1);
76903e770bf7SBruno Larsen (billionai)     }
76913e770bf7SBruno Larsen (billionai) #endif
76923e770bf7SBruno Larsen (billionai) #endif
76933e770bf7SBruno Larsen (billionai) 
76943e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
76953e770bf7SBruno Larsen (billionai)     if (mmu_is_64bit(env->mmu_model)) {
76963e770bf7SBruno Larsen (billionai)         msr |= (1ULL << MSR_SF);
76973e770bf7SBruno Larsen (billionai)     }
76983e770bf7SBruno Larsen (billionai) #endif
76993e770bf7SBruno Larsen (billionai) 
77003e770bf7SBruno Larsen (billionai)     hreg_store_msr(env, msr, 1);
77013e770bf7SBruno Larsen (billionai) 
77023e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
77033e770bf7SBruno Larsen (billionai)     env->nip = env->hreset_vector | env->excp_prefix;
770489bb5a4dSLucas Mateus Castro (alqotel) #if defined(CONFIG_TCG)
77053e770bf7SBruno Larsen (billionai)     if (env->mmu_model != POWERPC_MMU_REAL) {
77063e770bf7SBruno Larsen (billionai)         ppc_tlb_invalidate_all(env);
77073e770bf7SBruno Larsen (billionai)     }
770889bb5a4dSLucas Mateus Castro (alqotel) #endif /* CONFIG_TCG */
77093e770bf7SBruno Larsen (billionai) #endif
77103e770bf7SBruno Larsen (billionai) 
77116e8b9903SRichard Henderson     pmu_update_summaries(env);
77123e770bf7SBruno Larsen (billionai)     hreg_compute_hflags(env);
77133e770bf7SBruno Larsen (billionai)     env->reserve_addr = (target_ulong)-1ULL;
77143e770bf7SBruno Larsen (billionai)     /* Be sure no exception or interrupt is pending */
77153e770bf7SBruno Larsen (billionai)     env->pending_interrupts = 0;
77163e770bf7SBruno Larsen (billionai)     s->exception_index = POWERPC_EXCP_NONE;
77173e770bf7SBruno Larsen (billionai)     env->error_code = 0;
77183e770bf7SBruno Larsen (billionai)     ppc_irq_reset(cpu);
77193e770bf7SBruno Larsen (billionai) 
77203e770bf7SBruno Larsen (billionai)     /* tininess for underflow is detected before rounding */
77213e770bf7SBruno Larsen (billionai)     set_float_detect_tininess(float_tininess_before_rounding,
77223e770bf7SBruno Larsen (billionai)                               &env->fp_status);
77233e770bf7SBruno Larsen (billionai) 
77243e770bf7SBruno Larsen (billionai)     for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
77253e770bf7SBruno Larsen (billionai)         ppc_spr_t *spr = &env->spr_cb[i];
77263e770bf7SBruno Larsen (billionai) 
77273e770bf7SBruno Larsen (billionai)         if (!spr->name) {
77283e770bf7SBruno Larsen (billionai)             continue;
77293e770bf7SBruno Larsen (billionai)         }
77303e770bf7SBruno Larsen (billionai)         env->spr[i] = spr->default_value;
77313e770bf7SBruno Larsen (billionai)     }
77323e770bf7SBruno Larsen (billionai) }
77333e770bf7SBruno Larsen (billionai) 
77343e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
77353e770bf7SBruno Larsen (billionai) 
77363e770bf7SBruno Larsen (billionai) static bool ppc_cpu_is_big_endian(CPUState *cs)
77373e770bf7SBruno Larsen (billionai) {
77383e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
77393e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
77403e770bf7SBruno Larsen (billionai) 
77413e770bf7SBruno Larsen (billionai)     cpu_synchronize_state(cs);
77423e770bf7SBruno Larsen (billionai) 
77433e770bf7SBruno Larsen (billionai)     return !msr_le;
77443e770bf7SBruno Larsen (billionai) }
77453e770bf7SBruno Larsen (billionai) 
77463e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG
77473e770bf7SBruno Larsen (billionai) static void ppc_cpu_exec_enter(CPUState *cs)
77483e770bf7SBruno Larsen (billionai) {
77493e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
77503e770bf7SBruno Larsen (billionai) 
77513e770bf7SBruno Larsen (billionai)     if (cpu->vhyp) {
77523e770bf7SBruno Larsen (billionai)         PPCVirtualHypervisorClass *vhc =
77533e770bf7SBruno Larsen (billionai)             PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp);
77543e770bf7SBruno Larsen (billionai)         vhc->cpu_exec_enter(cpu->vhyp, cpu);
77553e770bf7SBruno Larsen (billionai)     }
77563e770bf7SBruno Larsen (billionai) }
77573e770bf7SBruno Larsen (billionai) 
77583e770bf7SBruno Larsen (billionai) static void ppc_cpu_exec_exit(CPUState *cs)
77593e770bf7SBruno Larsen (billionai) {
77603e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
77613e770bf7SBruno Larsen (billionai) 
77623e770bf7SBruno Larsen (billionai)     if (cpu->vhyp) {
77633e770bf7SBruno Larsen (billionai)         PPCVirtualHypervisorClass *vhc =
77643e770bf7SBruno Larsen (billionai)             PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp);
77653e770bf7SBruno Larsen (billionai)         vhc->cpu_exec_exit(cpu->vhyp, cpu);
77663e770bf7SBruno Larsen (billionai)     }
77673e770bf7SBruno Larsen (billionai) }
77683e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */
77693e770bf7SBruno Larsen (billionai) 
77703e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
77713e770bf7SBruno Larsen (billionai) 
77723e770bf7SBruno Larsen (billionai) static void ppc_cpu_instance_init(Object *obj)
77733e770bf7SBruno Larsen (billionai) {
77743e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(obj);
77753e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
77763e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
77773e770bf7SBruno Larsen (billionai) 
77783e770bf7SBruno Larsen (billionai)     cpu_set_cpustate_pointers(cpu);
77793e770bf7SBruno Larsen (billionai)     cpu->vcpu_id = UNASSIGNED_CPU_INDEX;
77803e770bf7SBruno Larsen (billionai) 
77813e770bf7SBruno Larsen (billionai)     env->msr_mask = pcc->msr_mask;
77823e770bf7SBruno Larsen (billionai)     env->mmu_model = pcc->mmu_model;
77833e770bf7SBruno Larsen (billionai)     env->excp_model = pcc->excp_model;
77843e770bf7SBruno Larsen (billionai)     env->bus_model = pcc->bus_model;
77853e770bf7SBruno Larsen (billionai)     env->insns_flags = pcc->insns_flags;
77863e770bf7SBruno Larsen (billionai)     env->insns_flags2 = pcc->insns_flags2;
77873e770bf7SBruno Larsen (billionai)     env->flags = pcc->flags;
77883e770bf7SBruno Larsen (billionai)     env->bfd_mach = pcc->bfd_mach;
77893e770bf7SBruno Larsen (billionai)     env->check_pow = pcc->check_pow;
77903e770bf7SBruno Larsen (billionai) 
77913e770bf7SBruno Larsen (billionai)     /*
77923e770bf7SBruno Larsen (billionai)      * Mark HV mode as supported if the CPU has an MSR_HV bit in the
77933e770bf7SBruno Larsen (billionai)      * msr_mask. The mask can later be cleared by PAPR mode but the hv
77943e770bf7SBruno Larsen (billionai)      * mode support will remain, thus enforcing that we cannot use
77953e770bf7SBruno Larsen (billionai)      * priv. instructions in guest in PAPR mode. For 970 we currently
77963e770bf7SBruno Larsen (billionai)      * simply don't set HV in msr_mask thus simulating an "Apple mode"
77973e770bf7SBruno Larsen (billionai)      * 970. If we ever want to support 970 HV mode, we'll have to add
77983e770bf7SBruno Larsen (billionai)      * a processor attribute of some sort.
77993e770bf7SBruno Larsen (billionai)      */
78003e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
78013e770bf7SBruno Larsen (billionai)     env->has_hv_mode = !!(env->msr_mask & MSR_HVB);
78023e770bf7SBruno Larsen (billionai) #endif
78033e770bf7SBruno Larsen (billionai) 
78043e770bf7SBruno Larsen (billionai)     ppc_hash64_init(cpu);
78053e770bf7SBruno Larsen (billionai) }
78063e770bf7SBruno Larsen (billionai) 
78073e770bf7SBruno Larsen (billionai) static void ppc_cpu_instance_finalize(Object *obj)
78083e770bf7SBruno Larsen (billionai) {
78093e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(obj);
78103e770bf7SBruno Larsen (billionai) 
78113e770bf7SBruno Larsen (billionai)     ppc_hash64_finalize(cpu);
78123e770bf7SBruno Larsen (billionai) }
78133e770bf7SBruno Larsen (billionai) 
78143e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_default(PowerPCCPUClass *pcc, uint32_t pvr)
78153e770bf7SBruno Larsen (billionai) {
78163e770bf7SBruno Larsen (billionai)     return pcc->pvr == pvr;
78173e770bf7SBruno Larsen (billionai) }
78183e770bf7SBruno Larsen (billionai) 
78193e770bf7SBruno Larsen (billionai) static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)
78203e770bf7SBruno Larsen (billionai) {
78213e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
78223e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
78233e770bf7SBruno Larsen (billionai) 
78243e770bf7SBruno Larsen (billionai)     if ((env->hflags >> MSR_LE) & 1) {
78253e770bf7SBruno Larsen (billionai)         info->endian = BFD_ENDIAN_LITTLE;
78263e770bf7SBruno Larsen (billionai)     }
78273e770bf7SBruno Larsen (billionai)     info->mach = env->bfd_mach;
78283e770bf7SBruno Larsen (billionai)     if (!env->bfd_mach) {
78293e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64
78303e770bf7SBruno Larsen (billionai)         info->mach = bfd_mach_ppc64;
78313e770bf7SBruno Larsen (billionai) #else
78323e770bf7SBruno Larsen (billionai)         info->mach = bfd_mach_ppc;
78333e770bf7SBruno Larsen (billionai) #endif
78343e770bf7SBruno Larsen (billionai)     }
78353e770bf7SBruno Larsen (billionai)     info->disassembler_options = (char *)"any";
78363e770bf7SBruno Larsen (billionai)     info->print_insn = print_insn_ppc;
78373e770bf7SBruno Larsen (billionai) 
78383e770bf7SBruno Larsen (billionai)     info->cap_arch = CS_ARCH_PPC;
78393e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64
78403e770bf7SBruno Larsen (billionai)     info->cap_mode = CS_MODE_64;
78413e770bf7SBruno Larsen (billionai) #endif
78423e770bf7SBruno Larsen (billionai) }
78433e770bf7SBruno Larsen (billionai) 
78443e770bf7SBruno Larsen (billionai) static Property ppc_cpu_properties[] = {
78453e770bf7SBruno Larsen (billionai)     DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU, pre_2_8_migration, false),
78463e770bf7SBruno Larsen (billionai)     DEFINE_PROP_BOOL("pre-2.10-migration", PowerPCCPU, pre_2_10_migration,
78473e770bf7SBruno Larsen (billionai)                      false),
78483e770bf7SBruno Larsen (billionai)     DEFINE_PROP_BOOL("pre-3.0-migration", PowerPCCPU, pre_3_0_migration,
78493e770bf7SBruno Larsen (billionai)                      false),
78503e770bf7SBruno Larsen (billionai)     DEFINE_PROP_END_OF_LIST(),
78513e770bf7SBruno Larsen (billionai) };
78523e770bf7SBruno Larsen (billionai) 
78538b80bd28SPhilippe Mathieu-Daudé #ifndef CONFIG_USER_ONLY
78548b80bd28SPhilippe Mathieu-Daudé #include "hw/core/sysemu-cpu-ops.h"
78558b80bd28SPhilippe Mathieu-Daudé 
78568b80bd28SPhilippe Mathieu-Daudé static const struct SysemuCPUOps ppc_sysemu_ops = {
785708928c6dSPhilippe Mathieu-Daudé     .get_phys_page_debug = ppc_cpu_get_phys_page_debug,
7858715e3c1aSPhilippe Mathieu-Daudé     .write_elf32_note = ppc32_cpu_write_elf32_note,
7859715e3c1aSPhilippe Mathieu-Daudé     .write_elf64_note = ppc64_cpu_write_elf64_note,
7860da383e02SPhilippe Mathieu-Daudé     .virtio_is_big_endian = ppc_cpu_is_big_endian,
7861feece4d0SPhilippe Mathieu-Daudé     .legacy_vmsd = &vmstate_ppc_cpu,
78628b80bd28SPhilippe Mathieu-Daudé };
78638b80bd28SPhilippe Mathieu-Daudé #endif
78648b80bd28SPhilippe Mathieu-Daudé 
78653e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG
78663e770bf7SBruno Larsen (billionai) #include "hw/core/tcg-cpu-ops.h"
78673e770bf7SBruno Larsen (billionai) 
786811906557SRichard Henderson static const struct TCGCPUOps ppc_tcg_ops = {
78693e770bf7SBruno Larsen (billionai)   .initialize = ppc_translate_init,
78703e770bf7SBruno Larsen (billionai) 
78711db8af5cSRichard Henderson #ifdef CONFIG_USER_ONLY
78721db8af5cSRichard Henderson   .record_sigsegv = ppc_cpu_record_sigsegv,
78731db8af5cSRichard Henderson #else
78741db8af5cSRichard Henderson   .tlb_fill = ppc_cpu_tlb_fill,
7875f725245cSPhilippe Mathieu-Daudé   .cpu_exec_interrupt = ppc_cpu_exec_interrupt,
78763e770bf7SBruno Larsen (billionai)   .do_interrupt = ppc_cpu_do_interrupt,
78773e770bf7SBruno Larsen (billionai)   .cpu_exec_enter = ppc_cpu_exec_enter,
78783e770bf7SBruno Larsen (billionai)   .cpu_exec_exit = ppc_cpu_exec_exit,
78793e770bf7SBruno Larsen (billionai)   .do_unaligned_access = ppc_cpu_do_unaligned_access,
78803e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
78813e770bf7SBruno Larsen (billionai) };
78823e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */
78833e770bf7SBruno Larsen (billionai) 
78843e770bf7SBruno Larsen (billionai) static void ppc_cpu_class_init(ObjectClass *oc, void *data)
78853e770bf7SBruno Larsen (billionai) {
78863e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
78873e770bf7SBruno Larsen (billionai)     CPUClass *cc = CPU_CLASS(oc);
78883e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
78893e770bf7SBruno Larsen (billionai) 
78903e770bf7SBruno Larsen (billionai)     device_class_set_parent_realize(dc, ppc_cpu_realize,
78913e770bf7SBruno Larsen (billionai)                                     &pcc->parent_realize);
78923e770bf7SBruno Larsen (billionai)     device_class_set_parent_unrealize(dc, ppc_cpu_unrealize,
78933e770bf7SBruno Larsen (billionai)                                       &pcc->parent_unrealize);
78943e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_default;
78953e770bf7SBruno Larsen (billionai)     device_class_set_props(dc, ppc_cpu_properties);
78963e770bf7SBruno Larsen (billionai) 
78973e770bf7SBruno Larsen (billionai)     device_class_set_parent_reset(dc, ppc_cpu_reset, &pcc->parent_reset);
78983e770bf7SBruno Larsen (billionai) 
78993e770bf7SBruno Larsen (billionai)     cc->class_by_name = ppc_cpu_class_by_name;
79003e770bf7SBruno Larsen (billionai)     cc->has_work = ppc_cpu_has_work;
79013e770bf7SBruno Larsen (billionai)     cc->dump_state = ppc_cpu_dump_state;
79023e770bf7SBruno Larsen (billionai)     cc->set_pc = ppc_cpu_set_pc;
79033e770bf7SBruno Larsen (billionai)     cc->gdb_read_register = ppc_cpu_gdb_read_register;
79043e770bf7SBruno Larsen (billionai)     cc->gdb_write_register = ppc_cpu_gdb_write_register;
79053e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
79068b80bd28SPhilippe Mathieu-Daudé     cc->sysemu_ops = &ppc_sysemu_ops;
79073e770bf7SBruno Larsen (billionai) #endif
79083e770bf7SBruno Larsen (billionai) 
79093e770bf7SBruno Larsen (billionai)     cc->gdb_num_core_regs = 71;
79103e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
79113e770bf7SBruno Larsen (billionai)     cc->gdb_get_dynamic_xml = ppc_gdb_get_dynamic_xml;
79123e770bf7SBruno Larsen (billionai) #endif
79133e770bf7SBruno Larsen (billionai) #ifdef USE_APPLE_GDB
79143e770bf7SBruno Larsen (billionai)     cc->gdb_read_register = ppc_cpu_gdb_read_register_apple;
79153e770bf7SBruno Larsen (billionai)     cc->gdb_write_register = ppc_cpu_gdb_write_register_apple;
79163e770bf7SBruno Larsen (billionai)     cc->gdb_num_core_regs = 71 + 32;
79173e770bf7SBruno Larsen (billionai) #endif
79183e770bf7SBruno Larsen (billionai) 
79193e770bf7SBruno Larsen (billionai)     cc->gdb_arch_name = ppc_gdb_arch_name;
79203e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
79213e770bf7SBruno Larsen (billionai)     cc->gdb_core_xml_file = "power64-core.xml";
79223e770bf7SBruno Larsen (billionai) #else
79233e770bf7SBruno Larsen (billionai)     cc->gdb_core_xml_file = "power-core.xml";
79243e770bf7SBruno Larsen (billionai) #endif
79253e770bf7SBruno Larsen (billionai)     cc->disas_set_info = ppc_disas_set_info;
79263e770bf7SBruno Larsen (billionai) 
79273e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,UNKNOWN";
79283e770bf7SBruno Larsen (billionai) 
79293e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG
79303e770bf7SBruno Larsen (billionai)     cc->tcg_ops = &ppc_tcg_ops;
79313e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */
79323e770bf7SBruno Larsen (billionai) }
79333e770bf7SBruno Larsen (billionai) 
79343e770bf7SBruno Larsen (billionai) static const TypeInfo ppc_cpu_type_info = {
79353e770bf7SBruno Larsen (billionai)     .name = TYPE_POWERPC_CPU,
79363e770bf7SBruno Larsen (billionai)     .parent = TYPE_CPU,
79373e770bf7SBruno Larsen (billionai)     .instance_size = sizeof(PowerPCCPU),
79383e770bf7SBruno Larsen (billionai)     .instance_align = __alignof__(PowerPCCPU),
79393e770bf7SBruno Larsen (billionai)     .instance_init = ppc_cpu_instance_init,
79403e770bf7SBruno Larsen (billionai)     .instance_finalize = ppc_cpu_instance_finalize,
79413e770bf7SBruno Larsen (billionai)     .abstract = true,
79423e770bf7SBruno Larsen (billionai)     .class_size = sizeof(PowerPCCPUClass),
79433e770bf7SBruno Larsen (billionai)     .class_init = ppc_cpu_class_init,
79443e770bf7SBruno Larsen (billionai) };
79453e770bf7SBruno Larsen (billionai) 
79463e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
79473e770bf7SBruno Larsen (billionai) static const TypeInfo ppc_vhyp_type_info = {
79483e770bf7SBruno Larsen (billionai)     .name = TYPE_PPC_VIRTUAL_HYPERVISOR,
79493e770bf7SBruno Larsen (billionai)     .parent = TYPE_INTERFACE,
79503e770bf7SBruno Larsen (billionai)     .class_size = sizeof(PPCVirtualHypervisorClass),
79513e770bf7SBruno Larsen (billionai) };
79523e770bf7SBruno Larsen (billionai) #endif
79533e770bf7SBruno Larsen (billionai) 
79543e770bf7SBruno Larsen (billionai) static void ppc_cpu_register_types(void)
79553e770bf7SBruno Larsen (billionai) {
79563e770bf7SBruno Larsen (billionai)     type_register_static(&ppc_cpu_type_info);
79573e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
79583e770bf7SBruno Larsen (billionai)     type_register_static(&ppc_vhyp_type_info);
79593e770bf7SBruno Larsen (billionai) #endif
79603e770bf7SBruno Larsen (billionai) }
79613e770bf7SBruno Larsen (billionai) 
796247334e17SBruno Larsen (billionai) void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
796347334e17SBruno Larsen (billionai) {
796447334e17SBruno Larsen (billionai) #define RGPL  4
796547334e17SBruno Larsen (billionai) #define RFPL  4
796647334e17SBruno Larsen (billionai) 
796747334e17SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
796847334e17SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
796947334e17SBruno Larsen (billionai)     int i;
797047334e17SBruno Larsen (billionai) 
797147334e17SBruno Larsen (billionai)     qemu_fprintf(f, "NIP " TARGET_FMT_lx "   LR " TARGET_FMT_lx " CTR "
797247334e17SBruno Larsen (billionai)                  TARGET_FMT_lx " XER " TARGET_FMT_lx " CPU#%d\n",
797347334e17SBruno Larsen (billionai)                  env->nip, env->lr, env->ctr, cpu_read_xer(env),
797447334e17SBruno Larsen (billionai)                  cs->cpu_index);
797547334e17SBruno Larsen (billionai)     qemu_fprintf(f, "MSR " TARGET_FMT_lx " HID0 " TARGET_FMT_lx "  HF "
797647334e17SBruno Larsen (billionai)                  "%08x iidx %d didx %d\n",
797747334e17SBruno Larsen (billionai)                  env->msr, env->spr[SPR_HID0], env->hflags,
797847334e17SBruno Larsen (billionai)                  cpu_mmu_index(env, true), cpu_mmu_index(env, false));
797947334e17SBruno Larsen (billionai) #if !defined(NO_TIMER_DUMP)
798047334e17SBruno Larsen (billionai)     qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64
798147334e17SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
798247334e17SBruno Larsen (billionai)                  " DECR " TARGET_FMT_lu
798347334e17SBruno Larsen (billionai) #endif
798447334e17SBruno Larsen (billionai)                  "\n",
798547334e17SBruno Larsen (billionai)                  cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env)
798647334e17SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
798747334e17SBruno Larsen (billionai)                  , cpu_ppc_load_decr(env)
798847334e17SBruno Larsen (billionai) #endif
798947334e17SBruno Larsen (billionai)         );
799047334e17SBruno Larsen (billionai) #endif
799147334e17SBruno Larsen (billionai)     for (i = 0; i < 32; i++) {
799247334e17SBruno Larsen (billionai)         if ((i & (RGPL - 1)) == 0) {
799347334e17SBruno Larsen (billionai)             qemu_fprintf(f, "GPR%02d", i);
799447334e17SBruno Larsen (billionai)         }
799547334e17SBruno Larsen (billionai)         qemu_fprintf(f, " %016" PRIx64, ppc_dump_gpr(env, i));
799647334e17SBruno Larsen (billionai)         if ((i & (RGPL - 1)) == (RGPL - 1)) {
799747334e17SBruno Larsen (billionai)             qemu_fprintf(f, "\n");
799847334e17SBruno Larsen (billionai)         }
799947334e17SBruno Larsen (billionai)     }
800047334e17SBruno Larsen (billionai)     qemu_fprintf(f, "CR ");
800147334e17SBruno Larsen (billionai)     for (i = 0; i < 8; i++)
800247334e17SBruno Larsen (billionai)         qemu_fprintf(f, "%01x", env->crf[i]);
800347334e17SBruno Larsen (billionai)     qemu_fprintf(f, "  [");
800447334e17SBruno Larsen (billionai)     for (i = 0; i < 8; i++) {
800547334e17SBruno Larsen (billionai)         char a = '-';
800647334e17SBruno Larsen (billionai)         if (env->crf[i] & 0x08) {
800747334e17SBruno Larsen (billionai)             a = 'L';
800847334e17SBruno Larsen (billionai)         } else if (env->crf[i] & 0x04) {
800947334e17SBruno Larsen (billionai)             a = 'G';
801047334e17SBruno Larsen (billionai)         } else if (env->crf[i] & 0x02) {
801147334e17SBruno Larsen (billionai)             a = 'E';
801247334e17SBruno Larsen (billionai)         }
801347334e17SBruno Larsen (billionai)         qemu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' ');
801447334e17SBruno Larsen (billionai)     }
801547334e17SBruno Larsen (billionai)     qemu_fprintf(f, " ]             RES " TARGET_FMT_lx "\n",
801647334e17SBruno Larsen (billionai)                  env->reserve_addr);
801747334e17SBruno Larsen (billionai) 
801847334e17SBruno Larsen (billionai)     if (flags & CPU_DUMP_FPU) {
801947334e17SBruno Larsen (billionai)         for (i = 0; i < 32; i++) {
802047334e17SBruno Larsen (billionai)             if ((i & (RFPL - 1)) == 0) {
802147334e17SBruno Larsen (billionai)                 qemu_fprintf(f, "FPR%02d", i);
802247334e17SBruno Larsen (billionai)             }
802347334e17SBruno Larsen (billionai)             qemu_fprintf(f, " %016" PRIx64, *cpu_fpr_ptr(env, i));
802447334e17SBruno Larsen (billionai)             if ((i & (RFPL - 1)) == (RFPL - 1)) {
802547334e17SBruno Larsen (billionai)                 qemu_fprintf(f, "\n");
802647334e17SBruno Larsen (billionai)             }
802747334e17SBruno Larsen (billionai)         }
802847334e17SBruno Larsen (billionai)         qemu_fprintf(f, "FPSCR " TARGET_FMT_lx "\n", env->fpscr);
802947334e17SBruno Larsen (billionai)     }
803047334e17SBruno Larsen (billionai) 
803147334e17SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
803247334e17SBruno Larsen (billionai)     qemu_fprintf(f, " SRR0 " TARGET_FMT_lx "  SRR1 " TARGET_FMT_lx
803347334e17SBruno Larsen (billionai)                  "    PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n",
803447334e17SBruno Larsen (billionai)                  env->spr[SPR_SRR0], env->spr[SPR_SRR1],
803547334e17SBruno Larsen (billionai)                  env->spr[SPR_PVR], env->spr[SPR_VRSAVE]);
803647334e17SBruno Larsen (billionai) 
803747334e17SBruno Larsen (billionai)     qemu_fprintf(f, "SPRG0 " TARGET_FMT_lx " SPRG1 " TARGET_FMT_lx
803847334e17SBruno Larsen (billionai)                  "  SPRG2 " TARGET_FMT_lx "  SPRG3 " TARGET_FMT_lx "\n",
803947334e17SBruno Larsen (billionai)                  env->spr[SPR_SPRG0], env->spr[SPR_SPRG1],
804047334e17SBruno Larsen (billionai)                  env->spr[SPR_SPRG2], env->spr[SPR_SPRG3]);
804147334e17SBruno Larsen (billionai) 
804247334e17SBruno Larsen (billionai)     qemu_fprintf(f, "SPRG4 " TARGET_FMT_lx " SPRG5 " TARGET_FMT_lx
804347334e17SBruno Larsen (billionai)                  "  SPRG6 " TARGET_FMT_lx "  SPRG7 " TARGET_FMT_lx "\n",
804447334e17SBruno Larsen (billionai)                  env->spr[SPR_SPRG4], env->spr[SPR_SPRG5],
804547334e17SBruno Larsen (billionai)                  env->spr[SPR_SPRG6], env->spr[SPR_SPRG7]);
804647334e17SBruno Larsen (billionai) 
8047fbe08667SCédric Le Goater     switch (env->excp_model) {
804847334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64)
8049fbe08667SCédric Le Goater     case POWERPC_EXCP_POWER7:
8050fbe08667SCédric Le Goater     case POWERPC_EXCP_POWER8:
8051fbe08667SCédric Le Goater     case POWERPC_EXCP_POWER9:
8052fbe08667SCédric Le Goater     case POWERPC_EXCP_POWER10:
805347334e17SBruno Larsen (billionai)         qemu_fprintf(f, "HSRR0 " TARGET_FMT_lx " HSRR1 " TARGET_FMT_lx "\n",
805447334e17SBruno Larsen (billionai)                      env->spr[SPR_HSRR0], env->spr[SPR_HSRR1]);
8055fbe08667SCédric Le Goater         break;
805647334e17SBruno Larsen (billionai) #endif
8057fbe08667SCédric Le Goater     case POWERPC_EXCP_BOOKE:
805847334e17SBruno Larsen (billionai)         qemu_fprintf(f, "CSRR0 " TARGET_FMT_lx " CSRR1 " TARGET_FMT_lx
805947334e17SBruno Larsen (billionai)                      " MCSRR0 " TARGET_FMT_lx " MCSRR1 " TARGET_FMT_lx "\n",
806047334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_CSRR0], env->spr[SPR_BOOKE_CSRR1],
806147334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]);
806247334e17SBruno Larsen (billionai) 
806347334e17SBruno Larsen (billionai)         qemu_fprintf(f, "  TCR " TARGET_FMT_lx "   TSR " TARGET_FMT_lx
806447334e17SBruno Larsen (billionai)                      "    ESR " TARGET_FMT_lx "   DEAR " TARGET_FMT_lx "\n",
806547334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_TCR], env->spr[SPR_BOOKE_TSR],
806647334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_ESR], env->spr[SPR_BOOKE_DEAR]);
806747334e17SBruno Larsen (billionai) 
806847334e17SBruno Larsen (billionai)         qemu_fprintf(f, "  PIR " TARGET_FMT_lx " DECAR " TARGET_FMT_lx
806947334e17SBruno Larsen (billionai)                      "   IVPR " TARGET_FMT_lx "   EPCR " TARGET_FMT_lx "\n",
807047334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_PIR], env->spr[SPR_BOOKE_DECAR],
807147334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_IVPR], env->spr[SPR_BOOKE_EPCR]);
807247334e17SBruno Larsen (billionai) 
807347334e17SBruno Larsen (billionai)         qemu_fprintf(f, " MCSR " TARGET_FMT_lx " SPRG8 " TARGET_FMT_lx
807447334e17SBruno Larsen (billionai)                      "    EPR " TARGET_FMT_lx "\n",
807547334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MCSR], env->spr[SPR_BOOKE_SPRG8],
807647334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_EPR]);
807747334e17SBruno Larsen (billionai) 
807847334e17SBruno Larsen (billionai)         /* FSL-specific */
807947334e17SBruno Larsen (billionai)         qemu_fprintf(f, " MCAR " TARGET_FMT_lx "  PID1 " TARGET_FMT_lx
808047334e17SBruno Larsen (billionai)                      "   PID2 " TARGET_FMT_lx "    SVR " TARGET_FMT_lx "\n",
808147334e17SBruno Larsen (billionai)                      env->spr[SPR_Exxx_MCAR], env->spr[SPR_BOOKE_PID1],
808247334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_PID2], env->spr[SPR_E500_SVR]);
808347334e17SBruno Larsen (billionai) 
808447334e17SBruno Larsen (billionai)         /*
808547334e17SBruno Larsen (billionai)          * IVORs are left out as they are large and do not change often --
808647334e17SBruno Larsen (billionai)          * they can be read with "p $ivor0", "p $ivor1", etc.
808747334e17SBruno Larsen (billionai)          */
8088fbe08667SCédric Le Goater         break;
8089fbe08667SCédric Le Goater     case POWERPC_EXCP_40x:
8090fbe08667SCédric Le Goater         qemu_fprintf(f, "  TCR " TARGET_FMT_lx "   TSR " TARGET_FMT_lx
8091fbe08667SCédric Le Goater                      "    ESR " TARGET_FMT_lx "   DEAR " TARGET_FMT_lx "\n",
8092fbe08667SCédric Le Goater                      env->spr[SPR_40x_TCR], env->spr[SPR_40x_TSR],
8093fbe08667SCédric Le Goater                      env->spr[SPR_40x_ESR], env->spr[SPR_40x_DEAR]);
8094fbe08667SCédric Le Goater 
8095fbe08667SCédric Le Goater         qemu_fprintf(f, " EVPR " TARGET_FMT_lx "  SRR2 " TARGET_FMT_lx
8096fbe08667SCédric Le Goater                      "   SRR3 " TARGET_FMT_lx  "   PID " TARGET_FMT_lx "\n",
8097fbe08667SCédric Le Goater                      env->spr[SPR_40x_EVPR], env->spr[SPR_40x_SRR2],
8098fbe08667SCédric Le Goater                      env->spr[SPR_40x_SRR3], env->spr[SPR_40x_PID]);
8099fbe08667SCédric Le Goater         break;
8100fbe08667SCédric Le Goater     default:
8101fbe08667SCédric Le Goater         break;
810247334e17SBruno Larsen (billionai)     }
810347334e17SBruno Larsen (billionai) 
810447334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64)
810547334e17SBruno Larsen (billionai)     if (env->flags & POWERPC_FLAG_CFAR) {
810647334e17SBruno Larsen (billionai)         qemu_fprintf(f, " CFAR " TARGET_FMT_lx"\n", env->cfar);
810747334e17SBruno Larsen (billionai)     }
810847334e17SBruno Larsen (billionai) #endif
810947334e17SBruno Larsen (billionai) 
811047334e17SBruno Larsen (billionai)     if (env->spr_cb[SPR_LPCR].name) {
811147334e17SBruno Larsen (billionai)         qemu_fprintf(f, " LPCR " TARGET_FMT_lx "\n", env->spr[SPR_LPCR]);
811247334e17SBruno Larsen (billionai)     }
811347334e17SBruno Larsen (billionai) 
811447334e17SBruno Larsen (billionai)     switch (env->mmu_model) {
811547334e17SBruno Larsen (billionai)     case POWERPC_MMU_32B:
811647334e17SBruno Larsen (billionai)     case POWERPC_MMU_SOFT_6xx:
811747334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64)
811847334e17SBruno Larsen (billionai)     case POWERPC_MMU_64B:
811947334e17SBruno Larsen (billionai)     case POWERPC_MMU_2_03:
812047334e17SBruno Larsen (billionai)     case POWERPC_MMU_2_06:
812147334e17SBruno Larsen (billionai)     case POWERPC_MMU_2_07:
812247334e17SBruno Larsen (billionai)     case POWERPC_MMU_3_00:
812347334e17SBruno Larsen (billionai) #endif
812447334e17SBruno Larsen (billionai)         if (env->spr_cb[SPR_SDR1].name) { /* SDR1 Exists */
812547334e17SBruno Larsen (billionai)             qemu_fprintf(f, " SDR1 " TARGET_FMT_lx " ", env->spr[SPR_SDR1]);
812647334e17SBruno Larsen (billionai)         }
812747334e17SBruno Larsen (billionai)         if (env->spr_cb[SPR_PTCR].name) { /* PTCR Exists */
812847334e17SBruno Larsen (billionai)             qemu_fprintf(f, " PTCR " TARGET_FMT_lx " ", env->spr[SPR_PTCR]);
812947334e17SBruno Larsen (billionai)         }
813047334e17SBruno Larsen (billionai)         qemu_fprintf(f, "  DAR " TARGET_FMT_lx "  DSISR " TARGET_FMT_lx "\n",
813147334e17SBruno Larsen (billionai)                      env->spr[SPR_DAR], env->spr[SPR_DSISR]);
813247334e17SBruno Larsen (billionai)         break;
813347334e17SBruno Larsen (billionai)     case POWERPC_MMU_BOOKE206:
813447334e17SBruno Larsen (billionai)         qemu_fprintf(f, " MAS0 " TARGET_FMT_lx "  MAS1 " TARGET_FMT_lx
813547334e17SBruno Larsen (billionai)                      "   MAS2 " TARGET_FMT_lx "   MAS3 " TARGET_FMT_lx "\n",
813647334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MAS0], env->spr[SPR_BOOKE_MAS1],
813747334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MAS2], env->spr[SPR_BOOKE_MAS3]);
813847334e17SBruno Larsen (billionai) 
813947334e17SBruno Larsen (billionai)         qemu_fprintf(f, " MAS4 " TARGET_FMT_lx "  MAS6 " TARGET_FMT_lx
814047334e17SBruno Larsen (billionai)                      "   MAS7 " TARGET_FMT_lx "    PID " TARGET_FMT_lx "\n",
814147334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MAS4], env->spr[SPR_BOOKE_MAS6],
814247334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MAS7], env->spr[SPR_BOOKE_PID]);
814347334e17SBruno Larsen (billionai) 
814447334e17SBruno Larsen (billionai)         qemu_fprintf(f, "MMUCFG " TARGET_FMT_lx " TLB0CFG " TARGET_FMT_lx
814547334e17SBruno Larsen (billionai)                      " TLB1CFG " TARGET_FMT_lx "\n",
814647334e17SBruno Larsen (billionai)                      env->spr[SPR_MMUCFG], env->spr[SPR_BOOKE_TLB0CFG],
814747334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_TLB1CFG]);
814847334e17SBruno Larsen (billionai)         break;
814947334e17SBruno Larsen (billionai)     default:
815047334e17SBruno Larsen (billionai)         break;
815147334e17SBruno Larsen (billionai)     }
815247334e17SBruno Larsen (billionai) #endif
815347334e17SBruno Larsen (billionai) 
815447334e17SBruno Larsen (billionai) #undef RGPL
815547334e17SBruno Larsen (billionai) #undef RFPL
815647334e17SBruno Larsen (billionai) }
81573e770bf7SBruno Larsen (billionai) type_init(ppc_cpu_register_types)
8158