All of lore.kernel.org
 help / color / mirror / Atom feed
* Function for revised cpuid format
@ 2010-05-21 12:14 Bahadir Balban
  0 siblings, 0 replies; only message in thread
From: Bahadir Balban @ 2010-05-21 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

Below is a patch for this. What do you think?


 From 30ed7d843d61a9663b7fe8d2f8c67ede3d819e50 Mon Sep 17 00:00:00 2001
From: Bahadir Balban <bbalban@b-labs.co.uk>
Date: Fri, 21 May 2010 14:39:56 +0300
Subject: [PATCH] Define revised cpuid function and convert assembler to use that.

This patch defines a minor function to read the revised cpuid
format and converts an assembler statement to use this function.

Signed-off-by: Bahadir Balban <bbalban@b-labs.co.uk>
---
  arch/codezero/include/asm/cputype.h |    5 +++++
  arch/codezero/kernel/setup.c        |    5 ++---
  2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/codezero/include/asm/cputype.h b/arch/codezero/include/asm/cputype.h
index 20ae96c..60071d8 100644
--- a/arch/codezero/include/asm/cputype.h
+++ b/arch/codezero/include/asm/cputype.h
@@ -58,6 +58,11 @@ static inline unsigned int __attribute_const__ read_cpuid_id(void)
  	return read_cpuid(CPUID_ID);
  }

+static inline unsigned int __attribute_const__ read_cpuid_revised_id(void)
+{
+	return read_cpuid_ext(CPUID_EXT_MMFR0);
+}
+
  static inline unsigned int __attribute_const__ read_cpuid_cachetype(void)
  {
  	return read_cpuid(CPUID_CACHETYPE);
diff --git a/arch/codezero/kernel/setup.c b/arch/codezero/kernel/setup.c
index c91c77b..c64b029 100644
--- a/arch/codezero/kernel/setup.c
+++ b/arch/codezero/kernel/setup.c
@@ -213,12 +213,11 @@ int cpu_architecture(void)
  		if (cpu_arch)
  			cpu_arch += CPU_ARCH_ARMv3;
  	} else if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
-		unsigned int mmfr0;

  		/* Revised CPUID format. Read the Memory Model Feature
  		 * Register 0 and check for VMSAv7 or PMSAv7 */
-		asm("mrc	p15, 0, %0, c0, c1, 4"
-		    : "=r" (mmfr0));
+		unsigned int mmfr0 = read_cpuid_revised_id();
+
  		if ((mmfr0 & 0x0000000f) == 0x00000003 ||
  		    (mmfr0 & 0x000000f0) == 0x00000030)
  			cpu_arch = CPU_ARCH_ARMv7;
-- 
1.6.3.3

-- 
Bahadir

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-21 12:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 12:14 Function for revised cpuid format Bahadir Balban

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.