diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2010-06-28 15:00:46 -0500 |
---|---|---|
committer | Patrick Williams <iawillia@us.ibm.com> | 2010-06-28 15:00:46 -0500 |
commit | 419ee15eddec34322a9d44a7b9099494fb2ff0c7 (patch) | |
tree | 79407a0c379194127fb4821bdd7904aa6ccb6573 /src/include/kernel | |
parent | 493f4e35ab698fa90870e4317d00f26cb095bf4f (diff) | |
download | talos-hostboot-419ee15eddec34322a9d44a7b9099494fb2ff0c7.tar.gz talos-hostboot-419ee15eddec34322a9d44a7b9099494fb2ff0c7.zip |
Move SPRG3 manipulation to common ppc-arch file.
Diffstat (limited to 'src/include/kernel')
-rw-r--r-- | src/include/kernel/ppcarch.H | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/include/kernel/ppcarch.H b/src/include/kernel/ppcarch.H index f6b80ea6f..2b61f6200 100644 --- a/src/include/kernel/ppcarch.H +++ b/src/include/kernel/ppcarch.H @@ -11,4 +11,37 @@ inline uint64_t ppc_getSRR1() return srr1; } +__attribute__((always_inline)) +inline uint64_t ppc_getPVR() +{ + register uint64_t pvr = 0; + asm volatile("mfspr %0, 287" : "=r" (pvr)); + return pvr; +} + +__attribute__((always_inline)) +inline uint64_t ppc_getPIR() +{ + register uint64_t pir = 0; + asm volatile("mfspr %0, 1023" : "=r" (pir)); + return pir; +} + +__attribute__((always_inline)) +inline uint64_t ppc_getSPRG3() +{ + register uint64_t sprg3 = 0; + asm volatile("mfsprg3 %0" : "=r" (sprg3)); + return sprg3; +} + +__attribute__((always_inline)) +inline void ppc_setSPRG3(uint64_t _sprg3) +{ + register uint64_t sprg3 = _sprg3; + asm volatile("mtsprg3 %0" : : "r" (sprg3)); + return; +} + + #endif |