powerpc/fsl: Modernise mt/mfpmr
With the addition of the machine directives, these are no longer simple 1-2 liner macros. So modernise them to be static inlines and use named asm parameters. Acked-by: Segher Boessenkool <segher@kernel.crashing.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240229122521.762431-4-mpe@ellerman.id.au
This commit is contained in:
parent
5f491356b7
commit
f01dbd73cc
1 changed files with 21 additions and 11 deletions
|
@ -11,17 +11,27 @@
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
/* Performance Monitor Registers */
|
/* Performance Monitor Registers */
|
||||||
#define mfpmr(rn) ({unsigned int rval; \
|
static inline unsigned int mfpmr(unsigned int rn)
|
||||||
asm volatile(".machine push; " \
|
{
|
||||||
".machine e300; " \
|
unsigned int rval;
|
||||||
"mfpmr %0," __stringify(rn) ";" \
|
|
||||||
".machine pop; " \
|
asm (".machine push; "
|
||||||
: "=r" (rval)); rval;})
|
".machine e300; "
|
||||||
#define mtpmr(rn, v) asm volatile(".machine push; " \
|
"mfpmr %[rval], %[rn];"
|
||||||
".machine e300; " \
|
".machine pop;"
|
||||||
"mtpmr " __stringify(rn) ",%0; " \
|
: [rval] "=r" (rval) : [rn] "i" (rn));
|
||||||
".machine pop; " \
|
|
||||||
: : "r" (v))
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void mtpmr(unsigned int rn, unsigned int val)
|
||||||
|
{
|
||||||
|
asm (".machine push; "
|
||||||
|
".machine e300; "
|
||||||
|
"mtpmr %[rn], %[val];"
|
||||||
|
".machine pop;"
|
||||||
|
: [val] "=r" (val) : [rn] "i" (rn));
|
||||||
|
}
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
/* Freescale Book E Performance Monitor APU Registers */
|
/* Freescale Book E Performance Monitor APU Registers */
|
||||||
|
|
Loading…
Add table
Reference in a new issue