diff options
author | raj <raj@FreeBSD.org> | 2009-05-14 16:48:25 +0000 |
---|---|---|
committer | raj <raj@FreeBSD.org> | 2009-05-14 16:48:25 +0000 |
commit | e648274e7cd96f1e6c180388779d4ba3f74b7c94 (patch) | |
tree | 40f3915c08086a4bbe1a4ba4460c5da9a14e43a5 /sys/powerpc/include/cpufunc.h | |
parent | 03b3bbecf2a89655d83d05fd316fc3cbf626860b (diff) | |
download | FreeBSD-src-e648274e7cd96f1e6c180388779d4ba3f74b7c94.zip FreeBSD-src-e648274e7cd96f1e6c180388779d4ba3f74b7c94.tar.gz |
PowerPC common SMP startup and time base rework.
- make mftb() shared, rewrite in C, provide complementary mttb()
- adjust SMP startup per the above, additional comments, minor naming
changes
- eliminate redundant TB defines, other minor cosmetics
Reviewed by: marcel, nwhitehorn
Obtained from: Freescale, Semihalf
Diffstat (limited to 'sys/powerpc/include/cpufunc.h')
-rw-r--r-- | sys/powerpc/include/cpufunc.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/powerpc/include/cpufunc.h b/sys/powerpc/include/cpufunc.h index 66b5df3..9cdaba0 100644 --- a/sys/powerpc/include/cpufunc.h +++ b/sys/powerpc/include/cpufunc.h @@ -115,13 +115,37 @@ mfdec(void) static __inline register_t mfpvr(void) { - register_t value; + register_t value; __asm __volatile ("mfpvr %0" : "=r"(value)); return (value); } +static __inline u_quad_t +mftb(void) +{ + u_quad_t tb; + uint32_t *tbup = (uint32_t *)&tb; + uint32_t *tblp = tbup + 1; + + do { + *tbup = mfspr(TBR_TBU); + *tblp = mfspr(TBR_TBL); + } while (*tbup != mfspr(TBR_TBU)); + + return (tb); +} + +static __inline void +mttb(u_quad_t time) +{ + + mtspr(TBR_TBWL, 0); + mtspr(TBR_TBWU, (uint32_t)(time >> 32)); + mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff)); +} + static __inline void eieio(void) { |