From 248b85a6e739c8eb107c3a278b8eac6fc1f0cf62 Mon Sep 17 00:00:00 2001
From: Alex Ray
Date: Sun, 6 Apr 2014 07:34:27 -0700
Subject: [PATCH] Disable multiprocessor-id read on ARMv7-R cores
ARMv7-R cores are largely uniprocessor-configured, and when they are
multiprocessor-configured the format of the MPIDR register isn't
compatible with ARMv7-A cores.
Change-Id: I024ec514496fbab5075c6fb34b6acd870e68e1fc
Signed-off-by: Alex Ray
Reviewed-on: http://openocd.zylin.com/2096
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson
---
src/target/armv7a.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/target/armv7a.c b/src/target/armv7a.c
index 11e7a37e..bf474d3a 100644
--- a/src/target/armv7a.c
+++ b/src/target/armv7a.c
@@ -545,6 +545,16 @@ static int armv7a_read_mpidr(struct target *target)
&mpidr);
if (retval != ERROR_OK)
goto done;
+
+ /* ARMv7R uses a different format for MPIDR.
+ * When configured uniprocessor (most R cores) it reads as 0.
+ * This will need to be implemented for multiprocessor ARMv7R cores. */
+ if (armv7a->is_armv7r) {
+ if (mpidr)
+ LOG_ERROR("MPIDR nonzero in ARMv7-R target");
+ goto done;
+ }
+
if (mpidr & 1<<31) {
armv7a->multi_processor_system = (mpidr >> 30) & 1;
armv7a->cluster_id = (mpidr >> 8) & 0xf;
@@ -555,7 +565,7 @@ static int armv7a_read_mpidr(struct target *target)
armv7a->multi_processor_system == 0 ? "multi core" : "mono core");
} else
- LOG_ERROR("mpdir not in multiprocessor format");
+ LOG_ERROR("MPIDR not in multiprocessor format");
done:
dpm->finish(dpm);
--
2.39.5