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) 469*1a71c5d1SFabiano Rosas static void register_755_sprs(CPUPPCState *env) 4703e770bf7SBruno Larsen (billionai) { 4713e770bf7SBruno Larsen (billionai) /* SGPRs */ 4723e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG4, "SPRG4", 4733e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 4743e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 4753e770bf7SBruno Larsen (billionai) 0x00000000); 4763e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG5, "SPRG5", 4773e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 4783e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 4793e770bf7SBruno Larsen (billionai) 0x00000000); 4803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG6, "SPRG6", 4813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 4823e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 4833e770bf7SBruno Larsen (billionai) 0x00000000); 4843e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG7, "SPRG7", 4853e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 4863e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 4873e770bf7SBruno Larsen (billionai) 0x00000000); 4883e770bf7SBruno Larsen (billionai) } 4893e770bf7SBruno Larsen (billionai) 4903e770bf7SBruno Larsen (billionai) /* SPR common to all 7xx PowerPC implementations */ 4913e770bf7SBruno Larsen (billionai) static void register_7xx_sprs(CPUPPCState *env) 4923e770bf7SBruno Larsen (billionai) { 4933e770bf7SBruno Larsen (billionai) /* Breakpoints */ 4943e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_DABR, "DABR", 4953e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 4963e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 4973e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DABR, 0x00000000); 498acf629ebSFabiano Rosas 4993e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IABR, "IABR", 5003e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5013e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5023e770bf7SBruno Larsen (billionai) 0x00000000); 5033e770bf7SBruno Larsen (billionai) /* Cache management */ 5043e770bf7SBruno Larsen (billionai) spr_register(env, SPR_ICTC, "ICTC", 5053e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5063e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5073e770bf7SBruno Larsen (billionai) 0x00000000); 5083e770bf7SBruno Larsen (billionai) /* Performance monitors */ 5093e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_MMCR0, "MMCR0", 5103e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5113e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5123e770bf7SBruno Larsen (billionai) 0x00000000); 513acf629ebSFabiano Rosas 5143e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_MMCR1, "MMCR1", 5153e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5163e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5173e770bf7SBruno Larsen (billionai) 0x00000000); 518acf629ebSFabiano Rosas 5193e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC1, "PMC1", 5203e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5213e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5223e770bf7SBruno Larsen (billionai) 0x00000000); 523acf629ebSFabiano Rosas 5243e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC2, "PMC2", 5253e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5263e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5273e770bf7SBruno Larsen (billionai) 0x00000000); 528acf629ebSFabiano Rosas 5293e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC3, "PMC3", 5303e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5313e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5323e770bf7SBruno Larsen (billionai) 0x00000000); 533acf629ebSFabiano Rosas 5343e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC4, "PMC4", 5353e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5363e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5373e770bf7SBruno Larsen (billionai) 0x00000000); 538acf629ebSFabiano Rosas 5393e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_SIAR, "SIAR", 5403e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5413e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 5423e770bf7SBruno Larsen (billionai) 0x00000000); 543acf629ebSFabiano Rosas 5443e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UMMCR0, "UMMCR0", 5453e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5463e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5473e770bf7SBruno Larsen (billionai) 0x00000000); 548acf629ebSFabiano Rosas 5493e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UMMCR1, "UMMCR1", 5503e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5513e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5523e770bf7SBruno Larsen (billionai) 0x00000000); 553acf629ebSFabiano Rosas 5543e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC1, "UPMC1", 5553e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5563e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5573e770bf7SBruno Larsen (billionai) 0x00000000); 558acf629ebSFabiano Rosas 5593e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC2, "UPMC2", 5603e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5613e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5623e770bf7SBruno Larsen (billionai) 0x00000000); 563acf629ebSFabiano Rosas 5643e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC3, "UPMC3", 5653e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5663e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5673e770bf7SBruno Larsen (billionai) 0x00000000); 568acf629ebSFabiano Rosas 5693e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC4, "UPMC4", 5703e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5713e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5723e770bf7SBruno Larsen (billionai) 0x00000000); 573acf629ebSFabiano Rosas 5743e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_USIAR, "USIAR", 5753e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5763e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 5773e770bf7SBruno Larsen (billionai) 0x00000000); 5783e770bf7SBruno Larsen (billionai) /* External access control */ 5793e770bf7SBruno Larsen (billionai) spr_register(env, SPR_EAR, "EAR", 5803e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5813e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 5823e770bf7SBruno Larsen (billionai) 0x00000000); 5833e770bf7SBruno Larsen (billionai) } 5843e770bf7SBruno Larsen (billionai) 5853e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64 5863e770bf7SBruno Larsen (billionai) static void register_amr_sprs(CPUPPCState *env) 5873e770bf7SBruno Larsen (billionai) { 5883e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY 5893e770bf7SBruno Larsen (billionai) /* 5903e770bf7SBruno Larsen (billionai) * Virtual Page Class Key protection 5913e770bf7SBruno Larsen (billionai) * 5923e770bf7SBruno Larsen (billionai) * The AMR is accessible either via SPR 13 or SPR 29. 13 is 5933e770bf7SBruno Larsen (billionai) * userspace accessible, 29 is privileged. So we only need to set 5943e770bf7SBruno Larsen (billionai) * the kvm ONE_REG id on one of them, we use 29 5953e770bf7SBruno Larsen (billionai) */ 5963e770bf7SBruno Larsen (billionai) spr_register(env, SPR_UAMR, "UAMR", 5973e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_amr, 5983e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_amr, 5993e770bf7SBruno Larsen (billionai) 0); 6003e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_AMR, "AMR", 6013e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6023e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_amr, 6033e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6043e770bf7SBruno Larsen (billionai) KVM_REG_PPC_AMR, 0); 6053e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_UAMOR, "UAMOR", 6063e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6073e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_uamor, 6083e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6093e770bf7SBruno Larsen (billionai) KVM_REG_PPC_UAMOR, 0); 6103e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_AMOR, "AMOR", 6113e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6123e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6133e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6143e770bf7SBruno Larsen (billionai) 0); 6153e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */ 6163e770bf7SBruno Larsen (billionai) } 6173e770bf7SBruno Larsen (billionai) 6183e770bf7SBruno Larsen (billionai) static void register_iamr_sprs(CPUPPCState *env) 6193e770bf7SBruno Larsen (billionai) { 6203e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY 6213e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_IAMR, "IAMR", 6223e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6233e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_iamr, 6243e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6253e770bf7SBruno Larsen (billionai) KVM_REG_PPC_IAMR, 0); 6263e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */ 6273e770bf7SBruno Larsen (billionai) } 6283e770bf7SBruno Larsen (billionai) #endif /* TARGET_PPC64 */ 6293e770bf7SBruno Larsen (billionai) 6303e770bf7SBruno Larsen (billionai) static void register_thrm_sprs(CPUPPCState *env) 6313e770bf7SBruno Larsen (billionai) { 6323e770bf7SBruno Larsen (billionai) /* Thermal management */ 6333e770bf7SBruno Larsen (billionai) spr_register(env, SPR_THRM1, "THRM1", 6343e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6353e770bf7SBruno Larsen (billionai) &spr_read_thrm, &spr_write_generic, 6363e770bf7SBruno Larsen (billionai) 0x00000000); 637acf629ebSFabiano Rosas 6383e770bf7SBruno Larsen (billionai) spr_register(env, SPR_THRM2, "THRM2", 6393e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6403e770bf7SBruno Larsen (billionai) &spr_read_thrm, &spr_write_generic, 6413e770bf7SBruno Larsen (billionai) 0x00000000); 642acf629ebSFabiano Rosas 6433e770bf7SBruno Larsen (billionai) spr_register(env, SPR_THRM3, "THRM3", 6443e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6453e770bf7SBruno Larsen (billionai) &spr_read_thrm, &spr_write_generic, 6463e770bf7SBruno Larsen (billionai) 0x00000000); 6473e770bf7SBruno Larsen (billionai) } 6483e770bf7SBruno Larsen (billionai) 6493e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 604 implementation */ 6503e770bf7SBruno Larsen (billionai) static void register_604_sprs(CPUPPCState *env) 6513e770bf7SBruno Larsen (billionai) { 6523e770bf7SBruno Larsen (billionai) /* Processor identification */ 6533e770bf7SBruno Larsen (billionai) spr_register(env, SPR_PIR, "PIR", 6543e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6553e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_pir, 6563e770bf7SBruno Larsen (billionai) 0x00000000); 6573e770bf7SBruno Larsen (billionai) /* Breakpoints */ 6583e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IABR, "IABR", 6593e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6603e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6613e770bf7SBruno Larsen (billionai) 0x00000000); 662acf629ebSFabiano Rosas 6633e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_DABR, "DABR", 6643e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6653e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6663e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DABR, 0x00000000); 6673e770bf7SBruno Larsen (billionai) /* Performance counters */ 6683e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_MMCR0, "MMCR0", 6693e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6703e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6713e770bf7SBruno Larsen (billionai) 0x00000000); 672acf629ebSFabiano Rosas 6733e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC1, "PMC1", 6743e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6753e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6763e770bf7SBruno Larsen (billionai) 0x00000000); 677acf629ebSFabiano Rosas 6783e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC2, "PMC2", 6793e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6803e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6813e770bf7SBruno Larsen (billionai) 0x00000000); 682acf629ebSFabiano Rosas 6833e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_SIAR, "SIAR", 6843e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6853e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 6863e770bf7SBruno Larsen (billionai) 0x00000000); 687acf629ebSFabiano Rosas 6883e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SDA, "SDA", 6893e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6903e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 6913e770bf7SBruno Larsen (billionai) 0x00000000); 6923e770bf7SBruno Larsen (billionai) /* External access control */ 6933e770bf7SBruno Larsen (billionai) spr_register(env, SPR_EAR, "EAR", 6943e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 6953e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 6963e770bf7SBruno Larsen (billionai) 0x00000000); 6973e770bf7SBruno Larsen (billionai) } 6983e770bf7SBruno Larsen (billionai) 6993e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 603 implementation */ 7003e770bf7SBruno Larsen (billionai) static void register_603_sprs(CPUPPCState *env) 7013e770bf7SBruno Larsen (billionai) { 7023e770bf7SBruno Larsen (billionai) /* External access control */ 7033e770bf7SBruno Larsen (billionai) spr_register(env, SPR_EAR, "EAR", 7043e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7053e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7063e770bf7SBruno Larsen (billionai) 0x00000000); 7073e770bf7SBruno Larsen (billionai) /* Breakpoints */ 7083e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IABR, "IABR", 7093e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7103e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7113e770bf7SBruno Larsen (billionai) 0x00000000); 7123e770bf7SBruno Larsen (billionai) 7133e770bf7SBruno Larsen (billionai) } 7143e770bf7SBruno Larsen (billionai) 7153e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC G2 implementation */ 7163e770bf7SBruno Larsen (billionai) static void register_G2_sprs(CPUPPCState *env) 7173e770bf7SBruno Larsen (billionai) { 7183e770bf7SBruno Larsen (billionai) /* Memory base address */ 7193e770bf7SBruno Larsen (billionai) /* MBAR */ 7203e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MBAR, "MBAR", 7213e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7223e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7233e770bf7SBruno Larsen (billionai) 0x00000000); 7243e770bf7SBruno Larsen (billionai) /* Exception processing */ 7253e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_CSRR0, "CSRR0", 7263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7283e770bf7SBruno Larsen (billionai) 0x00000000); 7293e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_CSRR1, "CSRR1", 7303e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7313e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7323e770bf7SBruno Larsen (billionai) 0x00000000); 7333e770bf7SBruno Larsen (billionai) /* Breakpoints */ 7343e770bf7SBruno Larsen (billionai) spr_register(env, SPR_DABR, "DABR", 7353e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7363e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7373e770bf7SBruno Larsen (billionai) 0x00000000); 738acf629ebSFabiano Rosas 7393e770bf7SBruno Larsen (billionai) spr_register(env, SPR_DABR2, "DABR2", 7403e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7413e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7423e770bf7SBruno Larsen (billionai) 0x00000000); 743acf629ebSFabiano Rosas 7443e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IABR, "IABR", 7453e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7463e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7473e770bf7SBruno Larsen (billionai) 0x00000000); 748acf629ebSFabiano Rosas 7493e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IABR2, "IABR2", 7503e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7513e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7523e770bf7SBruno Larsen (billionai) 0x00000000); 753acf629ebSFabiano Rosas 7543e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IBCR, "IBCR", 7553e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7563e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7573e770bf7SBruno Larsen (billionai) 0x00000000); 758acf629ebSFabiano Rosas 7593e770bf7SBruno Larsen (billionai) spr_register(env, SPR_DBCR, "DBCR", 7603e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 7613e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 7623e770bf7SBruno Larsen (billionai) 0x00000000); 763e599bcedSFabiano Rosas 764e599bcedSFabiano Rosas /* External access control */ 765e599bcedSFabiano Rosas spr_register(env, SPR_EAR, "EAR", 766e599bcedSFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 767e599bcedSFabiano Rosas &spr_read_generic, &spr_write_generic, 768e599bcedSFabiano Rosas 0x00000000); 769e599bcedSFabiano Rosas /* Hardware implementation register */ 770e599bcedSFabiano Rosas spr_register(env, SPR_HID0, "HID0", 771e599bcedSFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 772e599bcedSFabiano Rosas &spr_read_generic, &spr_write_generic, 773e599bcedSFabiano Rosas 0x00000000); 774e599bcedSFabiano Rosas 775e599bcedSFabiano Rosas spr_register(env, SPR_HID1, "HID1", 776e599bcedSFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 777e599bcedSFabiano Rosas &spr_read_generic, &spr_write_generic, 778e599bcedSFabiano Rosas 0x00000000); 779e599bcedSFabiano Rosas 780e599bcedSFabiano Rosas spr_register(env, SPR_HID2, "HID2", 781e599bcedSFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 782e599bcedSFabiano Rosas &spr_read_generic, &spr_write_generic, 783e599bcedSFabiano Rosas 0x00000000); 784e599bcedSFabiano Rosas 785*1a71c5d1SFabiano Rosas /* SGPRs */ 786*1a71c5d1SFabiano Rosas spr_register(env, SPR_SPRG4, "SPRG4", 787*1a71c5d1SFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 788*1a71c5d1SFabiano Rosas &spr_read_generic, &spr_write_generic, 789*1a71c5d1SFabiano Rosas 0x00000000); 790*1a71c5d1SFabiano Rosas spr_register(env, SPR_SPRG5, "SPRG5", 791*1a71c5d1SFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 792*1a71c5d1SFabiano Rosas &spr_read_generic, &spr_write_generic, 793*1a71c5d1SFabiano Rosas 0x00000000); 794*1a71c5d1SFabiano Rosas spr_register(env, SPR_SPRG6, "SPRG6", 795*1a71c5d1SFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 796*1a71c5d1SFabiano Rosas &spr_read_generic, &spr_write_generic, 797*1a71c5d1SFabiano Rosas 0x00000000); 798*1a71c5d1SFabiano Rosas spr_register(env, SPR_SPRG7, "SPRG7", 799*1a71c5d1SFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 800*1a71c5d1SFabiano Rosas &spr_read_generic, &spr_write_generic, 801*1a71c5d1SFabiano Rosas 0x00000000); 8023e770bf7SBruno Larsen (billionai) } 8033e770bf7SBruno Larsen (billionai) 8043e770bf7SBruno Larsen (billionai) static void register_74xx_sprs(CPUPPCState *env) 8053e770bf7SBruno Larsen (billionai) { 8063e770bf7SBruno Larsen (billionai) /* Processor identification */ 8073e770bf7SBruno Larsen (billionai) spr_register(env, SPR_PIR, "PIR", 8083e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8093e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_pir, 8103e770bf7SBruno Larsen (billionai) 0x00000000); 811acf629ebSFabiano Rosas 8123e770bf7SBruno Larsen (billionai) spr_register(env, SPR_74XX_MMCR2, "MMCR2", 8133e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8143e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8153e770bf7SBruno Larsen (billionai) 0x00000000); 816acf629ebSFabiano Rosas 8173e770bf7SBruno Larsen (billionai) spr_register(env, SPR_74XX_UMMCR2, "UMMCR2", 8183e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8193e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8203e770bf7SBruno Larsen (billionai) 0x00000000); 821acf629ebSFabiano Rosas 8223e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BAMR, "BAMR", 8233e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8243e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8253e770bf7SBruno Larsen (billionai) 0x00000000); 826acf629ebSFabiano Rosas 8273e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MSSCR0, "MSSCR0", 8283e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8293e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8303e770bf7SBruno Larsen (billionai) 0x00000000); 8313e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 8323e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 8333e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8343e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8353e770bf7SBruno Larsen (billionai) 0x00000000); 836acf629ebSFabiano Rosas 8373e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 8383e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8393e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8403e770bf7SBruno Larsen (billionai) 0x00000000); 8413e770bf7SBruno Larsen (billionai) /* Altivec */ 8423e770bf7SBruno Larsen (billionai) spr_register(env, SPR_VRSAVE, "VRSAVE", 8433e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8443e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8453e770bf7SBruno Larsen (billionai) 0x00000000); 846acf629ebSFabiano Rosas 8473e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2CR, "L2CR", 8483e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8493e770bf7SBruno Larsen (billionai) &spr_read_generic, spr_access_nop, 8503e770bf7SBruno Larsen (billionai) 0x00000000); 8513e770bf7SBruno Larsen (billionai) } 8523e770bf7SBruno Larsen (billionai) 8533e770bf7SBruno Larsen (billionai) static void register_l3_ctrl(CPUPPCState *env) 8543e770bf7SBruno Larsen (billionai) { 8553e770bf7SBruno Larsen (billionai) /* L3CR */ 8563e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3CR, "L3CR", 8573e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8583e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8593e770bf7SBruno Larsen (billionai) 0x00000000); 8603e770bf7SBruno Larsen (billionai) /* L3ITCR0 */ 8613e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3ITCR0, "L3ITCR0", 8623e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8633e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8643e770bf7SBruno Larsen (billionai) 0x00000000); 8653e770bf7SBruno Larsen (billionai) /* L3PM */ 8663e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3PM, "L3PM", 8673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 8683e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 8693e770bf7SBruno Larsen (billionai) 0x00000000); 8703e770bf7SBruno Larsen (billionai) } 8713e770bf7SBruno Larsen (billionai) 8723e770bf7SBruno Larsen (billionai) static void register_usprg3_sprs(CPUPPCState *env) 8733e770bf7SBruno Larsen (billionai) { 8743e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG3, "USPRG3", 8753e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8763e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8773e770bf7SBruno Larsen (billionai) 0x00000000); 8783e770bf7SBruno Larsen (billionai) } 8793e770bf7SBruno Larsen (billionai) 8803e770bf7SBruno Larsen (billionai) static void register_usprgh_sprs(CPUPPCState *env) 8813e770bf7SBruno Larsen (billionai) { 8823e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG4, "USPRG4", 8833e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8843e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8853e770bf7SBruno Larsen (billionai) 0x00000000); 8863e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG5, "USPRG5", 8873e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8883e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8893e770bf7SBruno Larsen (billionai) 0x00000000); 8903e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG6, "USPRG6", 8913e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8923e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8933e770bf7SBruno Larsen (billionai) 0x00000000); 8943e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG7, "USPRG7", 8953e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8963e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 8973e770bf7SBruno Larsen (billionai) 0x00000000); 8983e770bf7SBruno Larsen (billionai) } 8993e770bf7SBruno Larsen (billionai) 9003e770bf7SBruno Larsen (billionai) /* PowerPC BookE SPR */ 9013e770bf7SBruno Larsen (billionai) static void register_BookE_sprs(CPUPPCState *env, uint64_t ivor_mask) 9023e770bf7SBruno Larsen (billionai) { 9033e770bf7SBruno Larsen (billionai) const char *ivor_names[64] = { 9043e770bf7SBruno Larsen (billionai) "IVOR0", "IVOR1", "IVOR2", "IVOR3", 9053e770bf7SBruno Larsen (billionai) "IVOR4", "IVOR5", "IVOR6", "IVOR7", 9063e770bf7SBruno Larsen (billionai) "IVOR8", "IVOR9", "IVOR10", "IVOR11", 9073e770bf7SBruno Larsen (billionai) "IVOR12", "IVOR13", "IVOR14", "IVOR15", 9083e770bf7SBruno Larsen (billionai) "IVOR16", "IVOR17", "IVOR18", "IVOR19", 9093e770bf7SBruno Larsen (billionai) "IVOR20", "IVOR21", "IVOR22", "IVOR23", 9103e770bf7SBruno Larsen (billionai) "IVOR24", "IVOR25", "IVOR26", "IVOR27", 9113e770bf7SBruno Larsen (billionai) "IVOR28", "IVOR29", "IVOR30", "IVOR31", 9123e770bf7SBruno Larsen (billionai) "IVOR32", "IVOR33", "IVOR34", "IVOR35", 9133e770bf7SBruno Larsen (billionai) "IVOR36", "IVOR37", "IVOR38", "IVOR39", 9143e770bf7SBruno Larsen (billionai) "IVOR40", "IVOR41", "IVOR42", "IVOR43", 9153e770bf7SBruno Larsen (billionai) "IVOR44", "IVOR45", "IVOR46", "IVOR47", 9163e770bf7SBruno Larsen (billionai) "IVOR48", "IVOR49", "IVOR50", "IVOR51", 9173e770bf7SBruno Larsen (billionai) "IVOR52", "IVOR53", "IVOR54", "IVOR55", 9183e770bf7SBruno Larsen (billionai) "IVOR56", "IVOR57", "IVOR58", "IVOR59", 9193e770bf7SBruno Larsen (billionai) "IVOR60", "IVOR61", "IVOR62", "IVOR63", 9203e770bf7SBruno Larsen (billionai) }; 9213e770bf7SBruno Larsen (billionai) #define SPR_BOOKE_IVORxx (-1) 9223e770bf7SBruno Larsen (billionai) int ivor_sprn[64] = { 9233e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVOR0, SPR_BOOKE_IVOR1, SPR_BOOKE_IVOR2, SPR_BOOKE_IVOR3, 9243e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVOR4, SPR_BOOKE_IVOR5, SPR_BOOKE_IVOR6, SPR_BOOKE_IVOR7, 9253e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVOR8, SPR_BOOKE_IVOR9, SPR_BOOKE_IVOR10, SPR_BOOKE_IVOR11, 9263e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVOR12, SPR_BOOKE_IVOR13, SPR_BOOKE_IVOR14, SPR_BOOKE_IVOR15, 9273e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9283e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9293e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9303e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9313e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVOR32, SPR_BOOKE_IVOR33, SPR_BOOKE_IVOR34, SPR_BOOKE_IVOR35, 9323e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVOR36, SPR_BOOKE_IVOR37, SPR_BOOKE_IVOR38, SPR_BOOKE_IVOR39, 9333e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVOR40, SPR_BOOKE_IVOR41, SPR_BOOKE_IVOR42, SPR_BOOKE_IVORxx, 9343e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9353e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9363e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9373e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9383e770bf7SBruno Larsen (billionai) SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, 9393e770bf7SBruno Larsen (billionai) }; 9403e770bf7SBruno Larsen (billionai) int i; 9413e770bf7SBruno Larsen (billionai) 9423e770bf7SBruno Larsen (billionai) /* Interrupt processing */ 9433e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_CSRR0, "CSRR0", 9443e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9453e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9463e770bf7SBruno Larsen (billionai) 0x00000000); 9473e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_CSRR1, "CSRR1", 9483e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9493e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9503e770bf7SBruno Larsen (billionai) 0x00000000); 9513e770bf7SBruno Larsen (billionai) /* Debug */ 9523e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC1, "IAC1", 9533e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9543e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9553e770bf7SBruno Larsen (billionai) 0x00000000); 956acf629ebSFabiano Rosas 9573e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC2, "IAC2", 9583e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9593e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9603e770bf7SBruno Larsen (billionai) 0x00000000); 961acf629ebSFabiano Rosas 9623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DAC1, "DAC1", 9633e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9643e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9653e770bf7SBruno Larsen (billionai) 0x00000000); 966acf629ebSFabiano Rosas 9673e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DAC2, "DAC2", 9683e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9693e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9703e770bf7SBruno Larsen (billionai) 0x00000000); 971acf629ebSFabiano Rosas 9723e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DBCR0, "DBCR0", 9733e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9743e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_40x_dbcr0, 9753e770bf7SBruno Larsen (billionai) 0x00000000); 976acf629ebSFabiano Rosas 9773e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DBCR1, "DBCR1", 9783e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9793e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9803e770bf7SBruno Larsen (billionai) 0x00000000); 981acf629ebSFabiano Rosas 9823e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DBCR2, "DBCR2", 9833e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9843e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9853e770bf7SBruno Larsen (billionai) 0x00000000); 9863e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DSRR0, "DSRR0", 9873e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9883e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9893e770bf7SBruno Larsen (billionai) 0x00000000); 9903e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DSRR1, "DSRR1", 9913e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9923e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 9933e770bf7SBruno Larsen (billionai) 0x00000000); 994acf629ebSFabiano Rosas 9953e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DBSR, "DBSR", 9963e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 9973e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_clear, 9983e770bf7SBruno Larsen (billionai) 0x00000000); 9993e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DEAR, "DEAR", 10003e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10013e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10023e770bf7SBruno Larsen (billionai) 0x00000000); 10033e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_ESR, "ESR", 10043e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10053e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10063e770bf7SBruno Larsen (billionai) 0x00000000); 10073e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IVPR, "IVPR", 10083e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10093e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_excp_prefix, 10103e770bf7SBruno Larsen (billionai) 0x00000000); 10113e770bf7SBruno Larsen (billionai) /* Exception vectors */ 10123e770bf7SBruno Larsen (billionai) for (i = 0; i < 64; i++) { 10133e770bf7SBruno Larsen (billionai) if (ivor_mask & (1ULL << i)) { 10143e770bf7SBruno Larsen (billionai) if (ivor_sprn[i] == SPR_BOOKE_IVORxx) { 10153e770bf7SBruno Larsen (billionai) fprintf(stderr, "ERROR: IVOR %d SPR is not defined\n", i); 10163e770bf7SBruno Larsen (billionai) exit(1); 10173e770bf7SBruno Larsen (billionai) } 10183e770bf7SBruno Larsen (billionai) spr_register(env, ivor_sprn[i], ivor_names[i], 10193e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10203e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_excp_vector, 10213e770bf7SBruno Larsen (billionai) 0x00000000); 10223e770bf7SBruno Larsen (billionai) } 10233e770bf7SBruno Larsen (billionai) } 10243e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_PID, "PID", 10253e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10263e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_booke_pid, 10273e770bf7SBruno Larsen (billionai) 0x00000000); 10283e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_TCR, "TCR", 10293e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10303e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_booke_tcr, 10313e770bf7SBruno Larsen (billionai) 0x00000000); 10323e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_TSR, "TSR", 10333e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10343e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_booke_tsr, 10353e770bf7SBruno Larsen (billionai) 0x00000000); 10363e770bf7SBruno Larsen (billionai) /* Timer */ 10373e770bf7SBruno Larsen (billionai) spr_register(env, SPR_DECR, "DECR", 10383e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10393e770bf7SBruno Larsen (billionai) &spr_read_decr, &spr_write_decr, 10403e770bf7SBruno Larsen (billionai) 0x00000000); 10413e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DECAR, "DECAR", 10423e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10433e770bf7SBruno Larsen (billionai) SPR_NOACCESS, &spr_write_generic, 10443e770bf7SBruno Larsen (billionai) 0x00000000); 10453e770bf7SBruno Larsen (billionai) /* SPRGs */ 10463e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG0, "USPRG0", 10473e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10483e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10493e770bf7SBruno Larsen (billionai) 0x00000000); 10503e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG4, "SPRG4", 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_SPRG5, "SPRG5", 10553e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10563e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10573e770bf7SBruno Larsen (billionai) 0x00000000); 10583e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG6, "SPRG6", 10593e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10603e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10613e770bf7SBruno Larsen (billionai) 0x00000000); 10623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG7, "SPRG7", 10633e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10643e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10653e770bf7SBruno Larsen (billionai) 0x00000000); 10663e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_SPRG8, "SPRG8", 10673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10683e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10693e770bf7SBruno Larsen (billionai) 0x00000000); 10703e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_SPRG9, "SPRG9", 10713e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 10723e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 10733e770bf7SBruno Larsen (billionai) 0x00000000); 10743e770bf7SBruno Larsen (billionai) } 10753e770bf7SBruno Larsen (billionai) 10763e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 10773e770bf7SBruno Larsen (billionai) static inline uint32_t register_tlbncfg(uint32_t assoc, uint32_t minsize, 10783e770bf7SBruno Larsen (billionai) uint32_t maxsize, uint32_t flags, 10793e770bf7SBruno Larsen (billionai) uint32_t nentries) 10803e770bf7SBruno Larsen (billionai) { 10813e770bf7SBruno Larsen (billionai) return (assoc << TLBnCFG_ASSOC_SHIFT) | 10823e770bf7SBruno Larsen (billionai) (minsize << TLBnCFG_MINSIZE_SHIFT) | 10833e770bf7SBruno Larsen (billionai) (maxsize << TLBnCFG_MAXSIZE_SHIFT) | 10843e770bf7SBruno Larsen (billionai) flags | nentries; 10853e770bf7SBruno Larsen (billionai) } 10863e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */ 10873e770bf7SBruno Larsen (billionai) 10883e770bf7SBruno Larsen (billionai) /* BookE 2.06 storage control registers */ 10893e770bf7SBruno Larsen (billionai) static void register_BookE206_sprs(CPUPPCState *env, uint32_t mas_mask, 10903e770bf7SBruno Larsen (billionai) uint32_t *tlbncfg, uint32_t mmucfg) 10913e770bf7SBruno Larsen (billionai) { 10923e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 10933e770bf7SBruno Larsen (billionai) const char *mas_names[8] = { 10943e770bf7SBruno Larsen (billionai) "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7", 10953e770bf7SBruno Larsen (billionai) }; 10963e770bf7SBruno Larsen (billionai) int mas_sprn[8] = { 10973e770bf7SBruno Larsen (billionai) SPR_BOOKE_MAS0, SPR_BOOKE_MAS1, SPR_BOOKE_MAS2, SPR_BOOKE_MAS3, 10983e770bf7SBruno Larsen (billionai) SPR_BOOKE_MAS4, SPR_BOOKE_MAS5, SPR_BOOKE_MAS6, SPR_BOOKE_MAS7, 10993e770bf7SBruno Larsen (billionai) }; 11003e770bf7SBruno Larsen (billionai) int i; 11013e770bf7SBruno Larsen (billionai) 11023e770bf7SBruno Larsen (billionai) /* TLB assist registers */ 11033e770bf7SBruno Larsen (billionai) for (i = 0; i < 8; i++) { 11043e770bf7SBruno Larsen (billionai) if (mas_mask & (1 << i)) { 11053e770bf7SBruno Larsen (billionai) spr_register(env, mas_sprn[i], mas_names[i], 11063e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 110752e9612eSBruno Larsen (billionai) &spr_read_generic, 110852e9612eSBruno Larsen (billionai) (i == 2 && (env->insns_flags & PPC_64B)) 110952e9612eSBruno Larsen (billionai) ? &spr_write_generic : &spr_write_generic32, 11103e770bf7SBruno Larsen (billionai) 0x00000000); 11113e770bf7SBruno Larsen (billionai) } 11123e770bf7SBruno Larsen (billionai) } 11133e770bf7SBruno Larsen (billionai) if (env->nb_pids > 1) { 11143e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_PID1, "PID1", 11153e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11163e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_booke_pid, 11173e770bf7SBruno Larsen (billionai) 0x00000000); 11183e770bf7SBruno Larsen (billionai) } 11193e770bf7SBruno Larsen (billionai) if (env->nb_pids > 2) { 11203e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_PID2, "PID2", 11213e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11223e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_booke_pid, 11233e770bf7SBruno Larsen (billionai) 0x00000000); 11243e770bf7SBruno Larsen (billionai) } 11253e770bf7SBruno Larsen (billionai) 11263e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_EPLC, "EPLC", 11273e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11283e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_eplc, 11293e770bf7SBruno Larsen (billionai) 0x00000000); 11303e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_EPSC, "EPSC", 11313e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11323e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_epsc, 11333e770bf7SBruno Larsen (billionai) 0x00000000); 11343e770bf7SBruno Larsen (billionai) 11353e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MMUCFG, "MMUCFG", 11363e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11373e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 11383e770bf7SBruno Larsen (billionai) mmucfg); 11393e770bf7SBruno Larsen (billionai) switch (env->nb_ways) { 11403e770bf7SBruno Larsen (billionai) case 4: 11413e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_TLB3CFG, "TLB3CFG", 11423e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11433e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 11443e770bf7SBruno Larsen (billionai) tlbncfg[3]); 11453e770bf7SBruno Larsen (billionai) /* Fallthru */ 11463e770bf7SBruno Larsen (billionai) case 3: 11473e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_TLB2CFG, "TLB2CFG", 11483e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11493e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 11503e770bf7SBruno Larsen (billionai) tlbncfg[2]); 11513e770bf7SBruno Larsen (billionai) /* Fallthru */ 11523e770bf7SBruno Larsen (billionai) case 2: 11533e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG", 11543e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11553e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 11563e770bf7SBruno Larsen (billionai) tlbncfg[1]); 11573e770bf7SBruno Larsen (billionai) /* Fallthru */ 11583e770bf7SBruno Larsen (billionai) case 1: 11593e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG", 11603e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11613e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 11623e770bf7SBruno Larsen (billionai) tlbncfg[0]); 11633e770bf7SBruno Larsen (billionai) /* Fallthru */ 11643e770bf7SBruno Larsen (billionai) case 0: 11653e770bf7SBruno Larsen (billionai) default: 11663e770bf7SBruno Larsen (billionai) break; 11673e770bf7SBruno Larsen (billionai) } 11683e770bf7SBruno Larsen (billionai) #endif 11693e770bf7SBruno Larsen (billionai) } 11703e770bf7SBruno Larsen (billionai) 11713e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 440 implementation */ 11723e770bf7SBruno Larsen (billionai) static void register_440_sprs(CPUPPCState *env) 11733e770bf7SBruno Larsen (billionai) { 11743e770bf7SBruno Larsen (billionai) /* Cache control */ 11753e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DNV0, "DNV0", 11763e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11773e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 11783e770bf7SBruno Larsen (billionai) 0x00000000); 1179acf629ebSFabiano Rosas 11803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DNV1, "DNV1", 11813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11823e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 11833e770bf7SBruno Larsen (billionai) 0x00000000); 1184acf629ebSFabiano Rosas 11853e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DNV2, "DNV2", 11863e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11873e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 11883e770bf7SBruno Larsen (billionai) 0x00000000); 1189acf629ebSFabiano Rosas 11903e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DNV3, "DNV3", 11913e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11923e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 11933e770bf7SBruno Larsen (billionai) 0x00000000); 1194acf629ebSFabiano Rosas 11953e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DTV0, "DTV0", 11963e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 11973e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 11983e770bf7SBruno Larsen (billionai) 0x00000000); 1199acf629ebSFabiano Rosas 12003e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DTV1, "DTV1", 12013e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12023e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12033e770bf7SBruno Larsen (billionai) 0x00000000); 1204acf629ebSFabiano Rosas 12053e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DTV2, "DTV2", 12063e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12073e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12083e770bf7SBruno Larsen (billionai) 0x00000000); 1209acf629ebSFabiano Rosas 12103e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DTV3, "DTV3", 12113e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12123e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12133e770bf7SBruno Larsen (billionai) 0x00000000); 1214acf629ebSFabiano Rosas 12153e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DVLIM, "DVLIM", 12163e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12173e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12183e770bf7SBruno Larsen (billionai) 0x00000000); 1219acf629ebSFabiano Rosas 12203e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_INV0, "INV0", 12213e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12223e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12233e770bf7SBruno Larsen (billionai) 0x00000000); 1224acf629ebSFabiano Rosas 12253e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_INV1, "INV1", 12263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12283e770bf7SBruno Larsen (billionai) 0x00000000); 1229acf629ebSFabiano Rosas 12303e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_INV2, "INV2", 12313e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12323e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12333e770bf7SBruno Larsen (billionai) 0x00000000); 1234acf629ebSFabiano Rosas 12353e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_INV3, "INV3", 12363e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12373e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12383e770bf7SBruno Larsen (billionai) 0x00000000); 1239acf629ebSFabiano Rosas 12403e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_ITV0, "ITV0", 12413e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12423e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12433e770bf7SBruno Larsen (billionai) 0x00000000); 1244acf629ebSFabiano Rosas 12453e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_ITV1, "ITV1", 12463e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12473e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12483e770bf7SBruno Larsen (billionai) 0x00000000); 1249acf629ebSFabiano Rosas 12503e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_ITV2, "ITV2", 12513e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12523e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12533e770bf7SBruno Larsen (billionai) 0x00000000); 1254acf629ebSFabiano Rosas 12553e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_ITV3, "ITV3", 12563e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12573e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12583e770bf7SBruno Larsen (billionai) 0x00000000); 1259acf629ebSFabiano Rosas 12603e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_IVLIM, "IVLIM", 12613e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12623e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12633e770bf7SBruno Larsen (billionai) 0x00000000); 12643e770bf7SBruno Larsen (billionai) /* Cache debug */ 12653e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DCDBTRH, "DCDBTRH", 12663e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12673e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 12683e770bf7SBruno Larsen (billionai) 0x00000000); 1269acf629ebSFabiano Rosas 12703e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DCDBTRL, "DCDBTRL", 12713e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12723e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 12733e770bf7SBruno Larsen (billionai) 0x00000000); 1274acf629ebSFabiano Rosas 12753e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR", 12763e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12773e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 12783e770bf7SBruno Larsen (billionai) 0x00000000); 1279acf629ebSFabiano Rosas 12803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_ICDBTRH, "ICDBTRH", 12813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12823e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 12833e770bf7SBruno Larsen (billionai) 0x00000000); 1284acf629ebSFabiano Rosas 12853e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_ICDBTRL, "ICDBTRL", 12863e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12873e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 12883e770bf7SBruno Larsen (billionai) 0x00000000); 1289acf629ebSFabiano Rosas 12903e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_DBDR, "DBDR", 12913e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12923e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12933e770bf7SBruno Larsen (billionai) 0x00000000); 12943e770bf7SBruno Larsen (billionai) /* Processor control */ 12953e770bf7SBruno Larsen (billionai) spr_register(env, SPR_4xx_CCR0, "CCR0", 12963e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 12973e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 12983e770bf7SBruno Larsen (billionai) 0x00000000); 12993e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_RSTCFG, "RSTCFG", 13003e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13013e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 13023e770bf7SBruno Larsen (billionai) 0x00000000); 13033e770bf7SBruno Larsen (billionai) /* Storage control */ 13043e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_MMUCR, "MMUCR", 13053e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13063e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13073e770bf7SBruno Larsen (billionai) 0x00000000); 13083e770bf7SBruno Larsen (billionai) } 13093e770bf7SBruno Larsen (billionai) 13103e770bf7SBruno Larsen (billionai) /* SPR shared between PowerPC 40x implementations */ 13113e770bf7SBruno Larsen (billionai) static void register_40x_sprs(CPUPPCState *env) 13123e770bf7SBruno Larsen (billionai) { 13133e770bf7SBruno Larsen (billionai) /* Cache */ 13143e770bf7SBruno Larsen (billionai) /* not emulated, as QEMU do not emulate caches */ 13153e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_DCCR, "DCCR", 13163e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13173e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13183e770bf7SBruno Larsen (billionai) 0x00000000); 13193e770bf7SBruno Larsen (billionai) /* not emulated, as QEMU do not emulate caches */ 13203e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_ICCR, "ICCR", 13213e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13223e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13233e770bf7SBruno Larsen (billionai) 0x00000000); 13243e770bf7SBruno Larsen (billionai) /* not emulated, as QEMU do not emulate caches */ 13253e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR", 13263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13273e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 13283e770bf7SBruno Larsen (billionai) 0x00000000); 13293e770bf7SBruno Larsen (billionai) /* Exception */ 13303e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_DEAR, "DEAR", 13313e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13323e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13333e770bf7SBruno Larsen (billionai) 0x00000000); 13343e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_ESR, "ESR", 13353e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13363e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13373e770bf7SBruno Larsen (billionai) 0x00000000); 13383e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_EVPR, "EVPR", 13393e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13403e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_excp_prefix, 13413e770bf7SBruno Larsen (billionai) 0x00000000); 13423e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_SRR2, "SRR2", 13433e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13443e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13453e770bf7SBruno Larsen (billionai) 0x00000000); 13463e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_SRR3, "SRR3", 13473e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13483e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13493e770bf7SBruno Larsen (billionai) 0x00000000); 13503e770bf7SBruno Larsen (billionai) /* Timers */ 13513e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_PIT, "PIT", 13523e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13533e770bf7SBruno Larsen (billionai) &spr_read_40x_pit, &spr_write_40x_pit, 13543e770bf7SBruno Larsen (billionai) 0x00000000); 13553e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_TCR, "TCR", 13563e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 1357cbd8f17dSCédric Le Goater &spr_read_generic, &spr_write_40x_tcr, 13583e770bf7SBruno Larsen (billionai) 0x00000000); 13593e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_TSR, "TSR", 13603e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 1361cbd8f17dSCédric Le Goater &spr_read_generic, &spr_write_40x_tsr, 13623e770bf7SBruno Larsen (billionai) 0x00000000); 13633e770bf7SBruno Larsen (billionai) } 13643e770bf7SBruno Larsen (billionai) 13653e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 405 implementation */ 13663e770bf7SBruno Larsen (billionai) static void register_405_sprs(CPUPPCState *env) 13673e770bf7SBruno Larsen (billionai) { 13683e770bf7SBruno Larsen (billionai) /* MMU */ 13693e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_PID, "PID", 13703e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 1371dd69d140SCédric Le Goater &spr_read_generic, &spr_write_40x_pid, 13723e770bf7SBruno Larsen (billionai) 0x00000000); 13733e770bf7SBruno Larsen (billionai) spr_register(env, SPR_4xx_CCR0, "CCR0", 13743e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13753e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13763e770bf7SBruno Larsen (billionai) 0x00700000); 13773e770bf7SBruno Larsen (billionai) /* Debug interface */ 13783e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_DBCR0, "DBCR0", 13793e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13803e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_40x_dbcr0, 13813e770bf7SBruno Larsen (billionai) 0x00000000); 1382acf629ebSFabiano Rosas 13833e770bf7SBruno Larsen (billionai) spr_register(env, SPR_405_DBCR1, "DBCR1", 13843e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13853e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13863e770bf7SBruno Larsen (billionai) 0x00000000); 1387acf629ebSFabiano Rosas 13883e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_DBSR, "DBSR", 13893e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13903e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_clear, 13913e770bf7SBruno Larsen (billionai) /* Last reset was system reset */ 13923e770bf7SBruno Larsen (billionai) 0x00000300); 1393acf629ebSFabiano Rosas 13943e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_DAC1, "DAC1", 13953e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 13963e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 13973e770bf7SBruno Larsen (billionai) 0x00000000); 13983e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_DAC2, "DAC2", 13993e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14003e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14013e770bf7SBruno Larsen (billionai) 0x00000000); 1402acf629ebSFabiano Rosas 14033e770bf7SBruno Larsen (billionai) spr_register(env, SPR_405_DVC1, "DVC1", 14043e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14053e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14063e770bf7SBruno Larsen (billionai) 0x00000000); 1407acf629ebSFabiano Rosas 14083e770bf7SBruno Larsen (billionai) spr_register(env, SPR_405_DVC2, "DVC2", 14093e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14103e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14113e770bf7SBruno Larsen (billionai) 0x00000000); 1412acf629ebSFabiano Rosas 14133e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_IAC1, "IAC1", 14143e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14153e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14163e770bf7SBruno Larsen (billionai) 0x00000000); 14173e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_IAC2, "IAC2", 14183e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14193e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14203e770bf7SBruno Larsen (billionai) 0x00000000); 1421acf629ebSFabiano Rosas 14223e770bf7SBruno Larsen (billionai) spr_register(env, SPR_405_IAC3, "IAC3", 14233e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14243e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14253e770bf7SBruno Larsen (billionai) 0x00000000); 1426acf629ebSFabiano Rosas 14273e770bf7SBruno Larsen (billionai) spr_register(env, SPR_405_IAC4, "IAC4", 14283e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14293e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14303e770bf7SBruno Larsen (billionai) 0x00000000); 14313e770bf7SBruno Larsen (billionai) /* Storage control */ 14323e770bf7SBruno Larsen (billionai) spr_register(env, SPR_405_SLER, "SLER", 14333e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14343e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_40x_sler, 14353e770bf7SBruno Larsen (billionai) 0x00000000); 14363e770bf7SBruno Larsen (billionai) spr_register(env, SPR_40x_ZPR, "ZPR", 14373e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14383e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14393e770bf7SBruno Larsen (billionai) 0x00000000); 1440acf629ebSFabiano Rosas 14413e770bf7SBruno Larsen (billionai) spr_register(env, SPR_405_SU0R, "SU0R", 14423e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14433e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14443e770bf7SBruno Larsen (billionai) 0x00000000); 14453e770bf7SBruno Larsen (billionai) /* SPRG */ 14463e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG0, "USPRG0", 14473e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 14483e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 14493e770bf7SBruno Larsen (billionai) 0x00000000); 14503e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG4, "SPRG4", 14513e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14523e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14533e770bf7SBruno Larsen (billionai) 0x00000000); 14543e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG5, "SPRG5", 14553e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14563e770bf7SBruno Larsen (billionai) spr_read_generic, &spr_write_generic, 14573e770bf7SBruno Larsen (billionai) 0x00000000); 14583e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG6, "SPRG6", 14593e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14603e770bf7SBruno Larsen (billionai) spr_read_generic, &spr_write_generic, 14613e770bf7SBruno Larsen (billionai) 0x00000000); 14623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG7, "SPRG7", 14633e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14643e770bf7SBruno Larsen (billionai) spr_read_generic, &spr_write_generic, 14653e770bf7SBruno Larsen (billionai) 0x00000000); 1466acd1f788SFabiano Rosas 1467acd1f788SFabiano Rosas /* Bus access control */ 1468acd1f788SFabiano Rosas /* not emulated, as QEMU never does speculative access */ 1469acd1f788SFabiano Rosas spr_register(env, SPR_40x_SGR, "SGR", 1470acd1f788SFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 1471acd1f788SFabiano Rosas &spr_read_generic, &spr_write_generic, 1472acd1f788SFabiano Rosas 0xFFFFFFFF); 1473acd1f788SFabiano Rosas /* not emulated, as QEMU do not emulate caches */ 1474acd1f788SFabiano Rosas spr_register(env, SPR_40x_DCWR, "DCWR", 1475acd1f788SFabiano Rosas SPR_NOACCESS, SPR_NOACCESS, 1476acd1f788SFabiano Rosas &spr_read_generic, &spr_write_generic, 1477acd1f788SFabiano Rosas 0x00000000); 14783e770bf7SBruno Larsen (billionai) } 14793e770bf7SBruno Larsen (billionai) 14803e770bf7SBruno Larsen (billionai) 14813e770bf7SBruno Larsen (billionai) static void register_5xx_8xx_sprs(CPUPPCState *env) 14823e770bf7SBruno Larsen (billionai) { 14833e770bf7SBruno Larsen (billionai) /* Exception processing */ 14843e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_DSISR, "DSISR", 14853e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14863e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14873e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DSISR, 0x00000000); 14883e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_DAR, "DAR", 14893e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14903e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 14913e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DAR, 0x00000000); 14923e770bf7SBruno Larsen (billionai) /* Timer */ 14933e770bf7SBruno Larsen (billionai) spr_register(env, SPR_DECR, "DECR", 14943e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 14953e770bf7SBruno Larsen (billionai) &spr_read_decr, &spr_write_decr, 14963e770bf7SBruno Larsen (billionai) 0x00000000); 1497acf629ebSFabiano Rosas 14983e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_EIE, "EIE", 14993e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15003e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15013e770bf7SBruno Larsen (billionai) 0x00000000); 1502acf629ebSFabiano Rosas 15033e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_EID, "EID", 15043e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15053e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15063e770bf7SBruno Larsen (billionai) 0x00000000); 1507acf629ebSFabiano Rosas 15083e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_NRI, "NRI", 15093e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15103e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15113e770bf7SBruno Larsen (billionai) 0x00000000); 1512acf629ebSFabiano Rosas 15133e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_CMPA, "CMPA", 15143e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15153e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15163e770bf7SBruno Larsen (billionai) 0x00000000); 1517acf629ebSFabiano Rosas 15183e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_CMPB, "CMPB", 15193e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15203e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15213e770bf7SBruno Larsen (billionai) 0x00000000); 1522acf629ebSFabiano Rosas 15233e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_CMPC, "CMPC", 15243e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15253e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15263e770bf7SBruno Larsen (billionai) 0x00000000); 1527acf629ebSFabiano Rosas 15283e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_CMPD, "CMPD", 15293e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15303e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15313e770bf7SBruno Larsen (billionai) 0x00000000); 1532acf629ebSFabiano Rosas 15333e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_ECR, "ECR", 15343e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15353e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15363e770bf7SBruno Larsen (billionai) 0x00000000); 1537acf629ebSFabiano Rosas 15383e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_DER, "DER", 15393e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15403e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15413e770bf7SBruno Larsen (billionai) 0x00000000); 1542acf629ebSFabiano Rosas 15433e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_COUNTA, "COUNTA", 15443e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15453e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15463e770bf7SBruno Larsen (billionai) 0x00000000); 1547acf629ebSFabiano Rosas 15483e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_COUNTB, "COUNTB", 15493e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15503e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15513e770bf7SBruno Larsen (billionai) 0x00000000); 1552acf629ebSFabiano Rosas 15533e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_CMPE, "CMPE", 15543e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15553e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15563e770bf7SBruno Larsen (billionai) 0x00000000); 1557acf629ebSFabiano Rosas 15583e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_CMPF, "CMPF", 15593e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15603e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15613e770bf7SBruno Larsen (billionai) 0x00000000); 1562acf629ebSFabiano Rosas 15633e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_CMPG, "CMPG", 15643e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15653e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15663e770bf7SBruno Larsen (billionai) 0x00000000); 1567acf629ebSFabiano Rosas 15683e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_CMPH, "CMPH", 15693e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15703e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15713e770bf7SBruno Larsen (billionai) 0x00000000); 1572acf629ebSFabiano Rosas 15733e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_LCTRL1, "LCTRL1", 15743e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15753e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15763e770bf7SBruno Larsen (billionai) 0x00000000); 1577acf629ebSFabiano Rosas 15783e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_LCTRL2, "LCTRL2", 15793e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15803e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15813e770bf7SBruno Larsen (billionai) 0x00000000); 1582acf629ebSFabiano Rosas 15833e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_BAR, "BAR", 15843e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15853e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15863e770bf7SBruno Larsen (billionai) 0x00000000); 1587acf629ebSFabiano Rosas 15883e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_DPDR, "DPDR", 15893e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15903e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15913e770bf7SBruno Larsen (billionai) 0x00000000); 1592acf629ebSFabiano Rosas 15933e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_IMMR, "IMMR", 15943e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 15953e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 15963e770bf7SBruno Larsen (billionai) 0x00000000); 15973e770bf7SBruno Larsen (billionai) } 15983e770bf7SBruno Larsen (billionai) 15993e770bf7SBruno Larsen (billionai) static void register_5xx_sprs(CPUPPCState *env) 16003e770bf7SBruno Larsen (billionai) { 16013e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_GRA, "MI_GRA", 16023e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16033e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16043e770bf7SBruno Larsen (billionai) 0x00000000); 1605acf629ebSFabiano Rosas 16063e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_GRA, "L2U_GRA", 16073e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16083e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16093e770bf7SBruno Larsen (billionai) 0x00000000); 1610acf629ebSFabiano Rosas 16113e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RPCU_BBCMCR, "L2U_BBCMCR", 16123e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16133e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16143e770bf7SBruno Larsen (billionai) 0x00000000); 1615acf629ebSFabiano Rosas 16163e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_MCR, "L2U_MCR", 16173e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16183e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16193e770bf7SBruno Larsen (billionai) 0x00000000); 1620acf629ebSFabiano Rosas 16213e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_RBA0, "MI_RBA0", 16223e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16233e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16243e770bf7SBruno Larsen (billionai) 0x00000000); 1625acf629ebSFabiano Rosas 16263e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_RBA1, "MI_RBA1", 16273e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16283e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16293e770bf7SBruno Larsen (billionai) 0x00000000); 1630acf629ebSFabiano Rosas 16313e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_RBA2, "MI_RBA2", 16323e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16333e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16343e770bf7SBruno Larsen (billionai) 0x00000000); 1635acf629ebSFabiano Rosas 16363e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_RBA3, "MI_RBA3", 16373e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16383e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16393e770bf7SBruno Larsen (billionai) 0x00000000); 1640acf629ebSFabiano Rosas 16413e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_RBA0, "L2U_RBA0", 16423e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16433e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16443e770bf7SBruno Larsen (billionai) 0x00000000); 1645acf629ebSFabiano Rosas 16463e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_RBA1, "L2U_RBA1", 16473e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16483e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16493e770bf7SBruno Larsen (billionai) 0x00000000); 1650acf629ebSFabiano Rosas 16513e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_RBA2, "L2U_RBA2", 16523e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16533e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16543e770bf7SBruno Larsen (billionai) 0x00000000); 1655acf629ebSFabiano Rosas 16563e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_RBA3, "L2U_RBA3", 16573e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16583e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16593e770bf7SBruno Larsen (billionai) 0x00000000); 1660acf629ebSFabiano Rosas 16613e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_RA0, "MI_RA0", 16623e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16633e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16643e770bf7SBruno Larsen (billionai) 0x00000000); 1665acf629ebSFabiano Rosas 16663e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_RA1, "MI_RA1", 16673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16683e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16693e770bf7SBruno Larsen (billionai) 0x00000000); 1670acf629ebSFabiano Rosas 16713e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_RA2, "MI_RA2", 16723e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16733e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16743e770bf7SBruno Larsen (billionai) 0x00000000); 1675acf629ebSFabiano Rosas 16763e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_MI_RA3, "MI_RA3", 16773e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16783e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16793e770bf7SBruno Larsen (billionai) 0x00000000); 1680acf629ebSFabiano Rosas 16813e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_RA0, "L2U_RA0", 16823e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16833e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16843e770bf7SBruno Larsen (billionai) 0x00000000); 1685acf629ebSFabiano Rosas 16863e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_RA1, "L2U_RA1", 16873e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16883e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16893e770bf7SBruno Larsen (billionai) 0x00000000); 1690acf629ebSFabiano Rosas 16913e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_RA2, "L2U_RA2", 16923e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16933e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16943e770bf7SBruno Larsen (billionai) 0x00000000); 1695acf629ebSFabiano Rosas 16963e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_L2U_RA3, "L2U_RA3", 16973e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 16983e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 16993e770bf7SBruno Larsen (billionai) 0x00000000); 1700acf629ebSFabiano Rosas 17013e770bf7SBruno Larsen (billionai) spr_register(env, SPR_RCPU_FPECR, "FPECR", 17023e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17033e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17043e770bf7SBruno Larsen (billionai) 0x00000000); 17053e770bf7SBruno Larsen (billionai) } 17063e770bf7SBruno Larsen (billionai) 17073e770bf7SBruno Larsen (billionai) static void register_8xx_sprs(CPUPPCState *env) 17083e770bf7SBruno Larsen (billionai) { 1709acf629ebSFabiano Rosas 17103e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_IC_CST, "IC_CST", 17113e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17123e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17133e770bf7SBruno Larsen (billionai) 0x00000000); 1714acf629ebSFabiano Rosas 17153e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_IC_ADR, "IC_ADR", 17163e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17173e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17183e770bf7SBruno Larsen (billionai) 0x00000000); 1719acf629ebSFabiano Rosas 17203e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_IC_DAT, "IC_DAT", 17213e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17223e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17233e770bf7SBruno Larsen (billionai) 0x00000000); 1724acf629ebSFabiano Rosas 17253e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_DC_CST, "DC_CST", 17263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17283e770bf7SBruno Larsen (billionai) 0x00000000); 1729acf629ebSFabiano Rosas 17303e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_DC_ADR, "DC_ADR", 17313e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17323e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17333e770bf7SBruno Larsen (billionai) 0x00000000); 1734acf629ebSFabiano Rosas 17353e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_DC_DAT, "DC_DAT", 17363e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17373e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17383e770bf7SBruno Larsen (billionai) 0x00000000); 1739acf629ebSFabiano Rosas 17403e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MI_CTR, "MI_CTR", 17413e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17423e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17433e770bf7SBruno Larsen (billionai) 0x00000000); 1744acf629ebSFabiano Rosas 17453e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MI_AP, "MI_AP", 17463e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17473e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17483e770bf7SBruno Larsen (billionai) 0x00000000); 1749acf629ebSFabiano Rosas 17503e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MI_EPN, "MI_EPN", 17513e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17523e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17533e770bf7SBruno Larsen (billionai) 0x00000000); 1754acf629ebSFabiano Rosas 17553e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MI_TWC, "MI_TWC", 17563e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17573e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17583e770bf7SBruno Larsen (billionai) 0x00000000); 1759acf629ebSFabiano Rosas 17603e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MI_RPN, "MI_RPN", 17613e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17623e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17633e770bf7SBruno Larsen (billionai) 0x00000000); 1764acf629ebSFabiano Rosas 17653e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MI_DBCAM, "MI_DBCAM", 17663e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17673e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17683e770bf7SBruno Larsen (billionai) 0x00000000); 1769acf629ebSFabiano Rosas 17703e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MI_DBRAM0, "MI_DBRAM0", 17713e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17723e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17733e770bf7SBruno Larsen (billionai) 0x00000000); 1774acf629ebSFabiano Rosas 17753e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MI_DBRAM1, "MI_DBRAM1", 17763e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17773e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17783e770bf7SBruno Larsen (billionai) 0x00000000); 1779acf629ebSFabiano Rosas 17803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_CTR, "MD_CTR", 17813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17823e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17833e770bf7SBruno Larsen (billionai) 0x00000000); 1784acf629ebSFabiano Rosas 17853e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_CASID, "MD_CASID", 17863e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17873e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17883e770bf7SBruno Larsen (billionai) 0x00000000); 1789acf629ebSFabiano Rosas 17903e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_AP, "MD_AP", 17913e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17923e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17933e770bf7SBruno Larsen (billionai) 0x00000000); 1794acf629ebSFabiano Rosas 17953e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_EPN, "MD_EPN", 17963e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 17973e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 17983e770bf7SBruno Larsen (billionai) 0x00000000); 1799acf629ebSFabiano Rosas 18003e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_TWB, "MD_TWB", 18013e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 18023e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 18033e770bf7SBruno Larsen (billionai) 0x00000000); 1804acf629ebSFabiano Rosas 18053e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_TWC, "MD_TWC", 18063e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 18073e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 18083e770bf7SBruno Larsen (billionai) 0x00000000); 1809acf629ebSFabiano Rosas 18103e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_RPN, "MD_RPN", 18113e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 18123e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 18133e770bf7SBruno Larsen (billionai) 0x00000000); 1814acf629ebSFabiano Rosas 18153e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_TW, "MD_TW", 18163e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 18173e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 18183e770bf7SBruno Larsen (billionai) 0x00000000); 1819acf629ebSFabiano Rosas 18203e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_DBCAM, "MD_DBCAM", 18213e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 18223e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 18233e770bf7SBruno Larsen (billionai) 0x00000000); 1824acf629ebSFabiano Rosas 18253e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_DBRAM0, "MD_DBRAM0", 18263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 18273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 18283e770bf7SBruno Larsen (billionai) 0x00000000); 1829acf629ebSFabiano Rosas 18303e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MPC_MD_DBRAM1, "MD_DBRAM1", 18313e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 18323e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 18333e770bf7SBruno Larsen (billionai) 0x00000000); 18343e770bf7SBruno Larsen (billionai) } 18353e770bf7SBruno Larsen (billionai) 18363e770bf7SBruno Larsen (billionai) /* 18373e770bf7SBruno Larsen (billionai) * AMR => SPR 29 (Power 2.04) 18383e770bf7SBruno Larsen (billionai) * CTRL => SPR 136 (Power 2.04) 18393e770bf7SBruno Larsen (billionai) * CTRL => SPR 152 (Power 2.04) 18403e770bf7SBruno Larsen (billionai) * SCOMC => SPR 276 (64 bits ?) 18413e770bf7SBruno Larsen (billionai) * SCOMD => SPR 277 (64 bits ?) 18423e770bf7SBruno Larsen (billionai) * TBU40 => SPR 286 (Power 2.04 hypv) 18433e770bf7SBruno Larsen (billionai) * HSPRG0 => SPR 304 (Power 2.04 hypv) 18443e770bf7SBruno Larsen (billionai) * HSPRG1 => SPR 305 (Power 2.04 hypv) 18453e770bf7SBruno Larsen (billionai) * HDSISR => SPR 306 (Power 2.04 hypv) 18463e770bf7SBruno Larsen (billionai) * HDAR => SPR 307 (Power 2.04 hypv) 18473e770bf7SBruno Larsen (billionai) * PURR => SPR 309 (Power 2.04 hypv) 18483e770bf7SBruno Larsen (billionai) * HDEC => SPR 310 (Power 2.04 hypv) 18493e770bf7SBruno Larsen (billionai) * HIOR => SPR 311 (hypv) 18503e770bf7SBruno Larsen (billionai) * RMOR => SPR 312 (970) 18513e770bf7SBruno Larsen (billionai) * HRMOR => SPR 313 (Power 2.04 hypv) 18523e770bf7SBruno Larsen (billionai) * HSRR0 => SPR 314 (Power 2.04 hypv) 18533e770bf7SBruno Larsen (billionai) * HSRR1 => SPR 315 (Power 2.04 hypv) 18543e770bf7SBruno Larsen (billionai) * LPIDR => SPR 317 (970) 18553e770bf7SBruno Larsen (billionai) * EPR => SPR 702 (Power 2.04 emb) 18563e770bf7SBruno Larsen (billionai) * perf => 768-783 (Power 2.04) 18573e770bf7SBruno Larsen (billionai) * perf => 784-799 (Power 2.04) 18583e770bf7SBruno Larsen (billionai) * PPR => SPR 896 (Power 2.04) 18593e770bf7SBruno Larsen (billionai) * DABRX => 1015 (Power 2.04 hypv) 18603e770bf7SBruno Larsen (billionai) * FPECR => SPR 1022 (?) 18613e770bf7SBruno Larsen (billionai) * ... and more (thermal management, performance counters, ...) 18623e770bf7SBruno Larsen (billionai) */ 18633e770bf7SBruno Larsen (billionai) 18643e770bf7SBruno Larsen (billionai) /*****************************************************************************/ 18653e770bf7SBruno Larsen (billionai) /* Exception vectors models */ 18663e770bf7SBruno Larsen (billionai) static void init_excp_4xx_softmmu(CPUPPCState *env) 18673e770bf7SBruno Larsen (billionai) { 18683e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 18693e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100; 18703e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 18713e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 18723e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 18733e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 18743e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 18753e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 18763e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 18773e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PIT] = 0x00001000; 18783e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FIT] = 0x00001010; 18793e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_WDT] = 0x00001020; 18803e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DTLB] = 0x00001100; 18813e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ITLB] = 0x00001200; 18823e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00002000; 18833e770bf7SBruno Larsen (billionai) env->ivor_mask = 0x0000FFF0UL; 18843e770bf7SBruno Larsen (billionai) env->ivpr_mask = 0xFFFF0000UL; 18853e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 18863e770bf7SBruno Larsen (billionai) env->hreset_vector = 0xFFFFFFFCUL; 18873e770bf7SBruno Larsen (billionai) #endif 18883e770bf7SBruno Larsen (billionai) } 18893e770bf7SBruno Larsen (billionai) 18903e770bf7SBruno Larsen (billionai) static void init_excp_MPC5xx(CPUPPCState *env) 18913e770bf7SBruno Larsen (billionai) { 18923e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 18933e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 18943e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 18953e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 18963e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 18973e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 18986328a3bbSFabiano Rosas env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 18993e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 19003e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 19013e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 19023e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPA] = 0x00000E00; 19033e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EMUL] = 0x00001000; 19043e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DABR] = 0x00001C00; 19053e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001C00; 19063e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MEXTBR] = 0x00001E00; 19073e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_NMEXTBR] = 0x00001F00; 19083e770bf7SBruno Larsen (billionai) env->ivor_mask = 0x0000FFF0UL; 19093e770bf7SBruno Larsen (billionai) env->ivpr_mask = 0xFFFF0000UL; 19103e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 19113e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 19123e770bf7SBruno Larsen (billionai) #endif 19133e770bf7SBruno Larsen (billionai) } 19143e770bf7SBruno Larsen (billionai) 19153e770bf7SBruno Larsen (billionai) static void init_excp_MPC8xx(CPUPPCState *env) 19163e770bf7SBruno Larsen (billionai) { 19173e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 19183e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 19193e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 19203e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 19213e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 19223e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 19233e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 19243e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 19256328a3bbSFabiano Rosas env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 19263e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 19273e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 19283e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 19293e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPA] = 0x00000E00; 19303e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EMUL] = 0x00001000; 19313e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ITLB] = 0x00001100; 19323e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DTLB] = 0x00001200; 19333e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ITLBE] = 0x00001300; 19343e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DTLBE] = 0x00001400; 19353e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DABR] = 0x00001C00; 19363e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001C00; 19373e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MEXTBR] = 0x00001E00; 19383e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_NMEXTBR] = 0x00001F00; 19393e770bf7SBruno Larsen (billionai) env->ivor_mask = 0x0000FFF0UL; 19403e770bf7SBruno Larsen (billionai) env->ivpr_mask = 0xFFFF0000UL; 19413e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 19423e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 19433e770bf7SBruno Larsen (billionai) #endif 19443e770bf7SBruno Larsen (billionai) } 19453e770bf7SBruno Larsen (billionai) 19463e770bf7SBruno Larsen (billionai) static void init_excp_G2(CPUPPCState *env) 19473e770bf7SBruno Larsen (billionai) { 19483e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 19493e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 19503e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 19513e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 19523e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 19533e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 19543e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 19553e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 19563e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 19573e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 19583e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000A00; 19593e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 19603e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 19613e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IFTLB] = 0x00001000; 19623e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DLTLB] = 0x00001100; 19633e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSTLB] = 0x00001200; 19643e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 19653e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400; 19663e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 19673e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 19683e770bf7SBruno Larsen (billionai) #endif 19693e770bf7SBruno Larsen (billionai) } 19703e770bf7SBruno Larsen (billionai) 19713e770bf7SBruno Larsen (billionai) static void init_excp_e200(CPUPPCState *env, target_ulong ivpr_mask) 19723e770bf7SBruno Larsen (billionai) { 19733e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 19743e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000FFC; 19753e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000; 19763e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000000; 19773e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000000; 19783e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000000; 19793e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000; 19803e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000000; 19813e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000000; 19823e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000000; 19833e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000000; 19843e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_APU] = 0x00000000; 19853e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000000; 19863e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FIT] = 0x00000000; 19873e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_WDT] = 0x00000000; 19883e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DTLB] = 0x00000000; 19893e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ITLB] = 0x00000000; 19903e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00000000; 19917fc1dc83SFabiano Rosas /* 19927fc1dc83SFabiano Rosas * These two are the same IVOR as POWERPC_EXCP_VPU and 19937fc1dc83SFabiano Rosas * POWERPC_EXCP_VPUA. We deal with that when dispatching at 19947fc1dc83SFabiano Rosas * powerpc_excp(). 19957fc1dc83SFabiano Rosas */ 19963e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SPEU] = 0x00000000; 19973e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EFPDI] = 0x00000000; 19987fc1dc83SFabiano Rosas 19993e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EFPRI] = 0x00000000; 20003e770bf7SBruno Larsen (billionai) env->ivor_mask = 0x0000FFF7UL; 20013e770bf7SBruno Larsen (billionai) env->ivpr_mask = ivpr_mask; 20023e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 20033e770bf7SBruno Larsen (billionai) env->hreset_vector = 0xFFFFFFFCUL; 20043e770bf7SBruno Larsen (billionai) #endif 20053e770bf7SBruno Larsen (billionai) } 20063e770bf7SBruno Larsen (billionai) 20073e770bf7SBruno Larsen (billionai) static void init_excp_BookE(CPUPPCState *env) 20083e770bf7SBruno Larsen (billionai) { 20093e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 20103e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000; 20113e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000000; 20123e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000000; 20133e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000000; 20143e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000; 20153e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000000; 20163e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000000; 20173e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000000; 20183e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000000; 20193e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_APU] = 0x00000000; 20203e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000000; 20213e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FIT] = 0x00000000; 20223e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_WDT] = 0x00000000; 20233e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DTLB] = 0x00000000; 20243e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ITLB] = 0x00000000; 20253e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00000000; 20263e770bf7SBruno Larsen (billionai) env->ivor_mask = 0x0000FFF0UL; 20273e770bf7SBruno Larsen (billionai) env->ivpr_mask = 0xFFFF0000UL; 20283e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 20293e770bf7SBruno Larsen (billionai) env->hreset_vector = 0xFFFFFFFCUL; 20303e770bf7SBruno Larsen (billionai) #endif 20313e770bf7SBruno Larsen (billionai) } 20323e770bf7SBruno Larsen (billionai) 20333e770bf7SBruno Larsen (billionai) static void init_excp_603(CPUPPCState *env) 20343e770bf7SBruno Larsen (billionai) { 20353e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 20363e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 20373e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 20383e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 20393e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 20403e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 20413e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 20423e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 20433e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 20443e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 20453e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 20463e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 20473e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IFTLB] = 0x00001000; 20483e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DLTLB] = 0x00001100; 20493e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSTLB] = 0x00001200; 20503e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 20513e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400; 20523e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 20533e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 20543e770bf7SBruno Larsen (billionai) #endif 20553e770bf7SBruno Larsen (billionai) } 20563e770bf7SBruno Larsen (billionai) 20573e770bf7SBruno Larsen (billionai) static void init_excp_604(CPUPPCState *env) 20583e770bf7SBruno Larsen (billionai) { 20593e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 20603e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 20613e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 20623e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 20633e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 20643e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 20653e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 20663e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 20673e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 20683e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 20693e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 20703e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 20713e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 20723e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 20733e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400; 20743e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 20753e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 20763e770bf7SBruno Larsen (billionai) #endif 20773e770bf7SBruno Larsen (billionai) } 20783e770bf7SBruno Larsen (billionai) 20793e770bf7SBruno Larsen (billionai) static void init_excp_7x0(CPUPPCState *env) 20803e770bf7SBruno Larsen (billionai) { 20813e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 20823e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 20833e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 20843e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 20853e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 20863e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 20873e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 20883e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 20893e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 20903e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 20913e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 20923e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 20933e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 20943e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 20953e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400; 20963e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001700; 20973e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 20983e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 20993e770bf7SBruno Larsen (billionai) #endif 21003e770bf7SBruno Larsen (billionai) } 21013e770bf7SBruno Larsen (billionai) 21023e770bf7SBruno Larsen (billionai) static void init_excp_750cl(CPUPPCState *env) 21033e770bf7SBruno Larsen (billionai) { 21043e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 21053e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 21063e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 21073e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 21083e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 21093e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 21103e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 21113e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 21123e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 21133e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 21143e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 21153e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 21163e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 21173e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 21183e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400; 21193e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 21203e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 21213e770bf7SBruno Larsen (billionai) #endif 21223e770bf7SBruno Larsen (billionai) } 21233e770bf7SBruno Larsen (billionai) 21243e770bf7SBruno Larsen (billionai) static void init_excp_750cx(CPUPPCState *env) 21253e770bf7SBruno Larsen (billionai) { 21263e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 21273e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 21283e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 21293e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 21303e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 21313e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 21323e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 21333e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 21343e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 21353e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 21363e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 21373e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 21383e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 21393e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 21403e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001700; 21413e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 21423e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 21433e770bf7SBruno Larsen (billionai) #endif 21443e770bf7SBruno Larsen (billionai) } 21453e770bf7SBruno Larsen (billionai) 21463e770bf7SBruno Larsen (billionai) /* XXX: Check if this is correct */ 21473e770bf7SBruno Larsen (billionai) static void init_excp_7x5(CPUPPCState *env) 21483e770bf7SBruno Larsen (billionai) { 21493e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 21503e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 21513e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 21523e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 21533e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 21543e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 21553e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 21563e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 21573e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 21583e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 21593e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 21603e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 21613e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 21623e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IFTLB] = 0x00001000; 21633e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DLTLB] = 0x00001100; 21643e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSTLB] = 0x00001200; 21653e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 21663e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400; 21673e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001700; 21683e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 21693e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 21703e770bf7SBruno Larsen (billionai) #endif 21713e770bf7SBruno Larsen (billionai) } 21723e770bf7SBruno Larsen (billionai) 21733e770bf7SBruno Larsen (billionai) static void init_excp_7400(CPUPPCState *env) 21743e770bf7SBruno Larsen (billionai) { 21753e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 21763e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 21773e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 21783e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 21793e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 21803e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 21813e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 21823e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 21833e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 21843e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 21853e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 21863e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 21873e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 21883e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20; 21893e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 21903e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400; 21913e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001600; 21923e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001700; 21933e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 21943e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 21953e770bf7SBruno Larsen (billionai) #endif 21963e770bf7SBruno Larsen (billionai) } 21973e770bf7SBruno Larsen (billionai) 21983e770bf7SBruno Larsen (billionai) static void init_excp_7450(CPUPPCState *env) 21993e770bf7SBruno Larsen (billionai) { 22003e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 22013e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 22023e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 22033e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 22043e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 22053e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 22063e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 22073e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 22083e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 22093e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 22103e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 22113e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 22123e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 22133e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20; 22143e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 22153e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400; 22163e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001600; 22173e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 22183e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x00000100UL; 22193e770bf7SBruno Larsen (billionai) #endif 22203e770bf7SBruno Larsen (billionai) } 22213e770bf7SBruno Larsen (billionai) 22223e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64) 22233e770bf7SBruno Larsen (billionai) static void init_excp_970(CPUPPCState *env) 22243e770bf7SBruno Larsen (billionai) { 22253e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 22263e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 22273e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 22283e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 22293e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSEG] = 0x00000380; 22303e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 22313e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISEG] = 0x00000480; 22323e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 22333e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 22343e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 22353e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 22363e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 22373e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_HDECR] = 0x00000980; 22383e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 22393e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 22403e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 22413e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20; 22423e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; 22433e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MAINT] = 0x00001600; 22443e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001700; 22453e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001800; 22463e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 22473e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x0000000000000100ULL; 22483e770bf7SBruno Larsen (billionai) #endif 22493e770bf7SBruno Larsen (billionai) } 22503e770bf7SBruno Larsen (billionai) 22513e770bf7SBruno Larsen (billionai) static void init_excp_POWER7(CPUPPCState *env) 22523e770bf7SBruno Larsen (billionai) { 22533e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 22543e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; 22553e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; 22563e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; 22573e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DSEG] = 0x00000380; 22583e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; 22593e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ISEG] = 0x00000480; 22603e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; 22613e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; 22623e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; 22633e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; 22643e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; 22653e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_HDECR] = 0x00000980; 22663e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; 22673e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; 22683e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_HDSI] = 0x00000E00; 22693e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_HISI] = 0x00000E20; 22703e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_HV_EMU] = 0x00000E40; 22713e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_HV_MAINT] = 0x00000E60; 22723e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; 22733e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20; 22743e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_VSXU] = 0x00000F40; 22753e770bf7SBruno Larsen (billionai) /* Hardware reset vector */ 22763e770bf7SBruno Larsen (billionai) env->hreset_vector = 0x0000000000000100ULL; 22773e770bf7SBruno Larsen (billionai) #endif 22783e770bf7SBruno Larsen (billionai) } 22793e770bf7SBruno Larsen (billionai) 22803e770bf7SBruno Larsen (billionai) static void init_excp_POWER8(CPUPPCState *env) 22813e770bf7SBruno Larsen (billionai) { 22823e770bf7SBruno Larsen (billionai) init_excp_POWER7(env); 22833e770bf7SBruno Larsen (billionai) 22843e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 22853e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SDOOR] = 0x00000A00; 22863e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_FU] = 0x00000F60; 22873e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_HV_FU] = 0x00000F80; 22883e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SDOOR_HV] = 0x00000E80; 22893e770bf7SBruno Larsen (billionai) #endif 22903e770bf7SBruno Larsen (billionai) } 22913e770bf7SBruno Larsen (billionai) 22923e770bf7SBruno Larsen (billionai) static void init_excp_POWER9(CPUPPCState *env) 22933e770bf7SBruno Larsen (billionai) { 22943e770bf7SBruno Larsen (billionai) init_excp_POWER8(env); 22953e770bf7SBruno Larsen (billionai) 22963e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 22973e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_HVIRT] = 0x00000EA0; 22983e770bf7SBruno Larsen (billionai) env->excp_vectors[POWERPC_EXCP_SYSCALL_VECTORED] = 0x00017000; 22993e770bf7SBruno Larsen (billionai) #endif 23003e770bf7SBruno Larsen (billionai) } 23013e770bf7SBruno Larsen (billionai) 23023e770bf7SBruno Larsen (billionai) static void init_excp_POWER10(CPUPPCState *env) 23033e770bf7SBruno Larsen (billionai) { 23043e770bf7SBruno Larsen (billionai) init_excp_POWER9(env); 23053e770bf7SBruno Larsen (billionai) } 23063e770bf7SBruno Larsen (billionai) 23073e770bf7SBruno Larsen (billionai) #endif 23083e770bf7SBruno Larsen (billionai) 23093e770bf7SBruno Larsen (billionai) /*****************************************************************************/ 23103e770bf7SBruno Larsen (billionai) /* Power management enable checks */ 23113e770bf7SBruno Larsen (billionai) static int check_pow_none(CPUPPCState *env) 23123e770bf7SBruno Larsen (billionai) { 23133e770bf7SBruno Larsen (billionai) return 0; 23143e770bf7SBruno Larsen (billionai) } 23153e770bf7SBruno Larsen (billionai) 23163e770bf7SBruno Larsen (billionai) static int check_pow_nocheck(CPUPPCState *env) 23173e770bf7SBruno Larsen (billionai) { 23183e770bf7SBruno Larsen (billionai) return 1; 23193e770bf7SBruno Larsen (billionai) } 23203e770bf7SBruno Larsen (billionai) 23213e770bf7SBruno Larsen (billionai) static int check_pow_hid0(CPUPPCState *env) 23223e770bf7SBruno Larsen (billionai) { 23233e770bf7SBruno Larsen (billionai) if (env->spr[SPR_HID0] & 0x00E00000) { 23243e770bf7SBruno Larsen (billionai) return 1; 23253e770bf7SBruno Larsen (billionai) } 23263e770bf7SBruno Larsen (billionai) 23273e770bf7SBruno Larsen (billionai) return 0; 23283e770bf7SBruno Larsen (billionai) } 23293e770bf7SBruno Larsen (billionai) 23303e770bf7SBruno Larsen (billionai) static int check_pow_hid0_74xx(CPUPPCState *env) 23313e770bf7SBruno Larsen (billionai) { 23323e770bf7SBruno Larsen (billionai) if (env->spr[SPR_HID0] & 0x00600000) { 23333e770bf7SBruno Larsen (billionai) return 1; 23343e770bf7SBruno Larsen (billionai) } 23353e770bf7SBruno Larsen (billionai) 23363e770bf7SBruno Larsen (billionai) return 0; 23373e770bf7SBruno Larsen (billionai) } 23383e770bf7SBruno Larsen (billionai) 23393e770bf7SBruno Larsen (billionai) /*****************************************************************************/ 23403e770bf7SBruno Larsen (billionai) /* PowerPC implementations definitions */ 23413e770bf7SBruno Larsen (billionai) 23423e770bf7SBruno Larsen (billionai) #define POWERPC_FAMILY(_name) \ 23433e770bf7SBruno Larsen (billionai) static void \ 23443e770bf7SBruno Larsen (billionai) glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \ 23453e770bf7SBruno Larsen (billionai) \ 23463e770bf7SBruno Larsen (billionai) static const TypeInfo \ 23473e770bf7SBruno Larsen (billionai) glue(glue(ppc_, _name), _cpu_family_type_info) = { \ 23483e770bf7SBruno Larsen (billionai) .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \ 23493e770bf7SBruno Larsen (billionai) .parent = TYPE_POWERPC_CPU, \ 23503e770bf7SBruno Larsen (billionai) .abstract = true, \ 23513e770bf7SBruno Larsen (billionai) .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \ 23523e770bf7SBruno Larsen (billionai) }; \ 23533e770bf7SBruno Larsen (billionai) \ 23543e770bf7SBruno Larsen (billionai) static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \ 23553e770bf7SBruno Larsen (billionai) { \ 23563e770bf7SBruno Larsen (billionai) type_register_static( \ 23573e770bf7SBruno Larsen (billionai) &glue(glue(ppc_, _name), _cpu_family_type_info)); \ 23583e770bf7SBruno Larsen (billionai) } \ 23593e770bf7SBruno Larsen (billionai) \ 23603e770bf7SBruno Larsen (billionai) type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \ 23613e770bf7SBruno Larsen (billionai) \ 23623e770bf7SBruno Larsen (billionai) static void glue(glue(ppc_, _name), _cpu_family_class_init) 23633e770bf7SBruno Larsen (billionai) 23643e770bf7SBruno Larsen (billionai) static void init_proc_405(CPUPPCState *env) 23653e770bf7SBruno Larsen (billionai) { 23663e770bf7SBruno Larsen (billionai) register_40x_sprs(env); 23673e770bf7SBruno Larsen (billionai) register_405_sprs(env); 23684ffb8c5eSFabiano Rosas register_usprgh_sprs(env); 2369acd1f788SFabiano Rosas 23703e770bf7SBruno Larsen (billionai) /* Memory management */ 23713e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 23723e770bf7SBruno Larsen (billionai) env->nb_tlb = 64; 23733e770bf7SBruno Larsen (billionai) env->nb_ways = 1; 23743e770bf7SBruno Larsen (billionai) env->id_tlbs = 0; 23753e770bf7SBruno Larsen (billionai) env->tlb_type = TLB_EMB; 23763e770bf7SBruno Larsen (billionai) #endif 23773e770bf7SBruno Larsen (billionai) init_excp_4xx_softmmu(env); 23783e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 23793e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 23803e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 23813e770bf7SBruno Larsen (billionai) ppc40x_irq_init(env_archcpu(env)); 23823e770bf7SBruno Larsen (billionai) 23833e770bf7SBruno Larsen (billionai) SET_FIT_PERIOD(8, 12, 16, 20); 23843e770bf7SBruno Larsen (billionai) SET_WDT_PERIOD(16, 20, 24, 28); 23853e770bf7SBruno Larsen (billionai) } 23863e770bf7SBruno Larsen (billionai) 23873e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(405)(ObjectClass *oc, void *data) 23883e770bf7SBruno Larsen (billionai) { 23893e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 23903e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 23913e770bf7SBruno Larsen (billionai) 23923e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 405"; 23933e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_405; 23943e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 23953e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 23963e770bf7SBruno Larsen (billionai) PPC_DCR | PPC_WRTEE | 23973e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT | 23983e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 23993e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 24003e770bf7SBruno Larsen (billionai) PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | 24013e770bf7SBruno Larsen (billionai) PPC_4xx_COMMON | PPC_405_MAC | PPC_40x_EXCP; 2402645d843cSFabiano Rosas pcc->msr_mask = (1ull << MSR_WE) | 24033e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 24043e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 24053e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 24063e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 2407301e5d48SFabiano Rosas (1ull << MSR_ME) | 24083e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 24093e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 24103e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 24113e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 24123e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_SOFT_4xx; 24133e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_40x; 24143e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_405; 24153e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_403; 24163e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE | 24173e770bf7SBruno Larsen (billionai) POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK; 24183e770bf7SBruno Larsen (billionai) } 24193e770bf7SBruno Larsen (billionai) 24203e770bf7SBruno Larsen (billionai) static void init_proc_440EP(CPUPPCState *env) 24213e770bf7SBruno Larsen (billionai) { 24223e770bf7SBruno Larsen (billionai) register_BookE_sprs(env, 0x000000000000FFFFULL); 24233e770bf7SBruno Larsen (billionai) register_440_sprs(env); 24243e770bf7SBruno Larsen (billionai) register_usprgh_sprs(env); 24253e770bf7SBruno Larsen (billionai) /* Processor identification */ 24263e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_PIR, "PIR", 24273e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24283e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_pir, 24293e770bf7SBruno Larsen (billionai) 0x00000000); 2430acf629ebSFabiano Rosas 24313e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC3, "IAC3", 24323e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24333e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 24343e770bf7SBruno Larsen (billionai) 0x00000000); 2435acf629ebSFabiano Rosas 24363e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC4, "IAC4", 24373e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24383e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 24393e770bf7SBruno Larsen (billionai) 0x00000000); 2440acf629ebSFabiano Rosas 24413e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DVC1, "DVC1", 24423e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24433e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 24443e770bf7SBruno Larsen (billionai) 0x00000000); 2445acf629ebSFabiano Rosas 24463e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DVC2, "DVC2", 24473e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24483e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 24493e770bf7SBruno Larsen (billionai) 0x00000000); 2450acf629ebSFabiano Rosas 24513e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MCSR, "MCSR", 24523e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24533e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 24543e770bf7SBruno Larsen (billionai) 0x00000000); 24553e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0", 24563e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24573e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 24583e770bf7SBruno Larsen (billionai) 0x00000000); 24593e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1", 24603e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24613e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 24623e770bf7SBruno Larsen (billionai) 0x00000000); 2463acf629ebSFabiano Rosas 24643e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_CCR1, "CCR1", 24653e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 24663e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 24673e770bf7SBruno Larsen (billionai) 0x00000000); 24683e770bf7SBruno Larsen (billionai) /* Memory management */ 24693e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 24703e770bf7SBruno Larsen (billionai) env->nb_tlb = 64; 24713e770bf7SBruno Larsen (billionai) env->nb_ways = 1; 24723e770bf7SBruno Larsen (billionai) env->id_tlbs = 0; 24733e770bf7SBruno Larsen (billionai) env->tlb_type = TLB_EMB; 24743e770bf7SBruno Larsen (billionai) #endif 24753e770bf7SBruno Larsen (billionai) init_excp_BookE(env); 24763e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 24773e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 24783e770bf7SBruno Larsen (billionai) ppc40x_irq_init(env_archcpu(env)); 24793e770bf7SBruno Larsen (billionai) 24803e770bf7SBruno Larsen (billionai) SET_FIT_PERIOD(12, 16, 20, 24); 24813e770bf7SBruno Larsen (billionai) SET_WDT_PERIOD(20, 24, 28, 32); 24823e770bf7SBruno Larsen (billionai) } 24833e770bf7SBruno Larsen (billionai) 24843e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440EP)(ObjectClass *oc, void *data) 24853e770bf7SBruno Larsen (billionai) { 24863e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 24873e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 24883e770bf7SBruno Larsen (billionai) 24893e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 440 EP"; 24903e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_440EP; 24913e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 24923e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | 24933e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL | 24943e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 24953e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 24963e770bf7SBruno Larsen (billionai) PPC_DCR | PPC_WRTEE | PPC_RFMCI | 24973e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 24983e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 24993e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_MFTB | 25003e770bf7SBruno Larsen (billionai) PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | 25013e770bf7SBruno Larsen (billionai) PPC_440_SPEC; 25023e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 25033e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 25043e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 25053e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 25063e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 25073e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 25083e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 25093e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 25103e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 25113e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 25123e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 25133e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 25143e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE; 25153e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 25163e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 25173e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_403; 25183e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE | 25193e770bf7SBruno Larsen (billionai) POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK; 25203e770bf7SBruno Larsen (billionai) } 25213e770bf7SBruno Larsen (billionai) 25223e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(460EX)(ObjectClass *oc, void *data) 25233e770bf7SBruno Larsen (billionai) { 25243e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 25253e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 25263e770bf7SBruno Larsen (billionai) 25273e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 460 EX"; 25283e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_440EP; 25293e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 25303e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | 25313e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL | 25323e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 25333e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 25343e770bf7SBruno Larsen (billionai) PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_RFMCI | 25353e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 25363e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 25373e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_MFTB | 25383e770bf7SBruno Larsen (billionai) PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | 25393e770bf7SBruno Larsen (billionai) PPC_440_SPEC; 25403e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 25413e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 25423e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 25433e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 25443e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 25453e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 25463e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 25473e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 25483e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 25493e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 25503e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 25513e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 25523e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE; 25533e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 25543e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 25553e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_403; 25563e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE | 25573e770bf7SBruno Larsen (billionai) POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK; 25583e770bf7SBruno Larsen (billionai) } 25593e770bf7SBruno Larsen (billionai) 25603e770bf7SBruno Larsen (billionai) static void init_proc_440GP(CPUPPCState *env) 25613e770bf7SBruno Larsen (billionai) { 25623e770bf7SBruno Larsen (billionai) register_BookE_sprs(env, 0x000000000000FFFFULL); 25633e770bf7SBruno Larsen (billionai) register_440_sprs(env); 25643e770bf7SBruno Larsen (billionai) register_usprgh_sprs(env); 25653e770bf7SBruno Larsen (billionai) /* Processor identification */ 25663e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_PIR, "PIR", 25673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 25683e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_pir, 25693e770bf7SBruno Larsen (billionai) 0x00000000); 2570acf629ebSFabiano Rosas 25713e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC3, "IAC3", 25723e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 25733e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 25743e770bf7SBruno Larsen (billionai) 0x00000000); 2575acf629ebSFabiano Rosas 25763e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC4, "IAC4", 25773e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 25783e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 25793e770bf7SBruno Larsen (billionai) 0x00000000); 2580acf629ebSFabiano Rosas 25813e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DVC1, "DVC1", 25823e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 25833e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 25843e770bf7SBruno Larsen (billionai) 0x00000000); 2585acf629ebSFabiano Rosas 25863e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DVC2, "DVC2", 25873e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 25883e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 25893e770bf7SBruno Larsen (billionai) 0x00000000); 25903e770bf7SBruno Larsen (billionai) /* Memory management */ 25913e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 25923e770bf7SBruno Larsen (billionai) env->nb_tlb = 64; 25933e770bf7SBruno Larsen (billionai) env->nb_ways = 1; 25943e770bf7SBruno Larsen (billionai) env->id_tlbs = 0; 25953e770bf7SBruno Larsen (billionai) env->tlb_type = TLB_EMB; 25963e770bf7SBruno Larsen (billionai) #endif 25973e770bf7SBruno Larsen (billionai) init_excp_BookE(env); 25983e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 25993e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 26003e770bf7SBruno Larsen (billionai) /* XXX: TODO: allocate internal IRQ controller */ 26013e770bf7SBruno Larsen (billionai) 26023e770bf7SBruno Larsen (billionai) SET_FIT_PERIOD(12, 16, 20, 24); 26033e770bf7SBruno Larsen (billionai) SET_WDT_PERIOD(20, 24, 28, 32); 26043e770bf7SBruno Larsen (billionai) } 26053e770bf7SBruno Larsen (billionai) 26063e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440GP)(ObjectClass *oc, void *data) 26073e770bf7SBruno Larsen (billionai) { 26083e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 26093e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 26103e770bf7SBruno Larsen (billionai) 26113e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 440 GP"; 26123e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_440GP; 26133e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 26143e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | 26153e770bf7SBruno Larsen (billionai) PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_MFAPIDI | 26163e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 26173e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 26183e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_TLBIVA | PPC_MFTB | 26193e770bf7SBruno Larsen (billionai) PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | 26203e770bf7SBruno Larsen (billionai) PPC_440_SPEC; 26213e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 26223e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 26233e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 26243e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 26253e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 26263e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 26273e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 26283e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 26293e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 26303e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 26313e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 26323e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 26333e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE; 26343e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 26353e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 26363e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_403; 26373e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE | 26383e770bf7SBruno Larsen (billionai) POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK; 26393e770bf7SBruno Larsen (billionai) } 26403e770bf7SBruno Larsen (billionai) 26413e770bf7SBruno Larsen (billionai) static void init_proc_440x5(CPUPPCState *env) 26423e770bf7SBruno Larsen (billionai) { 26433e770bf7SBruno Larsen (billionai) register_BookE_sprs(env, 0x000000000000FFFFULL); 26443e770bf7SBruno Larsen (billionai) register_440_sprs(env); 26453e770bf7SBruno Larsen (billionai) register_usprgh_sprs(env); 26463e770bf7SBruno Larsen (billionai) /* Processor identification */ 26473e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_PIR, "PIR", 26483e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26493e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_pir, 26503e770bf7SBruno Larsen (billionai) 0x00000000); 2651acf629ebSFabiano Rosas 26523e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC3, "IAC3", 26533e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26543e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 26553e770bf7SBruno Larsen (billionai) 0x00000000); 2656acf629ebSFabiano Rosas 26573e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC4, "IAC4", 26583e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26593e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 26603e770bf7SBruno Larsen (billionai) 0x00000000); 2661acf629ebSFabiano Rosas 26623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DVC1, "DVC1", 26633e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26643e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 26653e770bf7SBruno Larsen (billionai) 0x00000000); 2666acf629ebSFabiano Rosas 26673e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DVC2, "DVC2", 26683e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26693e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 26703e770bf7SBruno Larsen (billionai) 0x00000000); 2671acf629ebSFabiano Rosas 26723e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MCSR, "MCSR", 26733e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26743e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 26753e770bf7SBruno Larsen (billionai) 0x00000000); 26763e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0", 26773e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26783e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 26793e770bf7SBruno Larsen (billionai) 0x00000000); 26803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1", 26813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26823e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 26833e770bf7SBruno Larsen (billionai) 0x00000000); 2684acf629ebSFabiano Rosas 26853e770bf7SBruno Larsen (billionai) spr_register(env, SPR_440_CCR1, "CCR1", 26863e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 26873e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 26883e770bf7SBruno Larsen (billionai) 0x00000000); 26893e770bf7SBruno Larsen (billionai) /* Memory management */ 26903e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 26913e770bf7SBruno Larsen (billionai) env->nb_tlb = 64; 26923e770bf7SBruno Larsen (billionai) env->nb_ways = 1; 26933e770bf7SBruno Larsen (billionai) env->id_tlbs = 0; 26943e770bf7SBruno Larsen (billionai) env->tlb_type = TLB_EMB; 26953e770bf7SBruno Larsen (billionai) #endif 26963e770bf7SBruno Larsen (billionai) init_excp_BookE(env); 26973e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 26983e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 26993e770bf7SBruno Larsen (billionai) ppc40x_irq_init(env_archcpu(env)); 27003e770bf7SBruno Larsen (billionai) 27013e770bf7SBruno Larsen (billionai) SET_FIT_PERIOD(12, 16, 20, 24); 27023e770bf7SBruno Larsen (billionai) SET_WDT_PERIOD(20, 24, 28, 32); 27033e770bf7SBruno Larsen (billionai) } 27043e770bf7SBruno Larsen (billionai) 27053e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440x5)(ObjectClass *oc, void *data) 27063e770bf7SBruno Larsen (billionai) { 27073e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 27083e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 27093e770bf7SBruno Larsen (billionai) 27103e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 440x5"; 27113e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_440x5; 27123e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 27133e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | 27143e770bf7SBruno Larsen (billionai) PPC_DCR | PPC_WRTEE | PPC_RFMCI | 27153e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 27163e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 27173e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_MFTB | 27183e770bf7SBruno Larsen (billionai) PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | 27193e770bf7SBruno Larsen (billionai) PPC_440_SPEC; 27203e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 27213e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 27223e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 27233e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 27243e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 27253e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 27263e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 27273e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 27283e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 27293e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 27303e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 27313e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 27323e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE; 27333e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 27343e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 27353e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_403; 27363e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE | 27373e770bf7SBruno Larsen (billionai) POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK; 27383e770bf7SBruno Larsen (billionai) } 27393e770bf7SBruno Larsen (billionai) 27403e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440x5wDFPU)(ObjectClass *oc, void *data) 27413e770bf7SBruno Larsen (billionai) { 27423e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 27433e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 27443e770bf7SBruno Larsen (billionai) 27453e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 440x5 with double precision FPU"; 27463e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_440x5; 27473e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 27483e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | 27493e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSQRT | 27503e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 27513e770bf7SBruno Larsen (billionai) PPC_DCR | PPC_WRTEE | PPC_RFMCI | 27523e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 27533e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 27543e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_MFTB | 27553e770bf7SBruno Larsen (billionai) PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | 27563e770bf7SBruno Larsen (billionai) PPC_440_SPEC; 27573e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_FP_CVT_S64; 27583e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 27593e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 27603e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 27613e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 27623e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 27633e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 27643e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 27653e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 27663e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 27673e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 27683e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 27693e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 27703e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE; 27713e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 27723e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 27733e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_403; 27743e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE | 27753e770bf7SBruno Larsen (billionai) POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK; 27763e770bf7SBruno Larsen (billionai) } 27773e770bf7SBruno Larsen (billionai) 27783e770bf7SBruno Larsen (billionai) static void init_proc_MPC5xx(CPUPPCState *env) 27793e770bf7SBruno Larsen (billionai) { 27803e770bf7SBruno Larsen (billionai) register_5xx_8xx_sprs(env); 27813e770bf7SBruno Larsen (billionai) register_5xx_sprs(env); 27823e770bf7SBruno Larsen (billionai) init_excp_MPC5xx(env); 27833e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 27843e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 27853e770bf7SBruno Larsen (billionai) /* XXX: TODO: allocate internal IRQ controller */ 27863e770bf7SBruno Larsen (billionai) } 27873e770bf7SBruno Larsen (billionai) 27883e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(MPC5xx)(ObjectClass *oc, void *data) 27893e770bf7SBruno Larsen (billionai) { 27903e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 27913e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 27923e770bf7SBruno Larsen (billionai) 27933e770bf7SBruno Larsen (billionai) dc->desc = "Freescale 5xx cores (aka RCPU)"; 27943e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_MPC5xx; 27953e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_none; 27963e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | 27973e770bf7SBruno Larsen (billionai) PPC_MEM_EIEIO | PPC_MEM_SYNC | 27983e770bf7SBruno Larsen (billionai) PPC_CACHE_ICBI | PPC_FLOAT | PPC_FLOAT_STFIWX | 27993e770bf7SBruno Larsen (billionai) PPC_MFTB; 28003e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_ILE) | 28013e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 28023e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 28033e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 28043e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 28053e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 28063e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 28073e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 28083e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 28093e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 28103e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 28113e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 28123e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_REAL; 28139323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 28143e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_RCPU; 28153e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_505; 28163e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 28173e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 28183e770bf7SBruno Larsen (billionai) } 28193e770bf7SBruno Larsen (billionai) 28203e770bf7SBruno Larsen (billionai) static void init_proc_MPC8xx(CPUPPCState *env) 28213e770bf7SBruno Larsen (billionai) { 28223e770bf7SBruno Larsen (billionai) register_5xx_8xx_sprs(env); 28233e770bf7SBruno Larsen (billionai) register_8xx_sprs(env); 28243e770bf7SBruno Larsen (billionai) init_excp_MPC8xx(env); 28253e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 28263e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 28273e770bf7SBruno Larsen (billionai) /* XXX: TODO: allocate internal IRQ controller */ 28283e770bf7SBruno Larsen (billionai) } 28293e770bf7SBruno Larsen (billionai) 28303e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(MPC8xx)(ObjectClass *oc, void *data) 28313e770bf7SBruno Larsen (billionai) { 28323e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 28333e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 28343e770bf7SBruno Larsen (billionai) 28353e770bf7SBruno Larsen (billionai) dc->desc = "Freescale 8xx cores (aka PowerQUICC)"; 28363e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_MPC8xx; 28373e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_none; 28383e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | 28393e770bf7SBruno Larsen (billionai) PPC_MEM_EIEIO | PPC_MEM_SYNC | 28403e770bf7SBruno Larsen (billionai) PPC_CACHE_ICBI | PPC_MFTB; 28413e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_ILE) | 28423e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 28433e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 28443e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 28453e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 28463e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 28473e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 28483e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 28493e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 28503e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 28513e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 28523e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 28533e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_MPC8xx; 28549323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 28553e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_RCPU; 28563e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_860; 28573e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 28583e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 28593e770bf7SBruno Larsen (billionai) } 28603e770bf7SBruno Larsen (billionai) 28613e770bf7SBruno Larsen (billionai) /* Freescale 82xx cores (aka PowerQUICC-II) */ 28623e770bf7SBruno Larsen (billionai) 28633e770bf7SBruno Larsen (billionai) static void init_proc_G2(CPUPPCState *env) 28643e770bf7SBruno Larsen (billionai) { 28653e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 28663e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 28673e770bf7SBruno Larsen (billionai) register_G2_sprs(env); 2868acf629ebSFabiano Rosas 28693e770bf7SBruno Larsen (billionai) /* Memory management */ 28703e770bf7SBruno Larsen (billionai) register_low_BATs(env); 28713e770bf7SBruno Larsen (billionai) register_high_BATs(env); 28723e770bf7SBruno Larsen (billionai) register_6xx_7xx_soft_tlb(env, 64, 2); 28733e770bf7SBruno Larsen (billionai) init_excp_G2(env); 28743e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 28753e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 28763e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 28773e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 28783e770bf7SBruno Larsen (billionai) } 28793e770bf7SBruno Larsen (billionai) 28803e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(G2)(ObjectClass *oc, void *data) 28813e770bf7SBruno Larsen (billionai) { 28823e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 28833e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 28843e770bf7SBruno Larsen (billionai) 28853e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC G2"; 28863e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_G2; 28873e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 28883e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 28893e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 28903e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 28913e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 28923e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 28933e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | 28943e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 28953e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 28963e770bf7SBruno Larsen (billionai) (1ull << MSR_TGPR) | 28973e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 28983e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 28993e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 29003e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 29013e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 29023e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 29033e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 29043e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 29053e770bf7SBruno Larsen (billionai) (1ull << MSR_AL) | 29063e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 29073e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 29083e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 29093e770bf7SBruno Larsen (billionai) (1ull << MSR_RI); 29103e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_SOFT_6xx; 29119323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 29123e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 29133e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_ec603e; 29143e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | 29153e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK; 29163e770bf7SBruno Larsen (billionai) } 29173e770bf7SBruno Larsen (billionai) 29183e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(G2LE)(ObjectClass *oc, void *data) 29193e770bf7SBruno Larsen (billionai) { 29203e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 29213e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 29223e770bf7SBruno Larsen (billionai) 29233e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC G2LE"; 2924363bd7d0SFabiano Rosas pcc->init_proc = init_proc_G2; 29253e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 29263e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 29273e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 29283e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 29293e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 29303e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 29313e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | 29323e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 29333e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 29343e770bf7SBruno Larsen (billionai) (1ull << MSR_TGPR) | 29353e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 29363e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 29373e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 29383e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 29393e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 29403e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 29413e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 29423e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 29433e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 29443e770bf7SBruno Larsen (billionai) (1ull << MSR_AL) | 29453e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 29463e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 29473e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 29483e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 29493e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 29503e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_SOFT_6xx; 29519323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 29523e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 29533e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_ec603e; 29543e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | 29553e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK; 29563e770bf7SBruno Larsen (billionai) } 29573e770bf7SBruno Larsen (billionai) 29583e770bf7SBruno Larsen (billionai) static void init_proc_e200(CPUPPCState *env) 29593e770bf7SBruno Larsen (billionai) { 29603e770bf7SBruno Larsen (billionai) register_BookE_sprs(env, 0x000000070000FFFFULL); 2961acf629ebSFabiano Rosas 29623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR", 29633e770bf7SBruno Larsen (billionai) &spr_read_spefscr, &spr_write_spefscr, 29643e770bf7SBruno Larsen (billionai) &spr_read_spefscr, &spr_write_spefscr, 29653e770bf7SBruno Larsen (billionai) 0x00000000); 29663e770bf7SBruno Larsen (billionai) /* Memory management */ 29673e770bf7SBruno Larsen (billionai) register_BookE206_sprs(env, 0x0000005D, NULL, 0); 29684ffb8c5eSFabiano Rosas register_usprgh_sprs(env); 2969acf629ebSFabiano Rosas 29703e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 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_HID1, "HID1", 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_ALTCTXCR, "ALTCTXCR", 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_BUCSR, "BUCSR", 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_CTXCR, "CTXCR", 29913e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 29923e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 29933e770bf7SBruno Larsen (billionai) 0x00000000); 2994acf629ebSFabiano Rosas 29953e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_DBCNT, "DBCNT", 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_DBCR3, "DBCR3", 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_Exxx_L1CFG0, "L1CFG0", 30063e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 30073e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 30083e770bf7SBruno Larsen (billionai) 0x00000000); 3009acf629ebSFabiano Rosas 30103e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0", 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_Exxx_L1FINV0, "L1FINV0", 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_TLB0CFG, "TLB0CFG", 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_BOOKE_TLB1CFG, "TLB1CFG", 30263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 30273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 30283e770bf7SBruno Larsen (billionai) 0x00000000); 3029acf629ebSFabiano Rosas 30303e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC3, "IAC3", 30313e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 30323e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 30333e770bf7SBruno Larsen (billionai) 0x00000000); 3034acf629ebSFabiano Rosas 30353e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_IAC4, "IAC4", 30363e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 30373e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 30383e770bf7SBruno Larsen (billionai) 0x00000000); 3039acf629ebSFabiano Rosas 30403e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MMUCSR0, "MMUCSR0", 30413e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 30423e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 30433e770bf7SBruno Larsen (billionai) 0x00000000); /* TOFIX */ 30443e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DSRR0, "DSRR0", 30453e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 30463e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 30473e770bf7SBruno Larsen (billionai) 0x00000000); 30483e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_DSRR1, "DSRR1", 30493e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 30503e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 30513e770bf7SBruno Larsen (billionai) 0x00000000); 30523e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 30533e770bf7SBruno Larsen (billionai) env->nb_tlb = 64; 30543e770bf7SBruno Larsen (billionai) env->nb_ways = 1; 30553e770bf7SBruno Larsen (billionai) env->id_tlbs = 0; 30563e770bf7SBruno Larsen (billionai) env->tlb_type = TLB_EMB; 30573e770bf7SBruno Larsen (billionai) #endif 30583e770bf7SBruno Larsen (billionai) init_excp_e200(env, 0xFFFF0000UL); 30593e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 30603e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 30613e770bf7SBruno Larsen (billionai) /* XXX: TODO: allocate internal IRQ controller */ 30623e770bf7SBruno Larsen (billionai) } 30633e770bf7SBruno Larsen (billionai) 30643e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e200)(ObjectClass *oc, void *data) 30653e770bf7SBruno Larsen (billionai) { 30663e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 30673e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 30683e770bf7SBruno Larsen (billionai) 30693e770bf7SBruno Larsen (billionai) dc->desc = "e200 core"; 30703e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_e200; 30713e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 30723e770bf7SBruno Larsen (billionai) /* 30733e770bf7SBruno Larsen (billionai) * XXX: unimplemented instructions: 30743e770bf7SBruno Larsen (billionai) * dcblc 30753e770bf7SBruno Larsen (billionai) * dcbtlst 30763e770bf7SBruno Larsen (billionai) * dcbtstls 30773e770bf7SBruno Larsen (billionai) * icblc 30783e770bf7SBruno Larsen (billionai) * icbtls 30793e770bf7SBruno Larsen (billionai) * tlbivax 30803e770bf7SBruno Larsen (billionai) * all SPE multiply-accumulate instructions 30813e770bf7SBruno Larsen (billionai) */ 30823e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | 30833e770bf7SBruno Larsen (billionai) PPC_SPE | PPC_SPE_SINGLE | 30843e770bf7SBruno Larsen (billionai) PPC_WRTEE | PPC_RFDI | 30853e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI | 30863e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 30873e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_TLBIVAX | 30883e770bf7SBruno Larsen (billionai) PPC_BOOKE; 30893e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_UCLE) | 30903e770bf7SBruno Larsen (billionai) (1ull << MSR_SPE) | 30913e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 30923e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 30933e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 30943e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 30953e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 30963e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 30973e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 30983e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 30993e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 31003e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 31013e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 31023e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 31033e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE206; 31043e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 31053e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 31063e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_860; 31073e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE | 31083e770bf7SBruno Larsen (billionai) POWERPC_FLAG_UBLE | POWERPC_FLAG_DE | 31093e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 31103e770bf7SBruno Larsen (billionai) } 31113e770bf7SBruno Larsen (billionai) 31123e770bf7SBruno Larsen (billionai) static void init_proc_e300(CPUPPCState *env) 31133e770bf7SBruno Larsen (billionai) { 31143e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 31153e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 31163e770bf7SBruno Larsen (billionai) register_603_sprs(env); 31173e770bf7SBruno Larsen (billionai) /* hardware implementation registers */ 31183e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 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_HID1, "HID1", 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_HID2, "HID2", 31293e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 31303e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 31313e770bf7SBruno Larsen (billionai) 0x00000000); 31323e770bf7SBruno Larsen (billionai) /* Breakpoints */ 31333e770bf7SBruno Larsen (billionai) spr_register(env, SPR_DABR, "DABR", 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_DABR2, "DABR2", 31393e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 31403e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 31413e770bf7SBruno Larsen (billionai) 0x00000000); 3142acf629ebSFabiano Rosas 31433e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IABR2, "IABR2", 31443e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 31453e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 31463e770bf7SBruno Larsen (billionai) 0x00000000); 3147acf629ebSFabiano Rosas 31483e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IBCR, "IBCR", 31493e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 31503e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 31513e770bf7SBruno Larsen (billionai) 0x00000000); 3152acf629ebSFabiano Rosas 31533e770bf7SBruno Larsen (billionai) spr_register(env, SPR_DBCR, "DBCR", 31543e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 31553e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 31563e770bf7SBruno Larsen (billionai) 0x00000000); 31573e770bf7SBruno Larsen (billionai) /* Memory management */ 31583e770bf7SBruno Larsen (billionai) register_low_BATs(env); 31593e770bf7SBruno Larsen (billionai) register_high_BATs(env); 31603e770bf7SBruno Larsen (billionai) register_6xx_7xx_soft_tlb(env, 64, 2); 31613e770bf7SBruno Larsen (billionai) init_excp_603(env); 31623e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 31633e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 31643e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 31653e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 31663e770bf7SBruno Larsen (billionai) } 31673e770bf7SBruno Larsen (billionai) 31683e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e300)(ObjectClass *oc, void *data) 31693e770bf7SBruno Larsen (billionai) { 31703e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 31713e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 31723e770bf7SBruno Larsen (billionai) 31733e770bf7SBruno Larsen (billionai) dc->desc = "e300 core"; 31743e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_e300; 31753e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 31763e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 31773e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 31783e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 31793e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 31803e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 31813e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | 31823e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 31833e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 31843e770bf7SBruno Larsen (billionai) (1ull << MSR_TGPR) | 31853e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 31863e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 31873e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 31883e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 31893e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 31903e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 31913e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 31923e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 31933e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 31943e770bf7SBruno Larsen (billionai) (1ull << MSR_AL) | 31953e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 31963e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 31973e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 31983e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 31993e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 32003e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_SOFT_6xx; 32019323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 32023e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 32033e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_603; 32043e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | 32053e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK; 32063e770bf7SBruno Larsen (billionai) } 32073e770bf7SBruno Larsen (billionai) 32083e770bf7SBruno Larsen (billionai) enum fsl_e500_version { 32093e770bf7SBruno Larsen (billionai) fsl_e500v1, 32103e770bf7SBruno Larsen (billionai) fsl_e500v2, 32113e770bf7SBruno Larsen (billionai) fsl_e500mc, 32123e770bf7SBruno Larsen (billionai) fsl_e5500, 32133e770bf7SBruno Larsen (billionai) fsl_e6500, 32143e770bf7SBruno Larsen (billionai) }; 32153e770bf7SBruno Larsen (billionai) 32163e770bf7SBruno Larsen (billionai) static void init_proc_e500(CPUPPCState *env, int version) 32173e770bf7SBruno Larsen (billionai) { 32183e770bf7SBruno Larsen (billionai) uint32_t tlbncfg[2]; 32193e770bf7SBruno Larsen (billionai) uint64_t ivor_mask; 32203e770bf7SBruno Larsen (billionai) uint64_t ivpr_mask = 0xFFFF0000ULL; 32213e770bf7SBruno Larsen (billionai) uint32_t l1cfg0 = 0x3800 /* 8 ways */ 32223e770bf7SBruno Larsen (billionai) | 0x0020; /* 32 kb */ 32233e770bf7SBruno Larsen (billionai) uint32_t l1cfg1 = 0x3800 /* 8 ways */ 32243e770bf7SBruno Larsen (billionai) | 0x0020; /* 32 kb */ 32253e770bf7SBruno Larsen (billionai) uint32_t mmucfg = 0; 32263e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 32273e770bf7SBruno Larsen (billionai) int i; 32283e770bf7SBruno Larsen (billionai) #endif 32293e770bf7SBruno Larsen (billionai) 32303e770bf7SBruno Larsen (billionai) /* 32313e770bf7SBruno Larsen (billionai) * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't 32323e770bf7SBruno Larsen (billionai) * complain when accessing them. 32333e770bf7SBruno Larsen (billionai) * register_BookE_sprs(env, 0x0000000F0000FD7FULL); 32343e770bf7SBruno Larsen (billionai) */ 32353e770bf7SBruno Larsen (billionai) switch (version) { 32363e770bf7SBruno Larsen (billionai) case fsl_e500v1: 32373e770bf7SBruno Larsen (billionai) case fsl_e500v2: 32383e770bf7SBruno Larsen (billionai) default: 32393e770bf7SBruno Larsen (billionai) ivor_mask = 0x0000000F0000FFFFULL; 32403e770bf7SBruno Larsen (billionai) break; 32413e770bf7SBruno Larsen (billionai) case fsl_e500mc: 32423e770bf7SBruno Larsen (billionai) case fsl_e5500: 32433e770bf7SBruno Larsen (billionai) ivor_mask = 0x000003FE0000FFFFULL; 32443e770bf7SBruno Larsen (billionai) break; 32453e770bf7SBruno Larsen (billionai) case fsl_e6500: 32463e770bf7SBruno Larsen (billionai) ivor_mask = 0x000003FF0000FFFFULL; 32473e770bf7SBruno Larsen (billionai) break; 32483e770bf7SBruno Larsen (billionai) } 32493e770bf7SBruno Larsen (billionai) register_BookE_sprs(env, ivor_mask); 32503e770bf7SBruno Larsen (billionai) register_usprg3_sprs(env); 32513e770bf7SBruno Larsen (billionai) /* Processor identification */ 32523e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_PIR, "PIR", 32533e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 32543e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_pir, 32553e770bf7SBruno Larsen (billionai) 0x00000000); 3256acf629ebSFabiano Rosas 32573e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR", 32583e770bf7SBruno Larsen (billionai) &spr_read_spefscr, &spr_write_spefscr, 32593e770bf7SBruno Larsen (billionai) &spr_read_spefscr, &spr_write_spefscr, 32603e770bf7SBruno Larsen (billionai) 0x00000000); 32613e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 32623e770bf7SBruno Larsen (billionai) /* Memory management */ 32633e770bf7SBruno Larsen (billionai) env->nb_pids = 3; 32643e770bf7SBruno Larsen (billionai) env->nb_ways = 2; 32653e770bf7SBruno Larsen (billionai) env->id_tlbs = 0; 32663e770bf7SBruno Larsen (billionai) switch (version) { 32673e770bf7SBruno Larsen (billionai) case fsl_e500v1: 32683e770bf7SBruno Larsen (billionai) tlbncfg[0] = register_tlbncfg(2, 1, 1, 0, 256); 32693e770bf7SBruno Larsen (billionai) tlbncfg[1] = register_tlbncfg(16, 1, 9, TLBnCFG_AVAIL | TLBnCFG_IPROT, 16); 32703e770bf7SBruno Larsen (billionai) break; 32713e770bf7SBruno Larsen (billionai) case fsl_e500v2: 32723e770bf7SBruno Larsen (billionai) tlbncfg[0] = register_tlbncfg(4, 1, 1, 0, 512); 32733e770bf7SBruno Larsen (billionai) tlbncfg[1] = register_tlbncfg(16, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 16); 32743e770bf7SBruno Larsen (billionai) break; 32753e770bf7SBruno Larsen (billionai) case fsl_e500mc: 32763e770bf7SBruno Larsen (billionai) case fsl_e5500: 32773e770bf7SBruno Larsen (billionai) tlbncfg[0] = register_tlbncfg(4, 1, 1, 0, 512); 32783e770bf7SBruno Larsen (billionai) tlbncfg[1] = register_tlbncfg(64, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 64); 32793e770bf7SBruno Larsen (billionai) break; 32803e770bf7SBruno Larsen (billionai) case fsl_e6500: 32813e770bf7SBruno Larsen (billionai) mmucfg = 0x6510B45; 32823e770bf7SBruno Larsen (billionai) env->nb_pids = 1; 32833e770bf7SBruno Larsen (billionai) tlbncfg[0] = 0x08052400; 32843e770bf7SBruno Larsen (billionai) tlbncfg[1] = 0x40028040; 32853e770bf7SBruno Larsen (billionai) break; 32863e770bf7SBruno Larsen (billionai) default: 32873e770bf7SBruno Larsen (billionai) cpu_abort(env_cpu(env), "Unknown CPU: " TARGET_FMT_lx "\n", 32883e770bf7SBruno Larsen (billionai) env->spr[SPR_PVR]); 32893e770bf7SBruno Larsen (billionai) } 32903e770bf7SBruno Larsen (billionai) #endif 32913e770bf7SBruno Larsen (billionai) /* Cache sizes */ 32923e770bf7SBruno Larsen (billionai) switch (version) { 32933e770bf7SBruno Larsen (billionai) case fsl_e500v1: 32943e770bf7SBruno Larsen (billionai) case fsl_e500v2: 32953e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 32963e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 32973e770bf7SBruno Larsen (billionai) break; 32983e770bf7SBruno Larsen (billionai) case fsl_e500mc: 32993e770bf7SBruno Larsen (billionai) case fsl_e5500: 33003e770bf7SBruno Larsen (billionai) env->dcache_line_size = 64; 33013e770bf7SBruno Larsen (billionai) env->icache_line_size = 64; 33023e770bf7SBruno Larsen (billionai) l1cfg0 |= 0x1000000; /* 64 byte cache block size */ 33033e770bf7SBruno Larsen (billionai) l1cfg1 |= 0x1000000; /* 64 byte cache block size */ 33043e770bf7SBruno Larsen (billionai) break; 33053e770bf7SBruno Larsen (billionai) case fsl_e6500: 33063e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 33073e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 33083e770bf7SBruno Larsen (billionai) l1cfg0 |= 0x0F83820; 33093e770bf7SBruno Larsen (billionai) l1cfg1 |= 0x0B83820; 33103e770bf7SBruno Larsen (billionai) break; 33113e770bf7SBruno Larsen (billionai) default: 33123e770bf7SBruno Larsen (billionai) cpu_abort(env_cpu(env), "Unknown CPU: " TARGET_FMT_lx "\n", 33133e770bf7SBruno Larsen (billionai) env->spr[SPR_PVR]); 33143e770bf7SBruno Larsen (billionai) } 33153e770bf7SBruno Larsen (billionai) register_BookE206_sprs(env, 0x000000DF, tlbncfg, mmucfg); 33164ffb8c5eSFabiano Rosas register_usprgh_sprs(env); 3317acf629ebSFabiano Rosas 33183e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 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_HID1, "HID1", 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_Exxx_BBEAR, "BBEAR", 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_BBTAR, "BBTAR", 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_MCAR, "MCAR", 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_BOOKE_MCSR, "MCSR", 33443e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33453e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 33463e770bf7SBruno Larsen (billionai) 0x00000000); 3347acf629ebSFabiano Rosas 33483e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_NPIDR, "NPIDR", 33493e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33503e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 33513e770bf7SBruno Larsen (billionai) 0x00000000); 3352acf629ebSFabiano Rosas 33533e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_BUCSR, "BUCSR", 33543e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33553e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 33563e770bf7SBruno Larsen (billionai) 0x00000000); 3357acf629ebSFabiano Rosas 33583e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0", 33593e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 33603e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 33613e770bf7SBruno Larsen (billionai) l1cfg0); 33623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_L1CFG1, "L1CFG1", 33633e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 33643e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 33653e770bf7SBruno Larsen (billionai) l1cfg1); 33663e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0", 33673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33683e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_e500_l1csr0, 33693e770bf7SBruno Larsen (billionai) 0x00000000); 33703e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_L1CSR1, "L1CSR1", 33713e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33723e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_e500_l1csr1, 33733e770bf7SBruno Larsen (billionai) 0x00000000); 33743e770bf7SBruno Larsen (billionai) if (version != fsl_e500v1 && version != fsl_e500v2) { 33753e770bf7SBruno Larsen (billionai) spr_register(env, SPR_Exxx_L2CSR0, "L2CSR0", 33763e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33773e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_e500_l2csr0, 33783e770bf7SBruno Larsen (billionai) 0x00000000); 33793e770bf7SBruno Larsen (billionai) } 33803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0", 33813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33823e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 33833e770bf7SBruno Larsen (billionai) 0x00000000); 33843e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1", 33853e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33863e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 33873e770bf7SBruno Larsen (billionai) 0x00000000); 33883e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MMUCSR0, "MMUCSR0", 33893e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33903e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_booke206_mmucsr0, 33913e770bf7SBruno Larsen (billionai) 0x00000000); 33923e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_EPR, "EPR", 33933e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 33943e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 33953e770bf7SBruno Larsen (billionai) 0x00000000); 33963e770bf7SBruno Larsen (billionai) /* XXX better abstract into Emb.xxx features */ 33973e770bf7SBruno Larsen (billionai) if ((version == fsl_e5500) || (version == fsl_e6500)) { 33983e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_EPCR, "EPCR", 33993e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 34003e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 34013e770bf7SBruno Larsen (billionai) 0x00000000); 34023e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_MAS7_MAS3, "MAS7_MAS3", 34033e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 34043e770bf7SBruno Larsen (billionai) &spr_read_mas73, &spr_write_mas73, 34053e770bf7SBruno Larsen (billionai) 0x00000000); 34063e770bf7SBruno Larsen (billionai) ivpr_mask = (target_ulong)~0xFFFFULL; 34073e770bf7SBruno Larsen (billionai) } 34083e770bf7SBruno Larsen (billionai) 34093e770bf7SBruno Larsen (billionai) if (version == fsl_e6500) { 34103e770bf7SBruno Larsen (billionai) /* Thread identification */ 34113e770bf7SBruno Larsen (billionai) spr_register(env, SPR_TIR, "TIR", 34123e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 34133e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 34143e770bf7SBruno Larsen (billionai) 0x00000000); 34153e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_TLB0PS, "TLB0PS", 34163e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 34173e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 34183e770bf7SBruno Larsen (billionai) 0x00000004); 34193e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BOOKE_TLB1PS, "TLB1PS", 34203e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 34213e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 34223e770bf7SBruno Larsen (billionai) 0x7FFFFFFC); 34233e770bf7SBruno Larsen (billionai) } 34243e770bf7SBruno Larsen (billionai) 34253e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 34263e770bf7SBruno Larsen (billionai) env->nb_tlb = 0; 34273e770bf7SBruno Larsen (billionai) env->tlb_type = TLB_MAS; 34283e770bf7SBruno Larsen (billionai) for (i = 0; i < BOOKE206_MAX_TLBN; i++) { 34293e770bf7SBruno Larsen (billionai) env->nb_tlb += booke206_tlb_size(env, i); 34303e770bf7SBruno Larsen (billionai) } 34313e770bf7SBruno Larsen (billionai) #endif 34323e770bf7SBruno Larsen (billionai) 34333e770bf7SBruno Larsen (billionai) init_excp_e200(env, ivpr_mask); 34343e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 34353e770bf7SBruno Larsen (billionai) ppce500_irq_init(env_archcpu(env)); 34363e770bf7SBruno Larsen (billionai) } 34373e770bf7SBruno Larsen (billionai) 34383e770bf7SBruno Larsen (billionai) static void init_proc_e500v1(CPUPPCState *env) 34393e770bf7SBruno Larsen (billionai) { 34403e770bf7SBruno Larsen (billionai) init_proc_e500(env, fsl_e500v1); 34413e770bf7SBruno Larsen (billionai) } 34423e770bf7SBruno Larsen (billionai) 34433e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500v1)(ObjectClass *oc, void *data) 34443e770bf7SBruno Larsen (billionai) { 34453e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 34463e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 34473e770bf7SBruno Larsen (billionai) 34483e770bf7SBruno Larsen (billionai) dc->desc = "e500v1 core"; 34493e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_e500v1; 34503e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 34513e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | 34523e770bf7SBruno Larsen (billionai) PPC_SPE | PPC_SPE_SINGLE | 34533e770bf7SBruno Larsen (billionai) PPC_WRTEE | PPC_RFDI | 34543e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI | 34553e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 34563e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC; 34573e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_BOOKE206; 34583e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_UCLE) | 34593e770bf7SBruno Larsen (billionai) (1ull << MSR_SPE) | 34603e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 34613e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 34623e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 34633e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 34643e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 34653e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 34663e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 34673e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 34683e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 34693e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 34703e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 34713e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 34723e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE206; 34733e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 34743e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 34753e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_860; 34763e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE | 34773e770bf7SBruno Larsen (billionai) POWERPC_FLAG_UBLE | POWERPC_FLAG_DE | 34783e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 34793e770bf7SBruno Larsen (billionai) } 34803e770bf7SBruno Larsen (billionai) 34813e770bf7SBruno Larsen (billionai) static void init_proc_e500v2(CPUPPCState *env) 34823e770bf7SBruno Larsen (billionai) { 34833e770bf7SBruno Larsen (billionai) init_proc_e500(env, fsl_e500v2); 34843e770bf7SBruno Larsen (billionai) } 34853e770bf7SBruno Larsen (billionai) 34863e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500v2)(ObjectClass *oc, void *data) 34873e770bf7SBruno Larsen (billionai) { 34883e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 34893e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 34903e770bf7SBruno Larsen (billionai) 34913e770bf7SBruno Larsen (billionai) dc->desc = "e500v2 core"; 34923e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_e500v2; 34933e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 34943e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | 34953e770bf7SBruno Larsen (billionai) PPC_SPE | PPC_SPE_SINGLE | PPC_SPE_DOUBLE | 34963e770bf7SBruno Larsen (billionai) PPC_WRTEE | PPC_RFDI | 34973e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI | 34983e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 34993e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC; 35003e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_BOOKE206; 35013e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_UCLE) | 35023e770bf7SBruno Larsen (billionai) (1ull << MSR_SPE) | 35033e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 35043e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 35053e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 35063e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 35073e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 35083e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 35093e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 35103e770bf7SBruno Larsen (billionai) (1ull << MSR_DWE) | 35113e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 35123e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 35133e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 35143e770bf7SBruno Larsen (billionai) (1ull << MSR_DR); 35153e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE206; 35163e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 35173e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 35183e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_860; 35193e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE | 35203e770bf7SBruno Larsen (billionai) POWERPC_FLAG_UBLE | POWERPC_FLAG_DE | 35213e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 35223e770bf7SBruno Larsen (billionai) } 35233e770bf7SBruno Larsen (billionai) 35243e770bf7SBruno Larsen (billionai) static void init_proc_e500mc(CPUPPCState *env) 35253e770bf7SBruno Larsen (billionai) { 35263e770bf7SBruno Larsen (billionai) init_proc_e500(env, fsl_e500mc); 35273e770bf7SBruno Larsen (billionai) } 35283e770bf7SBruno Larsen (billionai) 35293e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500mc)(ObjectClass *oc, void *data) 35303e770bf7SBruno Larsen (billionai) { 35313e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 35323e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 35333e770bf7SBruno Larsen (billionai) 35343e770bf7SBruno Larsen (billionai) dc->desc = "e500mc core"; 35353e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_e500mc; 35363e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_none; 35373e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB | 35383e770bf7SBruno Larsen (billionai) PPC_WRTEE | PPC_RFDI | PPC_RFMCI | 35393e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI | 35403e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 35413e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FRES | 35423e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL | 35433e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | PPC_WAIT | 35443e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC; 35453e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL; 35463e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_GS) | 35473e770bf7SBruno Larsen (billionai) (1ull << MSR_UCLE) | 35483e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 35493e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 35503e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 35513e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 35523e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 35533e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 35543e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 35553e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 35563e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 35573e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 35583e770bf7SBruno Larsen (billionai) (1ull << MSR_PX) | 35593e770bf7SBruno Larsen (billionai) (1ull << MSR_RI); 35603e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE206; 35613e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 35623e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 35633e770bf7SBruno Larsen (billionai) /* FIXME: figure out the correct flag for e500mc */ 35643e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_e500; 35653e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE | 35663e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 35673e770bf7SBruno Larsen (billionai) } 35683e770bf7SBruno Larsen (billionai) 35693e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64 35703e770bf7SBruno Larsen (billionai) static void init_proc_e5500(CPUPPCState *env) 35713e770bf7SBruno Larsen (billionai) { 35723e770bf7SBruno Larsen (billionai) init_proc_e500(env, fsl_e5500); 35733e770bf7SBruno Larsen (billionai) } 35743e770bf7SBruno Larsen (billionai) 35753e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e5500)(ObjectClass *oc, void *data) 35763e770bf7SBruno Larsen (billionai) { 35773e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 35783e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 35793e770bf7SBruno Larsen (billionai) 35803e770bf7SBruno Larsen (billionai) dc->desc = "e5500 core"; 35813e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_e5500; 35823e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_none; 35833e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB | 35843e770bf7SBruno Larsen (billionai) PPC_WRTEE | PPC_RFDI | PPC_RFMCI | 35853e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI | 35863e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 35873e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FRES | 35883e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL | 35893e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | PPC_WAIT | 35903e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC | 35913e770bf7SBruno Larsen (billionai) PPC_64B | PPC_POPCNTB | PPC_POPCNTWD; 35923e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL | PPC2_PERM_ISA206 | 35933e770bf7SBruno Larsen (billionai) PPC2_FP_CVT_S64; 35943e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_CM) | 35953e770bf7SBruno Larsen (billionai) (1ull << MSR_GS) | 35963e770bf7SBruno Larsen (billionai) (1ull << MSR_UCLE) | 35973e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 35983e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 35993e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 36003e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 36013e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 36023e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 36033e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 36043e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 36053e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 36063e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 36073e770bf7SBruno Larsen (billionai) (1ull << MSR_PX) | 36083e770bf7SBruno Larsen (billionai) (1ull << MSR_RI); 36093e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE206; 36103e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 36113e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 36123e770bf7SBruno Larsen (billionai) /* FIXME: figure out the correct flag for e5500 */ 36133e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_e500; 36143e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE | 36153e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 36163e770bf7SBruno Larsen (billionai) } 36173e770bf7SBruno Larsen (billionai) 36183e770bf7SBruno Larsen (billionai) static void init_proc_e6500(CPUPPCState *env) 36193e770bf7SBruno Larsen (billionai) { 36203e770bf7SBruno Larsen (billionai) init_proc_e500(env, fsl_e6500); 36213e770bf7SBruno Larsen (billionai) } 36223e770bf7SBruno Larsen (billionai) 36233e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e6500)(ObjectClass *oc, void *data) 36243e770bf7SBruno Larsen (billionai) { 36253e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 36263e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 36273e770bf7SBruno Larsen (billionai) 36283e770bf7SBruno Larsen (billionai) dc->desc = "e6500 core"; 36293e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_e6500; 36303e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_none; 36313e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB | 36323e770bf7SBruno Larsen (billionai) PPC_WRTEE | PPC_RFDI | PPC_RFMCI | 36333e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI | 36343e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBZ | PPC_CACHE_DCBA | 36353e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FRES | 36363e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL | 36373e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | PPC_WAIT | 36383e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC | 36393e770bf7SBruno Larsen (billionai) PPC_64B | PPC_POPCNTB | PPC_POPCNTWD | PPC_ALTIVEC; 36403e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL | PPC2_PERM_ISA206 | 36413e770bf7SBruno Larsen (billionai) PPC2_FP_CVT_S64 | PPC2_ATOMIC_ISA206; 36423e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_CM) | 36433e770bf7SBruno Larsen (billionai) (1ull << MSR_GS) | 36443e770bf7SBruno Larsen (billionai) (1ull << MSR_UCLE) | 36453e770bf7SBruno Larsen (billionai) (1ull << MSR_CE) | 36463e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 36473e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 36483e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 36493e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 36503e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 36513e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 36523e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 36533e770bf7SBruno Larsen (billionai) (1ull << MSR_IS) | 36543e770bf7SBruno Larsen (billionai) (1ull << MSR_DS) | 36553e770bf7SBruno Larsen (billionai) (1ull << MSR_PX) | 36563e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 36573e770bf7SBruno Larsen (billionai) (1ull << MSR_VR); 36583e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_BOOKE206; 36593e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_BOOKE; 36603e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_BookE; 36613e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_e500; 36623e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE | 36633e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_VRE; 36643e770bf7SBruno Larsen (billionai) } 36653e770bf7SBruno Larsen (billionai) 36663e770bf7SBruno Larsen (billionai) #endif 36673e770bf7SBruno Larsen (billionai) 36683e770bf7SBruno Larsen (billionai) /* Non-embedded PowerPC */ 36693e770bf7SBruno Larsen (billionai) static void init_proc_603(CPUPPCState *env) 36703e770bf7SBruno Larsen (billionai) { 36713e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 36723e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 36733e770bf7SBruno Larsen (billionai) register_603_sprs(env); 36743e770bf7SBruno Larsen (billionai) /* hardware implementation registers */ 36753e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 36763e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 36773e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 36783e770bf7SBruno Larsen (billionai) 0x00000000); 3679acf629ebSFabiano Rosas 36803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 36813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 36823e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 36833e770bf7SBruno Larsen (billionai) 0x00000000); 36843e770bf7SBruno Larsen (billionai) /* Memory management */ 36853e770bf7SBruno Larsen (billionai) register_low_BATs(env); 36863e770bf7SBruno Larsen (billionai) register_6xx_7xx_soft_tlb(env, 64, 2); 36873e770bf7SBruno Larsen (billionai) init_excp_603(env); 36883e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 36893e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 36903e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 36913e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 36923e770bf7SBruno Larsen (billionai) } 36933e770bf7SBruno Larsen (billionai) 36943e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(603)(ObjectClass *oc, void *data) 36953e770bf7SBruno Larsen (billionai) { 36963e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 36973e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 36983e770bf7SBruno Larsen (billionai) 36993e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 603"; 37003e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_603; 37013e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 37023e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 37033e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 37043e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 37053e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 37063e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 37073e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | 37083e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 37093e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 37103e770bf7SBruno Larsen (billionai) (1ull << MSR_TGPR) | 37113e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 37123e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 37133e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 37143e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 37153e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 37163e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 37173e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 37183e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 37193e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 37203e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 37213e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 37223e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 37233e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 37243e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 37253e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_SOFT_6xx; 37269323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 37273e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 37283e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_603; 37293e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | 37303e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK; 37313e770bf7SBruno Larsen (billionai) } 37323e770bf7SBruno Larsen (billionai) 37333e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(603E)(ObjectClass *oc, void *data) 37343e770bf7SBruno Larsen (billionai) { 37353e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 37363e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 37373e770bf7SBruno Larsen (billionai) 37383e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 603e"; 3739fd77f757SFabiano Rosas pcc->init_proc = init_proc_603; 37403e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 37413e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 37423e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 37433e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 37443e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 37453e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 37463e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | 37473e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 37483e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 37493e770bf7SBruno Larsen (billionai) (1ull << MSR_TGPR) | 37503e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 37513e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 37523e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 37533e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 37543e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 37553e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 37563e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 37573e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 37583e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 37593e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 37603e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 37613e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 37623e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 37633e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 37643e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_SOFT_6xx; 37659323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 37663e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 37673e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_ec603e; 37683e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | 37693e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK; 37703e770bf7SBruno Larsen (billionai) } 37713e770bf7SBruno Larsen (billionai) 37723e770bf7SBruno Larsen (billionai) static void init_proc_604(CPUPPCState *env) 37733e770bf7SBruno Larsen (billionai) { 37743e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 37753e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 37763e770bf7SBruno Larsen (billionai) register_604_sprs(env); 37773e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 37783e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 37793e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 37803e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 37813e770bf7SBruno Larsen (billionai) 0x00000000); 37823e770bf7SBruno Larsen (billionai) /* Memory management */ 37833e770bf7SBruno Larsen (billionai) register_low_BATs(env); 37843e770bf7SBruno Larsen (billionai) init_excp_604(env); 37853e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 37863e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 37873e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 37883e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 37893e770bf7SBruno Larsen (billionai) } 37903e770bf7SBruno Larsen (billionai) 37913e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(604)(ObjectClass *oc, void *data) 37923e770bf7SBruno Larsen (billionai) { 37933e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 37943e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 37953e770bf7SBruno Larsen (billionai) 37963e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 604"; 37973e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_604; 37983e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 37993e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 38003e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 38013e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 38023e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 38033e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 38043e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 38053e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 38063e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 38073e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 38083e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 38093e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 38103e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 38113e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 38123e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 38133e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 38143e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 38153e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 38163e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 38173e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 38183e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 38193e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 38203e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 38213e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 38223e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 38239323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 38243e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 38253e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_604; 38263e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 38273e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 38283e770bf7SBruno Larsen (billionai) } 38293e770bf7SBruno Larsen (billionai) 38303e770bf7SBruno Larsen (billionai) static void init_proc_604E(CPUPPCState *env) 38313e770bf7SBruno Larsen (billionai) { 38323e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 38333e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 38343e770bf7SBruno Larsen (billionai) register_604_sprs(env); 3835acf629ebSFabiano Rosas 38363e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_MMCR1, "MMCR1", 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_7XX_PMC3, "PMC3", 38423e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 38433e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 38443e770bf7SBruno Larsen (billionai) 0x00000000); 3845acf629ebSFabiano Rosas 38463e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC4, "PMC4", 38473e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 38483e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 38493e770bf7SBruno Larsen (billionai) 0x00000000); 38503e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 38513e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 38523e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 38533e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 38543e770bf7SBruno Larsen (billionai) 0x00000000); 3855acf629ebSFabiano Rosas 38563e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 38573e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 38583e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 38593e770bf7SBruno Larsen (billionai) 0x00000000); 38603e770bf7SBruno Larsen (billionai) /* Memory management */ 38613e770bf7SBruno Larsen (billionai) register_low_BATs(env); 38623e770bf7SBruno Larsen (billionai) init_excp_604(env); 38633e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 38643e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 38653e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 38663e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 38673e770bf7SBruno Larsen (billionai) } 38683e770bf7SBruno Larsen (billionai) 38693e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(604E)(ObjectClass *oc, void *data) 38703e770bf7SBruno Larsen (billionai) { 38713e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 38723e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 38733e770bf7SBruno Larsen (billionai) 38743e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 604E"; 38753e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_604E; 38763e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 38773e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 38783e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 38793e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 38803e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 38813e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 38823e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 38833e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 38843e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 38853e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 38863e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 38873e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 38883e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 38893e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 38903e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 38913e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 38923e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 38933e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 38943e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 38953e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 38963e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 38973e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 38983e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 38993e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 39003e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 39019323650fSFabiano Rosas pcc->excp_model = POWERPC_EXCP_6xx; 39023e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 39033e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_604; 39043e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 39053e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 39063e770bf7SBruno Larsen (billionai) } 39073e770bf7SBruno Larsen (billionai) 39083e770bf7SBruno Larsen (billionai) static void init_proc_740(CPUPPCState *env) 39093e770bf7SBruno Larsen (billionai) { 39103e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 39113e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 39123e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 39133e770bf7SBruno Larsen (billionai) /* Thermal management */ 39143e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 39153e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 39163e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 39173e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 39183e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 39193e770bf7SBruno Larsen (billionai) 0x00000000); 3920acf629ebSFabiano Rosas 39213e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 39223e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 39233e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 39243e770bf7SBruno Larsen (billionai) 0x00000000); 39253e770bf7SBruno Larsen (billionai) /* Memory management */ 39263e770bf7SBruno Larsen (billionai) register_low_BATs(env); 39273e770bf7SBruno Larsen (billionai) init_excp_7x0(env); 39283e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 39293e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 39303e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 39313e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 39323e770bf7SBruno Larsen (billionai) } 39333e770bf7SBruno Larsen (billionai) 39343e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(740)(ObjectClass *oc, void *data) 39353e770bf7SBruno Larsen (billionai) { 39363e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 39373e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 39383e770bf7SBruno Larsen (billionai) 39393e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 740"; 39403e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_740; 39413e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 39423e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 39433e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 39443e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 39453e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 39463e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 39473e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 39483e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 39493e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 39503e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 39513e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 39523e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 39533e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 39543e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 39553e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 39563e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 39573e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 39583e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 39593e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 39603e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 39613e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 39623e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 39633e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 39643e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 39653e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 3966fd7dc4bbSFabiano Rosas pcc->excp_model = POWERPC_EXCP_7xx; 39673e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 39683e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_750; 39693e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 39703e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 39713e770bf7SBruno Larsen (billionai) } 39723e770bf7SBruno Larsen (billionai) 39733e770bf7SBruno Larsen (billionai) static void init_proc_750(CPUPPCState *env) 39743e770bf7SBruno Larsen (billionai) { 39753e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 39763e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 39773e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 3978acf629ebSFabiano Rosas 39793e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2CR, "L2CR", 39803e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 39813e770bf7SBruno Larsen (billionai) &spr_read_generic, spr_access_nop, 39823e770bf7SBruno Larsen (billionai) 0x00000000); 39833e770bf7SBruno Larsen (billionai) /* Thermal management */ 39843e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 39853e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 39863e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 39873e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 39883e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 39893e770bf7SBruno Larsen (billionai) 0x00000000); 3990acf629ebSFabiano Rosas 39913e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 39923e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 39933e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 39943e770bf7SBruno Larsen (billionai) 0x00000000); 39953e770bf7SBruno Larsen (billionai) /* Memory management */ 39963e770bf7SBruno Larsen (billionai) register_low_BATs(env); 39973e770bf7SBruno Larsen (billionai) /* 39983e770bf7SBruno Larsen (billionai) * XXX: high BATs are also present but are known to be bugged on 39993e770bf7SBruno Larsen (billionai) * die version 1.x 40003e770bf7SBruno Larsen (billionai) */ 40013e770bf7SBruno Larsen (billionai) init_excp_7x0(env); 40023e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 40033e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 40043e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 40053e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 40063e770bf7SBruno Larsen (billionai) } 40073e770bf7SBruno Larsen (billionai) 40083e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750)(ObjectClass *oc, void *data) 40093e770bf7SBruno Larsen (billionai) { 40103e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 40113e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 40123e770bf7SBruno Larsen (billionai) 40133e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 750"; 40143e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_750; 40153e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 40163e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 40173e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 40183e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 40193e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 40203e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 40213e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 40223e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 40233e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 40243e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 40253e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 40263e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 40273e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 40283e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 40293e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 40303e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 40313e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 40323e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 40333e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 40343e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 40353e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 40363e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 40373e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 40383e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 40393e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 4040fd7dc4bbSFabiano Rosas pcc->excp_model = POWERPC_EXCP_7xx; 40413e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 40423e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_750; 40433e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 40443e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 40453e770bf7SBruno Larsen (billionai) } 40463e770bf7SBruno Larsen (billionai) 40473e770bf7SBruno Larsen (billionai) static void init_proc_750cl(CPUPPCState *env) 40483e770bf7SBruno Larsen (billionai) { 40493e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 40503e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 40513e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 4052acf629ebSFabiano Rosas 40533e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2CR, "L2CR", 40543e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40553e770bf7SBruno Larsen (billionai) &spr_read_generic, spr_access_nop, 40563e770bf7SBruno Larsen (billionai) 0x00000000); 40573e770bf7SBruno Larsen (billionai) /* Thermal management */ 40583e770bf7SBruno Larsen (billionai) /* Those registers are fake on 750CL */ 40593e770bf7SBruno Larsen (billionai) spr_register(env, SPR_THRM1, "THRM1", 40603e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40613e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40623e770bf7SBruno Larsen (billionai) 0x00000000); 40633e770bf7SBruno Larsen (billionai) spr_register(env, SPR_THRM2, "THRM2", 40643e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40653e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40663e770bf7SBruno Larsen (billionai) 0x00000000); 40673e770bf7SBruno Larsen (billionai) spr_register(env, SPR_THRM3, "THRM3", 40683e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40693e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40703e770bf7SBruno Larsen (billionai) 0x00000000); 4071acf629ebSFabiano Rosas 40723e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_TDCL, "TDCL", 40733e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40743e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40753e770bf7SBruno Larsen (billionai) 0x00000000); 40763e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_TDCH, "TDCH", 40773e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40783e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40793e770bf7SBruno Larsen (billionai) 0x00000000); 40803e770bf7SBruno Larsen (billionai) /* DMA */ 40813e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_WPAR, "WPAR", 40823e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40833e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40843e770bf7SBruno Larsen (billionai) 0x00000000); 40853e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_DMAL, "DMAL", 40863e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40873e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40883e770bf7SBruno Larsen (billionai) 0x00000000); 40893e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_DMAU, "DMAU", 40903e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40913e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40923e770bf7SBruno Larsen (billionai) 0x00000000); 40933e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 40943e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 40953e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 40963e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 40973e770bf7SBruno Larsen (billionai) 0x00000000); 4098acf629ebSFabiano Rosas 40993e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 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_750CL_HID2, "HID2", 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_750CL_HID4, "HID4", 41103e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 41113e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 41123e770bf7SBruno Larsen (billionai) 0x00000000); 41133e770bf7SBruno Larsen (billionai) /* Quantization registers */ 41143e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_GQR0, "GQR0", 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_GQR1, "GQR1", 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_GQR2, "GQR2", 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_GQR3, "GQR3", 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_GQR4, "GQR4", 41353e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 41363e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 41373e770bf7SBruno Larsen (billionai) 0x00000000); 4138acf629ebSFabiano Rosas 41393e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_GQR5, "GQR5", 41403e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 41413e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 41423e770bf7SBruno Larsen (billionai) 0x00000000); 4143acf629ebSFabiano Rosas 41443e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_GQR6, "GQR6", 41453e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 41463e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 41473e770bf7SBruno Larsen (billionai) 0x00000000); 4148acf629ebSFabiano Rosas 41493e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_GQR7, "GQR7", 41503e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 41513e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 41523e770bf7SBruno Larsen (billionai) 0x00000000); 41533e770bf7SBruno Larsen (billionai) /* Memory management */ 41543e770bf7SBruno Larsen (billionai) register_low_BATs(env); 41553e770bf7SBruno Larsen (billionai) /* PowerPC 750cl has 8 DBATs and 8 IBATs */ 41563e770bf7SBruno Larsen (billionai) register_high_BATs(env); 41573e770bf7SBruno Larsen (billionai) init_excp_750cl(env); 41583e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 41593e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 41603e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 41613e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 41623e770bf7SBruno Larsen (billionai) } 41633e770bf7SBruno Larsen (billionai) 41643e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750cl)(ObjectClass *oc, void *data) 41653e770bf7SBruno Larsen (billionai) { 41663e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 41673e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 41683e770bf7SBruno Larsen (billionai) 41693e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 750 CL"; 41703e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_750cl; 41713e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 41723e770bf7SBruno Larsen (billionai) /* 41733e770bf7SBruno Larsen (billionai) * XXX: not implemented: 41743e770bf7SBruno Larsen (billionai) * cache lock instructions: 41753e770bf7SBruno Larsen (billionai) * dcbz_l 41763e770bf7SBruno Larsen (billionai) * floating point paired instructions 41773e770bf7SBruno Larsen (billionai) * psq_lux 41783e770bf7SBruno Larsen (billionai) * psq_lx 41793e770bf7SBruno Larsen (billionai) * psq_stux 41803e770bf7SBruno Larsen (billionai) * psq_stx 41813e770bf7SBruno Larsen (billionai) * ps_abs 41823e770bf7SBruno Larsen (billionai) * ps_add 41833e770bf7SBruno Larsen (billionai) * ps_cmpo0 41843e770bf7SBruno Larsen (billionai) * ps_cmpo1 41853e770bf7SBruno Larsen (billionai) * ps_cmpu0 41863e770bf7SBruno Larsen (billionai) * ps_cmpu1 41873e770bf7SBruno Larsen (billionai) * ps_div 41883e770bf7SBruno Larsen (billionai) * ps_madd 41893e770bf7SBruno Larsen (billionai) * ps_madds0 41903e770bf7SBruno Larsen (billionai) * ps_madds1 41913e770bf7SBruno Larsen (billionai) * ps_merge00 41923e770bf7SBruno Larsen (billionai) * ps_merge01 41933e770bf7SBruno Larsen (billionai) * ps_merge10 41943e770bf7SBruno Larsen (billionai) * ps_merge11 41953e770bf7SBruno Larsen (billionai) * ps_mr 41963e770bf7SBruno Larsen (billionai) * ps_msub 41973e770bf7SBruno Larsen (billionai) * ps_mul 41983e770bf7SBruno Larsen (billionai) * ps_muls0 41993e770bf7SBruno Larsen (billionai) * ps_muls1 42003e770bf7SBruno Larsen (billionai) * ps_nabs 42013e770bf7SBruno Larsen (billionai) * ps_neg 42023e770bf7SBruno Larsen (billionai) * ps_nmadd 42033e770bf7SBruno Larsen (billionai) * ps_nmsub 42043e770bf7SBruno Larsen (billionai) * ps_res 42053e770bf7SBruno Larsen (billionai) * ps_rsqrte 42063e770bf7SBruno Larsen (billionai) * ps_sel 42073e770bf7SBruno Larsen (billionai) * ps_sub 42083e770bf7SBruno Larsen (billionai) * ps_sum0 42093e770bf7SBruno Larsen (billionai) * ps_sum1 42103e770bf7SBruno Larsen (billionai) */ 42113e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 42123e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 42133e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 42143e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 42153e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 42163e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 42173e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 42183e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 42193e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 42203e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 42213e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 42223e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 42233e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 42243e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 42253e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 42263e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 42273e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 42283e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 42293e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 42303e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 42313e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 42323e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 42333e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 42343e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 4235fd7dc4bbSFabiano Rosas pcc->excp_model = POWERPC_EXCP_7xx; 42363e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 42373e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_750; 42383e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 42393e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 42403e770bf7SBruno Larsen (billionai) } 42413e770bf7SBruno Larsen (billionai) 42423e770bf7SBruno Larsen (billionai) static void init_proc_750cx(CPUPPCState *env) 42433e770bf7SBruno Larsen (billionai) { 42443e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 42453e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 42463e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 4247acf629ebSFabiano Rosas 42483e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2CR, "L2CR", 42493e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 42503e770bf7SBruno Larsen (billionai) &spr_read_generic, spr_access_nop, 42513e770bf7SBruno Larsen (billionai) 0x00000000); 42523e770bf7SBruno Larsen (billionai) /* Thermal management */ 42533e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 4254acf629ebSFabiano Rosas 42553e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SDA, "SDA", 42563e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 42573e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 42583e770bf7SBruno Larsen (billionai) 0x00000000); 42593e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 42603e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 42613e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 42623e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 42633e770bf7SBruno Larsen (billionai) 0x00000000); 4264acf629ebSFabiano Rosas 42653e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 42663e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 42673e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 42683e770bf7SBruno Larsen (billionai) 0x00000000); 42693e770bf7SBruno Larsen (billionai) /* Memory management */ 42703e770bf7SBruno Larsen (billionai) register_low_BATs(env); 42713e770bf7SBruno Larsen (billionai) /* PowerPC 750cx has 8 DBATs and 8 IBATs */ 42723e770bf7SBruno Larsen (billionai) register_high_BATs(env); 42733e770bf7SBruno Larsen (billionai) init_excp_750cx(env); 42743e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 42753e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 42763e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 42773e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 42783e770bf7SBruno Larsen (billionai) } 42793e770bf7SBruno Larsen (billionai) 42803e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750cx)(ObjectClass *oc, void *data) 42813e770bf7SBruno Larsen (billionai) { 42823e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 42833e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 42843e770bf7SBruno Larsen (billionai) 42853e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 750CX"; 42863e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_750cx; 42873e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 42883e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 42893e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 42903e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 42913e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 42923e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 42933e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 42943e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 42953e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 42963e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 42973e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 42983e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 42993e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 43003e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 43013e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 43023e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 43033e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 43043e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 43053e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 43063e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 43073e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 43083e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 43093e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 43103e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 43113e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 4312fd7dc4bbSFabiano Rosas pcc->excp_model = POWERPC_EXCP_7xx; 43133e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 43143e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_750; 43153e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 43163e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 43173e770bf7SBruno Larsen (billionai) } 43183e770bf7SBruno Larsen (billionai) 43193e770bf7SBruno Larsen (billionai) static void init_proc_750fx(CPUPPCState *env) 43203e770bf7SBruno Larsen (billionai) { 43213e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 43223e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 43233e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 4324acf629ebSFabiano Rosas 43253e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2CR, "L2CR", 43263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 43273e770bf7SBruno Larsen (billionai) &spr_read_generic, spr_access_nop, 43283e770bf7SBruno Larsen (billionai) 0x00000000); 43293e770bf7SBruno Larsen (billionai) /* Thermal management */ 43303e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 4331acf629ebSFabiano Rosas 43323e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_THRM4, "THRM4", 43333e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 43343e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 43353e770bf7SBruno Larsen (billionai) 0x00000000); 43363e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 43373e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 43383e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 43393e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 43403e770bf7SBruno Larsen (billionai) 0x00000000); 4341acf629ebSFabiano Rosas 43423e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 43433e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 43443e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 43453e770bf7SBruno Larsen (billionai) 0x00000000); 4346acf629ebSFabiano Rosas 43473e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750FX_HID2, "HID2", 43483e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 43493e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 43503e770bf7SBruno Larsen (billionai) 0x00000000); 43513e770bf7SBruno Larsen (billionai) /* Memory management */ 43523e770bf7SBruno Larsen (billionai) register_low_BATs(env); 43533e770bf7SBruno Larsen (billionai) /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */ 43543e770bf7SBruno Larsen (billionai) register_high_BATs(env); 43553e770bf7SBruno Larsen (billionai) init_excp_7x0(env); 43563e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 43573e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 43583e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 43593e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 43603e770bf7SBruno Larsen (billionai) } 43613e770bf7SBruno Larsen (billionai) 43623e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750fx)(ObjectClass *oc, void *data) 43633e770bf7SBruno Larsen (billionai) { 43643e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 43653e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 43663e770bf7SBruno Larsen (billionai) 43673e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 750FX"; 43683e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_750fx; 43693e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 43703e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 43713e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 43723e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 43733e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 43743e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 43753e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 43763e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 43773e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 43783e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 43793e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 43803e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 43813e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 43823e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 43833e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 43843e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 43853e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 43863e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 43873e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 43883e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 43893e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 43903e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 43913e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 43923e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 43933e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 4394fd7dc4bbSFabiano Rosas pcc->excp_model = POWERPC_EXCP_7xx; 43953e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 43963e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_750; 43973e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 43983e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 43993e770bf7SBruno Larsen (billionai) } 44003e770bf7SBruno Larsen (billionai) 44013e770bf7SBruno Larsen (billionai) static void init_proc_750gx(CPUPPCState *env) 44023e770bf7SBruno Larsen (billionai) { 44033e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 44043e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 44053e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 4406acf629ebSFabiano Rosas 44073e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2CR, "L2CR", 44083e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 44093e770bf7SBruno Larsen (billionai) &spr_read_generic, spr_access_nop, 44103e770bf7SBruno Larsen (billionai) 0x00000000); 44113e770bf7SBruno Larsen (billionai) /* Thermal management */ 44123e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 4413acf629ebSFabiano Rosas 44143e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750_THRM4, "THRM4", 44153e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 44163e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 44173e770bf7SBruno Larsen (billionai) 0x00000000); 44183e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 44193e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 44203e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 44213e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 44223e770bf7SBruno Larsen (billionai) 0x00000000); 4423acf629ebSFabiano Rosas 44243e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 44253e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 44263e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 44273e770bf7SBruno Larsen (billionai) 0x00000000); 4428acf629ebSFabiano Rosas 44293e770bf7SBruno Larsen (billionai) spr_register(env, SPR_750FX_HID2, "HID2", 44303e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 44313e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 44323e770bf7SBruno Larsen (billionai) 0x00000000); 44333e770bf7SBruno Larsen (billionai) /* Memory management */ 44343e770bf7SBruno Larsen (billionai) register_low_BATs(env); 44353e770bf7SBruno Larsen (billionai) /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */ 44363e770bf7SBruno Larsen (billionai) register_high_BATs(env); 44373e770bf7SBruno Larsen (billionai) init_excp_7x0(env); 44383e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 44393e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 44403e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 44413e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 44423e770bf7SBruno Larsen (billionai) } 44433e770bf7SBruno Larsen (billionai) 44443e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750gx)(ObjectClass *oc, void *data) 44453e770bf7SBruno Larsen (billionai) { 44463e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 44473e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 44483e770bf7SBruno Larsen (billionai) 44493e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 750GX"; 44503e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_750gx; 44513e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 44523e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 44533e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 44543e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 44553e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 44563e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 44573e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 44583e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 44593e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 44603e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 44613e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 44623e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 44633e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 44643e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 44653e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 44663e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 44673e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 44683e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 44693e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 44703e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 44713e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 44723e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 44733e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 44743e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 44753e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 4476fd7dc4bbSFabiano Rosas pcc->excp_model = POWERPC_EXCP_7xx; 44773e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 44783e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_750; 44793e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 44803e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 44813e770bf7SBruno Larsen (billionai) } 44823e770bf7SBruno Larsen (billionai) 44833e770bf7SBruno Larsen (billionai) static void init_proc_745(CPUPPCState *env) 44843e770bf7SBruno Larsen (billionai) { 44853e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 44863e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 44873e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 4488*1a71c5d1SFabiano Rosas register_755_sprs(env); 44893e770bf7SBruno Larsen (billionai) /* Thermal management */ 44903e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 44913e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 44923e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 44933e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 44943e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 44953e770bf7SBruno Larsen (billionai) 0x00000000); 4496acf629ebSFabiano Rosas 44973e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 44983e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 44993e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 45003e770bf7SBruno Larsen (billionai) 0x00000000); 4501acf629ebSFabiano Rosas 45023e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID2, "HID2", 45033e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 45043e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 45053e770bf7SBruno Larsen (billionai) 0x00000000); 45063e770bf7SBruno Larsen (billionai) /* Memory management */ 45073e770bf7SBruno Larsen (billionai) register_low_BATs(env); 45083e770bf7SBruno Larsen (billionai) register_high_BATs(env); 45093e770bf7SBruno Larsen (billionai) register_6xx_7xx_soft_tlb(env, 64, 2); 45103e770bf7SBruno Larsen (billionai) init_excp_7x5(env); 45113e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 45123e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 45133e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 45143e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 45153e770bf7SBruno Larsen (billionai) } 45163e770bf7SBruno Larsen (billionai) 45173e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(745)(ObjectClass *oc, void *data) 45183e770bf7SBruno Larsen (billionai) { 45193e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 45203e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 45213e770bf7SBruno Larsen (billionai) 45223e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 745"; 45233e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_745; 45243e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 45253e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 45263e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 45273e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 45283e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 45293e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 45303e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | 45313e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 45323e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 45333e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 45343e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 45353e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 45363e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 45373e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 45383e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 45393e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 45403e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 45413e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 45423e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 45433e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 45443e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 45453e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 45463e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 45473e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 45483e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_SOFT_6xx; 4549fd7dc4bbSFabiano Rosas pcc->excp_model = POWERPC_EXCP_7xx; 45503e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 45513e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_750; 45523e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 45533e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 45543e770bf7SBruno Larsen (billionai) } 45553e770bf7SBruno Larsen (billionai) 45563e770bf7SBruno Larsen (billionai) static void init_proc_755(CPUPPCState *env) 45573e770bf7SBruno Larsen (billionai) { 45583e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 45593e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 45603e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 4561*1a71c5d1SFabiano Rosas register_755_sprs(env); 45623e770bf7SBruno Larsen (billionai) /* L2 cache control */ 45633e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2CR, "L2CR", 45643e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 45653e770bf7SBruno Larsen (billionai) &spr_read_generic, spr_access_nop, 45663e770bf7SBruno Larsen (billionai) 0x00000000); 4567acf629ebSFabiano Rosas 45683e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2PMCR, "L2PMCR", 45693e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 45703e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 45713e770bf7SBruno Larsen (billionai) 0x00000000); 45723e770bf7SBruno Larsen (billionai) /* Thermal management */ 45733e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 45743e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 45753e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 45763e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 45773e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 45783e770bf7SBruno Larsen (billionai) 0x00000000); 4579acf629ebSFabiano Rosas 45803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 45813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 45823e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 45833e770bf7SBruno Larsen (billionai) 0x00000000); 4584acf629ebSFabiano Rosas 45853e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID2, "HID2", 45863e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 45873e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 45883e770bf7SBruno Larsen (billionai) 0x00000000); 45893e770bf7SBruno Larsen (billionai) /* Memory management */ 45903e770bf7SBruno Larsen (billionai) register_low_BATs(env); 45913e770bf7SBruno Larsen (billionai) register_high_BATs(env); 45923e770bf7SBruno Larsen (billionai) register_6xx_7xx_soft_tlb(env, 64, 2); 45933e770bf7SBruno Larsen (billionai) init_excp_7x5(env); 45943e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 45953e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 45963e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 45973e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 45983e770bf7SBruno Larsen (billionai) } 45993e770bf7SBruno Larsen (billionai) 46003e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(755)(ObjectClass *oc, void *data) 46013e770bf7SBruno Larsen (billionai) { 46023e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 46033e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 46043e770bf7SBruno Larsen (billionai) 46053e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 755"; 46063e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_755; 46073e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 46083e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 46093e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 46103e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | 46113e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 46123e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 46133e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | 46143e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN; 46153e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_POW) | 46163e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 46173e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 46183e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 46193e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 46203e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 46213e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 46223e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 46233e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 46243e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 46253e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 46263e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 46273e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 46283e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 46293e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 46303e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 46313e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_SOFT_6xx; 4632fd7dc4bbSFabiano Rosas pcc->excp_model = POWERPC_EXCP_7xx; 46333e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 46343e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_750; 46353e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE | 46363e770bf7SBruno Larsen (billionai) POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; 46373e770bf7SBruno Larsen (billionai) } 46383e770bf7SBruno Larsen (billionai) 46393e770bf7SBruno Larsen (billionai) static void init_proc_7400(CPUPPCState *env) 46403e770bf7SBruno Larsen (billionai) { 46413e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 46423e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 46433e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 46443e770bf7SBruno Larsen (billionai) /* 74xx specific SPR */ 46453e770bf7SBruno Larsen (billionai) register_74xx_sprs(env); 46463e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 4647acf629ebSFabiano Rosas 46483e770bf7SBruno Larsen (billionai) spr_register(env, SPR_UBAMR, "UBAMR", 46493e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 46503e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 46513e770bf7SBruno Larsen (billionai) 0x00000000); 4652acf629ebSFabiano Rosas 46533e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MSSCR1, "MSSCR1", 46543e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 46553e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 46563e770bf7SBruno Larsen (billionai) 0x00000000); 46573e770bf7SBruno Larsen (billionai) /* Thermal management */ 46583e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 46593e770bf7SBruno Larsen (billionai) /* Memory management */ 46603e770bf7SBruno Larsen (billionai) register_low_BATs(env); 46613e770bf7SBruno Larsen (billionai) init_excp_7400(env); 46623e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 46633e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 46643e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 46653e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 46663e770bf7SBruno Larsen (billionai) } 46673e770bf7SBruno Larsen (billionai) 46683e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7400)(ObjectClass *oc, void *data) 46693e770bf7SBruno Larsen (billionai) { 46703e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 46713e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 46723e770bf7SBruno Larsen (billionai) 46733e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 7400 (aka G4)"; 46743e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_7400; 46753e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 46763e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 46773e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 46783e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 46793e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 46803e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 46813e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBA | PPC_CACHE_DCBZ | 46823e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 46833e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 46843e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIA | 46853e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN | 46863e770bf7SBruno Larsen (billionai) PPC_ALTIVEC; 46873e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_VR) | 46883e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 46893e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 46903e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 46913e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 46923e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 46933e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 46943e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 46953e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 46963e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 46973e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 46983e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 46993e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 47003e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 47013e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 47023e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 47033e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 47043e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 47053e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_74xx; 47063e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 47073e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_7400; 47083e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 47093e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 47103e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 47113e770bf7SBruno Larsen (billionai) } 47123e770bf7SBruno Larsen (billionai) 47133e770bf7SBruno Larsen (billionai) static void init_proc_7410(CPUPPCState *env) 47143e770bf7SBruno Larsen (billionai) { 47153e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 47163e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 47173e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 47183e770bf7SBruno Larsen (billionai) /* 74xx specific SPR */ 47193e770bf7SBruno Larsen (billionai) register_74xx_sprs(env); 47203e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 4721acf629ebSFabiano Rosas 47223e770bf7SBruno Larsen (billionai) spr_register(env, SPR_UBAMR, "UBAMR", 47233e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 47243e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 47253e770bf7SBruno Larsen (billionai) 0x00000000); 47263e770bf7SBruno Larsen (billionai) /* Thermal management */ 47273e770bf7SBruno Larsen (billionai) register_thrm_sprs(env); 47283e770bf7SBruno Larsen (billionai) /* L2PMCR */ 4729acf629ebSFabiano Rosas 47303e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L2PMCR, "L2PMCR", 47313e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 47323e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 47333e770bf7SBruno Larsen (billionai) 0x00000000); 47343e770bf7SBruno Larsen (billionai) /* LDSTDB */ 4735acf629ebSFabiano Rosas 47363e770bf7SBruno Larsen (billionai) spr_register(env, SPR_LDSTDB, "LDSTDB", 47373e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 47383e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 47393e770bf7SBruno Larsen (billionai) 0x00000000); 47403e770bf7SBruno Larsen (billionai) /* Memory management */ 47413e770bf7SBruno Larsen (billionai) register_low_BATs(env); 47423e770bf7SBruno Larsen (billionai) init_excp_7400(env); 47433e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 47443e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 47453e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 47463e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 47473e770bf7SBruno Larsen (billionai) } 47483e770bf7SBruno Larsen (billionai) 47493e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7410)(ObjectClass *oc, void *data) 47503e770bf7SBruno Larsen (billionai) { 47513e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 47523e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 47533e770bf7SBruno Larsen (billionai) 47543e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 7410 (aka G4)"; 47553e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_7410; 47563e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0; 47573e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 47583e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 47593e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 47603e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 47613e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 47623e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBA | PPC_CACHE_DCBZ | 47633e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 47643e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 47653e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIA | 47663e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN | 47673e770bf7SBruno Larsen (billionai) PPC_ALTIVEC; 47683e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_VR) | 47693e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 47703e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 47713e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 47723e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 47733e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 47743e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 47753e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 47763e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 47773e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 47783e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 47793e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 47803e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 47813e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 47823e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 47833e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 47843e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 47853e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 47863e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_74xx; 47873e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 47883e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_7400; 47893e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 47903e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 47913e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 47923e770bf7SBruno Larsen (billionai) } 47933e770bf7SBruno Larsen (billionai) 47943e770bf7SBruno Larsen (billionai) static void init_proc_7440(CPUPPCState *env) 47953e770bf7SBruno Larsen (billionai) { 47963e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 47973e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 47983e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 47993e770bf7SBruno Larsen (billionai) /* 74xx specific SPR */ 48003e770bf7SBruno Larsen (billionai) register_74xx_sprs(env); 48013e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 4802acf629ebSFabiano Rosas 48033e770bf7SBruno Larsen (billionai) spr_register(env, SPR_UBAMR, "UBAMR", 48043e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 48053e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 48063e770bf7SBruno Larsen (billionai) 0x00000000); 48073e770bf7SBruno Larsen (billionai) /* LDSTCR */ 48083e770bf7SBruno Larsen (billionai) spr_register(env, SPR_LDSTCR, "LDSTCR", 48093e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 48103e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 48113e770bf7SBruno Larsen (billionai) 0x00000000); 48123e770bf7SBruno Larsen (billionai) /* ICTRL */ 48133e770bf7SBruno Larsen (billionai) spr_register(env, SPR_ICTRL, "ICTRL", 48143e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 48153e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 48163e770bf7SBruno Larsen (billionai) 0x00000000); 48173e770bf7SBruno Larsen (billionai) /* MSSSR0 */ 48183e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MSSSR0, "MSSSR0", 48193e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 48203e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 48213e770bf7SBruno Larsen (billionai) 0x00000000); 48223e770bf7SBruno Larsen (billionai) /* PMC */ 48233e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC5, "PMC5", 48243e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 48253e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 48263e770bf7SBruno Larsen (billionai) 0x00000000); 4827acf629ebSFabiano Rosas 48283e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC5, "UPMC5", 48293e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 48303e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 48313e770bf7SBruno Larsen (billionai) 0x00000000); 4832acf629ebSFabiano Rosas 48333e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC6, "PMC6", 48343e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 48353e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 48363e770bf7SBruno Larsen (billionai) 0x00000000); 4837acf629ebSFabiano Rosas 48383e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC6, "UPMC6", 48393e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 48403e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 48413e770bf7SBruno Larsen (billionai) 0x00000000); 48423e770bf7SBruno Larsen (billionai) /* Memory management */ 48433e770bf7SBruno Larsen (billionai) register_low_BATs(env); 48443e770bf7SBruno Larsen (billionai) init_excp_7450(env); 48453e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 48463e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 48473e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 48483e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 48493e770bf7SBruno Larsen (billionai) } 48503e770bf7SBruno Larsen (billionai) 48513e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7440)(ObjectClass *oc, void *data) 48523e770bf7SBruno Larsen (billionai) { 48533e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 48543e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 48553e770bf7SBruno Larsen (billionai) 48563e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 7440 (aka G4)"; 48573e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_7440; 48583e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0_74xx; 48593e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 48603e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 48613e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 48623e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 48633e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 48643e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBA | PPC_CACHE_DCBZ | 48653e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 48663e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 48671da666cdSFabiano Rosas PPC_MEM_TLBIA | 48683e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN | 48693e770bf7SBruno Larsen (billionai) PPC_ALTIVEC; 48703e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_VR) | 48713e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 48723e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 48733e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 48743e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 48753e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 48763e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 48773e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 48783e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 48793e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 48803e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 48813e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 48823e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 48833e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 48843e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 48853e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 48863e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 48871da666cdSFabiano Rosas pcc->mmu_model = POWERPC_MMU_32B; 48883e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_74xx; 48893e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 48903e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_7400; 48913e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 48923e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 48933e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 48943e770bf7SBruno Larsen (billionai) } 48953e770bf7SBruno Larsen (billionai) 48963e770bf7SBruno Larsen (billionai) static void init_proc_7450(CPUPPCState *env) 48973e770bf7SBruno Larsen (billionai) { 48983e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 48993e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 49003e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 49013e770bf7SBruno Larsen (billionai) /* 74xx specific SPR */ 49023e770bf7SBruno Larsen (billionai) register_74xx_sprs(env); 49033e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 49043e770bf7SBruno Larsen (billionai) /* Level 3 cache control */ 49053e770bf7SBruno Larsen (billionai) register_l3_ctrl(env); 49063e770bf7SBruno Larsen (billionai) /* L3ITCR1 */ 49073e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3ITCR1, "L3ITCR1", 49083e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49093e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49103e770bf7SBruno Larsen (billionai) 0x00000000); 49113e770bf7SBruno Larsen (billionai) /* L3ITCR2 */ 49123e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3ITCR2, "L3ITCR2", 49133e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49143e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49153e770bf7SBruno Larsen (billionai) 0x00000000); 49163e770bf7SBruno Larsen (billionai) /* L3ITCR3 */ 49173e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3ITCR3, "L3ITCR3", 49183e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49193e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49203e770bf7SBruno Larsen (billionai) 0x00000000); 49213e770bf7SBruno Larsen (billionai) /* L3OHCR */ 49223e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3OHCR, "L3OHCR", 49233e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49243e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49253e770bf7SBruno Larsen (billionai) 0x00000000); 4926acf629ebSFabiano Rosas 49273e770bf7SBruno Larsen (billionai) spr_register(env, SPR_UBAMR, "UBAMR", 49283e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 49293e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 49303e770bf7SBruno Larsen (billionai) 0x00000000); 49313e770bf7SBruno Larsen (billionai) /* LDSTCR */ 49323e770bf7SBruno Larsen (billionai) spr_register(env, SPR_LDSTCR, "LDSTCR", 49333e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49343e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49353e770bf7SBruno Larsen (billionai) 0x00000000); 49363e770bf7SBruno Larsen (billionai) /* ICTRL */ 49373e770bf7SBruno Larsen (billionai) spr_register(env, SPR_ICTRL, "ICTRL", 49383e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49393e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49403e770bf7SBruno Larsen (billionai) 0x00000000); 49413e770bf7SBruno Larsen (billionai) /* MSSSR0 */ 49423e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MSSSR0, "MSSSR0", 49433e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49443e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49453e770bf7SBruno Larsen (billionai) 0x00000000); 49463e770bf7SBruno Larsen (billionai) /* PMC */ 49473e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC5, "PMC5", 49483e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49493e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49503e770bf7SBruno Larsen (billionai) 0x00000000); 4951acf629ebSFabiano Rosas 49523e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC5, "UPMC5", 49533e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 49543e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 49553e770bf7SBruno Larsen (billionai) 0x00000000); 4956acf629ebSFabiano Rosas 49573e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC6, "PMC6", 49583e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 49593e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 49603e770bf7SBruno Larsen (billionai) 0x00000000); 4961acf629ebSFabiano Rosas 49623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC6, "UPMC6", 49633e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 49643e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 49653e770bf7SBruno Larsen (billionai) 0x00000000); 49663e770bf7SBruno Larsen (billionai) /* Memory management */ 49673e770bf7SBruno Larsen (billionai) register_low_BATs(env); 49683e770bf7SBruno Larsen (billionai) init_excp_7450(env); 49693e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 49703e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 49713e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 49723e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 49733e770bf7SBruno Larsen (billionai) } 49743e770bf7SBruno Larsen (billionai) 49753e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7450)(ObjectClass *oc, void *data) 49763e770bf7SBruno Larsen (billionai) { 49773e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 49783e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 49793e770bf7SBruno Larsen (billionai) 49803e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 7450 (aka G4)"; 49813e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_7450; 49823e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0_74xx; 49833e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 49843e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 49853e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 49863e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 49873e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 49883e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBA | PPC_CACHE_DCBZ | 49893e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 49903e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 49911da666cdSFabiano Rosas PPC_MEM_TLBIA | 49923e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN | 49933e770bf7SBruno Larsen (billionai) PPC_ALTIVEC; 49943e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_VR) | 49953e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 49963e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 49973e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 49983e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 49993e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 50003e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 50013e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 50023e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 50033e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 50043e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 50053e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 50063e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 50073e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 50083e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 50093e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 50103e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 50111da666cdSFabiano Rosas pcc->mmu_model = POWERPC_MMU_32B; 50123e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_74xx; 50133e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 50143e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_7400; 50153e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 50163e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 50173e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 50183e770bf7SBruno Larsen (billionai) } 50193e770bf7SBruno Larsen (billionai) 50203e770bf7SBruno Larsen (billionai) static void init_proc_7445(CPUPPCState *env) 50213e770bf7SBruno Larsen (billionai) { 50223e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 50233e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 50243e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 50253e770bf7SBruno Larsen (billionai) /* 74xx specific SPR */ 50263e770bf7SBruno Larsen (billionai) register_74xx_sprs(env); 50273e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 50283e770bf7SBruno Larsen (billionai) /* LDSTCR */ 50293e770bf7SBruno Larsen (billionai) spr_register(env, SPR_LDSTCR, "LDSTCR", 50303e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50313e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50323e770bf7SBruno Larsen (billionai) 0x00000000); 50333e770bf7SBruno Larsen (billionai) /* ICTRL */ 50343e770bf7SBruno Larsen (billionai) spr_register(env, SPR_ICTRL, "ICTRL", 50353e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50363e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50373e770bf7SBruno Larsen (billionai) 0x00000000); 50383e770bf7SBruno Larsen (billionai) /* MSSSR0 */ 50393e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MSSSR0, "MSSSR0", 50403e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50413e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50423e770bf7SBruno Larsen (billionai) 0x00000000); 50433e770bf7SBruno Larsen (billionai) /* PMC */ 50443e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC5, "PMC5", 50453e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50463e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50473e770bf7SBruno Larsen (billionai) 0x00000000); 5048acf629ebSFabiano Rosas 50493e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC5, "UPMC5", 50503e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50513e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50523e770bf7SBruno Larsen (billionai) 0x00000000); 5053acf629ebSFabiano Rosas 50543e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC6, "PMC6", 50553e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50563e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50573e770bf7SBruno Larsen (billionai) 0x00000000); 5058acf629ebSFabiano Rosas 50593e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC6, "UPMC6", 50603e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50613e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50623e770bf7SBruno Larsen (billionai) 0x00000000); 50633e770bf7SBruno Larsen (billionai) /* SPRGs */ 50643e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG4, "SPRG4", 50653e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50663e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50673e770bf7SBruno Larsen (billionai) 0x00000000); 50683e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG4, "USPRG4", 50693e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50703e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50713e770bf7SBruno Larsen (billionai) 0x00000000); 50723e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG5, "SPRG5", 50733e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50743e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50753e770bf7SBruno Larsen (billionai) 0x00000000); 50763e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG5, "USPRG5", 50773e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50783e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50793e770bf7SBruno Larsen (billionai) 0x00000000); 50803e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG6, "SPRG6", 50813e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50823e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50833e770bf7SBruno Larsen (billionai) 0x00000000); 50843e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG6, "USPRG6", 50853e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50863e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50873e770bf7SBruno Larsen (billionai) 0x00000000); 50883e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG7, "SPRG7", 50893e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 50903e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 50913e770bf7SBruno Larsen (billionai) 0x00000000); 50923e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG7, "USPRG7", 50933e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50943e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 50953e770bf7SBruno Larsen (billionai) 0x00000000); 50963e770bf7SBruno Larsen (billionai) /* Memory management */ 50973e770bf7SBruno Larsen (billionai) register_low_BATs(env); 50983e770bf7SBruno Larsen (billionai) register_high_BATs(env); 50993e770bf7SBruno Larsen (billionai) init_excp_7450(env); 51003e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 51013e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 51023e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 51033e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 51043e770bf7SBruno Larsen (billionai) } 51053e770bf7SBruno Larsen (billionai) 51063e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7445)(ObjectClass *oc, void *data) 51073e770bf7SBruno Larsen (billionai) { 51083e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 51093e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 51103e770bf7SBruno Larsen (billionai) 51113e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 7445 (aka G4)"; 51123e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_7445; 51133e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0_74xx; 51143e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 51153e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 51163e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 51173e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 51183e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 51193e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBA | PPC_CACHE_DCBZ | 51203e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 51213e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 51221da666cdSFabiano Rosas PPC_MEM_TLBIA | 51233e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN | 51243e770bf7SBruno Larsen (billionai) PPC_ALTIVEC; 51253e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_VR) | 51263e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 51273e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 51283e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 51293e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 51303e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 51313e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 51323e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 51333e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 51343e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 51353e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 51363e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 51373e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 51383e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 51393e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 51403e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 51413e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 51421da666cdSFabiano Rosas pcc->mmu_model = POWERPC_MMU_32B; 51433e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_74xx; 51443e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 51453e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_7400; 51463e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 51473e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 51483e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 51493e770bf7SBruno Larsen (billionai) } 51503e770bf7SBruno Larsen (billionai) 51513e770bf7SBruno Larsen (billionai) static void init_proc_7455(CPUPPCState *env) 51523e770bf7SBruno Larsen (billionai) { 51533e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 51543e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 51553e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 51563e770bf7SBruno Larsen (billionai) /* 74xx specific SPR */ 51573e770bf7SBruno Larsen (billionai) register_74xx_sprs(env); 51583e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 51593e770bf7SBruno Larsen (billionai) /* Level 3 cache control */ 51603e770bf7SBruno Larsen (billionai) register_l3_ctrl(env); 51613e770bf7SBruno Larsen (billionai) /* LDSTCR */ 51623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_LDSTCR, "LDSTCR", 51633e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 51643e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 51653e770bf7SBruno Larsen (billionai) 0x00000000); 51663e770bf7SBruno Larsen (billionai) /* ICTRL */ 51673e770bf7SBruno Larsen (billionai) spr_register(env, SPR_ICTRL, "ICTRL", 51683e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 51693e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 51703e770bf7SBruno Larsen (billionai) 0x00000000); 51713e770bf7SBruno Larsen (billionai) /* MSSSR0 */ 51723e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MSSSR0, "MSSSR0", 51733e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 51743e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 51753e770bf7SBruno Larsen (billionai) 0x00000000); 51763e770bf7SBruno Larsen (billionai) /* PMC */ 51773e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC5, "PMC5", 51783e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 51793e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 51803e770bf7SBruno Larsen (billionai) 0x00000000); 5181acf629ebSFabiano Rosas 51823e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC5, "UPMC5", 51833e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 51843e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 51853e770bf7SBruno Larsen (billionai) 0x00000000); 5186acf629ebSFabiano Rosas 51873e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC6, "PMC6", 51883e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 51893e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 51903e770bf7SBruno Larsen (billionai) 0x00000000); 5191acf629ebSFabiano Rosas 51923e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC6, "UPMC6", 51933e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 51943e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 51953e770bf7SBruno Larsen (billionai) 0x00000000); 51963e770bf7SBruno Larsen (billionai) /* SPRGs */ 51973e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG4, "SPRG4", 51983e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 51993e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 52003e770bf7SBruno Larsen (billionai) 0x00000000); 52013e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG4, "USPRG4", 52023e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 52033e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 52043e770bf7SBruno Larsen (billionai) 0x00000000); 52053e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG5, "SPRG5", 52063e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 52073e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 52083e770bf7SBruno Larsen (billionai) 0x00000000); 52093e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG5, "USPRG5", 52103e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 52113e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 52123e770bf7SBruno Larsen (billionai) 0x00000000); 52133e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG6, "SPRG6", 52143e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 52153e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 52163e770bf7SBruno Larsen (billionai) 0x00000000); 52173e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG6, "USPRG6", 52183e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 52193e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 52203e770bf7SBruno Larsen (billionai) 0x00000000); 52213e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG7, "SPRG7", 52223e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 52233e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 52243e770bf7SBruno Larsen (billionai) 0x00000000); 52253e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG7, "USPRG7", 52263e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 52273e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 52283e770bf7SBruno Larsen (billionai) 0x00000000); 52293e770bf7SBruno Larsen (billionai) /* Memory management */ 52303e770bf7SBruno Larsen (billionai) register_low_BATs(env); 52313e770bf7SBruno Larsen (billionai) register_high_BATs(env); 52323e770bf7SBruno Larsen (billionai) init_excp_7450(env); 52333e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 52343e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 52353e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 52363e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 52373e770bf7SBruno Larsen (billionai) } 52383e770bf7SBruno Larsen (billionai) 52393e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7455)(ObjectClass *oc, void *data) 52403e770bf7SBruno Larsen (billionai) { 52413e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 52423e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 52433e770bf7SBruno Larsen (billionai) 52443e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 7455 (aka G4)"; 52453e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_7455; 52463e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0_74xx; 52473e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 52483e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 52493e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 52503e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 52513e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 52523e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBA | PPC_CACHE_DCBZ | 52533e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 52543e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 52551da666cdSFabiano Rosas PPC_MEM_TLBIA | 52563e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN | 52573e770bf7SBruno Larsen (billionai) PPC_ALTIVEC; 52583e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_VR) | 52593e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 52603e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 52613e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 52623e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 52633e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 52643e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 52653e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 52663e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 52673e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 52683e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 52693e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 52703e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 52713e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 52723e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 52733e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 52743e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 52751da666cdSFabiano Rosas pcc->mmu_model = POWERPC_MMU_32B; 52763e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_74xx; 52773e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 52783e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_7400; 52793e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 52803e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 52813e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 52823e770bf7SBruno Larsen (billionai) } 52833e770bf7SBruno Larsen (billionai) 52843e770bf7SBruno Larsen (billionai) static void init_proc_7457(CPUPPCState *env) 52853e770bf7SBruno Larsen (billionai) { 52863e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 52873e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 52883e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 52893e770bf7SBruno Larsen (billionai) /* 74xx specific SPR */ 52903e770bf7SBruno Larsen (billionai) register_74xx_sprs(env); 52913e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 52923e770bf7SBruno Larsen (billionai) /* Level 3 cache control */ 52933e770bf7SBruno Larsen (billionai) register_l3_ctrl(env); 52943e770bf7SBruno Larsen (billionai) /* L3ITCR1 */ 52953e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3ITCR1, "L3ITCR1", 52963e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 52973e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 52983e770bf7SBruno Larsen (billionai) 0x00000000); 52993e770bf7SBruno Larsen (billionai) /* L3ITCR2 */ 53003e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3ITCR2, "L3ITCR2", 53013e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53023e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53033e770bf7SBruno Larsen (billionai) 0x00000000); 53043e770bf7SBruno Larsen (billionai) /* L3ITCR3 */ 53053e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3ITCR3, "L3ITCR3", 53063e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53073e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53083e770bf7SBruno Larsen (billionai) 0x00000000); 53093e770bf7SBruno Larsen (billionai) /* L3OHCR */ 53103e770bf7SBruno Larsen (billionai) spr_register(env, SPR_L3OHCR, "L3OHCR", 53113e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53123e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53133e770bf7SBruno Larsen (billionai) 0x00000000); 53143e770bf7SBruno Larsen (billionai) /* LDSTCR */ 53153e770bf7SBruno Larsen (billionai) spr_register(env, SPR_LDSTCR, "LDSTCR", 53163e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53173e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53183e770bf7SBruno Larsen (billionai) 0x00000000); 53193e770bf7SBruno Larsen (billionai) /* ICTRL */ 53203e770bf7SBruno Larsen (billionai) spr_register(env, SPR_ICTRL, "ICTRL", 53213e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53223e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53233e770bf7SBruno Larsen (billionai) 0x00000000); 53243e770bf7SBruno Larsen (billionai) /* MSSSR0 */ 53253e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MSSSR0, "MSSSR0", 53263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53283e770bf7SBruno Larsen (billionai) 0x00000000); 53293e770bf7SBruno Larsen (billionai) /* PMC */ 53303e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC5, "PMC5", 53313e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53323e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53333e770bf7SBruno Larsen (billionai) 0x00000000); 5334acf629ebSFabiano Rosas 53353e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC5, "UPMC5", 53363e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53373e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53383e770bf7SBruno Larsen (billionai) 0x00000000); 5339acf629ebSFabiano Rosas 53403e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC6, "PMC6", 53413e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53423e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53433e770bf7SBruno Larsen (billionai) 0x00000000); 5344acf629ebSFabiano Rosas 53453e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC6, "UPMC6", 53463e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53473e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53483e770bf7SBruno Larsen (billionai) 0x00000000); 53493e770bf7SBruno Larsen (billionai) /* SPRGs */ 53503e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG4, "SPRG4", 53513e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53523e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53533e770bf7SBruno Larsen (billionai) 0x00000000); 53543e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG4, "USPRG4", 53553e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53563e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53573e770bf7SBruno Larsen (billionai) 0x00000000); 53583e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG5, "SPRG5", 53593e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53603e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53613e770bf7SBruno Larsen (billionai) 0x00000000); 53623e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG5, "USPRG5", 53633e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53643e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53653e770bf7SBruno Larsen (billionai) 0x00000000); 53663e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG6, "SPRG6", 53673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53683e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53693e770bf7SBruno Larsen (billionai) 0x00000000); 53703e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG6, "USPRG6", 53713e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53723e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53733e770bf7SBruno Larsen (billionai) 0x00000000); 53743e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG7, "SPRG7", 53753e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 53763e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 53773e770bf7SBruno Larsen (billionai) 0x00000000); 53783e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG7, "USPRG7", 53793e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53803e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 53813e770bf7SBruno Larsen (billionai) 0x00000000); 53823e770bf7SBruno Larsen (billionai) /* Memory management */ 53833e770bf7SBruno Larsen (billionai) register_low_BATs(env); 53843e770bf7SBruno Larsen (billionai) register_high_BATs(env); 53853e770bf7SBruno Larsen (billionai) init_excp_7450(env); 53863e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 53873e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 53883e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 53893e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 53903e770bf7SBruno Larsen (billionai) } 53913e770bf7SBruno Larsen (billionai) 53923e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7457)(ObjectClass *oc, void *data) 53933e770bf7SBruno Larsen (billionai) { 53943e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 53953e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 53963e770bf7SBruno Larsen (billionai) 53973e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 7457 (aka G4)"; 53983e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_7457; 53993e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0_74xx; 54003e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 54013e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 54023e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 54033e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 54043e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 54053e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBA | PPC_CACHE_DCBZ | 54063e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 54073e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 54081da666cdSFabiano Rosas PPC_MEM_TLBIA | 54093e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN | 54103e770bf7SBruno Larsen (billionai) PPC_ALTIVEC; 54113e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_VR) | 54123e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 54133e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 54143e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 54153e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 54163e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 54173e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 54183e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 54193e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 54203e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 54213e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 54223e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 54233e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 54243e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 54253e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 54263e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 54273e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 54281da666cdSFabiano Rosas pcc->mmu_model = POWERPC_MMU_32B; 54293e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_74xx; 54303e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 54313e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_7400; 54323e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 54333e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 54343e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 54353e770bf7SBruno Larsen (billionai) } 54363e770bf7SBruno Larsen (billionai) 54373e770bf7SBruno Larsen (billionai) static void init_proc_e600(CPUPPCState *env) 54383e770bf7SBruno Larsen (billionai) { 54393e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 54403e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 54413e770bf7SBruno Larsen (billionai) register_7xx_sprs(env); 54423e770bf7SBruno Larsen (billionai) /* 74xx specific SPR */ 54433e770bf7SBruno Larsen (billionai) register_74xx_sprs(env); 54443e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 5445acf629ebSFabiano Rosas 54463e770bf7SBruno Larsen (billionai) spr_register(env, SPR_UBAMR, "UBAMR", 54473e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 54483e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 54493e770bf7SBruno Larsen (billionai) 0x00000000); 5450acf629ebSFabiano Rosas 54513e770bf7SBruno Larsen (billionai) spr_register(env, SPR_LDSTCR, "LDSTCR", 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_ICTRL, "ICTRL", 54573e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 54583e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 54593e770bf7SBruno Larsen (billionai) 0x00000000); 5460acf629ebSFabiano Rosas 54613e770bf7SBruno Larsen (billionai) spr_register(env, SPR_MSSSR0, "MSSSR0", 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_PMC5, "PMC5", 54673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 54683e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 54693e770bf7SBruno Larsen (billionai) 0x00000000); 5470acf629ebSFabiano Rosas 54713e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC5, "UPMC5", 54723e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 54733e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 54743e770bf7SBruno Larsen (billionai) 0x00000000); 5475acf629ebSFabiano Rosas 54763e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_PMC6, "PMC6", 54773e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 54783e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 54793e770bf7SBruno Larsen (billionai) 0x00000000); 5480acf629ebSFabiano Rosas 54813e770bf7SBruno Larsen (billionai) spr_register(env, SPR_7XX_UPMC6, "UPMC6", 54823e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 54833e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 54843e770bf7SBruno Larsen (billionai) 0x00000000); 54853e770bf7SBruno Larsen (billionai) /* SPRGs */ 54863e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG4, "SPRG4", 54873e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 54883e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 54893e770bf7SBruno Larsen (billionai) 0x00000000); 54903e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG4, "USPRG4", 54913e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 54923e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 54933e770bf7SBruno Larsen (billionai) 0x00000000); 54943e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG5, "SPRG5", 54953e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 54963e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 54973e770bf7SBruno Larsen (billionai) 0x00000000); 54983e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG5, "USPRG5", 54993e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 55003e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 55013e770bf7SBruno Larsen (billionai) 0x00000000); 55023e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG6, "SPRG6", 55033e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 55043e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 55053e770bf7SBruno Larsen (billionai) 0x00000000); 55063e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG6, "USPRG6", 55073e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 55083e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 55093e770bf7SBruno Larsen (billionai) 0x00000000); 55103e770bf7SBruno Larsen (billionai) spr_register(env, SPR_SPRG7, "SPRG7", 55113e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 55123e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 55133e770bf7SBruno Larsen (billionai) 0x00000000); 55143e770bf7SBruno Larsen (billionai) spr_register(env, SPR_USPRG7, "USPRG7", 55153e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 55163e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 55173e770bf7SBruno Larsen (billionai) 0x00000000); 55183e770bf7SBruno Larsen (billionai) /* Memory management */ 55193e770bf7SBruno Larsen (billionai) register_low_BATs(env); 55203e770bf7SBruno Larsen (billionai) register_high_BATs(env); 55213e770bf7SBruno Larsen (billionai) init_excp_7450(env); 55223e770bf7SBruno Larsen (billionai) env->dcache_line_size = 32; 55233e770bf7SBruno Larsen (billionai) env->icache_line_size = 32; 55243e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 55253e770bf7SBruno Larsen (billionai) ppc6xx_irq_init(env_archcpu(env)); 55263e770bf7SBruno Larsen (billionai) } 55273e770bf7SBruno Larsen (billionai) 55283e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e600)(ObjectClass *oc, void *data) 55293e770bf7SBruno Larsen (billionai) { 55303e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 55313e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 55323e770bf7SBruno Larsen (billionai) 55333e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC e600"; 55343e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_e600; 55353e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_hid0_74xx; 55363e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 55373e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 55383e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 55393e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 55403e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | 55413e770bf7SBruno Larsen (billionai) PPC_CACHE_DCBA | PPC_CACHE_DCBZ | 55423e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 55433e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 5544b137fb72SFabiano Rosas PPC_MEM_TLBIA | 55453e770bf7SBruno Larsen (billionai) PPC_SEGMENT | PPC_EXTERN | 55463e770bf7SBruno Larsen (billionai) PPC_ALTIVEC; 55473e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC_NONE; 55483e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_VR) | 55493e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 55503e770bf7SBruno Larsen (billionai) (1ull << MSR_ILE) | 55513e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 55523e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 55533e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 55543e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 55553e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 55563e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 55573e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 55583e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 55593e770bf7SBruno Larsen (billionai) (1ull << MSR_EP) | 55603e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 55613e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 55623e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 55633e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 55643e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 55653e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_32B; 55663e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_74xx; 55673e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_6xx; 55683e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc_7400; 55693e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 55703e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 55713e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 55723e770bf7SBruno Larsen (billionai) } 55733e770bf7SBruno Larsen (billionai) 55743e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64) 55753e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY) 55763e770bf7SBruno Larsen (billionai) #define POWERPC970_HID5_INIT 0x00000080 55773e770bf7SBruno Larsen (billionai) #else 55783e770bf7SBruno Larsen (billionai) #define POWERPC970_HID5_INIT 0x00000000 55793e770bf7SBruno Larsen (billionai) #endif 55803e770bf7SBruno Larsen (billionai) 55813e770bf7SBruno Larsen (billionai) static int check_pow_970(CPUPPCState *env) 55823e770bf7SBruno Larsen (billionai) { 55833e770bf7SBruno Larsen (billionai) if (env->spr[SPR_HID0] & (HID0_DEEPNAP | HID0_DOZE | HID0_NAP)) { 55843e770bf7SBruno Larsen (billionai) return 1; 55853e770bf7SBruno Larsen (billionai) } 55863e770bf7SBruno Larsen (billionai) 55873e770bf7SBruno Larsen (billionai) return 0; 55883e770bf7SBruno Larsen (billionai) } 55893e770bf7SBruno Larsen (billionai) 55903e770bf7SBruno Larsen (billionai) static void register_970_hid_sprs(CPUPPCState *env) 55913e770bf7SBruno Larsen (billionai) { 55923e770bf7SBruno Larsen (billionai) /* Hardware implementation registers */ 55933e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID0, "HID0", 55943e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 55953e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_clear, 55963e770bf7SBruno Larsen (billionai) 0x60000000); 55973e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HID1, "HID1", 55983e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 55993e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56003e770bf7SBruno Larsen (billionai) 0x00000000); 56013e770bf7SBruno Larsen (billionai) spr_register(env, SPR_970_HID5, "HID5", 56023e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56033e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56043e770bf7SBruno Larsen (billionai) POWERPC970_HID5_INIT); 56053e770bf7SBruno Larsen (billionai) } 56063e770bf7SBruno Larsen (billionai) 56073e770bf7SBruno Larsen (billionai) static void register_970_hior_sprs(CPUPPCState *env) 56083e770bf7SBruno Larsen (billionai) { 56093e770bf7SBruno Larsen (billionai) spr_register(env, SPR_HIOR, "SPR_HIOR", 56103e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56113e770bf7SBruno Larsen (billionai) &spr_read_hior, &spr_write_hior, 56123e770bf7SBruno Larsen (billionai) 0x00000000); 56133e770bf7SBruno Larsen (billionai) } 56143e770bf7SBruno Larsen (billionai) 56153e770bf7SBruno Larsen (billionai) static void register_book3s_ctrl_sprs(CPUPPCState *env) 56163e770bf7SBruno Larsen (billionai) { 56173e770bf7SBruno Larsen (billionai) spr_register(env, SPR_CTRL, "SPR_CTRL", 56183e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56197aeac354SDaniel Henrique Barboza SPR_NOACCESS, &spr_write_CTRL, 56203e770bf7SBruno Larsen (billionai) 0x00000000); 56213e770bf7SBruno Larsen (billionai) spr_register(env, SPR_UCTRL, "SPR_UCTRL", 56223e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 56233e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 56243e770bf7SBruno Larsen (billionai) 0x00000000); 56253e770bf7SBruno Larsen (billionai) } 56263e770bf7SBruno Larsen (billionai) 56273e770bf7SBruno Larsen (billionai) static void register_book3s_altivec_sprs(CPUPPCState *env) 56283e770bf7SBruno Larsen (billionai) { 56293e770bf7SBruno Larsen (billionai) if (!(env->insns_flags & PPC_ALTIVEC)) { 56303e770bf7SBruno Larsen (billionai) return; 56313e770bf7SBruno Larsen (billionai) } 56323e770bf7SBruno Larsen (billionai) 56333e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_VRSAVE, "VRSAVE", 56343e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56353e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56363e770bf7SBruno Larsen (billionai) KVM_REG_PPC_VRSAVE, 0x00000000); 56373e770bf7SBruno Larsen (billionai) 56383e770bf7SBruno Larsen (billionai) } 56393e770bf7SBruno Larsen (billionai) 56403e770bf7SBruno Larsen (billionai) static void register_book3s_dbg_sprs(CPUPPCState *env) 56413e770bf7SBruno Larsen (billionai) { 56423e770bf7SBruno Larsen (billionai) /* 56433e770bf7SBruno Larsen (billionai) * TODO: different specs define different scopes for these, 56443e770bf7SBruno Larsen (billionai) * will have to address this: 56453e770bf7SBruno Larsen (billionai) * 970: super/write and super/read 56463e770bf7SBruno Larsen (billionai) * powerisa 2.03..2.04: hypv/write and super/read. 56473e770bf7SBruno Larsen (billionai) * powerisa 2.05 and newer: hypv/write and hypv/read. 56483e770bf7SBruno Larsen (billionai) */ 56493e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_DABR, "DABR", 56503e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56513e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56523e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DABR, 0x00000000); 56533e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_DABRX, "DABRX", 56543e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56553e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56563e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DABRX, 0x00000000); 56573e770bf7SBruno Larsen (billionai) } 56583e770bf7SBruno Larsen (billionai) 56593e770bf7SBruno Larsen (billionai) static void register_book3s_207_dbg_sprs(CPUPPCState *env) 56603e770bf7SBruno Larsen (billionai) { 56613e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_DAWR0, "DAWR0", 56623e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56633e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56643e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56653e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DAWR, 0x00000000); 56663e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_DAWRX0, "DAWRX0", 56673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56683e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56693e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56703e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DAWRX, 0x00000000); 56713e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_CIABR, "CIABR", 56723e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56733e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56743e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56753e770bf7SBruno Larsen (billionai) KVM_REG_PPC_CIABR, 0x00000000); 56763e770bf7SBruno Larsen (billionai) } 56773e770bf7SBruno Larsen (billionai) 56783e770bf7SBruno Larsen (billionai) static void register_970_dbg_sprs(CPUPPCState *env) 56793e770bf7SBruno Larsen (billionai) { 56803e770bf7SBruno Larsen (billionai) /* Breakpoints */ 56813e770bf7SBruno Larsen (billionai) spr_register(env, SPR_IABR, "IABR", 56823e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56833e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 56843e770bf7SBruno Larsen (billionai) 0x00000000); 56853e770bf7SBruno Larsen (billionai) } 56863e770bf7SBruno Larsen (billionai) 56873e770bf7SBruno Larsen (billionai) static void register_book3s_pmu_sup_sprs(CPUPPCState *env) 56883e770bf7SBruno Larsen (billionai) { 56893e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_MMCR0, "MMCR0", 56903e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5691c2eff582SDaniel Henrique Barboza &spr_read_generic, &spr_write_MMCR0, 5692c2eff582SDaniel Henrique Barboza KVM_REG_PPC_MMCR0, 0x80000000); 56933e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_MMCR1, "MMCR1", 56943e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5695a6f91249SDaniel Henrique Barboza &spr_read_generic, &spr_write_MMCR1, 56963e770bf7SBruno Larsen (billionai) KVM_REG_PPC_MMCR1, 0x00000000); 56973e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_MMCRA, "MMCRA", 56983e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 56993e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 57003e770bf7SBruno Larsen (billionai) KVM_REG_PPC_MMCRA, 0x00000000); 57013e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_PMC1, "PMC1", 57023e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5703308b9fadSDaniel Henrique Barboza &spr_read_PMC, &spr_write_PMC, 57043e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PMC1, 0x00000000); 57053e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_PMC2, "PMC2", 57063e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5707308b9fadSDaniel Henrique Barboza &spr_read_PMC, &spr_write_PMC, 57083e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PMC2, 0x00000000); 57093e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_PMC3, "PMC3", 57103e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5711308b9fadSDaniel Henrique Barboza &spr_read_PMC, &spr_write_PMC, 57123e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PMC3, 0x00000000); 57133e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_PMC4, "PMC4", 57143e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5715308b9fadSDaniel Henrique Barboza &spr_read_PMC, &spr_write_PMC, 57163e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PMC4, 0x00000000); 57173e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_PMC5, "PMC5", 57183e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5719308b9fadSDaniel Henrique Barboza &spr_read_PMC, &spr_write_PMC, 57203e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PMC5, 0x00000000); 57213e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_PMC6, "PMC6", 57223e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 5723308b9fadSDaniel Henrique Barboza &spr_read_PMC, &spr_write_PMC, 57243e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PMC6, 0x00000000); 57253e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_SIAR, "SIAR", 57263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 57273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 57283e770bf7SBruno Larsen (billionai) KVM_REG_PPC_SIAR, 0x00000000); 57293e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_SDAR, "SDAR", 57303e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 57313e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 57323e770bf7SBruno Larsen (billionai) KVM_REG_PPC_SDAR, 0x00000000); 57333e770bf7SBruno Larsen (billionai) } 57343e770bf7SBruno Larsen (billionai) 57353e770bf7SBruno Larsen (billionai) static void register_book3s_pmu_user_sprs(CPUPPCState *env) 57363e770bf7SBruno Larsen (billionai) { 57373e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UMMCR0, "UMMCR0", 5738565cb109SGustavo Romero &spr_read_MMCR0_ureg, &spr_write_MMCR0_ureg, 57393e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 5740c2eff582SDaniel Henrique Barboza 0x80000000); 57413e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UMMCR1, "UMMCR1", 57423e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 57433e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57443e770bf7SBruno Larsen (billionai) 0x00000000); 57453e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UMMCRA, "UMMCRA", 57463e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 57473e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57483e770bf7SBruno Larsen (billionai) 0x00000000); 57493e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UPMC1, "UPMC1", 5750cedf7069SDaniel Henrique Barboza &spr_read_PMC14_ureg, &spr_write_PMC14_ureg, 57513e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57523e770bf7SBruno Larsen (billionai) 0x00000000); 57533e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UPMC2, "UPMC2", 5754cedf7069SDaniel Henrique Barboza &spr_read_PMC14_ureg, &spr_write_PMC14_ureg, 57553e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57563e770bf7SBruno Larsen (billionai) 0x00000000); 57573e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UPMC3, "UPMC3", 5758cedf7069SDaniel Henrique Barboza &spr_read_PMC14_ureg, &spr_write_PMC14_ureg, 57593e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57603e770bf7SBruno Larsen (billionai) 0x00000000); 57613e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UPMC4, "UPMC4", 5762cedf7069SDaniel Henrique Barboza &spr_read_PMC14_ureg, &spr_write_PMC14_ureg, 57633e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57643e770bf7SBruno Larsen (billionai) 0x00000000); 57653e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UPMC5, "UPMC5", 5766cedf7069SDaniel Henrique Barboza &spr_read_PMC56_ureg, &spr_write_PMC56_ureg, 57673e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57683e770bf7SBruno Larsen (billionai) 0x00000000); 57693e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UPMC6, "UPMC6", 5770cedf7069SDaniel Henrique Barboza &spr_read_PMC56_ureg, &spr_write_PMC56_ureg, 57713e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57723e770bf7SBruno Larsen (billionai) 0x00000000); 57733e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_USIAR, "USIAR", 57743e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 57753e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57763e770bf7SBruno Larsen (billionai) 0x00000000); 57773e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_USDAR, "USDAR", 57783e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 57793e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 57803e770bf7SBruno Larsen (billionai) 0x00000000); 57813e770bf7SBruno Larsen (billionai) } 57823e770bf7SBruno Larsen (billionai) 57833e770bf7SBruno Larsen (billionai) static void register_970_pmu_sup_sprs(CPUPPCState *env) 57843e770bf7SBruno Larsen (billionai) { 57853e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_970_PMC7, "PMC7", 57863e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 57873e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 57883e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PMC7, 0x00000000); 57893e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_970_PMC8, "PMC8", 57903e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 57913e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 57923e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PMC8, 0x00000000); 57933e770bf7SBruno Larsen (billionai) } 57943e770bf7SBruno Larsen (billionai) 57953e770bf7SBruno Larsen (billionai) static void register_970_pmu_user_sprs(CPUPPCState *env) 57963e770bf7SBruno Larsen (billionai) { 57973e770bf7SBruno Larsen (billionai) spr_register(env, SPR_970_UPMC7, "UPMC7", 57983e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 57993e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 58003e770bf7SBruno Larsen (billionai) 0x00000000); 58013e770bf7SBruno Larsen (billionai) spr_register(env, SPR_970_UPMC8, "UPMC8", 58023e770bf7SBruno Larsen (billionai) &spr_read_ureg, SPR_NOACCESS, 58033e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 58043e770bf7SBruno Larsen (billionai) 0x00000000); 58053e770bf7SBruno Larsen (billionai) } 58063e770bf7SBruno Larsen (billionai) 58073e770bf7SBruno Larsen (billionai) static void register_power8_pmu_sup_sprs(CPUPPCState *env) 58083e770bf7SBruno Larsen (billionai) { 58093e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_MMCR2, "MMCR2", 58103e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58113e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58123e770bf7SBruno Larsen (billionai) KVM_REG_PPC_MMCR2, 0x00000000); 58133e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_MMCRS, "MMCRS", 58143e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58153e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58163e770bf7SBruno Larsen (billionai) KVM_REG_PPC_MMCRS, 0x00000000); 58173e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_SIER, "SIER", 58183e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58193e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58203e770bf7SBruno Larsen (billionai) KVM_REG_PPC_SIER, 0x00000000); 58213e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_SPMC1, "SPMC1", 58223e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58233e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58243e770bf7SBruno Larsen (billionai) KVM_REG_PPC_SPMC1, 0x00000000); 58253e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_POWER_SPMC2, "SPMC2", 58263e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58283e770bf7SBruno Larsen (billionai) KVM_REG_PPC_SPMC2, 0x00000000); 58293e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_TACR, "TACR", 58303e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58313e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58323e770bf7SBruno Larsen (billionai) KVM_REG_PPC_TACR, 0x00000000); 58333e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_TCSCR, "TCSCR", 58343e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58353e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58363e770bf7SBruno Larsen (billionai) KVM_REG_PPC_TCSCR, 0x00000000); 58373e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_CSIGR, "CSIGR", 58383e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58393e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58403e770bf7SBruno Larsen (billionai) KVM_REG_PPC_CSIGR, 0x00000000); 58413e770bf7SBruno Larsen (billionai) } 58423e770bf7SBruno Larsen (billionai) 58433e770bf7SBruno Larsen (billionai) static void register_power8_pmu_user_sprs(CPUPPCState *env) 58443e770bf7SBruno Larsen (billionai) { 58453e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_UMMCR2, "UMMCR2", 58467b3ecf16SDaniel Henrique Barboza &spr_read_MMCR2_ureg, &spr_write_MMCR2_ureg, 58473e770bf7SBruno Larsen (billionai) &spr_read_ureg, &spr_write_ureg, 58483e770bf7SBruno Larsen (billionai) 0x00000000); 58493e770bf7SBruno Larsen (billionai) spr_register(env, SPR_POWER_USIER, "USIER", 58503e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 58513e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58523e770bf7SBruno Larsen (billionai) 0x00000000); 58533e770bf7SBruno Larsen (billionai) } 58543e770bf7SBruno Larsen (billionai) 58553e770bf7SBruno Larsen (billionai) static void register_power5p_ear_sprs(CPUPPCState *env) 58563e770bf7SBruno Larsen (billionai) { 58573e770bf7SBruno Larsen (billionai) /* External access control */ 58583e770bf7SBruno Larsen (billionai) spr_register(env, SPR_EAR, "EAR", 58593e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58603e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58613e770bf7SBruno Larsen (billionai) 0x00000000); 58623e770bf7SBruno Larsen (billionai) } 58633e770bf7SBruno Larsen (billionai) 58643e770bf7SBruno Larsen (billionai) static void register_power5p_tb_sprs(CPUPPCState *env) 58653e770bf7SBruno Larsen (billionai) { 58663e770bf7SBruno Larsen (billionai) /* TBU40 (High 40 bits of the Timebase register */ 58673e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_TBU40, "TBU40", 58683e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58693e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58703e770bf7SBruno Larsen (billionai) SPR_NOACCESS, &spr_write_tbu40, 58713e770bf7SBruno Larsen (billionai) 0x00000000); 58723e770bf7SBruno Larsen (billionai) } 58733e770bf7SBruno Larsen (billionai) 58743e770bf7SBruno Larsen (billionai) static void register_970_lpar_sprs(CPUPPCState *env) 58753e770bf7SBruno Larsen (billionai) { 58763e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 58773e770bf7SBruno Larsen (billionai) /* 58783e770bf7SBruno Larsen (billionai) * PPC970: HID4 covers things later controlled by the LPCR and 58793e770bf7SBruno Larsen (billionai) * RMOR in later CPUs, but with a different encoding. We only 58803e770bf7SBruno Larsen (billionai) * support the 970 in "Apple mode" which has all hypervisor 58813e770bf7SBruno Larsen (billionai) * facilities disabled by strapping, so we can basically just 58823e770bf7SBruno Larsen (billionai) * ignore it 58833e770bf7SBruno Larsen (billionai) */ 58843e770bf7SBruno Larsen (billionai) spr_register(env, SPR_970_HID4, "HID4", 58853e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58863e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 58873e770bf7SBruno Larsen (billionai) 0x00000000); 58883e770bf7SBruno Larsen (billionai) #endif 58893e770bf7SBruno Larsen (billionai) } 58903e770bf7SBruno Larsen (billionai) 58913e770bf7SBruno Larsen (billionai) static void register_power5p_lpar_sprs(CPUPPCState *env) 58923e770bf7SBruno Larsen (billionai) { 58933e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 58943e770bf7SBruno Larsen (billionai) /* Logical partitionning */ 58953e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_LPCR, "LPCR", 58963e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58973e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 58983e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_lpcr, 58993e770bf7SBruno Larsen (billionai) KVM_REG_PPC_LPCR, LPCR_LPES0 | LPCR_LPES1); 59003e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_HDEC, "HDEC", 59013e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59023e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59033e770bf7SBruno Larsen (billionai) &spr_read_hdecr, &spr_write_hdecr, 0); 59043e770bf7SBruno Larsen (billionai) #endif 59053e770bf7SBruno Larsen (billionai) } 59063e770bf7SBruno Larsen (billionai) 59073e770bf7SBruno Larsen (billionai) static void register_book3s_ids_sprs(CPUPPCState *env) 59083e770bf7SBruno Larsen (billionai) { 59093e770bf7SBruno Larsen (billionai) /* FIXME: Will need to deal with thread vs core only SPRs */ 59103e770bf7SBruno Larsen (billionai) 59113e770bf7SBruno Larsen (billionai) /* Processor identification */ 59123e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_PIR, "PIR", 59133e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59143e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 59153e770bf7SBruno Larsen (billionai) &spr_read_generic, NULL, 59163e770bf7SBruno Larsen (billionai) 0x00000000); 59173e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_HID0, "HID0", 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_TSCR, "TSCR", 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_HMER, "HMER", 59283e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59293e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59303e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_hmer, 59313e770bf7SBruno Larsen (billionai) 0x00000000); 59323e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_HMEER, "HMEER", 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_TFMR, "TFMR", 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_LPIDR, "LPIDR", 59433e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59443e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59453e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_lpidr, 59463e770bf7SBruno Larsen (billionai) 0x00000000); 59473e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_HFSCR, "HFSCR", 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_MMCRC, "MMCRC", 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_MMCRH, "MMCRH", 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_HSPRG0, "HSPRG0", 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_HSPRG1, "HSPRG1", 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_HSRR0, "HSRR0", 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_HSRR1, "HSRR1", 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) spr_register_hv(env, SPR_HDAR, "HDAR", 59833e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59843e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59853e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 59863e770bf7SBruno Larsen (billionai) 0x00000000); 59873e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_HDSISR, "HDSISR", 59883e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59893e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59903e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 59913e770bf7SBruno Larsen (billionai) 0x00000000); 59923e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_HRMOR, "HRMOR", 59933e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59943e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 59953e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 59963e770bf7SBruno Larsen (billionai) 0x00000000); 59973e770bf7SBruno Larsen (billionai) } 59983e770bf7SBruno Larsen (billionai) 59993e770bf7SBruno Larsen (billionai) static void register_rmor_sprs(CPUPPCState *env) 60003e770bf7SBruno Larsen (billionai) { 60013e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_RMOR, "RMOR", 60023e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 60033e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 60043e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 60053e770bf7SBruno Larsen (billionai) 0x00000000); 60063e770bf7SBruno Larsen (billionai) } 60073e770bf7SBruno Larsen (billionai) 60083e770bf7SBruno Larsen (billionai) static void register_power8_ids_sprs(CPUPPCState *env) 60093e770bf7SBruno Larsen (billionai) { 60103e770bf7SBruno Larsen (billionai) /* Thread identification */ 60113e770bf7SBruno Larsen (billionai) spr_register(env, SPR_TIR, "TIR", 60123e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 60133e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 60143e770bf7SBruno Larsen (billionai) 0x00000000); 60153e770bf7SBruno Larsen (billionai) } 60163e770bf7SBruno Larsen (billionai) 60173e770bf7SBruno Larsen (billionai) static void register_book3s_purr_sprs(CPUPPCState *env) 60183e770bf7SBruno Larsen (billionai) { 60193e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 60203e770bf7SBruno Larsen (billionai) /* PURR & SPURR: Hack - treat these as aliases for the TB for now */ 60213e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_PURR, "PURR", 60223e770bf7SBruno Larsen (billionai) &spr_read_purr, SPR_NOACCESS, 60233e770bf7SBruno Larsen (billionai) &spr_read_purr, SPR_NOACCESS, 60243e770bf7SBruno Larsen (billionai) &spr_read_purr, &spr_write_purr, 60253e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PURR, 0x00000000); 60263e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_SPURR, "SPURR", 60273e770bf7SBruno Larsen (billionai) &spr_read_purr, SPR_NOACCESS, 60283e770bf7SBruno Larsen (billionai) &spr_read_purr, SPR_NOACCESS, 60293e770bf7SBruno Larsen (billionai) &spr_read_purr, &spr_write_purr, 60303e770bf7SBruno Larsen (billionai) KVM_REG_PPC_SPURR, 0x00000000); 60313e770bf7SBruno Larsen (billionai) #endif 60323e770bf7SBruno Larsen (billionai) } 60333e770bf7SBruno Larsen (billionai) 60343e770bf7SBruno Larsen (billionai) static void register_power6_dbg_sprs(CPUPPCState *env) 60353e770bf7SBruno Larsen (billionai) { 60363e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 60373e770bf7SBruno Larsen (billionai) spr_register(env, SPR_CFAR, "SPR_CFAR", 60383e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 60393e770bf7SBruno Larsen (billionai) &spr_read_cfar, &spr_write_cfar, 60403e770bf7SBruno Larsen (billionai) 0x00000000); 60413e770bf7SBruno Larsen (billionai) #endif 60423e770bf7SBruno Larsen (billionai) } 60433e770bf7SBruno Larsen (billionai) 60443e770bf7SBruno Larsen (billionai) static void register_power5p_common_sprs(CPUPPCState *env) 60453e770bf7SBruno Larsen (billionai) { 60463e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_PPR, "PPR", 60473e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 60483e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 60493e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PPR, 0x00000000); 60503e770bf7SBruno Larsen (billionai) } 60513e770bf7SBruno Larsen (billionai) 60523e770bf7SBruno Larsen (billionai) static void register_power6_common_sprs(CPUPPCState *env) 60533e770bf7SBruno Larsen (billionai) { 60543e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 60553e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_DSCR, "SPR_DSCR", 60563e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 60573e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 60583e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DSCR, 0x00000000); 60593e770bf7SBruno Larsen (billionai) #endif 60603e770bf7SBruno Larsen (billionai) /* 60613e770bf7SBruno Larsen (billionai) * Register PCR to report POWERPC_EXCP_PRIV_REG instead of 60623e770bf7SBruno Larsen (billionai) * POWERPC_EXCP_INVAL_SPR in userspace. Permit hypervisor access. 60633e770bf7SBruno Larsen (billionai) */ 60643e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_PCR, "PCR", 60653e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 60663e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 60673e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_pcr, 60683e770bf7SBruno Larsen (billionai) 0x00000000); 60693e770bf7SBruno Larsen (billionai) } 60703e770bf7SBruno Larsen (billionai) 60713e770bf7SBruno Larsen (billionai) static void register_power8_tce_address_control_sprs(CPUPPCState *env) 60723e770bf7SBruno Larsen (billionai) { 60733e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_TAR, "TAR", 60743e770bf7SBruno Larsen (billionai) &spr_read_tar, &spr_write_tar, 60753e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 60763e770bf7SBruno Larsen (billionai) KVM_REG_PPC_TAR, 0x00000000); 60773e770bf7SBruno Larsen (billionai) } 60783e770bf7SBruno Larsen (billionai) 60793e770bf7SBruno Larsen (billionai) static void register_power8_tm_sprs(CPUPPCState *env) 60803e770bf7SBruno Larsen (billionai) { 60813e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_TFHAR, "TFHAR", 60823e770bf7SBruno Larsen (billionai) &spr_read_tm, &spr_write_tm, 60833e770bf7SBruno Larsen (billionai) &spr_read_tm, &spr_write_tm, 60843e770bf7SBruno Larsen (billionai) KVM_REG_PPC_TFHAR, 0x00000000); 60853e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_TFIAR, "TFIAR", 60863e770bf7SBruno Larsen (billionai) &spr_read_tm, &spr_write_tm, 60873e770bf7SBruno Larsen (billionai) &spr_read_tm, &spr_write_tm, 60883e770bf7SBruno Larsen (billionai) KVM_REG_PPC_TFIAR, 0x00000000); 60893e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_TEXASR, "TEXASR", 60903e770bf7SBruno Larsen (billionai) &spr_read_tm, &spr_write_tm, 60913e770bf7SBruno Larsen (billionai) &spr_read_tm, &spr_write_tm, 60923e770bf7SBruno Larsen (billionai) KVM_REG_PPC_TEXASR, 0x00000000); 60933e770bf7SBruno Larsen (billionai) spr_register(env, SPR_TEXASRU, "TEXASRU", 60943e770bf7SBruno Larsen (billionai) &spr_read_tm_upper32, &spr_write_tm_upper32, 60953e770bf7SBruno Larsen (billionai) &spr_read_tm_upper32, &spr_write_tm_upper32, 60963e770bf7SBruno Larsen (billionai) 0x00000000); 60973e770bf7SBruno Larsen (billionai) } 60983e770bf7SBruno Larsen (billionai) 60993e770bf7SBruno Larsen (billionai) static void register_power8_ebb_sprs(CPUPPCState *env) 61003e770bf7SBruno Larsen (billionai) { 61013e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BESCRS, "BESCRS", 61023e770bf7SBruno Larsen (billionai) &spr_read_ebb, &spr_write_ebb, 61033e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 61043e770bf7SBruno Larsen (billionai) 0x00000000); 61053e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BESCRSU, "BESCRSU", 61063e770bf7SBruno Larsen (billionai) &spr_read_ebb_upper32, &spr_write_ebb_upper32, 61073e770bf7SBruno Larsen (billionai) &spr_read_prev_upper32, &spr_write_prev_upper32, 61083e770bf7SBruno Larsen (billionai) 0x00000000); 61093e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BESCRR, "BESCRR", 61103e770bf7SBruno Larsen (billionai) &spr_read_ebb, &spr_write_ebb, 61113e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 61123e770bf7SBruno Larsen (billionai) 0x00000000); 61133e770bf7SBruno Larsen (billionai) spr_register(env, SPR_BESCRRU, "BESCRRU", 61143e770bf7SBruno Larsen (billionai) &spr_read_ebb_upper32, &spr_write_ebb_upper32, 61153e770bf7SBruno Larsen (billionai) &spr_read_prev_upper32, &spr_write_prev_upper32, 61163e770bf7SBruno Larsen (billionai) 0x00000000); 61173e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_EBBHR, "EBBHR", 61183e770bf7SBruno Larsen (billionai) &spr_read_ebb, &spr_write_ebb, 61193e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 61203e770bf7SBruno Larsen (billionai) KVM_REG_PPC_EBBHR, 0x00000000); 61213e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_EBBRR, "EBBRR", 61223e770bf7SBruno Larsen (billionai) &spr_read_ebb, &spr_write_ebb, 61233e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 61243e770bf7SBruno Larsen (billionai) KVM_REG_PPC_EBBRR, 0x00000000); 61253e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_BESCR, "BESCR", 61263e770bf7SBruno Larsen (billionai) &spr_read_ebb, &spr_write_ebb, 61273e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 61283e770bf7SBruno Larsen (billionai) KVM_REG_PPC_BESCR, 0x00000000); 61293e770bf7SBruno Larsen (billionai) } 61303e770bf7SBruno Larsen (billionai) 61313e770bf7SBruno Larsen (billionai) /* Virtual Time Base */ 61323e770bf7SBruno Larsen (billionai) static void register_vtb_sprs(CPUPPCState *env) 61333e770bf7SBruno Larsen (billionai) { 61343e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_VTB, "VTB", 61353e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 61363e770bf7SBruno Larsen (billionai) &spr_read_vtb, SPR_NOACCESS, 61373e770bf7SBruno Larsen (billionai) &spr_read_vtb, &spr_write_vtb, 61383e770bf7SBruno Larsen (billionai) KVM_REG_PPC_VTB, 0x00000000); 61393e770bf7SBruno Larsen (billionai) } 61403e770bf7SBruno Larsen (billionai) 61413e770bf7SBruno Larsen (billionai) static void register_power8_fscr_sprs(CPUPPCState *env) 61423e770bf7SBruno Larsen (billionai) { 61433e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY) 61443e770bf7SBruno Larsen (billionai) target_ulong initval = 1ULL << FSCR_TAR; 61453e770bf7SBruno Larsen (billionai) #else 61463e770bf7SBruno Larsen (billionai) target_ulong initval = 0; 61473e770bf7SBruno Larsen (billionai) #endif 61483e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_FSCR, "FSCR", 61493e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 61503e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 61513e770bf7SBruno Larsen (billionai) KVM_REG_PPC_FSCR, initval); 61523e770bf7SBruno Larsen (billionai) } 61533e770bf7SBruno Larsen (billionai) 61543e770bf7SBruno Larsen (billionai) static void register_power8_pspb_sprs(CPUPPCState *env) 61553e770bf7SBruno Larsen (billionai) { 61563e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_PSPB, "PSPB", 61573e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 61583e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic32, 61593e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PSPB, 0); 61603e770bf7SBruno Larsen (billionai) } 61613e770bf7SBruno Larsen (billionai) 61623e770bf7SBruno Larsen (billionai) static void register_power8_dpdes_sprs(CPUPPCState *env) 61633e770bf7SBruno Larsen (billionai) { 61643e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 61653e770bf7SBruno Larsen (billionai) /* Directed Privileged Door-bell Exception State, used for IPI */ 61663e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_DPDES, "DPDES", 61673e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 61683e770bf7SBruno Larsen (billionai) &spr_read_dpdes, SPR_NOACCESS, 61693e770bf7SBruno Larsen (billionai) &spr_read_dpdes, &spr_write_dpdes, 61703e770bf7SBruno Larsen (billionai) KVM_REG_PPC_DPDES, 0x00000000); 61713e770bf7SBruno Larsen (billionai) #endif 61723e770bf7SBruno Larsen (billionai) } 61733e770bf7SBruno Larsen (billionai) 61743e770bf7SBruno Larsen (billionai) static void register_power8_ic_sprs(CPUPPCState *env) 61753e770bf7SBruno Larsen (billionai) { 61763e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 61773e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_IC, "IC", 61783e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 61793e770bf7SBruno Larsen (billionai) &spr_read_generic, SPR_NOACCESS, 61803e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 61813e770bf7SBruno Larsen (billionai) 0); 61823e770bf7SBruno Larsen (billionai) #endif 61833e770bf7SBruno Larsen (billionai) } 61843e770bf7SBruno Larsen (billionai) 61853e770bf7SBruno Larsen (billionai) static void register_power8_book4_sprs(CPUPPCState *env) 61863e770bf7SBruno Larsen (billionai) { 61873e770bf7SBruno Larsen (billionai) /* Add a number of P8 book4 registers */ 61883e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 61893e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_ACOP, "ACOP", 61903e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 61913e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 61923e770bf7SBruno Larsen (billionai) KVM_REG_PPC_ACOP, 0); 61933e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_BOOKS_PID, "PID", 61943e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 61953e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_pidr, 61963e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PID, 0); 61973e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_WORT, "WORT", 61983e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 61993e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 62003e770bf7SBruno Larsen (billionai) KVM_REG_PPC_WORT, 0); 62013e770bf7SBruno Larsen (billionai) #endif 62023e770bf7SBruno Larsen (billionai) } 62033e770bf7SBruno Larsen (billionai) 62043e770bf7SBruno Larsen (billionai) static void register_power7_book4_sprs(CPUPPCState *env) 62053e770bf7SBruno Larsen (billionai) { 62063e770bf7SBruno Larsen (billionai) /* Add a number of P7 book4 registers */ 62073e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 62083e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_ACOP, "ACOP", 62093e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 62103e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 62113e770bf7SBruno Larsen (billionai) KVM_REG_PPC_ACOP, 0); 62123e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_BOOKS_PID, "PID", 62133e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 62143e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 62153e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PID, 0); 62163e770bf7SBruno Larsen (billionai) #endif 62173e770bf7SBruno Larsen (billionai) } 62183e770bf7SBruno Larsen (billionai) 62193e770bf7SBruno Larsen (billionai) static void register_power8_rpr_sprs(CPUPPCState *env) 62203e770bf7SBruno Larsen (billionai) { 62213e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 62223e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_RPR, "RPR", 62233e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 62243e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 62253e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 62263e770bf7SBruno Larsen (billionai) 0x00000103070F1F3F); 62273e770bf7SBruno Larsen (billionai) #endif 62283e770bf7SBruno Larsen (billionai) } 62293e770bf7SBruno Larsen (billionai) 62303e770bf7SBruno Larsen (billionai) static void register_power9_mmu_sprs(CPUPPCState *env) 62313e770bf7SBruno Larsen (billionai) { 62323e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 62333e770bf7SBruno Larsen (billionai) /* Partition Table Control */ 62343e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_PTCR, "PTCR", 62353e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 62363e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 62373e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_ptcr, 62383e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PTCR, 0x00000000); 62393e770bf7SBruno Larsen (billionai) /* Address Segment Descriptor Register */ 62403e770bf7SBruno Larsen (billionai) spr_register_hv(env, SPR_ASDR, "ASDR", 62413e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 62423e770bf7SBruno Larsen (billionai) SPR_NOACCESS, SPR_NOACCESS, 62433e770bf7SBruno Larsen (billionai) &spr_read_generic, &spr_write_generic, 62443e770bf7SBruno Larsen (billionai) 0x0000000000000000); 62453e770bf7SBruno Larsen (billionai) #endif 62463e770bf7SBruno Larsen (billionai) } 62473e770bf7SBruno Larsen (billionai) 62488f2e9d40SDaniel Henrique Barboza /* 62498f2e9d40SDaniel Henrique Barboza * Initialize PMU counter overflow timers for Power8 and 62508f2e9d40SDaniel Henrique Barboza * newer Power chips when using TCG. 62518f2e9d40SDaniel Henrique Barboza */ 62528f2e9d40SDaniel Henrique Barboza static void init_tcg_pmu_power8(CPUPPCState *env) 62538f2e9d40SDaniel Henrique Barboza { 62548f2e9d40SDaniel Henrique Barboza #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) 62558f2e9d40SDaniel Henrique Barboza /* Init PMU overflow timers */ 62568f2e9d40SDaniel Henrique Barboza if (!kvm_enabled()) { 62578f2e9d40SDaniel Henrique Barboza cpu_ppc_pmu_init(env); 62588f2e9d40SDaniel Henrique Barboza } 62598f2e9d40SDaniel Henrique Barboza #endif 62608f2e9d40SDaniel Henrique Barboza } 62618f2e9d40SDaniel Henrique Barboza 62623e770bf7SBruno Larsen (billionai) static void init_proc_book3s_common(CPUPPCState *env) 62633e770bf7SBruno Larsen (billionai) { 62643e770bf7SBruno Larsen (billionai) register_ne_601_sprs(env); 62653e770bf7SBruno Larsen (billionai) register_usprg3_sprs(env); 62663e770bf7SBruno Larsen (billionai) register_book3s_altivec_sprs(env); 62673e770bf7SBruno Larsen (billionai) register_book3s_pmu_sup_sprs(env); 62683e770bf7SBruno Larsen (billionai) register_book3s_pmu_user_sprs(env); 62693e770bf7SBruno Larsen (billionai) register_book3s_ctrl_sprs(env); 62703e770bf7SBruno Larsen (billionai) /* 62713e770bf7SBruno Larsen (billionai) * Can't find information on what this should be on reset. This 62723e770bf7SBruno Larsen (billionai) * value is the one used by 74xx processors. 62733e770bf7SBruno Larsen (billionai) */ 62743e770bf7SBruno Larsen (billionai) vscr_init(env, 0x00010000); 62753e770bf7SBruno Larsen (billionai) } 62763e770bf7SBruno Larsen (billionai) 62773e770bf7SBruno Larsen (billionai) static void init_proc_970(CPUPPCState *env) 62783e770bf7SBruno Larsen (billionai) { 62793e770bf7SBruno Larsen (billionai) /* Common Registers */ 62803e770bf7SBruno Larsen (billionai) init_proc_book3s_common(env); 62813e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 62823e770bf7SBruno Larsen (billionai) register_book3s_dbg_sprs(env); 62833e770bf7SBruno Larsen (billionai) 62843e770bf7SBruno Larsen (billionai) /* 970 Specific Registers */ 62853e770bf7SBruno Larsen (billionai) register_970_hid_sprs(env); 62863e770bf7SBruno Larsen (billionai) register_970_hior_sprs(env); 62873e770bf7SBruno Larsen (billionai) register_low_BATs(env); 62883e770bf7SBruno Larsen (billionai) register_970_pmu_sup_sprs(env); 62893e770bf7SBruno Larsen (billionai) register_970_pmu_user_sprs(env); 62903e770bf7SBruno Larsen (billionai) register_970_lpar_sprs(env); 62913e770bf7SBruno Larsen (billionai) register_970_dbg_sprs(env); 62923e770bf7SBruno Larsen (billionai) 62933e770bf7SBruno Larsen (billionai) /* env variables */ 62943e770bf7SBruno Larsen (billionai) env->dcache_line_size = 128; 62953e770bf7SBruno Larsen (billionai) env->icache_line_size = 128; 62963e770bf7SBruno Larsen (billionai) 62973e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 62983e770bf7SBruno Larsen (billionai) init_excp_970(env); 62993e770bf7SBruno Larsen (billionai) ppc970_irq_init(env_archcpu(env)); 63003e770bf7SBruno Larsen (billionai) } 63013e770bf7SBruno Larsen (billionai) 63023e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(970)(ObjectClass *oc, void *data) 63033e770bf7SBruno Larsen (billionai) { 63043e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 63053e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 63063e770bf7SBruno Larsen (billionai) 63073e770bf7SBruno Larsen (billionai) dc->desc = "PowerPC 970"; 63083e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_970; 63093e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_970; 63103e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 63113e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 63123e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 63133e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 63143e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 63153e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 63163e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 63173e770bf7SBruno Larsen (billionai) PPC_64B | PPC_ALTIVEC | 63183e770bf7SBruno Larsen (billionai) PPC_SEGMENT_64B | PPC_SLBI; 63193e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_FP_CVT_S64; 63203e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_SF) | 63213e770bf7SBruno Larsen (billionai) (1ull << MSR_VR) | 63223e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 63233e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 63243e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 63253e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 63263e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 63273e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 63283e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 63293e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 63303e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 63313e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 63323e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 63333e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 63343e770bf7SBruno Larsen (billionai) (1ull << MSR_RI); 63353e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_64B; 63363e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU) 63373e770bf7SBruno Larsen (billionai) pcc->hash64_opts = &ppc_hash64_opts_basic; 63383e770bf7SBruno Larsen (billionai) #endif 63393e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_970; 63403e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_970; 63413e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc64; 63423e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 63433e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 63443e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 63453e770bf7SBruno Larsen (billionai) pcc->l1_dcache_size = 0x8000; 63463e770bf7SBruno Larsen (billionai) pcc->l1_icache_size = 0x10000; 63473e770bf7SBruno Larsen (billionai) } 63483e770bf7SBruno Larsen (billionai) 63493e770bf7SBruno Larsen (billionai) static void init_proc_power5plus(CPUPPCState *env) 63503e770bf7SBruno Larsen (billionai) { 63513e770bf7SBruno Larsen (billionai) /* Common Registers */ 63523e770bf7SBruno Larsen (billionai) init_proc_book3s_common(env); 63533e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 63543e770bf7SBruno Larsen (billionai) register_book3s_dbg_sprs(env); 63553e770bf7SBruno Larsen (billionai) 63563e770bf7SBruno Larsen (billionai) /* POWER5+ Specific Registers */ 63573e770bf7SBruno Larsen (billionai) register_970_hid_sprs(env); 63583e770bf7SBruno Larsen (billionai) register_970_hior_sprs(env); 63593e770bf7SBruno Larsen (billionai) register_low_BATs(env); 63603e770bf7SBruno Larsen (billionai) register_970_pmu_sup_sprs(env); 63613e770bf7SBruno Larsen (billionai) register_970_pmu_user_sprs(env); 63623e770bf7SBruno Larsen (billionai) register_power5p_common_sprs(env); 63633e770bf7SBruno Larsen (billionai) register_power5p_lpar_sprs(env); 63643e770bf7SBruno Larsen (billionai) register_power5p_ear_sprs(env); 63653e770bf7SBruno Larsen (billionai) register_power5p_tb_sprs(env); 63663e770bf7SBruno Larsen (billionai) 63673e770bf7SBruno Larsen (billionai) /* env variables */ 63683e770bf7SBruno Larsen (billionai) env->dcache_line_size = 128; 63693e770bf7SBruno Larsen (billionai) env->icache_line_size = 128; 63703e770bf7SBruno Larsen (billionai) 63713e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 63723e770bf7SBruno Larsen (billionai) init_excp_970(env); 63733e770bf7SBruno Larsen (billionai) ppc970_irq_init(env_archcpu(env)); 63743e770bf7SBruno Larsen (billionai) } 63753e770bf7SBruno Larsen (billionai) 63763e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data) 63773e770bf7SBruno Larsen (billionai) { 63783e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 63793e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 63803e770bf7SBruno Larsen (billionai) 63813e770bf7SBruno Larsen (billionai) dc->fw_name = "PowerPC,POWER5"; 63823e770bf7SBruno Larsen (billionai) dc->desc = "POWER5+"; 63833e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_power5plus; 63843e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_970; 63853e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | 63863e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 63873e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 63883e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 638991137619SCédric Le Goater PPC_FLOAT_EXT | 63903e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 63913e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 63923e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 63933e770bf7SBruno Larsen (billionai) PPC_64B | 639423ab6d88SCédric Le Goater PPC_POPCNTB | 63953e770bf7SBruno Larsen (billionai) PPC_SEGMENT_64B | PPC_SLBI; 63963e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_FP_CVT_S64; 63973e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_SF) | 63983e770bf7SBruno Larsen (billionai) (1ull << MSR_VR) | 63993e770bf7SBruno Larsen (billionai) (1ull << MSR_POW) | 64003e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 64013e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 64023e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 64033e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 64043e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 64053e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 64063e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 64073e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 64083e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 64093e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 64103e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 64113e770bf7SBruno Larsen (billionai) (1ull << MSR_RI); 64123e770bf7SBruno Larsen (billionai) pcc->lpcr_mask = LPCR_RMLS | LPCR_ILE | LPCR_LPES0 | LPCR_LPES1 | 64133e770bf7SBruno Larsen (billionai) LPCR_RMI | LPCR_HDICE; 64143e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_2_03; 64153e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU) 64163e770bf7SBruno Larsen (billionai) pcc->hash64_opts = &ppc_hash64_opts_basic; 64173e770bf7SBruno Larsen (billionai) pcc->lrg_decr_bits = 32; 64183e770bf7SBruno Larsen (billionai) #endif 64193e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_970; 64203e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_970; 64213e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc64; 64223e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 64233e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 64243e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK; 64253e770bf7SBruno Larsen (billionai) pcc->l1_dcache_size = 0x8000; 64263e770bf7SBruno Larsen (billionai) pcc->l1_icache_size = 0x10000; 64273e770bf7SBruno Larsen (billionai) } 64283e770bf7SBruno Larsen (billionai) 64293e770bf7SBruno Larsen (billionai) static void init_proc_POWER7(CPUPPCState *env) 64303e770bf7SBruno Larsen (billionai) { 64313e770bf7SBruno Larsen (billionai) /* Common Registers */ 64323e770bf7SBruno Larsen (billionai) init_proc_book3s_common(env); 64333e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 64343e770bf7SBruno Larsen (billionai) register_book3s_dbg_sprs(env); 64353e770bf7SBruno Larsen (billionai) 64363e770bf7SBruno Larsen (billionai) /* POWER7 Specific Registers */ 64373e770bf7SBruno Larsen (billionai) register_book3s_ids_sprs(env); 64383e770bf7SBruno Larsen (billionai) register_rmor_sprs(env); 64393e770bf7SBruno Larsen (billionai) register_amr_sprs(env); 64403e770bf7SBruno Larsen (billionai) register_book3s_purr_sprs(env); 64413e770bf7SBruno Larsen (billionai) register_power5p_common_sprs(env); 64423e770bf7SBruno Larsen (billionai) register_power5p_lpar_sprs(env); 64433e770bf7SBruno Larsen (billionai) register_power5p_ear_sprs(env); 64443e770bf7SBruno Larsen (billionai) register_power5p_tb_sprs(env); 64453e770bf7SBruno Larsen (billionai) register_power6_common_sprs(env); 64463e770bf7SBruno Larsen (billionai) register_power6_dbg_sprs(env); 64473e770bf7SBruno Larsen (billionai) register_power7_book4_sprs(env); 64483e770bf7SBruno Larsen (billionai) 64493e770bf7SBruno Larsen (billionai) /* env variables */ 64503e770bf7SBruno Larsen (billionai) env->dcache_line_size = 128; 64513e770bf7SBruno Larsen (billionai) env->icache_line_size = 128; 64523e770bf7SBruno Larsen (billionai) 64533e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 64543e770bf7SBruno Larsen (billionai) init_excp_POWER7(env); 64553e770bf7SBruno Larsen (billionai) ppcPOWER7_irq_init(env_archcpu(env)); 64563e770bf7SBruno Larsen (billionai) } 64573e770bf7SBruno Larsen (billionai) 64583e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_power7(PowerPCCPUClass *pcc, uint32_t pvr) 64593e770bf7SBruno Larsen (billionai) { 64603e770bf7SBruno Larsen (billionai) if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER7P_BASE) { 64613e770bf7SBruno Larsen (billionai) return true; 64623e770bf7SBruno Larsen (billionai) } 64633e770bf7SBruno Larsen (billionai) if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER7_BASE) { 64643e770bf7SBruno Larsen (billionai) return true; 64653e770bf7SBruno Larsen (billionai) } 64663e770bf7SBruno Larsen (billionai) return false; 64673e770bf7SBruno Larsen (billionai) } 64683e770bf7SBruno Larsen (billionai) 64693e770bf7SBruno Larsen (billionai) static bool cpu_has_work_POWER7(CPUState *cs) 64703e770bf7SBruno Larsen (billionai) { 64713e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 64723e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 64733e770bf7SBruno Larsen (billionai) 64743e770bf7SBruno Larsen (billionai) if (cs->halted) { 64753e770bf7SBruno Larsen (billionai) if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { 64763e770bf7SBruno Larsen (billionai) return false; 64773e770bf7SBruno Larsen (billionai) } 64783e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && 64793e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P7_PECE0)) { 64803e770bf7SBruno Larsen (billionai) return true; 64813e770bf7SBruno Larsen (billionai) } 64823e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) && 64833e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P7_PECE1)) { 64843e770bf7SBruno Larsen (billionai) return true; 64853e770bf7SBruno Larsen (billionai) } 64863e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK)) && 64873e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) { 64883e770bf7SBruno Larsen (billionai) return true; 64893e770bf7SBruno Larsen (billionai) } 64903e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HMI)) && 64913e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) { 64923e770bf7SBruno Larsen (billionai) return true; 64933e770bf7SBruno Larsen (billionai) } 64943e770bf7SBruno Larsen (billionai) if (env->pending_interrupts & (1u << PPC_INTERRUPT_RESET)) { 64953e770bf7SBruno Larsen (billionai) return true; 64963e770bf7SBruno Larsen (billionai) } 64973e770bf7SBruno Larsen (billionai) return false; 64983e770bf7SBruno Larsen (billionai) } else { 64993e770bf7SBruno Larsen (billionai) return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); 65003e770bf7SBruno Larsen (billionai) } 65013e770bf7SBruno Larsen (billionai) } 65023e770bf7SBruno Larsen (billionai) 65033e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) 65043e770bf7SBruno Larsen (billionai) { 65053e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 65063e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 65073e770bf7SBruno Larsen (billionai) CPUClass *cc = CPU_CLASS(oc); 65083e770bf7SBruno Larsen (billionai) 65093e770bf7SBruno Larsen (billionai) dc->fw_name = "PowerPC,POWER7"; 65103e770bf7SBruno Larsen (billionai) dc->desc = "POWER7"; 65113e770bf7SBruno Larsen (billionai) pcc->pvr_match = ppc_pvr_match_power7; 65123e770bf7SBruno Larsen (billionai) pcc->pcr_mask = PCR_VEC_DIS | PCR_VSX_DIS | PCR_COMPAT_2_05; 65133e770bf7SBruno Larsen (billionai) pcc->pcr_supported = PCR_COMPAT_2_06 | PCR_COMPAT_2_05; 65143e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_POWER7; 65153e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 65163e770bf7SBruno Larsen (billionai) cc->has_work = cpu_has_work_POWER7; 65173e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | 65183e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 65193e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 65203e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTES | 65213e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 65223e770bf7SBruno Larsen (billionai) PPC_FLOAT_EXT | 65233e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 65243e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 65253e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 65263e770bf7SBruno Larsen (billionai) PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC | 65273e770bf7SBruno Larsen (billionai) PPC_SEGMENT_64B | PPC_SLBI | 65283e770bf7SBruno Larsen (billionai) PPC_POPCNTB | PPC_POPCNTWD | 65293e770bf7SBruno Larsen (billionai) PPC_CILDST; 65303e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_VSX | PPC2_DFP | PPC2_DBRX | PPC2_ISA205 | 65313e770bf7SBruno Larsen (billionai) PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | 65323e770bf7SBruno Larsen (billionai) PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 | 65333e770bf7SBruno Larsen (billionai) PPC2_FP_TST_ISA206 | PPC2_FP_CVT_S64 | 65343e770bf7SBruno Larsen (billionai) PPC2_PM_ISA206; 65353e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_SF) | 65363e770bf7SBruno Larsen (billionai) (1ull << MSR_VR) | 65373e770bf7SBruno Larsen (billionai) (1ull << MSR_VSX) | 65383e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 65393e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 65403e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 65413e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 65423e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 65433e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 65443e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 65453e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 65463e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 65473e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 65483e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 65493e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 65503e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 65513e770bf7SBruno Larsen (billionai) pcc->lpcr_mask = LPCR_VPM0 | LPCR_VPM1 | LPCR_ISL | LPCR_DPFD | 65523e770bf7SBruno Larsen (billionai) LPCR_VRMASD | LPCR_RMLS | LPCR_ILE | 65533e770bf7SBruno Larsen (billionai) LPCR_P7_PECE0 | LPCR_P7_PECE1 | LPCR_P7_PECE2 | 65543e770bf7SBruno Larsen (billionai) LPCR_MER | LPCR_TC | 65553e770bf7SBruno Larsen (billionai) LPCR_LPES0 | LPCR_LPES1 | LPCR_HDICE; 65563e770bf7SBruno Larsen (billionai) pcc->lpcr_pm = LPCR_P7_PECE0 | LPCR_P7_PECE1 | LPCR_P7_PECE2; 65573e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_2_06; 65583e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU) 65593e770bf7SBruno Larsen (billionai) pcc->hash64_opts = &ppc_hash64_opts_POWER7; 65603e770bf7SBruno Larsen (billionai) pcc->lrg_decr_bits = 32; 65613e770bf7SBruno Larsen (billionai) #endif 65623e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_POWER7; 65633e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_POWER7; 65643e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc64; 65653e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 65663e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 65673e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR | 65683e770bf7SBruno Larsen (billionai) POWERPC_FLAG_VSX; 65693e770bf7SBruno Larsen (billionai) pcc->l1_dcache_size = 0x8000; 65703e770bf7SBruno Larsen (billionai) pcc->l1_icache_size = 0x8000; 65713e770bf7SBruno Larsen (billionai) } 65723e770bf7SBruno Larsen (billionai) 65733e770bf7SBruno Larsen (billionai) static void init_proc_POWER8(CPUPPCState *env) 65743e770bf7SBruno Larsen (billionai) { 65753e770bf7SBruno Larsen (billionai) /* Common Registers */ 65763e770bf7SBruno Larsen (billionai) init_proc_book3s_common(env); 65773e770bf7SBruno Larsen (billionai) register_sdr1_sprs(env); 65783e770bf7SBruno Larsen (billionai) register_book3s_207_dbg_sprs(env); 65793e770bf7SBruno Larsen (billionai) 65808f2e9d40SDaniel Henrique Barboza /* Common TCG PMU */ 65818f2e9d40SDaniel Henrique Barboza init_tcg_pmu_power8(env); 65828f2e9d40SDaniel Henrique Barboza 65833e770bf7SBruno Larsen (billionai) /* POWER8 Specific Registers */ 65843e770bf7SBruno Larsen (billionai) register_book3s_ids_sprs(env); 65853e770bf7SBruno Larsen (billionai) register_rmor_sprs(env); 65863e770bf7SBruno Larsen (billionai) register_amr_sprs(env); 65873e770bf7SBruno Larsen (billionai) register_iamr_sprs(env); 65883e770bf7SBruno Larsen (billionai) register_book3s_purr_sprs(env); 65893e770bf7SBruno Larsen (billionai) register_power5p_common_sprs(env); 65903e770bf7SBruno Larsen (billionai) register_power5p_lpar_sprs(env); 65913e770bf7SBruno Larsen (billionai) register_power5p_ear_sprs(env); 65923e770bf7SBruno Larsen (billionai) register_power5p_tb_sprs(env); 65933e770bf7SBruno Larsen (billionai) register_power6_common_sprs(env); 65943e770bf7SBruno Larsen (billionai) register_power6_dbg_sprs(env); 65953e770bf7SBruno Larsen (billionai) register_power8_tce_address_control_sprs(env); 65963e770bf7SBruno Larsen (billionai) register_power8_ids_sprs(env); 65973e770bf7SBruno Larsen (billionai) register_power8_ebb_sprs(env); 65983e770bf7SBruno Larsen (billionai) register_power8_fscr_sprs(env); 65993e770bf7SBruno Larsen (billionai) register_power8_pmu_sup_sprs(env); 66003e770bf7SBruno Larsen (billionai) register_power8_pmu_user_sprs(env); 66013e770bf7SBruno Larsen (billionai) register_power8_tm_sprs(env); 66023e770bf7SBruno Larsen (billionai) register_power8_pspb_sprs(env); 66033e770bf7SBruno Larsen (billionai) register_power8_dpdes_sprs(env); 66043e770bf7SBruno Larsen (billionai) register_vtb_sprs(env); 66053e770bf7SBruno Larsen (billionai) register_power8_ic_sprs(env); 66063e770bf7SBruno Larsen (billionai) register_power8_book4_sprs(env); 66073e770bf7SBruno Larsen (billionai) register_power8_rpr_sprs(env); 66083e770bf7SBruno Larsen (billionai) 66093e770bf7SBruno Larsen (billionai) /* env variables */ 66103e770bf7SBruno Larsen (billionai) env->dcache_line_size = 128; 66113e770bf7SBruno Larsen (billionai) env->icache_line_size = 128; 66123e770bf7SBruno Larsen (billionai) 66133e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 66143e770bf7SBruno Larsen (billionai) init_excp_POWER8(env); 66153e770bf7SBruno Larsen (billionai) ppcPOWER7_irq_init(env_archcpu(env)); 66163e770bf7SBruno Larsen (billionai) } 66173e770bf7SBruno Larsen (billionai) 66183e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_power8(PowerPCCPUClass *pcc, uint32_t pvr) 66193e770bf7SBruno Larsen (billionai) { 66203e770bf7SBruno Larsen (billionai) if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER8NVL_BASE) { 66213e770bf7SBruno Larsen (billionai) return true; 66223e770bf7SBruno Larsen (billionai) } 66233e770bf7SBruno Larsen (billionai) if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER8E_BASE) { 66243e770bf7SBruno Larsen (billionai) return true; 66253e770bf7SBruno Larsen (billionai) } 66263e770bf7SBruno Larsen (billionai) if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER8_BASE) { 66273e770bf7SBruno Larsen (billionai) return true; 66283e770bf7SBruno Larsen (billionai) } 66293e770bf7SBruno Larsen (billionai) return false; 66303e770bf7SBruno Larsen (billionai) } 66313e770bf7SBruno Larsen (billionai) 66323e770bf7SBruno Larsen (billionai) static bool cpu_has_work_POWER8(CPUState *cs) 66333e770bf7SBruno Larsen (billionai) { 66343e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 66353e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 66363e770bf7SBruno Larsen (billionai) 66373e770bf7SBruno Larsen (billionai) if (cs->halted) { 66383e770bf7SBruno Larsen (billionai) if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { 66393e770bf7SBruno Larsen (billionai) return false; 66403e770bf7SBruno Larsen (billionai) } 66413e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && 66423e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P8_PECE2)) { 66433e770bf7SBruno Larsen (billionai) return true; 66443e770bf7SBruno Larsen (billionai) } 66453e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) && 66463e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P8_PECE3)) { 66473e770bf7SBruno Larsen (billionai) return true; 66483e770bf7SBruno Larsen (billionai) } 66493e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK)) && 66503e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) { 66513e770bf7SBruno Larsen (billionai) return true; 66523e770bf7SBruno Larsen (billionai) } 66533e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HMI)) && 66543e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) { 66553e770bf7SBruno Larsen (billionai) return true; 66563e770bf7SBruno Larsen (billionai) } 66573e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DOORBELL)) && 66583e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P8_PECE0)) { 66593e770bf7SBruno Larsen (billionai) return true; 66603e770bf7SBruno Larsen (billionai) } 66613e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HDOORBELL)) && 66623e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_P8_PECE1)) { 66633e770bf7SBruno Larsen (billionai) return true; 66643e770bf7SBruno Larsen (billionai) } 66653e770bf7SBruno Larsen (billionai) if (env->pending_interrupts & (1u << PPC_INTERRUPT_RESET)) { 66663e770bf7SBruno Larsen (billionai) return true; 66673e770bf7SBruno Larsen (billionai) } 66683e770bf7SBruno Larsen (billionai) return false; 66693e770bf7SBruno Larsen (billionai) } else { 66703e770bf7SBruno Larsen (billionai) return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); 66713e770bf7SBruno Larsen (billionai) } 66723e770bf7SBruno Larsen (billionai) } 66733e770bf7SBruno Larsen (billionai) 66743e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) 66753e770bf7SBruno Larsen (billionai) { 66763e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 66773e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 66783e770bf7SBruno Larsen (billionai) CPUClass *cc = CPU_CLASS(oc); 66793e770bf7SBruno Larsen (billionai) 66803e770bf7SBruno Larsen (billionai) dc->fw_name = "PowerPC,POWER8"; 66813e770bf7SBruno Larsen (billionai) dc->desc = "POWER8"; 66823e770bf7SBruno Larsen (billionai) pcc->pvr_match = ppc_pvr_match_power8; 66833e770bf7SBruno Larsen (billionai) pcc->pcr_mask = PCR_TM_DIS | PCR_COMPAT_2_06 | PCR_COMPAT_2_05; 66843e770bf7SBruno Larsen (billionai) pcc->pcr_supported = PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05; 66853e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_POWER8; 66863e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 66873e770bf7SBruno Larsen (billionai) cc->has_work = cpu_has_work_POWER8; 66883e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | 66893e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 66903e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 66913e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTES | 66923e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 66933e770bf7SBruno Larsen (billionai) PPC_FLOAT_EXT | 66943e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 66953e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 66963e770bf7SBruno Larsen (billionai) PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | 66973e770bf7SBruno Larsen (billionai) PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC | 66983e770bf7SBruno Larsen (billionai) PPC_SEGMENT_64B | PPC_SLBI | 66993e770bf7SBruno Larsen (billionai) PPC_POPCNTB | PPC_POPCNTWD | 67003e770bf7SBruno Larsen (billionai) PPC_CILDST; 67013e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX | 67023e770bf7SBruno Larsen (billionai) PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | 67033e770bf7SBruno Larsen (billionai) PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 | 67043e770bf7SBruno Larsen (billionai) PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | 67053e770bf7SBruno Larsen (billionai) PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | 67063e770bf7SBruno Larsen (billionai) PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 | 67073e770bf7SBruno Larsen (billionai) PPC2_TM | PPC2_PM_ISA206; 67083e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_SF) | 67093e770bf7SBruno Larsen (billionai) (1ull << MSR_HV) | 67103e770bf7SBruno Larsen (billionai) (1ull << MSR_TM) | 67113e770bf7SBruno Larsen (billionai) (1ull << MSR_VR) | 67123e770bf7SBruno Larsen (billionai) (1ull << MSR_VSX) | 67133e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 67143e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 67153e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 67163e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 67173e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 67183e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 67193e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 67203e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 67213e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 67223e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 67233e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 67243e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 67253e770bf7SBruno Larsen (billionai) (1ull << MSR_TS0) | 67263e770bf7SBruno Larsen (billionai) (1ull << MSR_TS1) | 67273e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 67283e770bf7SBruno Larsen (billionai) pcc->lpcr_mask = LPCR_VPM0 | LPCR_VPM1 | LPCR_ISL | LPCR_KBV | 67293e770bf7SBruno Larsen (billionai) LPCR_DPFD | LPCR_VRMASD | LPCR_RMLS | LPCR_ILE | 67303e770bf7SBruno Larsen (billionai) LPCR_AIL | LPCR_ONL | LPCR_P8_PECE0 | LPCR_P8_PECE1 | 67313e770bf7SBruno Larsen (billionai) LPCR_P8_PECE2 | LPCR_P8_PECE3 | LPCR_P8_PECE4 | 67323e770bf7SBruno Larsen (billionai) LPCR_MER | LPCR_TC | LPCR_LPES0 | LPCR_HDICE; 67333e770bf7SBruno Larsen (billionai) pcc->lpcr_pm = LPCR_P8_PECE0 | LPCR_P8_PECE1 | LPCR_P8_PECE2 | 67343e770bf7SBruno Larsen (billionai) LPCR_P8_PECE3 | LPCR_P8_PECE4; 67353e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_2_07; 67363e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU) 67373e770bf7SBruno Larsen (billionai) pcc->hash64_opts = &ppc_hash64_opts_POWER7; 67383e770bf7SBruno Larsen (billionai) pcc->lrg_decr_bits = 32; 67393e770bf7SBruno Larsen (billionai) pcc->n_host_threads = 8; 67403e770bf7SBruno Larsen (billionai) #endif 67413e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_POWER8; 67423e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_POWER7; 67433e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc64; 67443e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 67453e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 67463e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR | 67473e770bf7SBruno Larsen (billionai) POWERPC_FLAG_VSX | POWERPC_FLAG_TM; 67483e770bf7SBruno Larsen (billionai) pcc->l1_dcache_size = 0x8000; 67493e770bf7SBruno Larsen (billionai) pcc->l1_icache_size = 0x8000; 67503e770bf7SBruno Larsen (billionai) } 67513e770bf7SBruno Larsen (billionai) 67523e770bf7SBruno Larsen (billionai) #ifdef CONFIG_SOFTMMU 67533e770bf7SBruno Larsen (billionai) /* 67543e770bf7SBruno Larsen (billionai) * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings 67553e770bf7SBruno Larsen (billionai) * Encoded as array of int_32s in the form: 67563e770bf7SBruno Larsen (billionai) * 0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 67573e770bf7SBruno Larsen (billionai) * x -> AP encoding 67583e770bf7SBruno Larsen (billionai) * y -> radix mode supported page size (encoded as a shift) 67593e770bf7SBruno Larsen (billionai) */ 67603e770bf7SBruno Larsen (billionai) static struct ppc_radix_page_info POWER9_radix_page_info = { 67613e770bf7SBruno Larsen (billionai) .count = 4, 67623e770bf7SBruno Larsen (billionai) .entries = { 67633e770bf7SBruno Larsen (billionai) 0x0000000c, /* 4K - enc: 0x0 */ 67643e770bf7SBruno Larsen (billionai) 0xa0000010, /* 64K - enc: 0x5 */ 67653e770bf7SBruno Larsen (billionai) 0x20000015, /* 2M - enc: 0x1 */ 67663e770bf7SBruno Larsen (billionai) 0x4000001e /* 1G - enc: 0x2 */ 67673e770bf7SBruno Larsen (billionai) } 67683e770bf7SBruno Larsen (billionai) }; 67693e770bf7SBruno Larsen (billionai) #endif /* CONFIG_SOFTMMU */ 67703e770bf7SBruno Larsen (billionai) 67713e770bf7SBruno Larsen (billionai) static void init_proc_POWER9(CPUPPCState *env) 67723e770bf7SBruno Larsen (billionai) { 67733e770bf7SBruno Larsen (billionai) /* Common Registers */ 67743e770bf7SBruno Larsen (billionai) init_proc_book3s_common(env); 67753e770bf7SBruno Larsen (billionai) register_book3s_207_dbg_sprs(env); 67763e770bf7SBruno Larsen (billionai) 67778f2e9d40SDaniel Henrique Barboza /* Common TCG PMU */ 67788f2e9d40SDaniel Henrique Barboza init_tcg_pmu_power8(env); 67798f2e9d40SDaniel Henrique Barboza 67803e770bf7SBruno Larsen (billionai) /* POWER8 Specific Registers */ 67813e770bf7SBruno Larsen (billionai) register_book3s_ids_sprs(env); 67823e770bf7SBruno Larsen (billionai) register_amr_sprs(env); 67833e770bf7SBruno Larsen (billionai) register_iamr_sprs(env); 67843e770bf7SBruno Larsen (billionai) register_book3s_purr_sprs(env); 67853e770bf7SBruno Larsen (billionai) register_power5p_common_sprs(env); 67863e770bf7SBruno Larsen (billionai) register_power5p_lpar_sprs(env); 67873e770bf7SBruno Larsen (billionai) register_power5p_ear_sprs(env); 67883e770bf7SBruno Larsen (billionai) register_power5p_tb_sprs(env); 67893e770bf7SBruno Larsen (billionai) register_power6_common_sprs(env); 67903e770bf7SBruno Larsen (billionai) register_power6_dbg_sprs(env); 67913e770bf7SBruno Larsen (billionai) register_power8_tce_address_control_sprs(env); 67923e770bf7SBruno Larsen (billionai) register_power8_ids_sprs(env); 67933e770bf7SBruno Larsen (billionai) register_power8_ebb_sprs(env); 67943e770bf7SBruno Larsen (billionai) register_power8_fscr_sprs(env); 67953e770bf7SBruno Larsen (billionai) register_power8_pmu_sup_sprs(env); 67963e770bf7SBruno Larsen (billionai) register_power8_pmu_user_sprs(env); 67973e770bf7SBruno Larsen (billionai) register_power8_tm_sprs(env); 67983e770bf7SBruno Larsen (billionai) register_power8_pspb_sprs(env); 67993e770bf7SBruno Larsen (billionai) register_power8_dpdes_sprs(env); 68003e770bf7SBruno Larsen (billionai) register_vtb_sprs(env); 68013e770bf7SBruno Larsen (billionai) register_power8_ic_sprs(env); 68023e770bf7SBruno Larsen (billionai) register_power8_book4_sprs(env); 68033e770bf7SBruno Larsen (billionai) register_power8_rpr_sprs(env); 68043e770bf7SBruno Larsen (billionai) register_power9_mmu_sprs(env); 68053e770bf7SBruno Larsen (billionai) 68063e770bf7SBruno Larsen (billionai) /* POWER9 Specific registers */ 68073e770bf7SBruno Larsen (billionai) spr_register_kvm(env, SPR_TIDR, "TIDR", NULL, NULL, 68083e770bf7SBruno Larsen (billionai) spr_read_generic, spr_write_generic, 68093e770bf7SBruno Larsen (billionai) KVM_REG_PPC_TIDR, 0); 68103e770bf7SBruno Larsen (billionai) 68113e770bf7SBruno Larsen (billionai) /* FIXME: Filter fields properly based on privilege level */ 68123e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL, 68133e770bf7SBruno Larsen (billionai) spr_read_generic, spr_write_generic, 68143e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PSSCR, 0); 68153e770bf7SBruno Larsen (billionai) 68163e770bf7SBruno Larsen (billionai) /* env variables */ 68173e770bf7SBruno Larsen (billionai) env->dcache_line_size = 128; 68183e770bf7SBruno Larsen (billionai) env->icache_line_size = 128; 68193e770bf7SBruno Larsen (billionai) 68203e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 68213e770bf7SBruno Larsen (billionai) init_excp_POWER9(env); 68223e770bf7SBruno Larsen (billionai) ppcPOWER9_irq_init(env_archcpu(env)); 68233e770bf7SBruno Larsen (billionai) } 68243e770bf7SBruno Larsen (billionai) 68253e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr) 68263e770bf7SBruno Larsen (billionai) { 68273e770bf7SBruno Larsen (billionai) if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER9_BASE) { 68283e770bf7SBruno Larsen (billionai) return true; 68293e770bf7SBruno Larsen (billionai) } 68303e770bf7SBruno Larsen (billionai) return false; 68313e770bf7SBruno Larsen (billionai) } 68323e770bf7SBruno Larsen (billionai) 68333e770bf7SBruno Larsen (billionai) static bool cpu_has_work_POWER9(CPUState *cs) 68343e770bf7SBruno Larsen (billionai) { 68353e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 68363e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 68373e770bf7SBruno Larsen (billionai) 68383e770bf7SBruno Larsen (billionai) if (cs->halted) { 68393e770bf7SBruno Larsen (billionai) uint64_t psscr = env->spr[SPR_PSSCR]; 68403e770bf7SBruno Larsen (billionai) 68413e770bf7SBruno Larsen (billionai) if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { 68423e770bf7SBruno Larsen (billionai) return false; 68433e770bf7SBruno Larsen (billionai) } 68443e770bf7SBruno Larsen (billionai) 68453e770bf7SBruno Larsen (billionai) /* If EC is clear, just return true on any pending interrupt */ 68463e770bf7SBruno Larsen (billionai) if (!(psscr & PSSCR_EC)) { 68473e770bf7SBruno Larsen (billionai) return true; 68483e770bf7SBruno Larsen (billionai) } 68493e770bf7SBruno Larsen (billionai) /* External Exception */ 68503e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && 68513e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_EEE)) { 68523e770bf7SBruno Larsen (billionai) bool heic = !!(env->spr[SPR_LPCR] & LPCR_HEIC); 68533e770bf7SBruno Larsen (billionai) if (heic == 0 || !msr_hv || msr_pr) { 68543e770bf7SBruno Larsen (billionai) return true; 68553e770bf7SBruno Larsen (billionai) } 68563e770bf7SBruno Larsen (billionai) } 68573e770bf7SBruno Larsen (billionai) /* Decrementer Exception */ 68583e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) && 68593e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_DEE)) { 68603e770bf7SBruno Larsen (billionai) return true; 68613e770bf7SBruno Larsen (billionai) } 68623e770bf7SBruno Larsen (billionai) /* Machine Check or Hypervisor Maintenance Exception */ 68633e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK | 68643e770bf7SBruno Larsen (billionai) 1u << PPC_INTERRUPT_HMI)) && (env->spr[SPR_LPCR] & LPCR_OEE)) { 68653e770bf7SBruno Larsen (billionai) return true; 68663e770bf7SBruno Larsen (billionai) } 68673e770bf7SBruno Larsen (billionai) /* Privileged Doorbell Exception */ 68683e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DOORBELL)) && 68693e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_PDEE)) { 68703e770bf7SBruno Larsen (billionai) return true; 68713e770bf7SBruno Larsen (billionai) } 68723e770bf7SBruno Larsen (billionai) /* Hypervisor Doorbell Exception */ 68733e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HDOORBELL)) && 68743e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_HDEE)) { 68753e770bf7SBruno Larsen (billionai) return true; 68763e770bf7SBruno Larsen (billionai) } 68773e770bf7SBruno Larsen (billionai) /* Hypervisor virtualization exception */ 68783e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HVIRT)) && 68793e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_HVEE)) { 68803e770bf7SBruno Larsen (billionai) return true; 68813e770bf7SBruno Larsen (billionai) } 68823e770bf7SBruno Larsen (billionai) if (env->pending_interrupts & (1u << PPC_INTERRUPT_RESET)) { 68833e770bf7SBruno Larsen (billionai) return true; 68843e770bf7SBruno Larsen (billionai) } 68853e770bf7SBruno Larsen (billionai) return false; 68863e770bf7SBruno Larsen (billionai) } else { 68873e770bf7SBruno Larsen (billionai) return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); 68883e770bf7SBruno Larsen (billionai) } 68893e770bf7SBruno Larsen (billionai) } 68903e770bf7SBruno Larsen (billionai) 68913e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) 68923e770bf7SBruno Larsen (billionai) { 68933e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 68943e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 68953e770bf7SBruno Larsen (billionai) CPUClass *cc = CPU_CLASS(oc); 68963e770bf7SBruno Larsen (billionai) 68973e770bf7SBruno Larsen (billionai) dc->fw_name = "PowerPC,POWER9"; 68983e770bf7SBruno Larsen (billionai) dc->desc = "POWER9"; 68993e770bf7SBruno Larsen (billionai) pcc->pvr_match = ppc_pvr_match_power9; 69003e770bf7SBruno Larsen (billionai) pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06 | PCR_COMPAT_2_07; 69013e770bf7SBruno Larsen (billionai) pcc->pcr_supported = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | 69023e770bf7SBruno Larsen (billionai) PCR_COMPAT_2_05; 69033e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_POWER9; 69043e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 69053e770bf7SBruno Larsen (billionai) cc->has_work = cpu_has_work_POWER9; 69063e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | 69073e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 69083e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 69093e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTES | 69103e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 69113e770bf7SBruno Larsen (billionai) PPC_FLOAT_EXT | 69123e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 69133e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 69143e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | 69153e770bf7SBruno Larsen (billionai) PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC | 69163e770bf7SBruno Larsen (billionai) PPC_SEGMENT_64B | PPC_SLBI | 69173e770bf7SBruno Larsen (billionai) PPC_POPCNTB | PPC_POPCNTWD | 69183e770bf7SBruno Larsen (billionai) PPC_CILDST; 69193e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX | 69203e770bf7SBruno Larsen (billionai) PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | 69213e770bf7SBruno Larsen (billionai) PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 | 69223e770bf7SBruno Larsen (billionai) PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | 69233e770bf7SBruno Larsen (billionai) PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | 69243e770bf7SBruno Larsen (billionai) PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 | 69253e770bf7SBruno Larsen (billionai) PPC2_TM | PPC2_ISA300 | PPC2_PRCNTL; 69263e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_SF) | 69273e770bf7SBruno Larsen (billionai) (1ull << MSR_HV) | 69283e770bf7SBruno Larsen (billionai) (1ull << MSR_TM) | 69293e770bf7SBruno Larsen (billionai) (1ull << MSR_VR) | 69303e770bf7SBruno Larsen (billionai) (1ull << MSR_VSX) | 69313e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 69323e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 69333e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 69343e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 69353e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 69363e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 69373e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 69383e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 69393e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 69403e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 69413e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 69423e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 69433e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 69443e770bf7SBruno Larsen (billionai) pcc->lpcr_mask = LPCR_VPM1 | LPCR_ISL | LPCR_KBV | LPCR_DPFD | 69453e770bf7SBruno Larsen (billionai) (LPCR_PECE_U_MASK & LPCR_HVEE) | LPCR_ILE | LPCR_AIL | 69463e770bf7SBruno Larsen (billionai) LPCR_UPRT | LPCR_EVIRT | LPCR_ONL | LPCR_HR | LPCR_LD | 69473e770bf7SBruno Larsen (billionai) (LPCR_PECE_L_MASK & (LPCR_PDEE | LPCR_HDEE | LPCR_EEE | 69483e770bf7SBruno Larsen (billionai) LPCR_DEE | LPCR_OEE)) 69493e770bf7SBruno Larsen (billionai) | LPCR_MER | LPCR_GTSE | LPCR_TC | 69503e770bf7SBruno Larsen (billionai) LPCR_HEIC | LPCR_LPES0 | LPCR_HVICE | LPCR_HDICE; 69513e770bf7SBruno Larsen (billionai) pcc->lpcr_pm = LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE | LPCR_OEE; 69523e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_3_00; 69533e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU) 69543e770bf7SBruno Larsen (billionai) /* segment page size remain the same */ 69553e770bf7SBruno Larsen (billionai) pcc->hash64_opts = &ppc_hash64_opts_POWER7; 69563e770bf7SBruno Larsen (billionai) pcc->radix_page_info = &POWER9_radix_page_info; 69573e770bf7SBruno Larsen (billionai) pcc->lrg_decr_bits = 56; 69583e770bf7SBruno Larsen (billionai) pcc->n_host_threads = 4; 69593e770bf7SBruno Larsen (billionai) #endif 69603e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_POWER9; 69613e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_POWER9; 69623e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc64; 69633e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 69643e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 69653e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR | 69663e770bf7SBruno Larsen (billionai) POWERPC_FLAG_VSX | POWERPC_FLAG_TM | POWERPC_FLAG_SCV; 69673e770bf7SBruno Larsen (billionai) pcc->l1_dcache_size = 0x8000; 69683e770bf7SBruno Larsen (billionai) pcc->l1_icache_size = 0x8000; 69693e770bf7SBruno Larsen (billionai) } 69703e770bf7SBruno Larsen (billionai) 69713e770bf7SBruno Larsen (billionai) #ifdef CONFIG_SOFTMMU 69723e770bf7SBruno Larsen (billionai) /* 69733e770bf7SBruno Larsen (billionai) * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings 69743e770bf7SBruno Larsen (billionai) * Encoded as array of int_32s in the form: 69753e770bf7SBruno Larsen (billionai) * 0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 69763e770bf7SBruno Larsen (billionai) * x -> AP encoding 69773e770bf7SBruno Larsen (billionai) * y -> radix mode supported page size (encoded as a shift) 69783e770bf7SBruno Larsen (billionai) */ 69793e770bf7SBruno Larsen (billionai) static struct ppc_radix_page_info POWER10_radix_page_info = { 69803e770bf7SBruno Larsen (billionai) .count = 4, 69813e770bf7SBruno Larsen (billionai) .entries = { 69823e770bf7SBruno Larsen (billionai) 0x0000000c, /* 4K - enc: 0x0 */ 69833e770bf7SBruno Larsen (billionai) 0xa0000010, /* 64K - enc: 0x5 */ 69843e770bf7SBruno Larsen (billionai) 0x20000015, /* 2M - enc: 0x1 */ 69853e770bf7SBruno Larsen (billionai) 0x4000001e /* 1G - enc: 0x2 */ 69863e770bf7SBruno Larsen (billionai) } 69873e770bf7SBruno Larsen (billionai) }; 69883e770bf7SBruno Larsen (billionai) #endif /* CONFIG_SOFTMMU */ 69893e770bf7SBruno Larsen (billionai) 69903e770bf7SBruno Larsen (billionai) static void init_proc_POWER10(CPUPPCState *env) 69913e770bf7SBruno Larsen (billionai) { 69923e770bf7SBruno Larsen (billionai) /* Common Registers */ 69933e770bf7SBruno Larsen (billionai) init_proc_book3s_common(env); 69943e770bf7SBruno Larsen (billionai) register_book3s_207_dbg_sprs(env); 69953e770bf7SBruno Larsen (billionai) 69968f2e9d40SDaniel Henrique Barboza /* Common TCG PMU */ 69978f2e9d40SDaniel Henrique Barboza init_tcg_pmu_power8(env); 69988f2e9d40SDaniel Henrique Barboza 69993e770bf7SBruno Larsen (billionai) /* POWER8 Specific Registers */ 70003e770bf7SBruno Larsen (billionai) register_book3s_ids_sprs(env); 70013e770bf7SBruno Larsen (billionai) register_amr_sprs(env); 70023e770bf7SBruno Larsen (billionai) register_iamr_sprs(env); 70033e770bf7SBruno Larsen (billionai) register_book3s_purr_sprs(env); 70043e770bf7SBruno Larsen (billionai) register_power5p_common_sprs(env); 70053e770bf7SBruno Larsen (billionai) register_power5p_lpar_sprs(env); 70063e770bf7SBruno Larsen (billionai) register_power5p_ear_sprs(env); 70073e770bf7SBruno Larsen (billionai) register_power6_common_sprs(env); 70083e770bf7SBruno Larsen (billionai) register_power6_dbg_sprs(env); 70093e770bf7SBruno Larsen (billionai) register_power8_tce_address_control_sprs(env); 70103e770bf7SBruno Larsen (billionai) register_power8_ids_sprs(env); 70113e770bf7SBruno Larsen (billionai) register_power8_ebb_sprs(env); 70123e770bf7SBruno Larsen (billionai) register_power8_fscr_sprs(env); 70133e770bf7SBruno Larsen (billionai) register_power8_pmu_sup_sprs(env); 70143e770bf7SBruno Larsen (billionai) register_power8_pmu_user_sprs(env); 70153e770bf7SBruno Larsen (billionai) register_power8_tm_sprs(env); 70163e770bf7SBruno Larsen (billionai) register_power8_pspb_sprs(env); 70173e770bf7SBruno Larsen (billionai) register_vtb_sprs(env); 70183e770bf7SBruno Larsen (billionai) register_power8_ic_sprs(env); 70193e770bf7SBruno Larsen (billionai) register_power8_book4_sprs(env); 70203e770bf7SBruno Larsen (billionai) register_power8_rpr_sprs(env); 70213e770bf7SBruno Larsen (billionai) register_power9_mmu_sprs(env); 70223e770bf7SBruno Larsen (billionai) 70233e770bf7SBruno Larsen (billionai) /* FIXME: Filter fields properly based on privilege level */ 70243e770bf7SBruno Larsen (billionai) spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL, 70253e770bf7SBruno Larsen (billionai) spr_read_generic, spr_write_generic, 70263e770bf7SBruno Larsen (billionai) KVM_REG_PPC_PSSCR, 0); 70273e770bf7SBruno Larsen (billionai) 70283e770bf7SBruno Larsen (billionai) /* env variables */ 70293e770bf7SBruno Larsen (billionai) env->dcache_line_size = 128; 70303e770bf7SBruno Larsen (billionai) env->icache_line_size = 128; 70313e770bf7SBruno Larsen (billionai) 70323e770bf7SBruno Larsen (billionai) /* Allocate hardware IRQ controller */ 70333e770bf7SBruno Larsen (billionai) init_excp_POWER10(env); 70343e770bf7SBruno Larsen (billionai) ppcPOWER9_irq_init(env_archcpu(env)); 70353e770bf7SBruno Larsen (billionai) } 70363e770bf7SBruno Larsen (billionai) 70373e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_power10(PowerPCCPUClass *pcc, uint32_t pvr) 70383e770bf7SBruno Larsen (billionai) { 70393e770bf7SBruno Larsen (billionai) if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER10_BASE) { 70403e770bf7SBruno Larsen (billionai) return true; 70413e770bf7SBruno Larsen (billionai) } 70423e770bf7SBruno Larsen (billionai) return false; 70433e770bf7SBruno Larsen (billionai) } 70443e770bf7SBruno Larsen (billionai) 70453e770bf7SBruno Larsen (billionai) static bool cpu_has_work_POWER10(CPUState *cs) 70463e770bf7SBruno Larsen (billionai) { 70473e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 70483e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 70493e770bf7SBruno Larsen (billionai) 70503e770bf7SBruno Larsen (billionai) if (cs->halted) { 70513e770bf7SBruno Larsen (billionai) uint64_t psscr = env->spr[SPR_PSSCR]; 70523e770bf7SBruno Larsen (billionai) 70533e770bf7SBruno Larsen (billionai) if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { 70543e770bf7SBruno Larsen (billionai) return false; 70553e770bf7SBruno Larsen (billionai) } 70563e770bf7SBruno Larsen (billionai) 70573e770bf7SBruno Larsen (billionai) /* If EC is clear, just return true on any pending interrupt */ 70583e770bf7SBruno Larsen (billionai) if (!(psscr & PSSCR_EC)) { 70593e770bf7SBruno Larsen (billionai) return true; 70603e770bf7SBruno Larsen (billionai) } 70613e770bf7SBruno Larsen (billionai) /* External Exception */ 70623e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && 70633e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_EEE)) { 70643e770bf7SBruno Larsen (billionai) bool heic = !!(env->spr[SPR_LPCR] & LPCR_HEIC); 70653e770bf7SBruno Larsen (billionai) if (heic == 0 || !msr_hv || msr_pr) { 70663e770bf7SBruno Larsen (billionai) return true; 70673e770bf7SBruno Larsen (billionai) } 70683e770bf7SBruno Larsen (billionai) } 70693e770bf7SBruno Larsen (billionai) /* Decrementer Exception */ 70703e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) && 70713e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_DEE)) { 70723e770bf7SBruno Larsen (billionai) return true; 70733e770bf7SBruno Larsen (billionai) } 70743e770bf7SBruno Larsen (billionai) /* Machine Check or Hypervisor Maintenance Exception */ 70753e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK | 70763e770bf7SBruno Larsen (billionai) 1u << PPC_INTERRUPT_HMI)) && (env->spr[SPR_LPCR] & LPCR_OEE)) { 70773e770bf7SBruno Larsen (billionai) return true; 70783e770bf7SBruno Larsen (billionai) } 70793e770bf7SBruno Larsen (billionai) /* Privileged Doorbell Exception */ 70803e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DOORBELL)) && 70813e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_PDEE)) { 70823e770bf7SBruno Larsen (billionai) return true; 70833e770bf7SBruno Larsen (billionai) } 70843e770bf7SBruno Larsen (billionai) /* Hypervisor Doorbell Exception */ 70853e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HDOORBELL)) && 70863e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_HDEE)) { 70873e770bf7SBruno Larsen (billionai) return true; 70883e770bf7SBruno Larsen (billionai) } 70893e770bf7SBruno Larsen (billionai) /* Hypervisor virtualization exception */ 70903e770bf7SBruno Larsen (billionai) if ((env->pending_interrupts & (1u << PPC_INTERRUPT_HVIRT)) && 70913e770bf7SBruno Larsen (billionai) (env->spr[SPR_LPCR] & LPCR_HVEE)) { 70923e770bf7SBruno Larsen (billionai) return true; 70933e770bf7SBruno Larsen (billionai) } 70943e770bf7SBruno Larsen (billionai) if (env->pending_interrupts & (1u << PPC_INTERRUPT_RESET)) { 70953e770bf7SBruno Larsen (billionai) return true; 70963e770bf7SBruno Larsen (billionai) } 70973e770bf7SBruno Larsen (billionai) return false; 70983e770bf7SBruno Larsen (billionai) } else { 70993e770bf7SBruno Larsen (billionai) return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); 71003e770bf7SBruno Larsen (billionai) } 71013e770bf7SBruno Larsen (billionai) } 71023e770bf7SBruno Larsen (billionai) 71033e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) 71043e770bf7SBruno Larsen (billionai) { 71053e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 71063e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 71073e770bf7SBruno Larsen (billionai) CPUClass *cc = CPU_CLASS(oc); 71083e770bf7SBruno Larsen (billionai) 71093e770bf7SBruno Larsen (billionai) dc->fw_name = "PowerPC,POWER10"; 71103e770bf7SBruno Larsen (billionai) dc->desc = "POWER10"; 71113e770bf7SBruno Larsen (billionai) pcc->pvr_match = ppc_pvr_match_power10; 71123e770bf7SBruno Larsen (billionai) pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06 | PCR_COMPAT_2_07 | 71133e770bf7SBruno Larsen (billionai) PCR_COMPAT_3_00; 71143e770bf7SBruno Larsen (billionai) pcc->pcr_supported = PCR_COMPAT_3_10 | PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | 71153e770bf7SBruno Larsen (billionai) PCR_COMPAT_2_06 | PCR_COMPAT_2_05; 71163e770bf7SBruno Larsen (billionai) pcc->init_proc = init_proc_POWER10; 71173e770bf7SBruno Larsen (billionai) pcc->check_pow = check_pow_nocheck; 71183e770bf7SBruno Larsen (billionai) cc->has_work = cpu_has_work_POWER10; 71193e770bf7SBruno Larsen (billionai) pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | 71203e770bf7SBruno Larsen (billionai) PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | 71213e770bf7SBruno Larsen (billionai) PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | 71223e770bf7SBruno Larsen (billionai) PPC_FLOAT_FRSQRTES | 71233e770bf7SBruno Larsen (billionai) PPC_FLOAT_STFIWX | 71243e770bf7SBruno Larsen (billionai) PPC_FLOAT_EXT | 71253e770bf7SBruno Larsen (billionai) PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | 71263e770bf7SBruno Larsen (billionai) PPC_MEM_SYNC | PPC_MEM_EIEIO | 71273e770bf7SBruno Larsen (billionai) PPC_MEM_TLBSYNC | 71283e770bf7SBruno Larsen (billionai) PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC | 71293e770bf7SBruno Larsen (billionai) PPC_SEGMENT_64B | PPC_SLBI | 71303e770bf7SBruno Larsen (billionai) PPC_POPCNTB | PPC_POPCNTWD | 71313e770bf7SBruno Larsen (billionai) PPC_CILDST; 71323e770bf7SBruno Larsen (billionai) pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX | 71333e770bf7SBruno Larsen (billionai) PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | 71343e770bf7SBruno Larsen (billionai) PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 | 71353e770bf7SBruno Larsen (billionai) PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | 71363e770bf7SBruno Larsen (billionai) PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | 71373e770bf7SBruno Larsen (billionai) PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 | 71383e770bf7SBruno Larsen (billionai) PPC2_TM | PPC2_ISA300 | PPC2_PRCNTL | PPC2_ISA310; 71393e770bf7SBruno Larsen (billionai) pcc->msr_mask = (1ull << MSR_SF) | 71403e770bf7SBruno Larsen (billionai) (1ull << MSR_HV) | 71413e770bf7SBruno Larsen (billionai) (1ull << MSR_TM) | 71423e770bf7SBruno Larsen (billionai) (1ull << MSR_VR) | 71433e770bf7SBruno Larsen (billionai) (1ull << MSR_VSX) | 71443e770bf7SBruno Larsen (billionai) (1ull << MSR_EE) | 71453e770bf7SBruno Larsen (billionai) (1ull << MSR_PR) | 71463e770bf7SBruno Larsen (billionai) (1ull << MSR_FP) | 71473e770bf7SBruno Larsen (billionai) (1ull << MSR_ME) | 71483e770bf7SBruno Larsen (billionai) (1ull << MSR_FE0) | 71493e770bf7SBruno Larsen (billionai) (1ull << MSR_SE) | 71503e770bf7SBruno Larsen (billionai) (1ull << MSR_DE) | 71513e770bf7SBruno Larsen (billionai) (1ull << MSR_FE1) | 71523e770bf7SBruno Larsen (billionai) (1ull << MSR_IR) | 71533e770bf7SBruno Larsen (billionai) (1ull << MSR_DR) | 71543e770bf7SBruno Larsen (billionai) (1ull << MSR_PMM) | 71553e770bf7SBruno Larsen (billionai) (1ull << MSR_RI) | 71563e770bf7SBruno Larsen (billionai) (1ull << MSR_LE); 71573e770bf7SBruno Larsen (billionai) pcc->lpcr_mask = LPCR_VPM1 | LPCR_ISL | LPCR_KBV | LPCR_DPFD | 71583e770bf7SBruno Larsen (billionai) (LPCR_PECE_U_MASK & LPCR_HVEE) | LPCR_ILE | LPCR_AIL | 71593e770bf7SBruno Larsen (billionai) LPCR_UPRT | LPCR_EVIRT | LPCR_ONL | LPCR_HR | LPCR_LD | 71603e770bf7SBruno Larsen (billionai) (LPCR_PECE_L_MASK & (LPCR_PDEE | LPCR_HDEE | LPCR_EEE | 71613e770bf7SBruno Larsen (billionai) LPCR_DEE | LPCR_OEE)) 71623e770bf7SBruno Larsen (billionai) | LPCR_MER | LPCR_GTSE | LPCR_TC | 71633e770bf7SBruno Larsen (billionai) LPCR_HEIC | LPCR_LPES0 | LPCR_HVICE | LPCR_HDICE; 7164363fd548SCédric Le Goater /* DD2 adds an extra HAIL bit */ 7165363fd548SCédric Le Goater pcc->lpcr_mask |= LPCR_HAIL; 7166363fd548SCédric Le Goater 71673e770bf7SBruno Larsen (billionai) pcc->lpcr_pm = LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE | LPCR_OEE; 71683e770bf7SBruno Larsen (billionai) pcc->mmu_model = POWERPC_MMU_3_00; 71693e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU) 71703e770bf7SBruno Larsen (billionai) /* segment page size remain the same */ 71713e770bf7SBruno Larsen (billionai) pcc->hash64_opts = &ppc_hash64_opts_POWER7; 71723e770bf7SBruno Larsen (billionai) pcc->radix_page_info = &POWER10_radix_page_info; 71733e770bf7SBruno Larsen (billionai) pcc->lrg_decr_bits = 56; 71743e770bf7SBruno Larsen (billionai) #endif 71753e770bf7SBruno Larsen (billionai) pcc->excp_model = POWERPC_EXCP_POWER10; 71763e770bf7SBruno Larsen (billionai) pcc->bus_model = PPC_FLAGS_INPUT_POWER9; 71773e770bf7SBruno Larsen (billionai) pcc->bfd_mach = bfd_mach_ppc64; 71783e770bf7SBruno Larsen (billionai) pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | 71793e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BE | POWERPC_FLAG_PMM | 71803e770bf7SBruno Larsen (billionai) POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR | 71813e770bf7SBruno Larsen (billionai) POWERPC_FLAG_VSX | POWERPC_FLAG_TM | POWERPC_FLAG_SCV; 71823e770bf7SBruno Larsen (billionai) pcc->l1_dcache_size = 0x8000; 71833e770bf7SBruno Larsen (billionai) pcc->l1_icache_size = 0x8000; 71843e770bf7SBruno Larsen (billionai) } 71853e770bf7SBruno Larsen (billionai) 71863e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 71873e770bf7SBruno Larsen (billionai) void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp) 71883e770bf7SBruno Larsen (billionai) { 71893e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 71903e770bf7SBruno Larsen (billionai) 71913e770bf7SBruno Larsen (billionai) cpu->vhyp = vhyp; 71923e770bf7SBruno Larsen (billionai) 71933e770bf7SBruno Larsen (billionai) /* 71943e770bf7SBruno Larsen (billionai) * With a virtual hypervisor mode we never allow the CPU to go 71953e770bf7SBruno Larsen (billionai) * hypervisor mode itself 71963e770bf7SBruno Larsen (billionai) */ 71973e770bf7SBruno Larsen (billionai) env->msr_mask &= ~MSR_HVB; 71983e770bf7SBruno Larsen (billionai) } 71993e770bf7SBruno Larsen (billionai) 72003e770bf7SBruno Larsen (billionai) #endif /* !defined(CONFIG_USER_ONLY) */ 72013e770bf7SBruno Larsen (billionai) 72023e770bf7SBruno Larsen (billionai) #endif /* defined(TARGET_PPC64) */ 72033e770bf7SBruno Larsen (billionai) 72043e770bf7SBruno Larsen (billionai) /*****************************************************************************/ 72053e770bf7SBruno Larsen (billionai) /* Generic CPU instantiation routine */ 72063e770bf7SBruno Larsen (billionai) static void init_ppc_proc(PowerPCCPU *cpu) 72073e770bf7SBruno Larsen (billionai) { 72083e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); 72093e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 72103e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 72113e770bf7SBruno Larsen (billionai) int i; 72123e770bf7SBruno Larsen (billionai) 72133e770bf7SBruno Larsen (billionai) env->irq_inputs = NULL; 72143e770bf7SBruno Larsen (billionai) /* Set all exception vectors to an invalid address */ 72153e770bf7SBruno Larsen (billionai) for (i = 0; i < POWERPC_EXCP_NB; i++) { 72163e770bf7SBruno Larsen (billionai) env->excp_vectors[i] = (target_ulong)(-1ULL); 72173e770bf7SBruno Larsen (billionai) } 72183e770bf7SBruno Larsen (billionai) env->ivor_mask = 0x00000000; 72193e770bf7SBruno Larsen (billionai) env->ivpr_mask = 0x00000000; 72203e770bf7SBruno Larsen (billionai) /* Default MMU definitions */ 72213e770bf7SBruno Larsen (billionai) env->nb_BATs = 0; 72223e770bf7SBruno Larsen (billionai) env->nb_tlb = 0; 72233e770bf7SBruno Larsen (billionai) env->nb_ways = 0; 72243e770bf7SBruno Larsen (billionai) env->tlb_type = TLB_NONE; 72253e770bf7SBruno Larsen (billionai) #endif 72263e770bf7SBruno Larsen (billionai) /* Register SPR common to all PowerPC implementations */ 7227e78280a2SFabiano Rosas register_generic_sprs(cpu); 7228e78280a2SFabiano Rosas 72293e770bf7SBruno Larsen (billionai) /* PowerPC implementation specific initialisations (SPRs, timers, ...) */ 72303e770bf7SBruno Larsen (billionai) (*pcc->init_proc)(env); 72313e770bf7SBruno Larsen (billionai) 72323e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 72333e770bf7SBruno Larsen (billionai) ppc_gdb_gen_spr_xml(cpu); 72343e770bf7SBruno Larsen (billionai) #endif 72353e770bf7SBruno Larsen (billionai) 72363e770bf7SBruno Larsen (billionai) /* MSR bits & flags consistency checks */ 72373e770bf7SBruno Larsen (billionai) if (env->msr_mask & (1 << 25)) { 72383e770bf7SBruno Larsen (billionai) switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { 72393e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_SPE: 72403e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_VRE: 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_SPE or POWERPC_FLAG_VRE\n"); 72453e770bf7SBruno Larsen (billionai) exit(1); 72463e770bf7SBruno Larsen (billionai) } 72473e770bf7SBruno Larsen (billionai) } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { 72483e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC MSR definition inconsistency\n" 72493e770bf7SBruno Larsen (billionai) "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n"); 72503e770bf7SBruno Larsen (billionai) exit(1); 72513e770bf7SBruno Larsen (billionai) } 72523e770bf7SBruno Larsen (billionai) if (env->msr_mask & (1 << 17)) { 72533e770bf7SBruno Larsen (billionai) switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { 72543e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_TGPR: 72553e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_CE: 72563e770bf7SBruno Larsen (billionai) break; 72573e770bf7SBruno Larsen (billionai) default: 72583e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC MSR definition inconsistency\n" 72593e770bf7SBruno Larsen (billionai) "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n"); 72603e770bf7SBruno Larsen (billionai) exit(1); 72613e770bf7SBruno Larsen (billionai) } 72623e770bf7SBruno Larsen (billionai) } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) { 72633e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC MSR definition inconsistency\n" 72643e770bf7SBruno Larsen (billionai) "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n"); 72653e770bf7SBruno Larsen (billionai) exit(1); 72663e770bf7SBruno Larsen (billionai) } 72673e770bf7SBruno Larsen (billionai) if (env->msr_mask & (1 << 10)) { 72683e770bf7SBruno Larsen (billionai) switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | 72693e770bf7SBruno Larsen (billionai) POWERPC_FLAG_UBLE)) { 72703e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_SE: 72713e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_DWE: 72723e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_UBLE: 72733e770bf7SBruno Larsen (billionai) break; 72743e770bf7SBruno Larsen (billionai) default: 72753e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC MSR definition inconsistency\n" 72763e770bf7SBruno Larsen (billionai) "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or " 72773e770bf7SBruno Larsen (billionai) "POWERPC_FLAG_UBLE\n"); 72783e770bf7SBruno Larsen (billionai) exit(1); 72793e770bf7SBruno Larsen (billionai) } 72803e770bf7SBruno Larsen (billionai) } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE | 72813e770bf7SBruno Larsen (billionai) POWERPC_FLAG_UBLE)) { 72823e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC MSR definition inconsistency\n" 72833e770bf7SBruno Larsen (billionai) "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor " 72843e770bf7SBruno Larsen (billionai) "POWERPC_FLAG_UBLE\n"); 72853e770bf7SBruno Larsen (billionai) exit(1); 72863e770bf7SBruno Larsen (billionai) } 72873e770bf7SBruno Larsen (billionai) if (env->msr_mask & (1 << 9)) { 72883e770bf7SBruno Larsen (billionai) switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { 72893e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_BE: 72903e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_DE: 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_BE or POWERPC_FLAG_DE\n"); 72953e770bf7SBruno Larsen (billionai) exit(1); 72963e770bf7SBruno Larsen (billionai) } 72973e770bf7SBruno Larsen (billionai) } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) { 72983e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC MSR definition inconsistency\n" 72993e770bf7SBruno Larsen (billionai) "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n"); 73003e770bf7SBruno Larsen (billionai) exit(1); 73013e770bf7SBruno Larsen (billionai) } 73023e770bf7SBruno Larsen (billionai) if (env->msr_mask & (1 << 2)) { 73033e770bf7SBruno Larsen (billionai) switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { 73043e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_PX: 73053e770bf7SBruno Larsen (billionai) case POWERPC_FLAG_PMM: 73063e770bf7SBruno Larsen (billionai) break; 73073e770bf7SBruno Larsen (billionai) default: 73083e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC MSR definition inconsistency\n" 73093e770bf7SBruno Larsen (billionai) "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n"); 73103e770bf7SBruno Larsen (billionai) exit(1); 73113e770bf7SBruno Larsen (billionai) } 73123e770bf7SBruno Larsen (billionai) } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) { 73133e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC MSR definition inconsistency\n" 73143e770bf7SBruno Larsen (billionai) "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n"); 73153e770bf7SBruno Larsen (billionai) exit(1); 73163e770bf7SBruno Larsen (billionai) } 7317005b69fdSCédric Le Goater if ((env->flags & POWERPC_FLAG_BUS_CLK) == 0) { 73183e770bf7SBruno Larsen (billionai) fprintf(stderr, "PowerPC flags inconsistency\n" 73193e770bf7SBruno Larsen (billionai) "Should define the time-base and decrementer clock source\n"); 73203e770bf7SBruno Larsen (billionai) exit(1); 73213e770bf7SBruno Larsen (billionai) } 73223e770bf7SBruno Larsen (billionai) /* Allocate TLBs buffer when needed */ 73233e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 73243e770bf7SBruno Larsen (billionai) if (env->nb_tlb != 0) { 73253e770bf7SBruno Larsen (billionai) int nb_tlb = env->nb_tlb; 73263e770bf7SBruno Larsen (billionai) if (env->id_tlbs != 0) { 73273e770bf7SBruno Larsen (billionai) nb_tlb *= 2; 73283e770bf7SBruno Larsen (billionai) } 73293e770bf7SBruno Larsen (billionai) switch (env->tlb_type) { 73303e770bf7SBruno Larsen (billionai) case TLB_6XX: 73313e770bf7SBruno Larsen (billionai) env->tlb.tlb6 = g_new0(ppc6xx_tlb_t, nb_tlb); 73323e770bf7SBruno Larsen (billionai) break; 73333e770bf7SBruno Larsen (billionai) case TLB_EMB: 73343e770bf7SBruno Larsen (billionai) env->tlb.tlbe = g_new0(ppcemb_tlb_t, nb_tlb); 73353e770bf7SBruno Larsen (billionai) break; 73363e770bf7SBruno Larsen (billionai) case TLB_MAS: 73373e770bf7SBruno Larsen (billionai) env->tlb.tlbm = g_new0(ppcmas_tlb_t, nb_tlb); 73383e770bf7SBruno Larsen (billionai) break; 73393e770bf7SBruno Larsen (billionai) } 73403e770bf7SBruno Larsen (billionai) /* Pre-compute some useful values */ 73413e770bf7SBruno Larsen (billionai) env->tlb_per_way = env->nb_tlb / env->nb_ways; 73423e770bf7SBruno Larsen (billionai) } 73433e770bf7SBruno Larsen (billionai) if (env->irq_inputs == NULL) { 73443e770bf7SBruno Larsen (billionai) warn_report("no internal IRQ controller registered." 73453e770bf7SBruno Larsen (billionai) " Attempt QEMU to crash very soon !"); 73463e770bf7SBruno Larsen (billionai) } 73473e770bf7SBruno Larsen (billionai) #endif 73483e770bf7SBruno Larsen (billionai) if (env->check_pow == NULL) { 73493e770bf7SBruno Larsen (billionai) warn_report("no power management check handler registered." 73503e770bf7SBruno Larsen (billionai) " Attempt QEMU to crash very soon !"); 73513e770bf7SBruno Larsen (billionai) } 73523e770bf7SBruno Larsen (billionai) } 73533e770bf7SBruno Larsen (billionai) 73543e770bf7SBruno Larsen (billionai) 73553e770bf7SBruno Larsen (billionai) static void ppc_cpu_realize(DeviceState *dev, Error **errp) 73563e770bf7SBruno Larsen (billionai) { 73573e770bf7SBruno Larsen (billionai) CPUState *cs = CPU(dev); 73583e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(dev); 73593e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); 73603e770bf7SBruno Larsen (billionai) Error *local_err = NULL; 73613e770bf7SBruno Larsen (billionai) 73623e770bf7SBruno Larsen (billionai) cpu_exec_realizefn(cs, &local_err); 73633e770bf7SBruno Larsen (billionai) if (local_err != NULL) { 73643e770bf7SBruno Larsen (billionai) error_propagate(errp, local_err); 73653e770bf7SBruno Larsen (billionai) return; 73663e770bf7SBruno Larsen (billionai) } 73673e770bf7SBruno Larsen (billionai) if (cpu->vcpu_id == UNASSIGNED_CPU_INDEX) { 73683e770bf7SBruno Larsen (billionai) cpu->vcpu_id = cs->cpu_index; 73693e770bf7SBruno Larsen (billionai) } 73703e770bf7SBruno Larsen (billionai) 73713e770bf7SBruno Larsen (billionai) if (tcg_enabled()) { 73723e770bf7SBruno Larsen (billionai) if (ppc_fixup_cpu(cpu) != 0) { 73733e770bf7SBruno Larsen (billionai) error_setg(errp, "Unable to emulate selected CPU with TCG"); 73743e770bf7SBruno Larsen (billionai) goto unrealize; 73753e770bf7SBruno Larsen (billionai) } 73763e770bf7SBruno Larsen (billionai) } 73773e770bf7SBruno Larsen (billionai) 73783e770bf7SBruno Larsen (billionai) create_ppc_opcodes(cpu, &local_err); 73793e770bf7SBruno Larsen (billionai) if (local_err != NULL) { 73803e770bf7SBruno Larsen (billionai) error_propagate(errp, local_err); 73813e770bf7SBruno Larsen (billionai) goto unrealize; 73823e770bf7SBruno Larsen (billionai) } 73833e770bf7SBruno Larsen (billionai) init_ppc_proc(cpu); 73843e770bf7SBruno Larsen (billionai) 73853e770bf7SBruno Larsen (billionai) ppc_gdb_init(cs, pcc); 73863e770bf7SBruno Larsen (billionai) qemu_init_vcpu(cs); 73873e770bf7SBruno Larsen (billionai) 73883e770bf7SBruno Larsen (billionai) pcc->parent_realize(dev, errp); 73893e770bf7SBruno Larsen (billionai) 73903e770bf7SBruno Larsen (billionai) return; 73913e770bf7SBruno Larsen (billionai) 73923e770bf7SBruno Larsen (billionai) unrealize: 73933e770bf7SBruno Larsen (billionai) cpu_exec_unrealizefn(cs); 73943e770bf7SBruno Larsen (billionai) } 73953e770bf7SBruno Larsen (billionai) 73963e770bf7SBruno Larsen (billionai) static void ppc_cpu_unrealize(DeviceState *dev) 73973e770bf7SBruno Larsen (billionai) { 73983e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(dev); 73993e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); 74003e770bf7SBruno Larsen (billionai) 74013e770bf7SBruno Larsen (billionai) pcc->parent_unrealize(dev); 74023e770bf7SBruno Larsen (billionai) 74033e770bf7SBruno Larsen (billionai) cpu_remove_sync(CPU(cpu)); 74043e770bf7SBruno Larsen (billionai) 74053e770bf7SBruno Larsen (billionai) destroy_ppc_opcodes(cpu); 74063e770bf7SBruno Larsen (billionai) } 74073e770bf7SBruno Larsen (billionai) 74083e770bf7SBruno Larsen (billionai) static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b) 74093e770bf7SBruno Larsen (billionai) { 74103e770bf7SBruno Larsen (billionai) ObjectClass *oc = (ObjectClass *)a; 74113e770bf7SBruno Larsen (billionai) uint32_t pvr = *(uint32_t *)b; 74123e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = (PowerPCCPUClass *)a; 74133e770bf7SBruno Larsen (billionai) 74143e770bf7SBruno Larsen (billionai) /* -cpu host does a PVR lookup during construction */ 74153e770bf7SBruno Larsen (billionai) if (unlikely(strcmp(object_class_get_name(oc), 74163e770bf7SBruno Larsen (billionai) TYPE_HOST_POWERPC_CPU) == 0)) { 74173e770bf7SBruno Larsen (billionai) return -1; 74183e770bf7SBruno Larsen (billionai) } 74193e770bf7SBruno Larsen (billionai) 74203e770bf7SBruno Larsen (billionai) return pcc->pvr == pvr ? 0 : -1; 74213e770bf7SBruno Larsen (billionai) } 74223e770bf7SBruno Larsen (billionai) 74233e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr) 74243e770bf7SBruno Larsen (billionai) { 74253e770bf7SBruno Larsen (billionai) GSList *list, *item; 74263e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = NULL; 74273e770bf7SBruno Larsen (billionai) 74283e770bf7SBruno Larsen (billionai) list = object_class_get_list(TYPE_POWERPC_CPU, false); 74293e770bf7SBruno Larsen (billionai) item = g_slist_find_custom(list, &pvr, ppc_cpu_compare_class_pvr); 74303e770bf7SBruno Larsen (billionai) if (item != NULL) { 74313e770bf7SBruno Larsen (billionai) pcc = POWERPC_CPU_CLASS(item->data); 74323e770bf7SBruno Larsen (billionai) } 74333e770bf7SBruno Larsen (billionai) g_slist_free(list); 74343e770bf7SBruno Larsen (billionai) 74353e770bf7SBruno Larsen (billionai) return pcc; 74363e770bf7SBruno Larsen (billionai) } 74373e770bf7SBruno Larsen (billionai) 74383e770bf7SBruno Larsen (billionai) static gint ppc_cpu_compare_class_pvr_mask(gconstpointer a, gconstpointer b) 74393e770bf7SBruno Larsen (billionai) { 74403e770bf7SBruno Larsen (billionai) ObjectClass *oc = (ObjectClass *)a; 74413e770bf7SBruno Larsen (billionai) uint32_t pvr = *(uint32_t *)b; 74423e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = (PowerPCCPUClass *)a; 74433e770bf7SBruno Larsen (billionai) 74443e770bf7SBruno Larsen (billionai) /* -cpu host does a PVR lookup during construction */ 74453e770bf7SBruno Larsen (billionai) if (unlikely(strcmp(object_class_get_name(oc), 74463e770bf7SBruno Larsen (billionai) TYPE_HOST_POWERPC_CPU) == 0)) { 74473e770bf7SBruno Larsen (billionai) return -1; 74483e770bf7SBruno Larsen (billionai) } 74493e770bf7SBruno Larsen (billionai) 74503e770bf7SBruno Larsen (billionai) if (pcc->pvr_match(pcc, pvr)) { 74513e770bf7SBruno Larsen (billionai) return 0; 74523e770bf7SBruno Larsen (billionai) } 74533e770bf7SBruno Larsen (billionai) 74543e770bf7SBruno Larsen (billionai) return -1; 74553e770bf7SBruno Larsen (billionai) } 74563e770bf7SBruno Larsen (billionai) 74573e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr) 74583e770bf7SBruno Larsen (billionai) { 74593e770bf7SBruno Larsen (billionai) GSList *list, *item; 74603e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = NULL; 74613e770bf7SBruno Larsen (billionai) 74623e770bf7SBruno Larsen (billionai) list = object_class_get_list(TYPE_POWERPC_CPU, true); 74633e770bf7SBruno Larsen (billionai) item = g_slist_find_custom(list, &pvr, ppc_cpu_compare_class_pvr_mask); 74643e770bf7SBruno Larsen (billionai) if (item != NULL) { 74653e770bf7SBruno Larsen (billionai) pcc = POWERPC_CPU_CLASS(item->data); 74663e770bf7SBruno Larsen (billionai) } 74673e770bf7SBruno Larsen (billionai) g_slist_free(list); 74683e770bf7SBruno Larsen (billionai) 74693e770bf7SBruno Larsen (billionai) return pcc; 74703e770bf7SBruno Larsen (billionai) } 74713e770bf7SBruno Larsen (billionai) 74723e770bf7SBruno Larsen (billionai) static const char *ppc_cpu_lookup_alias(const char *alias) 74733e770bf7SBruno Larsen (billionai) { 74743e770bf7SBruno Larsen (billionai) int ai; 74753e770bf7SBruno Larsen (billionai) 74763e770bf7SBruno Larsen (billionai) for (ai = 0; ppc_cpu_aliases[ai].alias != NULL; ai++) { 74773e770bf7SBruno Larsen (billionai) if (strcmp(ppc_cpu_aliases[ai].alias, alias) == 0) { 74783e770bf7SBruno Larsen (billionai) return ppc_cpu_aliases[ai].model; 74793e770bf7SBruno Larsen (billionai) } 74803e770bf7SBruno Larsen (billionai) } 74813e770bf7SBruno Larsen (billionai) 74823e770bf7SBruno Larsen (billionai) return NULL; 74833e770bf7SBruno Larsen (billionai) } 74843e770bf7SBruno Larsen (billionai) 74853e770bf7SBruno Larsen (billionai) static ObjectClass *ppc_cpu_class_by_name(const char *name) 74863e770bf7SBruno Larsen (billionai) { 74873e770bf7SBruno Larsen (billionai) char *cpu_model, *typename; 74883e770bf7SBruno Larsen (billionai) ObjectClass *oc; 74893e770bf7SBruno Larsen (billionai) const char *p; 74903e770bf7SBruno Larsen (billionai) unsigned long pvr; 74913e770bf7SBruno Larsen (billionai) 74923e770bf7SBruno Larsen (billionai) /* 74933e770bf7SBruno Larsen (billionai) * Lookup by PVR if cpu_model is valid 8 digit hex number (excl: 74943e770bf7SBruno Larsen (billionai) * 0x prefix if present) 74953e770bf7SBruno Larsen (billionai) */ 74963e770bf7SBruno Larsen (billionai) if (!qemu_strtoul(name, &p, 16, &pvr)) { 74973e770bf7SBruno Larsen (billionai) int len = p - name; 74983e770bf7SBruno Larsen (billionai) len = (len == 10) && (name[1] == 'x') ? len - 2 : len; 74993e770bf7SBruno Larsen (billionai) if ((len == 8) && (*p == '\0')) { 75003e770bf7SBruno Larsen (billionai) return OBJECT_CLASS(ppc_cpu_class_by_pvr(pvr)); 75013e770bf7SBruno Larsen (billionai) } 75023e770bf7SBruno Larsen (billionai) } 75033e770bf7SBruno Larsen (billionai) 75043e770bf7SBruno Larsen (billionai) cpu_model = g_ascii_strdown(name, -1); 75053e770bf7SBruno Larsen (billionai) p = ppc_cpu_lookup_alias(cpu_model); 75063e770bf7SBruno Larsen (billionai) if (p) { 75073e770bf7SBruno Larsen (billionai) g_free(cpu_model); 75083e770bf7SBruno Larsen (billionai) cpu_model = g_strdup(p); 75093e770bf7SBruno Larsen (billionai) } 75103e770bf7SBruno Larsen (billionai) 75113e770bf7SBruno Larsen (billionai) typename = g_strdup_printf("%s" POWERPC_CPU_TYPE_SUFFIX, cpu_model); 75123e770bf7SBruno Larsen (billionai) oc = object_class_by_name(typename); 75133e770bf7SBruno Larsen (billionai) g_free(typename); 75143e770bf7SBruno Larsen (billionai) g_free(cpu_model); 75153e770bf7SBruno Larsen (billionai) 75163e770bf7SBruno Larsen (billionai) return oc; 75173e770bf7SBruno Larsen (billionai) } 75183e770bf7SBruno Larsen (billionai) 75193e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc) 75203e770bf7SBruno Larsen (billionai) { 75213e770bf7SBruno Larsen (billionai) ObjectClass *oc = OBJECT_CLASS(pcc); 75223e770bf7SBruno Larsen (billionai) 75233e770bf7SBruno Larsen (billionai) while (oc && !object_class_is_abstract(oc)) { 75243e770bf7SBruno Larsen (billionai) oc = object_class_get_parent(oc); 75253e770bf7SBruno Larsen (billionai) } 75263e770bf7SBruno Larsen (billionai) assert(oc); 75273e770bf7SBruno Larsen (billionai) 75283e770bf7SBruno Larsen (billionai) return POWERPC_CPU_CLASS(oc); 75293e770bf7SBruno Larsen (billionai) } 75303e770bf7SBruno Larsen (billionai) 75313e770bf7SBruno Larsen (billionai) /* Sort by PVR, ordering special case "host" last. */ 75323e770bf7SBruno Larsen (billionai) static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b) 75333e770bf7SBruno Larsen (billionai) { 75343e770bf7SBruno Larsen (billionai) ObjectClass *oc_a = (ObjectClass *)a; 75353e770bf7SBruno Larsen (billionai) ObjectClass *oc_b = (ObjectClass *)b; 75363e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc_a = POWERPC_CPU_CLASS(oc_a); 75373e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc_b = POWERPC_CPU_CLASS(oc_b); 75383e770bf7SBruno Larsen (billionai) const char *name_a = object_class_get_name(oc_a); 75393e770bf7SBruno Larsen (billionai) const char *name_b = object_class_get_name(oc_b); 75403e770bf7SBruno Larsen (billionai) 75413e770bf7SBruno Larsen (billionai) if (strcmp(name_a, TYPE_HOST_POWERPC_CPU) == 0) { 75423e770bf7SBruno Larsen (billionai) return 1; 75433e770bf7SBruno Larsen (billionai) } else if (strcmp(name_b, TYPE_HOST_POWERPC_CPU) == 0) { 75443e770bf7SBruno Larsen (billionai) return -1; 75453e770bf7SBruno Larsen (billionai) } else { 75463e770bf7SBruno Larsen (billionai) /* Avoid an integer overflow during subtraction */ 75473e770bf7SBruno Larsen (billionai) if (pcc_a->pvr < pcc_b->pvr) { 75483e770bf7SBruno Larsen (billionai) return -1; 75493e770bf7SBruno Larsen (billionai) } else if (pcc_a->pvr > pcc_b->pvr) { 75503e770bf7SBruno Larsen (billionai) return 1; 75513e770bf7SBruno Larsen (billionai) } else { 75523e770bf7SBruno Larsen (billionai) return 0; 75533e770bf7SBruno Larsen (billionai) } 75543e770bf7SBruno Larsen (billionai) } 75553e770bf7SBruno Larsen (billionai) } 75563e770bf7SBruno Larsen (billionai) 75573e770bf7SBruno Larsen (billionai) static void ppc_cpu_list_entry(gpointer data, gpointer user_data) 75583e770bf7SBruno Larsen (billionai) { 75593e770bf7SBruno Larsen (billionai) ObjectClass *oc = data; 75603e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 75613e770bf7SBruno Larsen (billionai) DeviceClass *family = DEVICE_CLASS(ppc_cpu_get_family_class(pcc)); 75623e770bf7SBruno Larsen (billionai) const char *typename = object_class_get_name(oc); 75633e770bf7SBruno Larsen (billionai) char *name; 75643e770bf7SBruno Larsen (billionai) int i; 75653e770bf7SBruno Larsen (billionai) 75663e770bf7SBruno Larsen (billionai) if (unlikely(strcmp(typename, TYPE_HOST_POWERPC_CPU) == 0)) { 75673e770bf7SBruno Larsen (billionai) return; 75683e770bf7SBruno Larsen (billionai) } 75693e770bf7SBruno Larsen (billionai) 75703e770bf7SBruno Larsen (billionai) name = g_strndup(typename, 75713e770bf7SBruno Larsen (billionai) strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX)); 75723e770bf7SBruno Larsen (billionai) qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr); 75733e770bf7SBruno Larsen (billionai) for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { 75743e770bf7SBruno Larsen (billionai) PowerPCCPUAlias *alias = &ppc_cpu_aliases[i]; 75753e770bf7SBruno Larsen (billionai) ObjectClass *alias_oc = ppc_cpu_class_by_name(alias->model); 75763e770bf7SBruno Larsen (billionai) 75773e770bf7SBruno Larsen (billionai) if (alias_oc != oc) { 75783e770bf7SBruno Larsen (billionai) continue; 75793e770bf7SBruno Larsen (billionai) } 75803e770bf7SBruno Larsen (billionai) /* 75813e770bf7SBruno Larsen (billionai) * If running with KVM, we might update the family alias later, so 75823e770bf7SBruno Larsen (billionai) * avoid printing the wrong alias here and use "preferred" instead 75833e770bf7SBruno Larsen (billionai) */ 75843e770bf7SBruno Larsen (billionai) if (strcmp(alias->alias, family->desc) == 0) { 75853e770bf7SBruno Larsen (billionai) qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n", 75863e770bf7SBruno Larsen (billionai) alias->alias, family->desc); 75873e770bf7SBruno Larsen (billionai) } else { 75883e770bf7SBruno Larsen (billionai) qemu_printf("PowerPC %-16s (alias for %s)\n", 75893e770bf7SBruno Larsen (billionai) alias->alias, name); 75903e770bf7SBruno Larsen (billionai) } 75913e770bf7SBruno Larsen (billionai) } 75923e770bf7SBruno Larsen (billionai) g_free(name); 75933e770bf7SBruno Larsen (billionai) } 75943e770bf7SBruno Larsen (billionai) 75953e770bf7SBruno Larsen (billionai) void ppc_cpu_list(void) 75963e770bf7SBruno Larsen (billionai) { 75973e770bf7SBruno Larsen (billionai) GSList *list; 75983e770bf7SBruno Larsen (billionai) 75993e770bf7SBruno Larsen (billionai) list = object_class_get_list(TYPE_POWERPC_CPU, false); 76003e770bf7SBruno Larsen (billionai) list = g_slist_sort(list, ppc_cpu_list_compare); 76013e770bf7SBruno Larsen (billionai) g_slist_foreach(list, ppc_cpu_list_entry, NULL); 76023e770bf7SBruno Larsen (billionai) g_slist_free(list); 76033e770bf7SBruno Larsen (billionai) 76043e770bf7SBruno Larsen (billionai) #ifdef CONFIG_KVM 76053e770bf7SBruno Larsen (billionai) qemu_printf("\n"); 760661848717SMarkus Armbruster qemu_printf("PowerPC %s\n", "host"); 76073e770bf7SBruno Larsen (billionai) #endif 76083e770bf7SBruno Larsen (billionai) } 76093e770bf7SBruno Larsen (billionai) 76103e770bf7SBruno Larsen (billionai) static void ppc_cpu_defs_entry(gpointer data, gpointer user_data) 76113e770bf7SBruno Larsen (billionai) { 76123e770bf7SBruno Larsen (billionai) ObjectClass *oc = data; 76133e770bf7SBruno Larsen (billionai) CpuDefinitionInfoList **first = user_data; 76143e770bf7SBruno Larsen (billionai) const char *typename; 76153e770bf7SBruno Larsen (billionai) CpuDefinitionInfo *info; 76163e770bf7SBruno Larsen (billionai) 76173e770bf7SBruno Larsen (billionai) typename = object_class_get_name(oc); 76183e770bf7SBruno Larsen (billionai) info = g_malloc0(sizeof(*info)); 76193e770bf7SBruno Larsen (billionai) info->name = g_strndup(typename, 76203e770bf7SBruno Larsen (billionai) strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX)); 76213e770bf7SBruno Larsen (billionai) 76223e770bf7SBruno Larsen (billionai) QAPI_LIST_PREPEND(*first, info); 76233e770bf7SBruno Larsen (billionai) } 76243e770bf7SBruno Larsen (billionai) 76253e770bf7SBruno Larsen (billionai) CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) 76263e770bf7SBruno Larsen (billionai) { 76273e770bf7SBruno Larsen (billionai) CpuDefinitionInfoList *cpu_list = NULL; 76283e770bf7SBruno Larsen (billionai) GSList *list; 76293e770bf7SBruno Larsen (billionai) int i; 76303e770bf7SBruno Larsen (billionai) 76313e770bf7SBruno Larsen (billionai) list = object_class_get_list(TYPE_POWERPC_CPU, false); 76323e770bf7SBruno Larsen (billionai) g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list); 76333e770bf7SBruno Larsen (billionai) g_slist_free(list); 76343e770bf7SBruno Larsen (billionai) 76353e770bf7SBruno Larsen (billionai) for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { 76363e770bf7SBruno Larsen (billionai) PowerPCCPUAlias *alias = &ppc_cpu_aliases[i]; 76373e770bf7SBruno Larsen (billionai) ObjectClass *oc; 76383e770bf7SBruno Larsen (billionai) CpuDefinitionInfo *info; 76393e770bf7SBruno Larsen (billionai) 76403e770bf7SBruno Larsen (billionai) oc = ppc_cpu_class_by_name(alias->model); 76413e770bf7SBruno Larsen (billionai) if (oc == NULL) { 76423e770bf7SBruno Larsen (billionai) continue; 76433e770bf7SBruno Larsen (billionai) } 76443e770bf7SBruno Larsen (billionai) 76453e770bf7SBruno Larsen (billionai) info = g_malloc0(sizeof(*info)); 76463e770bf7SBruno Larsen (billionai) info->name = g_strdup(alias->alias); 76473e770bf7SBruno Larsen (billionai) info->q_typename = g_strdup(object_class_get_name(oc)); 76483e770bf7SBruno Larsen (billionai) 76493e770bf7SBruno Larsen (billionai) QAPI_LIST_PREPEND(cpu_list, info); 76503e770bf7SBruno Larsen (billionai) } 76513e770bf7SBruno Larsen (billionai) 76523e770bf7SBruno Larsen (billionai) return cpu_list; 76533e770bf7SBruno Larsen (billionai) } 76543e770bf7SBruno Larsen (billionai) 76553e770bf7SBruno Larsen (billionai) static void ppc_cpu_set_pc(CPUState *cs, vaddr value) 76563e770bf7SBruno Larsen (billionai) { 76573e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 76583e770bf7SBruno Larsen (billionai) 76593e770bf7SBruno Larsen (billionai) cpu->env.nip = value; 76603e770bf7SBruno Larsen (billionai) } 76613e770bf7SBruno Larsen (billionai) 76623e770bf7SBruno Larsen (billionai) static bool ppc_cpu_has_work(CPUState *cs) 76633e770bf7SBruno Larsen (billionai) { 76643e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 76653e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 76663e770bf7SBruno Larsen (billionai) 76673e770bf7SBruno Larsen (billionai) return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); 76683e770bf7SBruno Larsen (billionai) } 76693e770bf7SBruno Larsen (billionai) 76703e770bf7SBruno Larsen (billionai) static void ppc_cpu_reset(DeviceState *dev) 76713e770bf7SBruno Larsen (billionai) { 76723e770bf7SBruno Larsen (billionai) CPUState *s = CPU(dev); 76733e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(s); 76743e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); 76753e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 76763e770bf7SBruno Larsen (billionai) target_ulong msr; 76773e770bf7SBruno Larsen (billionai) int i; 76783e770bf7SBruno Larsen (billionai) 76793e770bf7SBruno Larsen (billionai) pcc->parent_reset(dev); 76803e770bf7SBruno Larsen (billionai) 76813e770bf7SBruno Larsen (billionai) msr = (target_ulong)0; 76823e770bf7SBruno Larsen (billionai) msr |= (target_ulong)MSR_HVB; 76833e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_EP; 76843e770bf7SBruno Larsen (billionai) #if defined(DO_SINGLE_STEP) && 0 76853e770bf7SBruno Larsen (billionai) /* Single step trace mode */ 76863e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_SE; 76873e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_BE; 76883e770bf7SBruno Larsen (billionai) #endif 76893e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY) 76903e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_FP; /* Allow floating point usage */ 76913e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_FE0; /* Allow floating point exceptions */ 76923e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_FE1; 76933e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_VR; /* Allow altivec usage */ 76943e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_VSX; /* Allow VSX usage */ 76953e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_SPE; /* Allow SPE usage */ 76963e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_PR; 76973e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64) 76983e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_TM; /* Transactional memory */ 76993e770bf7SBruno Larsen (billionai) #endif 77003e770bf7SBruno Larsen (billionai) #if !defined(TARGET_WORDS_BIGENDIAN) 77013e770bf7SBruno Larsen (billionai) msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */ 77023e770bf7SBruno Larsen (billionai) if (!((env->msr_mask >> MSR_LE) & 1)) { 77033e770bf7SBruno Larsen (billionai) fprintf(stderr, "Selected CPU does not support little-endian.\n"); 77043e770bf7SBruno Larsen (billionai) exit(1); 77053e770bf7SBruno Larsen (billionai) } 77063e770bf7SBruno Larsen (billionai) #endif 77073e770bf7SBruno Larsen (billionai) #endif 77083e770bf7SBruno Larsen (billionai) 77093e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64) 77103e770bf7SBruno Larsen (billionai) if (mmu_is_64bit(env->mmu_model)) { 77113e770bf7SBruno Larsen (billionai) msr |= (1ULL << MSR_SF); 77123e770bf7SBruno Larsen (billionai) } 77133e770bf7SBruno Larsen (billionai) #endif 77143e770bf7SBruno Larsen (billionai) 77153e770bf7SBruno Larsen (billionai) hreg_store_msr(env, msr, 1); 77163e770bf7SBruno Larsen (billionai) 77173e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 77183e770bf7SBruno Larsen (billionai) env->nip = env->hreset_vector | env->excp_prefix; 771989bb5a4dSLucas Mateus Castro (alqotel) #if defined(CONFIG_TCG) 77203e770bf7SBruno Larsen (billionai) if (env->mmu_model != POWERPC_MMU_REAL) { 77213e770bf7SBruno Larsen (billionai) ppc_tlb_invalidate_all(env); 77223e770bf7SBruno Larsen (billionai) } 772389bb5a4dSLucas Mateus Castro (alqotel) #endif /* CONFIG_TCG */ 77243e770bf7SBruno Larsen (billionai) #endif 77253e770bf7SBruno Larsen (billionai) 77266e8b9903SRichard Henderson pmu_update_summaries(env); 77273e770bf7SBruno Larsen (billionai) hreg_compute_hflags(env); 77283e770bf7SBruno Larsen (billionai) env->reserve_addr = (target_ulong)-1ULL; 77293e770bf7SBruno Larsen (billionai) /* Be sure no exception or interrupt is pending */ 77303e770bf7SBruno Larsen (billionai) env->pending_interrupts = 0; 77313e770bf7SBruno Larsen (billionai) s->exception_index = POWERPC_EXCP_NONE; 77323e770bf7SBruno Larsen (billionai) env->error_code = 0; 77333e770bf7SBruno Larsen (billionai) ppc_irq_reset(cpu); 77343e770bf7SBruno Larsen (billionai) 77353e770bf7SBruno Larsen (billionai) /* tininess for underflow is detected before rounding */ 77363e770bf7SBruno Larsen (billionai) set_float_detect_tininess(float_tininess_before_rounding, 77373e770bf7SBruno Larsen (billionai) &env->fp_status); 77383e770bf7SBruno Larsen (billionai) 77393e770bf7SBruno Larsen (billionai) for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) { 77403e770bf7SBruno Larsen (billionai) ppc_spr_t *spr = &env->spr_cb[i]; 77413e770bf7SBruno Larsen (billionai) 77423e770bf7SBruno Larsen (billionai) if (!spr->name) { 77433e770bf7SBruno Larsen (billionai) continue; 77443e770bf7SBruno Larsen (billionai) } 77453e770bf7SBruno Larsen (billionai) env->spr[i] = spr->default_value; 77463e770bf7SBruno Larsen (billionai) } 77473e770bf7SBruno Larsen (billionai) } 77483e770bf7SBruno Larsen (billionai) 77493e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY 77503e770bf7SBruno Larsen (billionai) 77513e770bf7SBruno Larsen (billionai) static bool ppc_cpu_is_big_endian(CPUState *cs) 77523e770bf7SBruno Larsen (billionai) { 77533e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 77543e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 77553e770bf7SBruno Larsen (billionai) 77563e770bf7SBruno Larsen (billionai) cpu_synchronize_state(cs); 77573e770bf7SBruno Larsen (billionai) 77583e770bf7SBruno Larsen (billionai) return !msr_le; 77593e770bf7SBruno Larsen (billionai) } 77603e770bf7SBruno Larsen (billionai) 77613e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG 77623e770bf7SBruno Larsen (billionai) static void ppc_cpu_exec_enter(CPUState *cs) 77633e770bf7SBruno Larsen (billionai) { 77643e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 77653e770bf7SBruno Larsen (billionai) 77663e770bf7SBruno Larsen (billionai) if (cpu->vhyp) { 77673e770bf7SBruno Larsen (billionai) PPCVirtualHypervisorClass *vhc = 77683e770bf7SBruno Larsen (billionai) PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); 77693e770bf7SBruno Larsen (billionai) vhc->cpu_exec_enter(cpu->vhyp, cpu); 77703e770bf7SBruno Larsen (billionai) } 77713e770bf7SBruno Larsen (billionai) } 77723e770bf7SBruno Larsen (billionai) 77733e770bf7SBruno Larsen (billionai) static void ppc_cpu_exec_exit(CPUState *cs) 77743e770bf7SBruno Larsen (billionai) { 77753e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 77763e770bf7SBruno Larsen (billionai) 77773e770bf7SBruno Larsen (billionai) if (cpu->vhyp) { 77783e770bf7SBruno Larsen (billionai) PPCVirtualHypervisorClass *vhc = 77793e770bf7SBruno Larsen (billionai) PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); 77803e770bf7SBruno Larsen (billionai) vhc->cpu_exec_exit(cpu->vhyp, cpu); 77813e770bf7SBruno Larsen (billionai) } 77823e770bf7SBruno Larsen (billionai) } 77833e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */ 77843e770bf7SBruno Larsen (billionai) 77853e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */ 77863e770bf7SBruno Larsen (billionai) 77873e770bf7SBruno Larsen (billionai) static void ppc_cpu_instance_init(Object *obj) 77883e770bf7SBruno Larsen (billionai) { 77893e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(obj); 77903e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); 77913e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 77923e770bf7SBruno Larsen (billionai) 77933e770bf7SBruno Larsen (billionai) cpu_set_cpustate_pointers(cpu); 77943e770bf7SBruno Larsen (billionai) cpu->vcpu_id = UNASSIGNED_CPU_INDEX; 77953e770bf7SBruno Larsen (billionai) 77963e770bf7SBruno Larsen (billionai) env->msr_mask = pcc->msr_mask; 77973e770bf7SBruno Larsen (billionai) env->mmu_model = pcc->mmu_model; 77983e770bf7SBruno Larsen (billionai) env->excp_model = pcc->excp_model; 77993e770bf7SBruno Larsen (billionai) env->bus_model = pcc->bus_model; 78003e770bf7SBruno Larsen (billionai) env->insns_flags = pcc->insns_flags; 78013e770bf7SBruno Larsen (billionai) env->insns_flags2 = pcc->insns_flags2; 78023e770bf7SBruno Larsen (billionai) env->flags = pcc->flags; 78033e770bf7SBruno Larsen (billionai) env->bfd_mach = pcc->bfd_mach; 78043e770bf7SBruno Larsen (billionai) env->check_pow = pcc->check_pow; 78053e770bf7SBruno Larsen (billionai) 78063e770bf7SBruno Larsen (billionai) /* 78073e770bf7SBruno Larsen (billionai) * Mark HV mode as supported if the CPU has an MSR_HV bit in the 78083e770bf7SBruno Larsen (billionai) * msr_mask. The mask can later be cleared by PAPR mode but the hv 78093e770bf7SBruno Larsen (billionai) * mode support will remain, thus enforcing that we cannot use 78103e770bf7SBruno Larsen (billionai) * priv. instructions in guest in PAPR mode. For 970 we currently 78113e770bf7SBruno Larsen (billionai) * simply don't set HV in msr_mask thus simulating an "Apple mode" 78123e770bf7SBruno Larsen (billionai) * 970. If we ever want to support 970 HV mode, we'll have to add 78133e770bf7SBruno Larsen (billionai) * a processor attribute of some sort. 78143e770bf7SBruno Larsen (billionai) */ 78153e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 78163e770bf7SBruno Larsen (billionai) env->has_hv_mode = !!(env->msr_mask & MSR_HVB); 78173e770bf7SBruno Larsen (billionai) #endif 78183e770bf7SBruno Larsen (billionai) 78193e770bf7SBruno Larsen (billionai) ppc_hash64_init(cpu); 78203e770bf7SBruno Larsen (billionai) } 78213e770bf7SBruno Larsen (billionai) 78223e770bf7SBruno Larsen (billionai) static void ppc_cpu_instance_finalize(Object *obj) 78233e770bf7SBruno Larsen (billionai) { 78243e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(obj); 78253e770bf7SBruno Larsen (billionai) 78263e770bf7SBruno Larsen (billionai) ppc_hash64_finalize(cpu); 78273e770bf7SBruno Larsen (billionai) } 78283e770bf7SBruno Larsen (billionai) 78293e770bf7SBruno Larsen (billionai) static bool ppc_pvr_match_default(PowerPCCPUClass *pcc, uint32_t pvr) 78303e770bf7SBruno Larsen (billionai) { 78313e770bf7SBruno Larsen (billionai) return pcc->pvr == pvr; 78323e770bf7SBruno Larsen (billionai) } 78333e770bf7SBruno Larsen (billionai) 78343e770bf7SBruno Larsen (billionai) static void ppc_disas_set_info(CPUState *cs, disassemble_info *info) 78353e770bf7SBruno Larsen (billionai) { 78363e770bf7SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 78373e770bf7SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 78383e770bf7SBruno Larsen (billionai) 78393e770bf7SBruno Larsen (billionai) if ((env->hflags >> MSR_LE) & 1) { 78403e770bf7SBruno Larsen (billionai) info->endian = BFD_ENDIAN_LITTLE; 78413e770bf7SBruno Larsen (billionai) } 78423e770bf7SBruno Larsen (billionai) info->mach = env->bfd_mach; 78433e770bf7SBruno Larsen (billionai) if (!env->bfd_mach) { 78443e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64 78453e770bf7SBruno Larsen (billionai) info->mach = bfd_mach_ppc64; 78463e770bf7SBruno Larsen (billionai) #else 78473e770bf7SBruno Larsen (billionai) info->mach = bfd_mach_ppc; 78483e770bf7SBruno Larsen (billionai) #endif 78493e770bf7SBruno Larsen (billionai) } 78503e770bf7SBruno Larsen (billionai) info->disassembler_options = (char *)"any"; 78513e770bf7SBruno Larsen (billionai) info->print_insn = print_insn_ppc; 78523e770bf7SBruno Larsen (billionai) 78533e770bf7SBruno Larsen (billionai) info->cap_arch = CS_ARCH_PPC; 78543e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64 78553e770bf7SBruno Larsen (billionai) info->cap_mode = CS_MODE_64; 78563e770bf7SBruno Larsen (billionai) #endif 78573e770bf7SBruno Larsen (billionai) } 78583e770bf7SBruno Larsen (billionai) 78593e770bf7SBruno Larsen (billionai) static Property ppc_cpu_properties[] = { 78603e770bf7SBruno Larsen (billionai) DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU, pre_2_8_migration, false), 78613e770bf7SBruno Larsen (billionai) DEFINE_PROP_BOOL("pre-2.10-migration", PowerPCCPU, pre_2_10_migration, 78623e770bf7SBruno Larsen (billionai) false), 78633e770bf7SBruno Larsen (billionai) DEFINE_PROP_BOOL("pre-3.0-migration", PowerPCCPU, pre_3_0_migration, 78643e770bf7SBruno Larsen (billionai) false), 78653e770bf7SBruno Larsen (billionai) DEFINE_PROP_END_OF_LIST(), 78663e770bf7SBruno Larsen (billionai) }; 78673e770bf7SBruno Larsen (billionai) 78688b80bd28SPhilippe Mathieu-Daudé #ifndef CONFIG_USER_ONLY 78698b80bd28SPhilippe Mathieu-Daudé #include "hw/core/sysemu-cpu-ops.h" 78708b80bd28SPhilippe Mathieu-Daudé 78718b80bd28SPhilippe Mathieu-Daudé static const struct SysemuCPUOps ppc_sysemu_ops = { 787208928c6dSPhilippe Mathieu-Daudé .get_phys_page_debug = ppc_cpu_get_phys_page_debug, 7873715e3c1aSPhilippe Mathieu-Daudé .write_elf32_note = ppc32_cpu_write_elf32_note, 7874715e3c1aSPhilippe Mathieu-Daudé .write_elf64_note = ppc64_cpu_write_elf64_note, 7875da383e02SPhilippe Mathieu-Daudé .virtio_is_big_endian = ppc_cpu_is_big_endian, 7876feece4d0SPhilippe Mathieu-Daudé .legacy_vmsd = &vmstate_ppc_cpu, 78778b80bd28SPhilippe Mathieu-Daudé }; 78788b80bd28SPhilippe Mathieu-Daudé #endif 78798b80bd28SPhilippe Mathieu-Daudé 78803e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG 78813e770bf7SBruno Larsen (billionai) #include "hw/core/tcg-cpu-ops.h" 78823e770bf7SBruno Larsen (billionai) 788311906557SRichard Henderson static const struct TCGCPUOps ppc_tcg_ops = { 78843e770bf7SBruno Larsen (billionai) .initialize = ppc_translate_init, 78853e770bf7SBruno Larsen (billionai) 78861db8af5cSRichard Henderson #ifdef CONFIG_USER_ONLY 78871db8af5cSRichard Henderson .record_sigsegv = ppc_cpu_record_sigsegv, 78881db8af5cSRichard Henderson #else 78891db8af5cSRichard Henderson .tlb_fill = ppc_cpu_tlb_fill, 7890f725245cSPhilippe Mathieu-Daudé .cpu_exec_interrupt = ppc_cpu_exec_interrupt, 78913e770bf7SBruno Larsen (billionai) .do_interrupt = ppc_cpu_do_interrupt, 78923e770bf7SBruno Larsen (billionai) .cpu_exec_enter = ppc_cpu_exec_enter, 78933e770bf7SBruno Larsen (billionai) .cpu_exec_exit = ppc_cpu_exec_exit, 78943e770bf7SBruno Larsen (billionai) .do_unaligned_access = ppc_cpu_do_unaligned_access, 78953e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */ 78963e770bf7SBruno Larsen (billionai) }; 78973e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */ 78983e770bf7SBruno Larsen (billionai) 78993e770bf7SBruno Larsen (billionai) static void ppc_cpu_class_init(ObjectClass *oc, void *data) 79003e770bf7SBruno Larsen (billionai) { 79013e770bf7SBruno Larsen (billionai) PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); 79023e770bf7SBruno Larsen (billionai) CPUClass *cc = CPU_CLASS(oc); 79033e770bf7SBruno Larsen (billionai) DeviceClass *dc = DEVICE_CLASS(oc); 79043e770bf7SBruno Larsen (billionai) 79053e770bf7SBruno Larsen (billionai) device_class_set_parent_realize(dc, ppc_cpu_realize, 79063e770bf7SBruno Larsen (billionai) &pcc->parent_realize); 79073e770bf7SBruno Larsen (billionai) device_class_set_parent_unrealize(dc, ppc_cpu_unrealize, 79083e770bf7SBruno Larsen (billionai) &pcc->parent_unrealize); 79093e770bf7SBruno Larsen (billionai) pcc->pvr_match = ppc_pvr_match_default; 79103e770bf7SBruno Larsen (billionai) device_class_set_props(dc, ppc_cpu_properties); 79113e770bf7SBruno Larsen (billionai) 79123e770bf7SBruno Larsen (billionai) device_class_set_parent_reset(dc, ppc_cpu_reset, &pcc->parent_reset); 79133e770bf7SBruno Larsen (billionai) 79143e770bf7SBruno Larsen (billionai) cc->class_by_name = ppc_cpu_class_by_name; 79153e770bf7SBruno Larsen (billionai) cc->has_work = ppc_cpu_has_work; 79163e770bf7SBruno Larsen (billionai) cc->dump_state = ppc_cpu_dump_state; 79173e770bf7SBruno Larsen (billionai) cc->set_pc = ppc_cpu_set_pc; 79183e770bf7SBruno Larsen (billionai) cc->gdb_read_register = ppc_cpu_gdb_read_register; 79193e770bf7SBruno Larsen (billionai) cc->gdb_write_register = ppc_cpu_gdb_write_register; 79203e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY 79218b80bd28SPhilippe Mathieu-Daudé cc->sysemu_ops = &ppc_sysemu_ops; 79223e770bf7SBruno Larsen (billionai) #endif 79233e770bf7SBruno Larsen (billionai) 79243e770bf7SBruno Larsen (billionai) cc->gdb_num_core_regs = 71; 79253e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY 79263e770bf7SBruno Larsen (billionai) cc->gdb_get_dynamic_xml = ppc_gdb_get_dynamic_xml; 79273e770bf7SBruno Larsen (billionai) #endif 79283e770bf7SBruno Larsen (billionai) #ifdef USE_APPLE_GDB 79293e770bf7SBruno Larsen (billionai) cc->gdb_read_register = ppc_cpu_gdb_read_register_apple; 79303e770bf7SBruno Larsen (billionai) cc->gdb_write_register = ppc_cpu_gdb_write_register_apple; 79313e770bf7SBruno Larsen (billionai) cc->gdb_num_core_regs = 71 + 32; 79323e770bf7SBruno Larsen (billionai) #endif 79333e770bf7SBruno Larsen (billionai) 79343e770bf7SBruno Larsen (billionai) cc->gdb_arch_name = ppc_gdb_arch_name; 79353e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64) 79363e770bf7SBruno Larsen (billionai) cc->gdb_core_xml_file = "power64-core.xml"; 79373e770bf7SBruno Larsen (billionai) #else 79383e770bf7SBruno Larsen (billionai) cc->gdb_core_xml_file = "power-core.xml"; 79393e770bf7SBruno Larsen (billionai) #endif 79403e770bf7SBruno Larsen (billionai) cc->disas_set_info = ppc_disas_set_info; 79413e770bf7SBruno Larsen (billionai) 79423e770bf7SBruno Larsen (billionai) dc->fw_name = "PowerPC,UNKNOWN"; 79433e770bf7SBruno Larsen (billionai) 79443e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG 79453e770bf7SBruno Larsen (billionai) cc->tcg_ops = &ppc_tcg_ops; 79463e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */ 79473e770bf7SBruno Larsen (billionai) } 79483e770bf7SBruno Larsen (billionai) 79493e770bf7SBruno Larsen (billionai) static const TypeInfo ppc_cpu_type_info = { 79503e770bf7SBruno Larsen (billionai) .name = TYPE_POWERPC_CPU, 79513e770bf7SBruno Larsen (billionai) .parent = TYPE_CPU, 79523e770bf7SBruno Larsen (billionai) .instance_size = sizeof(PowerPCCPU), 79533e770bf7SBruno Larsen (billionai) .instance_align = __alignof__(PowerPCCPU), 79543e770bf7SBruno Larsen (billionai) .instance_init = ppc_cpu_instance_init, 79553e770bf7SBruno Larsen (billionai) .instance_finalize = ppc_cpu_instance_finalize, 79563e770bf7SBruno Larsen (billionai) .abstract = true, 79573e770bf7SBruno Larsen (billionai) .class_size = sizeof(PowerPCCPUClass), 79583e770bf7SBruno Larsen (billionai) .class_init = ppc_cpu_class_init, 79593e770bf7SBruno Larsen (billionai) }; 79603e770bf7SBruno Larsen (billionai) 79613e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY 79623e770bf7SBruno Larsen (billionai) static const TypeInfo ppc_vhyp_type_info = { 79633e770bf7SBruno Larsen (billionai) .name = TYPE_PPC_VIRTUAL_HYPERVISOR, 79643e770bf7SBruno Larsen (billionai) .parent = TYPE_INTERFACE, 79653e770bf7SBruno Larsen (billionai) .class_size = sizeof(PPCVirtualHypervisorClass), 79663e770bf7SBruno Larsen (billionai) }; 79673e770bf7SBruno Larsen (billionai) #endif 79683e770bf7SBruno Larsen (billionai) 79693e770bf7SBruno Larsen (billionai) static void ppc_cpu_register_types(void) 79703e770bf7SBruno Larsen (billionai) { 79713e770bf7SBruno Larsen (billionai) type_register_static(&ppc_cpu_type_info); 79723e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY 79733e770bf7SBruno Larsen (billionai) type_register_static(&ppc_vhyp_type_info); 79743e770bf7SBruno Larsen (billionai) #endif 79753e770bf7SBruno Larsen (billionai) } 79763e770bf7SBruno Larsen (billionai) 797747334e17SBruno Larsen (billionai) void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) 797847334e17SBruno Larsen (billionai) { 797947334e17SBruno Larsen (billionai) #define RGPL 4 798047334e17SBruno Larsen (billionai) #define RFPL 4 798147334e17SBruno Larsen (billionai) 798247334e17SBruno Larsen (billionai) PowerPCCPU *cpu = POWERPC_CPU(cs); 798347334e17SBruno Larsen (billionai) CPUPPCState *env = &cpu->env; 798447334e17SBruno Larsen (billionai) int i; 798547334e17SBruno Larsen (billionai) 798647334e17SBruno Larsen (billionai) qemu_fprintf(f, "NIP " TARGET_FMT_lx " LR " TARGET_FMT_lx " CTR " 798747334e17SBruno Larsen (billionai) TARGET_FMT_lx " XER " TARGET_FMT_lx " CPU#%d\n", 798847334e17SBruno Larsen (billionai) env->nip, env->lr, env->ctr, cpu_read_xer(env), 798947334e17SBruno Larsen (billionai) cs->cpu_index); 799047334e17SBruno Larsen (billionai) qemu_fprintf(f, "MSR " TARGET_FMT_lx " HID0 " TARGET_FMT_lx " HF " 799147334e17SBruno Larsen (billionai) "%08x iidx %d didx %d\n", 799247334e17SBruno Larsen (billionai) env->msr, env->spr[SPR_HID0], env->hflags, 799347334e17SBruno Larsen (billionai) cpu_mmu_index(env, true), cpu_mmu_index(env, false)); 799447334e17SBruno Larsen (billionai) #if !defined(NO_TIMER_DUMP) 799547334e17SBruno Larsen (billionai) qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64 799647334e17SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 799747334e17SBruno Larsen (billionai) " DECR " TARGET_FMT_lu 799847334e17SBruno Larsen (billionai) #endif 799947334e17SBruno Larsen (billionai) "\n", 800047334e17SBruno Larsen (billionai) cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env) 800147334e17SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 800247334e17SBruno Larsen (billionai) , cpu_ppc_load_decr(env) 800347334e17SBruno Larsen (billionai) #endif 800447334e17SBruno Larsen (billionai) ); 800547334e17SBruno Larsen (billionai) #endif 800647334e17SBruno Larsen (billionai) for (i = 0; i < 32; i++) { 800747334e17SBruno Larsen (billionai) if ((i & (RGPL - 1)) == 0) { 800847334e17SBruno Larsen (billionai) qemu_fprintf(f, "GPR%02d", i); 800947334e17SBruno Larsen (billionai) } 801047334e17SBruno Larsen (billionai) qemu_fprintf(f, " %016" PRIx64, ppc_dump_gpr(env, i)); 801147334e17SBruno Larsen (billionai) if ((i & (RGPL - 1)) == (RGPL - 1)) { 801247334e17SBruno Larsen (billionai) qemu_fprintf(f, "\n"); 801347334e17SBruno Larsen (billionai) } 801447334e17SBruno Larsen (billionai) } 801547334e17SBruno Larsen (billionai) qemu_fprintf(f, "CR "); 801647334e17SBruno Larsen (billionai) for (i = 0; i < 8; i++) 801747334e17SBruno Larsen (billionai) qemu_fprintf(f, "%01x", env->crf[i]); 801847334e17SBruno Larsen (billionai) qemu_fprintf(f, " ["); 801947334e17SBruno Larsen (billionai) for (i = 0; i < 8; i++) { 802047334e17SBruno Larsen (billionai) char a = '-'; 802147334e17SBruno Larsen (billionai) if (env->crf[i] & 0x08) { 802247334e17SBruno Larsen (billionai) a = 'L'; 802347334e17SBruno Larsen (billionai) } else if (env->crf[i] & 0x04) { 802447334e17SBruno Larsen (billionai) a = 'G'; 802547334e17SBruno Larsen (billionai) } else if (env->crf[i] & 0x02) { 802647334e17SBruno Larsen (billionai) a = 'E'; 802747334e17SBruno Larsen (billionai) } 802847334e17SBruno Larsen (billionai) qemu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' '); 802947334e17SBruno Larsen (billionai) } 803047334e17SBruno Larsen (billionai) qemu_fprintf(f, " ] RES " TARGET_FMT_lx "\n", 803147334e17SBruno Larsen (billionai) env->reserve_addr); 803247334e17SBruno Larsen (billionai) 803347334e17SBruno Larsen (billionai) if (flags & CPU_DUMP_FPU) { 803447334e17SBruno Larsen (billionai) for (i = 0; i < 32; i++) { 803547334e17SBruno Larsen (billionai) if ((i & (RFPL - 1)) == 0) { 803647334e17SBruno Larsen (billionai) qemu_fprintf(f, "FPR%02d", i); 803747334e17SBruno Larsen (billionai) } 803847334e17SBruno Larsen (billionai) qemu_fprintf(f, " %016" PRIx64, *cpu_fpr_ptr(env, i)); 803947334e17SBruno Larsen (billionai) if ((i & (RFPL - 1)) == (RFPL - 1)) { 804047334e17SBruno Larsen (billionai) qemu_fprintf(f, "\n"); 804147334e17SBruno Larsen (billionai) } 804247334e17SBruno Larsen (billionai) } 804347334e17SBruno Larsen (billionai) qemu_fprintf(f, "FPSCR " TARGET_FMT_lx "\n", env->fpscr); 804447334e17SBruno Larsen (billionai) } 804547334e17SBruno Larsen (billionai) 804647334e17SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY) 804747334e17SBruno Larsen (billionai) qemu_fprintf(f, " SRR0 " TARGET_FMT_lx " SRR1 " TARGET_FMT_lx 804847334e17SBruno Larsen (billionai) " PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n", 804947334e17SBruno Larsen (billionai) env->spr[SPR_SRR0], env->spr[SPR_SRR1], 805047334e17SBruno Larsen (billionai) env->spr[SPR_PVR], env->spr[SPR_VRSAVE]); 805147334e17SBruno Larsen (billionai) 805247334e17SBruno Larsen (billionai) qemu_fprintf(f, "SPRG0 " TARGET_FMT_lx " SPRG1 " TARGET_FMT_lx 805347334e17SBruno Larsen (billionai) " SPRG2 " TARGET_FMT_lx " SPRG3 " TARGET_FMT_lx "\n", 805447334e17SBruno Larsen (billionai) env->spr[SPR_SPRG0], env->spr[SPR_SPRG1], 805547334e17SBruno Larsen (billionai) env->spr[SPR_SPRG2], env->spr[SPR_SPRG3]); 805647334e17SBruno Larsen (billionai) 805747334e17SBruno Larsen (billionai) qemu_fprintf(f, "SPRG4 " TARGET_FMT_lx " SPRG5 " TARGET_FMT_lx 805847334e17SBruno Larsen (billionai) " SPRG6 " TARGET_FMT_lx " SPRG7 " TARGET_FMT_lx "\n", 805947334e17SBruno Larsen (billionai) env->spr[SPR_SPRG4], env->spr[SPR_SPRG5], 806047334e17SBruno Larsen (billionai) env->spr[SPR_SPRG6], env->spr[SPR_SPRG7]); 806147334e17SBruno Larsen (billionai) 8062fbe08667SCédric Le Goater switch (env->excp_model) { 806347334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64) 8064fbe08667SCédric Le Goater case POWERPC_EXCP_POWER7: 8065fbe08667SCédric Le Goater case POWERPC_EXCP_POWER8: 8066fbe08667SCédric Le Goater case POWERPC_EXCP_POWER9: 8067fbe08667SCédric Le Goater case POWERPC_EXCP_POWER10: 806847334e17SBruno Larsen (billionai) qemu_fprintf(f, "HSRR0 " TARGET_FMT_lx " HSRR1 " TARGET_FMT_lx "\n", 806947334e17SBruno Larsen (billionai) env->spr[SPR_HSRR0], env->spr[SPR_HSRR1]); 8070fbe08667SCédric Le Goater break; 807147334e17SBruno Larsen (billionai) #endif 8072fbe08667SCédric Le Goater case POWERPC_EXCP_BOOKE: 807347334e17SBruno Larsen (billionai) qemu_fprintf(f, "CSRR0 " TARGET_FMT_lx " CSRR1 " TARGET_FMT_lx 807447334e17SBruno Larsen (billionai) " MCSRR0 " TARGET_FMT_lx " MCSRR1 " TARGET_FMT_lx "\n", 807547334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_CSRR0], env->spr[SPR_BOOKE_CSRR1], 807647334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]); 807747334e17SBruno Larsen (billionai) 807847334e17SBruno Larsen (billionai) qemu_fprintf(f, " TCR " TARGET_FMT_lx " TSR " TARGET_FMT_lx 807947334e17SBruno Larsen (billionai) " ESR " TARGET_FMT_lx " DEAR " TARGET_FMT_lx "\n", 808047334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_TCR], env->spr[SPR_BOOKE_TSR], 808147334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_ESR], env->spr[SPR_BOOKE_DEAR]); 808247334e17SBruno Larsen (billionai) 808347334e17SBruno Larsen (billionai) qemu_fprintf(f, " PIR " TARGET_FMT_lx " DECAR " TARGET_FMT_lx 808447334e17SBruno Larsen (billionai) " IVPR " TARGET_FMT_lx " EPCR " TARGET_FMT_lx "\n", 808547334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_PIR], env->spr[SPR_BOOKE_DECAR], 808647334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_IVPR], env->spr[SPR_BOOKE_EPCR]); 808747334e17SBruno Larsen (billionai) 808847334e17SBruno Larsen (billionai) qemu_fprintf(f, " MCSR " TARGET_FMT_lx " SPRG8 " TARGET_FMT_lx 808947334e17SBruno Larsen (billionai) " EPR " TARGET_FMT_lx "\n", 809047334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_MCSR], env->spr[SPR_BOOKE_SPRG8], 809147334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_EPR]); 809247334e17SBruno Larsen (billionai) 809347334e17SBruno Larsen (billionai) /* FSL-specific */ 809447334e17SBruno Larsen (billionai) qemu_fprintf(f, " MCAR " TARGET_FMT_lx " PID1 " TARGET_FMT_lx 809547334e17SBruno Larsen (billionai) " PID2 " TARGET_FMT_lx " SVR " TARGET_FMT_lx "\n", 809647334e17SBruno Larsen (billionai) env->spr[SPR_Exxx_MCAR], env->spr[SPR_BOOKE_PID1], 809747334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_PID2], env->spr[SPR_E500_SVR]); 809847334e17SBruno Larsen (billionai) 809947334e17SBruno Larsen (billionai) /* 810047334e17SBruno Larsen (billionai) * IVORs are left out as they are large and do not change often -- 810147334e17SBruno Larsen (billionai) * they can be read with "p $ivor0", "p $ivor1", etc. 810247334e17SBruno Larsen (billionai) */ 8103fbe08667SCédric Le Goater break; 8104fbe08667SCédric Le Goater case POWERPC_EXCP_40x: 8105fbe08667SCédric Le Goater qemu_fprintf(f, " TCR " TARGET_FMT_lx " TSR " TARGET_FMT_lx 8106fbe08667SCédric Le Goater " ESR " TARGET_FMT_lx " DEAR " TARGET_FMT_lx "\n", 8107fbe08667SCédric Le Goater env->spr[SPR_40x_TCR], env->spr[SPR_40x_TSR], 8108fbe08667SCédric Le Goater env->spr[SPR_40x_ESR], env->spr[SPR_40x_DEAR]); 8109fbe08667SCédric Le Goater 8110fbe08667SCédric Le Goater qemu_fprintf(f, " EVPR " TARGET_FMT_lx " SRR2 " TARGET_FMT_lx 8111fbe08667SCédric Le Goater " SRR3 " TARGET_FMT_lx " PID " TARGET_FMT_lx "\n", 8112fbe08667SCédric Le Goater env->spr[SPR_40x_EVPR], env->spr[SPR_40x_SRR2], 8113fbe08667SCédric Le Goater env->spr[SPR_40x_SRR3], env->spr[SPR_40x_PID]); 8114fbe08667SCédric Le Goater break; 8115fbe08667SCédric Le Goater default: 8116fbe08667SCédric Le Goater break; 811747334e17SBruno Larsen (billionai) } 811847334e17SBruno Larsen (billionai) 811947334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64) 812047334e17SBruno Larsen (billionai) if (env->flags & POWERPC_FLAG_CFAR) { 812147334e17SBruno Larsen (billionai) qemu_fprintf(f, " CFAR " TARGET_FMT_lx"\n", env->cfar); 812247334e17SBruno Larsen (billionai) } 812347334e17SBruno Larsen (billionai) #endif 812447334e17SBruno Larsen (billionai) 812547334e17SBruno Larsen (billionai) if (env->spr_cb[SPR_LPCR].name) { 812647334e17SBruno Larsen (billionai) qemu_fprintf(f, " LPCR " TARGET_FMT_lx "\n", env->spr[SPR_LPCR]); 812747334e17SBruno Larsen (billionai) } 812847334e17SBruno Larsen (billionai) 812947334e17SBruno Larsen (billionai) switch (env->mmu_model) { 813047334e17SBruno Larsen (billionai) case POWERPC_MMU_32B: 813147334e17SBruno Larsen (billionai) case POWERPC_MMU_SOFT_6xx: 813247334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64) 813347334e17SBruno Larsen (billionai) case POWERPC_MMU_64B: 813447334e17SBruno Larsen (billionai) case POWERPC_MMU_2_03: 813547334e17SBruno Larsen (billionai) case POWERPC_MMU_2_06: 813647334e17SBruno Larsen (billionai) case POWERPC_MMU_2_07: 813747334e17SBruno Larsen (billionai) case POWERPC_MMU_3_00: 813847334e17SBruno Larsen (billionai) #endif 813947334e17SBruno Larsen (billionai) if (env->spr_cb[SPR_SDR1].name) { /* SDR1 Exists */ 814047334e17SBruno Larsen (billionai) qemu_fprintf(f, " SDR1 " TARGET_FMT_lx " ", env->spr[SPR_SDR1]); 814147334e17SBruno Larsen (billionai) } 814247334e17SBruno Larsen (billionai) if (env->spr_cb[SPR_PTCR].name) { /* PTCR Exists */ 814347334e17SBruno Larsen (billionai) qemu_fprintf(f, " PTCR " TARGET_FMT_lx " ", env->spr[SPR_PTCR]); 814447334e17SBruno Larsen (billionai) } 814547334e17SBruno Larsen (billionai) qemu_fprintf(f, " DAR " TARGET_FMT_lx " DSISR " TARGET_FMT_lx "\n", 814647334e17SBruno Larsen (billionai) env->spr[SPR_DAR], env->spr[SPR_DSISR]); 814747334e17SBruno Larsen (billionai) break; 814847334e17SBruno Larsen (billionai) case POWERPC_MMU_BOOKE206: 814947334e17SBruno Larsen (billionai) qemu_fprintf(f, " MAS0 " TARGET_FMT_lx " MAS1 " TARGET_FMT_lx 815047334e17SBruno Larsen (billionai) " MAS2 " TARGET_FMT_lx " MAS3 " TARGET_FMT_lx "\n", 815147334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_MAS0], env->spr[SPR_BOOKE_MAS1], 815247334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_MAS2], env->spr[SPR_BOOKE_MAS3]); 815347334e17SBruno Larsen (billionai) 815447334e17SBruno Larsen (billionai) qemu_fprintf(f, " MAS4 " TARGET_FMT_lx " MAS6 " TARGET_FMT_lx 815547334e17SBruno Larsen (billionai) " MAS7 " TARGET_FMT_lx " PID " TARGET_FMT_lx "\n", 815647334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_MAS4], env->spr[SPR_BOOKE_MAS6], 815747334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_MAS7], env->spr[SPR_BOOKE_PID]); 815847334e17SBruno Larsen (billionai) 815947334e17SBruno Larsen (billionai) qemu_fprintf(f, "MMUCFG " TARGET_FMT_lx " TLB0CFG " TARGET_FMT_lx 816047334e17SBruno Larsen (billionai) " TLB1CFG " TARGET_FMT_lx "\n", 816147334e17SBruno Larsen (billionai) env->spr[SPR_MMUCFG], env->spr[SPR_BOOKE_TLB0CFG], 816247334e17SBruno Larsen (billionai) env->spr[SPR_BOOKE_TLB1CFG]); 816347334e17SBruno Larsen (billionai) break; 816447334e17SBruno Larsen (billionai) default: 816547334e17SBruno Larsen (billionai) break; 816647334e17SBruno Larsen (billionai) } 816747334e17SBruno Larsen (billionai) #endif 816847334e17SBruno Larsen (billionai) 816947334e17SBruno Larsen (billionai) #undef RGPL 817047334e17SBruno Larsen (billionai) #undef RFPL 817147334e17SBruno Larsen (billionai) } 81723e770bf7SBruno Larsen (billionai) type_init(ppc_cpu_register_types) 8173