xref: /openbmc/qemu/target/ppc/cpu_init.c (revision 395b5d5b)
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"
4799e964efSFabiano Rosas #include "spr_common.h"
488f2e9d40SDaniel Henrique Barboza #include "power8-pmu.h"
493e770bf7SBruno Larsen (billionai) 
50c7e89de1SMurilo Opsfelder Araujo #ifndef CONFIG_USER_ONLY
51c7e89de1SMurilo Opsfelder Araujo #include "hw/boards.h"
52c7e89de1SMurilo Opsfelder Araujo #endif
53c7e89de1SMurilo Opsfelder Araujo 
543e770bf7SBruno Larsen (billionai) /* #define PPC_DEBUG_SPR */
553e770bf7SBruno Larsen (billionai) /* #define USE_APPLE_GDB */
563e770bf7SBruno Larsen (billionai) 
573e770bf7SBruno Larsen (billionai) static inline void vscr_init(CPUPPCState *env, uint32_t val)
583e770bf7SBruno Larsen (billionai) {
593e770bf7SBruno Larsen (billionai)     /* Altivec always uses round-to-nearest */
603e770bf7SBruno Larsen (billionai)     set_float_rounding_mode(float_round_nearest_even, &env->vec_status);
61c19940dbSBruno Larsen (billionai)     ppc_store_vscr(env, val);
623e770bf7SBruno Larsen (billionai) }
633e770bf7SBruno Larsen (billionai) 
64a5d1120bSFabiano Rosas static void register_745_sprs(CPUPPCState *env)
653e770bf7SBruno Larsen (billionai) {
663e770bf7SBruno Larsen (billionai)     /* SGPRs */
673e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
683e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
693e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
703e770bf7SBruno Larsen (billionai)                  0x00000000);
713e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
723e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
733e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
743e770bf7SBruno Larsen (billionai)                  0x00000000);
753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
763e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
773e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
783e770bf7SBruno Larsen (billionai)                  0x00000000);
793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
823e770bf7SBruno Larsen (billionai)                  0x00000000);
83a5d1120bSFabiano Rosas 
84a5d1120bSFabiano Rosas     /* Hardware implementation registers */
85a5d1120bSFabiano Rosas     spr_register(env, SPR_HID0, "HID0",
86a5d1120bSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
87a5d1120bSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
88a5d1120bSFabiano Rosas                  0x00000000);
89a5d1120bSFabiano Rosas 
90a5d1120bSFabiano Rosas     spr_register(env, SPR_HID1, "HID1",
91a5d1120bSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
92a5d1120bSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
93a5d1120bSFabiano Rosas                  0x00000000);
94a5d1120bSFabiano Rosas 
95a5d1120bSFabiano Rosas     spr_register(env, SPR_HID2, "HID2",
96a5d1120bSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
97a5d1120bSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
98a5d1120bSFabiano Rosas                  0x00000000);
993e770bf7SBruno Larsen (billionai) }
1003e770bf7SBruno Larsen (billionai) 
10128930245SFabiano Rosas static void register_755_sprs(CPUPPCState *env)
10228930245SFabiano Rosas {
10328930245SFabiano Rosas     /* L2 cache control */
10428930245SFabiano Rosas     spr_register(env, SPR_L2CR, "L2CR",
10528930245SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
10628930245SFabiano Rosas                  &spr_read_generic, spr_access_nop,
10728930245SFabiano Rosas                  0x00000000);
10828930245SFabiano Rosas 
10928930245SFabiano Rosas     spr_register(env, SPR_L2PMCR, "L2PMCR",
11028930245SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
11128930245SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
11228930245SFabiano Rosas                  0x00000000);
11328930245SFabiano Rosas }
11428930245SFabiano Rosas 
1153e770bf7SBruno Larsen (billionai) /* SPR common to all 7xx PowerPC implementations */
1163e770bf7SBruno Larsen (billionai) static void register_7xx_sprs(CPUPPCState *env)
1173e770bf7SBruno Larsen (billionai) {
1183e770bf7SBruno Larsen (billionai)     /* Breakpoints */
1193e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DABR, "DABR",
1203e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
1213e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
1223e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DABR, 0x00000000);
123acf629ebSFabiano Rosas 
1243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
1253e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1263e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1273e770bf7SBruno Larsen (billionai)                  0x00000000);
1283e770bf7SBruno Larsen (billionai)     /* Cache management */
1293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTC, "ICTC",
1303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1323e770bf7SBruno Larsen (billionai)                  0x00000000);
1333e770bf7SBruno Larsen (billionai)     /* Performance monitors */
1343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_MMCR0, "MMCR0",
1353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1373e770bf7SBruno Larsen (billionai)                  0x00000000);
138acf629ebSFabiano Rosas 
1393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_MMCR1, "MMCR1",
1403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1413e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1423e770bf7SBruno Larsen (billionai)                  0x00000000);
143acf629ebSFabiano Rosas 
1443e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC1, "PMC1",
1453e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1463e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1473e770bf7SBruno Larsen (billionai)                  0x00000000);
148acf629ebSFabiano Rosas 
1493e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC2, "PMC2",
1503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1513e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1523e770bf7SBruno Larsen (billionai)                  0x00000000);
153acf629ebSFabiano Rosas 
1543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC3, "PMC3",
1553e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1563e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1573e770bf7SBruno Larsen (billionai)                  0x00000000);
158acf629ebSFabiano Rosas 
1593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC4, "PMC4",
1603e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1613e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
1623e770bf7SBruno Larsen (billionai)                  0x00000000);
163acf629ebSFabiano Rosas 
1643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_SIAR, "SIAR",
1653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
1673e770bf7SBruno Larsen (billionai)                  0x00000000);
168acf629ebSFabiano Rosas 
1693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UMMCR0, "UMMCR0",
1703e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1713e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1723e770bf7SBruno Larsen (billionai)                  0x00000000);
173acf629ebSFabiano Rosas 
1743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UMMCR1, "UMMCR1",
1753e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1763e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1773e770bf7SBruno Larsen (billionai)                  0x00000000);
178acf629ebSFabiano Rosas 
1793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC1, "UPMC1",
1803e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1813e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1823e770bf7SBruno Larsen (billionai)                  0x00000000);
183acf629ebSFabiano Rosas 
1843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC2, "UPMC2",
1853e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1863e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1873e770bf7SBruno Larsen (billionai)                  0x00000000);
188acf629ebSFabiano Rosas 
1893e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC3, "UPMC3",
1903e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1913e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1923e770bf7SBruno Larsen (billionai)                  0x00000000);
193acf629ebSFabiano Rosas 
1943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC4, "UPMC4",
1953e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1963e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
1973e770bf7SBruno Larsen (billionai)                  0x00000000);
198acf629ebSFabiano Rosas 
1993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_USIAR, "USIAR",
2003e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
2013e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
2023e770bf7SBruno Larsen (billionai)                  0x00000000);
2033e770bf7SBruno Larsen (billionai)     /* External access control */
2043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_EAR, "EAR",
2053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
2073e770bf7SBruno Larsen (billionai)                  0x00000000);
2080301b39cSFabiano Rosas 
2090301b39cSFabiano Rosas     /* Hardware implementation registers */
2100301b39cSFabiano Rosas     spr_register(env, SPR_HID0, "HID0",
2110301b39cSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
2120301b39cSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
2130301b39cSFabiano Rosas                  0x00000000);
2140301b39cSFabiano Rosas 
2150301b39cSFabiano Rosas     spr_register(env, SPR_HID1, "HID1",
2160301b39cSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
2170301b39cSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
2180301b39cSFabiano Rosas                  0x00000000);
2193e770bf7SBruno Larsen (billionai) }
2203e770bf7SBruno Larsen (billionai) 
2213e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64
2223e770bf7SBruno Larsen (billionai) static void register_amr_sprs(CPUPPCState *env)
2233e770bf7SBruno Larsen (billionai) {
2243e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
2253e770bf7SBruno Larsen (billionai)     /*
2263e770bf7SBruno Larsen (billionai)      * Virtual Page Class Key protection
2273e770bf7SBruno Larsen (billionai)      *
2283e770bf7SBruno Larsen (billionai)      * The AMR is accessible either via SPR 13 or SPR 29.  13 is
2293e770bf7SBruno Larsen (billionai)      * userspace accessible, 29 is privileged.  So we only need to set
2303e770bf7SBruno Larsen (billionai)      * the kvm ONE_REG id on one of them, we use 29
2313e770bf7SBruno Larsen (billionai)      */
2323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UAMR, "UAMR",
2333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_amr,
2343e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_amr,
2353e770bf7SBruno Larsen (billionai)                  0);
2363e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_AMR, "AMR",
2373e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
2383e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_amr,
2393e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
2403e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_AMR, 0);
2413e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_UAMOR, "UAMOR",
2423e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
2433e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_uamor,
2443e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
2453e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_UAMOR, 0);
2463e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_AMOR, "AMOR",
2473e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
2483e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
2493e770bf7SBruno Larsen (billionai)                     &spr_read_generic, &spr_write_generic,
2503e770bf7SBruno Larsen (billionai)                     0);
2513e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
2523e770bf7SBruno Larsen (billionai) }
2533e770bf7SBruno Larsen (billionai) 
2543e770bf7SBruno Larsen (billionai) static void register_iamr_sprs(CPUPPCState *env)
2553e770bf7SBruno Larsen (billionai) {
2563e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
2573e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_IAMR, "IAMR",
2583e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
2593e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_iamr,
2603e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_generic,
2613e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_IAMR, 0);
2623e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
2633e770bf7SBruno Larsen (billionai) }
2643e770bf7SBruno Larsen (billionai) #endif /* TARGET_PPC64 */
2653e770bf7SBruno Larsen (billionai) 
2663e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 604 implementation */
2673e770bf7SBruno Larsen (billionai) static void register_604_sprs(CPUPPCState *env)
2683e770bf7SBruno Larsen (billionai) {
2693e770bf7SBruno Larsen (billionai)     /* Processor identification */
2703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_PIR, "PIR",
2713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2723e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
2733e770bf7SBruno Larsen (billionai)                  0x00000000);
2743e770bf7SBruno Larsen (billionai)     /* Breakpoints */
2753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
2763e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2773e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
2783e770bf7SBruno Larsen (billionai)                  0x00000000);
279acf629ebSFabiano Rosas 
2803e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DABR, "DABR",
2813e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
2823e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
2833e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DABR, 0x00000000);
2843e770bf7SBruno Larsen (billionai)     /* Performance counters */
2853e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_MMCR0, "MMCR0",
2863e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2873e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
2883e770bf7SBruno Larsen (billionai)                  0x00000000);
289acf629ebSFabiano Rosas 
2903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC1, "PMC1",
2913e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2923e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
2933e770bf7SBruno Larsen (billionai)                  0x00000000);
294acf629ebSFabiano Rosas 
2953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC2, "PMC2",
2963e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
2973e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
2983e770bf7SBruno Larsen (billionai)                  0x00000000);
299acf629ebSFabiano Rosas 
3003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_SIAR, "SIAR",
3013e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3023e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
3033e770bf7SBruno Larsen (billionai)                  0x00000000);
304acf629ebSFabiano Rosas 
3053e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SDA, "SDA",
3063e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3073e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
3083e770bf7SBruno Larsen (billionai)                  0x00000000);
3093e770bf7SBruno Larsen (billionai)     /* External access control */
3103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_EAR, "EAR",
3113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
3133e770bf7SBruno Larsen (billionai)                  0x00000000);
31420f6fb99SFabiano Rosas 
31520f6fb99SFabiano Rosas     /* Hardware implementation registers */
31620f6fb99SFabiano Rosas     spr_register(env, SPR_HID0, "HID0",
31720f6fb99SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
31820f6fb99SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
31920f6fb99SFabiano Rosas                  0x00000000);
3203e770bf7SBruno Larsen (billionai) }
3213e770bf7SBruno Larsen (billionai) 
3223b18ec76SFabiano Rosas static void register_604e_sprs(CPUPPCState *env)
3233b18ec76SFabiano Rosas {
3243b18ec76SFabiano Rosas     spr_register(env, SPR_7XX_MMCR1, "MMCR1",
3253b18ec76SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
3263b18ec76SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
3273b18ec76SFabiano Rosas                  0x00000000);
3283b18ec76SFabiano Rosas 
3293b18ec76SFabiano Rosas     spr_register(env, SPR_7XX_PMC3, "PMC3",
3303b18ec76SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
3313b18ec76SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
3323b18ec76SFabiano Rosas                  0x00000000);
3333b18ec76SFabiano Rosas 
3343b18ec76SFabiano Rosas     spr_register(env, SPR_7XX_PMC4, "PMC4",
3353b18ec76SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
3363b18ec76SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
3373b18ec76SFabiano Rosas                  0x00000000);
3383b18ec76SFabiano Rosas     /* Hardware implementation registers */
3393b18ec76SFabiano Rosas     spr_register(env, SPR_HID1, "HID1",
3403b18ec76SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
3413b18ec76SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
3423b18ec76SFabiano Rosas                  0x00000000);
3433b18ec76SFabiano Rosas }
3443b18ec76SFabiano Rosas 
3453e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 603 implementation */
3463e770bf7SBruno Larsen (billionai) static void register_603_sprs(CPUPPCState *env)
3473e770bf7SBruno Larsen (billionai) {
3483e770bf7SBruno Larsen (billionai)     /* External access control */
3493e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_EAR, "EAR",
3503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3513e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
3523e770bf7SBruno Larsen (billionai)                  0x00000000);
3533e770bf7SBruno Larsen (billionai)     /* Breakpoints */
3543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
3553e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
3563e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
3573e770bf7SBruno Larsen (billionai)                  0x00000000);
3583e770bf7SBruno Larsen (billionai) 
359d2b29d0aSFabiano Rosas     spr_register(env, SPR_HID0, "HID0",
360d2b29d0aSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
361d2b29d0aSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
362d2b29d0aSFabiano Rosas                  0x00000000);
363d2b29d0aSFabiano Rosas 
364d2b29d0aSFabiano Rosas     spr_register(env, SPR_HID1, "HID1",
365d2b29d0aSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
366d2b29d0aSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
367d2b29d0aSFabiano Rosas                  0x00000000);
3683e770bf7SBruno Larsen (billionai) }
3693e770bf7SBruno Larsen (billionai) 
370a3a27674SFabiano Rosas static void register_e300_sprs(CPUPPCState *env)
371a3a27674SFabiano Rosas {
372a3a27674SFabiano Rosas     /* hardware implementation registers */
373a3a27674SFabiano Rosas     spr_register(env, SPR_HID2, "HID2",
374a3a27674SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
375a3a27674SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
376a3a27674SFabiano Rosas                  0x00000000);
377a3a27674SFabiano Rosas     /* Breakpoints */
378a3a27674SFabiano Rosas     spr_register(env, SPR_DABR, "DABR",
379a3a27674SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
380a3a27674SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
381a3a27674SFabiano Rosas                  0x00000000);
382a3a27674SFabiano Rosas 
383a3a27674SFabiano Rosas     spr_register(env, SPR_DABR2, "DABR2",
384a3a27674SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
385a3a27674SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
386a3a27674SFabiano Rosas                  0x00000000);
387a3a27674SFabiano Rosas 
388a3a27674SFabiano Rosas     spr_register(env, SPR_IABR2, "IABR2",
389a3a27674SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
390a3a27674SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
391a3a27674SFabiano Rosas                  0x00000000);
392a3a27674SFabiano Rosas 
393a3a27674SFabiano Rosas     spr_register(env, SPR_IBCR, "IBCR",
394a3a27674SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
395a3a27674SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
396a3a27674SFabiano Rosas                  0x00000000);
397a3a27674SFabiano Rosas 
398a3a27674SFabiano Rosas     spr_register(env, SPR_DBCR, "DBCR",
399a3a27674SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
400a3a27674SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
401a3a27674SFabiano Rosas                  0x00000000);
402a3a27674SFabiano Rosas }
403a3a27674SFabiano Rosas 
4043e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC G2 implementation */
4053e770bf7SBruno Larsen (billionai) static void register_G2_sprs(CPUPPCState *env)
4063e770bf7SBruno Larsen (billionai) {
4073e770bf7SBruno Larsen (billionai)     /* Memory base address */
4083e770bf7SBruno Larsen (billionai)     /* MBAR */
4093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MBAR, "MBAR",
4103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4123e770bf7SBruno Larsen (billionai)                  0x00000000);
4133e770bf7SBruno Larsen (billionai)     /* Exception processing */
4143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_CSRR0, "CSRR0",
4153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4173e770bf7SBruno Larsen (billionai)                  0x00000000);
4183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_CSRR1, "CSRR1",
4193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4213e770bf7SBruno Larsen (billionai)                  0x00000000);
4223e770bf7SBruno Larsen (billionai)     /* Breakpoints */
4233e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DABR, "DABR",
4243e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4253e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4263e770bf7SBruno Larsen (billionai)                  0x00000000);
427acf629ebSFabiano Rosas 
4283e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DABR2, "DABR2",
4293e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4303e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4313e770bf7SBruno Larsen (billionai)                  0x00000000);
432acf629ebSFabiano Rosas 
4333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
4343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4363e770bf7SBruno Larsen (billionai)                  0x00000000);
437acf629ebSFabiano Rosas 
4383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR2, "IABR2",
4393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4413e770bf7SBruno Larsen (billionai)                  0x00000000);
442acf629ebSFabiano Rosas 
4433e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IBCR, "IBCR",
4443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4463e770bf7SBruno Larsen (billionai)                  0x00000000);
447acf629ebSFabiano Rosas 
4483e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DBCR, "DBCR",
4493e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
4503e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
4513e770bf7SBruno Larsen (billionai)                  0x00000000);
452e599bcedSFabiano Rosas 
453e599bcedSFabiano Rosas     /* External access control */
454e599bcedSFabiano Rosas     spr_register(env, SPR_EAR, "EAR",
455e599bcedSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
456e599bcedSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
457e599bcedSFabiano Rosas                  0x00000000);
458e599bcedSFabiano Rosas     /* Hardware implementation register */
459e599bcedSFabiano Rosas     spr_register(env, SPR_HID0, "HID0",
460e599bcedSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
461e599bcedSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
462e599bcedSFabiano Rosas                  0x00000000);
463e599bcedSFabiano Rosas 
464e599bcedSFabiano Rosas     spr_register(env, SPR_HID1, "HID1",
465e599bcedSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
466e599bcedSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
467e599bcedSFabiano Rosas                  0x00000000);
468e599bcedSFabiano Rosas 
469e599bcedSFabiano Rosas     spr_register(env, SPR_HID2, "HID2",
470e599bcedSFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
471e599bcedSFabiano Rosas                  &spr_read_generic, &spr_write_generic,
472e599bcedSFabiano Rosas                  0x00000000);
473e599bcedSFabiano Rosas 
4741a71c5d1SFabiano Rosas     /* SGPRs */
4751a71c5d1SFabiano Rosas     spr_register(env, SPR_SPRG4, "SPRG4",
4761a71c5d1SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
4771a71c5d1SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
4781a71c5d1SFabiano Rosas                  0x00000000);
4791a71c5d1SFabiano Rosas     spr_register(env, SPR_SPRG5, "SPRG5",
4801a71c5d1SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
4811a71c5d1SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
4821a71c5d1SFabiano Rosas                  0x00000000);
4831a71c5d1SFabiano Rosas     spr_register(env, SPR_SPRG6, "SPRG6",
4841a71c5d1SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
4851a71c5d1SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
4861a71c5d1SFabiano Rosas                  0x00000000);
4871a71c5d1SFabiano Rosas     spr_register(env, SPR_SPRG7, "SPRG7",
4881a71c5d1SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
4891a71c5d1SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
4901a71c5d1SFabiano Rosas                  0x00000000);
4913e770bf7SBruno Larsen (billionai) }
4923e770bf7SBruno Larsen (billionai) 
4933e770bf7SBruno Larsen (billionai) static void register_74xx_sprs(CPUPPCState *env)
4943e770bf7SBruno Larsen (billionai) {
495674f4509SFabiano Rosas     /* Breakpoints */
496674f4509SFabiano Rosas     spr_register_kvm(env, SPR_DABR, "DABR",
497674f4509SFabiano Rosas                      SPR_NOACCESS, SPR_NOACCESS,
498674f4509SFabiano Rosas                      &spr_read_generic, &spr_write_generic,
499674f4509SFabiano Rosas                      KVM_REG_PPC_DABR, 0x00000000);
500674f4509SFabiano Rosas 
501674f4509SFabiano Rosas     spr_register(env, SPR_IABR, "IABR",
502674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
503674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
504674f4509SFabiano Rosas                  0x00000000);
505674f4509SFabiano Rosas     /* Cache management */
506674f4509SFabiano Rosas     spr_register(env, SPR_ICTC, "ICTC",
507674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
508674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
509674f4509SFabiano Rosas                  0x00000000);
510674f4509SFabiano Rosas     /* Performance monitors */
511674f4509SFabiano Rosas     spr_register(env, SPR_7XX_MMCR0, "MMCR0",
512674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
513674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
514674f4509SFabiano Rosas                  0x00000000);
515674f4509SFabiano Rosas 
516674f4509SFabiano Rosas     spr_register(env, SPR_7XX_MMCR1, "MMCR1",
517674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
518674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
519674f4509SFabiano Rosas                  0x00000000);
520674f4509SFabiano Rosas 
521674f4509SFabiano Rosas     spr_register(env, SPR_7XX_PMC1, "PMC1",
522674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
523674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
524674f4509SFabiano Rosas                  0x00000000);
525674f4509SFabiano Rosas 
526674f4509SFabiano Rosas     spr_register(env, SPR_7XX_PMC2, "PMC2",
527674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
528674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
529674f4509SFabiano Rosas                  0x00000000);
530674f4509SFabiano Rosas 
531674f4509SFabiano Rosas     spr_register(env, SPR_7XX_PMC3, "PMC3",
532674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
533674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
534674f4509SFabiano Rosas                  0x00000000);
535674f4509SFabiano Rosas 
536674f4509SFabiano Rosas     spr_register(env, SPR_7XX_PMC4, "PMC4",
537674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
538674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
539674f4509SFabiano Rosas                  0x00000000);
540674f4509SFabiano Rosas 
541674f4509SFabiano Rosas     spr_register(env, SPR_7XX_SIAR, "SIAR",
542674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
543674f4509SFabiano Rosas                  &spr_read_generic, SPR_NOACCESS,
544674f4509SFabiano Rosas                  0x00000000);
545674f4509SFabiano Rosas 
546674f4509SFabiano Rosas     spr_register(env, SPR_7XX_UMMCR0, "UMMCR0",
547674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
548674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
549674f4509SFabiano Rosas                  0x00000000);
550674f4509SFabiano Rosas 
551674f4509SFabiano Rosas     spr_register(env, SPR_7XX_UMMCR1, "UMMCR1",
552674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
553674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
554674f4509SFabiano Rosas                  0x00000000);
555674f4509SFabiano Rosas 
556674f4509SFabiano Rosas     spr_register(env, SPR_7XX_UPMC1, "UPMC1",
557674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
558674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
559674f4509SFabiano Rosas                  0x00000000);
560674f4509SFabiano Rosas 
561674f4509SFabiano Rosas     spr_register(env, SPR_7XX_UPMC2, "UPMC2",
562674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
563674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
564674f4509SFabiano Rosas                  0x00000000);
565674f4509SFabiano Rosas 
566674f4509SFabiano Rosas     spr_register(env, SPR_7XX_UPMC3, "UPMC3",
567674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
568674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
569674f4509SFabiano Rosas                  0x00000000);
570674f4509SFabiano Rosas 
571674f4509SFabiano Rosas     spr_register(env, SPR_7XX_UPMC4, "UPMC4",
572674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
573674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
574674f4509SFabiano Rosas                  0x00000000);
575674f4509SFabiano Rosas 
576674f4509SFabiano Rosas     spr_register(env, SPR_7XX_USIAR, "USIAR",
577674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
578674f4509SFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
579674f4509SFabiano Rosas                  0x00000000);
580674f4509SFabiano Rosas     /* External access control */
581674f4509SFabiano Rosas     spr_register(env, SPR_EAR, "EAR",
582674f4509SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
583674f4509SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
584674f4509SFabiano Rosas                  0x00000000);
585674f4509SFabiano Rosas 
5863e770bf7SBruno Larsen (billionai)     /* Processor identification */
5873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_PIR, "PIR",
5883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
5903e770bf7SBruno Larsen (billionai)                  0x00000000);
591acf629ebSFabiano Rosas 
5923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_74XX_MMCR2, "MMCR2",
5933e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
5943e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
5953e770bf7SBruno Larsen (billionai)                  0x00000000);
596acf629ebSFabiano Rosas 
5973e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_74XX_UMMCR2, "UMMCR2",
5983e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
5993e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
6003e770bf7SBruno Larsen (billionai)                  0x00000000);
601acf629ebSFabiano Rosas 
6023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BAMR, "BAMR",
6033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6043e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6053e770bf7SBruno Larsen (billionai)                  0x00000000);
606acf629ebSFabiano Rosas 
6073e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSCR0, "MSSCR0",
6083e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6093e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6103e770bf7SBruno Larsen (billionai)                  0x00000000);
6113e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
6123e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
6133e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6143e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6153e770bf7SBruno Larsen (billionai)                  0x00000000);
616acf629ebSFabiano Rosas 
6173e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
6183e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6193e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6203e770bf7SBruno Larsen (billionai)                  0x00000000);
6213e770bf7SBruno Larsen (billionai)     /* Altivec */
6223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_VRSAVE, "VRSAVE",
6233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6243e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6253e770bf7SBruno Larsen (billionai)                  0x00000000);
626acf629ebSFabiano Rosas 
6273e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
6283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6293e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
6303e770bf7SBruno Larsen (billionai)                  0x00000000);
6313e770bf7SBruno Larsen (billionai) }
6323e770bf7SBruno Larsen (billionai) 
6333e770bf7SBruno Larsen (billionai) static void register_l3_ctrl(CPUPPCState *env)
6343e770bf7SBruno Larsen (billionai) {
6353e770bf7SBruno Larsen (billionai)     /* L3CR */
6363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3CR, "L3CR",
6373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6383e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6393e770bf7SBruno Larsen (billionai)                  0x00000000);
6403e770bf7SBruno Larsen (billionai)     /* L3ITCR0 */
6413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR0, "L3ITCR0",
6423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6443e770bf7SBruno Larsen (billionai)                  0x00000000);
6453e770bf7SBruno Larsen (billionai)     /* L3PM */
6463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3PM, "L3PM",
6473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6493e770bf7SBruno Larsen (billionai)                  0x00000000);
6503e770bf7SBruno Larsen (billionai) }
6513e770bf7SBruno Larsen (billionai) 
6523e770bf7SBruno Larsen (billionai) /* PowerPC BookE SPR */
6533e770bf7SBruno Larsen (billionai) static void register_BookE_sprs(CPUPPCState *env, uint64_t ivor_mask)
6543e770bf7SBruno Larsen (billionai) {
6553e770bf7SBruno Larsen (billionai)     const char *ivor_names[64] = {
6563e770bf7SBruno Larsen (billionai)         "IVOR0",  "IVOR1",  "IVOR2",  "IVOR3",
6573e770bf7SBruno Larsen (billionai)         "IVOR4",  "IVOR5",  "IVOR6",  "IVOR7",
6583e770bf7SBruno Larsen (billionai)         "IVOR8",  "IVOR9",  "IVOR10", "IVOR11",
6593e770bf7SBruno Larsen (billionai)         "IVOR12", "IVOR13", "IVOR14", "IVOR15",
6603e770bf7SBruno Larsen (billionai)         "IVOR16", "IVOR17", "IVOR18", "IVOR19",
6613e770bf7SBruno Larsen (billionai)         "IVOR20", "IVOR21", "IVOR22", "IVOR23",
6623e770bf7SBruno Larsen (billionai)         "IVOR24", "IVOR25", "IVOR26", "IVOR27",
6633e770bf7SBruno Larsen (billionai)         "IVOR28", "IVOR29", "IVOR30", "IVOR31",
6643e770bf7SBruno Larsen (billionai)         "IVOR32", "IVOR33", "IVOR34", "IVOR35",
6653e770bf7SBruno Larsen (billionai)         "IVOR36", "IVOR37", "IVOR38", "IVOR39",
6663e770bf7SBruno Larsen (billionai)         "IVOR40", "IVOR41", "IVOR42", "IVOR43",
6673e770bf7SBruno Larsen (billionai)         "IVOR44", "IVOR45", "IVOR46", "IVOR47",
6683e770bf7SBruno Larsen (billionai)         "IVOR48", "IVOR49", "IVOR50", "IVOR51",
6693e770bf7SBruno Larsen (billionai)         "IVOR52", "IVOR53", "IVOR54", "IVOR55",
6703e770bf7SBruno Larsen (billionai)         "IVOR56", "IVOR57", "IVOR58", "IVOR59",
6713e770bf7SBruno Larsen (billionai)         "IVOR60", "IVOR61", "IVOR62", "IVOR63",
6723e770bf7SBruno Larsen (billionai)     };
6733e770bf7SBruno Larsen (billionai) #define SPR_BOOKE_IVORxx (-1)
6743e770bf7SBruno Larsen (billionai)     int ivor_sprn[64] = {
6753e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR0,  SPR_BOOKE_IVOR1,  SPR_BOOKE_IVOR2,  SPR_BOOKE_IVOR3,
6763e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR4,  SPR_BOOKE_IVOR5,  SPR_BOOKE_IVOR6,  SPR_BOOKE_IVOR7,
6773e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR8,  SPR_BOOKE_IVOR9,  SPR_BOOKE_IVOR10, SPR_BOOKE_IVOR11,
6783e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR12, SPR_BOOKE_IVOR13, SPR_BOOKE_IVOR14, SPR_BOOKE_IVOR15,
6793e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6803e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6813e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6823e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6833e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR32, SPR_BOOKE_IVOR33, SPR_BOOKE_IVOR34, SPR_BOOKE_IVOR35,
6843e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR36, SPR_BOOKE_IVOR37, SPR_BOOKE_IVOR38, SPR_BOOKE_IVOR39,
6853e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVOR40, SPR_BOOKE_IVOR41, SPR_BOOKE_IVOR42, SPR_BOOKE_IVORxx,
6863e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6873e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6883e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6893e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6903e770bf7SBruno Larsen (billionai)         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
6913e770bf7SBruno Larsen (billionai)     };
6923e770bf7SBruno Larsen (billionai)     int i;
6933e770bf7SBruno Larsen (billionai) 
6943e770bf7SBruno Larsen (billionai)     /* Interrupt processing */
6953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_CSRR0, "CSRR0",
6963e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
6973e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
6983e770bf7SBruno Larsen (billionai)                  0x00000000);
6993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_CSRR1, "CSRR1",
7003e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7013e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7023e770bf7SBruno Larsen (billionai)                  0x00000000);
7033e770bf7SBruno Larsen (billionai)     /* Debug */
7043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC1, "IAC1",
7053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7073e770bf7SBruno Larsen (billionai)                  0x00000000);
708acf629ebSFabiano Rosas 
7093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC2, "IAC2",
7103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7123e770bf7SBruno Larsen (billionai)                  0x00000000);
713acf629ebSFabiano Rosas 
7143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DAC1, "DAC1",
7153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7173e770bf7SBruno Larsen (billionai)                  0x00000000);
718acf629ebSFabiano Rosas 
7193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DAC2, "DAC2",
7203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7223e770bf7SBruno Larsen (billionai)                  0x00000000);
723acf629ebSFabiano Rosas 
7243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DBCR0, "DBCR0",
7253e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7263e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_40x_dbcr0,
7273e770bf7SBruno Larsen (billionai)                  0x00000000);
728acf629ebSFabiano Rosas 
7293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DBCR1, "DBCR1",
7303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7323e770bf7SBruno Larsen (billionai)                  0x00000000);
733acf629ebSFabiano Rosas 
7343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DBCR2, "DBCR2",
7353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7373e770bf7SBruno Larsen (billionai)                  0x00000000);
7383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DSRR0, "DSRR0",
7393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7413e770bf7SBruno Larsen (billionai)                  0x00000000);
7423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DSRR1, "DSRR1",
7433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7453e770bf7SBruno Larsen (billionai)                  0x00000000);
746acf629ebSFabiano Rosas 
7473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DBSR, "DBSR",
7483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_clear,
7503e770bf7SBruno Larsen (billionai)                  0x00000000);
7513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DEAR, "DEAR",
7523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7543e770bf7SBruno Larsen (billionai)                  0x00000000);
7553e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ESR, "ESR",
7563e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7573e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
7583e770bf7SBruno Larsen (billionai)                  0x00000000);
7593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IVPR, "IVPR",
7603e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7613e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_excp_prefix,
7623e770bf7SBruno Larsen (billionai)                  0x00000000);
7633e770bf7SBruno Larsen (billionai)     /* Exception vectors */
7643e770bf7SBruno Larsen (billionai)     for (i = 0; i < 64; i++) {
7653e770bf7SBruno Larsen (billionai)         if (ivor_mask & (1ULL << i)) {
7663e770bf7SBruno Larsen (billionai)             if (ivor_sprn[i] == SPR_BOOKE_IVORxx) {
7673e770bf7SBruno Larsen (billionai)                 fprintf(stderr, "ERROR: IVOR %d SPR is not defined\n", i);
7683e770bf7SBruno Larsen (billionai)                 exit(1);
7693e770bf7SBruno Larsen (billionai)             }
7703e770bf7SBruno Larsen (billionai)             spr_register(env, ivor_sprn[i], ivor_names[i],
7713e770bf7SBruno Larsen (billionai)                          SPR_NOACCESS, SPR_NOACCESS,
7723e770bf7SBruno Larsen (billionai)                          &spr_read_generic, &spr_write_excp_vector,
7733e770bf7SBruno Larsen (billionai)                          0x00000000);
7743e770bf7SBruno Larsen (billionai)         }
7753e770bf7SBruno Larsen (billionai)     }
7763e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_PID, "PID",
7773e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7783e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_booke_pid,
7793e770bf7SBruno Larsen (billionai)                  0x00000000);
7803e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_TCR, "TCR",
7813e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7823e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_booke_tcr,
7833e770bf7SBruno Larsen (billionai)                  0x00000000);
7843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_TSR, "TSR",
7853e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7863e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_booke_tsr,
7873e770bf7SBruno Larsen (billionai)                  0x00000000);
7883e770bf7SBruno Larsen (billionai)     /* Timer */
7893e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DECR, "DECR",
7903e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7913e770bf7SBruno Larsen (billionai)                  &spr_read_decr, &spr_write_decr,
7923e770bf7SBruno Larsen (billionai)                  0x00000000);
7933e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DECAR, "DECAR",
7943e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
7953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, &spr_write_generic,
7963e770bf7SBruno Larsen (billionai)                  0x00000000);
7973e770bf7SBruno Larsen (billionai)     /* SPRGs */
7983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG0, "USPRG0",
7993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8013e770bf7SBruno Larsen (billionai)                  0x00000000);
8023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
8033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8043e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8053e770bf7SBruno Larsen (billionai)                  0x00000000);
8063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
8073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8083e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8093e770bf7SBruno Larsen (billionai)                  0x00000000);
8103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
8113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8133e770bf7SBruno Larsen (billionai)                  0x00000000);
8143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
8153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8173e770bf7SBruno Larsen (billionai)                  0x00000000);
8183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_SPRG8, "SPRG8",
8193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8213e770bf7SBruno Larsen (billionai)                  0x00000000);
8223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_SPRG9, "SPRG9",
8233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8243e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
8253e770bf7SBruno Larsen (billionai)                  0x00000000);
8263e770bf7SBruno Larsen (billionai) }
8273e770bf7SBruno Larsen (billionai) 
8283e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
8293e770bf7SBruno Larsen (billionai) static inline uint32_t register_tlbncfg(uint32_t assoc, uint32_t minsize,
8303e770bf7SBruno Larsen (billionai)                                    uint32_t maxsize, uint32_t flags,
8313e770bf7SBruno Larsen (billionai)                                    uint32_t nentries)
8323e770bf7SBruno Larsen (billionai) {
8333e770bf7SBruno Larsen (billionai)     return (assoc << TLBnCFG_ASSOC_SHIFT) |
8343e770bf7SBruno Larsen (billionai)            (minsize << TLBnCFG_MINSIZE_SHIFT) |
8353e770bf7SBruno Larsen (billionai)            (maxsize << TLBnCFG_MAXSIZE_SHIFT) |
8363e770bf7SBruno Larsen (billionai)            flags | nentries;
8373e770bf7SBruno Larsen (billionai) }
8383e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
8393e770bf7SBruno Larsen (billionai) 
8403e770bf7SBruno Larsen (billionai) /* BookE 2.06 storage control registers */
8413e770bf7SBruno Larsen (billionai) static void register_BookE206_sprs(CPUPPCState *env, uint32_t mas_mask,
8423e770bf7SBruno Larsen (billionai)                              uint32_t *tlbncfg, uint32_t mmucfg)
8433e770bf7SBruno Larsen (billionai) {
8443e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
8453e770bf7SBruno Larsen (billionai)     const char *mas_names[8] = {
8463e770bf7SBruno Larsen (billionai)         "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
8473e770bf7SBruno Larsen (billionai)     };
8483e770bf7SBruno Larsen (billionai)     int mas_sprn[8] = {
8493e770bf7SBruno Larsen (billionai)         SPR_BOOKE_MAS0, SPR_BOOKE_MAS1, SPR_BOOKE_MAS2, SPR_BOOKE_MAS3,
8503e770bf7SBruno Larsen (billionai)         SPR_BOOKE_MAS4, SPR_BOOKE_MAS5, SPR_BOOKE_MAS6, SPR_BOOKE_MAS7,
8513e770bf7SBruno Larsen (billionai)     };
8523e770bf7SBruno Larsen (billionai)     int i;
8533e770bf7SBruno Larsen (billionai) 
8543e770bf7SBruno Larsen (billionai)     /* TLB assist registers */
8553e770bf7SBruno Larsen (billionai)     for (i = 0; i < 8; i++) {
8563e770bf7SBruno Larsen (billionai)         if (mas_mask & (1 << i)) {
8573e770bf7SBruno Larsen (billionai)             spr_register(env, mas_sprn[i], mas_names[i],
8583e770bf7SBruno Larsen (billionai)                          SPR_NOACCESS, SPR_NOACCESS,
85952e9612eSBruno Larsen (billionai)                          &spr_read_generic,
86052e9612eSBruno Larsen (billionai)                          (i == 2 && (env->insns_flags & PPC_64B))
86152e9612eSBruno Larsen (billionai)                          ? &spr_write_generic : &spr_write_generic32,
8623e770bf7SBruno Larsen (billionai)                          0x00000000);
8633e770bf7SBruno Larsen (billionai)         }
8643e770bf7SBruno Larsen (billionai)     }
8653e770bf7SBruno Larsen (billionai)     if (env->nb_pids > 1) {
8663e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_PID1, "PID1",
8673e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
8683e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_booke_pid,
8693e770bf7SBruno Larsen (billionai)                      0x00000000);
8703e770bf7SBruno Larsen (billionai)     }
8713e770bf7SBruno Larsen (billionai)     if (env->nb_pids > 2) {
8723e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_PID2, "PID2",
8733e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
8743e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_booke_pid,
8753e770bf7SBruno Larsen (billionai)                      0x00000000);
8763e770bf7SBruno Larsen (billionai)     }
8773e770bf7SBruno Larsen (billionai) 
8783e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_EPLC, "EPLC",
8793e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8803e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_eplc,
8813e770bf7SBruno Larsen (billionai)                  0x00000000);
8823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_EPSC, "EPSC",
8833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_epsc,
8853e770bf7SBruno Larsen (billionai)                  0x00000000);
8863e770bf7SBruno Larsen (billionai) 
8873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MMUCFG, "MMUCFG",
8883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
8893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
8903e770bf7SBruno Larsen (billionai)                  mmucfg);
8913e770bf7SBruno Larsen (billionai)     switch (env->nb_ways) {
8923e770bf7SBruno Larsen (billionai)     case 4:
8933e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB3CFG, "TLB3CFG",
8943e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
8953e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
8963e770bf7SBruno Larsen (billionai)                      tlbncfg[3]);
8973e770bf7SBruno Larsen (billionai)         /* Fallthru */
8983e770bf7SBruno Larsen (billionai)     case 3:
8993e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB2CFG, "TLB2CFG",
9003e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
9013e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
9023e770bf7SBruno Larsen (billionai)                      tlbncfg[2]);
9033e770bf7SBruno Larsen (billionai)         /* Fallthru */
9043e770bf7SBruno Larsen (billionai)     case 2:
9053e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
9063e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
9073e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
9083e770bf7SBruno Larsen (billionai)                      tlbncfg[1]);
9093e770bf7SBruno Larsen (billionai)         /* Fallthru */
9103e770bf7SBruno Larsen (billionai)     case 1:
9113e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
9123e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
9133e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
9143e770bf7SBruno Larsen (billionai)                      tlbncfg[0]);
9153e770bf7SBruno Larsen (billionai)         /* Fallthru */
9163e770bf7SBruno Larsen (billionai)     case 0:
9173e770bf7SBruno Larsen (billionai)     default:
9183e770bf7SBruno Larsen (billionai)         break;
9193e770bf7SBruno Larsen (billionai)     }
9203e770bf7SBruno Larsen (billionai) #endif
9213e770bf7SBruno Larsen (billionai) }
9223e770bf7SBruno Larsen (billionai) 
9233e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 440 implementation */
9243e770bf7SBruno Larsen (billionai) static void register_440_sprs(CPUPPCState *env)
9253e770bf7SBruno Larsen (billionai) {
9263e770bf7SBruno Larsen (billionai)     /* Cache control */
9273e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DNV0, "DNV0",
9283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9293e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9303e770bf7SBruno Larsen (billionai)                  0x00000000);
931acf629ebSFabiano Rosas 
9323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DNV1, "DNV1",
9333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9343e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9353e770bf7SBruno Larsen (billionai)                  0x00000000);
936acf629ebSFabiano Rosas 
9373e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DNV2, "DNV2",
9383e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9393e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9403e770bf7SBruno Larsen (billionai)                  0x00000000);
941acf629ebSFabiano Rosas 
9423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DNV3, "DNV3",
9433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9453e770bf7SBruno Larsen (billionai)                  0x00000000);
946acf629ebSFabiano Rosas 
9473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DTV0, "DTV0",
9483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9503e770bf7SBruno Larsen (billionai)                  0x00000000);
951acf629ebSFabiano Rosas 
9523e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DTV1, "DTV1",
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_440_DTV2, "DTV2",
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_440_DTV3, "DTV3",
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_440_DVLIM, "DVLIM",
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_440_INV0, "INV0",
9733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9743e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9753e770bf7SBruno Larsen (billionai)                  0x00000000);
976acf629ebSFabiano Rosas 
9773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_INV1, "INV1",
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_440_INV2, "INV2",
9833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9853e770bf7SBruno Larsen (billionai)                  0x00000000);
986acf629ebSFabiano Rosas 
9873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_INV3, "INV3",
9883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9903e770bf7SBruno Larsen (billionai)                  0x00000000);
991acf629ebSFabiano Rosas 
9923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_ITV0, "ITV0",
9933e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9943e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
9953e770bf7SBruno Larsen (billionai)                  0x00000000);
996acf629ebSFabiano Rosas 
9973e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_ITV1, "ITV1",
9983e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
9993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10003e770bf7SBruno Larsen (billionai)                  0x00000000);
1001acf629ebSFabiano Rosas 
10023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_ITV2, "ITV2",
10033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10043e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10053e770bf7SBruno Larsen (billionai)                  0x00000000);
1006acf629ebSFabiano Rosas 
10073e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_ITV3, "ITV3",
10083e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10093e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10103e770bf7SBruno Larsen (billionai)                  0x00000000);
1011acf629ebSFabiano Rosas 
10123e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_IVLIM, "IVLIM",
10133e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10143e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10153e770bf7SBruno Larsen (billionai)                  0x00000000);
10163e770bf7SBruno Larsen (billionai)     /* Cache debug */
10173e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DCDBTRH, "DCDBTRH",
10183e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10193e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
10203e770bf7SBruno Larsen (billionai)                  0x00000000);
1021acf629ebSFabiano Rosas 
10223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DCDBTRL, "DCDBTRL",
10233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10243e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
10253e770bf7SBruno Larsen (billionai)                  0x00000000);
1026acf629ebSFabiano Rosas 
10273e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR",
10283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10293e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
10303e770bf7SBruno Larsen (billionai)                  0x00000000);
1031acf629ebSFabiano Rosas 
10323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ICDBTRH, "ICDBTRH",
10333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10343e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
10353e770bf7SBruno Larsen (billionai)                  0x00000000);
1036acf629ebSFabiano Rosas 
10373e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ICDBTRL, "ICDBTRL",
10383e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10393e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
10403e770bf7SBruno Larsen (billionai)                  0x00000000);
1041acf629ebSFabiano Rosas 
10423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_DBDR, "DBDR",
10433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10453e770bf7SBruno Larsen (billionai)                  0x00000000);
10463e770bf7SBruno Larsen (billionai)     /* Processor control */
10473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_4xx_CCR0, "CCR0",
10483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10503e770bf7SBruno Larsen (billionai)                  0x00000000);
10513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_RSTCFG, "RSTCFG",
10523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
10543e770bf7SBruno Larsen (billionai)                  0x00000000);
10553e770bf7SBruno Larsen (billionai)     /* Storage control */
10563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_MMUCR, "MMUCR",
10573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10593e770bf7SBruno Larsen (billionai)                  0x00000000);
106049ed82b2SFabiano Rosas 
106149ed82b2SFabiano Rosas     /* Processor identification */
106249ed82b2SFabiano Rosas     spr_register(env, SPR_BOOKE_PIR, "PIR",
106349ed82b2SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
106449ed82b2SFabiano Rosas                  &spr_read_generic, &spr_write_pir,
106549ed82b2SFabiano Rosas                  0x00000000);
106649ed82b2SFabiano Rosas 
106749ed82b2SFabiano Rosas     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
106849ed82b2SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
106949ed82b2SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
107049ed82b2SFabiano Rosas                  0x00000000);
107149ed82b2SFabiano Rosas 
107249ed82b2SFabiano Rosas     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
107349ed82b2SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
107449ed82b2SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
107549ed82b2SFabiano Rosas                  0x00000000);
107649ed82b2SFabiano Rosas 
107749ed82b2SFabiano Rosas     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
107849ed82b2SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
107949ed82b2SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
108049ed82b2SFabiano Rosas                  0x00000000);
108149ed82b2SFabiano Rosas 
108249ed82b2SFabiano Rosas     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
108349ed82b2SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
108449ed82b2SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
108549ed82b2SFabiano Rosas                  0x00000000);
10863e770bf7SBruno Larsen (billionai) }
10873e770bf7SBruno Larsen (billionai) 
10883e770bf7SBruno Larsen (billionai) /* SPR shared between PowerPC 40x implementations */
10893e770bf7SBruno Larsen (billionai) static void register_40x_sprs(CPUPPCState *env)
10903e770bf7SBruno Larsen (billionai) {
10913e770bf7SBruno Larsen (billionai)     /* Cache */
10923e770bf7SBruno Larsen (billionai)     /* not emulated, as QEMU do not emulate caches */
10933e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DCCR, "DCCR",
10943e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
10953e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
10963e770bf7SBruno Larsen (billionai)                  0x00000000);
10973e770bf7SBruno Larsen (billionai)     /* not emulated, as QEMU do not emulate caches */
10983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_ICCR, "ICCR",
10993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11013e770bf7SBruno Larsen (billionai)                  0x00000000);
11023e770bf7SBruno Larsen (billionai)     /* not emulated, as QEMU do not emulate caches */
11033e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR",
11043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
11063e770bf7SBruno Larsen (billionai)                  0x00000000);
11073e770bf7SBruno Larsen (billionai)     /* Exception */
11083e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DEAR, "DEAR",
11093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11113e770bf7SBruno Larsen (billionai)                  0x00000000);
11123e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_ESR, "ESR",
11133e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11143e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11153e770bf7SBruno Larsen (billionai)                  0x00000000);
11163e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_EVPR, "EVPR",
11173e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11183e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_excp_prefix,
11193e770bf7SBruno Larsen (billionai)                  0x00000000);
11203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_SRR2, "SRR2",
11213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11223e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11233e770bf7SBruno Larsen (billionai)                  0x00000000);
11243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_SRR3, "SRR3",
11253e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11263e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11273e770bf7SBruno Larsen (billionai)                  0x00000000);
11283e770bf7SBruno Larsen (billionai)     /* Timers */
11293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_PIT, "PIT",
11303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11313e770bf7SBruno Larsen (billionai)                  &spr_read_40x_pit, &spr_write_40x_pit,
11323e770bf7SBruno Larsen (billionai)                  0x00000000);
11333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_TCR, "TCR",
11343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1135cbd8f17dSCédric Le Goater                  &spr_read_generic, &spr_write_40x_tcr,
11363e770bf7SBruno Larsen (billionai)                  0x00000000);
11373e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_TSR, "TSR",
11383e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1139cbd8f17dSCédric Le Goater                  &spr_read_generic, &spr_write_40x_tsr,
11403e770bf7SBruno Larsen (billionai)                  0x00000000);
11413e770bf7SBruno Larsen (billionai) }
11423e770bf7SBruno Larsen (billionai) 
11433e770bf7SBruno Larsen (billionai) /* SPR specific to PowerPC 405 implementation */
11443e770bf7SBruno Larsen (billionai) static void register_405_sprs(CPUPPCState *env)
11453e770bf7SBruno Larsen (billionai) {
11463e770bf7SBruno Larsen (billionai)     /* MMU */
11473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_PID, "PID",
11483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
1149dd69d140SCédric Le Goater                  &spr_read_generic, &spr_write_40x_pid,
11503e770bf7SBruno Larsen (billionai)                  0x00000000);
11513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_4xx_CCR0, "CCR0",
11523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11543e770bf7SBruno Larsen (billionai)                  0x00700000);
11553e770bf7SBruno Larsen (billionai)     /* Debug interface */
11563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DBCR0, "DBCR0",
11573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_40x_dbcr0,
11593e770bf7SBruno Larsen (billionai)                  0x00000000);
1160acf629ebSFabiano Rosas 
11613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_DBCR1, "DBCR1",
11623e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11633e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11643e770bf7SBruno Larsen (billionai)                  0x00000000);
1165acf629ebSFabiano Rosas 
11663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DBSR, "DBSR",
11673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11683e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_clear,
11693e770bf7SBruno Larsen (billionai)                  /* Last reset was system reset */
11703e770bf7SBruno Larsen (billionai)                  0x00000300);
1171acf629ebSFabiano Rosas 
11723e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DAC1, "DAC1",
11733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11743e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11753e770bf7SBruno Larsen (billionai)                  0x00000000);
11763e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_DAC2, "DAC2",
11773e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11783e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11793e770bf7SBruno Larsen (billionai)                  0x00000000);
1180acf629ebSFabiano Rosas 
11813e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_DVC1, "DVC1",
11823e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11833e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11843e770bf7SBruno Larsen (billionai)                  0x00000000);
1185acf629ebSFabiano Rosas 
11863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_DVC2, "DVC2",
11873e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11883e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11893e770bf7SBruno Larsen (billionai)                  0x00000000);
1190acf629ebSFabiano Rosas 
11913e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_IAC1, "IAC1",
11923e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
11933e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
11943e770bf7SBruno Larsen (billionai)                  0x00000000);
11953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_IAC2, "IAC2",
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_405_IAC3, "IAC3",
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_405_IAC4, "IAC4",
12063e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12073e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12083e770bf7SBruno Larsen (billionai)                  0x00000000);
12093e770bf7SBruno Larsen (billionai)     /* Storage control */
12103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_SLER, "SLER",
12113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_40x_sler,
12133e770bf7SBruno Larsen (billionai)                  0x00000000);
12143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_40x_ZPR, "ZPR",
12153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12173e770bf7SBruno Larsen (billionai)                  0x00000000);
1218acf629ebSFabiano Rosas 
12193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_405_SU0R, "SU0R",
12203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12223e770bf7SBruno Larsen (billionai)                  0x00000000);
12233e770bf7SBruno Larsen (billionai)     /* SPRG */
12243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG0, "USPRG0",
12253e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
12263e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
12273e770bf7SBruno Larsen (billionai)                  0x00000000);
12283e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
12293e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12303e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12313e770bf7SBruno Larsen (billionai)                  0x00000000);
12323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
12333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12343e770bf7SBruno Larsen (billionai)                  spr_read_generic, &spr_write_generic,
12353e770bf7SBruno Larsen (billionai)                  0x00000000);
12363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
12373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12383e770bf7SBruno Larsen (billionai)                  spr_read_generic, &spr_write_generic,
12393e770bf7SBruno Larsen (billionai)                  0x00000000);
12403e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
12413e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12423e770bf7SBruno Larsen (billionai)                  spr_read_generic, &spr_write_generic,
12433e770bf7SBruno Larsen (billionai)                  0x00000000);
1244acd1f788SFabiano Rosas 
1245acd1f788SFabiano Rosas     /* Bus access control */
1246acd1f788SFabiano Rosas     /* not emulated, as QEMU never does speculative access */
1247acd1f788SFabiano Rosas     spr_register(env, SPR_40x_SGR, "SGR",
1248acd1f788SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
1249acd1f788SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
1250acd1f788SFabiano Rosas                  0xFFFFFFFF);
1251acd1f788SFabiano Rosas     /* not emulated, as QEMU do not emulate caches */
1252acd1f788SFabiano Rosas     spr_register(env, SPR_40x_DCWR, "DCWR",
1253acd1f788SFabiano Rosas                  SPR_NOACCESS, SPR_NOACCESS,
1254acd1f788SFabiano Rosas                  &spr_read_generic, &spr_write_generic,
1255acd1f788SFabiano Rosas                  0x00000000);
12563e770bf7SBruno Larsen (billionai) }
12573e770bf7SBruno Larsen (billionai) 
12583e770bf7SBruno Larsen (billionai) 
12593e770bf7SBruno Larsen (billionai) static void register_5xx_8xx_sprs(CPUPPCState *env)
12603e770bf7SBruno Larsen (billionai) {
12613e770bf7SBruno Larsen (billionai)     /* Exception processing */
12623e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DSISR, "DSISR",
12633e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
12643e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
12653e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DSISR, 0x00000000);
12663e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DAR, "DAR",
12673e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
12683e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
12693e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DAR, 0x00000000);
12703e770bf7SBruno Larsen (billionai)     /* Timer */
12713e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_DECR, "DECR",
12723e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12733e770bf7SBruno Larsen (billionai)                  &spr_read_decr, &spr_write_decr,
12743e770bf7SBruno Larsen (billionai)                  0x00000000);
1275acf629ebSFabiano Rosas 
12763e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_EIE, "EIE",
12773e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12783e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12793e770bf7SBruno Larsen (billionai)                  0x00000000);
1280acf629ebSFabiano Rosas 
12813e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_EID, "EID",
12823e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12833e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12843e770bf7SBruno Larsen (billionai)                  0x00000000);
1285acf629ebSFabiano Rosas 
12863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_NRI, "NRI",
12873e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12883e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12893e770bf7SBruno Larsen (billionai)                  0x00000000);
1290acf629ebSFabiano Rosas 
12913e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPA, "CMPA",
12923e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12933e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12943e770bf7SBruno Larsen (billionai)                  0x00000000);
1295acf629ebSFabiano Rosas 
12963e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPB, "CMPB",
12973e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
12983e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
12993e770bf7SBruno Larsen (billionai)                  0x00000000);
1300acf629ebSFabiano Rosas 
13013e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPC, "CMPC",
13023e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13033e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13043e770bf7SBruno Larsen (billionai)                  0x00000000);
1305acf629ebSFabiano Rosas 
13063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPD, "CMPD",
13073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13083e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13093e770bf7SBruno Larsen (billionai)                  0x00000000);
1310acf629ebSFabiano Rosas 
13113e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_ECR, "ECR",
13123e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13133e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13143e770bf7SBruno Larsen (billionai)                  0x00000000);
1315acf629ebSFabiano Rosas 
13163e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_DER, "DER",
13173e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13183e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13193e770bf7SBruno Larsen (billionai)                  0x00000000);
1320acf629ebSFabiano Rosas 
13213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_COUNTA, "COUNTA",
13223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13243e770bf7SBruno Larsen (billionai)                  0x00000000);
1325acf629ebSFabiano Rosas 
13263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_COUNTB, "COUNTB",
13273e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13283e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13293e770bf7SBruno Larsen (billionai)                  0x00000000);
1330acf629ebSFabiano Rosas 
13313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPE, "CMPE",
13323e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13343e770bf7SBruno Larsen (billionai)                  0x00000000);
1335acf629ebSFabiano Rosas 
13363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPF, "CMPF",
13373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13383e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13393e770bf7SBruno Larsen (billionai)                  0x00000000);
1340acf629ebSFabiano Rosas 
13413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPG, "CMPG",
13423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13443e770bf7SBruno Larsen (billionai)                  0x00000000);
1345acf629ebSFabiano Rosas 
13463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_CMPH, "CMPH",
13473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13493e770bf7SBruno Larsen (billionai)                  0x00000000);
1350acf629ebSFabiano Rosas 
13513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_LCTRL1, "LCTRL1",
13523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13543e770bf7SBruno Larsen (billionai)                  0x00000000);
1355acf629ebSFabiano Rosas 
13563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_LCTRL2, "LCTRL2",
13573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13593e770bf7SBruno Larsen (billionai)                  0x00000000);
1360acf629ebSFabiano Rosas 
13613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_BAR, "BAR",
13623e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13633e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13643e770bf7SBruno Larsen (billionai)                  0x00000000);
1365acf629ebSFabiano Rosas 
13663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_DPDR, "DPDR",
13673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13683e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13693e770bf7SBruno Larsen (billionai)                  0x00000000);
1370acf629ebSFabiano Rosas 
13713e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_IMMR, "IMMR",
13723e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13733e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13743e770bf7SBruno Larsen (billionai)                  0x00000000);
13753e770bf7SBruno Larsen (billionai) }
13763e770bf7SBruno Larsen (billionai) 
13773e770bf7SBruno Larsen (billionai) static void register_5xx_sprs(CPUPPCState *env)
13783e770bf7SBruno Larsen (billionai) {
13793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_GRA, "MI_GRA",
13803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13823e770bf7SBruno Larsen (billionai)                  0x00000000);
1383acf629ebSFabiano Rosas 
13843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_GRA, "L2U_GRA",
13853e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13863e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13873e770bf7SBruno Larsen (billionai)                  0x00000000);
1388acf629ebSFabiano Rosas 
13893e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RPCU_BBCMCR, "L2U_BBCMCR",
13903e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13913e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13923e770bf7SBruno Larsen (billionai)                  0x00000000);
1393acf629ebSFabiano Rosas 
13943e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_MCR, "L2U_MCR",
13953e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
13963e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
13973e770bf7SBruno Larsen (billionai)                  0x00000000);
1398acf629ebSFabiano Rosas 
13993e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RBA0, "MI_RBA0",
14003e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14013e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14023e770bf7SBruno Larsen (billionai)                  0x00000000);
1403acf629ebSFabiano Rosas 
14043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RBA1, "MI_RBA1",
14053e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14073e770bf7SBruno Larsen (billionai)                  0x00000000);
1408acf629ebSFabiano Rosas 
14093e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RBA2, "MI_RBA2",
14103e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14113e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14123e770bf7SBruno Larsen (billionai)                  0x00000000);
1413acf629ebSFabiano Rosas 
14143e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RBA3, "MI_RBA3",
14153e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14163e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14173e770bf7SBruno Larsen (billionai)                  0x00000000);
1418acf629ebSFabiano Rosas 
14193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RBA0, "L2U_RBA0",
14203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14223e770bf7SBruno Larsen (billionai)                  0x00000000);
1423acf629ebSFabiano Rosas 
14243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RBA1, "L2U_RBA1",
14253e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14263e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14273e770bf7SBruno Larsen (billionai)                  0x00000000);
1428acf629ebSFabiano Rosas 
14293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RBA2, "L2U_RBA2",
14303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14323e770bf7SBruno Larsen (billionai)                  0x00000000);
1433acf629ebSFabiano Rosas 
14343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RBA3, "L2U_RBA3",
14353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14373e770bf7SBruno Larsen (billionai)                  0x00000000);
1438acf629ebSFabiano Rosas 
14393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RA0, "MI_RA0",
14403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14413e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14423e770bf7SBruno Larsen (billionai)                  0x00000000);
1443acf629ebSFabiano Rosas 
14443e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RA1, "MI_RA1",
14453e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14463e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14473e770bf7SBruno Larsen (billionai)                  0x00000000);
1448acf629ebSFabiano Rosas 
14493e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RA2, "MI_RA2",
14503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14513e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14523e770bf7SBruno Larsen (billionai)                  0x00000000);
1453acf629ebSFabiano Rosas 
14543e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_MI_RA3, "MI_RA3",
14553e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14563e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14573e770bf7SBruno Larsen (billionai)                  0x00000000);
1458acf629ebSFabiano Rosas 
14593e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RA0, "L2U_RA0",
14603e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14613e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14623e770bf7SBruno Larsen (billionai)                  0x00000000);
1463acf629ebSFabiano Rosas 
14643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RA1, "L2U_RA1",
14653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14673e770bf7SBruno Larsen (billionai)                  0x00000000);
1468acf629ebSFabiano Rosas 
14693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RA2, "L2U_RA2",
14703e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14713e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14723e770bf7SBruno Larsen (billionai)                  0x00000000);
1473acf629ebSFabiano Rosas 
14743e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_L2U_RA3, "L2U_RA3",
14753e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14763e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14773e770bf7SBruno Larsen (billionai)                  0x00000000);
1478acf629ebSFabiano Rosas 
14793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_RCPU_FPECR, "FPECR",
14803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14823e770bf7SBruno Larsen (billionai)                  0x00000000);
14833e770bf7SBruno Larsen (billionai) }
14843e770bf7SBruno Larsen (billionai) 
14853e770bf7SBruno Larsen (billionai) static void register_8xx_sprs(CPUPPCState *env)
14863e770bf7SBruno Larsen (billionai) {
1487acf629ebSFabiano Rosas 
14883e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_IC_CST, "IC_CST",
14893e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14903e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14913e770bf7SBruno Larsen (billionai)                  0x00000000);
1492acf629ebSFabiano Rosas 
14933e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_IC_ADR, "IC_ADR",
14943e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
14953e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
14963e770bf7SBruno Larsen (billionai)                  0x00000000);
1497acf629ebSFabiano Rosas 
14983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_IC_DAT, "IC_DAT",
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_DC_CST, "DC_CST",
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_DC_ADR, "DC_ADR",
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_DC_DAT, "DC_DAT",
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_MI_CTR, "MI_CTR",
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_MI_AP, "MI_AP",
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_MI_EPN, "MI_EPN",
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_MI_TWC, "MI_TWC",
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_MI_RPN, "MI_RPN",
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_MI_DBCAM, "MI_DBCAM",
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_MI_DBRAM0, "MI_DBRAM0",
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_MI_DBRAM1, "MI_DBRAM1",
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_MD_CTR, "MD_CTR",
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_MD_CASID, "MD_CASID",
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_MD_AP, "MD_AP",
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_MD_EPN, "MD_EPN",
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_MD_TWB, "MD_TWB",
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_MD_TWC, "MD_TWC",
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_MD_RPN, "MD_RPN",
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_MD_TW, "MD_TW",
15943e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
15953e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
15963e770bf7SBruno Larsen (billionai)                  0x00000000);
1597acf629ebSFabiano Rosas 
15983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_DBCAM, "MD_DBCAM",
15993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16013e770bf7SBruno Larsen (billionai)                  0x00000000);
1602acf629ebSFabiano Rosas 
16033e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_DBRAM0, "MD_DBRAM0",
16043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16063e770bf7SBruno Larsen (billionai)                  0x00000000);
1607acf629ebSFabiano Rosas 
16083e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MPC_MD_DBRAM1, "MD_DBRAM1",
16093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
16103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
16113e770bf7SBruno Larsen (billionai)                  0x00000000);
16123e770bf7SBruno Larsen (billionai) }
16133e770bf7SBruno Larsen (billionai) 
16143e770bf7SBruno Larsen (billionai) /*
16153e770bf7SBruno Larsen (billionai)  * AMR     => SPR 29 (Power 2.04)
16163e770bf7SBruno Larsen (billionai)  * CTRL    => SPR 136 (Power 2.04)
16173e770bf7SBruno Larsen (billionai)  * CTRL    => SPR 152 (Power 2.04)
16183e770bf7SBruno Larsen (billionai)  * SCOMC   => SPR 276 (64 bits ?)
16193e770bf7SBruno Larsen (billionai)  * SCOMD   => SPR 277 (64 bits ?)
16203e770bf7SBruno Larsen (billionai)  * TBU40   => SPR 286 (Power 2.04 hypv)
16213e770bf7SBruno Larsen (billionai)  * HSPRG0  => SPR 304 (Power 2.04 hypv)
16223e770bf7SBruno Larsen (billionai)  * HSPRG1  => SPR 305 (Power 2.04 hypv)
16233e770bf7SBruno Larsen (billionai)  * HDSISR  => SPR 306 (Power 2.04 hypv)
16243e770bf7SBruno Larsen (billionai)  * HDAR    => SPR 307 (Power 2.04 hypv)
16253e770bf7SBruno Larsen (billionai)  * PURR    => SPR 309 (Power 2.04 hypv)
16263e770bf7SBruno Larsen (billionai)  * HDEC    => SPR 310 (Power 2.04 hypv)
16273e770bf7SBruno Larsen (billionai)  * HIOR    => SPR 311 (hypv)
16283e770bf7SBruno Larsen (billionai)  * RMOR    => SPR 312 (970)
16293e770bf7SBruno Larsen (billionai)  * HRMOR   => SPR 313 (Power 2.04 hypv)
16303e770bf7SBruno Larsen (billionai)  * HSRR0   => SPR 314 (Power 2.04 hypv)
16313e770bf7SBruno Larsen (billionai)  * HSRR1   => SPR 315 (Power 2.04 hypv)
16323e770bf7SBruno Larsen (billionai)  * LPIDR   => SPR 317 (970)
16333e770bf7SBruno Larsen (billionai)  * EPR     => SPR 702 (Power 2.04 emb)
16343e770bf7SBruno Larsen (billionai)  * perf    => 768-783 (Power 2.04)
16353e770bf7SBruno Larsen (billionai)  * perf    => 784-799 (Power 2.04)
16363e770bf7SBruno Larsen (billionai)  * PPR     => SPR 896 (Power 2.04)
16373e770bf7SBruno Larsen (billionai)  * DABRX   => 1015    (Power 2.04 hypv)
16383e770bf7SBruno Larsen (billionai)  * FPECR   => SPR 1022 (?)
16393e770bf7SBruno Larsen (billionai)  * ... and more (thermal management, performance counters, ...)
16403e770bf7SBruno Larsen (billionai)  */
16413e770bf7SBruno Larsen (billionai) 
16423e770bf7SBruno Larsen (billionai) /*****************************************************************************/
16433e770bf7SBruno Larsen (billionai) /* Exception vectors models                                                  */
16443e770bf7SBruno Larsen (billionai) static void init_excp_4xx_softmmu(CPUPPCState *env)
16453e770bf7SBruno Larsen (billionai) {
16463e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
16473e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
16483e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
16493e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
16503e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
16513e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
16523e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
16533e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
16543e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
16553e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PIT]      = 0x00001000;
16563e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00001010;
16573e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00001020;
16583e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00001100;
16593e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00001200;
16603e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00002000;
16613e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF0UL;
16623e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0xFFFF0000UL;
16633e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
16643e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0xFFFFFFFCUL;
16653e770bf7SBruno Larsen (billionai) #endif
16663e770bf7SBruno Larsen (billionai) }
16673e770bf7SBruno Larsen (billionai) 
16683e770bf7SBruno Larsen (billionai) static void init_excp_MPC5xx(CPUPPCState *env)
16693e770bf7SBruno Larsen (billionai) {
16703e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
16713e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
16723e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
16733e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
16743e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
16753e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
16766328a3bbSFabiano Rosas     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
16773e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
16783e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
16793e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
16803e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPA]      = 0x00000E00;
16813e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EMUL]     = 0x00001000;
16823e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DABR]     = 0x00001C00;
16833e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001C00;
16843e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MEXTBR]   = 0x00001E00;
16853e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_NMEXTBR]  = 0x00001F00;
16863e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF0UL;
16873e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0xFFFF0000UL;
16883e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
16893e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
16903e770bf7SBruno Larsen (billionai) #endif
16913e770bf7SBruno Larsen (billionai) }
16923e770bf7SBruno Larsen (billionai) 
16933e770bf7SBruno Larsen (billionai) static void init_excp_MPC8xx(CPUPPCState *env)
16943e770bf7SBruno Larsen (billionai) {
16953e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
16963e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
16973e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
16983e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
16993e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
17003e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
17013e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
17023e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
17036328a3bbSFabiano Rosas     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
17043e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
17053e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
17063e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
17073e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPA]      = 0x00000E00;
17083e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EMUL]     = 0x00001000;
17093e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00001100;
17103e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00001200;
17113e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLBE]    = 0x00001300;
17123e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLBE]    = 0x00001400;
17133e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DABR]     = 0x00001C00;
17143e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001C00;
17153e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MEXTBR]   = 0x00001E00;
17163e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_NMEXTBR]  = 0x00001F00;
17173e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF0UL;
17183e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0xFFFF0000UL;
17193e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
17203e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
17213e770bf7SBruno Larsen (billionai) #endif
17223e770bf7SBruno Larsen (billionai) }
17233e770bf7SBruno Larsen (billionai) 
17243e770bf7SBruno Larsen (billionai) static void init_excp_G2(CPUPPCState *env)
17253e770bf7SBruno Larsen (billionai) {
17263e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
17273e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
17283e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
17293e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
17303e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
17313e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
17323e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
17333e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
17343e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
17353e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
17363e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000A00;
17373e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
17383e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
17393e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
17403e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
17413e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
17423e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
17433e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
17443e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
17453e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
17463e770bf7SBruno Larsen (billionai) #endif
17473e770bf7SBruno Larsen (billionai) }
17483e770bf7SBruno Larsen (billionai) 
17493e770bf7SBruno Larsen (billionai) static void init_excp_e200(CPUPPCState *env, target_ulong ivpr_mask)
17503e770bf7SBruno Larsen (billionai) {
17513e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
17523e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000FFC;
17533e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000;
17543e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000000;
17553e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000000;
17563e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000000;
17573e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000;
17583e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000000;
17593e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000000;
17603e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000000;
17613e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000000;
17623e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_APU]      = 0x00000000;
17633e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000000;
17643e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00000000;
17653e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00000000;
17663e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00000000;
17673e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00000000;
17683e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00000000;
17697fc1dc83SFabiano Rosas     /*
17707fc1dc83SFabiano Rosas      * These two are the same IVOR as POWERPC_EXCP_VPU and
17717fc1dc83SFabiano Rosas      * POWERPC_EXCP_VPUA. We deal with that when dispatching at
17727fc1dc83SFabiano Rosas      * powerpc_excp().
17737fc1dc83SFabiano Rosas      */
17743e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SPEU]     = 0x00000000;
17753e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EFPDI]    = 0x00000000;
17767fc1dc83SFabiano Rosas 
17773e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EFPRI]    = 0x00000000;
17783e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF7UL;
17793e770bf7SBruno Larsen (billionai)     env->ivpr_mask = ivpr_mask;
17803e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
17813e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0xFFFFFFFCUL;
17823e770bf7SBruno Larsen (billionai) #endif
17833e770bf7SBruno Larsen (billionai) }
17843e770bf7SBruno Larsen (billionai) 
17853e770bf7SBruno Larsen (billionai) static void init_excp_BookE(CPUPPCState *env)
17863e770bf7SBruno Larsen (billionai) {
17873e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
17883e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000;
17893e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000000;
17903e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000000;
17913e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000000;
17923e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000;
17933e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000000;
17943e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000000;
17953e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000000;
17963e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000000;
17973e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_APU]      = 0x00000000;
17983e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000000;
17993e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00000000;
18003e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00000000;
18013e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00000000;
18023e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00000000;
18033e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00000000;
18043e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x0000FFF0UL;
18053e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0xFFFF0000UL;
18063e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
18073e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0xFFFFFFFCUL;
18083e770bf7SBruno Larsen (billionai) #endif
18093e770bf7SBruno Larsen (billionai) }
18103e770bf7SBruno Larsen (billionai) 
18113e770bf7SBruno Larsen (billionai) static void init_excp_603(CPUPPCState *env)
18123e770bf7SBruno Larsen (billionai) {
18133e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
18143e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
18153e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
18163e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
18173e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
18183e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
18193e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
18203e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
18213e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
18223e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
18233e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
18243e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
18253e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
18263e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
18273e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
18283e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
18293e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
18303e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
18313e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
18323e770bf7SBruno Larsen (billionai) #endif
18333e770bf7SBruno Larsen (billionai) }
18343e770bf7SBruno Larsen (billionai) 
18353e770bf7SBruno Larsen (billionai) static void init_excp_604(CPUPPCState *env)
18363e770bf7SBruno Larsen (billionai) {
18373e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
18383e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
18393e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
18403e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
18413e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
18423e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
18433e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
18443e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
18453e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
18463e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
18473e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
18483e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
18493e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
18503e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
18513e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
18523e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
18533e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
18543e770bf7SBruno Larsen (billionai) #endif
18553e770bf7SBruno Larsen (billionai) }
18563e770bf7SBruno Larsen (billionai) 
18573e770bf7SBruno Larsen (billionai) static void init_excp_7x0(CPUPPCState *env)
18583e770bf7SBruno Larsen (billionai) {
18593e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
18603e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
18613e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
18623e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
18633e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
18643e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
18653e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
18663e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
18673e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
18683e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
18693e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
18703e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
18713e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
18723e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
18733e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
18743e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
18753e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
18763e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
18773e770bf7SBruno Larsen (billionai) #endif
18783e770bf7SBruno Larsen (billionai) }
18793e770bf7SBruno Larsen (billionai) 
18803e770bf7SBruno Larsen (billionai) static void init_excp_750cl(CPUPPCState *env)
18813e770bf7SBruno Larsen (billionai) {
18823e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
18833e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
18843e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
18853e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
18863e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
18873e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
18883e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
18893e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
18903e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
18913e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
18923e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
18933e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
18943e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
18953e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
18963e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
18973e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
18983e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
18993e770bf7SBruno Larsen (billionai) #endif
19003e770bf7SBruno Larsen (billionai) }
19013e770bf7SBruno Larsen (billionai) 
19023e770bf7SBruno Larsen (billionai) static void init_excp_750cx(CPUPPCState *env)
19033e770bf7SBruno Larsen (billionai) {
19043e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
19053e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
19063e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
19073e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
19083e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
19093e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
19103e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
19113e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
19123e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
19133e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
19143e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
19153e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
19163e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
19173e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
19183e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
19193e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
19203e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
19213e770bf7SBruno Larsen (billionai) #endif
19223e770bf7SBruno Larsen (billionai) }
19233e770bf7SBruno Larsen (billionai) 
19243e770bf7SBruno Larsen (billionai) /* XXX: Check if this is correct */
19253e770bf7SBruno Larsen (billionai) static void init_excp_7x5(CPUPPCState *env)
19263e770bf7SBruno Larsen (billionai) {
19273e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
19283e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
19293e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
19303e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
19313e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
19323e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
19333e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
19343e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
19353e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
19363e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
19373e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
19383e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
19393e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
19403e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
19413e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
19423e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
19433e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
19443e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
19453e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
19463e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
19473e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
19483e770bf7SBruno Larsen (billionai) #endif
19493e770bf7SBruno Larsen (billionai) }
19503e770bf7SBruno Larsen (billionai) 
19513e770bf7SBruno Larsen (billionai) static void init_excp_7400(CPUPPCState *env)
19523e770bf7SBruno Larsen (billionai) {
19533e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
19543e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
19553e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
19563e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
19573e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
19583e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
19593e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
19603e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
19613e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
19623e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
19633e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
19643e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
19653e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
19663e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
19673e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
19683e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
19693e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001600;
19703e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
19713e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
19723e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
19733e770bf7SBruno Larsen (billionai) #endif
19743e770bf7SBruno Larsen (billionai) }
19753e770bf7SBruno Larsen (billionai) 
19763e770bf7SBruno Larsen (billionai) static void init_excp_7450(CPUPPCState *env)
19773e770bf7SBruno Larsen (billionai) {
19783e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
19793e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
19803e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
19813e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
19823e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
19833e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
19843e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
19853e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
19863e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
19873e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
19883e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
19893e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
19903e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
19913e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
19923e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
19933e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
19943e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001600;
19953e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
19963e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x00000100UL;
19973e770bf7SBruno Larsen (billionai) #endif
19983e770bf7SBruno Larsen (billionai) }
19993e770bf7SBruno Larsen (billionai) 
20003e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
20013e770bf7SBruno Larsen (billionai) static void init_excp_970(CPUPPCState *env)
20023e770bf7SBruno Larsen (billionai) {
20033e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
20043e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
20053e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
20063e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
20073e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSEG]     = 0x00000380;
20083e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
20093e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISEG]     = 0x00000480;
20103e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
20113e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
20123e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
20133e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
20143e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
20153e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HDECR]    = 0x00000980;
20163e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
20173e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
20183e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
20193e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
20203e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
20213e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MAINT]    = 0x00001600;
20223e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001700;
20233e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001800;
20243e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
20253e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x0000000000000100ULL;
20263e770bf7SBruno Larsen (billionai) #endif
20273e770bf7SBruno Larsen (billionai) }
20283e770bf7SBruno Larsen (billionai) 
20293e770bf7SBruno Larsen (billionai) static void init_excp_POWER7(CPUPPCState *env)
20303e770bf7SBruno Larsen (billionai) {
20313e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
20323e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
20333e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
20343e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
20353e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DSEG]     = 0x00000380;
20363e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
20373e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ISEG]     = 0x00000480;
20383e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
20393e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
20403e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
20413e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
20423e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
20433e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HDECR]    = 0x00000980;
20443e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
20453e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
20463e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HDSI]     = 0x00000E00;
20473e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HISI]     = 0x00000E20;
20483e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HV_EMU]   = 0x00000E40;
20493e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HV_MAINT] = 0x00000E60;
20503e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
20513e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
20523e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_VSXU]     = 0x00000F40;
20533e770bf7SBruno Larsen (billionai)     /* Hardware reset vector */
20543e770bf7SBruno Larsen (billionai)     env->hreset_vector = 0x0000000000000100ULL;
20553e770bf7SBruno Larsen (billionai) #endif
20563e770bf7SBruno Larsen (billionai) }
20573e770bf7SBruno Larsen (billionai) 
20583e770bf7SBruno Larsen (billionai) static void init_excp_POWER8(CPUPPCState *env)
20593e770bf7SBruno Larsen (billionai) {
20603e770bf7SBruno Larsen (billionai)     init_excp_POWER7(env);
20613e770bf7SBruno Larsen (billionai) 
20623e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
20633e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SDOOR]    = 0x00000A00;
20643e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_FU]       = 0x00000F60;
20653e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HV_FU]    = 0x00000F80;
20663e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SDOOR_HV] = 0x00000E80;
2067cb76bbc4SDaniel Henrique Barboza 
2068cb76bbc4SDaniel Henrique Barboza     /* Userland exceptions without vector value in PowerISA v3.1 */
2069cb76bbc4SDaniel Henrique Barboza     env->excp_vectors[POWERPC_EXCP_PERFM_EBB] = 0x0;
2070cb76bbc4SDaniel Henrique Barboza     env->excp_vectors[POWERPC_EXCP_EXTERNAL_EBB] = 0x0;
20713e770bf7SBruno Larsen (billionai) #endif
20723e770bf7SBruno Larsen (billionai) }
20733e770bf7SBruno Larsen (billionai) 
20743e770bf7SBruno Larsen (billionai) static void init_excp_POWER9(CPUPPCState *env)
20753e770bf7SBruno Larsen (billionai) {
20763e770bf7SBruno Larsen (billionai)     init_excp_POWER8(env);
20773e770bf7SBruno Larsen (billionai) 
20783e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
20793e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_HVIRT]    = 0x00000EA0;
20803e770bf7SBruno Larsen (billionai)     env->excp_vectors[POWERPC_EXCP_SYSCALL_VECTORED] = 0x00017000;
20813e770bf7SBruno Larsen (billionai) #endif
20823e770bf7SBruno Larsen (billionai) }
20833e770bf7SBruno Larsen (billionai) 
20843e770bf7SBruno Larsen (billionai) static void init_excp_POWER10(CPUPPCState *env)
20853e770bf7SBruno Larsen (billionai) {
20863e770bf7SBruno Larsen (billionai)     init_excp_POWER9(env);
20873e770bf7SBruno Larsen (billionai) }
20883e770bf7SBruno Larsen (billionai) 
20893e770bf7SBruno Larsen (billionai) #endif
20903e770bf7SBruno Larsen (billionai) 
20913e770bf7SBruno Larsen (billionai) static int check_pow_hid0(CPUPPCState *env)
20923e770bf7SBruno Larsen (billionai) {
20933e770bf7SBruno Larsen (billionai)     if (env->spr[SPR_HID0] & 0x00E00000) {
20943e770bf7SBruno Larsen (billionai)         return 1;
20953e770bf7SBruno Larsen (billionai)     }
20963e770bf7SBruno Larsen (billionai) 
20973e770bf7SBruno Larsen (billionai)     return 0;
20983e770bf7SBruno Larsen (billionai) }
20993e770bf7SBruno Larsen (billionai) 
21003e770bf7SBruno Larsen (billionai) static int check_pow_hid0_74xx(CPUPPCState *env)
21013e770bf7SBruno Larsen (billionai) {
21023e770bf7SBruno Larsen (billionai)     if (env->spr[SPR_HID0] & 0x00600000) {
21033e770bf7SBruno Larsen (billionai)         return 1;
21043e770bf7SBruno Larsen (billionai)     }
21053e770bf7SBruno Larsen (billionai) 
21063e770bf7SBruno Larsen (billionai)     return 0;
21073e770bf7SBruno Larsen (billionai) }
21083e770bf7SBruno Larsen (billionai) 
21093e770bf7SBruno Larsen (billionai) static void init_proc_405(CPUPPCState *env)
21103e770bf7SBruno Larsen (billionai) {
21113e770bf7SBruno Larsen (billionai)     register_40x_sprs(env);
21123e770bf7SBruno Larsen (billionai)     register_405_sprs(env);
21134ffb8c5eSFabiano Rosas     register_usprgh_sprs(env);
2114acd1f788SFabiano Rosas 
21153e770bf7SBruno Larsen (billionai)     /* Memory management */
21163e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
21173e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
21183e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
21193e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
21203e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
21213e770bf7SBruno Larsen (billionai) #endif
21223e770bf7SBruno Larsen (billionai)     init_excp_4xx_softmmu(env);
21233e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
21243e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
21253e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
21263e770bf7SBruno Larsen (billionai)     ppc40x_irq_init(env_archcpu(env));
21273e770bf7SBruno Larsen (billionai) 
21283e770bf7SBruno Larsen (billionai)     SET_FIT_PERIOD(8, 12, 16, 20);
21293e770bf7SBruno Larsen (billionai)     SET_WDT_PERIOD(16, 20, 24, 28);
21303e770bf7SBruno Larsen (billionai) }
21313e770bf7SBruno Larsen (billionai) 
21323e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(405)(ObjectClass *oc, void *data)
21333e770bf7SBruno Larsen (billionai) {
21343e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
21353e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
21363e770bf7SBruno Larsen (billionai) 
21373e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 405";
21383e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_405;
21393e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
21403e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
21413e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_WRTEE |
21423e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT |
21433e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
21443e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
21453e770bf7SBruno Larsen (billionai)                        PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC |
21463e770bf7SBruno Larsen (billionai)                        PPC_4xx_COMMON | PPC_405_MAC | PPC_40x_EXCP;
2147645d843cSFabiano Rosas     pcc->msr_mask = (1ull << MSR_WE) |
21483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
21493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
21503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
21513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
2152301e5d48SFabiano Rosas                     (1ull << MSR_ME) |
21533e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
21543e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
21553e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
21563e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
21573e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_4xx;
21583e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_40x;
21593e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_405;
21603e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
21613e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
21623e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
21633e770bf7SBruno Larsen (billionai) }
21643e770bf7SBruno Larsen (billionai) 
21653e770bf7SBruno Larsen (billionai) static void init_proc_440EP(CPUPPCState *env)
21663e770bf7SBruno Larsen (billionai) {
21673e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, 0x000000000000FFFFULL);
21683e770bf7SBruno Larsen (billionai)     register_440_sprs(env);
21693e770bf7SBruno Larsen (billionai)     register_usprgh_sprs(env);
2170acf629ebSFabiano Rosas 
21713e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
21723e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
21733e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
21743e770bf7SBruno Larsen (billionai)                  0x00000000);
21753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
21763e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
21773e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
21783e770bf7SBruno Larsen (billionai)                  0x00000000);
21793e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
21803e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
21813e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
21823e770bf7SBruno Larsen (billionai)                  0x00000000);
2183acf629ebSFabiano Rosas 
21843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_CCR1, "CCR1",
21853e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
21863e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
21873e770bf7SBruno Larsen (billionai)                  0x00000000);
21883e770bf7SBruno Larsen (billionai)     /* Memory management */
21893e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
21903e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
21913e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
21923e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
21933e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
21943e770bf7SBruno Larsen (billionai) #endif
21953e770bf7SBruno Larsen (billionai)     init_excp_BookE(env);
21963e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
21973e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
21983e770bf7SBruno Larsen (billionai)     ppc40x_irq_init(env_archcpu(env));
21993e770bf7SBruno Larsen (billionai) 
22003e770bf7SBruno Larsen (billionai)     SET_FIT_PERIOD(12, 16, 20, 24);
22013e770bf7SBruno Larsen (billionai)     SET_WDT_PERIOD(20, 24, 28, 32);
22023e770bf7SBruno Larsen (billionai) }
22033e770bf7SBruno Larsen (billionai) 
22043e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440EP)(ObjectClass *oc, void *data)
22053e770bf7SBruno Larsen (billionai) {
22063e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
22073e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
22083e770bf7SBruno Larsen (billionai) 
22093e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 440 EP";
22103e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440EP;
22113e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
22123e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
22133e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL |
22143e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
22153e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
22163e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_WRTEE | PPC_RFMCI |
22173e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
22183e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
22193e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_MFTB |
22203e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
22213e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
22223e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
22233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
22243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
22253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
22263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
22273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
22283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
22293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
22303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
22313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
22323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
22333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
22343e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
22353e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
22363e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
22373e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
22383e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
22393e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
22403e770bf7SBruno Larsen (billionai) }
22413e770bf7SBruno Larsen (billionai) 
22423e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(460EX)(ObjectClass *oc, void *data)
22433e770bf7SBruno Larsen (billionai) {
22443e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
22453e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
22463e770bf7SBruno Larsen (billionai) 
22473e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 460 EX";
22483e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440EP;
22493e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
22503e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
22513e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL |
22523e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
22533e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
22543e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_RFMCI |
22553e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
22563e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
22573e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_MFTB |
22583e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
22593e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
22603e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
22613e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
22623e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
22633e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
22643e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
22653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
22663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
22673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
22683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
22693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
22703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
22713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
22723e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
22733e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
22743e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
22753e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
22763e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
22773e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
22783e770bf7SBruno Larsen (billionai) }
22793e770bf7SBruno Larsen (billionai) 
22803e770bf7SBruno Larsen (billionai) static void init_proc_440GP(CPUPPCState *env)
22813e770bf7SBruno Larsen (billionai) {
22823e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, 0x000000000000FFFFULL);
22833e770bf7SBruno Larsen (billionai)     register_440_sprs(env);
22843e770bf7SBruno Larsen (billionai)     register_usprgh_sprs(env);
2285acf629ebSFabiano Rosas 
22863e770bf7SBruno Larsen (billionai)     /* Memory management */
22873e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
22883e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
22893e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
22903e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
22913e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
22923e770bf7SBruno Larsen (billionai) #endif
22933e770bf7SBruno Larsen (billionai)     init_excp_BookE(env);
22943e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
22953e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
22963e770bf7SBruno Larsen (billionai)     /* XXX: TODO: allocate internal IRQ controller */
22973e770bf7SBruno Larsen (billionai) 
22983e770bf7SBruno Larsen (billionai)     SET_FIT_PERIOD(12, 16, 20, 24);
22993e770bf7SBruno Larsen (billionai)     SET_WDT_PERIOD(20, 24, 28, 32);
23003e770bf7SBruno Larsen (billionai) }
23013e770bf7SBruno Larsen (billionai) 
23023e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440GP)(ObjectClass *oc, void *data)
23033e770bf7SBruno Larsen (billionai) {
23043e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
23053e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
23063e770bf7SBruno Larsen (billionai) 
23073e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 440 GP";
23083e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440GP;
23093e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
23103e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
23113e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_MFAPIDI |
23123e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
23133e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
23143e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVA | PPC_MFTB |
23153e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
23163e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
23173e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
23183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
23193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
23203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
23213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
23223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
23233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
23243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
23253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
23263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
23273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
23283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
23293e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
23303e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
23313e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
23323e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
23333e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
23343e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
23353e770bf7SBruno Larsen (billionai) }
23363e770bf7SBruno Larsen (billionai) 
23373e770bf7SBruno Larsen (billionai) static void init_proc_440x5(CPUPPCState *env)
23383e770bf7SBruno Larsen (billionai) {
23393e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, 0x000000000000FFFFULL);
23403e770bf7SBruno Larsen (billionai)     register_440_sprs(env);
23413e770bf7SBruno Larsen (billionai)     register_usprgh_sprs(env);
2342acf629ebSFabiano Rosas 
23433e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
23443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
23453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
23463e770bf7SBruno Larsen (billionai)                  0x00000000);
23473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
23483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
23493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
23503e770bf7SBruno Larsen (billionai)                  0x00000000);
23513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
23523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
23533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
23543e770bf7SBruno Larsen (billionai)                  0x00000000);
2355acf629ebSFabiano Rosas 
23563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_440_CCR1, "CCR1",
23573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
23583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
23593e770bf7SBruno Larsen (billionai)                  0x00000000);
23603e770bf7SBruno Larsen (billionai)     /* Memory management */
23613e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
23623e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
23633e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
23643e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
23653e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
23663e770bf7SBruno Larsen (billionai) #endif
23673e770bf7SBruno Larsen (billionai)     init_excp_BookE(env);
23683e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
23693e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
23703e770bf7SBruno Larsen (billionai)     ppc40x_irq_init(env_archcpu(env));
23713e770bf7SBruno Larsen (billionai) 
23723e770bf7SBruno Larsen (billionai)     SET_FIT_PERIOD(12, 16, 20, 24);
23733e770bf7SBruno Larsen (billionai)     SET_WDT_PERIOD(20, 24, 28, 32);
23743e770bf7SBruno Larsen (billionai) }
23753e770bf7SBruno Larsen (billionai) 
23763e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440x5)(ObjectClass *oc, void *data)
23773e770bf7SBruno Larsen (billionai) {
23783e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
23793e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
23803e770bf7SBruno Larsen (billionai) 
23813e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 440x5";
23823e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440x5;
23833e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
23843e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
23853e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_WRTEE | PPC_RFMCI |
23863e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
23873e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
23883e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_MFTB |
23893e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
23903e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
23913e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
23923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
23933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
23943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
23953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
23963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
23973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
23983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
23993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
24003e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
24013e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
24023e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
24033e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
24043e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
24053e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
24063e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
24073e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
24083e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
24093e770bf7SBruno Larsen (billionai) }
24103e770bf7SBruno Larsen (billionai) 
24113e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(440x5wDFPU)(ObjectClass *oc, void *data)
24123e770bf7SBruno Larsen (billionai) {
24133e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
24143e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
24153e770bf7SBruno Larsen (billionai) 
24163e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 440x5 with double precision FPU";
24173e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_440x5;
24183e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
24193e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
24203e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSQRT |
24213e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
24223e770bf7SBruno Larsen (billionai)                        PPC_DCR | PPC_WRTEE | PPC_RFMCI |
24233e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
24243e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
24253e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_MFTB |
24263e770bf7SBruno Larsen (billionai)                        PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
24273e770bf7SBruno Larsen (billionai)                        PPC_440_SPEC;
24283e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_FP_CVT_S64;
24293e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
24303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
24313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
24323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
24333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
24343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
24353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
24363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
24373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
24383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
24393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
24403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
24413e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE;
24423e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
24433e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
24443e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_403;
24453e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
24463e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
24473e770bf7SBruno Larsen (billionai) }
24483e770bf7SBruno Larsen (billionai) 
24493e770bf7SBruno Larsen (billionai) static void init_proc_MPC5xx(CPUPPCState *env)
24503e770bf7SBruno Larsen (billionai) {
24513e770bf7SBruno Larsen (billionai)     register_5xx_8xx_sprs(env);
24523e770bf7SBruno Larsen (billionai)     register_5xx_sprs(env);
24533e770bf7SBruno Larsen (billionai)     init_excp_MPC5xx(env);
24543e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
24553e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
24563e770bf7SBruno Larsen (billionai)     /* XXX: TODO: allocate internal IRQ controller */
24573e770bf7SBruno Larsen (billionai) }
24583e770bf7SBruno Larsen (billionai) 
24593e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(MPC5xx)(ObjectClass *oc, void *data)
24603e770bf7SBruno Larsen (billionai) {
24613e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
24623e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
24633e770bf7SBruno Larsen (billionai) 
24643e770bf7SBruno Larsen (billionai)     dc->desc = "Freescale 5xx cores (aka RCPU)";
24653e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_MPC5xx;
24663e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
24673e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
24683e770bf7SBruno Larsen (billionai)                        PPC_MEM_EIEIO | PPC_MEM_SYNC |
24693e770bf7SBruno Larsen (billionai)                        PPC_CACHE_ICBI | PPC_FLOAT | PPC_FLOAT_STFIWX |
24703e770bf7SBruno Larsen (billionai)                        PPC_MFTB;
24713e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_ILE) |
24723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
24733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
24743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
24753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
24763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
24773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
24783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
24793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
24803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
24813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
24823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
24833e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_REAL;
24849323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
24853e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_RCPU;
24863e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_505;
24873e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
24883e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
24893e770bf7SBruno Larsen (billionai) }
24903e770bf7SBruno Larsen (billionai) 
24913e770bf7SBruno Larsen (billionai) static void init_proc_MPC8xx(CPUPPCState *env)
24923e770bf7SBruno Larsen (billionai) {
24933e770bf7SBruno Larsen (billionai)     register_5xx_8xx_sprs(env);
24943e770bf7SBruno Larsen (billionai)     register_8xx_sprs(env);
24953e770bf7SBruno Larsen (billionai)     init_excp_MPC8xx(env);
24963e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
24973e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
24983e770bf7SBruno Larsen (billionai)     /* XXX: TODO: allocate internal IRQ controller */
24993e770bf7SBruno Larsen (billionai) }
25003e770bf7SBruno Larsen (billionai) 
25013e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(MPC8xx)(ObjectClass *oc, void *data)
25023e770bf7SBruno Larsen (billionai) {
25033e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
25043e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
25053e770bf7SBruno Larsen (billionai) 
25063e770bf7SBruno Larsen (billionai)     dc->desc = "Freescale 8xx cores (aka PowerQUICC)";
25073e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_MPC8xx;
25083e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
25093e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING  |
25103e770bf7SBruno Larsen (billionai)                        PPC_MEM_EIEIO | PPC_MEM_SYNC |
25113e770bf7SBruno Larsen (billionai)                        PPC_CACHE_ICBI | PPC_MFTB;
25123e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_ILE) |
25133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
25143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
25153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
25163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
25173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
25183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
25193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
25203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
25213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
25223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
25233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
25243e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_MPC8xx;
25259323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
25263e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_RCPU;
25273e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_860;
25283e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
25293e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
25303e770bf7SBruno Larsen (billionai) }
25313e770bf7SBruno Larsen (billionai) 
25323e770bf7SBruno Larsen (billionai) /* Freescale 82xx cores (aka PowerQUICC-II)                                  */
25333e770bf7SBruno Larsen (billionai) 
25343e770bf7SBruno Larsen (billionai) static void init_proc_G2(CPUPPCState *env)
25353e770bf7SBruno Larsen (billionai) {
2536217781afSFabiano Rosas     register_non_embedded_sprs(env);
25373e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
25383e770bf7SBruno Larsen (billionai)     register_G2_sprs(env);
2539acf629ebSFabiano Rosas 
25403e770bf7SBruno Larsen (billionai)     /* Memory management */
25413e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
25423e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
25433e770bf7SBruno Larsen (billionai)     register_6xx_7xx_soft_tlb(env, 64, 2);
25443e770bf7SBruno Larsen (billionai)     init_excp_G2(env);
25453e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
25463e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
25473e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
25483e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
25493e770bf7SBruno Larsen (billionai) }
25503e770bf7SBruno Larsen (billionai) 
25513e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(G2)(ObjectClass *oc, void *data)
25523e770bf7SBruno Larsen (billionai) {
25533e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
25543e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
25553e770bf7SBruno Larsen (billionai) 
25563e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC G2";
25573e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_G2;
25583e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
25593e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
25603e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
25613e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
25623e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
25633e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
25643e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
25653e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
25663e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
25673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
25683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
25693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
25703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
25713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
25723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
25733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
25743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
25753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
25763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_AL) |
25773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
25783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
25793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
25803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
25813e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
25829323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
25833e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
25843e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_ec603e;
25853e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
25863e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
25873e770bf7SBruno Larsen (billionai) }
25883e770bf7SBruno Larsen (billionai) 
25893e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(G2LE)(ObjectClass *oc, void *data)
25903e770bf7SBruno Larsen (billionai) {
25913e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
25923e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
25933e770bf7SBruno Larsen (billionai) 
25943e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC G2LE";
2595363bd7d0SFabiano Rosas     pcc->init_proc = init_proc_G2;
25963e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
25973e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
25983e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
25993e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
26003e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
26013e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
26023e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
26033e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
26043e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
26053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
26063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
26073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
26083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
26093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
26103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
26113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
26123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
26133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
26143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
26153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_AL) |
26163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
26173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
26183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
26193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
26203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
26213e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
26229323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
26233e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
26243e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_ec603e;
26253e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
26263e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
26273e770bf7SBruno Larsen (billionai) }
26283e770bf7SBruno Larsen (billionai) 
26293e770bf7SBruno Larsen (billionai) static void init_proc_e200(CPUPPCState *env)
26303e770bf7SBruno Larsen (billionai) {
26313e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, 0x000000070000FFFFULL);
2632acf629ebSFabiano Rosas 
26333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
26343e770bf7SBruno Larsen (billionai)                  &spr_read_spefscr, &spr_write_spefscr,
26353e770bf7SBruno Larsen (billionai)                  &spr_read_spefscr, &spr_write_spefscr,
26363e770bf7SBruno Larsen (billionai)                  0x00000000);
26373e770bf7SBruno Larsen (billionai)     /* Memory management */
26383e770bf7SBruno Larsen (billionai)     register_BookE206_sprs(env, 0x0000005D, NULL, 0);
26394ffb8c5eSFabiano Rosas     register_usprgh_sprs(env);
2640acf629ebSFabiano Rosas 
26413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
26423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26443e770bf7SBruno Larsen (billionai)                  0x00000000);
2645acf629ebSFabiano Rosas 
26463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
26473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26493e770bf7SBruno Larsen (billionai)                  0x00000000);
2650acf629ebSFabiano Rosas 
26513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_ALTCTXCR, "ALTCTXCR",
26523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26543e770bf7SBruno Larsen (billionai)                  0x00000000);
2655acf629ebSFabiano Rosas 
26563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_BUCSR, "BUCSR",
26573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26593e770bf7SBruno Larsen (billionai)                  0x00000000);
2660acf629ebSFabiano Rosas 
26613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_CTXCR, "CTXCR",
26623e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26633e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26643e770bf7SBruno Larsen (billionai)                  0x00000000);
2665acf629ebSFabiano Rosas 
26663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_DBCNT, "DBCNT",
26673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26683e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26693e770bf7SBruno Larsen (billionai)                  0x00000000);
2670acf629ebSFabiano Rosas 
26713e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_DBCR3, "DBCR3",
26723e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26733e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26743e770bf7SBruno Larsen (billionai)                  0x00000000);
2675acf629ebSFabiano Rosas 
26763e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0",
26773e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
26783e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
26793e770bf7SBruno Larsen (billionai)                  0x00000000);
2680acf629ebSFabiano Rosas 
26813e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0",
26823e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26833e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26843e770bf7SBruno Larsen (billionai)                  0x00000000);
2685acf629ebSFabiano Rosas 
26863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1FINV0, "L1FINV0",
26873e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26883e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26893e770bf7SBruno Larsen (billionai)                  0x00000000);
2690acf629ebSFabiano Rosas 
26913e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
26923e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26933e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26943e770bf7SBruno Larsen (billionai)                  0x00000000);
2695acf629ebSFabiano Rosas 
26963e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
26973e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
26983e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
26993e770bf7SBruno Larsen (billionai)                  0x00000000);
2700acf629ebSFabiano Rosas 
27013e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
27023e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
27033e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
27043e770bf7SBruno Larsen (billionai)                  0x00000000);
2705acf629ebSFabiano Rosas 
27063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
27073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
27083e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
27093e770bf7SBruno Larsen (billionai)                  0x00000000);
2710acf629ebSFabiano Rosas 
27113e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
27123e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
27133e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
27143e770bf7SBruno Larsen (billionai)                  0x00000000); /* TOFIX */
27153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DSRR0, "DSRR0",
27163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
27173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
27183e770bf7SBruno Larsen (billionai)                  0x00000000);
27193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_DSRR1, "DSRR1",
27203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
27213e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
27223e770bf7SBruno Larsen (billionai)                  0x00000000);
27233e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
27243e770bf7SBruno Larsen (billionai)     env->nb_tlb = 64;
27253e770bf7SBruno Larsen (billionai)     env->nb_ways = 1;
27263e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
27273e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_EMB;
27283e770bf7SBruno Larsen (billionai) #endif
27293e770bf7SBruno Larsen (billionai)     init_excp_e200(env, 0xFFFF0000UL);
27303e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
27313e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
27323e770bf7SBruno Larsen (billionai)     /* XXX: TODO: allocate internal IRQ controller */
27333e770bf7SBruno Larsen (billionai) }
27343e770bf7SBruno Larsen (billionai) 
27353e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e200)(ObjectClass *oc, void *data)
27363e770bf7SBruno Larsen (billionai) {
27373e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
27383e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
27393e770bf7SBruno Larsen (billionai) 
27403e770bf7SBruno Larsen (billionai)     dc->desc = "e200 core";
27413e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e200;
27423e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
27433e770bf7SBruno Larsen (billionai)     /*
27443e770bf7SBruno Larsen (billionai)      * XXX: unimplemented instructions:
27453e770bf7SBruno Larsen (billionai)      * dcblc
27463e770bf7SBruno Larsen (billionai)      * dcbtlst
27473e770bf7SBruno Larsen (billionai)      * dcbtstls
27483e770bf7SBruno Larsen (billionai)      * icblc
27493e770bf7SBruno Larsen (billionai)      * icbtls
27503e770bf7SBruno Larsen (billionai)      * tlbivax
27513e770bf7SBruno Larsen (billionai)      * all SPE multiply-accumulate instructions
27523e770bf7SBruno Larsen (billionai)      */
27533e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL |
27543e770bf7SBruno Larsen (billionai)                        PPC_SPE | PPC_SPE_SINGLE |
27553e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI |
27563e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
27573e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
27583e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX |
27593e770bf7SBruno Larsen (billionai)                        PPC_BOOKE;
27603e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_UCLE) |
27613e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SPE) |
27623e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
27633e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
27643e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
27653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
27663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
27673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
27683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
27693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
27703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
27713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
27723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
27733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
27743e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
27753e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
27763e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
27773e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_860;
27783e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE |
27793e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_UBLE | POWERPC_FLAG_DE |
27803e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
27813e770bf7SBruno Larsen (billionai) }
27823e770bf7SBruno Larsen (billionai) 
27833e770bf7SBruno Larsen (billionai) enum fsl_e500_version {
27843e770bf7SBruno Larsen (billionai)     fsl_e500v1,
27853e770bf7SBruno Larsen (billionai)     fsl_e500v2,
27863e770bf7SBruno Larsen (billionai)     fsl_e500mc,
27873e770bf7SBruno Larsen (billionai)     fsl_e5500,
27883e770bf7SBruno Larsen (billionai)     fsl_e6500,
27893e770bf7SBruno Larsen (billionai) };
27903e770bf7SBruno Larsen (billionai) 
27913e770bf7SBruno Larsen (billionai) static void init_proc_e500(CPUPPCState *env, int version)
27923e770bf7SBruno Larsen (billionai) {
27933e770bf7SBruno Larsen (billionai)     uint32_t tlbncfg[2];
27943e770bf7SBruno Larsen (billionai)     uint64_t ivor_mask;
27953e770bf7SBruno Larsen (billionai)     uint64_t ivpr_mask = 0xFFFF0000ULL;
27963e770bf7SBruno Larsen (billionai)     uint32_t l1cfg0 = 0x3800  /* 8 ways */
27973e770bf7SBruno Larsen (billionai)                     | 0x0020; /* 32 kb */
27983e770bf7SBruno Larsen (billionai)     uint32_t l1cfg1 = 0x3800  /* 8 ways */
27993e770bf7SBruno Larsen (billionai)                     | 0x0020; /* 32 kb */
28003e770bf7SBruno Larsen (billionai)     uint32_t mmucfg = 0;
28013e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
28023e770bf7SBruno Larsen (billionai)     int i;
28033e770bf7SBruno Larsen (billionai) #endif
28043e770bf7SBruno Larsen (billionai) 
28053e770bf7SBruno Larsen (billionai)     /*
28063e770bf7SBruno Larsen (billionai)      * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
28073e770bf7SBruno Larsen (billionai)      *     complain when accessing them.
28083e770bf7SBruno Larsen (billionai)      * register_BookE_sprs(env, 0x0000000F0000FD7FULL);
28093e770bf7SBruno Larsen (billionai)      */
28103e770bf7SBruno Larsen (billionai)     switch (version) {
28113e770bf7SBruno Larsen (billionai)     case fsl_e500v1:
28123e770bf7SBruno Larsen (billionai)     case fsl_e500v2:
28133e770bf7SBruno Larsen (billionai)     default:
28143e770bf7SBruno Larsen (billionai)         ivor_mask = 0x0000000F0000FFFFULL;
28153e770bf7SBruno Larsen (billionai)         break;
28163e770bf7SBruno Larsen (billionai)     case fsl_e500mc:
28173e770bf7SBruno Larsen (billionai)     case fsl_e5500:
28183e770bf7SBruno Larsen (billionai)         ivor_mask = 0x000003FE0000FFFFULL;
28193e770bf7SBruno Larsen (billionai)         break;
28203e770bf7SBruno Larsen (billionai)     case fsl_e6500:
28213e770bf7SBruno Larsen (billionai)         ivor_mask = 0x000003FF0000FFFFULL;
28223e770bf7SBruno Larsen (billionai)         break;
28233e770bf7SBruno Larsen (billionai)     }
28243e770bf7SBruno Larsen (billionai)     register_BookE_sprs(env, ivor_mask);
28252a48d83dSFabiano Rosas 
28262a48d83dSFabiano Rosas     spr_register(env, SPR_USPRG3, "USPRG3",
28272a48d83dSFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
28282a48d83dSFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
28292a48d83dSFabiano Rosas                  0x00000000);
28302a48d83dSFabiano Rosas 
28313e770bf7SBruno Larsen (billionai)     /* Processor identification */
28323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_PIR, "PIR",
28333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
28343e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pir,
28353e770bf7SBruno Larsen (billionai)                  0x00000000);
2836acf629ebSFabiano Rosas 
28373e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
28383e770bf7SBruno Larsen (billionai)                  &spr_read_spefscr, &spr_write_spefscr,
28393e770bf7SBruno Larsen (billionai)                  &spr_read_spefscr, &spr_write_spefscr,
28403e770bf7SBruno Larsen (billionai)                  0x00000000);
28413e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
28423e770bf7SBruno Larsen (billionai)     /* Memory management */
28433e770bf7SBruno Larsen (billionai)     env->nb_pids = 3;
28443e770bf7SBruno Larsen (billionai)     env->nb_ways = 2;
28453e770bf7SBruno Larsen (billionai)     env->id_tlbs = 0;
28463e770bf7SBruno Larsen (billionai)     switch (version) {
28473e770bf7SBruno Larsen (billionai)     case fsl_e500v1:
28483e770bf7SBruno Larsen (billionai)         tlbncfg[0] = register_tlbncfg(2, 1, 1, 0, 256);
28493e770bf7SBruno Larsen (billionai)         tlbncfg[1] = register_tlbncfg(16, 1, 9, TLBnCFG_AVAIL | TLBnCFG_IPROT, 16);
28503e770bf7SBruno Larsen (billionai)         break;
28513e770bf7SBruno Larsen (billionai)     case fsl_e500v2:
28523e770bf7SBruno Larsen (billionai)         tlbncfg[0] = register_tlbncfg(4, 1, 1, 0, 512);
28533e770bf7SBruno Larsen (billionai)         tlbncfg[1] = register_tlbncfg(16, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 16);
28543e770bf7SBruno Larsen (billionai)         break;
28553e770bf7SBruno Larsen (billionai)     case fsl_e500mc:
28563e770bf7SBruno Larsen (billionai)     case fsl_e5500:
28573e770bf7SBruno Larsen (billionai)         tlbncfg[0] = register_tlbncfg(4, 1, 1, 0, 512);
28583e770bf7SBruno Larsen (billionai)         tlbncfg[1] = register_tlbncfg(64, 1, 12, TLBnCFG_AVAIL | TLBnCFG_IPROT, 64);
28593e770bf7SBruno Larsen (billionai)         break;
28603e770bf7SBruno Larsen (billionai)     case fsl_e6500:
28613e770bf7SBruno Larsen (billionai)         mmucfg = 0x6510B45;
28623e770bf7SBruno Larsen (billionai)         env->nb_pids = 1;
28633e770bf7SBruno Larsen (billionai)         tlbncfg[0] = 0x08052400;
28643e770bf7SBruno Larsen (billionai)         tlbncfg[1] = 0x40028040;
28653e770bf7SBruno Larsen (billionai)         break;
28663e770bf7SBruno Larsen (billionai)     default:
28673e770bf7SBruno Larsen (billionai)         cpu_abort(env_cpu(env), "Unknown CPU: " TARGET_FMT_lx "\n",
28683e770bf7SBruno Larsen (billionai)                   env->spr[SPR_PVR]);
28693e770bf7SBruno Larsen (billionai)     }
28703e770bf7SBruno Larsen (billionai) #endif
28713e770bf7SBruno Larsen (billionai)     /* Cache sizes */
28723e770bf7SBruno Larsen (billionai)     switch (version) {
28733e770bf7SBruno Larsen (billionai)     case fsl_e500v1:
28743e770bf7SBruno Larsen (billionai)     case fsl_e500v2:
28753e770bf7SBruno Larsen (billionai)         env->dcache_line_size = 32;
28763e770bf7SBruno Larsen (billionai)         env->icache_line_size = 32;
28773e770bf7SBruno Larsen (billionai)         break;
28783e770bf7SBruno Larsen (billionai)     case fsl_e500mc:
28793e770bf7SBruno Larsen (billionai)     case fsl_e5500:
28803e770bf7SBruno Larsen (billionai)         env->dcache_line_size = 64;
28813e770bf7SBruno Larsen (billionai)         env->icache_line_size = 64;
28823e770bf7SBruno Larsen (billionai)         l1cfg0 |= 0x1000000; /* 64 byte cache block size */
28833e770bf7SBruno Larsen (billionai)         l1cfg1 |= 0x1000000; /* 64 byte cache block size */
28843e770bf7SBruno Larsen (billionai)         break;
28853e770bf7SBruno Larsen (billionai)     case fsl_e6500:
28863e770bf7SBruno Larsen (billionai)         env->dcache_line_size = 32;
28873e770bf7SBruno Larsen (billionai)         env->icache_line_size = 32;
28883e770bf7SBruno Larsen (billionai)         l1cfg0 |= 0x0F83820;
28893e770bf7SBruno Larsen (billionai)         l1cfg1 |= 0x0B83820;
28903e770bf7SBruno Larsen (billionai)         break;
28913e770bf7SBruno Larsen (billionai)     default:
28923e770bf7SBruno Larsen (billionai)         cpu_abort(env_cpu(env), "Unknown CPU: " TARGET_FMT_lx "\n",
28933e770bf7SBruno Larsen (billionai)                   env->spr[SPR_PVR]);
28943e770bf7SBruno Larsen (billionai)     }
28953e770bf7SBruno Larsen (billionai)     register_BookE206_sprs(env, 0x000000DF, tlbncfg, mmucfg);
28964ffb8c5eSFabiano Rosas     register_usprgh_sprs(env);
2897acf629ebSFabiano Rosas 
28983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
28993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29013e770bf7SBruno Larsen (billionai)                  0x00000000);
2902acf629ebSFabiano Rosas 
29033e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
29043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29063e770bf7SBruno Larsen (billionai)                  0x00000000);
2907acf629ebSFabiano Rosas 
29083e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_BBEAR, "BBEAR",
29093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29113e770bf7SBruno Larsen (billionai)                  0x00000000);
2912acf629ebSFabiano Rosas 
29133e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_BBTAR, "BBTAR",
29143e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29153e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29163e770bf7SBruno Larsen (billionai)                  0x00000000);
2917acf629ebSFabiano Rosas 
29183e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_MCAR, "MCAR",
29193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29213e770bf7SBruno Larsen (billionai)                  0x00000000);
2922acf629ebSFabiano Rosas 
29233e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
29243e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29253e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29263e770bf7SBruno Larsen (billionai)                  0x00000000);
2927acf629ebSFabiano Rosas 
29283e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_NPIDR, "NPIDR",
29293e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29303e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29313e770bf7SBruno Larsen (billionai)                  0x00000000);
2932acf629ebSFabiano Rosas 
29333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_BUCSR, "BUCSR",
29343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29363e770bf7SBruno Larsen (billionai)                  0x00000000);
2937acf629ebSFabiano Rosas 
29383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0",
29393e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
29403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
29413e770bf7SBruno Larsen (billionai)                  l1cfg0);
29423e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CFG1, "L1CFG1",
29433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
29443e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
29453e770bf7SBruno Larsen (billionai)                  l1cfg1);
29463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0",
29473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_e500_l1csr0,
29493e770bf7SBruno Larsen (billionai)                  0x00000000);
29503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_Exxx_L1CSR1, "L1CSR1",
29513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_e500_l1csr1,
29533e770bf7SBruno Larsen (billionai)                  0x00000000);
29543e770bf7SBruno Larsen (billionai)     if (version != fsl_e500v1 && version != fsl_e500v2) {
29553e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_Exxx_L2CSR0, "L2CSR0",
29563e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
29573e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_e500_l2csr0,
29583e770bf7SBruno Larsen (billionai)                      0x00000000);
29593e770bf7SBruno Larsen (billionai)     }
29603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
29613e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29623e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29633e770bf7SBruno Larsen (billionai)                  0x00000000);
29643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
29653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
29673e770bf7SBruno Larsen (billionai)                  0x00000000);
29683e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
29693e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29703e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_booke206_mmucsr0,
29713e770bf7SBruno Larsen (billionai)                  0x00000000);
29723e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BOOKE_EPR, "EPR",
29733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
29743e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
29753e770bf7SBruno Larsen (billionai)                  0x00000000);
29763e770bf7SBruno Larsen (billionai)     /* XXX better abstract into Emb.xxx features */
29773e770bf7SBruno Larsen (billionai)     if ((version == fsl_e5500) || (version == fsl_e6500)) {
29783e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_EPCR, "EPCR",
29793e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
29803e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
29813e770bf7SBruno Larsen (billionai)                      0x00000000);
29823e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_MAS7_MAS3, "MAS7_MAS3",
29833e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
29843e770bf7SBruno Larsen (billionai)                      &spr_read_mas73, &spr_write_mas73,
29853e770bf7SBruno Larsen (billionai)                      0x00000000);
29863e770bf7SBruno Larsen (billionai)         ivpr_mask = (target_ulong)~0xFFFFULL;
29873e770bf7SBruno Larsen (billionai)     }
29883e770bf7SBruno Larsen (billionai) 
29893e770bf7SBruno Larsen (billionai)     if (version == fsl_e6500) {
29903e770bf7SBruno Larsen (billionai)         /* Thread identification */
29913e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_TIR, "TIR",
29923e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
29933e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
29943e770bf7SBruno Larsen (billionai)                      0x00000000);
29953e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB0PS, "TLB0PS",
29963e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
29973e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
29983e770bf7SBruno Larsen (billionai)                      0x00000004);
29993e770bf7SBruno Larsen (billionai)         spr_register(env, SPR_BOOKE_TLB1PS, "TLB1PS",
30003e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
30013e770bf7SBruno Larsen (billionai)                      &spr_read_generic, SPR_NOACCESS,
30023e770bf7SBruno Larsen (billionai)                      0x7FFFFFFC);
30033e770bf7SBruno Larsen (billionai)     }
30043e770bf7SBruno Larsen (billionai) 
30053e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
30063e770bf7SBruno Larsen (billionai)     env->nb_tlb = 0;
30073e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_MAS;
30083e770bf7SBruno Larsen (billionai)     for (i = 0; i < BOOKE206_MAX_TLBN; i++) {
30093e770bf7SBruno Larsen (billionai)         env->nb_tlb += booke206_tlb_size(env, i);
30103e770bf7SBruno Larsen (billionai)     }
30113e770bf7SBruno Larsen (billionai) #endif
30123e770bf7SBruno Larsen (billionai) 
30133e770bf7SBruno Larsen (billionai)     init_excp_e200(env, ivpr_mask);
30143e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
30153e770bf7SBruno Larsen (billionai)     ppce500_irq_init(env_archcpu(env));
30163e770bf7SBruno Larsen (billionai) }
30173e770bf7SBruno Larsen (billionai) 
30183e770bf7SBruno Larsen (billionai) static void init_proc_e500v1(CPUPPCState *env)
30193e770bf7SBruno Larsen (billionai) {
30203e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e500v1);
30213e770bf7SBruno Larsen (billionai) }
30223e770bf7SBruno Larsen (billionai) 
30233e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500v1)(ObjectClass *oc, void *data)
30243e770bf7SBruno Larsen (billionai) {
30253e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
30263e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
30273e770bf7SBruno Larsen (billionai) 
30283e770bf7SBruno Larsen (billionai)     dc->desc = "e500v1 core";
30293e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e500v1;
30303e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
30313e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL |
30323e770bf7SBruno Larsen (billionai)                        PPC_SPE | PPC_SPE_SINGLE |
30333e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI |
30343e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
30353e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
30363e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC;
30373e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206;
30383e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_UCLE) |
30393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SPE) |
30403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
30413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
30423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
30433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
30443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
30453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
30463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
30473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
30483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
30493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
30503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
30513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
30523e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
30533e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
30543e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
30553e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_860;
30563e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE |
30573e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_UBLE | POWERPC_FLAG_DE |
30583e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
30593e770bf7SBruno Larsen (billionai) }
30603e770bf7SBruno Larsen (billionai) 
30613e770bf7SBruno Larsen (billionai) static void init_proc_e500v2(CPUPPCState *env)
30623e770bf7SBruno Larsen (billionai) {
30633e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e500v2);
30643e770bf7SBruno Larsen (billionai) }
30653e770bf7SBruno Larsen (billionai) 
30663e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500v2)(ObjectClass *oc, void *data)
30673e770bf7SBruno Larsen (billionai) {
30683e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
30693e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
30703e770bf7SBruno Larsen (billionai) 
30713e770bf7SBruno Larsen (billionai)     dc->desc = "e500v2 core";
30723e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e500v2;
30733e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
30743e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL |
30753e770bf7SBruno Larsen (billionai)                        PPC_SPE | PPC_SPE_SINGLE | PPC_SPE_DOUBLE |
30763e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI |
30773e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
30783e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
30793e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC;
30803e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206;
30813e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_UCLE) |
30823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SPE) |
30833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
30843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
30853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
30863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
30873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
30883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
30893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
30903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DWE) |
30913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
30923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
30933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
30943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR);
30953e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
30963e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
30973e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
30983e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_860;
30993e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SPE | POWERPC_FLAG_CE |
31003e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_UBLE | POWERPC_FLAG_DE |
31013e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
31023e770bf7SBruno Larsen (billionai) }
31033e770bf7SBruno Larsen (billionai) 
31043e770bf7SBruno Larsen (billionai) static void init_proc_e500mc(CPUPPCState *env)
31053e770bf7SBruno Larsen (billionai) {
31063e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e500mc);
31073e770bf7SBruno Larsen (billionai) }
31083e770bf7SBruno Larsen (billionai) 
31093e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e500mc)(ObjectClass *oc, void *data)
31103e770bf7SBruno Larsen (billionai) {
31113e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
31123e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
31133e770bf7SBruno Larsen (billionai) 
31143e770bf7SBruno Larsen (billionai)     dc->desc = "e500mc core";
31153e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e500mc;
31163e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
31173e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB |
31183e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI | PPC_RFMCI |
31193e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
31203e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
31213e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES |
31223e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL |
31233e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX | PPC_WAIT |
31243e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC;
31253e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL;
31263e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_GS) |
31273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_UCLE) |
31283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
31293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
31303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
31313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
31323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
31333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
31343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
31353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
31363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
31373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
31383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PX) |
31393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
31403e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
31413e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
31423e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
31433e770bf7SBruno Larsen (billionai)     /* FIXME: figure out the correct flag for e500mc */
31443e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_e500;
31453e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE |
31463e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
31473e770bf7SBruno Larsen (billionai) }
31483e770bf7SBruno Larsen (billionai) 
31493e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64
31503e770bf7SBruno Larsen (billionai) static void init_proc_e5500(CPUPPCState *env)
31513e770bf7SBruno Larsen (billionai) {
31523e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e5500);
31533e770bf7SBruno Larsen (billionai) }
31543e770bf7SBruno Larsen (billionai) 
31553e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e5500)(ObjectClass *oc, void *data)
31563e770bf7SBruno Larsen (billionai) {
31573e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
31583e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
31593e770bf7SBruno Larsen (billionai) 
31603e770bf7SBruno Larsen (billionai)     dc->desc = "e5500 core";
31613e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e5500;
31623e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
31633e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB |
31643e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI | PPC_RFMCI |
31653e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
31663e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
31673e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES |
31683e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL |
31693e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX | PPC_WAIT |
31703e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC |
31713e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_POPCNTB | PPC_POPCNTWD;
31723e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL | PPC2_PERM_ISA206 |
31733e770bf7SBruno Larsen (billionai)                         PPC2_FP_CVT_S64;
31743e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_CM) |
31753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_GS) |
31763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_UCLE) |
31773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
31783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
31793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
31803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
31813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
31823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
31833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
31843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
31853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
31863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
31873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PX) |
31883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
31893e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
31903e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
31913e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
31923e770bf7SBruno Larsen (billionai)     /* FIXME: figure out the correct flag for e5500 */
31933e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_e500;
31943e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE |
31953e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
31963e770bf7SBruno Larsen (billionai) }
31973e770bf7SBruno Larsen (billionai) 
31983e770bf7SBruno Larsen (billionai) static void init_proc_e6500(CPUPPCState *env)
31993e770bf7SBruno Larsen (billionai) {
32003e770bf7SBruno Larsen (billionai)     init_proc_e500(env, fsl_e6500);
32013e770bf7SBruno Larsen (billionai) }
32023e770bf7SBruno Larsen (billionai) 
32033e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e6500)(ObjectClass *oc, void *data)
32043e770bf7SBruno Larsen (billionai) {
32053e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
32063e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
32073e770bf7SBruno Larsen (billionai) 
32083e770bf7SBruno Larsen (billionai)     dc->desc = "e6500 core";
32093e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e6500;
32103e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_none;
32113e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_MFTB |
32123e770bf7SBruno Larsen (billionai)                        PPC_WRTEE | PPC_RFDI | PPC_RFMCI |
32133e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |
32143e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
32153e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FRES |
32163e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL |
32173e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX | PPC_WAIT |
32183e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBSYNC | PPC_TLBIVAX | PPC_MEM_SYNC |
32193e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_POPCNTB | PPC_POPCNTWD | PPC_ALTIVEC;
32203e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_BOOKE206 | PPC2_PRCNTL | PPC2_PERM_ISA206 |
32213e770bf7SBruno Larsen (billionai)                         PPC2_FP_CVT_S64 | PPC2_ATOMIC_ISA206;
32223e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_CM) |
32233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_GS) |
32243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_UCLE) |
32253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_CE) |
32263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
32273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
32283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
32293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
32303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
32313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
32323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
32333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IS) |
32343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DS) |
32353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PX) |
32363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
32373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR);
32383e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_BOOKE206;
32393e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_BOOKE;
32403e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_BookE;
32413e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_e500;
32423e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DE |
32433e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_VRE;
32443e770bf7SBruno Larsen (billionai) }
32453e770bf7SBruno Larsen (billionai) 
32463e770bf7SBruno Larsen (billionai) #endif
32473e770bf7SBruno Larsen (billionai) 
32483e770bf7SBruno Larsen (billionai) /* Non-embedded PowerPC                                                      */
32493e770bf7SBruno Larsen (billionai) static void init_proc_603(CPUPPCState *env)
32503e770bf7SBruno Larsen (billionai) {
3251217781afSFabiano Rosas     register_non_embedded_sprs(env);
32523e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
32533e770bf7SBruno Larsen (billionai)     register_603_sprs(env);
3254acf629ebSFabiano Rosas 
32553e770bf7SBruno Larsen (billionai)     /* Memory management */
32563e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
32573e770bf7SBruno Larsen (billionai)     register_6xx_7xx_soft_tlb(env, 64, 2);
32583e770bf7SBruno Larsen (billionai)     init_excp_603(env);
32593e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
32603e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
32613e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
32623e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
32633e770bf7SBruno Larsen (billionai) }
32643e770bf7SBruno Larsen (billionai) 
32653e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(603)(ObjectClass *oc, void *data)
32663e770bf7SBruno Larsen (billionai) {
32673e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
32683e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
32693e770bf7SBruno Larsen (billionai) 
32703e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 603";
32713e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_603;
32723e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
32733e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
32743e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
32753e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
32763e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
32773e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
32783e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
32793e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
32803e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
32813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
32823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
32833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
32843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
32853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
32863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
32873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
32883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
32893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
32903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
32913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
32923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
32933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
32943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
32953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
32963e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
32979323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
32983e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
32993e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_603;
33003e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
33013e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
33023e770bf7SBruno Larsen (billionai) }
33033e770bf7SBruno Larsen (billionai) 
33043e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(603E)(ObjectClass *oc, void *data)
33053e770bf7SBruno Larsen (billionai) {
33063e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
33073e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
33083e770bf7SBruno Larsen (billionai) 
33093e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 603e";
3310fd77f757SFabiano Rosas     pcc->init_proc = init_proc_603;
33113e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
33123e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
33133e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
33143e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
33153e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
33163e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
33173e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
33183e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
33193e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
33203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TGPR) |
33213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
33223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
33233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
33243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
33253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
33263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
33273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
33283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
33293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
33303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
33313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
33323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
33333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
33343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
33353e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
33369323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
33373e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
33383e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_ec603e;
33393e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
33403e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
33413e770bf7SBruno Larsen (billionai) }
33423e770bf7SBruno Larsen (billionai) 
33439f33f3d8SFabiano Rosas static void init_proc_e300(CPUPPCState *env)
33449f33f3d8SFabiano Rosas {
33459f33f3d8SFabiano Rosas     init_proc_603(env);
33469f33f3d8SFabiano Rosas     register_e300_sprs(env);
33479f33f3d8SFabiano Rosas }
33489f33f3d8SFabiano Rosas 
33499f33f3d8SFabiano Rosas POWERPC_FAMILY(e300)(ObjectClass *oc, void *data)
33509f33f3d8SFabiano Rosas {
33519f33f3d8SFabiano Rosas     DeviceClass *dc = DEVICE_CLASS(oc);
33529f33f3d8SFabiano Rosas     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
33539f33f3d8SFabiano Rosas 
33549f33f3d8SFabiano Rosas     dc->desc = "e300 core";
33559f33f3d8SFabiano Rosas     pcc->init_proc = init_proc_e300;
33569f33f3d8SFabiano Rosas     pcc->check_pow = check_pow_hid0;
33579f33f3d8SFabiano Rosas     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
33589f33f3d8SFabiano Rosas                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
33599f33f3d8SFabiano Rosas                        PPC_FLOAT_STFIWX |
33609f33f3d8SFabiano Rosas                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
33619f33f3d8SFabiano Rosas                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
33629f33f3d8SFabiano Rosas                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
33639f33f3d8SFabiano Rosas                        PPC_SEGMENT | PPC_EXTERN;
33649f33f3d8SFabiano Rosas     pcc->msr_mask = (1ull << MSR_POW) |
33659f33f3d8SFabiano Rosas                     (1ull << MSR_TGPR) |
33669f33f3d8SFabiano Rosas                     (1ull << MSR_ILE) |
33679f33f3d8SFabiano Rosas                     (1ull << MSR_EE) |
33689f33f3d8SFabiano Rosas                     (1ull << MSR_PR) |
33699f33f3d8SFabiano Rosas                     (1ull << MSR_FP) |
33709f33f3d8SFabiano Rosas                     (1ull << MSR_ME) |
33719f33f3d8SFabiano Rosas                     (1ull << MSR_FE0) |
33729f33f3d8SFabiano Rosas                     (1ull << MSR_SE) |
33739f33f3d8SFabiano Rosas                     (1ull << MSR_DE) |
33749f33f3d8SFabiano Rosas                     (1ull << MSR_FE1) |
33759f33f3d8SFabiano Rosas                     (1ull << MSR_AL) |
33769f33f3d8SFabiano Rosas                     (1ull << MSR_EP) |
33779f33f3d8SFabiano Rosas                     (1ull << MSR_IR) |
33789f33f3d8SFabiano Rosas                     (1ull << MSR_DR) |
33799f33f3d8SFabiano Rosas                     (1ull << MSR_RI) |
33809f33f3d8SFabiano Rosas                     (1ull << MSR_LE);
33819f33f3d8SFabiano Rosas     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
33829f33f3d8SFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
33839f33f3d8SFabiano Rosas     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
33849f33f3d8SFabiano Rosas     pcc->bfd_mach = bfd_mach_ppc_603;
33859f33f3d8SFabiano Rosas     pcc->flags = POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |
33869f33f3d8SFabiano Rosas                  POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK;
33879f33f3d8SFabiano Rosas }
33889f33f3d8SFabiano Rosas 
33893e770bf7SBruno Larsen (billionai) static void init_proc_604(CPUPPCState *env)
33903e770bf7SBruno Larsen (billionai) {
3391217781afSFabiano Rosas     register_non_embedded_sprs(env);
33923e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
33933e770bf7SBruno Larsen (billionai)     register_604_sprs(env);
339420f6fb99SFabiano Rosas 
33953e770bf7SBruno Larsen (billionai)     /* Memory management */
33963e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
33973e770bf7SBruno Larsen (billionai)     init_excp_604(env);
33983e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
33993e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
34003e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
34013e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
34023e770bf7SBruno Larsen (billionai) }
34033e770bf7SBruno Larsen (billionai) 
34043e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(604)(ObjectClass *oc, void *data)
34053e770bf7SBruno Larsen (billionai) {
34063e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
34073e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
34083e770bf7SBruno Larsen (billionai) 
34093e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 604";
34103e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_604;
34113e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
34123e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
34133e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
34143e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
34153e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
34163e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
34173e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
34183e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
34193e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
34203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
34213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
34223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
34233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
34243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
34253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
34263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
34273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
34283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
34293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
34303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
34313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
34323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
34333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
34343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
34353e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
34369323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
34373e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
34383e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_604;
34393e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
34403e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
34413e770bf7SBruno Larsen (billionai) }
34423e770bf7SBruno Larsen (billionai) 
34433e770bf7SBruno Larsen (billionai) static void init_proc_604E(CPUPPCState *env)
34443e770bf7SBruno Larsen (billionai) {
34450df0ca16SFabiano Rosas     init_proc_604(env);
34463b18ec76SFabiano Rosas     register_604e_sprs(env);
34473e770bf7SBruno Larsen (billionai) }
34483e770bf7SBruno Larsen (billionai) 
34493e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(604E)(ObjectClass *oc, void *data)
34503e770bf7SBruno Larsen (billionai) {
34513e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
34523e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
34533e770bf7SBruno Larsen (billionai) 
34543e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 604E";
34553e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_604E;
34563e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
34573e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
34583e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
34593e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
34603e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
34613e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
34623e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
34633e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
34643e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
34653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
34663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
34673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
34683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
34693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
34703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
34713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
34723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
34733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
34743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
34753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
34763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
34773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
34783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
34793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
34803e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
34819323650fSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_6xx;
34823e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
34833e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_604;
34843e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
34853e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
34863e770bf7SBruno Larsen (billionai) }
34873e770bf7SBruno Larsen (billionai) 
34883e770bf7SBruno Larsen (billionai) static void init_proc_740(CPUPPCState *env)
34893e770bf7SBruno Larsen (billionai) {
3490217781afSFabiano Rosas     register_non_embedded_sprs(env);
34913e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
34923e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
34933e770bf7SBruno Larsen (billionai)     /* Thermal management */
34943e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
3495acf629ebSFabiano Rosas 
34963e770bf7SBruno Larsen (billionai)     /* Memory management */
34973e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
34983e770bf7SBruno Larsen (billionai)     init_excp_7x0(env);
34993e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
35003e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
35013e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
35023e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
35033e770bf7SBruno Larsen (billionai) }
35043e770bf7SBruno Larsen (billionai) 
35053e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(740)(ObjectClass *oc, void *data)
35063e770bf7SBruno Larsen (billionai) {
35073e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
35083e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
35093e770bf7SBruno Larsen (billionai) 
35103e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 740";
35113e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_740;
35123e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
35133e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
35143e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
35153e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
35163e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
35173e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
35183e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
35193e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
35203e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
35213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
35223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
35233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
35243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
35253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
35263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
35273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
35283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
35293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
35303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
35313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
35323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
35333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
35343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
35353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
35363e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
3537fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
35383e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
35393e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
35403e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
35413e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
35423e770bf7SBruno Larsen (billionai) }
35433e770bf7SBruno Larsen (billionai) 
35443e770bf7SBruno Larsen (billionai) static void init_proc_750(CPUPPCState *env)
35453e770bf7SBruno Larsen (billionai) {
3546217781afSFabiano Rosas     register_non_embedded_sprs(env);
35473e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
35483e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
3549acf629ebSFabiano Rosas 
35503e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
35513e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
35523e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
35533e770bf7SBruno Larsen (billionai)                  0x00000000);
35543e770bf7SBruno Larsen (billionai)     /* Thermal management */
35553e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
3556acf629ebSFabiano Rosas 
35573e770bf7SBruno Larsen (billionai)     /* Memory management */
35583e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
35593e770bf7SBruno Larsen (billionai)     /*
35603e770bf7SBruno Larsen (billionai)      * XXX: high BATs are also present but are known to be bugged on
35613e770bf7SBruno Larsen (billionai)      *      die version 1.x
35623e770bf7SBruno Larsen (billionai)      */
35633e770bf7SBruno Larsen (billionai)     init_excp_7x0(env);
35643e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
35653e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
35663e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
35673e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
35683e770bf7SBruno Larsen (billionai) }
35693e770bf7SBruno Larsen (billionai) 
35703e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750)(ObjectClass *oc, void *data)
35713e770bf7SBruno Larsen (billionai) {
35723e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
35733e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
35743e770bf7SBruno Larsen (billionai) 
35753e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750";
35763e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750;
35773e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
35783e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
35793e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
35803e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
35813e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
35823e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
35833e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
35843e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
35853e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
35863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
35873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
35883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
35893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
35903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
35913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
35923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
35933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
35943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
35953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
35963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
35973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
35983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
35993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
36003e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
36013e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
3602fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
36033e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
36043e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
36053e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
36063e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
36073e770bf7SBruno Larsen (billionai) }
36083e770bf7SBruno Larsen (billionai) 
36093e770bf7SBruno Larsen (billionai) static void init_proc_750cl(CPUPPCState *env)
36103e770bf7SBruno Larsen (billionai) {
3611217781afSFabiano Rosas     register_non_embedded_sprs(env);
36123e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
36133e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
3614acf629ebSFabiano Rosas 
36153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
36163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
36183e770bf7SBruno Larsen (billionai)                  0x00000000);
36193e770bf7SBruno Larsen (billionai)     /* Thermal management */
36203e770bf7SBruno Larsen (billionai)     /* Those registers are fake on 750CL */
36213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM1, "THRM1",
36223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36243e770bf7SBruno Larsen (billionai)                  0x00000000);
36253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM2, "THRM2",
36263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36283e770bf7SBruno Larsen (billionai)                  0x00000000);
36293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_THRM3, "THRM3",
36303e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36313e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36323e770bf7SBruno Larsen (billionai)                  0x00000000);
3633acf629ebSFabiano Rosas 
36343e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_TDCL, "TDCL",
36353e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36363e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36373e770bf7SBruno Larsen (billionai)                  0x00000000);
36383e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_TDCH, "TDCH",
36393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36413e770bf7SBruno Larsen (billionai)                  0x00000000);
36423e770bf7SBruno Larsen (billionai)     /* DMA */
36433e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_WPAR, "WPAR",
36443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36463e770bf7SBruno Larsen (billionai)                  0x00000000);
36473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_DMAL, "DMAL",
36483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36503e770bf7SBruno Larsen (billionai)                  0x00000000);
36513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_DMAU, "DMAU",
36523e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36533e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36543e770bf7SBruno Larsen (billionai)                  0x00000000);
36553e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
36563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750CL_HID2, "HID2",
36573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36593e770bf7SBruno Larsen (billionai)                  0x00000000);
3660acf629ebSFabiano Rosas 
36613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750CL_HID4, "HID4",
36623e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36633e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36643e770bf7SBruno Larsen (billionai)                  0x00000000);
36653e770bf7SBruno Larsen (billionai)     /* Quantization registers */
36663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR0, "GQR0",
36673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36683e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36693e770bf7SBruno Larsen (billionai)                  0x00000000);
3670acf629ebSFabiano Rosas 
36713e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR1, "GQR1",
36723e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36733e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36743e770bf7SBruno Larsen (billionai)                  0x00000000);
3675acf629ebSFabiano Rosas 
36763e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR2, "GQR2",
36773e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36783e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36793e770bf7SBruno Larsen (billionai)                  0x00000000);
3680acf629ebSFabiano Rosas 
36813e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR3, "GQR3",
36823e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36833e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36843e770bf7SBruno Larsen (billionai)                  0x00000000);
3685acf629ebSFabiano Rosas 
36863e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR4, "GQR4",
36873e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36883e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36893e770bf7SBruno Larsen (billionai)                  0x00000000);
3690acf629ebSFabiano Rosas 
36913e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR5, "GQR5",
36923e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36933e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36943e770bf7SBruno Larsen (billionai)                  0x00000000);
3695acf629ebSFabiano Rosas 
36963e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR6, "GQR6",
36973e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
36983e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
36993e770bf7SBruno Larsen (billionai)                  0x00000000);
3700acf629ebSFabiano Rosas 
37013e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_GQR7, "GQR7",
37023e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
37033e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
37043e770bf7SBruno Larsen (billionai)                  0x00000000);
37053e770bf7SBruno Larsen (billionai)     /* Memory management */
37063e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
37073e770bf7SBruno Larsen (billionai)     /* PowerPC 750cl has 8 DBATs and 8 IBATs */
37083e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
37093e770bf7SBruno Larsen (billionai)     init_excp_750cl(env);
37103e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
37113e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
37123e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
37133e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
37143e770bf7SBruno Larsen (billionai) }
37153e770bf7SBruno Larsen (billionai) 
37163e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750cl)(ObjectClass *oc, void *data)
37173e770bf7SBruno Larsen (billionai) {
37183e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
37193e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
37203e770bf7SBruno Larsen (billionai) 
37213e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750 CL";
37223e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750cl;
37233e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
37243e770bf7SBruno Larsen (billionai)     /*
37253e770bf7SBruno Larsen (billionai)      * XXX: not implemented:
37263e770bf7SBruno Larsen (billionai)      * cache lock instructions:
37273e770bf7SBruno Larsen (billionai)      * dcbz_l
37283e770bf7SBruno Larsen (billionai)      * floating point paired instructions
37293e770bf7SBruno Larsen (billionai)      * psq_lux
37303e770bf7SBruno Larsen (billionai)      * psq_lx
37313e770bf7SBruno Larsen (billionai)      * psq_stux
37323e770bf7SBruno Larsen (billionai)      * psq_stx
37333e770bf7SBruno Larsen (billionai)      * ps_abs
37343e770bf7SBruno Larsen (billionai)      * ps_add
37353e770bf7SBruno Larsen (billionai)      * ps_cmpo0
37363e770bf7SBruno Larsen (billionai)      * ps_cmpo1
37373e770bf7SBruno Larsen (billionai)      * ps_cmpu0
37383e770bf7SBruno Larsen (billionai)      * ps_cmpu1
37393e770bf7SBruno Larsen (billionai)      * ps_div
37403e770bf7SBruno Larsen (billionai)      * ps_madd
37413e770bf7SBruno Larsen (billionai)      * ps_madds0
37423e770bf7SBruno Larsen (billionai)      * ps_madds1
37433e770bf7SBruno Larsen (billionai)      * ps_merge00
37443e770bf7SBruno Larsen (billionai)      * ps_merge01
37453e770bf7SBruno Larsen (billionai)      * ps_merge10
37463e770bf7SBruno Larsen (billionai)      * ps_merge11
37473e770bf7SBruno Larsen (billionai)      * ps_mr
37483e770bf7SBruno Larsen (billionai)      * ps_msub
37493e770bf7SBruno Larsen (billionai)      * ps_mul
37503e770bf7SBruno Larsen (billionai)      * ps_muls0
37513e770bf7SBruno Larsen (billionai)      * ps_muls1
37523e770bf7SBruno Larsen (billionai)      * ps_nabs
37533e770bf7SBruno Larsen (billionai)      * ps_neg
37543e770bf7SBruno Larsen (billionai)      * ps_nmadd
37553e770bf7SBruno Larsen (billionai)      * ps_nmsub
37563e770bf7SBruno Larsen (billionai)      * ps_res
37573e770bf7SBruno Larsen (billionai)      * ps_rsqrte
37583e770bf7SBruno Larsen (billionai)      * ps_sel
37593e770bf7SBruno Larsen (billionai)      * ps_sub
37603e770bf7SBruno Larsen (billionai)      * ps_sum0
37613e770bf7SBruno Larsen (billionai)      * ps_sum1
37623e770bf7SBruno Larsen (billionai)      */
37633e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
37643e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
37653e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
37663e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
37673e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
37683e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
37693e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
37703e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
37713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
37723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
37733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
37743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
37753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
37763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
37773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
37783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
37793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
37803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
37813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
37823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
37833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
37843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
37853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
37863e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
3787fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
37883e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
37893e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
37903e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
37913e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
37923e770bf7SBruno Larsen (billionai) }
37933e770bf7SBruno Larsen (billionai) 
37943e770bf7SBruno Larsen (billionai) static void init_proc_750cx(CPUPPCState *env)
37953e770bf7SBruno Larsen (billionai) {
3796217781afSFabiano Rosas     register_non_embedded_sprs(env);
37973e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
37983e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
3799acf629ebSFabiano Rosas 
38003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
38013e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38023e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
38033e770bf7SBruno Larsen (billionai)                  0x00000000);
38043e770bf7SBruno Larsen (billionai)     /* Thermal management */
38053e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
3806acf629ebSFabiano Rosas 
38073e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SDA, "SDA",
38083e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38093e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
38103e770bf7SBruno Larsen (billionai)                  0x00000000);
3811acf629ebSFabiano Rosas 
38123e770bf7SBruno Larsen (billionai)     /* Memory management */
38133e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
38143e770bf7SBruno Larsen (billionai)     /* PowerPC 750cx has 8 DBATs and 8 IBATs */
38153e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
38163e770bf7SBruno Larsen (billionai)     init_excp_750cx(env);
38173e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
38183e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
38193e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
38203e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
38213e770bf7SBruno Larsen (billionai) }
38223e770bf7SBruno Larsen (billionai) 
38233e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750cx)(ObjectClass *oc, void *data)
38243e770bf7SBruno Larsen (billionai) {
38253e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
38263e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
38273e770bf7SBruno Larsen (billionai) 
38283e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750CX";
38293e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750cx;
38303e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
38313e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
38323e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
38333e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
38343e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
38353e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
38363e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
38373e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
38383e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
38393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
38403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
38413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
38423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
38433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
38443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
38453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
38463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
38473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
38483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
38493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
38503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
38513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
38523e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
38533e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
38543e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
3855fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
38563e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
38573e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
38583e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
38593e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
38603e770bf7SBruno Larsen (billionai) }
38613e770bf7SBruno Larsen (billionai) 
38623e770bf7SBruno Larsen (billionai) static void init_proc_750fx(CPUPPCState *env)
38633e770bf7SBruno Larsen (billionai) {
3864217781afSFabiano Rosas     register_non_embedded_sprs(env);
38653e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
38663e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
3867acf629ebSFabiano Rosas 
38683e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
38693e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38703e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
38713e770bf7SBruno Larsen (billionai)                  0x00000000);
38723e770bf7SBruno Larsen (billionai)     /* Thermal management */
38733e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
3874acf629ebSFabiano Rosas 
38753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_THRM4, "THRM4",
38763e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38773e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
38783e770bf7SBruno Larsen (billionai)                  0x00000000);
38793e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
38803e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750FX_HID2, "HID2",
38813e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
38823e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
38833e770bf7SBruno Larsen (billionai)                  0x00000000);
38843e770bf7SBruno Larsen (billionai)     /* Memory management */
38853e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
38863e770bf7SBruno Larsen (billionai)     /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
38873e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
38883e770bf7SBruno Larsen (billionai)     init_excp_7x0(env);
38893e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
38903e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
38913e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
38923e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
38933e770bf7SBruno Larsen (billionai) }
38943e770bf7SBruno Larsen (billionai) 
38953e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750fx)(ObjectClass *oc, void *data)
38963e770bf7SBruno Larsen (billionai) {
38973e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
38983e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
38993e770bf7SBruno Larsen (billionai) 
39003e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750FX";
39013e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750fx;
39023e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
39033e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
39043e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
39053e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
39063e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
39073e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
39083e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
39093e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
39103e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
39113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
39123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
39133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
39143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
39153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
39163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
39173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
39183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
39193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
39203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
39213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
39223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
39233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
39243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
39253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
39263e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
3927fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
39283e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
39293e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
39303e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
39313e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
39323e770bf7SBruno Larsen (billionai) }
39333e770bf7SBruno Larsen (billionai) 
39343e770bf7SBruno Larsen (billionai) static void init_proc_750gx(CPUPPCState *env)
39353e770bf7SBruno Larsen (billionai) {
3936217781afSFabiano Rosas     register_non_embedded_sprs(env);
39373e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
39383e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
3939acf629ebSFabiano Rosas 
39403e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2CR, "L2CR",
39413e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
39423e770bf7SBruno Larsen (billionai)                  &spr_read_generic, spr_access_nop,
39433e770bf7SBruno Larsen (billionai)                  0x00000000);
39443e770bf7SBruno Larsen (billionai)     /* Thermal management */
39453e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
3946acf629ebSFabiano Rosas 
39473e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750_THRM4, "THRM4",
39483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
39493e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
39503e770bf7SBruno Larsen (billionai)                  0x00000000);
39513e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
39523e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_750FX_HID2, "HID2",
39533e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
39543e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
39553e770bf7SBruno Larsen (billionai)                  0x00000000);
39563e770bf7SBruno Larsen (billionai)     /* Memory management */
39573e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
39583e770bf7SBruno Larsen (billionai)     /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
39593e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
39603e770bf7SBruno Larsen (billionai)     init_excp_7x0(env);
39613e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
39623e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
39633e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
39643e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
39653e770bf7SBruno Larsen (billionai) }
39663e770bf7SBruno Larsen (billionai) 
39673e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(750gx)(ObjectClass *oc, void *data)
39683e770bf7SBruno Larsen (billionai) {
39693e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
39703e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
39713e770bf7SBruno Larsen (billionai) 
39723e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 750GX";
39733e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_750gx;
39743e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
39753e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
39763e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
39773e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
39783e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
39793e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
39803e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
39813e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
39823e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
39833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
39843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
39853e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
39863e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
39873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
39883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
39893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
39903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
39913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
39923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
39933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
39943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
39953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
39963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
39973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
39983e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
3999fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
40003e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
40013e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
40023e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
40033e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
40043e770bf7SBruno Larsen (billionai) }
40053e770bf7SBruno Larsen (billionai) 
40063e770bf7SBruno Larsen (billionai) static void init_proc_745(CPUPPCState *env)
40073e770bf7SBruno Larsen (billionai) {
4008217781afSFabiano Rosas     register_non_embedded_sprs(env);
40093e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
40103e770bf7SBruno Larsen (billionai)     register_7xx_sprs(env);
4011a5d1120bSFabiano Rosas     register_745_sprs(env);
40123e770bf7SBruno Larsen (billionai)     /* Thermal management */
40133e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
4014acf629ebSFabiano Rosas 
40153e770bf7SBruno Larsen (billionai)     /* Memory management */
40163e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
40173e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
40183e770bf7SBruno Larsen (billionai)     register_6xx_7xx_soft_tlb(env, 64, 2);
40193e770bf7SBruno Larsen (billionai)     init_excp_7x5(env);
40203e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
40213e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
40223e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
40233e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
40243e770bf7SBruno Larsen (billionai) }
40253e770bf7SBruno Larsen (billionai) 
40263e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(745)(ObjectClass *oc, void *data)
40273e770bf7SBruno Larsen (billionai) {
40283e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
40293e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
40303e770bf7SBruno Larsen (billionai) 
40313e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 745";
40323e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_745;
40333e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
40343e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
40353e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
40363e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
40373e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
40383e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
40393e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
40403e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
40413e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
40423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
40433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
40443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
40453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
40463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
40473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
40483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
40493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
40503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
40513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
40523e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
40533e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
40543e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
40553e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
40563e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
40573e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
4058fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
40593e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
40603e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
40613e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
40623e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
40633e770bf7SBruno Larsen (billionai) }
40643e770bf7SBruno Larsen (billionai) 
40653e770bf7SBruno Larsen (billionai) static void init_proc_755(CPUPPCState *env)
40663e770bf7SBruno Larsen (billionai) {
4067c1f21577SFabiano Rosas     init_proc_745(env);
406828930245SFabiano Rosas     register_755_sprs(env);
40693e770bf7SBruno Larsen (billionai) }
40703e770bf7SBruno Larsen (billionai) 
40713e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(755)(ObjectClass *oc, void *data)
40723e770bf7SBruno Larsen (billionai) {
40733e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
40743e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
40753e770bf7SBruno Larsen (billionai) 
40763e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 755";
40773e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_755;
40783e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
40793e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
40803e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
40813e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |
40823e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
40833e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
40843e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB |
40853e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN;
40863e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_POW) |
40873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
40883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
40893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
40903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
40913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
40923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
40933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
40943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
40953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
40963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
40973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
40983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
40993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
41003e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
41013e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
41023e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_SOFT_6xx;
4103fd7dc4bbSFabiano Rosas     pcc->excp_model = POWERPC_EXCP_7xx;
41043e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
41053e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_750;
41063e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_SE | POWERPC_FLAG_BE |
41073e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK;
41083e770bf7SBruno Larsen (billionai) }
41093e770bf7SBruno Larsen (billionai) 
41103e770bf7SBruno Larsen (billionai) static void init_proc_7400(CPUPPCState *env)
41113e770bf7SBruno Larsen (billionai) {
4112217781afSFabiano Rosas     register_non_embedded_sprs(env);
41133e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
41143e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
41153e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
4116acf629ebSFabiano Rosas 
41173e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
41183e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
41193e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
41203e770bf7SBruno Larsen (billionai)                  0x00000000);
4121acf629ebSFabiano Rosas 
41223e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSCR1, "MSSCR1",
41233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41243e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
41253e770bf7SBruno Larsen (billionai)                  0x00000000);
41263e770bf7SBruno Larsen (billionai)     /* Thermal management */
41273e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
41283e770bf7SBruno Larsen (billionai)     /* Memory management */
41293e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
41303e770bf7SBruno Larsen (billionai)     init_excp_7400(env);
41313e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
41323e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
41333e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
41343e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
41353e770bf7SBruno Larsen (billionai) }
41363e770bf7SBruno Larsen (billionai) 
41373e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7400)(ObjectClass *oc, void *data)
41383e770bf7SBruno Larsen (billionai) {
41393e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
41403e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
41413e770bf7SBruno Larsen (billionai) 
41423e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7400 (aka G4)";
41433e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7400;
41443e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
41453e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
41463e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
41473e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
41483e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
41493e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
41503e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
41513e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
41523e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
41533e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIA |
41543e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
41553e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
41563e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
41573e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
41583e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
41593e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
41603e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
41613e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
41623e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
41633e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
41643e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
41653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
41663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
41673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
41683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
41693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
41703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
41713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
41723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
41733e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
41743e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
41753e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
41763e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
41773e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
41783e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
41793e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
41803e770bf7SBruno Larsen (billionai) }
41813e770bf7SBruno Larsen (billionai) 
41823e770bf7SBruno Larsen (billionai) static void init_proc_7410(CPUPPCState *env)
41833e770bf7SBruno Larsen (billionai) {
4184217781afSFabiano Rosas     register_non_embedded_sprs(env);
41853e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
41863e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
41873e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
4188acf629ebSFabiano Rosas 
41893e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
41903e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
41913e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
41923e770bf7SBruno Larsen (billionai)                  0x00000000);
41933e770bf7SBruno Larsen (billionai)     /* Thermal management */
41943e770bf7SBruno Larsen (billionai)     register_thrm_sprs(env);
41953e770bf7SBruno Larsen (billionai)     /* L2PMCR */
4196acf629ebSFabiano Rosas 
41973e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L2PMCR, "L2PMCR",
41983e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
41993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42003e770bf7SBruno Larsen (billionai)                  0x00000000);
42013e770bf7SBruno Larsen (billionai)     /* LDSTDB */
4202acf629ebSFabiano Rosas 
42033e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTDB, "LDSTDB",
42043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42063e770bf7SBruno Larsen (billionai)                  0x00000000);
42073e770bf7SBruno Larsen (billionai)     /* Memory management */
42083e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
42093e770bf7SBruno Larsen (billionai)     init_excp_7400(env);
42103e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
42113e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
42123e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
42133e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
42143e770bf7SBruno Larsen (billionai) }
42153e770bf7SBruno Larsen (billionai) 
42163e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7410)(ObjectClass *oc, void *data)
42173e770bf7SBruno Larsen (billionai) {
42183e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
42193e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
42203e770bf7SBruno Larsen (billionai) 
42213e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7410 (aka G4)";
42223e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7410;
42233e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0;
42243e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
42253e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
42263e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
42273e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
42283e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
42293e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
42303e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
42313e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
42323e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIA |
42333e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
42343e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
42353e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
42363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
42373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
42383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
42393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
42403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
42413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
42423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
42433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
42443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
42453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
42463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
42473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
42483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
42493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
42503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
42513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
42523e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
42533e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
42543e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
42553e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
42563e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
42573e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
42583e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
42593e770bf7SBruno Larsen (billionai) }
42603e770bf7SBruno Larsen (billionai) 
42613e770bf7SBruno Larsen (billionai) static void init_proc_7440(CPUPPCState *env)
42623e770bf7SBruno Larsen (billionai) {
4263217781afSFabiano Rosas     register_non_embedded_sprs(env);
42643e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
42653e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
42663e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
4267acf629ebSFabiano Rosas 
42683e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
42693e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
42703e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
42713e770bf7SBruno Larsen (billionai)                  0x00000000);
42723e770bf7SBruno Larsen (billionai)     /* LDSTCR */
42733e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
42743e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42753e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42763e770bf7SBruno Larsen (billionai)                  0x00000000);
42773e770bf7SBruno Larsen (billionai)     /* ICTRL */
42783e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
42793e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42803e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42813e770bf7SBruno Larsen (billionai)                  0x00000000);
42823e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
42833e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
42843e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42853e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42863e770bf7SBruno Larsen (billionai)                  0x00000000);
42873e770bf7SBruno Larsen (billionai)     /* PMC */
42883e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
42893e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
42903e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
42913e770bf7SBruno Larsen (billionai)                  0x00000000);
4292acf629ebSFabiano Rosas 
42933e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
42943e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
42953e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
42963e770bf7SBruno Larsen (billionai)                  0x00000000);
4297acf629ebSFabiano Rosas 
42983e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
42993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43013e770bf7SBruno Larsen (billionai)                  0x00000000);
4302acf629ebSFabiano Rosas 
43033e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
43043e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
43053e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
43063e770bf7SBruno Larsen (billionai)                  0x00000000);
43073e770bf7SBruno Larsen (billionai)     /* Memory management */
43083e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
43093e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
43103e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
43113e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
43123e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
43133e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
43143e770bf7SBruno Larsen (billionai) }
43153e770bf7SBruno Larsen (billionai) 
43163e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7440)(ObjectClass *oc, void *data)
43173e770bf7SBruno Larsen (billionai) {
43183e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
43193e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
43203e770bf7SBruno Larsen (billionai) 
43213e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7440 (aka G4)";
43223e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7440;
43233e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
43243e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
43253e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
43263e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
43273e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
43283e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
43293e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
43303e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
43313e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
43321da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
43333e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
43343e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
43353e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
43363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
43373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
43383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
43393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
43403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
43413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
43423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
43433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
43443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
43453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
43463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
43473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
43483e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
43493e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
43503e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
43513e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
43521da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
43533e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
43543e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
43553e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
43563e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
43573e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
43583e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
43593e770bf7SBruno Larsen (billionai) }
43603e770bf7SBruno Larsen (billionai) 
43613e770bf7SBruno Larsen (billionai) static void init_proc_7450(CPUPPCState *env)
43623e770bf7SBruno Larsen (billionai) {
4363217781afSFabiano Rosas     register_non_embedded_sprs(env);
43643e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
43653e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
43663e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
43673e770bf7SBruno Larsen (billionai)     /* Level 3 cache control */
43683e770bf7SBruno Larsen (billionai)     register_l3_ctrl(env);
43693e770bf7SBruno Larsen (billionai)     /* L3ITCR1 */
43703e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR1, "L3ITCR1",
43713e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43723e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43733e770bf7SBruno Larsen (billionai)                  0x00000000);
43743e770bf7SBruno Larsen (billionai)     /* L3ITCR2 */
43753e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR2, "L3ITCR2",
43763e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43773e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43783e770bf7SBruno Larsen (billionai)                  0x00000000);
43793e770bf7SBruno Larsen (billionai)     /* L3ITCR3 */
43803e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR3, "L3ITCR3",
43813e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43823e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43833e770bf7SBruno Larsen (billionai)                  0x00000000);
43843e770bf7SBruno Larsen (billionai)     /* L3OHCR */
43853e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3OHCR, "L3OHCR",
43863e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43873e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43883e770bf7SBruno Larsen (billionai)                  0x00000000);
4389acf629ebSFabiano Rosas 
43903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
43913e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
43923e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
43933e770bf7SBruno Larsen (billionai)                  0x00000000);
43943e770bf7SBruno Larsen (billionai)     /* LDSTCR */
43953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
43963e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
43973e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
43983e770bf7SBruno Larsen (billionai)                  0x00000000);
43993e770bf7SBruno Larsen (billionai)     /* ICTRL */
44003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
44013e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44023e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44033e770bf7SBruno Larsen (billionai)                  0x00000000);
44043e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
44053e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
44063e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44073e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44083e770bf7SBruno Larsen (billionai)                  0x00000000);
44093e770bf7SBruno Larsen (billionai)     /* PMC */
44103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
44113e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44123e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44133e770bf7SBruno Larsen (billionai)                  0x00000000);
4414acf629ebSFabiano Rosas 
44153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
44163e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
44173e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
44183e770bf7SBruno Larsen (billionai)                  0x00000000);
4419acf629ebSFabiano Rosas 
44203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
44213e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44223e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44233e770bf7SBruno Larsen (billionai)                  0x00000000);
4424acf629ebSFabiano Rosas 
44253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
44263e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
44273e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
44283e770bf7SBruno Larsen (billionai)                  0x00000000);
44293e770bf7SBruno Larsen (billionai)     /* Memory management */
44303e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
44313e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
44323e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
44333e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
44343e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
44353e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
44363e770bf7SBruno Larsen (billionai) }
44373e770bf7SBruno Larsen (billionai) 
44383e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7450)(ObjectClass *oc, void *data)
44393e770bf7SBruno Larsen (billionai) {
44403e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
44413e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
44423e770bf7SBruno Larsen (billionai) 
44433e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7450 (aka G4)";
44443e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7450;
44453e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
44463e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
44473e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
44483e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
44493e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
44503e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
44513e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
44523e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
44533e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
44541da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
44553e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
44563e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
44573e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
44583e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
44593e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
44603e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
44613e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
44623e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
44633e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
44643e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
44653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
44663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
44673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
44683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
44693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
44703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
44713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
44723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
44733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
44741da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
44753e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
44763e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
44773e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
44783e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
44793e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
44803e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
44813e770bf7SBruno Larsen (billionai) }
44823e770bf7SBruno Larsen (billionai) 
44833e770bf7SBruno Larsen (billionai) static void init_proc_7445(CPUPPCState *env)
44843e770bf7SBruno Larsen (billionai) {
4485217781afSFabiano Rosas     register_non_embedded_sprs(env);
44863e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
44873e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
44883e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
44893e770bf7SBruno Larsen (billionai)     /* LDSTCR */
44903e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
44913e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44923e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44933e770bf7SBruno Larsen (billionai)                  0x00000000);
44943e770bf7SBruno Larsen (billionai)     /* ICTRL */
44953e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
44963e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
44973e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
44983e770bf7SBruno Larsen (billionai)                  0x00000000);
44993e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
45003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
45013e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45023e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45033e770bf7SBruno Larsen (billionai)                  0x00000000);
45043e770bf7SBruno Larsen (billionai)     /* PMC */
45053e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
45063e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45073e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45083e770bf7SBruno Larsen (billionai)                  0x00000000);
4509acf629ebSFabiano Rosas 
45103e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
45113e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45123e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45133e770bf7SBruno Larsen (billionai)                  0x00000000);
4514acf629ebSFabiano Rosas 
45153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
45163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45183e770bf7SBruno Larsen (billionai)                  0x00000000);
4519acf629ebSFabiano Rosas 
45203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
45213e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45223e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45233e770bf7SBruno Larsen (billionai)                  0x00000000);
45243e770bf7SBruno Larsen (billionai)     /* SPRGs */
45253e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
45263e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45273e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45283e770bf7SBruno Larsen (billionai)                  0x00000000);
45293e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
45303e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45313e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45323e770bf7SBruno Larsen (billionai)                  0x00000000);
45333e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
45343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45363e770bf7SBruno Larsen (billionai)                  0x00000000);
45373e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
45383e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45393e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45403e770bf7SBruno Larsen (billionai)                  0x00000000);
45413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
45423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45443e770bf7SBruno Larsen (billionai)                  0x00000000);
45453e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
45463e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45473e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45483e770bf7SBruno Larsen (billionai)                  0x00000000);
45493e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
45503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
45513e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
45523e770bf7SBruno Larsen (billionai)                  0x00000000);
45533e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
45543e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45553e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
45563e770bf7SBruno Larsen (billionai)                  0x00000000);
45573e770bf7SBruno Larsen (billionai)     /* Memory management */
45583e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
45593e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
45603e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
45613e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
45623e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
45633e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
45643e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
45653e770bf7SBruno Larsen (billionai) }
45663e770bf7SBruno Larsen (billionai) 
45673e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7445)(ObjectClass *oc, void *data)
45683e770bf7SBruno Larsen (billionai) {
45693e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
45703e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
45713e770bf7SBruno Larsen (billionai) 
45723e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7445 (aka G4)";
45733e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7445;
45743e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
45753e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
45763e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
45773e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
45783e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
45793e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
45803e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
45813e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
45823e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
45831da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
45843e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
45853e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
45863e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
45873e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
45883e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
45893e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
45903e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
45913e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
45923e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
45933e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
45943e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
45953e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
45963e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
45973e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
45983e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
45993e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
46003e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
46013e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
46023e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
46031da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
46043e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
46053e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
46063e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
46073e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
46083e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
46093e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
46103e770bf7SBruno Larsen (billionai) }
46113e770bf7SBruno Larsen (billionai) 
46123e770bf7SBruno Larsen (billionai) static void init_proc_7455(CPUPPCState *env)
46133e770bf7SBruno Larsen (billionai) {
4614217781afSFabiano Rosas     register_non_embedded_sprs(env);
46153e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
46163e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
46173e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
46183e770bf7SBruno Larsen (billionai)     /* Level 3 cache control */
46193e770bf7SBruno Larsen (billionai)     register_l3_ctrl(env);
46203e770bf7SBruno Larsen (billionai)     /* LDSTCR */
46213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
46223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46243e770bf7SBruno Larsen (billionai)                  0x00000000);
46253e770bf7SBruno Larsen (billionai)     /* ICTRL */
46263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
46273e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46283e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46293e770bf7SBruno Larsen (billionai)                  0x00000000);
46303e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
46313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
46323e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46343e770bf7SBruno Larsen (billionai)                  0x00000000);
46353e770bf7SBruno Larsen (billionai)     /* PMC */
46363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
46373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46383e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46393e770bf7SBruno Larsen (billionai)                  0x00000000);
4640acf629ebSFabiano Rosas 
46413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
46423e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46433e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46443e770bf7SBruno Larsen (billionai)                  0x00000000);
4645acf629ebSFabiano Rosas 
46463e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
46473e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46483e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46493e770bf7SBruno Larsen (billionai)                  0x00000000);
4650acf629ebSFabiano Rosas 
46513e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
46523e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46533e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46543e770bf7SBruno Larsen (billionai)                  0x00000000);
46553e770bf7SBruno Larsen (billionai)     /* SPRGs */
46563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
46573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46593e770bf7SBruno Larsen (billionai)                  0x00000000);
46603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
46613e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46623e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46633e770bf7SBruno Larsen (billionai)                  0x00000000);
46643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
46653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46673e770bf7SBruno Larsen (billionai)                  0x00000000);
46683e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
46693e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46703e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46713e770bf7SBruno Larsen (billionai)                  0x00000000);
46723e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
46733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46743e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46753e770bf7SBruno Larsen (billionai)                  0x00000000);
46763e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
46773e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46783e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46793e770bf7SBruno Larsen (billionai)                  0x00000000);
46803e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
46813e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
46823e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
46833e770bf7SBruno Larsen (billionai)                  0x00000000);
46843e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
46853e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46863e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
46873e770bf7SBruno Larsen (billionai)                  0x00000000);
46883e770bf7SBruno Larsen (billionai)     /* Memory management */
46893e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
46903e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
46913e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
46923e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
46933e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
46943e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
46953e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
46963e770bf7SBruno Larsen (billionai) }
46973e770bf7SBruno Larsen (billionai) 
46983e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7455)(ObjectClass *oc, void *data)
46993e770bf7SBruno Larsen (billionai) {
47003e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
47013e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
47023e770bf7SBruno Larsen (billionai) 
47033e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7455 (aka G4)";
47043e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7455;
47053e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
47063e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
47073e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
47083e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
47093e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
47103e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
47113e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
47123e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
47133e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
47141da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
47153e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
47163e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
47173e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
47183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
47193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
47203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
47213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
47223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
47233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
47243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
47253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
47263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
47273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
47283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
47293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
47303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
47313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
47323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
47333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
47341da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
47353e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
47363e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
47373e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
47383e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
47393e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
47403e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
47413e770bf7SBruno Larsen (billionai) }
47423e770bf7SBruno Larsen (billionai) 
47433e770bf7SBruno Larsen (billionai) static void init_proc_7457(CPUPPCState *env)
47443e770bf7SBruno Larsen (billionai) {
4745217781afSFabiano Rosas     register_non_embedded_sprs(env);
47463e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
47473e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
47483e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
47493e770bf7SBruno Larsen (billionai)     /* Level 3 cache control */
47503e770bf7SBruno Larsen (billionai)     register_l3_ctrl(env);
47513e770bf7SBruno Larsen (billionai)     /* L3ITCR1 */
47523e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR1, "L3ITCR1",
47533e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47543e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47553e770bf7SBruno Larsen (billionai)                  0x00000000);
47563e770bf7SBruno Larsen (billionai)     /* L3ITCR2 */
47573e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR2, "L3ITCR2",
47583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47593e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47603e770bf7SBruno Larsen (billionai)                  0x00000000);
47613e770bf7SBruno Larsen (billionai)     /* L3ITCR3 */
47623e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3ITCR3, "L3ITCR3",
47633e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47643e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47653e770bf7SBruno Larsen (billionai)                  0x00000000);
47663e770bf7SBruno Larsen (billionai)     /* L3OHCR */
47673e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_L3OHCR, "L3OHCR",
47683e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47693e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47703e770bf7SBruno Larsen (billionai)                  0x00000000);
47713e770bf7SBruno Larsen (billionai)     /* LDSTCR */
47723e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
47733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47743e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47753e770bf7SBruno Larsen (billionai)                  0x00000000);
47763e770bf7SBruno Larsen (billionai)     /* ICTRL */
47773e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
47783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47793e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47803e770bf7SBruno Larsen (billionai)                  0x00000000);
47813e770bf7SBruno Larsen (billionai)     /* MSSSR0 */
47823e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
47833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47843e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47853e770bf7SBruno Larsen (billionai)                  0x00000000);
47863e770bf7SBruno Larsen (billionai)     /* PMC */
47873e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
47883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47893e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
47903e770bf7SBruno Larsen (billionai)                  0x00000000);
4791acf629ebSFabiano Rosas 
47923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
47933e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
47943e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
47953e770bf7SBruno Larsen (billionai)                  0x00000000);
4796acf629ebSFabiano Rosas 
47973e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
47983e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
47993e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48003e770bf7SBruno Larsen (billionai)                  0x00000000);
4801acf629ebSFabiano Rosas 
48023e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
48033e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48043e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48053e770bf7SBruno Larsen (billionai)                  0x00000000);
48063e770bf7SBruno Larsen (billionai)     /* SPRGs */
48073e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
48083e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48093e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48103e770bf7SBruno Larsen (billionai)                  0x00000000);
48113e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
48123e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48133e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48143e770bf7SBruno Larsen (billionai)                  0x00000000);
48153e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
48163e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48173e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48183e770bf7SBruno Larsen (billionai)                  0x00000000);
48193e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
48203e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48213e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48223e770bf7SBruno Larsen (billionai)                  0x00000000);
48233e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
48243e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48253e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48263e770bf7SBruno Larsen (billionai)                  0x00000000);
48273e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
48283e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48293e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48303e770bf7SBruno Larsen (billionai)                  0x00000000);
48313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
48323e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
48333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
48343e770bf7SBruno Larsen (billionai)                  0x00000000);
48353e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
48363e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48373e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
48383e770bf7SBruno Larsen (billionai)                  0x00000000);
48393e770bf7SBruno Larsen (billionai)     /* Memory management */
48403e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
48413e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
48423e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
48433e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
48443e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
48453e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
48463e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
48473e770bf7SBruno Larsen (billionai) }
48483e770bf7SBruno Larsen (billionai) 
48493e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(7457)(ObjectClass *oc, void *data)
48503e770bf7SBruno Larsen (billionai) {
48513e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
48523e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
48533e770bf7SBruno Larsen (billionai) 
48543e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 7457 (aka G4)";
48553e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_7457;
48563e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
48573e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
48583e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
48593e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
48603e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
48613e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
48623e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
48633e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
48643e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
48651da666cdSFabiano Rosas                        PPC_MEM_TLBIA |
48663e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
48673e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
48683e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
48693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
48703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
48713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
48723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
48733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
48743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
48753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
48763e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
48773e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
48783e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
48793e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
48803e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
48813e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
48823e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
48833e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
48843e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
48851da666cdSFabiano Rosas     pcc->mmu_model = POWERPC_MMU_32B;
48863e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
48873e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
48883e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
48893e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
48903e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
48913e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
48923e770bf7SBruno Larsen (billionai) }
48933e770bf7SBruno Larsen (billionai) 
48943e770bf7SBruno Larsen (billionai) static void init_proc_e600(CPUPPCState *env)
48953e770bf7SBruno Larsen (billionai) {
4896217781afSFabiano Rosas     register_non_embedded_sprs(env);
48973e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
48983e770bf7SBruno Larsen (billionai)     register_74xx_sprs(env);
48993e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
4900acf629ebSFabiano Rosas 
49013e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UBAMR, "UBAMR",
49023e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49033e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49043e770bf7SBruno Larsen (billionai)                  0x00000000);
4905acf629ebSFabiano Rosas 
49063e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_LDSTCR, "LDSTCR",
49073e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49083e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49093e770bf7SBruno Larsen (billionai)                  0x00000000);
4910acf629ebSFabiano Rosas 
49113e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_ICTRL, "ICTRL",
49123e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49133e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49143e770bf7SBruno Larsen (billionai)                  0x00000000);
4915acf629ebSFabiano Rosas 
49163e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_MSSSR0, "MSSSR0",
49173e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49183e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49193e770bf7SBruno Larsen (billionai)                  0x00000000);
4920acf629ebSFabiano Rosas 
49213e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC5, "PMC5",
49223e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49233e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49243e770bf7SBruno Larsen (billionai)                  0x00000000);
4925acf629ebSFabiano Rosas 
49263e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC5, "UPMC5",
49273e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49283e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49293e770bf7SBruno Larsen (billionai)                  0x00000000);
4930acf629ebSFabiano Rosas 
49313e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_PMC6, "PMC6",
49323e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49333e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49343e770bf7SBruno Larsen (billionai)                  0x00000000);
4935acf629ebSFabiano Rosas 
49363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_7XX_UPMC6, "UPMC6",
49373e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49383e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49393e770bf7SBruno Larsen (billionai)                  0x00000000);
49403e770bf7SBruno Larsen (billionai)     /* SPRGs */
49413e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG4, "SPRG4",
49423e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49433e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49443e770bf7SBruno Larsen (billionai)                  0x00000000);
49453e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG4, "USPRG4",
49463e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49473e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49483e770bf7SBruno Larsen (billionai)                  0x00000000);
49493e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG5, "SPRG5",
49503e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49513e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49523e770bf7SBruno Larsen (billionai)                  0x00000000);
49533e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG5, "USPRG5",
49543e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49553e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49563e770bf7SBruno Larsen (billionai)                  0x00000000);
49573e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG6, "SPRG6",
49583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49593e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49603e770bf7SBruno Larsen (billionai)                  0x00000000);
49613e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG6, "USPRG6",
49623e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49633e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49643e770bf7SBruno Larsen (billionai)                  0x00000000);
49653e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_SPRG7, "SPRG7",
49663e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
49673e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
49683e770bf7SBruno Larsen (billionai)                  0x00000000);
49693e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_USPRG7, "USPRG7",
49703e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49713e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
49723e770bf7SBruno Larsen (billionai)                  0x00000000);
49733e770bf7SBruno Larsen (billionai)     /* Memory management */
49743e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
49753e770bf7SBruno Larsen (billionai)     register_high_BATs(env);
49763e770bf7SBruno Larsen (billionai)     init_excp_7450(env);
49773e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 32;
49783e770bf7SBruno Larsen (billionai)     env->icache_line_size = 32;
49793e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
49803e770bf7SBruno Larsen (billionai)     ppc6xx_irq_init(env_archcpu(env));
49813e770bf7SBruno Larsen (billionai) }
49823e770bf7SBruno Larsen (billionai) 
49833e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(e600)(ObjectClass *oc, void *data)
49843e770bf7SBruno Larsen (billionai) {
49853e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
49863e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
49873e770bf7SBruno Larsen (billionai) 
49883e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC e600";
49893e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_e600;
49903e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_hid0_74xx;
49913e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
49923e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
49933e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
49943e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
49953e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI |
49963e770bf7SBruno Larsen (billionai)                        PPC_CACHE_DCBA | PPC_CACHE_DCBZ |
49973e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
49983e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
4999b137fb72SFabiano Rosas                        PPC_MEM_TLBIA |
50003e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT | PPC_EXTERN |
50013e770bf7SBruno Larsen (billionai)                        PPC_ALTIVEC;
50023e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC_NONE;
50033e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_VR) |
50043e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
50053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ILE) |
50063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
50073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
50083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
50093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
50103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
50113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
50123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
50133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
50143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EP) |
50153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
50163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
50173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
50183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
50193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
50203e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_32B;
50213e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_74xx;
50223e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_6xx;
50233e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc_7400;
50243e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
50253e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
50263e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
50273e770bf7SBruno Larsen (billionai) }
50283e770bf7SBruno Larsen (billionai) 
50293e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
50303e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY)
50313e770bf7SBruno Larsen (billionai) #define POWERPC970_HID5_INIT 0x00000080
50323e770bf7SBruno Larsen (billionai) #else
50333e770bf7SBruno Larsen (billionai) #define POWERPC970_HID5_INIT 0x00000000
50343e770bf7SBruno Larsen (billionai) #endif
50353e770bf7SBruno Larsen (billionai) 
50363e770bf7SBruno Larsen (billionai) static int check_pow_970(CPUPPCState *env)
50373e770bf7SBruno Larsen (billionai) {
50383e770bf7SBruno Larsen (billionai)     if (env->spr[SPR_HID0] & (HID0_DEEPNAP | HID0_DOZE | HID0_NAP)) {
50393e770bf7SBruno Larsen (billionai)         return 1;
50403e770bf7SBruno Larsen (billionai)     }
50413e770bf7SBruno Larsen (billionai) 
50423e770bf7SBruno Larsen (billionai)     return 0;
50433e770bf7SBruno Larsen (billionai) }
50443e770bf7SBruno Larsen (billionai) 
50453e770bf7SBruno Larsen (billionai) static void register_970_hid_sprs(CPUPPCState *env)
50463e770bf7SBruno Larsen (billionai) {
50473e770bf7SBruno Larsen (billionai)     /* Hardware implementation registers */
50483e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID0, "HID0",
50493e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50503e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_clear,
50513e770bf7SBruno Larsen (billionai)                  0x60000000);
50523e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HID1, "HID1",
50533e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50543e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50553e770bf7SBruno Larsen (billionai)                  0x00000000);
50563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_970_HID5, "HID5",
50573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
50593e770bf7SBruno Larsen (billionai)                  POWERPC970_HID5_INIT);
50603e770bf7SBruno Larsen (billionai) }
50613e770bf7SBruno Larsen (billionai) 
50623e770bf7SBruno Larsen (billionai) static void register_970_hior_sprs(CPUPPCState *env)
50633e770bf7SBruno Larsen (billionai) {
50643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_HIOR, "SPR_HIOR",
50653e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50663e770bf7SBruno Larsen (billionai)                  &spr_read_hior, &spr_write_hior,
50673e770bf7SBruno Larsen (billionai)                  0x00000000);
50683e770bf7SBruno Larsen (billionai) }
50693e770bf7SBruno Larsen (billionai) 
50703e770bf7SBruno Larsen (billionai) static void register_book3s_ctrl_sprs(CPUPPCState *env)
50713e770bf7SBruno Larsen (billionai) {
50723e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_CTRL, "SPR_CTRL",
50733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
50747aeac354SDaniel Henrique Barboza                  SPR_NOACCESS, &spr_write_CTRL,
50753e770bf7SBruno Larsen (billionai)                  0x00000000);
50763e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_UCTRL, "SPR_UCTRL",
50773e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50783e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
50793e770bf7SBruno Larsen (billionai)                  0x00000000);
50803e770bf7SBruno Larsen (billionai) }
50813e770bf7SBruno Larsen (billionai) 
50823e770bf7SBruno Larsen (billionai) static void register_book3s_altivec_sprs(CPUPPCState *env)
50833e770bf7SBruno Larsen (billionai) {
50843e770bf7SBruno Larsen (billionai)     if (!(env->insns_flags & PPC_ALTIVEC)) {
50853e770bf7SBruno Larsen (billionai)         return;
50863e770bf7SBruno Larsen (billionai)     }
50873e770bf7SBruno Larsen (billionai) 
50883e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_VRSAVE, "VRSAVE",
50893e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
50903e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
50913e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_VRSAVE, 0x00000000);
50923e770bf7SBruno Larsen (billionai) 
50933e770bf7SBruno Larsen (billionai) }
50943e770bf7SBruno Larsen (billionai) 
50953e770bf7SBruno Larsen (billionai) static void register_book3s_dbg_sprs(CPUPPCState *env)
50963e770bf7SBruno Larsen (billionai) {
50973e770bf7SBruno Larsen (billionai)     /*
50983e770bf7SBruno Larsen (billionai)      * TODO: different specs define different scopes for these,
50993e770bf7SBruno Larsen (billionai)      * will have to address this:
51003e770bf7SBruno Larsen (billionai)      * 970: super/write and super/read
51013e770bf7SBruno Larsen (billionai)      * powerisa 2.03..2.04: hypv/write and super/read.
51023e770bf7SBruno Larsen (billionai)      * powerisa 2.05 and newer: hypv/write and hypv/read.
51033e770bf7SBruno Larsen (billionai)      */
51043e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DABR, "DABR",
51053e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
51063e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
51073e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DABR, 0x00000000);
51083e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DABRX, "DABRX",
51093e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
51103e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
51113e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DABRX, 0x00000000);
51123e770bf7SBruno Larsen (billionai) }
51133e770bf7SBruno Larsen (billionai) 
51143e770bf7SBruno Larsen (billionai) static void register_book3s_207_dbg_sprs(CPUPPCState *env)
51153e770bf7SBruno Larsen (billionai) {
51163e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_DAWR0, "DAWR0",
51173e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
51183e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
51193e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_generic,
51203e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_DAWR, 0x00000000);
51213e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_DAWRX0, "DAWRX0",
51223e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
51233e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
51243e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_generic,
51253e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_DAWRX, 0x00000000);
51263e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_CIABR, "CIABR",
51273e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
51283e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
51293e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_generic,
51303e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_CIABR, 0x00000000);
51313e770bf7SBruno Larsen (billionai) }
51323e770bf7SBruno Larsen (billionai) 
51333e770bf7SBruno Larsen (billionai) static void register_970_dbg_sprs(CPUPPCState *env)
51343e770bf7SBruno Larsen (billionai) {
51353e770bf7SBruno Larsen (billionai)     /* Breakpoints */
51363e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_IABR, "IABR",
51373e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
51383e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
51393e770bf7SBruno Larsen (billionai)                  0x00000000);
51403e770bf7SBruno Larsen (billionai) }
51413e770bf7SBruno Larsen (billionai) 
51423e770bf7SBruno Larsen (billionai) static void register_book3s_pmu_sup_sprs(CPUPPCState *env)
51433e770bf7SBruno Larsen (billionai) {
51443e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCR0, "MMCR0",
51453e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5146c2eff582SDaniel Henrique Barboza                      &spr_read_generic, &spr_write_MMCR0,
5147c2eff582SDaniel Henrique Barboza                      KVM_REG_PPC_MMCR0, 0x80000000);
51483e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCR1, "MMCR1",
51493e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5150a6f91249SDaniel Henrique Barboza                      &spr_read_generic, &spr_write_MMCR1,
51513e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_MMCR1, 0x00000000);
51523e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCRA, "MMCRA",
51533e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
51543e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
51553e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_MMCRA, 0x00000000);
51563e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC1, "PMC1",
51573e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5158308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
51593e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC1, 0x00000000);
51603e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC2, "PMC2",
51613e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5162308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
51633e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC2, 0x00000000);
51643e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC3, "PMC3",
51653e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5166308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
51673e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC3, 0x00000000);
51683e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC4, "PMC4",
51693e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5170308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
51713e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC4, 0x00000000);
51723e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC5, "PMC5",
51733e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5174308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
51753e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC5, 0x00000000);
51763e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_PMC6, "PMC6",
51773e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
5178308b9fadSDaniel Henrique Barboza                      &spr_read_PMC, &spr_write_PMC,
51793e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC6, 0x00000000);
51803e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SIAR, "SIAR",
51813e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
51823e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
51833e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SIAR, 0x00000000);
51843e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SDAR, "SDAR",
51853e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
51863e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
51873e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SDAR, 0x00000000);
51883e770bf7SBruno Larsen (billionai) }
51893e770bf7SBruno Larsen (billionai) 
51903e770bf7SBruno Larsen (billionai) static void register_book3s_pmu_user_sprs(CPUPPCState *env)
51913e770bf7SBruno Larsen (billionai) {
51923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UMMCR0, "UMMCR0",
5193565cb109SGustavo Romero                  &spr_read_MMCR0_ureg, &spr_write_MMCR0_ureg,
51943e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
5195c2eff582SDaniel Henrique Barboza                  0x80000000);
51963e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UMMCR1, "UMMCR1",
51973e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
51983e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
51993e770bf7SBruno Larsen (billionai)                  0x00000000);
52003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UMMCRA, "UMMCRA",
52013e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52023e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52033e770bf7SBruno Larsen (billionai)                  0x00000000);
52043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC1, "UPMC1",
5205cedf7069SDaniel Henrique Barboza                  &spr_read_PMC14_ureg, &spr_write_PMC14_ureg,
52063e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52073e770bf7SBruno Larsen (billionai)                  0x00000000);
52083e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC2, "UPMC2",
5209cedf7069SDaniel Henrique Barboza                  &spr_read_PMC14_ureg, &spr_write_PMC14_ureg,
52103e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52113e770bf7SBruno Larsen (billionai)                  0x00000000);
52123e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC3, "UPMC3",
5213cedf7069SDaniel Henrique Barboza                  &spr_read_PMC14_ureg, &spr_write_PMC14_ureg,
52143e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52153e770bf7SBruno Larsen (billionai)                  0x00000000);
52163e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC4, "UPMC4",
5217cedf7069SDaniel Henrique Barboza                  &spr_read_PMC14_ureg, &spr_write_PMC14_ureg,
52183e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52193e770bf7SBruno Larsen (billionai)                  0x00000000);
52203e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC5, "UPMC5",
5221cedf7069SDaniel Henrique Barboza                  &spr_read_PMC56_ureg, &spr_write_PMC56_ureg,
52223e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52233e770bf7SBruno Larsen (billionai)                  0x00000000);
52243e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UPMC6, "UPMC6",
5225cedf7069SDaniel Henrique Barboza                  &spr_read_PMC56_ureg, &spr_write_PMC56_ureg,
52263e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52273e770bf7SBruno Larsen (billionai)                  0x00000000);
52283e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_USIAR, "USIAR",
52293e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52303e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52313e770bf7SBruno Larsen (billionai)                  0x00000000);
52323e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_USDAR, "USDAR",
52333e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52343e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52353e770bf7SBruno Larsen (billionai)                  0x00000000);
52363e770bf7SBruno Larsen (billionai) }
52373e770bf7SBruno Larsen (billionai) 
52383e770bf7SBruno Larsen (billionai) static void register_970_pmu_sup_sprs(CPUPPCState *env)
52393e770bf7SBruno Larsen (billionai) {
52403e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_970_PMC7, "PMC7",
52413e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52423e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52433e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC7, 0x00000000);
52443e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_970_PMC8, "PMC8",
52453e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52463e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52473e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PMC8, 0x00000000);
52483e770bf7SBruno Larsen (billionai) }
52493e770bf7SBruno Larsen (billionai) 
52503e770bf7SBruno Larsen (billionai) static void register_970_pmu_user_sprs(CPUPPCState *env)
52513e770bf7SBruno Larsen (billionai) {
52523e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_970_UPMC7, "UPMC7",
52533e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52543e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52553e770bf7SBruno Larsen (billionai)                  0x00000000);
52563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_970_UPMC8, "UPMC8",
52573e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, SPR_NOACCESS,
52583e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
52593e770bf7SBruno Larsen (billionai)                  0x00000000);
52603e770bf7SBruno Larsen (billionai) }
52613e770bf7SBruno Larsen (billionai) 
52623e770bf7SBruno Larsen (billionai) static void register_power8_pmu_sup_sprs(CPUPPCState *env)
52633e770bf7SBruno Larsen (billionai) {
52643e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCR2, "MMCR2",
52653e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52663e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52673e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_MMCR2, 0x00000000);
52683e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_MMCRS, "MMCRS",
52693e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52703e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52713e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_MMCRS, 0x00000000);
52723e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SIER, "SIER",
52733e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52743e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52753e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SIER, 0x00000000);
52763e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SPMC1, "SPMC1",
52773e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52783e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52793e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SPMC1, 0x00000000);
52803e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_POWER_SPMC2, "SPMC2",
52813e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52823e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52833e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_SPMC2, 0x00000000);
52843e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TACR, "TACR",
52853e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52863e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52873e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TACR, 0x00000000);
52883e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TCSCR, "TCSCR",
52893e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52903e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52913e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TCSCR, 0x00000000);
52923e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_CSIGR, "CSIGR",
52933e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
52943e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
52953e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_CSIGR, 0x00000000);
52963e770bf7SBruno Larsen (billionai) }
52973e770bf7SBruno Larsen (billionai) 
52983e770bf7SBruno Larsen (billionai) static void register_power8_pmu_user_sprs(CPUPPCState *env)
52993e770bf7SBruno Larsen (billionai) {
53003e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_UMMCR2, "UMMCR2",
53017b3ecf16SDaniel Henrique Barboza                  &spr_read_MMCR2_ureg, &spr_write_MMCR2_ureg,
53023e770bf7SBruno Larsen (billionai)                  &spr_read_ureg, &spr_write_ureg,
53033e770bf7SBruno Larsen (billionai)                  0x00000000);
53043e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_POWER_USIER, "USIER",
53053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
53063e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53073e770bf7SBruno Larsen (billionai)                  0x00000000);
53083e770bf7SBruno Larsen (billionai) }
53093e770bf7SBruno Larsen (billionai) 
53103e770bf7SBruno Larsen (billionai) static void register_power5p_ear_sprs(CPUPPCState *env)
53113e770bf7SBruno Larsen (billionai) {
53123e770bf7SBruno Larsen (billionai)     /* External access control */
53133e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_EAR, "EAR",
53143e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53153e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53163e770bf7SBruno Larsen (billionai)                  0x00000000);
53173e770bf7SBruno Larsen (billionai) }
53183e770bf7SBruno Larsen (billionai) 
53193e770bf7SBruno Larsen (billionai) static void register_power5p_tb_sprs(CPUPPCState *env)
53203e770bf7SBruno Larsen (billionai) {
53213e770bf7SBruno Larsen (billionai)     /* TBU40 (High 40 bits of the Timebase register */
53223e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_TBU40, "TBU40",
53233e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
53243e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
53253e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, &spr_write_tbu40,
53263e770bf7SBruno Larsen (billionai)                     0x00000000);
53273e770bf7SBruno Larsen (billionai) }
53283e770bf7SBruno Larsen (billionai) 
53293e770bf7SBruno Larsen (billionai) static void register_970_lpar_sprs(CPUPPCState *env)
53303e770bf7SBruno Larsen (billionai) {
53313e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
53323e770bf7SBruno Larsen (billionai)     /*
53333e770bf7SBruno Larsen (billionai)      * PPC970: HID4 covers things later controlled by the LPCR and
53343e770bf7SBruno Larsen (billionai)      * RMOR in later CPUs, but with a different encoding.  We only
53353e770bf7SBruno Larsen (billionai)      * support the 970 in "Apple mode" which has all hypervisor
53363e770bf7SBruno Larsen (billionai)      * facilities disabled by strapping, so we can basically just
53373e770bf7SBruno Larsen (billionai)      * ignore it
53383e770bf7SBruno Larsen (billionai)      */
53393e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_970_HID4, "HID4",
53403e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53413e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53423e770bf7SBruno Larsen (billionai)                  0x00000000);
53433e770bf7SBruno Larsen (billionai) #endif
53443e770bf7SBruno Larsen (billionai) }
53453e770bf7SBruno Larsen (billionai) 
53463e770bf7SBruno Larsen (billionai) static void register_power5p_lpar_sprs(CPUPPCState *env)
53473e770bf7SBruno Larsen (billionai) {
53483e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
53493e770bf7SBruno Larsen (billionai)     /* Logical partitionning */
53503e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_LPCR, "LPCR",
53513e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
53523e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
53533e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_lpcr,
53543e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_LPCR, LPCR_LPES0 | LPCR_LPES1);
53553e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HDEC, "HDEC",
53563e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
53573e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
53583e770bf7SBruno Larsen (billionai)                     &spr_read_hdecr, &spr_write_hdecr, 0);
53593e770bf7SBruno Larsen (billionai) #endif
53603e770bf7SBruno Larsen (billionai) }
53613e770bf7SBruno Larsen (billionai) 
53623e770bf7SBruno Larsen (billionai) static void register_book3s_ids_sprs(CPUPPCState *env)
53633e770bf7SBruno Larsen (billionai) {
53643e770bf7SBruno Larsen (billionai)     /* FIXME: Will need to deal with thread vs core only SPRs */
53653e770bf7SBruno Larsen (billionai) 
53663e770bf7SBruno Larsen (billionai)     /* Processor identification */
53673e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_PIR, "PIR",
53683e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53693e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
53703e770bf7SBruno Larsen (billionai)                  &spr_read_generic, NULL,
53713e770bf7SBruno Larsen (billionai)                  0x00000000);
53723e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HID0, "HID0",
53733e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53743e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53753e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53763e770bf7SBruno Larsen (billionai)                  0x00000000);
53773e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_TSCR, "TSCR",
53783e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53793e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53803e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53813e770bf7SBruno Larsen (billionai)                  0x00000000);
53823e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HMER, "HMER",
53833e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53843e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53853e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_hmer,
53863e770bf7SBruno Larsen (billionai)                  0x00000000);
53873e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HMEER, "HMEER",
53883e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53893e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53903e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53913e770bf7SBruno Larsen (billionai)                  0x00000000);
53923e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_TFMR, "TFMR",
53933e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53943e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53953e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
53963e770bf7SBruno Larsen (billionai)                  0x00000000);
53973e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_LPIDR, "LPIDR",
53983e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
53993e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54003e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_lpidr,
54013e770bf7SBruno Larsen (billionai)                  0x00000000);
54023e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HFSCR, "HFSCR",
54033e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54043e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54053e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54063e770bf7SBruno Larsen (billionai)                  0x00000000);
54073e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_MMCRC, "MMCRC",
54083e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54093e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54103e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54113e770bf7SBruno Larsen (billionai)                  0x00000000);
54123e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_MMCRH, "MMCRH",
54133e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54143e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54153e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54163e770bf7SBruno Larsen (billionai)                  0x00000000);
54173e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HSPRG0, "HSPRG0",
54183e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54193e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54203e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54213e770bf7SBruno Larsen (billionai)                  0x00000000);
54223e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HSPRG1, "HSPRG1",
54233e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54243e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54253e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54263e770bf7SBruno Larsen (billionai)                  0x00000000);
54273e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HSRR0, "HSRR0",
54283e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54293e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54303e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54313e770bf7SBruno Larsen (billionai)                  0x00000000);
54323e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HSRR1, "HSRR1",
54333e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54343e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54353e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54363e770bf7SBruno Larsen (billionai)                  0x00000000);
54373e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HDAR, "HDAR",
54383e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54393e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54403e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54413e770bf7SBruno Larsen (billionai)                  0x00000000);
54423e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HDSISR, "HDSISR",
54433e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54443e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54453e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54463e770bf7SBruno Larsen (billionai)                  0x00000000);
54473e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_HRMOR, "HRMOR",
54483e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54493e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54503e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54513e770bf7SBruno Larsen (billionai)                  0x00000000);
54523e770bf7SBruno Larsen (billionai) }
54533e770bf7SBruno Larsen (billionai) 
54543e770bf7SBruno Larsen (billionai) static void register_rmor_sprs(CPUPPCState *env)
54553e770bf7SBruno Larsen (billionai) {
54563e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_RMOR, "RMOR",
54573e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54583e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54593e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
54603e770bf7SBruno Larsen (billionai)                  0x00000000);
54613e770bf7SBruno Larsen (billionai) }
54623e770bf7SBruno Larsen (billionai) 
54633e770bf7SBruno Larsen (billionai) static void register_power8_ids_sprs(CPUPPCState *env)
54643e770bf7SBruno Larsen (billionai) {
54653e770bf7SBruno Larsen (billionai)     /* Thread identification */
54663e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_TIR, "TIR",
54673e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54683e770bf7SBruno Larsen (billionai)                  &spr_read_generic, SPR_NOACCESS,
54693e770bf7SBruno Larsen (billionai)                  0x00000000);
54703e770bf7SBruno Larsen (billionai) }
54713e770bf7SBruno Larsen (billionai) 
54723e770bf7SBruno Larsen (billionai) static void register_book3s_purr_sprs(CPUPPCState *env)
54733e770bf7SBruno Larsen (billionai) {
54743e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
54753e770bf7SBruno Larsen (billionai)     /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
54763e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_PURR,   "PURR",
54773e770bf7SBruno Larsen (billionai)                         &spr_read_purr, SPR_NOACCESS,
54783e770bf7SBruno Larsen (billionai)                         &spr_read_purr, SPR_NOACCESS,
54793e770bf7SBruno Larsen (billionai)                         &spr_read_purr, &spr_write_purr,
54803e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_PURR, 0x00000000);
54813e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_SPURR,   "SPURR",
54823e770bf7SBruno Larsen (billionai)                         &spr_read_purr, SPR_NOACCESS,
54833e770bf7SBruno Larsen (billionai)                         &spr_read_purr, SPR_NOACCESS,
54843e770bf7SBruno Larsen (billionai)                         &spr_read_purr, &spr_write_purr,
54853e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_SPURR, 0x00000000);
54863e770bf7SBruno Larsen (billionai) #endif
54873e770bf7SBruno Larsen (billionai) }
54883e770bf7SBruno Larsen (billionai) 
54893e770bf7SBruno Larsen (billionai) static void register_power6_dbg_sprs(CPUPPCState *env)
54903e770bf7SBruno Larsen (billionai) {
54913e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
54923e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_CFAR, "SPR_CFAR",
54933e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
54943e770bf7SBruno Larsen (billionai)                  &spr_read_cfar, &spr_write_cfar,
54953e770bf7SBruno Larsen (billionai)                  0x00000000);
54963e770bf7SBruno Larsen (billionai) #endif
54973e770bf7SBruno Larsen (billionai) }
54983e770bf7SBruno Larsen (billionai) 
54993e770bf7SBruno Larsen (billionai) static void register_power5p_common_sprs(CPUPPCState *env)
55003e770bf7SBruno Larsen (billionai) {
55013e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_PPR, "PPR",
55023e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
55033e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
55043e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PPR, 0x00000000);
55053e770bf7SBruno Larsen (billionai) }
55063e770bf7SBruno Larsen (billionai) 
55073e770bf7SBruno Larsen (billionai) static void register_power6_common_sprs(CPUPPCState *env)
55083e770bf7SBruno Larsen (billionai) {
55093e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
55103e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_DSCR, "SPR_DSCR",
55113e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
55123e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
55133e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_DSCR, 0x00000000);
55143e770bf7SBruno Larsen (billionai) #endif
55153e770bf7SBruno Larsen (billionai)     /*
55163e770bf7SBruno Larsen (billionai)      * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
55173e770bf7SBruno Larsen (billionai)      * POWERPC_EXCP_INVAL_SPR in userspace. Permit hypervisor access.
55183e770bf7SBruno Larsen (billionai)      */
55193e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_PCR, "PCR",
55203e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
55213e770bf7SBruno Larsen (billionai)                  SPR_NOACCESS, SPR_NOACCESS,
55223e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_pcr,
55233e770bf7SBruno Larsen (billionai)                  0x00000000);
55243e770bf7SBruno Larsen (billionai) }
55253e770bf7SBruno Larsen (billionai) 
55263e770bf7SBruno Larsen (billionai) static void register_power8_tce_address_control_sprs(CPUPPCState *env)
55273e770bf7SBruno Larsen (billionai) {
55283e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TAR, "TAR",
55293e770bf7SBruno Larsen (billionai)                      &spr_read_tar, &spr_write_tar,
55303e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
55313e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TAR, 0x00000000);
55323e770bf7SBruno Larsen (billionai) }
55333e770bf7SBruno Larsen (billionai) 
55343e770bf7SBruno Larsen (billionai) static void register_power8_tm_sprs(CPUPPCState *env)
55353e770bf7SBruno Larsen (billionai) {
55363e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TFHAR, "TFHAR",
55373e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
55383e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
55393e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TFHAR, 0x00000000);
55403e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TFIAR, "TFIAR",
55413e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
55423e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
55433e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TFIAR, 0x00000000);
55443e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TEXASR, "TEXASR",
55453e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
55463e770bf7SBruno Larsen (billionai)                      &spr_read_tm, &spr_write_tm,
55473e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TEXASR, 0x00000000);
55483e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_TEXASRU, "TEXASRU",
55493e770bf7SBruno Larsen (billionai)                  &spr_read_tm_upper32, &spr_write_tm_upper32,
55503e770bf7SBruno Larsen (billionai)                  &spr_read_tm_upper32, &spr_write_tm_upper32,
55513e770bf7SBruno Larsen (billionai)                  0x00000000);
55523e770bf7SBruno Larsen (billionai) }
55533e770bf7SBruno Larsen (billionai) 
55543e770bf7SBruno Larsen (billionai) static void register_power8_ebb_sprs(CPUPPCState *env)
55553e770bf7SBruno Larsen (billionai) {
55563e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BESCRS, "BESCRS",
55573e770bf7SBruno Larsen (billionai)                  &spr_read_ebb, &spr_write_ebb,
55583e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
55593e770bf7SBruno Larsen (billionai)                  0x00000000);
55603e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BESCRSU, "BESCRSU",
55613e770bf7SBruno Larsen (billionai)                  &spr_read_ebb_upper32, &spr_write_ebb_upper32,
55623e770bf7SBruno Larsen (billionai)                  &spr_read_prev_upper32, &spr_write_prev_upper32,
55633e770bf7SBruno Larsen (billionai)                  0x00000000);
55643e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BESCRR, "BESCRR",
55653e770bf7SBruno Larsen (billionai)                  &spr_read_ebb, &spr_write_ebb,
55663e770bf7SBruno Larsen (billionai)                  &spr_read_generic, &spr_write_generic,
55673e770bf7SBruno Larsen (billionai)                  0x00000000);
55683e770bf7SBruno Larsen (billionai)     spr_register(env, SPR_BESCRRU, "BESCRRU",
55693e770bf7SBruno Larsen (billionai)                  &spr_read_ebb_upper32, &spr_write_ebb_upper32,
55703e770bf7SBruno Larsen (billionai)                  &spr_read_prev_upper32, &spr_write_prev_upper32,
55713e770bf7SBruno Larsen (billionai)                  0x00000000);
55723e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_EBBHR, "EBBHR",
55733e770bf7SBruno Larsen (billionai)                      &spr_read_ebb, &spr_write_ebb,
55743e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
55753e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_EBBHR, 0x00000000);
55763e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_EBBRR, "EBBRR",
55773e770bf7SBruno Larsen (billionai)                      &spr_read_ebb, &spr_write_ebb,
55783e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
55793e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_EBBRR, 0x00000000);
55803e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_BESCR, "BESCR",
55813e770bf7SBruno Larsen (billionai)                      &spr_read_ebb, &spr_write_ebb,
55823e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
55833e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_BESCR, 0x00000000);
55843e770bf7SBruno Larsen (billionai) }
55853e770bf7SBruno Larsen (billionai) 
55863e770bf7SBruno Larsen (billionai) /* Virtual Time Base */
55873e770bf7SBruno Larsen (billionai) static void register_vtb_sprs(CPUPPCState *env)
55883e770bf7SBruno Larsen (billionai) {
55893e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_VTB, "VTB",
55903e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
55913e770bf7SBruno Larsen (billionai)                         &spr_read_vtb, SPR_NOACCESS,
55923e770bf7SBruno Larsen (billionai)                         &spr_read_vtb, &spr_write_vtb,
55933e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_VTB, 0x00000000);
55943e770bf7SBruno Larsen (billionai) }
55953e770bf7SBruno Larsen (billionai) 
55963e770bf7SBruno Larsen (billionai) static void register_power8_fscr_sprs(CPUPPCState *env)
55973e770bf7SBruno Larsen (billionai) {
55983e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY)
55993e770bf7SBruno Larsen (billionai)     target_ulong initval = 1ULL << FSCR_TAR;
56003e770bf7SBruno Larsen (billionai) #else
56013e770bf7SBruno Larsen (billionai)     target_ulong initval = 0;
56023e770bf7SBruno Larsen (billionai) #endif
56033e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_FSCR, "FSCR",
56043e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56053e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56063e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_FSCR, initval);
56073e770bf7SBruno Larsen (billionai) }
56083e770bf7SBruno Larsen (billionai) 
56093e770bf7SBruno Larsen (billionai) static void register_power8_pspb_sprs(CPUPPCState *env)
56103e770bf7SBruno Larsen (billionai) {
56113e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_PSPB, "PSPB",
56123e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56133e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic32,
56143e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PSPB, 0);
56153e770bf7SBruno Larsen (billionai) }
56163e770bf7SBruno Larsen (billionai) 
56173e770bf7SBruno Larsen (billionai) static void register_power8_dpdes_sprs(CPUPPCState *env)
56183e770bf7SBruno Larsen (billionai) {
56193e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
56203e770bf7SBruno Larsen (billionai)     /* Directed Privileged Door-bell Exception State, used for IPI */
56213e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_DPDES, "DPDES",
56223e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56233e770bf7SBruno Larsen (billionai)                         &spr_read_dpdes, SPR_NOACCESS,
56243e770bf7SBruno Larsen (billionai)                         &spr_read_dpdes, &spr_write_dpdes,
56253e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_DPDES, 0x00000000);
56263e770bf7SBruno Larsen (billionai) #endif
56273e770bf7SBruno Larsen (billionai) }
56283e770bf7SBruno Larsen (billionai) 
56293e770bf7SBruno Larsen (billionai) static void register_power8_ic_sprs(CPUPPCState *env)
56303e770bf7SBruno Larsen (billionai) {
56313e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
56323e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_IC, "IC",
56333e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
56343e770bf7SBruno Larsen (billionai)                     &spr_read_generic, SPR_NOACCESS,
56353e770bf7SBruno Larsen (billionai)                     &spr_read_generic, &spr_write_generic,
56363e770bf7SBruno Larsen (billionai)                     0);
56373e770bf7SBruno Larsen (billionai) #endif
56383e770bf7SBruno Larsen (billionai) }
56393e770bf7SBruno Larsen (billionai) 
56403e770bf7SBruno Larsen (billionai) static void register_power8_book4_sprs(CPUPPCState *env)
56413e770bf7SBruno Larsen (billionai) {
56423e770bf7SBruno Larsen (billionai)     /* Add a number of P8 book4 registers */
56433e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
56443e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_ACOP, "ACOP",
56453e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56463e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56473e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_ACOP, 0);
56483e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_BOOKS_PID, "PID",
56493e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56503e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_pidr,
56513e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PID, 0);
56523e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_WORT, "WORT",
56533e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56543e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56553e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_WORT, 0);
56563e770bf7SBruno Larsen (billionai) #endif
56573e770bf7SBruno Larsen (billionai) }
56583e770bf7SBruno Larsen (billionai) 
56593e770bf7SBruno Larsen (billionai) static void register_power7_book4_sprs(CPUPPCState *env)
56603e770bf7SBruno Larsen (billionai) {
56613e770bf7SBruno Larsen (billionai)     /* Add a number of P7 book4 registers */
56623e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
56633e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_ACOP, "ACOP",
56643e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56653e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56663e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_ACOP, 0);
56673e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_BOOKS_PID, "PID",
56683e770bf7SBruno Larsen (billionai)                      SPR_NOACCESS, SPR_NOACCESS,
56693e770bf7SBruno Larsen (billionai)                      &spr_read_generic, &spr_write_generic,
56703e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_PID, 0);
56713e770bf7SBruno Larsen (billionai) #endif
56723e770bf7SBruno Larsen (billionai) }
56733e770bf7SBruno Larsen (billionai) 
56743e770bf7SBruno Larsen (billionai) static void register_power8_rpr_sprs(CPUPPCState *env)
56753e770bf7SBruno Larsen (billionai) {
56763e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
56773e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_RPR, "RPR",
56783e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
56793e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
56803e770bf7SBruno Larsen (billionai)                     &spr_read_generic, &spr_write_generic,
56813e770bf7SBruno Larsen (billionai)                     0x00000103070F1F3F);
56823e770bf7SBruno Larsen (billionai) #endif
56833e770bf7SBruno Larsen (billionai) }
56843e770bf7SBruno Larsen (billionai) 
56853e770bf7SBruno Larsen (billionai) static void register_power9_mmu_sprs(CPUPPCState *env)
56863e770bf7SBruno Larsen (billionai) {
56873e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
56883e770bf7SBruno Larsen (billionai)     /* Partition Table Control */
56893e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_PTCR, "PTCR",
56903e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56913e770bf7SBruno Larsen (billionai)                         SPR_NOACCESS, SPR_NOACCESS,
56923e770bf7SBruno Larsen (billionai)                         &spr_read_generic, &spr_write_ptcr,
56933e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_PTCR, 0x00000000);
56943e770bf7SBruno Larsen (billionai)     /* Address Segment Descriptor Register */
56953e770bf7SBruno Larsen (billionai)     spr_register_hv(env, SPR_ASDR, "ASDR",
56963e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
56973e770bf7SBruno Larsen (billionai)                     SPR_NOACCESS, SPR_NOACCESS,
56983e770bf7SBruno Larsen (billionai)                     &spr_read_generic, &spr_write_generic,
56993e770bf7SBruno Larsen (billionai)                     0x0000000000000000);
57003e770bf7SBruno Larsen (billionai) #endif
57013e770bf7SBruno Larsen (billionai) }
57023e770bf7SBruno Larsen (billionai) 
5703903f84ebSVíctor Colombo static void register_power10_hash_sprs(CPUPPCState *env)
5704903f84ebSVíctor Colombo {
5705903f84ebSVíctor Colombo     /*
5706903f84ebSVíctor Colombo      * it's the OS responsability to generate a random value for the registers
5707903f84ebSVíctor Colombo      * in each process' context. So, initialize it with 0 here.
5708903f84ebSVíctor Colombo      */
5709903f84ebSVíctor Colombo     uint64_t hashkeyr_initial_value = 0, hashpkeyr_initial_value = 0;
5710903f84ebSVíctor Colombo #if defined(CONFIG_USER_ONLY)
5711903f84ebSVíctor Colombo     /* in linux-user, setup the hash register with a random value */
5712903f84ebSVíctor Colombo     GRand *rand = g_rand_new();
5713903f84ebSVíctor Colombo     hashkeyr_initial_value =
5714903f84ebSVíctor Colombo         ((uint64_t)g_rand_int(rand) << 32) | (uint64_t)g_rand_int(rand);
5715903f84ebSVíctor Colombo     hashpkeyr_initial_value =
5716903f84ebSVíctor Colombo         ((uint64_t)g_rand_int(rand) << 32) | (uint64_t)g_rand_int(rand);
5717903f84ebSVíctor Colombo     g_rand_free(rand);
5718903f84ebSVíctor Colombo #endif
5719903f84ebSVíctor Colombo     spr_register(env, SPR_HASHKEYR, "HASHKEYR",
5720903f84ebSVíctor Colombo             SPR_NOACCESS, SPR_NOACCESS,
5721903f84ebSVíctor Colombo             &spr_read_generic, &spr_write_generic,
5722903f84ebSVíctor Colombo             hashkeyr_initial_value);
5723903f84ebSVíctor Colombo     spr_register_hv(env, SPR_HASHPKEYR, "HASHPKEYR",
5724903f84ebSVíctor Colombo             SPR_NOACCESS, SPR_NOACCESS,
5725903f84ebSVíctor Colombo             SPR_NOACCESS, SPR_NOACCESS,
5726903f84ebSVíctor Colombo             &spr_read_generic, &spr_write_generic,
5727903f84ebSVíctor Colombo             hashpkeyr_initial_value);
5728903f84ebSVíctor Colombo }
5729903f84ebSVíctor Colombo 
5730*395b5d5bSNicholas Miehlbradt static void register_power10_dexcr_sprs(CPUPPCState *env)
5731*395b5d5bSNicholas Miehlbradt {
5732*395b5d5bSNicholas Miehlbradt     spr_register(env, SPR_DEXCR, "DEXCR",
5733*395b5d5bSNicholas Miehlbradt             SPR_NOACCESS, SPR_NOACCESS,
5734*395b5d5bSNicholas Miehlbradt             &spr_read_generic, &spr_write_generic,
5735*395b5d5bSNicholas Miehlbradt             0);
5736*395b5d5bSNicholas Miehlbradt 
5737*395b5d5bSNicholas Miehlbradt     spr_register(env, SPR_UDEXCR, "DEXCR",
5738*395b5d5bSNicholas Miehlbradt             &spr_read_dexcr_ureg, SPR_NOACCESS,
5739*395b5d5bSNicholas Miehlbradt             &spr_read_dexcr_ureg, SPR_NOACCESS,
5740*395b5d5bSNicholas Miehlbradt             0);
5741*395b5d5bSNicholas Miehlbradt 
5742*395b5d5bSNicholas Miehlbradt     spr_register_hv(env, SPR_HDEXCR, "HDEXCR",
5743*395b5d5bSNicholas Miehlbradt             SPR_NOACCESS, SPR_NOACCESS,
5744*395b5d5bSNicholas Miehlbradt             SPR_NOACCESS, SPR_NOACCESS,
5745*395b5d5bSNicholas Miehlbradt             &spr_read_generic, &spr_write_generic,
5746*395b5d5bSNicholas Miehlbradt             0);
5747*395b5d5bSNicholas Miehlbradt 
5748*395b5d5bSNicholas Miehlbradt     spr_register(env, SPR_UHDEXCR, "HDEXCR",
5749*395b5d5bSNicholas Miehlbradt             &spr_read_dexcr_ureg, SPR_NOACCESS,
5750*395b5d5bSNicholas Miehlbradt             &spr_read_dexcr_ureg, SPR_NOACCESS,
5751*395b5d5bSNicholas Miehlbradt             0);
5752*395b5d5bSNicholas Miehlbradt }
5753*395b5d5bSNicholas Miehlbradt 
57548f2e9d40SDaniel Henrique Barboza /*
57558f2e9d40SDaniel Henrique Barboza  * Initialize PMU counter overflow timers for Power8 and
57568f2e9d40SDaniel Henrique Barboza  * newer Power chips when using TCG.
57578f2e9d40SDaniel Henrique Barboza  */
57588f2e9d40SDaniel Henrique Barboza static void init_tcg_pmu_power8(CPUPPCState *env)
57598f2e9d40SDaniel Henrique Barboza {
57608f2e9d40SDaniel Henrique Barboza     /* Init PMU overflow timers */
576133edcde7SDaniel Henrique Barboza     if (tcg_enabled()) {
57628f2e9d40SDaniel Henrique Barboza         cpu_ppc_pmu_init(env);
57638f2e9d40SDaniel Henrique Barboza     }
57648f2e9d40SDaniel Henrique Barboza }
57658f2e9d40SDaniel Henrique Barboza 
57663e770bf7SBruno Larsen (billionai) static void init_proc_book3s_common(CPUPPCState *env)
57673e770bf7SBruno Larsen (billionai) {
5768217781afSFabiano Rosas     register_non_embedded_sprs(env);
57693e770bf7SBruno Larsen (billionai)     register_book3s_altivec_sprs(env);
57703e770bf7SBruno Larsen (billionai)     register_book3s_pmu_sup_sprs(env);
57713e770bf7SBruno Larsen (billionai)     register_book3s_pmu_user_sprs(env);
57723e770bf7SBruno Larsen (billionai)     register_book3s_ctrl_sprs(env);
57733e770bf7SBruno Larsen (billionai)     /*
57743e770bf7SBruno Larsen (billionai)      * Can't find information on what this should be on reset.  This
57753e770bf7SBruno Larsen (billionai)      * value is the one used by 74xx processors.
57763e770bf7SBruno Larsen (billionai)      */
57773e770bf7SBruno Larsen (billionai)     vscr_init(env, 0x00010000);
57782a48d83dSFabiano Rosas 
57792a48d83dSFabiano Rosas     spr_register(env, SPR_USPRG3, "USPRG3",
57802a48d83dSFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
57812a48d83dSFabiano Rosas                  &spr_read_ureg, SPR_NOACCESS,
57822a48d83dSFabiano Rosas                  0x00000000);
57833e770bf7SBruno Larsen (billionai) }
57843e770bf7SBruno Larsen (billionai) 
57853e770bf7SBruno Larsen (billionai) static void init_proc_970(CPUPPCState *env)
57863e770bf7SBruno Larsen (billionai) {
57873e770bf7SBruno Larsen (billionai)     /* Common Registers */
57883e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
57893e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
57903e770bf7SBruno Larsen (billionai)     register_book3s_dbg_sprs(env);
57913e770bf7SBruno Larsen (billionai) 
57923e770bf7SBruno Larsen (billionai)     /* 970 Specific Registers */
57933e770bf7SBruno Larsen (billionai)     register_970_hid_sprs(env);
57943e770bf7SBruno Larsen (billionai)     register_970_hior_sprs(env);
57953e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
57963e770bf7SBruno Larsen (billionai)     register_970_pmu_sup_sprs(env);
57973e770bf7SBruno Larsen (billionai)     register_970_pmu_user_sprs(env);
57983e770bf7SBruno Larsen (billionai)     register_970_lpar_sprs(env);
57993e770bf7SBruno Larsen (billionai)     register_970_dbg_sprs(env);
58003e770bf7SBruno Larsen (billionai) 
58013e770bf7SBruno Larsen (billionai)     /* env variables */
58023e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
58033e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
58043e770bf7SBruno Larsen (billionai) 
58053e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
58063e770bf7SBruno Larsen (billionai)     init_excp_970(env);
58073e770bf7SBruno Larsen (billionai)     ppc970_irq_init(env_archcpu(env));
58083e770bf7SBruno Larsen (billionai) }
58093e770bf7SBruno Larsen (billionai) 
58103e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(970)(ObjectClass *oc, void *data)
58113e770bf7SBruno Larsen (billionai) {
58123e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
58133e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
58143e770bf7SBruno Larsen (billionai) 
58153e770bf7SBruno Larsen (billionai)     dc->desc = "PowerPC 970";
58163e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_970;
58173e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_970;
58183e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
58193e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
58203e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
58213e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
58223e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
58233e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
58243e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
58253e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_ALTIVEC |
58263e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI;
582703abfd90SNicholas Piggin     pcc->insns_flags2 = PPC2_FP_CVT_S64 | PPC2_MEM_LWSYNC;
58283e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
58293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
58303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
58313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
58323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
58333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
58343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
58353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
58363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
58373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
58383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
58393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
58403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
58413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
58423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
58433e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_64B;
58443e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
58453e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_basic;
58463e770bf7SBruno Larsen (billionai) #endif
58473e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_970;
58483e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_970;
58493e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
58503e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
58513e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
58523e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
58533e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
58543e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x10000;
58553e770bf7SBruno Larsen (billionai) }
58563e770bf7SBruno Larsen (billionai) 
58573e770bf7SBruno Larsen (billionai) static void init_proc_power5plus(CPUPPCState *env)
58583e770bf7SBruno Larsen (billionai) {
58593e770bf7SBruno Larsen (billionai)     /* Common Registers */
58603e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
58613e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
58623e770bf7SBruno Larsen (billionai)     register_book3s_dbg_sprs(env);
58633e770bf7SBruno Larsen (billionai) 
58643e770bf7SBruno Larsen (billionai)     /* POWER5+ Specific Registers */
58653e770bf7SBruno Larsen (billionai)     register_970_hid_sprs(env);
58663e770bf7SBruno Larsen (billionai)     register_970_hior_sprs(env);
58673e770bf7SBruno Larsen (billionai)     register_low_BATs(env);
58683e770bf7SBruno Larsen (billionai)     register_970_pmu_sup_sprs(env);
58693e770bf7SBruno Larsen (billionai)     register_970_pmu_user_sprs(env);
58703e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
58713e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
58723e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
58733e770bf7SBruno Larsen (billionai)     register_power5p_tb_sprs(env);
58743e770bf7SBruno Larsen (billionai) 
58753e770bf7SBruno Larsen (billionai)     /* env variables */
58763e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
58773e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
58783e770bf7SBruno Larsen (billionai) 
58793e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
58803e770bf7SBruno Larsen (billionai)     init_excp_970(env);
58813e770bf7SBruno Larsen (billionai)     ppc970_irq_init(env_archcpu(env));
58823e770bf7SBruno Larsen (billionai) }
58833e770bf7SBruno Larsen (billionai) 
58843e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data)
58853e770bf7SBruno Larsen (billionai) {
58863e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
58873e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
58883e770bf7SBruno Larsen (billionai) 
58893e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER5";
58903e770bf7SBruno Larsen (billionai)     dc->desc = "POWER5+";
58913e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_power5plus;
58923e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_970;
58933e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
58943e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
58953e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
58963e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
589791137619SCédric Le Goater                        PPC_FLOAT_EXT |
58983e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
58993e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
59003e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
59013e770bf7SBruno Larsen (billionai)                        PPC_64B |
590223ab6d88SCédric Le Goater                        PPC_POPCNTB |
59033e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI;
590403abfd90SNicholas Piggin     pcc->insns_flags2 = PPC2_FP_CVT_S64 | PPC2_MEM_LWSYNC;
59053e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
59063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
59073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_POW) |
59083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
59093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
59103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
59113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
59123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
59133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
59143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
59153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
59163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
59173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
59183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
59193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI);
59203e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_RMLS | LPCR_ILE | LPCR_LPES0 | LPCR_LPES1 |
59213e770bf7SBruno Larsen (billionai)         LPCR_RMI | LPCR_HDICE;
59223e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_2_03;
59233e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
59243e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_basic;
59253e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 32;
59263e770bf7SBruno Larsen (billionai) #endif
59273e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_970;
59283e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_970;
59293e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
59303e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
59313e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
59323e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK;
59333e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
59343e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x10000;
59353e770bf7SBruno Larsen (billionai) }
59363e770bf7SBruno Larsen (billionai) 
59373e770bf7SBruno Larsen (billionai) static void init_proc_POWER7(CPUPPCState *env)
59383e770bf7SBruno Larsen (billionai) {
59393e770bf7SBruno Larsen (billionai)     /* Common Registers */
59403e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
59413e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
59423e770bf7SBruno Larsen (billionai)     register_book3s_dbg_sprs(env);
59433e770bf7SBruno Larsen (billionai) 
59443e770bf7SBruno Larsen (billionai)     /* POWER7 Specific Registers */
59453e770bf7SBruno Larsen (billionai)     register_book3s_ids_sprs(env);
59463e770bf7SBruno Larsen (billionai)     register_rmor_sprs(env);
59473e770bf7SBruno Larsen (billionai)     register_amr_sprs(env);
59483e770bf7SBruno Larsen (billionai)     register_book3s_purr_sprs(env);
59493e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
59503e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
59513e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
59523e770bf7SBruno Larsen (billionai)     register_power5p_tb_sprs(env);
59533e770bf7SBruno Larsen (billionai)     register_power6_common_sprs(env);
59543e770bf7SBruno Larsen (billionai)     register_power6_dbg_sprs(env);
59553e770bf7SBruno Larsen (billionai)     register_power7_book4_sprs(env);
59563e770bf7SBruno Larsen (billionai) 
59573e770bf7SBruno Larsen (billionai)     /* env variables */
59583e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
59593e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
59603e770bf7SBruno Larsen (billionai) 
59613e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
59623e770bf7SBruno Larsen (billionai)     init_excp_POWER7(env);
59633e770bf7SBruno Larsen (billionai)     ppcPOWER7_irq_init(env_archcpu(env));
59643e770bf7SBruno Larsen (billionai) }
59653e770bf7SBruno Larsen (billionai) 
596621d3a78eSNicholas Piggin static bool ppc_pvr_match_power7(PowerPCCPUClass *pcc, uint32_t pvr, bool best)
59673e770bf7SBruno Larsen (billionai) {
596821d3a78eSNicholas Piggin     uint32_t base = pvr & CPU_POWERPC_POWER_SERVER_MASK;
596921d3a78eSNicholas Piggin     uint32_t pcc_base = pcc->pvr & CPU_POWERPC_POWER_SERVER_MASK;
597021d3a78eSNicholas Piggin 
597121d3a78eSNicholas Piggin     if (!best) {
597221d3a78eSNicholas Piggin         if (base == CPU_POWERPC_POWER7_BASE) {
59733e770bf7SBruno Larsen (billionai)             return true;
59743e770bf7SBruno Larsen (billionai)         }
597521d3a78eSNicholas Piggin         if (base == CPU_POWERPC_POWER7P_BASE) {
59763e770bf7SBruno Larsen (billionai)             return true;
59773e770bf7SBruno Larsen (billionai)         }
597821d3a78eSNicholas Piggin     }
597921d3a78eSNicholas Piggin 
598021d3a78eSNicholas Piggin     if (base != pcc_base) {
59813e770bf7SBruno Larsen (billionai)         return false;
59823e770bf7SBruno Larsen (billionai)     }
59833e770bf7SBruno Larsen (billionai) 
598421d3a78eSNicholas Piggin     return true;
598521d3a78eSNicholas Piggin }
598621d3a78eSNicholas Piggin 
59873e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)
59883e770bf7SBruno Larsen (billionai) {
59893e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
59903e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
59913e770bf7SBruno Larsen (billionai) 
59923e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER7";
59933e770bf7SBruno Larsen (billionai)     dc->desc = "POWER7";
59943e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_power7;
59953e770bf7SBruno Larsen (billionai)     pcc->pcr_mask = PCR_VEC_DIS | PCR_VSX_DIS | PCR_COMPAT_2_05;
59963e770bf7SBruno Larsen (billionai)     pcc->pcr_supported = PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
59973e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_POWER7;
59983e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
59993e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
60003e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
60013e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
60023e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTES |
60033e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
60043e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_EXT |
60053e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
60063e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
60073e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
60083e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
60093e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI |
60103e770bf7SBruno Larsen (billionai)                        PPC_POPCNTB | PPC_POPCNTWD |
60113e770bf7SBruno Larsen (billionai)                        PPC_CILDST;
60123e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_VSX | PPC2_DFP | PPC2_DBRX | PPC2_ISA205 |
60133e770bf7SBruno Larsen (billionai)                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
60143e770bf7SBruno Larsen (billionai)                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
60153e770bf7SBruno Larsen (billionai)                         PPC2_FP_TST_ISA206 | PPC2_FP_CVT_S64 |
60164dc5f8abSMatheus Ferst                         PPC2_PM_ISA206 | PPC2_MEM_LWSYNC | PPC2_BCDA_ISA206;
60173e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
60183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
60193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VSX) |
60203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
60213e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
60223e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
60233e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
60243e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
60253e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
60263e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
60273e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
60283e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
60293e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
60303e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
60313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
60323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
60333e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_VPM0 | LPCR_VPM1 | LPCR_ISL | LPCR_DPFD |
60343e770bf7SBruno Larsen (billionai)         LPCR_VRMASD | LPCR_RMLS | LPCR_ILE |
60353e770bf7SBruno Larsen (billionai)         LPCR_P7_PECE0 | LPCR_P7_PECE1 | LPCR_P7_PECE2 |
60363e770bf7SBruno Larsen (billionai)         LPCR_MER | LPCR_TC |
60373e770bf7SBruno Larsen (billionai)         LPCR_LPES0 | LPCR_LPES1 | LPCR_HDICE;
60383e770bf7SBruno Larsen (billionai)     pcc->lpcr_pm = LPCR_P7_PECE0 | LPCR_P7_PECE1 | LPCR_P7_PECE2;
60393e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_2_06;
60403e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
60413e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_POWER7;
60423e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 32;
60433e770bf7SBruno Larsen (billionai) #endif
60443e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_POWER7;
60453e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
60463e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
60473e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
60483e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
60493e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
60503e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_VSX;
60513e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
60523e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x8000;
60533e770bf7SBruno Larsen (billionai) }
60543e770bf7SBruno Larsen (billionai) 
60553e770bf7SBruno Larsen (billionai) static void init_proc_POWER8(CPUPPCState *env)
60563e770bf7SBruno Larsen (billionai) {
60573e770bf7SBruno Larsen (billionai)     /* Common Registers */
60583e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
60593e770bf7SBruno Larsen (billionai)     register_sdr1_sprs(env);
60603e770bf7SBruno Larsen (billionai)     register_book3s_207_dbg_sprs(env);
60613e770bf7SBruno Larsen (billionai) 
60628f2e9d40SDaniel Henrique Barboza     /* Common TCG PMU */
60638f2e9d40SDaniel Henrique Barboza     init_tcg_pmu_power8(env);
60648f2e9d40SDaniel Henrique Barboza 
60653e770bf7SBruno Larsen (billionai)     /* POWER8 Specific Registers */
60663e770bf7SBruno Larsen (billionai)     register_book3s_ids_sprs(env);
60673e770bf7SBruno Larsen (billionai)     register_rmor_sprs(env);
60683e770bf7SBruno Larsen (billionai)     register_amr_sprs(env);
60693e770bf7SBruno Larsen (billionai)     register_iamr_sprs(env);
60703e770bf7SBruno Larsen (billionai)     register_book3s_purr_sprs(env);
60713e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
60723e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
60733e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
60743e770bf7SBruno Larsen (billionai)     register_power5p_tb_sprs(env);
60753e770bf7SBruno Larsen (billionai)     register_power6_common_sprs(env);
60763e770bf7SBruno Larsen (billionai)     register_power6_dbg_sprs(env);
60773e770bf7SBruno Larsen (billionai)     register_power8_tce_address_control_sprs(env);
60783e770bf7SBruno Larsen (billionai)     register_power8_ids_sprs(env);
60793e770bf7SBruno Larsen (billionai)     register_power8_ebb_sprs(env);
60803e770bf7SBruno Larsen (billionai)     register_power8_fscr_sprs(env);
60813e770bf7SBruno Larsen (billionai)     register_power8_pmu_sup_sprs(env);
60823e770bf7SBruno Larsen (billionai)     register_power8_pmu_user_sprs(env);
60833e770bf7SBruno Larsen (billionai)     register_power8_tm_sprs(env);
60843e770bf7SBruno Larsen (billionai)     register_power8_pspb_sprs(env);
60853e770bf7SBruno Larsen (billionai)     register_power8_dpdes_sprs(env);
60863e770bf7SBruno Larsen (billionai)     register_vtb_sprs(env);
60873e770bf7SBruno Larsen (billionai)     register_power8_ic_sprs(env);
60883e770bf7SBruno Larsen (billionai)     register_power8_book4_sprs(env);
60893e770bf7SBruno Larsen (billionai)     register_power8_rpr_sprs(env);
60903e770bf7SBruno Larsen (billionai) 
60913e770bf7SBruno Larsen (billionai)     /* env variables */
60923e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
60933e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
60943e770bf7SBruno Larsen (billionai) 
60953e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
60963e770bf7SBruno Larsen (billionai)     init_excp_POWER8(env);
60973e770bf7SBruno Larsen (billionai)     ppcPOWER7_irq_init(env_archcpu(env));
60983e770bf7SBruno Larsen (billionai) }
60993e770bf7SBruno Larsen (billionai) 
610021d3a78eSNicholas Piggin static bool ppc_pvr_match_power8(PowerPCCPUClass *pcc, uint32_t pvr, bool best)
61013e770bf7SBruno Larsen (billionai) {
610221d3a78eSNicholas Piggin     uint32_t base = pvr & CPU_POWERPC_POWER_SERVER_MASK;
610321d3a78eSNicholas Piggin     uint32_t pcc_base = pcc->pvr & CPU_POWERPC_POWER_SERVER_MASK;
610421d3a78eSNicholas Piggin 
610521d3a78eSNicholas Piggin     if (!best) {
610621d3a78eSNicholas Piggin         if (base == CPU_POWERPC_POWER8_BASE) {
61073e770bf7SBruno Larsen (billionai)             return true;
61083e770bf7SBruno Larsen (billionai)         }
610921d3a78eSNicholas Piggin         if (base == CPU_POWERPC_POWER8E_BASE) {
61103e770bf7SBruno Larsen (billionai)             return true;
61113e770bf7SBruno Larsen (billionai)         }
611221d3a78eSNicholas Piggin         if (base == CPU_POWERPC_POWER8NVL_BASE) {
61133e770bf7SBruno Larsen (billionai)             return true;
61143e770bf7SBruno Larsen (billionai)         }
611521d3a78eSNicholas Piggin     }
611621d3a78eSNicholas Piggin     if (base != pcc_base) {
61173e770bf7SBruno Larsen (billionai)         return false;
61183e770bf7SBruno Larsen (billionai)     }
61193e770bf7SBruno Larsen (billionai) 
612021d3a78eSNicholas Piggin     return true;
612121d3a78eSNicholas Piggin }
612221d3a78eSNicholas Piggin 
61233e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)
61243e770bf7SBruno Larsen (billionai) {
61253e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
61263e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
61273e770bf7SBruno Larsen (billionai) 
61283e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER8";
61293e770bf7SBruno Larsen (billionai)     dc->desc = "POWER8";
61303e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_power8;
61313e770bf7SBruno Larsen (billionai)     pcc->pcr_mask = PCR_TM_DIS | PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
61323e770bf7SBruno Larsen (billionai)     pcc->pcr_supported = PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
61333e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_POWER8;
61343e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
61353e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
61363e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
61373e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
61383e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTES |
61393e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
61403e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_EXT |
61413e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
61423e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
61433e770bf7SBruno Larsen (billionai)                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
61443e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
61453e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI |
61463e770bf7SBruno Larsen (billionai)                        PPC_POPCNTB | PPC_POPCNTWD |
61473e770bf7SBruno Larsen (billionai)                        PPC_CILDST;
61483e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
61493e770bf7SBruno Larsen (billionai)                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
61503e770bf7SBruno Larsen (billionai)                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
61513e770bf7SBruno Larsen (billionai)                         PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
61523e770bf7SBruno Larsen (billionai)                         PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
61533e770bf7SBruno Larsen (billionai)                         PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 |
61544dc5f8abSMatheus Ferst                         PPC2_TM | PPC2_PM_ISA206 | PPC2_MEM_LWSYNC |
61554dc5f8abSMatheus Ferst                         PPC2_BCDA_ISA206;
61563e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
61573e770bf7SBruno Larsen (billionai)                     (1ull << MSR_HV) |
61583e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TM) |
61593e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
61603e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VSX) |
61613e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
61623e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
61633e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
61643e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
61653e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
61663e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
61673e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
61683e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
61693e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
61703e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
61713e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
61723e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
61733e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TS0) |
61743e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TS1) |
61753e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
61763e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_VPM0 | LPCR_VPM1 | LPCR_ISL | LPCR_KBV |
61773e770bf7SBruno Larsen (billionai)         LPCR_DPFD | LPCR_VRMASD | LPCR_RMLS | LPCR_ILE |
61783e770bf7SBruno Larsen (billionai)         LPCR_AIL | LPCR_ONL | LPCR_P8_PECE0 | LPCR_P8_PECE1 |
61793e770bf7SBruno Larsen (billionai)         LPCR_P8_PECE2 | LPCR_P8_PECE3 | LPCR_P8_PECE4 |
61803e770bf7SBruno Larsen (billionai)         LPCR_MER | LPCR_TC | LPCR_LPES0 | LPCR_HDICE;
61813e770bf7SBruno Larsen (billionai)     pcc->lpcr_pm = LPCR_P8_PECE0 | LPCR_P8_PECE1 | LPCR_P8_PECE2 |
61823e770bf7SBruno Larsen (billionai)                    LPCR_P8_PECE3 | LPCR_P8_PECE4;
61833e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_2_07;
61843e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
61853e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_POWER7;
61863e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 32;
61873e770bf7SBruno Larsen (billionai)     pcc->n_host_threads = 8;
61883e770bf7SBruno Larsen (billionai) #endif
61893e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_POWER8;
61903e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
61913e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
61923e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
61933e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
61943e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
61953e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_VSX | POWERPC_FLAG_TM;
61963e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
61973e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x8000;
61983e770bf7SBruno Larsen (billionai) }
61993e770bf7SBruno Larsen (billionai) 
62003e770bf7SBruno Larsen (billionai) #ifdef CONFIG_SOFTMMU
62013e770bf7SBruno Larsen (billionai) /*
62023e770bf7SBruno Larsen (billionai)  * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
62033e770bf7SBruno Larsen (billionai)  * Encoded as array of int_32s in the form:
62043e770bf7SBruno Larsen (billionai)  *  0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
62053e770bf7SBruno Larsen (billionai)  *  x -> AP encoding
62063e770bf7SBruno Larsen (billionai)  *  y -> radix mode supported page size (encoded as a shift)
62073e770bf7SBruno Larsen (billionai)  */
62083e770bf7SBruno Larsen (billionai) static struct ppc_radix_page_info POWER9_radix_page_info = {
62093e770bf7SBruno Larsen (billionai)     .count = 4,
62103e770bf7SBruno Larsen (billionai)     .entries = {
62113e770bf7SBruno Larsen (billionai)         0x0000000c, /*  4K - enc: 0x0 */
62123e770bf7SBruno Larsen (billionai)         0xa0000010, /* 64K - enc: 0x5 */
62133e770bf7SBruno Larsen (billionai)         0x20000015, /*  2M - enc: 0x1 */
62143e770bf7SBruno Larsen (billionai)         0x4000001e  /*  1G - enc: 0x2 */
62153e770bf7SBruno Larsen (billionai)     }
62163e770bf7SBruno Larsen (billionai) };
62173e770bf7SBruno Larsen (billionai) #endif /* CONFIG_SOFTMMU */
62183e770bf7SBruno Larsen (billionai) 
62193e770bf7SBruno Larsen (billionai) static void init_proc_POWER9(CPUPPCState *env)
62203e770bf7SBruno Larsen (billionai) {
62213e770bf7SBruno Larsen (billionai)     /* Common Registers */
62223e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
62233e770bf7SBruno Larsen (billionai)     register_book3s_207_dbg_sprs(env);
62243e770bf7SBruno Larsen (billionai) 
62258f2e9d40SDaniel Henrique Barboza     /* Common TCG PMU */
62268f2e9d40SDaniel Henrique Barboza     init_tcg_pmu_power8(env);
62278f2e9d40SDaniel Henrique Barboza 
62283e770bf7SBruno Larsen (billionai)     /* POWER8 Specific Registers */
62293e770bf7SBruno Larsen (billionai)     register_book3s_ids_sprs(env);
62303e770bf7SBruno Larsen (billionai)     register_amr_sprs(env);
62313e770bf7SBruno Larsen (billionai)     register_iamr_sprs(env);
62323e770bf7SBruno Larsen (billionai)     register_book3s_purr_sprs(env);
62333e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
62343e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
62353e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
62363e770bf7SBruno Larsen (billionai)     register_power5p_tb_sprs(env);
62373e770bf7SBruno Larsen (billionai)     register_power6_common_sprs(env);
62383e770bf7SBruno Larsen (billionai)     register_power6_dbg_sprs(env);
62393e770bf7SBruno Larsen (billionai)     register_power8_tce_address_control_sprs(env);
62403e770bf7SBruno Larsen (billionai)     register_power8_ids_sprs(env);
62413e770bf7SBruno Larsen (billionai)     register_power8_ebb_sprs(env);
62423e770bf7SBruno Larsen (billionai)     register_power8_fscr_sprs(env);
62433e770bf7SBruno Larsen (billionai)     register_power8_pmu_sup_sprs(env);
62443e770bf7SBruno Larsen (billionai)     register_power8_pmu_user_sprs(env);
62453e770bf7SBruno Larsen (billionai)     register_power8_tm_sprs(env);
62463e770bf7SBruno Larsen (billionai)     register_power8_pspb_sprs(env);
62473e770bf7SBruno Larsen (billionai)     register_power8_dpdes_sprs(env);
62483e770bf7SBruno Larsen (billionai)     register_vtb_sprs(env);
62493e770bf7SBruno Larsen (billionai)     register_power8_ic_sprs(env);
62503e770bf7SBruno Larsen (billionai)     register_power8_book4_sprs(env);
62513e770bf7SBruno Larsen (billionai)     register_power8_rpr_sprs(env);
62523e770bf7SBruno Larsen (billionai)     register_power9_mmu_sprs(env);
62533e770bf7SBruno Larsen (billionai) 
62543e770bf7SBruno Larsen (billionai)     /* POWER9 Specific registers */
62553e770bf7SBruno Larsen (billionai)     spr_register_kvm(env, SPR_TIDR, "TIDR", NULL, NULL,
62563e770bf7SBruno Larsen (billionai)                      spr_read_generic, spr_write_generic,
62573e770bf7SBruno Larsen (billionai)                      KVM_REG_PPC_TIDR, 0);
62583e770bf7SBruno Larsen (billionai) 
62593e770bf7SBruno Larsen (billionai)     /* FIXME: Filter fields properly based on privilege level */
62603e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL,
62613e770bf7SBruno Larsen (billionai)                         spr_read_generic, spr_write_generic,
62623e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_PSSCR, 0);
62633e770bf7SBruno Larsen (billionai) 
62643e770bf7SBruno Larsen (billionai)     /* env variables */
62653e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
62663e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
62673e770bf7SBruno Larsen (billionai) 
62683e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
62693e770bf7SBruno Larsen (billionai)     init_excp_POWER9(env);
62703e770bf7SBruno Larsen (billionai)     ppcPOWER9_irq_init(env_archcpu(env));
62713e770bf7SBruno Larsen (billionai) }
62723e770bf7SBruno Larsen (billionai) 
627321d3a78eSNicholas Piggin static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr, bool best)
62743e770bf7SBruno Larsen (billionai) {
627521d3a78eSNicholas Piggin     uint32_t base = pvr & CPU_POWERPC_POWER_SERVER_MASK;
627621d3a78eSNicholas Piggin     uint32_t pcc_base = pcc->pvr & CPU_POWERPC_POWER_SERVER_MASK;
627721d3a78eSNicholas Piggin 
627821d3a78eSNicholas Piggin     if (!best) {
627921d3a78eSNicholas Piggin         if (base == CPU_POWERPC_POWER9_BASE) {
62803e770bf7SBruno Larsen (billionai)             return true;
62813e770bf7SBruno Larsen (billionai)         }
628221d3a78eSNicholas Piggin     }
628321d3a78eSNicholas Piggin 
628421d3a78eSNicholas Piggin     if (base != pcc_base) {
628521d3a78eSNicholas Piggin         return false;
628621d3a78eSNicholas Piggin     }
628721d3a78eSNicholas Piggin 
628821d3a78eSNicholas Piggin     if ((pvr & 0x0f00) == (pcc->pvr & 0x0f00)) {
628921d3a78eSNicholas Piggin         /* Major DD version matches to power9_v1.0 and power9_v2.0 */
629021d3a78eSNicholas Piggin         return true;
629121d3a78eSNicholas Piggin     }
629221d3a78eSNicholas Piggin 
62933e770bf7SBruno Larsen (billionai)     return false;
62943e770bf7SBruno Larsen (billionai) }
62953e770bf7SBruno Larsen (billionai) 
62963e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data)
62973e770bf7SBruno Larsen (billionai) {
62983e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
62993e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
63003e770bf7SBruno Larsen (billionai) 
63013e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER9";
63023e770bf7SBruno Larsen (billionai)     dc->desc = "POWER9";
63033e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_power9;
63043e770bf7SBruno Larsen (billionai)     pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06 | PCR_COMPAT_2_07;
63053e770bf7SBruno Larsen (billionai)     pcc->pcr_supported = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 |
63063e770bf7SBruno Larsen (billionai)                          PCR_COMPAT_2_05;
63073e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_POWER9;
63083e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
63093e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
63103e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
63113e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
63123e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTES |
63133e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
63143e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_EXT |
63153e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
63163e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
6317016b6e1dSLeandro Lupori                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
63183e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
63193e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI |
63203e770bf7SBruno Larsen (billionai)                        PPC_POPCNTB | PPC_POPCNTWD |
63213e770bf7SBruno Larsen (billionai)                        PPC_CILDST;
63223e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
63233e770bf7SBruno Larsen (billionai)                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
63243e770bf7SBruno Larsen (billionai)                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
63253e770bf7SBruno Larsen (billionai)                         PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
63263e770bf7SBruno Larsen (billionai)                         PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
63273e770bf7SBruno Larsen (billionai)                         PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 |
63284dc5f8abSMatheus Ferst                         PPC2_TM | PPC2_ISA300 | PPC2_PRCNTL | PPC2_MEM_LWSYNC |
63294dc5f8abSMatheus Ferst                         PPC2_BCDA_ISA206;
63303e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
63313e770bf7SBruno Larsen (billionai)                     (1ull << MSR_HV) |
63323e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TM) |
63333e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
63343e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VSX) |
63353e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
63363e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
63373e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
63383e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
63393e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
63403e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
63413e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
63423e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
63433e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
63443e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
63453e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
63463e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
63473e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
63483e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_VPM1 | LPCR_ISL | LPCR_KBV | LPCR_DPFD |
63493e770bf7SBruno Larsen (billionai)         (LPCR_PECE_U_MASK & LPCR_HVEE) | LPCR_ILE | LPCR_AIL |
63503e770bf7SBruno Larsen (billionai)         LPCR_UPRT | LPCR_EVIRT | LPCR_ONL | LPCR_HR | LPCR_LD |
63513e770bf7SBruno Larsen (billionai)         (LPCR_PECE_L_MASK & (LPCR_PDEE | LPCR_HDEE | LPCR_EEE |
63523e770bf7SBruno Larsen (billionai)                              LPCR_DEE | LPCR_OEE))
63533e770bf7SBruno Larsen (billionai)         | LPCR_MER | LPCR_GTSE | LPCR_TC |
63543e770bf7SBruno Larsen (billionai)         LPCR_HEIC | LPCR_LPES0 | LPCR_HVICE | LPCR_HDICE;
63553e770bf7SBruno Larsen (billionai)     pcc->lpcr_pm = LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE | LPCR_OEE;
63563e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_3_00;
63573e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
63583e770bf7SBruno Larsen (billionai)     /* segment page size remain the same */
63593e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_POWER7;
63603e770bf7SBruno Larsen (billionai)     pcc->radix_page_info = &POWER9_radix_page_info;
63613e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 56;
63623e770bf7SBruno Larsen (billionai)     pcc->n_host_threads = 4;
63633e770bf7SBruno Larsen (billionai) #endif
63643e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_POWER9;
63653e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_POWER9;
63663e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
63673e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
63683e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
63693e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
63703e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_VSX | POWERPC_FLAG_TM | POWERPC_FLAG_SCV;
63713e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
63723e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x8000;
63733e770bf7SBruno Larsen (billionai) }
63743e770bf7SBruno Larsen (billionai) 
63753e770bf7SBruno Larsen (billionai) #ifdef CONFIG_SOFTMMU
63763e770bf7SBruno Larsen (billionai) /*
63773e770bf7SBruno Larsen (billionai)  * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
63783e770bf7SBruno Larsen (billionai)  * Encoded as array of int_32s in the form:
63793e770bf7SBruno Larsen (billionai)  *  0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
63803e770bf7SBruno Larsen (billionai)  *  x -> AP encoding
63813e770bf7SBruno Larsen (billionai)  *  y -> radix mode supported page size (encoded as a shift)
63823e770bf7SBruno Larsen (billionai)  */
63833e770bf7SBruno Larsen (billionai) static struct ppc_radix_page_info POWER10_radix_page_info = {
63843e770bf7SBruno Larsen (billionai)     .count = 4,
63853e770bf7SBruno Larsen (billionai)     .entries = {
63863e770bf7SBruno Larsen (billionai)         0x0000000c, /*  4K - enc: 0x0 */
63873e770bf7SBruno Larsen (billionai)         0xa0000010, /* 64K - enc: 0x5 */
63883e770bf7SBruno Larsen (billionai)         0x20000015, /*  2M - enc: 0x1 */
63893e770bf7SBruno Larsen (billionai)         0x4000001e  /*  1G - enc: 0x2 */
63903e770bf7SBruno Larsen (billionai)     }
63913e770bf7SBruno Larsen (billionai) };
63923e770bf7SBruno Larsen (billionai) #endif /* CONFIG_SOFTMMU */
63933e770bf7SBruno Larsen (billionai) 
63943e770bf7SBruno Larsen (billionai) static void init_proc_POWER10(CPUPPCState *env)
63953e770bf7SBruno Larsen (billionai) {
63963e770bf7SBruno Larsen (billionai)     /* Common Registers */
63973e770bf7SBruno Larsen (billionai)     init_proc_book3s_common(env);
63983e770bf7SBruno Larsen (billionai)     register_book3s_207_dbg_sprs(env);
63993e770bf7SBruno Larsen (billionai) 
64008f2e9d40SDaniel Henrique Barboza     /* Common TCG PMU */
64018f2e9d40SDaniel Henrique Barboza     init_tcg_pmu_power8(env);
64028f2e9d40SDaniel Henrique Barboza 
64033e770bf7SBruno Larsen (billionai)     /* POWER8 Specific Registers */
64043e770bf7SBruno Larsen (billionai)     register_book3s_ids_sprs(env);
64053e770bf7SBruno Larsen (billionai)     register_amr_sprs(env);
64063e770bf7SBruno Larsen (billionai)     register_iamr_sprs(env);
64073e770bf7SBruno Larsen (billionai)     register_book3s_purr_sprs(env);
64083e770bf7SBruno Larsen (billionai)     register_power5p_common_sprs(env);
64093e770bf7SBruno Larsen (billionai)     register_power5p_lpar_sprs(env);
64103e770bf7SBruno Larsen (billionai)     register_power5p_ear_sprs(env);
64114e610064SFrederic Barrat     register_power5p_tb_sprs(env);
64123e770bf7SBruno Larsen (billionai)     register_power6_common_sprs(env);
64133e770bf7SBruno Larsen (billionai)     register_power6_dbg_sprs(env);
64143e770bf7SBruno Larsen (billionai)     register_power8_tce_address_control_sprs(env);
64153e770bf7SBruno Larsen (billionai)     register_power8_ids_sprs(env);
64163e770bf7SBruno Larsen (billionai)     register_power8_ebb_sprs(env);
64173e770bf7SBruno Larsen (billionai)     register_power8_fscr_sprs(env);
64183e770bf7SBruno Larsen (billionai)     register_power8_pmu_sup_sprs(env);
64193e770bf7SBruno Larsen (billionai)     register_power8_pmu_user_sprs(env);
64203e770bf7SBruno Larsen (billionai)     register_power8_tm_sprs(env);
64213e770bf7SBruno Larsen (billionai)     register_power8_pspb_sprs(env);
64224e610064SFrederic Barrat     register_power8_dpdes_sprs(env);
64233e770bf7SBruno Larsen (billionai)     register_vtb_sprs(env);
64243e770bf7SBruno Larsen (billionai)     register_power8_ic_sprs(env);
64253e770bf7SBruno Larsen (billionai)     register_power8_book4_sprs(env);
64263e770bf7SBruno Larsen (billionai)     register_power8_rpr_sprs(env);
64273e770bf7SBruno Larsen (billionai)     register_power9_mmu_sprs(env);
6428903f84ebSVíctor Colombo     register_power10_hash_sprs(env);
6429*395b5d5bSNicholas Miehlbradt     register_power10_dexcr_sprs(env);
64303e770bf7SBruno Larsen (billionai) 
64313e770bf7SBruno Larsen (billionai)     /* FIXME: Filter fields properly based on privilege level */
64323e770bf7SBruno Larsen (billionai)     spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL,
64333e770bf7SBruno Larsen (billionai)                         spr_read_generic, spr_write_generic,
64343e770bf7SBruno Larsen (billionai)                         KVM_REG_PPC_PSSCR, 0);
64353e770bf7SBruno Larsen (billionai) 
64363e770bf7SBruno Larsen (billionai)     /* env variables */
64373e770bf7SBruno Larsen (billionai)     env->dcache_line_size = 128;
64383e770bf7SBruno Larsen (billionai)     env->icache_line_size = 128;
64393e770bf7SBruno Larsen (billionai) 
64403e770bf7SBruno Larsen (billionai)     /* Allocate hardware IRQ controller */
64413e770bf7SBruno Larsen (billionai)     init_excp_POWER10(env);
64423e770bf7SBruno Larsen (billionai)     ppcPOWER9_irq_init(env_archcpu(env));
64433e770bf7SBruno Larsen (billionai) }
64443e770bf7SBruno Larsen (billionai) 
644521d3a78eSNicholas Piggin static bool ppc_pvr_match_power10(PowerPCCPUClass *pcc, uint32_t pvr, bool best)
64463e770bf7SBruno Larsen (billionai) {
644721d3a78eSNicholas Piggin     uint32_t base = pvr & CPU_POWERPC_POWER_SERVER_MASK;
644821d3a78eSNicholas Piggin     uint32_t pcc_base = pcc->pvr & CPU_POWERPC_POWER_SERVER_MASK;
644921d3a78eSNicholas Piggin 
645021d3a78eSNicholas Piggin     if (!best) {
645121d3a78eSNicholas Piggin         if (base == CPU_POWERPC_POWER10_BASE) {
64523e770bf7SBruno Larsen (billionai)             return true;
64533e770bf7SBruno Larsen (billionai)         }
645421d3a78eSNicholas Piggin     }
645521d3a78eSNicholas Piggin 
645621d3a78eSNicholas Piggin     if (base != pcc_base) {
645721d3a78eSNicholas Piggin         return false;
645821d3a78eSNicholas Piggin     }
645921d3a78eSNicholas Piggin 
646021d3a78eSNicholas Piggin     if ((pvr & 0x0f00) == (pcc->pvr & 0x0f00)) {
646121d3a78eSNicholas Piggin         /* Major DD version matches to power10_v1.0 and power10_v2.0 */
646221d3a78eSNicholas Piggin         return true;
646321d3a78eSNicholas Piggin     }
646421d3a78eSNicholas Piggin 
64653e770bf7SBruno Larsen (billionai)     return false;
64663e770bf7SBruno Larsen (billionai) }
64673e770bf7SBruno Larsen (billionai) 
64683e770bf7SBruno Larsen (billionai) POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data)
64693e770bf7SBruno Larsen (billionai) {
64703e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
64713e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
64723e770bf7SBruno Larsen (billionai) 
64733e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,POWER10";
64743e770bf7SBruno Larsen (billionai)     dc->desc = "POWER10";
64753e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_power10;
64763e770bf7SBruno Larsen (billionai)     pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06 | PCR_COMPAT_2_07 |
64773e770bf7SBruno Larsen (billionai)                     PCR_COMPAT_3_00;
64783e770bf7SBruno Larsen (billionai)     pcc->pcr_supported = PCR_COMPAT_3_10 | PCR_COMPAT_3_00 | PCR_COMPAT_2_07 |
64793e770bf7SBruno Larsen (billionai)                          PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
64803e770bf7SBruno Larsen (billionai)     pcc->init_proc = init_proc_POWER10;
64813e770bf7SBruno Larsen (billionai)     pcc->check_pow = check_pow_nocheck;
64823e770bf7SBruno Larsen (billionai)     pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
64833e770bf7SBruno Larsen (billionai)                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
64843e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
64853e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_FRSQRTES |
64863e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_STFIWX |
64873e770bf7SBruno Larsen (billionai)                        PPC_FLOAT_EXT |
64883e770bf7SBruno Larsen (billionai)                        PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
64893e770bf7SBruno Larsen (billionai)                        PPC_MEM_SYNC | PPC_MEM_EIEIO |
6490016b6e1dSLeandro Lupori                        PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
64913e770bf7SBruno Larsen (billionai)                        PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |
64923e770bf7SBruno Larsen (billionai)                        PPC_SEGMENT_64B | PPC_SLBI |
64933e770bf7SBruno Larsen (billionai)                        PPC_POPCNTB | PPC_POPCNTWD |
64943e770bf7SBruno Larsen (billionai)                        PPC_CILDST;
64953e770bf7SBruno Larsen (billionai)     pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX |
64963e770bf7SBruno Larsen (billionai)                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
64973e770bf7SBruno Larsen (billionai)                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
64983e770bf7SBruno Larsen (billionai)                         PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
64993e770bf7SBruno Larsen (billionai)                         PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
65003e770bf7SBruno Larsen (billionai)                         PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 |
650103abfd90SNicholas Piggin                         PPC2_TM | PPC2_ISA300 | PPC2_PRCNTL | PPC2_ISA310 |
65024dc5f8abSMatheus Ferst                         PPC2_MEM_LWSYNC | PPC2_BCDA_ISA206;
65033e770bf7SBruno Larsen (billionai)     pcc->msr_mask = (1ull << MSR_SF) |
65043e770bf7SBruno Larsen (billionai)                     (1ull << MSR_HV) |
65053e770bf7SBruno Larsen (billionai)                     (1ull << MSR_TM) |
65063e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VR) |
65073e770bf7SBruno Larsen (billionai)                     (1ull << MSR_VSX) |
65083e770bf7SBruno Larsen (billionai)                     (1ull << MSR_EE) |
65093e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PR) |
65103e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FP) |
65113e770bf7SBruno Larsen (billionai)                     (1ull << MSR_ME) |
65123e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE0) |
65133e770bf7SBruno Larsen (billionai)                     (1ull << MSR_SE) |
65143e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DE) |
65153e770bf7SBruno Larsen (billionai)                     (1ull << MSR_FE1) |
65163e770bf7SBruno Larsen (billionai)                     (1ull << MSR_IR) |
65173e770bf7SBruno Larsen (billionai)                     (1ull << MSR_DR) |
65183e770bf7SBruno Larsen (billionai)                     (1ull << MSR_PMM) |
65193e770bf7SBruno Larsen (billionai)                     (1ull << MSR_RI) |
65203e770bf7SBruno Larsen (billionai)                     (1ull << MSR_LE);
65213e770bf7SBruno Larsen (billionai)     pcc->lpcr_mask = LPCR_VPM1 | LPCR_ISL | LPCR_KBV | LPCR_DPFD |
65223e770bf7SBruno Larsen (billionai)         (LPCR_PECE_U_MASK & LPCR_HVEE) | LPCR_ILE | LPCR_AIL |
65233e770bf7SBruno Larsen (billionai)         LPCR_UPRT | LPCR_EVIRT | LPCR_ONL | LPCR_HR | LPCR_LD |
65243e770bf7SBruno Larsen (billionai)         (LPCR_PECE_L_MASK & (LPCR_PDEE | LPCR_HDEE | LPCR_EEE |
65253e770bf7SBruno Larsen (billionai)                              LPCR_DEE | LPCR_OEE))
65263e770bf7SBruno Larsen (billionai)         | LPCR_MER | LPCR_GTSE | LPCR_TC |
65273e770bf7SBruno Larsen (billionai)         LPCR_HEIC | LPCR_LPES0 | LPCR_HVICE | LPCR_HDICE;
6528363fd548SCédric Le Goater     /* DD2 adds an extra HAIL bit */
6529363fd548SCédric Le Goater     pcc->lpcr_mask |= LPCR_HAIL;
6530363fd548SCédric Le Goater 
65313e770bf7SBruno Larsen (billionai)     pcc->lpcr_pm = LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE | LPCR_OEE;
65323e770bf7SBruno Larsen (billionai)     pcc->mmu_model = POWERPC_MMU_3_00;
65333e770bf7SBruno Larsen (billionai) #if defined(CONFIG_SOFTMMU)
65343e770bf7SBruno Larsen (billionai)     /* segment page size remain the same */
65353e770bf7SBruno Larsen (billionai)     pcc->hash64_opts = &ppc_hash64_opts_POWER7;
65363e770bf7SBruno Larsen (billionai)     pcc->radix_page_info = &POWER10_radix_page_info;
65373e770bf7SBruno Larsen (billionai)     pcc->lrg_decr_bits = 56;
65383e770bf7SBruno Larsen (billionai) #endif
65393e770bf7SBruno Larsen (billionai)     pcc->excp_model = POWERPC_EXCP_POWER10;
65403e770bf7SBruno Larsen (billionai)     pcc->bus_model = PPC_FLAGS_INPUT_POWER9;
65413e770bf7SBruno Larsen (billionai)     pcc->bfd_mach = bfd_mach_ppc64;
65423e770bf7SBruno Larsen (billionai)     pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
65433e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
65443e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
65453e770bf7SBruno Larsen (billionai)                  POWERPC_FLAG_VSX | POWERPC_FLAG_TM | POWERPC_FLAG_SCV;
65463e770bf7SBruno Larsen (billionai)     pcc->l1_dcache_size = 0x8000;
65473e770bf7SBruno Larsen (billionai)     pcc->l1_icache_size = 0x8000;
65483e770bf7SBruno Larsen (billionai) }
65493e770bf7SBruno Larsen (billionai) 
65503e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
65513e770bf7SBruno Larsen (billionai) void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp)
65523e770bf7SBruno Larsen (billionai) {
65533e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
65543e770bf7SBruno Larsen (billionai) 
65553e770bf7SBruno Larsen (billionai)     cpu->vhyp = vhyp;
65563e770bf7SBruno Larsen (billionai) 
65573e770bf7SBruno Larsen (billionai)     /*
65583e770bf7SBruno Larsen (billionai)      * With a virtual hypervisor mode we never allow the CPU to go
65593e770bf7SBruno Larsen (billionai)      * hypervisor mode itself
65603e770bf7SBruno Larsen (billionai)      */
65613e770bf7SBruno Larsen (billionai)     env->msr_mask &= ~MSR_HVB;
65623e770bf7SBruno Larsen (billionai) }
65633e770bf7SBruno Larsen (billionai) 
65643e770bf7SBruno Larsen (billionai) #endif /* !defined(CONFIG_USER_ONLY) */
65653e770bf7SBruno Larsen (billionai) 
65663e770bf7SBruno Larsen (billionai) #endif /* defined(TARGET_PPC64) */
65673e770bf7SBruno Larsen (billionai) 
65683e770bf7SBruno Larsen (billionai) /*****************************************************************************/
65693e770bf7SBruno Larsen (billionai) /* Generic CPU instantiation routine                                         */
65703e770bf7SBruno Larsen (billionai) static void init_ppc_proc(PowerPCCPU *cpu)
65713e770bf7SBruno Larsen (billionai) {
65723e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
65733e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
65743e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
65753e770bf7SBruno Larsen (billionai)     int i;
65763e770bf7SBruno Larsen (billionai) 
65773e770bf7SBruno Larsen (billionai)     /* Set all exception vectors to an invalid address */
65783e770bf7SBruno Larsen (billionai)     for (i = 0; i < POWERPC_EXCP_NB; i++) {
65793e770bf7SBruno Larsen (billionai)         env->excp_vectors[i] = (target_ulong)(-1ULL);
65803e770bf7SBruno Larsen (billionai)     }
65813e770bf7SBruno Larsen (billionai)     env->ivor_mask = 0x00000000;
65823e770bf7SBruno Larsen (billionai)     env->ivpr_mask = 0x00000000;
65833e770bf7SBruno Larsen (billionai)     /* Default MMU definitions */
65843e770bf7SBruno Larsen (billionai)     env->nb_BATs = 0;
65853e770bf7SBruno Larsen (billionai)     env->nb_tlb = 0;
65863e770bf7SBruno Larsen (billionai)     env->nb_ways = 0;
65873e770bf7SBruno Larsen (billionai)     env->tlb_type = TLB_NONE;
65883e770bf7SBruno Larsen (billionai) #endif
65893e770bf7SBruno Larsen (billionai)     /* Register SPR common to all PowerPC implementations */
6590e78280a2SFabiano Rosas     register_generic_sprs(cpu);
6591e78280a2SFabiano Rosas 
65923e770bf7SBruno Larsen (billionai)     /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
65933e770bf7SBruno Larsen (billionai)     (*pcc->init_proc)(env);
65943e770bf7SBruno Larsen (billionai) 
65953e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
65963e770bf7SBruno Larsen (billionai)     ppc_gdb_gen_spr_xml(cpu);
65973e770bf7SBruno Larsen (billionai) #endif
65983e770bf7SBruno Larsen (billionai) 
65993e770bf7SBruno Larsen (billionai)     /* MSR bits & flags consistency checks */
66003e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 25)) {
66013e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
66023e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_SPE:
66033e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_VRE:
66043e770bf7SBruno Larsen (billionai)             break;
66053e770bf7SBruno Larsen (billionai)         default:
66063e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66073e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
66083e770bf7SBruno Larsen (billionai)             exit(1);
66093e770bf7SBruno Larsen (billionai)         }
66103e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
66113e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66123e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
66133e770bf7SBruno Larsen (billionai)         exit(1);
66143e770bf7SBruno Larsen (billionai)     }
66153e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 17)) {
66163e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
66173e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_TGPR:
66183e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_CE:
66193e770bf7SBruno Larsen (billionai)             break;
66203e770bf7SBruno Larsen (billionai)         default:
66213e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66223e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
66233e770bf7SBruno Larsen (billionai)             exit(1);
66243e770bf7SBruno Larsen (billionai)         }
66253e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
66263e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66273e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
66283e770bf7SBruno Larsen (billionai)         exit(1);
66293e770bf7SBruno Larsen (billionai)     }
66303e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 10)) {
66313e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
66323e770bf7SBruno Larsen (billionai)                               POWERPC_FLAG_UBLE)) {
66333e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_SE:
66343e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_DWE:
66353e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_UBLE:
66363e770bf7SBruno Larsen (billionai)             break;
66373e770bf7SBruno Larsen (billionai)         default:
66383e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66393e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
66403e770bf7SBruno Larsen (billionai)                     "POWERPC_FLAG_UBLE\n");
66413e770bf7SBruno Larsen (billionai)             exit(1);
66423e770bf7SBruno Larsen (billionai)         }
66433e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
66443e770bf7SBruno Larsen (billionai)                              POWERPC_FLAG_UBLE)) {
66453e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66463e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
66473e770bf7SBruno Larsen (billionai)                 "POWERPC_FLAG_UBLE\n");
66483e770bf7SBruno Larsen (billionai)             exit(1);
66493e770bf7SBruno Larsen (billionai)     }
66503e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 9)) {
66513e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
66523e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_BE:
66533e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_DE:
66543e770bf7SBruno Larsen (billionai)             break;
66553e770bf7SBruno Larsen (billionai)         default:
66563e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66573e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
66583e770bf7SBruno Larsen (billionai)             exit(1);
66593e770bf7SBruno Larsen (billionai)         }
66603e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
66613e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66623e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
66633e770bf7SBruno Larsen (billionai)         exit(1);
66643e770bf7SBruno Larsen (billionai)     }
66653e770bf7SBruno Larsen (billionai)     if (env->msr_mask & (1 << 2)) {
66663e770bf7SBruno Larsen (billionai)         switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
66673e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_PX:
66683e770bf7SBruno Larsen (billionai)         case POWERPC_FLAG_PMM:
66693e770bf7SBruno Larsen (billionai)             break;
66703e770bf7SBruno Larsen (billionai)         default:
66713e770bf7SBruno Larsen (billionai)             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66723e770bf7SBruno Larsen (billionai)                     "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
66733e770bf7SBruno Larsen (billionai)             exit(1);
66743e770bf7SBruno Larsen (billionai)         }
66753e770bf7SBruno Larsen (billionai)     } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
66763e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
66773e770bf7SBruno Larsen (billionai)                 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
66783e770bf7SBruno Larsen (billionai)         exit(1);
66793e770bf7SBruno Larsen (billionai)     }
6680005b69fdSCédric Le Goater     if ((env->flags & POWERPC_FLAG_BUS_CLK) == 0) {
66813e770bf7SBruno Larsen (billionai)         fprintf(stderr, "PowerPC flags inconsistency\n"
66823e770bf7SBruno Larsen (billionai)                 "Should define the time-base and decrementer clock source\n");
66833e770bf7SBruno Larsen (billionai)         exit(1);
66843e770bf7SBruno Larsen (billionai)     }
66853e770bf7SBruno Larsen (billionai)     /* Allocate TLBs buffer when needed */
66863e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
66873e770bf7SBruno Larsen (billionai)     if (env->nb_tlb != 0) {
66883e770bf7SBruno Larsen (billionai)         int nb_tlb = env->nb_tlb;
66893e770bf7SBruno Larsen (billionai)         if (env->id_tlbs != 0) {
66903e770bf7SBruno Larsen (billionai)             nb_tlb *= 2;
66913e770bf7SBruno Larsen (billionai)         }
66923e770bf7SBruno Larsen (billionai)         switch (env->tlb_type) {
66933e770bf7SBruno Larsen (billionai)         case TLB_6XX:
66943e770bf7SBruno Larsen (billionai)             env->tlb.tlb6 = g_new0(ppc6xx_tlb_t, nb_tlb);
66953e770bf7SBruno Larsen (billionai)             break;
66963e770bf7SBruno Larsen (billionai)         case TLB_EMB:
66973e770bf7SBruno Larsen (billionai)             env->tlb.tlbe = g_new0(ppcemb_tlb_t, nb_tlb);
66983e770bf7SBruno Larsen (billionai)             break;
66993e770bf7SBruno Larsen (billionai)         case TLB_MAS:
67003e770bf7SBruno Larsen (billionai)             env->tlb.tlbm = g_new0(ppcmas_tlb_t, nb_tlb);
67013e770bf7SBruno Larsen (billionai)             break;
67023e770bf7SBruno Larsen (billionai)         }
67033e770bf7SBruno Larsen (billionai)         /* Pre-compute some useful values */
67043e770bf7SBruno Larsen (billionai)         env->tlb_per_way = env->nb_tlb / env->nb_ways;
67053e770bf7SBruno Larsen (billionai)     }
67063e770bf7SBruno Larsen (billionai) #endif
67073e770bf7SBruno Larsen (billionai)     if (env->check_pow == NULL) {
67083e770bf7SBruno Larsen (billionai)         warn_report("no power management check handler registered."
67093e770bf7SBruno Larsen (billionai)                     " Attempt QEMU to crash very soon !");
67103e770bf7SBruno Larsen (billionai)     }
67113e770bf7SBruno Larsen (billionai) }
67123e770bf7SBruno Larsen (billionai) 
67133e770bf7SBruno Larsen (billionai) 
67143e770bf7SBruno Larsen (billionai) static void ppc_cpu_realize(DeviceState *dev, Error **errp)
67153e770bf7SBruno Larsen (billionai) {
67163e770bf7SBruno Larsen (billionai)     CPUState *cs = CPU(dev);
67173e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(dev);
67183e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
67193e770bf7SBruno Larsen (billionai)     Error *local_err = NULL;
67203e770bf7SBruno Larsen (billionai) 
67213e770bf7SBruno Larsen (billionai)     cpu_exec_realizefn(cs, &local_err);
67223e770bf7SBruno Larsen (billionai)     if (local_err != NULL) {
67233e770bf7SBruno Larsen (billionai)         error_propagate(errp, local_err);
67243e770bf7SBruno Larsen (billionai)         return;
67253e770bf7SBruno Larsen (billionai)     }
67263e770bf7SBruno Larsen (billionai)     if (cpu->vcpu_id == UNASSIGNED_CPU_INDEX) {
67273e770bf7SBruno Larsen (billionai)         cpu->vcpu_id = cs->cpu_index;
67283e770bf7SBruno Larsen (billionai)     }
67293e770bf7SBruno Larsen (billionai) 
67303e770bf7SBruno Larsen (billionai)     if (tcg_enabled()) {
67313e770bf7SBruno Larsen (billionai)         if (ppc_fixup_cpu(cpu) != 0) {
67323e770bf7SBruno Larsen (billionai)             error_setg(errp, "Unable to emulate selected CPU with TCG");
67333e770bf7SBruno Larsen (billionai)             goto unrealize;
67343e770bf7SBruno Larsen (billionai)         }
67353e770bf7SBruno Larsen (billionai)     }
67363e770bf7SBruno Larsen (billionai) 
67373e770bf7SBruno Larsen (billionai)     create_ppc_opcodes(cpu, &local_err);
67383e770bf7SBruno Larsen (billionai)     if (local_err != NULL) {
67393e770bf7SBruno Larsen (billionai)         error_propagate(errp, local_err);
67403e770bf7SBruno Larsen (billionai)         goto unrealize;
67413e770bf7SBruno Larsen (billionai)     }
67423e770bf7SBruno Larsen (billionai)     init_ppc_proc(cpu);
67433e770bf7SBruno Larsen (billionai) 
67443e770bf7SBruno Larsen (billionai)     ppc_gdb_init(cs, pcc);
67453e770bf7SBruno Larsen (billionai)     qemu_init_vcpu(cs);
67463e770bf7SBruno Larsen (billionai) 
67473e770bf7SBruno Larsen (billionai)     pcc->parent_realize(dev, errp);
67483e770bf7SBruno Larsen (billionai) 
67493e770bf7SBruno Larsen (billionai)     return;
67503e770bf7SBruno Larsen (billionai) 
67513e770bf7SBruno Larsen (billionai) unrealize:
67523e770bf7SBruno Larsen (billionai)     cpu_exec_unrealizefn(cs);
67533e770bf7SBruno Larsen (billionai) }
67543e770bf7SBruno Larsen (billionai) 
67553e770bf7SBruno Larsen (billionai) static void ppc_cpu_unrealize(DeviceState *dev)
67563e770bf7SBruno Larsen (billionai) {
67573e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(dev);
67583e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
67593e770bf7SBruno Larsen (billionai) 
67603e770bf7SBruno Larsen (billionai)     pcc->parent_unrealize(dev);
67613e770bf7SBruno Larsen (billionai) 
67623e770bf7SBruno Larsen (billionai)     cpu_remove_sync(CPU(cpu));
67633e770bf7SBruno Larsen (billionai) 
67643e770bf7SBruno Larsen (billionai)     destroy_ppc_opcodes(cpu);
67653e770bf7SBruno Larsen (billionai) }
67663e770bf7SBruno Larsen (billionai) 
67673e770bf7SBruno Larsen (billionai) static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b)
67683e770bf7SBruno Larsen (billionai) {
67693e770bf7SBruno Larsen (billionai)     ObjectClass *oc = (ObjectClass *)a;
67703e770bf7SBruno Larsen (billionai)     uint32_t pvr = *(uint32_t *)b;
67713e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = (PowerPCCPUClass *)a;
67723e770bf7SBruno Larsen (billionai) 
67733e770bf7SBruno Larsen (billionai)     /* -cpu host does a PVR lookup during construction */
67743e770bf7SBruno Larsen (billionai)     if (unlikely(strcmp(object_class_get_name(oc),
67753e770bf7SBruno Larsen (billionai)                         TYPE_HOST_POWERPC_CPU) == 0)) {
67763e770bf7SBruno Larsen (billionai)         return -1;
67773e770bf7SBruno Larsen (billionai)     }
67783e770bf7SBruno Larsen (billionai) 
67793e770bf7SBruno Larsen (billionai)     return pcc->pvr == pvr ? 0 : -1;
67803e770bf7SBruno Larsen (billionai) }
67813e770bf7SBruno Larsen (billionai) 
67823e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr)
67833e770bf7SBruno Larsen (billionai) {
67843e770bf7SBruno Larsen (billionai)     GSList *list, *item;
67853e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = NULL;
67863e770bf7SBruno Larsen (billionai) 
67873e770bf7SBruno Larsen (billionai)     list = object_class_get_list(TYPE_POWERPC_CPU, false);
67883e770bf7SBruno Larsen (billionai)     item = g_slist_find_custom(list, &pvr, ppc_cpu_compare_class_pvr);
67893e770bf7SBruno Larsen (billionai)     if (item != NULL) {
67903e770bf7SBruno Larsen (billionai)         pcc = POWERPC_CPU_CLASS(item->data);
67913e770bf7SBruno Larsen (billionai)     }
67923e770bf7SBruno Larsen (billionai)     g_slist_free(list);
67933e770bf7SBruno Larsen (billionai) 
67943e770bf7SBruno Larsen (billionai)     return pcc;
67953e770bf7SBruno Larsen (billionai) }
67963e770bf7SBruno Larsen (billionai) 
67973e770bf7SBruno Larsen (billionai) static gint ppc_cpu_compare_class_pvr_mask(gconstpointer a, gconstpointer b)
67983e770bf7SBruno Larsen (billionai) {
67993e770bf7SBruno Larsen (billionai)     ObjectClass *oc = (ObjectClass *)a;
68003e770bf7SBruno Larsen (billionai)     uint32_t pvr = *(uint32_t *)b;
68013e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = (PowerPCCPUClass *)a;
68023e770bf7SBruno Larsen (billionai) 
68033e770bf7SBruno Larsen (billionai)     /* -cpu host does a PVR lookup during construction */
68043e770bf7SBruno Larsen (billionai)     if (unlikely(strcmp(object_class_get_name(oc),
68053e770bf7SBruno Larsen (billionai)                         TYPE_HOST_POWERPC_CPU) == 0)) {
68063e770bf7SBruno Larsen (billionai)         return -1;
68073e770bf7SBruno Larsen (billionai)     }
68083e770bf7SBruno Larsen (billionai) 
680921d3a78eSNicholas Piggin     if (pcc->pvr_match(pcc, pvr, true)) {
68103e770bf7SBruno Larsen (billionai)         return 0;
68113e770bf7SBruno Larsen (billionai)     }
68123e770bf7SBruno Larsen (billionai) 
68133e770bf7SBruno Larsen (billionai)     return -1;
68143e770bf7SBruno Larsen (billionai) }
68153e770bf7SBruno Larsen (billionai) 
68163e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr)
68173e770bf7SBruno Larsen (billionai) {
68183e770bf7SBruno Larsen (billionai)     GSList *list, *item;
68193e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = NULL;
68203e770bf7SBruno Larsen (billionai) 
68213e770bf7SBruno Larsen (billionai)     list = object_class_get_list(TYPE_POWERPC_CPU, true);
68223e770bf7SBruno Larsen (billionai)     item = g_slist_find_custom(list, &pvr, ppc_cpu_compare_class_pvr_mask);
68233e770bf7SBruno Larsen (billionai)     if (item != NULL) {
68243e770bf7SBruno Larsen (billionai)         pcc = POWERPC_CPU_CLASS(item->data);
68253e770bf7SBruno Larsen (billionai)     }
68263e770bf7SBruno Larsen (billionai)     g_slist_free(list);
68273e770bf7SBruno Larsen (billionai) 
68283e770bf7SBruno Larsen (billionai)     return pcc;
68293e770bf7SBruno Larsen (billionai) }
68303e770bf7SBruno Larsen (billionai) 
68313e770bf7SBruno Larsen (billionai) static const char *ppc_cpu_lookup_alias(const char *alias)
68323e770bf7SBruno Larsen (billionai) {
68333e770bf7SBruno Larsen (billionai)     int ai;
68343e770bf7SBruno Larsen (billionai) 
68353e770bf7SBruno Larsen (billionai)     for (ai = 0; ppc_cpu_aliases[ai].alias != NULL; ai++) {
68363e770bf7SBruno Larsen (billionai)         if (strcmp(ppc_cpu_aliases[ai].alias, alias) == 0) {
68373e770bf7SBruno Larsen (billionai)             return ppc_cpu_aliases[ai].model;
68383e770bf7SBruno Larsen (billionai)         }
68393e770bf7SBruno Larsen (billionai)     }
68403e770bf7SBruno Larsen (billionai) 
68413e770bf7SBruno Larsen (billionai)     return NULL;
68423e770bf7SBruno Larsen (billionai) }
68433e770bf7SBruno Larsen (billionai) 
68443e770bf7SBruno Larsen (billionai) static ObjectClass *ppc_cpu_class_by_name(const char *name)
68453e770bf7SBruno Larsen (billionai) {
68463e770bf7SBruno Larsen (billionai)     char *cpu_model, *typename;
68473e770bf7SBruno Larsen (billionai)     ObjectClass *oc;
68483e770bf7SBruno Larsen (billionai)     const char *p;
68493e770bf7SBruno Larsen (billionai)     unsigned long pvr;
68503e770bf7SBruno Larsen (billionai) 
68513e770bf7SBruno Larsen (billionai)     /*
68523e770bf7SBruno Larsen (billionai)      * Lookup by PVR if cpu_model is valid 8 digit hex number (excl:
68533e770bf7SBruno Larsen (billionai)      * 0x prefix if present)
68543e770bf7SBruno Larsen (billionai)      */
68553e770bf7SBruno Larsen (billionai)     if (!qemu_strtoul(name, &p, 16, &pvr)) {
68563e770bf7SBruno Larsen (billionai)         int len = p - name;
68573e770bf7SBruno Larsen (billionai)         len = (len == 10) && (name[1] == 'x') ? len - 2 : len;
68583e770bf7SBruno Larsen (billionai)         if ((len == 8) && (*p == '\0')) {
68593e770bf7SBruno Larsen (billionai)             return OBJECT_CLASS(ppc_cpu_class_by_pvr(pvr));
68603e770bf7SBruno Larsen (billionai)         }
68613e770bf7SBruno Larsen (billionai)     }
68623e770bf7SBruno Larsen (billionai) 
6863c7e89de1SMurilo Opsfelder Araujo     /*
6864c7e89de1SMurilo Opsfelder Araujo      * All ppc CPUs represent hardware that exists in the real world, i.e.: we
6865c7e89de1SMurilo Opsfelder Araujo      * do not have a "max" CPU with all possible emulated features enabled.
6866c7e89de1SMurilo Opsfelder Araujo      * Return the default CPU type for the machine because that has greater
6867c7e89de1SMurilo Opsfelder Araujo      * chance of being useful as the "max" CPU.
6868c7e89de1SMurilo Opsfelder Araujo      */
6869c7e89de1SMurilo Opsfelder Araujo #if !defined(CONFIG_USER_ONLY)
6870c7e89de1SMurilo Opsfelder Araujo     if (strcmp(name, "max") == 0) {
6871c7e89de1SMurilo Opsfelder Araujo         MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
6872c7e89de1SMurilo Opsfelder Araujo         if (mc) {
6873c7e89de1SMurilo Opsfelder Araujo             return object_class_by_name(mc->default_cpu_type);
6874c7e89de1SMurilo Opsfelder Araujo         }
6875c7e89de1SMurilo Opsfelder Araujo     }
6876c7e89de1SMurilo Opsfelder Araujo #endif
6877c7e89de1SMurilo Opsfelder Araujo 
68783e770bf7SBruno Larsen (billionai)     cpu_model = g_ascii_strdown(name, -1);
68793e770bf7SBruno Larsen (billionai)     p = ppc_cpu_lookup_alias(cpu_model);
68803e770bf7SBruno Larsen (billionai)     if (p) {
68813e770bf7SBruno Larsen (billionai)         g_free(cpu_model);
68823e770bf7SBruno Larsen (billionai)         cpu_model = g_strdup(p);
68833e770bf7SBruno Larsen (billionai)     }
68843e770bf7SBruno Larsen (billionai) 
68853e770bf7SBruno Larsen (billionai)     typename = g_strdup_printf("%s" POWERPC_CPU_TYPE_SUFFIX, cpu_model);
68863e770bf7SBruno Larsen (billionai)     oc = object_class_by_name(typename);
68873e770bf7SBruno Larsen (billionai)     g_free(typename);
68883e770bf7SBruno Larsen (billionai)     g_free(cpu_model);
68893e770bf7SBruno Larsen (billionai) 
68903e770bf7SBruno Larsen (billionai)     return oc;
68913e770bf7SBruno Larsen (billionai) }
68923e770bf7SBruno Larsen (billionai) 
68933e770bf7SBruno Larsen (billionai) PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
68943e770bf7SBruno Larsen (billionai) {
68953e770bf7SBruno Larsen (billionai)     ObjectClass *oc = OBJECT_CLASS(pcc);
68963e770bf7SBruno Larsen (billionai) 
68973e770bf7SBruno Larsen (billionai)     while (oc && !object_class_is_abstract(oc)) {
68983e770bf7SBruno Larsen (billionai)         oc = object_class_get_parent(oc);
68993e770bf7SBruno Larsen (billionai)     }
69003e770bf7SBruno Larsen (billionai)     assert(oc);
69013e770bf7SBruno Larsen (billionai) 
69023e770bf7SBruno Larsen (billionai)     return POWERPC_CPU_CLASS(oc);
69033e770bf7SBruno Larsen (billionai) }
69043e770bf7SBruno Larsen (billionai) 
69053e770bf7SBruno Larsen (billionai) /* Sort by PVR, ordering special case "host" last. */
69063e770bf7SBruno Larsen (billionai) static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b)
69073e770bf7SBruno Larsen (billionai) {
69083e770bf7SBruno Larsen (billionai)     ObjectClass *oc_a = (ObjectClass *)a;
69093e770bf7SBruno Larsen (billionai)     ObjectClass *oc_b = (ObjectClass *)b;
69103e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc_a = POWERPC_CPU_CLASS(oc_a);
69113e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc_b = POWERPC_CPU_CLASS(oc_b);
69123e770bf7SBruno Larsen (billionai)     const char *name_a = object_class_get_name(oc_a);
69133e770bf7SBruno Larsen (billionai)     const char *name_b = object_class_get_name(oc_b);
69143e770bf7SBruno Larsen (billionai) 
69153e770bf7SBruno Larsen (billionai)     if (strcmp(name_a, TYPE_HOST_POWERPC_CPU) == 0) {
69163e770bf7SBruno Larsen (billionai)         return 1;
69173e770bf7SBruno Larsen (billionai)     } else if (strcmp(name_b, TYPE_HOST_POWERPC_CPU) == 0) {
69183e770bf7SBruno Larsen (billionai)         return -1;
69193e770bf7SBruno Larsen (billionai)     } else {
69203e770bf7SBruno Larsen (billionai)         /* Avoid an integer overflow during subtraction */
69213e770bf7SBruno Larsen (billionai)         if (pcc_a->pvr < pcc_b->pvr) {
69223e770bf7SBruno Larsen (billionai)             return -1;
69233e770bf7SBruno Larsen (billionai)         } else if (pcc_a->pvr > pcc_b->pvr) {
69243e770bf7SBruno Larsen (billionai)             return 1;
69253e770bf7SBruno Larsen (billionai)         } else {
69263e770bf7SBruno Larsen (billionai)             return 0;
69273e770bf7SBruno Larsen (billionai)         }
69283e770bf7SBruno Larsen (billionai)     }
69293e770bf7SBruno Larsen (billionai) }
69303e770bf7SBruno Larsen (billionai) 
69313e770bf7SBruno Larsen (billionai) static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
69323e770bf7SBruno Larsen (billionai) {
69333e770bf7SBruno Larsen (billionai)     ObjectClass *oc = data;
69343e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
69353e770bf7SBruno Larsen (billionai)     DeviceClass *family = DEVICE_CLASS(ppc_cpu_get_family_class(pcc));
69363e770bf7SBruno Larsen (billionai)     const char *typename = object_class_get_name(oc);
69373e770bf7SBruno Larsen (billionai)     char *name;
69383e770bf7SBruno Larsen (billionai)     int i;
69393e770bf7SBruno Larsen (billionai) 
69403e770bf7SBruno Larsen (billionai)     if (unlikely(strcmp(typename, TYPE_HOST_POWERPC_CPU) == 0)) {
69413e770bf7SBruno Larsen (billionai)         return;
69423e770bf7SBruno Larsen (billionai)     }
69433e770bf7SBruno Larsen (billionai) 
69443e770bf7SBruno Larsen (billionai)     name = g_strndup(typename,
69453e770bf7SBruno Larsen (billionai)                      strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
69463e770bf7SBruno Larsen (billionai)     qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr);
69473e770bf7SBruno Larsen (billionai)     for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
69483e770bf7SBruno Larsen (billionai)         PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
69493e770bf7SBruno Larsen (billionai)         ObjectClass *alias_oc = ppc_cpu_class_by_name(alias->model);
69503e770bf7SBruno Larsen (billionai) 
69513e770bf7SBruno Larsen (billionai)         if (alias_oc != oc) {
69523e770bf7SBruno Larsen (billionai)             continue;
69533e770bf7SBruno Larsen (billionai)         }
69543e770bf7SBruno Larsen (billionai)         /*
69553e770bf7SBruno Larsen (billionai)          * If running with KVM, we might update the family alias later, so
69563e770bf7SBruno Larsen (billionai)          * avoid printing the wrong alias here and use "preferred" instead
69573e770bf7SBruno Larsen (billionai)          */
69583e770bf7SBruno Larsen (billionai)         if (strcmp(alias->alias, family->desc) == 0) {
69593e770bf7SBruno Larsen (billionai)             qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n",
69603e770bf7SBruno Larsen (billionai)                         alias->alias, family->desc);
69613e770bf7SBruno Larsen (billionai)         } else {
69623e770bf7SBruno Larsen (billionai)             qemu_printf("PowerPC %-16s (alias for %s)\n",
69633e770bf7SBruno Larsen (billionai)                         alias->alias, name);
69643e770bf7SBruno Larsen (billionai)         }
69653e770bf7SBruno Larsen (billionai)     }
69663e770bf7SBruno Larsen (billionai)     g_free(name);
69673e770bf7SBruno Larsen (billionai) }
69683e770bf7SBruno Larsen (billionai) 
69693e770bf7SBruno Larsen (billionai) void ppc_cpu_list(void)
69703e770bf7SBruno Larsen (billionai) {
69713e770bf7SBruno Larsen (billionai)     GSList *list;
69723e770bf7SBruno Larsen (billionai) 
69733e770bf7SBruno Larsen (billionai)     list = object_class_get_list(TYPE_POWERPC_CPU, false);
69743e770bf7SBruno Larsen (billionai)     list = g_slist_sort(list, ppc_cpu_list_compare);
69753e770bf7SBruno Larsen (billionai)     g_slist_foreach(list, ppc_cpu_list_entry, NULL);
69763e770bf7SBruno Larsen (billionai)     g_slist_free(list);
69773e770bf7SBruno Larsen (billionai) 
69783e770bf7SBruno Larsen (billionai) #ifdef CONFIG_KVM
69793e770bf7SBruno Larsen (billionai)     qemu_printf("\n");
698061848717SMarkus Armbruster     qemu_printf("PowerPC %s\n", "host");
69813e770bf7SBruno Larsen (billionai) #endif
69823e770bf7SBruno Larsen (billionai) }
69833e770bf7SBruno Larsen (billionai) 
69843e770bf7SBruno Larsen (billionai) static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
69853e770bf7SBruno Larsen (billionai) {
69863e770bf7SBruno Larsen (billionai)     ObjectClass *oc = data;
69873e770bf7SBruno Larsen (billionai)     CpuDefinitionInfoList **first = user_data;
69883e770bf7SBruno Larsen (billionai)     const char *typename;
69893e770bf7SBruno Larsen (billionai)     CpuDefinitionInfo *info;
69903e770bf7SBruno Larsen (billionai) 
69913e770bf7SBruno Larsen (billionai)     typename = object_class_get_name(oc);
69923e770bf7SBruno Larsen (billionai)     info = g_malloc0(sizeof(*info));
69933e770bf7SBruno Larsen (billionai)     info->name = g_strndup(typename,
69943e770bf7SBruno Larsen (billionai)                            strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
69953e770bf7SBruno Larsen (billionai) 
69963e770bf7SBruno Larsen (billionai)     QAPI_LIST_PREPEND(*first, info);
69973e770bf7SBruno Larsen (billionai) }
69983e770bf7SBruno Larsen (billionai) 
69993e770bf7SBruno Larsen (billionai) CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
70003e770bf7SBruno Larsen (billionai) {
70013e770bf7SBruno Larsen (billionai)     CpuDefinitionInfoList *cpu_list = NULL;
70023e770bf7SBruno Larsen (billionai)     GSList *list;
70033e770bf7SBruno Larsen (billionai)     int i;
70043e770bf7SBruno Larsen (billionai) 
70053e770bf7SBruno Larsen (billionai)     list = object_class_get_list(TYPE_POWERPC_CPU, false);
70063e770bf7SBruno Larsen (billionai)     g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
70073e770bf7SBruno Larsen (billionai)     g_slist_free(list);
70083e770bf7SBruno Larsen (billionai) 
70093e770bf7SBruno Larsen (billionai)     for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
70103e770bf7SBruno Larsen (billionai)         PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
70113e770bf7SBruno Larsen (billionai)         ObjectClass *oc;
70123e770bf7SBruno Larsen (billionai)         CpuDefinitionInfo *info;
70133e770bf7SBruno Larsen (billionai) 
70143e770bf7SBruno Larsen (billionai)         oc = ppc_cpu_class_by_name(alias->model);
70153e770bf7SBruno Larsen (billionai)         if (oc == NULL) {
70163e770bf7SBruno Larsen (billionai)             continue;
70173e770bf7SBruno Larsen (billionai)         }
70183e770bf7SBruno Larsen (billionai) 
70193e770bf7SBruno Larsen (billionai)         info = g_malloc0(sizeof(*info));
70203e770bf7SBruno Larsen (billionai)         info->name = g_strdup(alias->alias);
70213e770bf7SBruno Larsen (billionai)         info->q_typename = g_strdup(object_class_get_name(oc));
70223e770bf7SBruno Larsen (billionai) 
70233e770bf7SBruno Larsen (billionai)         QAPI_LIST_PREPEND(cpu_list, info);
70243e770bf7SBruno Larsen (billionai)     }
70253e770bf7SBruno Larsen (billionai) 
70263e770bf7SBruno Larsen (billionai)     return cpu_list;
70273e770bf7SBruno Larsen (billionai) }
70283e770bf7SBruno Larsen (billionai) 
70293e770bf7SBruno Larsen (billionai) static void ppc_cpu_set_pc(CPUState *cs, vaddr value)
70303e770bf7SBruno Larsen (billionai) {
70313e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
70323e770bf7SBruno Larsen (billionai) 
70333e770bf7SBruno Larsen (billionai)     cpu->env.nip = value;
70343e770bf7SBruno Larsen (billionai) }
70353e770bf7SBruno Larsen (billionai) 
7036e4fdf9dfSRichard Henderson static vaddr ppc_cpu_get_pc(CPUState *cs)
7037e4fdf9dfSRichard Henderson {
7038e4fdf9dfSRichard Henderson     PowerPCCPU *cpu = POWERPC_CPU(cs);
7039e4fdf9dfSRichard Henderson 
7040e4fdf9dfSRichard Henderson     return cpu->env.nip;
7041e4fdf9dfSRichard Henderson }
7042e4fdf9dfSRichard Henderson 
7043049b4ad6SVaibhav Jain #ifdef CONFIG_TCG
704461bd1d29SRichard Henderson static void ppc_restore_state_to_opc(CPUState *cs,
704561bd1d29SRichard Henderson                                      const TranslationBlock *tb,
704661bd1d29SRichard Henderson                                      const uint64_t *data)
704761bd1d29SRichard Henderson {
704861bd1d29SRichard Henderson     PowerPCCPU *cpu = POWERPC_CPU(cs);
704961bd1d29SRichard Henderson 
705061bd1d29SRichard Henderson     cpu->env.nip = data[0];
705161bd1d29SRichard Henderson }
7052049b4ad6SVaibhav Jain #endif /* CONFIG_TCG */
705361bd1d29SRichard Henderson 
70543e770bf7SBruno Larsen (billionai) static bool ppc_cpu_has_work(CPUState *cs)
70553e770bf7SBruno Larsen (billionai) {
7056ab9cfa04SMatheus Ferst     return cs->interrupt_request & CPU_INTERRUPT_HARD;
70573e770bf7SBruno Larsen (billionai) }
70583e770bf7SBruno Larsen (billionai) 
7059a1c5d644SPeter Maydell static void ppc_cpu_reset_hold(Object *obj)
70603e770bf7SBruno Larsen (billionai) {
7061a1c5d644SPeter Maydell     CPUState *s = CPU(obj);
70623e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(s);
70633e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
70643e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
70653e770bf7SBruno Larsen (billionai)     target_ulong msr;
70663e770bf7SBruno Larsen (billionai)     int i;
70673e770bf7SBruno Larsen (billionai) 
7068a1c5d644SPeter Maydell     if (pcc->parent_phases.hold) {
7069a1c5d644SPeter Maydell         pcc->parent_phases.hold(obj);
7070a1c5d644SPeter Maydell     }
70713e770bf7SBruno Larsen (billionai) 
70723e770bf7SBruno Larsen (billionai)     msr = (target_ulong)0;
70733e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)MSR_HVB;
70743e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_EP;
70753e770bf7SBruno Larsen (billionai) #if defined(DO_SINGLE_STEP) && 0
70763e770bf7SBruno Larsen (billionai)     /* Single step trace mode */
70773e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_SE;
70783e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_BE;
70793e770bf7SBruno Larsen (billionai) #endif
70803e770bf7SBruno Larsen (billionai) #if defined(CONFIG_USER_ONLY)
70813e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_FP; /* Allow floating point usage */
70823e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_FE0; /* Allow floating point exceptions */
70833e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_FE1;
70843e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_VR; /* Allow altivec usage */
70853e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_VSX; /* Allow VSX usage */
70863e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_SPE; /* Allow SPE usage */
70873e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_PR;
70883e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
70893e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_TM; /* Transactional memory */
70903e770bf7SBruno Larsen (billionai) #endif
7091ee3eb3a7SMarc-André Lureau #if !TARGET_BIG_ENDIAN
70923e770bf7SBruno Larsen (billionai)     msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */
70933e770bf7SBruno Larsen (billionai)     if (!((env->msr_mask >> MSR_LE) & 1)) {
70943e770bf7SBruno Larsen (billionai)         fprintf(stderr, "Selected CPU does not support little-endian.\n");
70953e770bf7SBruno Larsen (billionai)         exit(1);
70963e770bf7SBruno Larsen (billionai)     }
70973e770bf7SBruno Larsen (billionai) #endif
70983e770bf7SBruno Larsen (billionai) #endif
70993e770bf7SBruno Larsen (billionai) 
71003e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
71013e770bf7SBruno Larsen (billionai)     if (mmu_is_64bit(env->mmu_model)) {
71023e770bf7SBruno Larsen (billionai)         msr |= (1ULL << MSR_SF);
71033e770bf7SBruno Larsen (billionai)     }
71043e770bf7SBruno Larsen (billionai) #endif
71053e770bf7SBruno Larsen (billionai) 
71063e770bf7SBruno Larsen (billionai)     hreg_store_msr(env, msr, 1);
71073e770bf7SBruno Larsen (billionai) 
71083e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
71093e770bf7SBruno Larsen (billionai)     env->nip = env->hreset_vector | env->excp_prefix;
711033edcde7SDaniel Henrique Barboza 
711133edcde7SDaniel Henrique Barboza     if (tcg_enabled()) {
71123e770bf7SBruno Larsen (billionai)         if (env->mmu_model != POWERPC_MMU_REAL) {
71133e770bf7SBruno Larsen (billionai)             ppc_tlb_invalidate_all(env);
71143e770bf7SBruno Larsen (billionai)         }
71156e8b9903SRichard Henderson         pmu_update_summaries(env);
711633edcde7SDaniel Henrique Barboza     }
7117609b1c86SFrederic Barrat 
7118609b1c86SFrederic Barrat     /* clean any pending stop state */
7119609b1c86SFrederic Barrat     env->resume_as_sreset = 0;
712033edcde7SDaniel Henrique Barboza #endif
71213e770bf7SBruno Larsen (billionai)     hreg_compute_hflags(env);
71223e770bf7SBruno Larsen (billionai)     env->reserve_addr = (target_ulong)-1ULL;
71233e770bf7SBruno Larsen (billionai)     /* Be sure no exception or interrupt is pending */
71243e770bf7SBruno Larsen (billionai)     env->pending_interrupts = 0;
71253e770bf7SBruno Larsen (billionai)     s->exception_index = POWERPC_EXCP_NONE;
71263e770bf7SBruno Larsen (billionai)     env->error_code = 0;
71273e770bf7SBruno Larsen (billionai)     ppc_irq_reset(cpu);
71283e770bf7SBruno Larsen (billionai) 
71293e770bf7SBruno Larsen (billionai)     /* tininess for underflow is detected before rounding */
71303e770bf7SBruno Larsen (billionai)     set_float_detect_tininess(float_tininess_before_rounding,
71313e770bf7SBruno Larsen (billionai)                               &env->fp_status);
71323e770bf7SBruno Larsen (billionai) 
71333e770bf7SBruno Larsen (billionai)     for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
71343e770bf7SBruno Larsen (billionai)         ppc_spr_t *spr = &env->spr_cb[i];
71353e770bf7SBruno Larsen (billionai) 
71363e770bf7SBruno Larsen (billionai)         if (!spr->name) {
71373e770bf7SBruno Larsen (billionai)             continue;
71383e770bf7SBruno Larsen (billionai)         }
71393e770bf7SBruno Larsen (billionai)         env->spr[i] = spr->default_value;
71403e770bf7SBruno Larsen (billionai)     }
71413e770bf7SBruno Larsen (billionai) }
71423e770bf7SBruno Larsen (billionai) 
71433e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
71443e770bf7SBruno Larsen (billionai) 
71453e770bf7SBruno Larsen (billionai) static bool ppc_cpu_is_big_endian(CPUState *cs)
71463e770bf7SBruno Larsen (billionai) {
71473e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
71483e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
71493e770bf7SBruno Larsen (billionai) 
71503e770bf7SBruno Larsen (billionai)     cpu_synchronize_state(cs);
71513e770bf7SBruno Larsen (billionai) 
71521922322cSVíctor Colombo     return !FIELD_EX64(env->msr, MSR, LE);
71533e770bf7SBruno Larsen (billionai) }
71543e770bf7SBruno Larsen (billionai) 
71553e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG
71563e770bf7SBruno Larsen (billionai) static void ppc_cpu_exec_enter(CPUState *cs)
71573e770bf7SBruno Larsen (billionai) {
71583e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
71593e770bf7SBruno Larsen (billionai) 
71603e770bf7SBruno Larsen (billionai)     if (cpu->vhyp) {
71613e770bf7SBruno Larsen (billionai)         PPCVirtualHypervisorClass *vhc =
71623e770bf7SBruno Larsen (billionai)             PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp);
71633e770bf7SBruno Larsen (billionai)         vhc->cpu_exec_enter(cpu->vhyp, cpu);
71643e770bf7SBruno Larsen (billionai)     }
71653e770bf7SBruno Larsen (billionai) }
71663e770bf7SBruno Larsen (billionai) 
71673e770bf7SBruno Larsen (billionai) static void ppc_cpu_exec_exit(CPUState *cs)
71683e770bf7SBruno Larsen (billionai) {
71693e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
71703e770bf7SBruno Larsen (billionai) 
71713e770bf7SBruno Larsen (billionai)     if (cpu->vhyp) {
71723e770bf7SBruno Larsen (billionai)         PPCVirtualHypervisorClass *vhc =
71733e770bf7SBruno Larsen (billionai)             PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp);
71743e770bf7SBruno Larsen (billionai)         vhc->cpu_exec_exit(cpu->vhyp, cpu);
71753e770bf7SBruno Larsen (billionai)     }
71763e770bf7SBruno Larsen (billionai) }
71773e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */
71783e770bf7SBruno Larsen (billionai) 
71793e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
71803e770bf7SBruno Larsen (billionai) 
71813e770bf7SBruno Larsen (billionai) static void ppc_cpu_instance_init(Object *obj)
71823e770bf7SBruno Larsen (billionai) {
71833e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(obj);
71843e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
71853e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
71863e770bf7SBruno Larsen (billionai) 
71873e770bf7SBruno Larsen (billionai)     cpu_set_cpustate_pointers(cpu);
71883e770bf7SBruno Larsen (billionai)     cpu->vcpu_id = UNASSIGNED_CPU_INDEX;
71893e770bf7SBruno Larsen (billionai) 
71903e770bf7SBruno Larsen (billionai)     env->msr_mask = pcc->msr_mask;
71913e770bf7SBruno Larsen (billionai)     env->mmu_model = pcc->mmu_model;
71923e770bf7SBruno Larsen (billionai)     env->excp_model = pcc->excp_model;
71933e770bf7SBruno Larsen (billionai)     env->bus_model = pcc->bus_model;
71943e770bf7SBruno Larsen (billionai)     env->insns_flags = pcc->insns_flags;
71953e770bf7SBruno Larsen (billionai)     env->insns_flags2 = pcc->insns_flags2;
71963e770bf7SBruno Larsen (billionai)     env->flags = pcc->flags;
71973e770bf7SBruno Larsen (billionai)     env->bfd_mach = pcc->bfd_mach;
71983e770bf7SBruno Larsen (billionai)     env->check_pow = pcc->check_pow;
71993e770bf7SBruno Larsen (billionai) 
72003e770bf7SBruno Larsen (billionai)     /*
72013e770bf7SBruno Larsen (billionai)      * Mark HV mode as supported if the CPU has an MSR_HV bit in the
72023e770bf7SBruno Larsen (billionai)      * msr_mask. The mask can later be cleared by PAPR mode but the hv
72033e770bf7SBruno Larsen (billionai)      * mode support will remain, thus enforcing that we cannot use
72043e770bf7SBruno Larsen (billionai)      * priv. instructions in guest in PAPR mode. For 970 we currently
72053e770bf7SBruno Larsen (billionai)      * simply don't set HV in msr_mask thus simulating an "Apple mode"
72063e770bf7SBruno Larsen (billionai)      * 970. If we ever want to support 970 HV mode, we'll have to add
72073e770bf7SBruno Larsen (billionai)      * a processor attribute of some sort.
72083e770bf7SBruno Larsen (billionai)      */
72093e770bf7SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
72103e770bf7SBruno Larsen (billionai)     env->has_hv_mode = !!(env->msr_mask & MSR_HVB);
72113e770bf7SBruno Larsen (billionai) #endif
72123e770bf7SBruno Larsen (billionai) 
72133e770bf7SBruno Larsen (billionai)     ppc_hash64_init(cpu);
72143e770bf7SBruno Larsen (billionai) }
72153e770bf7SBruno Larsen (billionai) 
72163e770bf7SBruno Larsen (billionai) static void ppc_cpu_instance_finalize(Object *obj)
72173e770bf7SBruno Larsen (billionai) {
72183e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(obj);
72193e770bf7SBruno Larsen (billionai) 
72203e770bf7SBruno Larsen (billionai)     ppc_hash64_finalize(cpu);
72213e770bf7SBruno Larsen (billionai) }
72223e770bf7SBruno Larsen (billionai) 
722321d3a78eSNicholas Piggin static bool ppc_pvr_match_default(PowerPCCPUClass *pcc, uint32_t pvr, bool best)
72243e770bf7SBruno Larsen (billionai) {
72253e770bf7SBruno Larsen (billionai)     return pcc->pvr == pvr;
72263e770bf7SBruno Larsen (billionai) }
72273e770bf7SBruno Larsen (billionai) 
72283e770bf7SBruno Larsen (billionai) static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)
72293e770bf7SBruno Larsen (billionai) {
72303e770bf7SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
72313e770bf7SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
72323e770bf7SBruno Larsen (billionai) 
72333e770bf7SBruno Larsen (billionai)     if ((env->hflags >> MSR_LE) & 1) {
72343e770bf7SBruno Larsen (billionai)         info->endian = BFD_ENDIAN_LITTLE;
72353e770bf7SBruno Larsen (billionai)     }
72363e770bf7SBruno Larsen (billionai)     info->mach = env->bfd_mach;
72373e770bf7SBruno Larsen (billionai)     if (!env->bfd_mach) {
72383e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64
72393e770bf7SBruno Larsen (billionai)         info->mach = bfd_mach_ppc64;
72403e770bf7SBruno Larsen (billionai) #else
72413e770bf7SBruno Larsen (billionai)         info->mach = bfd_mach_ppc;
72423e770bf7SBruno Larsen (billionai) #endif
72433e770bf7SBruno Larsen (billionai)     }
72443e770bf7SBruno Larsen (billionai) 
72453e770bf7SBruno Larsen (billionai)     info->cap_arch = CS_ARCH_PPC;
72463e770bf7SBruno Larsen (billionai) #ifdef TARGET_PPC64
72473e770bf7SBruno Larsen (billionai)     info->cap_mode = CS_MODE_64;
72483e770bf7SBruno Larsen (billionai) #endif
72493e770bf7SBruno Larsen (billionai) }
72503e770bf7SBruno Larsen (billionai) 
72513e770bf7SBruno Larsen (billionai) static Property ppc_cpu_properties[] = {
72523e770bf7SBruno Larsen (billionai)     DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU, pre_2_8_migration, false),
72533e770bf7SBruno Larsen (billionai)     DEFINE_PROP_BOOL("pre-2.10-migration", PowerPCCPU, pre_2_10_migration,
72543e770bf7SBruno Larsen (billionai)                      false),
72553e770bf7SBruno Larsen (billionai)     DEFINE_PROP_BOOL("pre-3.0-migration", PowerPCCPU, pre_3_0_migration,
72563e770bf7SBruno Larsen (billionai)                      false),
72573e770bf7SBruno Larsen (billionai)     DEFINE_PROP_END_OF_LIST(),
72583e770bf7SBruno Larsen (billionai) };
72593e770bf7SBruno Larsen (billionai) 
72608b80bd28SPhilippe Mathieu-Daudé #ifndef CONFIG_USER_ONLY
72618b80bd28SPhilippe Mathieu-Daudé #include "hw/core/sysemu-cpu-ops.h"
72628b80bd28SPhilippe Mathieu-Daudé 
72638b80bd28SPhilippe Mathieu-Daudé static const struct SysemuCPUOps ppc_sysemu_ops = {
726408928c6dSPhilippe Mathieu-Daudé     .get_phys_page_debug = ppc_cpu_get_phys_page_debug,
7265715e3c1aSPhilippe Mathieu-Daudé     .write_elf32_note = ppc32_cpu_write_elf32_note,
7266715e3c1aSPhilippe Mathieu-Daudé     .write_elf64_note = ppc64_cpu_write_elf64_note,
7267da383e02SPhilippe Mathieu-Daudé     .virtio_is_big_endian = ppc_cpu_is_big_endian,
7268feece4d0SPhilippe Mathieu-Daudé     .legacy_vmsd = &vmstate_ppc_cpu,
72698b80bd28SPhilippe Mathieu-Daudé };
72708b80bd28SPhilippe Mathieu-Daudé #endif
72718b80bd28SPhilippe Mathieu-Daudé 
72723e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG
72733e770bf7SBruno Larsen (billionai) #include "hw/core/tcg-cpu-ops.h"
72743e770bf7SBruno Larsen (billionai) 
727511906557SRichard Henderson static const struct TCGCPUOps ppc_tcg_ops = {
72763e770bf7SBruno Larsen (billionai)   .initialize = ppc_translate_init,
727761bd1d29SRichard Henderson   .restore_state_to_opc = ppc_restore_state_to_opc,
72783e770bf7SBruno Larsen (billionai) 
72791db8af5cSRichard Henderson #ifdef CONFIG_USER_ONLY
72801db8af5cSRichard Henderson   .record_sigsegv = ppc_cpu_record_sigsegv,
72811db8af5cSRichard Henderson #else
72821db8af5cSRichard Henderson   .tlb_fill = ppc_cpu_tlb_fill,
7283f725245cSPhilippe Mathieu-Daudé   .cpu_exec_interrupt = ppc_cpu_exec_interrupt,
72843e770bf7SBruno Larsen (billionai)   .do_interrupt = ppc_cpu_do_interrupt,
72853e770bf7SBruno Larsen (billionai)   .cpu_exec_enter = ppc_cpu_exec_enter,
72863e770bf7SBruno Larsen (billionai)   .cpu_exec_exit = ppc_cpu_exec_exit,
72873e770bf7SBruno Larsen (billionai)   .do_unaligned_access = ppc_cpu_do_unaligned_access,
72883e770bf7SBruno Larsen (billionai) #endif /* !CONFIG_USER_ONLY */
72893e770bf7SBruno Larsen (billionai) };
72903e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */
72913e770bf7SBruno Larsen (billionai) 
72923e770bf7SBruno Larsen (billionai) static void ppc_cpu_class_init(ObjectClass *oc, void *data)
72933e770bf7SBruno Larsen (billionai) {
72943e770bf7SBruno Larsen (billionai)     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
72953e770bf7SBruno Larsen (billionai)     CPUClass *cc = CPU_CLASS(oc);
72963e770bf7SBruno Larsen (billionai)     DeviceClass *dc = DEVICE_CLASS(oc);
7297a1c5d644SPeter Maydell     ResettableClass *rc = RESETTABLE_CLASS(oc);
72983e770bf7SBruno Larsen (billionai) 
72993e770bf7SBruno Larsen (billionai)     device_class_set_parent_realize(dc, ppc_cpu_realize,
73003e770bf7SBruno Larsen (billionai)                                     &pcc->parent_realize);
73013e770bf7SBruno Larsen (billionai)     device_class_set_parent_unrealize(dc, ppc_cpu_unrealize,
73023e770bf7SBruno Larsen (billionai)                                       &pcc->parent_unrealize);
73033e770bf7SBruno Larsen (billionai)     pcc->pvr_match = ppc_pvr_match_default;
73043e770bf7SBruno Larsen (billionai)     device_class_set_props(dc, ppc_cpu_properties);
73053e770bf7SBruno Larsen (billionai) 
7306a1c5d644SPeter Maydell     resettable_class_set_parent_phases(rc, NULL, ppc_cpu_reset_hold, NULL,
7307a1c5d644SPeter Maydell                                        &pcc->parent_phases);
73083e770bf7SBruno Larsen (billionai) 
73093e770bf7SBruno Larsen (billionai)     cc->class_by_name = ppc_cpu_class_by_name;
73103e770bf7SBruno Larsen (billionai)     cc->has_work = ppc_cpu_has_work;
73113e770bf7SBruno Larsen (billionai)     cc->dump_state = ppc_cpu_dump_state;
73123e770bf7SBruno Larsen (billionai)     cc->set_pc = ppc_cpu_set_pc;
7313e4fdf9dfSRichard Henderson     cc->get_pc = ppc_cpu_get_pc;
73143e770bf7SBruno Larsen (billionai)     cc->gdb_read_register = ppc_cpu_gdb_read_register;
73153e770bf7SBruno Larsen (billionai)     cc->gdb_write_register = ppc_cpu_gdb_write_register;
73163e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
73178b80bd28SPhilippe Mathieu-Daudé     cc->sysemu_ops = &ppc_sysemu_ops;
73183e770bf7SBruno Larsen (billionai) #endif
73193e770bf7SBruno Larsen (billionai) 
73203e770bf7SBruno Larsen (billionai)     cc->gdb_num_core_regs = 71;
73213e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
73223e770bf7SBruno Larsen (billionai)     cc->gdb_get_dynamic_xml = ppc_gdb_get_dynamic_xml;
73233e770bf7SBruno Larsen (billionai) #endif
73243e770bf7SBruno Larsen (billionai) #ifdef USE_APPLE_GDB
73253e770bf7SBruno Larsen (billionai)     cc->gdb_read_register = ppc_cpu_gdb_read_register_apple;
73263e770bf7SBruno Larsen (billionai)     cc->gdb_write_register = ppc_cpu_gdb_write_register_apple;
73273e770bf7SBruno Larsen (billionai)     cc->gdb_num_core_regs = 71 + 32;
73283e770bf7SBruno Larsen (billionai) #endif
73293e770bf7SBruno Larsen (billionai) 
73303e770bf7SBruno Larsen (billionai)     cc->gdb_arch_name = ppc_gdb_arch_name;
73313e770bf7SBruno Larsen (billionai) #if defined(TARGET_PPC64)
73323e770bf7SBruno Larsen (billionai)     cc->gdb_core_xml_file = "power64-core.xml";
73333e770bf7SBruno Larsen (billionai) #else
73343e770bf7SBruno Larsen (billionai)     cc->gdb_core_xml_file = "power-core.xml";
73353e770bf7SBruno Larsen (billionai) #endif
73363e770bf7SBruno Larsen (billionai)     cc->disas_set_info = ppc_disas_set_info;
73373e770bf7SBruno Larsen (billionai) 
73383e770bf7SBruno Larsen (billionai)     dc->fw_name = "PowerPC,UNKNOWN";
73393e770bf7SBruno Larsen (billionai) 
73403e770bf7SBruno Larsen (billionai) #ifdef CONFIG_TCG
73413e770bf7SBruno Larsen (billionai)     cc->tcg_ops = &ppc_tcg_ops;
73423e770bf7SBruno Larsen (billionai) #endif /* CONFIG_TCG */
73433e770bf7SBruno Larsen (billionai) }
73443e770bf7SBruno Larsen (billionai) 
73453e770bf7SBruno Larsen (billionai) static const TypeInfo ppc_cpu_type_info = {
73463e770bf7SBruno Larsen (billionai)     .name = TYPE_POWERPC_CPU,
73473e770bf7SBruno Larsen (billionai)     .parent = TYPE_CPU,
73483e770bf7SBruno Larsen (billionai)     .instance_size = sizeof(PowerPCCPU),
73493e770bf7SBruno Larsen (billionai)     .instance_align = __alignof__(PowerPCCPU),
73503e770bf7SBruno Larsen (billionai)     .instance_init = ppc_cpu_instance_init,
73513e770bf7SBruno Larsen (billionai)     .instance_finalize = ppc_cpu_instance_finalize,
73523e770bf7SBruno Larsen (billionai)     .abstract = true,
73533e770bf7SBruno Larsen (billionai)     .class_size = sizeof(PowerPCCPUClass),
73543e770bf7SBruno Larsen (billionai)     .class_init = ppc_cpu_class_init,
73553e770bf7SBruno Larsen (billionai) };
73563e770bf7SBruno Larsen (billionai) 
73573e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
73583e770bf7SBruno Larsen (billionai) static const TypeInfo ppc_vhyp_type_info = {
73593e770bf7SBruno Larsen (billionai)     .name = TYPE_PPC_VIRTUAL_HYPERVISOR,
73603e770bf7SBruno Larsen (billionai)     .parent = TYPE_INTERFACE,
73613e770bf7SBruno Larsen (billionai)     .class_size = sizeof(PPCVirtualHypervisorClass),
73623e770bf7SBruno Larsen (billionai) };
73633e770bf7SBruno Larsen (billionai) #endif
73643e770bf7SBruno Larsen (billionai) 
73653e770bf7SBruno Larsen (billionai) static void ppc_cpu_register_types(void)
73663e770bf7SBruno Larsen (billionai) {
73673e770bf7SBruno Larsen (billionai)     type_register_static(&ppc_cpu_type_info);
73683e770bf7SBruno Larsen (billionai) #ifndef CONFIG_USER_ONLY
73693e770bf7SBruno Larsen (billionai)     type_register_static(&ppc_vhyp_type_info);
73703e770bf7SBruno Larsen (billionai) #endif
73713e770bf7SBruno Larsen (billionai) }
73723e770bf7SBruno Larsen (billionai) 
737347334e17SBruno Larsen (billionai) void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
737447334e17SBruno Larsen (billionai) {
737547334e17SBruno Larsen (billionai) #define RGPL  4
737647334e17SBruno Larsen (billionai) #define RFPL  4
737747334e17SBruno Larsen (billionai) 
737847334e17SBruno Larsen (billionai)     PowerPCCPU *cpu = POWERPC_CPU(cs);
737947334e17SBruno Larsen (billionai)     CPUPPCState *env = &cpu->env;
738047334e17SBruno Larsen (billionai)     int i;
738147334e17SBruno Larsen (billionai) 
738247334e17SBruno Larsen (billionai)     qemu_fprintf(f, "NIP " TARGET_FMT_lx "   LR " TARGET_FMT_lx " CTR "
738347334e17SBruno Larsen (billionai)                  TARGET_FMT_lx " XER " TARGET_FMT_lx " CPU#%d\n",
738447334e17SBruno Larsen (billionai)                  env->nip, env->lr, env->ctr, cpu_read_xer(env),
738547334e17SBruno Larsen (billionai)                  cs->cpu_index);
738647334e17SBruno Larsen (billionai)     qemu_fprintf(f, "MSR " TARGET_FMT_lx " HID0 " TARGET_FMT_lx "  HF "
738747334e17SBruno Larsen (billionai)                  "%08x iidx %d didx %d\n",
738847334e17SBruno Larsen (billionai)                  env->msr, env->spr[SPR_HID0], env->hflags,
738947334e17SBruno Larsen (billionai)                  cpu_mmu_index(env, true), cpu_mmu_index(env, false));
73903778aa97SMatheus Ferst #if !defined(CONFIG_USER_ONLY)
73913778aa97SMatheus Ferst     if (env->tb_env) {
739247334e17SBruno Larsen (billionai)         qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64
73933778aa97SMatheus Ferst                      " DECR " TARGET_FMT_lu "\n", cpu_ppc_load_tbu(env),
73943778aa97SMatheus Ferst                      cpu_ppc_load_tbl(env), cpu_ppc_load_decr(env));
73953778aa97SMatheus Ferst     }
73963778aa97SMatheus Ferst #else
73973778aa97SMatheus Ferst     qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64 "\n", cpu_ppc_load_tbu(env),
73983778aa97SMatheus Ferst                  cpu_ppc_load_tbl(env));
739947334e17SBruno Larsen (billionai) #endif
740047334e17SBruno Larsen (billionai)     for (i = 0; i < 32; i++) {
740147334e17SBruno Larsen (billionai)         if ((i & (RGPL - 1)) == 0) {
740247334e17SBruno Larsen (billionai)             qemu_fprintf(f, "GPR%02d", i);
740347334e17SBruno Larsen (billionai)         }
740447334e17SBruno Larsen (billionai)         qemu_fprintf(f, " %016" PRIx64, ppc_dump_gpr(env, i));
740547334e17SBruno Larsen (billionai)         if ((i & (RGPL - 1)) == (RGPL - 1)) {
740647334e17SBruno Larsen (billionai)             qemu_fprintf(f, "\n");
740747334e17SBruno Larsen (billionai)         }
740847334e17SBruno Larsen (billionai)     }
740947334e17SBruno Larsen (billionai)     qemu_fprintf(f, "CR ");
741047334e17SBruno Larsen (billionai)     for (i = 0; i < 8; i++)
741147334e17SBruno Larsen (billionai)         qemu_fprintf(f, "%01x", env->crf[i]);
741247334e17SBruno Larsen (billionai)     qemu_fprintf(f, "  [");
741347334e17SBruno Larsen (billionai)     for (i = 0; i < 8; i++) {
741447334e17SBruno Larsen (billionai)         char a = '-';
741547334e17SBruno Larsen (billionai)         if (env->crf[i] & 0x08) {
741647334e17SBruno Larsen (billionai)             a = 'L';
741747334e17SBruno Larsen (billionai)         } else if (env->crf[i] & 0x04) {
741847334e17SBruno Larsen (billionai)             a = 'G';
741947334e17SBruno Larsen (billionai)         } else if (env->crf[i] & 0x02) {
742047334e17SBruno Larsen (billionai)             a = 'E';
742147334e17SBruno Larsen (billionai)         }
742247334e17SBruno Larsen (billionai)         qemu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' ');
742347334e17SBruno Larsen (billionai)     }
742447334e17SBruno Larsen (billionai)     qemu_fprintf(f, " ]             RES " TARGET_FMT_lx "\n",
742547334e17SBruno Larsen (billionai)                  env->reserve_addr);
742647334e17SBruno Larsen (billionai) 
742747334e17SBruno Larsen (billionai)     if (flags & CPU_DUMP_FPU) {
742847334e17SBruno Larsen (billionai)         for (i = 0; i < 32; i++) {
742947334e17SBruno Larsen (billionai)             if ((i & (RFPL - 1)) == 0) {
743047334e17SBruno Larsen (billionai)                 qemu_fprintf(f, "FPR%02d", i);
743147334e17SBruno Larsen (billionai)             }
743247334e17SBruno Larsen (billionai)             qemu_fprintf(f, " %016" PRIx64, *cpu_fpr_ptr(env, i));
743347334e17SBruno Larsen (billionai)             if ((i & (RFPL - 1)) == (RFPL - 1)) {
743447334e17SBruno Larsen (billionai)                 qemu_fprintf(f, "\n");
743547334e17SBruno Larsen (billionai)             }
743647334e17SBruno Larsen (billionai)         }
743747334e17SBruno Larsen (billionai)         qemu_fprintf(f, "FPSCR " TARGET_FMT_lx "\n", env->fpscr);
743847334e17SBruno Larsen (billionai)     }
743947334e17SBruno Larsen (billionai) 
744047334e17SBruno Larsen (billionai) #if !defined(CONFIG_USER_ONLY)
744147334e17SBruno Larsen (billionai)     qemu_fprintf(f, " SRR0 " TARGET_FMT_lx "  SRR1 " TARGET_FMT_lx
744247334e17SBruno Larsen (billionai)                  "    PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n",
744347334e17SBruno Larsen (billionai)                  env->spr[SPR_SRR0], env->spr[SPR_SRR1],
744447334e17SBruno Larsen (billionai)                  env->spr[SPR_PVR], env->spr[SPR_VRSAVE]);
744547334e17SBruno Larsen (billionai) 
744647334e17SBruno Larsen (billionai)     qemu_fprintf(f, "SPRG0 " TARGET_FMT_lx " SPRG1 " TARGET_FMT_lx
744747334e17SBruno Larsen (billionai)                  "  SPRG2 " TARGET_FMT_lx "  SPRG3 " TARGET_FMT_lx "\n",
744847334e17SBruno Larsen (billionai)                  env->spr[SPR_SPRG0], env->spr[SPR_SPRG1],
744947334e17SBruno Larsen (billionai)                  env->spr[SPR_SPRG2], env->spr[SPR_SPRG3]);
745047334e17SBruno Larsen (billionai) 
745147334e17SBruno Larsen (billionai)     qemu_fprintf(f, "SPRG4 " TARGET_FMT_lx " SPRG5 " TARGET_FMT_lx
745247334e17SBruno Larsen (billionai)                  "  SPRG6 " TARGET_FMT_lx "  SPRG7 " TARGET_FMT_lx "\n",
745347334e17SBruno Larsen (billionai)                  env->spr[SPR_SPRG4], env->spr[SPR_SPRG5],
745447334e17SBruno Larsen (billionai)                  env->spr[SPR_SPRG6], env->spr[SPR_SPRG7]);
745547334e17SBruno Larsen (billionai) 
7456fbe08667SCédric Le Goater     switch (env->excp_model) {
745747334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64)
7458fbe08667SCédric Le Goater     case POWERPC_EXCP_POWER7:
7459fbe08667SCédric Le Goater     case POWERPC_EXCP_POWER8:
7460fbe08667SCédric Le Goater     case POWERPC_EXCP_POWER9:
7461fbe08667SCédric Le Goater     case POWERPC_EXCP_POWER10:
746247334e17SBruno Larsen (billionai)         qemu_fprintf(f, "HSRR0 " TARGET_FMT_lx " HSRR1 " TARGET_FMT_lx "\n",
746347334e17SBruno Larsen (billionai)                      env->spr[SPR_HSRR0], env->spr[SPR_HSRR1]);
7464fbe08667SCédric Le Goater         break;
746547334e17SBruno Larsen (billionai) #endif
7466fbe08667SCédric Le Goater     case POWERPC_EXCP_BOOKE:
746747334e17SBruno Larsen (billionai)         qemu_fprintf(f, "CSRR0 " TARGET_FMT_lx " CSRR1 " TARGET_FMT_lx
746847334e17SBruno Larsen (billionai)                      " MCSRR0 " TARGET_FMT_lx " MCSRR1 " TARGET_FMT_lx "\n",
746947334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_CSRR0], env->spr[SPR_BOOKE_CSRR1],
747047334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]);
747147334e17SBruno Larsen (billionai) 
747247334e17SBruno Larsen (billionai)         qemu_fprintf(f, "  TCR " TARGET_FMT_lx "   TSR " TARGET_FMT_lx
747347334e17SBruno Larsen (billionai)                      "    ESR " TARGET_FMT_lx "   DEAR " TARGET_FMT_lx "\n",
747447334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_TCR], env->spr[SPR_BOOKE_TSR],
747547334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_ESR], env->spr[SPR_BOOKE_DEAR]);
747647334e17SBruno Larsen (billionai) 
747747334e17SBruno Larsen (billionai)         qemu_fprintf(f, "  PIR " TARGET_FMT_lx " DECAR " TARGET_FMT_lx
747847334e17SBruno Larsen (billionai)                      "   IVPR " TARGET_FMT_lx "   EPCR " TARGET_FMT_lx "\n",
747947334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_PIR], env->spr[SPR_BOOKE_DECAR],
748047334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_IVPR], env->spr[SPR_BOOKE_EPCR]);
748147334e17SBruno Larsen (billionai) 
748247334e17SBruno Larsen (billionai)         qemu_fprintf(f, " MCSR " TARGET_FMT_lx " SPRG8 " TARGET_FMT_lx
748347334e17SBruno Larsen (billionai)                      "    EPR " TARGET_FMT_lx "\n",
748447334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MCSR], env->spr[SPR_BOOKE_SPRG8],
748547334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_EPR]);
748647334e17SBruno Larsen (billionai) 
748747334e17SBruno Larsen (billionai)         /* FSL-specific */
748847334e17SBruno Larsen (billionai)         qemu_fprintf(f, " MCAR " TARGET_FMT_lx "  PID1 " TARGET_FMT_lx
748947334e17SBruno Larsen (billionai)                      "   PID2 " TARGET_FMT_lx "    SVR " TARGET_FMT_lx "\n",
749047334e17SBruno Larsen (billionai)                      env->spr[SPR_Exxx_MCAR], env->spr[SPR_BOOKE_PID1],
749147334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_PID2], env->spr[SPR_E500_SVR]);
749247334e17SBruno Larsen (billionai) 
749347334e17SBruno Larsen (billionai)         /*
749447334e17SBruno Larsen (billionai)          * IVORs are left out as they are large and do not change often --
749547334e17SBruno Larsen (billionai)          * they can be read with "p $ivor0", "p $ivor1", etc.
749647334e17SBruno Larsen (billionai)          */
7497fbe08667SCédric Le Goater         break;
7498fbe08667SCédric Le Goater     case POWERPC_EXCP_40x:
7499fbe08667SCédric Le Goater         qemu_fprintf(f, "  TCR " TARGET_FMT_lx "   TSR " TARGET_FMT_lx
7500fbe08667SCédric Le Goater                      "    ESR " TARGET_FMT_lx "   DEAR " TARGET_FMT_lx "\n",
7501fbe08667SCédric Le Goater                      env->spr[SPR_40x_TCR], env->spr[SPR_40x_TSR],
7502fbe08667SCédric Le Goater                      env->spr[SPR_40x_ESR], env->spr[SPR_40x_DEAR]);
7503fbe08667SCédric Le Goater 
7504fbe08667SCédric Le Goater         qemu_fprintf(f, " EVPR " TARGET_FMT_lx "  SRR2 " TARGET_FMT_lx
7505fbe08667SCédric Le Goater                      "   SRR3 " TARGET_FMT_lx  "   PID " TARGET_FMT_lx "\n",
7506fbe08667SCédric Le Goater                      env->spr[SPR_40x_EVPR], env->spr[SPR_40x_SRR2],
7507fbe08667SCédric Le Goater                      env->spr[SPR_40x_SRR3], env->spr[SPR_40x_PID]);
7508fbe08667SCédric Le Goater         break;
7509fbe08667SCédric Le Goater     default:
7510fbe08667SCédric Le Goater         break;
751147334e17SBruno Larsen (billionai)     }
751247334e17SBruno Larsen (billionai) 
751347334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64)
751447334e17SBruno Larsen (billionai)     if (env->flags & POWERPC_FLAG_CFAR) {
751547334e17SBruno Larsen (billionai)         qemu_fprintf(f, " CFAR " TARGET_FMT_lx"\n", env->cfar);
751647334e17SBruno Larsen (billionai)     }
751747334e17SBruno Larsen (billionai) #endif
751847334e17SBruno Larsen (billionai) 
751947334e17SBruno Larsen (billionai)     if (env->spr_cb[SPR_LPCR].name) {
752047334e17SBruno Larsen (billionai)         qemu_fprintf(f, " LPCR " TARGET_FMT_lx "\n", env->spr[SPR_LPCR]);
752147334e17SBruno Larsen (billionai)     }
752247334e17SBruno Larsen (billionai) 
752347334e17SBruno Larsen (billionai)     switch (env->mmu_model) {
752447334e17SBruno Larsen (billionai)     case POWERPC_MMU_32B:
752547334e17SBruno Larsen (billionai)     case POWERPC_MMU_SOFT_6xx:
752647334e17SBruno Larsen (billionai) #if defined(TARGET_PPC64)
752747334e17SBruno Larsen (billionai)     case POWERPC_MMU_64B:
752847334e17SBruno Larsen (billionai)     case POWERPC_MMU_2_03:
752947334e17SBruno Larsen (billionai)     case POWERPC_MMU_2_06:
753047334e17SBruno Larsen (billionai)     case POWERPC_MMU_2_07:
753147334e17SBruno Larsen (billionai)     case POWERPC_MMU_3_00:
753247334e17SBruno Larsen (billionai) #endif
753347334e17SBruno Larsen (billionai)         if (env->spr_cb[SPR_SDR1].name) { /* SDR1 Exists */
753447334e17SBruno Larsen (billionai)             qemu_fprintf(f, " SDR1 " TARGET_FMT_lx " ", env->spr[SPR_SDR1]);
753547334e17SBruno Larsen (billionai)         }
753647334e17SBruno Larsen (billionai)         if (env->spr_cb[SPR_PTCR].name) { /* PTCR Exists */
753747334e17SBruno Larsen (billionai)             qemu_fprintf(f, " PTCR " TARGET_FMT_lx " ", env->spr[SPR_PTCR]);
753847334e17SBruno Larsen (billionai)         }
753947334e17SBruno Larsen (billionai)         qemu_fprintf(f, "  DAR " TARGET_FMT_lx "  DSISR " TARGET_FMT_lx "\n",
754047334e17SBruno Larsen (billionai)                      env->spr[SPR_DAR], env->spr[SPR_DSISR]);
754147334e17SBruno Larsen (billionai)         break;
754247334e17SBruno Larsen (billionai)     case POWERPC_MMU_BOOKE206:
754347334e17SBruno Larsen (billionai)         qemu_fprintf(f, " MAS0 " TARGET_FMT_lx "  MAS1 " TARGET_FMT_lx
754447334e17SBruno Larsen (billionai)                      "   MAS2 " TARGET_FMT_lx "   MAS3 " TARGET_FMT_lx "\n",
754547334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MAS0], env->spr[SPR_BOOKE_MAS1],
754647334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MAS2], env->spr[SPR_BOOKE_MAS3]);
754747334e17SBruno Larsen (billionai) 
754847334e17SBruno Larsen (billionai)         qemu_fprintf(f, " MAS4 " TARGET_FMT_lx "  MAS6 " TARGET_FMT_lx
754947334e17SBruno Larsen (billionai)                      "   MAS7 " TARGET_FMT_lx "    PID " TARGET_FMT_lx "\n",
755047334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MAS4], env->spr[SPR_BOOKE_MAS6],
755147334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_MAS7], env->spr[SPR_BOOKE_PID]);
755247334e17SBruno Larsen (billionai) 
755347334e17SBruno Larsen (billionai)         qemu_fprintf(f, "MMUCFG " TARGET_FMT_lx " TLB0CFG " TARGET_FMT_lx
755447334e17SBruno Larsen (billionai)                      " TLB1CFG " TARGET_FMT_lx "\n",
755547334e17SBruno Larsen (billionai)                      env->spr[SPR_MMUCFG], env->spr[SPR_BOOKE_TLB0CFG],
755647334e17SBruno Larsen (billionai)                      env->spr[SPR_BOOKE_TLB1CFG]);
755747334e17SBruno Larsen (billionai)         break;
755847334e17SBruno Larsen (billionai)     default:
755947334e17SBruno Larsen (billionai)         break;
756047334e17SBruno Larsen (billionai)     }
756147334e17SBruno Larsen (billionai) #endif
756247334e17SBruno Larsen (billionai) 
756347334e17SBruno Larsen (billionai) #undef RGPL
756447334e17SBruno Larsen (billionai) #undef RFPL
756547334e17SBruno Larsen (billionai) }
75663e770bf7SBruno Larsen (billionai) type_init(ppc_cpu_register_types)
7567