Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1230532

[PATCH 4/5] MIPS: allow read64 GCR accessors to work on MIPS32 kernels

From Paul Burton <paul.burton@imgtec.com>
Newsgroups linux.kernel
Subject [PATCH 4/5] MIPS: allow read64 GCR accessors to work on MIPS32 kernels
Date 2015-09-22 19:30 +0200
Message-ID <qbzyb-3xX-39@gated-at.bofh.it> (permalink)
References <qbzya-3xX-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If we run a MIPS32 kernel on a system using CM3 we may still need to
access 64 bit GCRs, as will be done in later patches. Allow this by
having the read64_gcr_* accessor functions perform 2 x 32 bit reads on
those systems.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/include/asm/mips-cm.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
index 2a70b76..b9df4b2 100644
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -125,7 +125,17 @@ static inline u32 read32_gcr_##name(void)			\
 								\
 static inline u64 read64_gcr_##name(void)			\
 {								\
-	return __raw_readq(addr_gcr_##name());			\
+	void __iomem *addr = addr_gcr_##name();			\
+	u64 ret;						\
+								\
+	if (mips_cm_is64) {					\
+		ret = __raw_readq(addr);			\
+	} else {						\
+		ret = __raw_readl(addr);			\
+		ret |= (u64)__raw_readl(addr + 0x4) << 32;	\
+	}							\
+								\
+	return ret;						\
 }								\
 								\
 static inline unsigned long read_gcr_##name(void)		\
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] CM error report fixes Paul Burton <paul.burton@imgtec.com> - 2015-09-22 19:30 +0200
  [PATCH 4/5] MIPS: allow read64 GCR accessors to work on MIPS32 kernels Paul Burton <paul.burton@imgtec.com> - 2015-09-22 19:30 +0200
  [PATCH 3/5] MIPS: avoid buffer overrun in mips_cm_error_report Paul Burton <paul.burton@imgtec.com> - 2015-09-22 19:30 +0200

csiph-web