1 #ifndef __ASM_ARM_SYSREGS_H
2 #define __ASM_ARM_SYSREGS_H
3 
4 #if defined(CONFIG_ARM_32)
5 # include <asm/arm32/sysregs.h>
6 #elif defined(CONFIG_ARM_64)
7 # include <asm/arm64/sysregs.h>
8 #else
9 # error "unknown ARM variant"
10 #endif
11 
12 #ifndef __ASSEMBLY__
13 
14 #include <asm/alternative.h>
15 
read_sysreg_par(void)16 static inline register_t read_sysreg_par(void)
17 {
18     register_t par_el1;
19 
20     /*
21      * On Cortex-A77 r0p0 and r1p0, read access to PAR_EL1 shall include a
22      * DMB SY before and after accessing it, as part of the workaround for the
23      * errata 1508412.
24      */
25     asm_inline volatile (
26         ALTERNATIVE("nop", "dmb sy", ARM64_WORKAROUND_1508412,
27                     CONFIG_ARM64_ERRATUM_1508412) );
28     par_el1 = READ_SYSREG64(PAR_EL1);
29     asm_inline volatile (
30         ALTERNATIVE("nop", "dmb sy", ARM64_WORKAROUND_1508412,
31                     CONFIG_ARM64_ERRATUM_1508412) );
32 
33     return par_el1;
34 }
35 
36 #endif /*  !__ASSEMBLY__  */
37 
38 #endif /* __ASM_ARM_SYSREGS_H */
39 /*
40  * Local variables:
41  * mode: C
42  * c-file-style: "BSD"
43  * c-basic-offset: 4
44  * indent-tabs-mode: nil
45  * End:
46  */
47 
48 
49