target/ppc: cpu_init: Group registration of generic SPRs
The top level init_proc calls register_generic_sprs but also registers some other SPRs outside of that function. Let's group everything into a single place. Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20220216162426.1885923-4-farosas@linux.ibm.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
parent
363bd7d0d5
commit
e78280a237
@ -150,8 +150,11 @@ static void _spr_register(CPUPPCState *env, int num, const char *name,
|
|||||||
oea_read, oea_write, 0, ival)
|
oea_read, oea_write, 0, ival)
|
||||||
|
|
||||||
/* Generic PowerPC SPRs */
|
/* Generic PowerPC SPRs */
|
||||||
static void register_generic_sprs(CPUPPCState *env)
|
static void register_generic_sprs(PowerPCCPU *cpu)
|
||||||
{
|
{
|
||||||
|
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
|
||||||
|
CPUPPCState *env = &cpu->env;
|
||||||
|
|
||||||
/* Integer processing */
|
/* Integer processing */
|
||||||
spr_register(env, SPR_XER, "XER",
|
spr_register(env, SPR_XER, "XER",
|
||||||
&spr_read_xer, &spr_write_xer,
|
&spr_read_xer, &spr_write_xer,
|
||||||
@ -192,6 +195,32 @@ static void register_generic_sprs(CPUPPCState *env)
|
|||||||
SPR_NOACCESS, SPR_NOACCESS,
|
SPR_NOACCESS, SPR_NOACCESS,
|
||||||
&spr_read_generic, &spr_write_generic,
|
&spr_read_generic, &spr_write_generic,
|
||||||
0x00000000);
|
0x00000000);
|
||||||
|
|
||||||
|
spr_register(env, SPR_PVR, "PVR",
|
||||||
|
/* Linux permits userspace to read PVR */
|
||||||
|
#if defined(CONFIG_LINUX_USER)
|
||||||
|
&spr_read_generic,
|
||||||
|
#else
|
||||||
|
SPR_NOACCESS,
|
||||||
|
#endif
|
||||||
|
SPR_NOACCESS,
|
||||||
|
&spr_read_generic, SPR_NOACCESS,
|
||||||
|
pcc->pvr);
|
||||||
|
|
||||||
|
/* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
|
||||||
|
if (pcc->svr != POWERPC_SVR_NONE) {
|
||||||
|
if (pcc->svr & POWERPC_SVR_E500) {
|
||||||
|
spr_register(env, SPR_E500_SVR, "SVR",
|
||||||
|
SPR_NOACCESS, SPR_NOACCESS,
|
||||||
|
&spr_read_generic, SPR_NOACCESS,
|
||||||
|
pcc->svr & ~POWERPC_SVR_E500);
|
||||||
|
} else {
|
||||||
|
spr_register(env, SPR_SVR, "SVR",
|
||||||
|
SPR_NOACCESS, SPR_NOACCESS,
|
||||||
|
&spr_read_generic, SPR_NOACCESS,
|
||||||
|
pcc->svr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SPR common to all non-embedded PowerPC, including 601 */
|
/* SPR common to all non-embedded PowerPC, including 601 */
|
||||||
@ -7237,31 +7266,8 @@ static void init_ppc_proc(PowerPCCPU *cpu)
|
|||||||
env->tlb_type = TLB_NONE;
|
env->tlb_type = TLB_NONE;
|
||||||
#endif
|
#endif
|
||||||
/* Register SPR common to all PowerPC implementations */
|
/* Register SPR common to all PowerPC implementations */
|
||||||
register_generic_sprs(env);
|
register_generic_sprs(cpu);
|
||||||
spr_register(env, SPR_PVR, "PVR",
|
|
||||||
/* Linux permits userspace to read PVR */
|
|
||||||
#if defined(CONFIG_LINUX_USER)
|
|
||||||
&spr_read_generic,
|
|
||||||
#else
|
|
||||||
SPR_NOACCESS,
|
|
||||||
#endif
|
|
||||||
SPR_NOACCESS,
|
|
||||||
&spr_read_generic, SPR_NOACCESS,
|
|
||||||
pcc->pvr);
|
|
||||||
/* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
|
|
||||||
if (pcc->svr != POWERPC_SVR_NONE) {
|
|
||||||
if (pcc->svr & POWERPC_SVR_E500) {
|
|
||||||
spr_register(env, SPR_E500_SVR, "SVR",
|
|
||||||
SPR_NOACCESS, SPR_NOACCESS,
|
|
||||||
&spr_read_generic, SPR_NOACCESS,
|
|
||||||
pcc->svr & ~POWERPC_SVR_E500);
|
|
||||||
} else {
|
|
||||||
spr_register(env, SPR_SVR, "SVR",
|
|
||||||
SPR_NOACCESS, SPR_NOACCESS,
|
|
||||||
&spr_read_generic, SPR_NOACCESS,
|
|
||||||
pcc->svr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* PowerPC implementation specific initialisations (SPRs, timers, ...) */
|
/* PowerPC implementation specific initialisations (SPRs, timers, ...) */
|
||||||
(*pcc->init_proc)(env);
|
(*pcc->init_proc)(env);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user