Skip to content

Commit d8a6245

Browse files
committed
target/ppc: Wire up BookE ATB registers for e500 family
From the Freescale PowerPC Architecture Primer: Alternate time base APU. This APU, implemented on the e500v2, defines a 64-bit time base counter that differs from the PowerPC defined time base in that it is not writable and counts at a different, and typically much higher, frequency. The alternate time base always counts up, wrapping when the 64-bit count overflows. This implementation of ATB uses the same frequency as the TB. The existing spr_read_atbu/l functions are unused without this patch to wire them into the SPR. RTEMS uses this SPR on the e6500, though this hasn't been tested. Message-ID: <[email protected]> Signed-off-by: Nicholas Piggin <[email protected]>
1 parent e8291ec commit d8a6245

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

target/ppc/cpu_init.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,18 @@ static void register_BookE206_sprs(CPUPPCState *env, uint32_t mas_mask,
922922
#endif
923923
}
924924

925+
static void register_atb_sprs(CPUPPCState *env)
926+
{
927+
spr_register(env, SPR_ATBL, "ATBL",
928+
&spr_read_atbl, SPR_NOACCESS,
929+
&spr_read_atbl, SPR_NOACCESS,
930+
0x00000000);
931+
spr_register(env, SPR_ATBU, "ATBU",
932+
&spr_read_atbu, SPR_NOACCESS,
933+
&spr_read_atbu, SPR_NOACCESS,
934+
0x00000000);
935+
}
936+
925937
/* SPR specific to PowerPC 440 implementation */
926938
static void register_440_sprs(CPUPPCState *env)
927939
{
@@ -2911,6 +2923,11 @@ static void init_proc_e500(CPUPPCState *env, int version)
29112923
register_BookE206_sprs(env, 0x000000DF, tlbncfg, mmucfg);
29122924
register_usprgh_sprs(env);
29132925

2926+
if (version != fsl_e500v1) {
2927+
/* e500v1 has no support for alternate timebase */
2928+
register_atb_sprs(env);
2929+
}
2930+
29142931
spr_register(env, SPR_HID0, "HID0",
29152932
SPR_NOACCESS, SPR_NOACCESS,
29162933
&spr_read_generic, &spr_write_generic,

0 commit comments

Comments
 (0)