summaryrefslogtreecommitdiff
path: root/arch/mips/cpu
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2016-09-21 13:59:54 (GMT)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2016-09-21 15:04:53 (GMT)
commit31d36f748c52b22833aa946f6c406cc8fb2f1908 (patch)
tree3eec119018d0fc405e56e333c244af6e60bd5a04 /arch/mips/cpu
parentd263cda5ae41279208d9576eab1c5215a57252a6 (diff)
downloadu-boot-fsl-qoriq-31d36f748c52b22833aa946f6c406cc8fb2f1908.tar.xz
MIPS: Hang if run on a secondary CPU
Some systems are configured such that multiple CPUs begin running from their reset vector following a system reset. If this occurs then U-Boot will be run on multiple CPUs simultaneously, which causes all sorts of issues as the multiple instances of U-Boot clobber each other. Prevent this from happening by simply hanging with an infinite loop if we run on a CPU whose ID, as determined by GlobalNumber or EBase.CPUNum as appropriate, is non-zero. Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Diffstat (limited to 'arch/mips/cpu')
-rw-r--r--arch/mips/cpu/start.S21
1 files changed, 20 insertions, 1 deletions
diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S
index cbc02fa..3f0fc12 100644
--- a/arch/mips/cpu/start.S
+++ b/arch/mips/cpu/start.S
@@ -108,9 +108,28 @@ ENTRY(_start)
.align 4
reset:
+#if __mips_isa_rev >= 6
+ mfc0 t0, CP0_CONFIG, 5
+ and t0, t0, MIPS_CONF5_VP
+ beqz t0, 1f
+ nop
+
+ b 2f
+ mfc0 t0, CP0_GLOBALNUMBER
+#endif
+
+1: mfc0 t0, CP0_EBASE
+ and t0, t0, EBASE_CPUNUM
+
+ /* Hang if this isn't the first CPU in the system */
+2: beqz t0, 4f
+ nop
+3: wait
+ b 3b
+ nop
/* Clear watch registers */
- MTC0 zero, CP0_WATCHLO
+4: MTC0 zero, CP0_WATCHLO
mtc0 zero, CP0_WATCHHI
/* WP(Watch Pending), SW0/1 should be cleared */