public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: bahadir@l4dev•org (Bahadir Balban)
To: linux-arm-kernel@lists•infradead.org
Subject: Function for revised cpuid format
Date: Fri, 21 May 2010 15:14:08 +0300	[thread overview]
Message-ID: <4BF67910.1080108@l4dev.org> (raw)

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

                 reply	other threads:[~2010-05-21 12:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BF67910.1080108@l4dev.org \
    --to=bahadir@l4dev$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox