@@ -72,7 +72,12 @@ static inline bool mips_cpc_present(void)
7272#define MIPS_CPC_COCB_OFS 0x4000
7373
7474/* Macros to ease the creation of register access functions */
75- #define BUILD_CPC_R_ (name , off ) \
75+ #define BUILD_CPC_R_ (name , off ) \
76+ static inline u32 *addr_cpc_##name(void) \
77+ { \
78+ return (u32 *)(mips_cpc_base + (off)); \
79+ } \
80+ \
7681static inline u32 read_cpc_##name(void) \
7782{ \
7883 return __raw_readl(mips_cpc_base + (off)); \
@@ -147,4 +152,31 @@ BUILD_CPC_Cx_RW(other, 0x10)
147152#define CPC_Cx_OTHER_CORENUM_SHF 16
148153#define CPC_Cx_OTHER_CORENUM_MSK (_ULCAST_(0xff) << 16)
149154
155+ #ifdef CONFIG_MIPS_CPC
156+
157+ /**
158+ * mips_cpc_lock_other - lock access to another core
159+ * core: the other core to be accessed
160+ *
161+ * Call before operating upon a core via the 'other' register region in
162+ * order to prevent the region being moved during access. Must be followed
163+ * by a call to mips_cpc_unlock_other.
164+ */
165+ extern void mips_cpc_lock_other (unsigned int core );
166+
167+ /**
168+ * mips_cpc_unlock_other - unlock access to another core
169+ *
170+ * Call after operating upon another core via the 'other' register region.
171+ * Must be called after mips_cpc_lock_other.
172+ */
173+ extern void mips_cpc_unlock_other (void );
174+
175+ #else /* !CONFIG_MIPS_CPC */
176+
177+ static inline void mips_cpc_lock_other (unsigned int core ) { }
178+ static inline void mips_cpc_unlock_other (void ) { }
179+
180+ #endif /* !CONFIG_MIPS_CPC */
181+
150182#endif /* __MIPS_ASM_MIPS_CPC_H__ */
0 commit comments