Patchwork [1/2] Added sparc_leon3_snooping_enabled()

login
register
mail settings
Submitter Kristoffer Glembo
Date Nov. 2, 2009, 2:28 p.m.
Message ID <1257172092-25026-1-git-send-email-kristoffer@gaisler.com>
Download mbox | patch
Permalink /patch/37418/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Kristoffer Glembo - Nov. 2, 2009, 2:28 p.m.
Added a function for checking if snooping is enabled.

Best regards,
Kristoffer Glembo


---
 arch/sparc/include/asm/leon.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
David Miller - Nov. 4, 2009, 1:41 p.m.
From: Kristoffer Glembo <kristoffer@gaisler.com>
Date: Mon,  2 Nov 2009 15:28:11 +0100

> Added a function for checking if snooping is enabled.

You need to provide a proper "Signed-off-by:" when submitting patches.

Also, all of these inline routines in leon.h should be
"static inline" not "extern inline".

"extern inline" tells the compiler that it can choose to not
inline the function, and that externally in some other object
file an implementation of that function will exist that the
compiler can generate a call to.

You want "static inline" which tells the compiler that it either
must inline the function or emit a local static copy of it into
the current compilation unit.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index 28a42b7..9f4ff4e 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -209,6 +209,13 @@  extern inline void sparc_leon3_enable_snooping(void)
 			  "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2");
 };
 
+extern inline int sparc_leon3_snooping_enabled(void)
+{
+	u32 cctrl;
+	__asm__ __volatile__("lda [%%g0] 2, %0\n\t" : "=r"(cctrl));
+        return (cctrl >> 23) & 1;
+};
+
 extern inline void sparc_leon3_disable_cache(void)
 {
 	__asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t"