svn commit: r261419 - in head/sys/arm: arm include

Olivier Houchard cognet at FreeBSD.org
Sun Feb 2 23:29:52 UTC 2014


Author: cognet
Date: Sun Feb  2 23:29:51 2014
New Revision: 261419
URL: http://svnweb.freebsd.org/changeset/base/261419

Log:
  Only use the CPU ID register if SMP is defined. Some non-MPCore armv6 cpu,
  such as the one found in the RPi, don't have it, and just hang when we try
  to access it.

Modified:
  head/sys/arm/arm/swtch.S
  head/sys/arm/include/pcpu.h

Modified: head/sys/arm/arm/swtch.S
==============================================================================
--- head/sys/arm/arm/swtch.S	Sun Feb  2 22:26:30 2014	(r261418)
+++ head/sys/arm/arm/swtch.S	Sun Feb  2 23:29:51 2014	(r261419)
@@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$");
 
 #define DOMAIN_CLIENT	0x01
 
-#ifdef _ARM_ARCH_6
+#if defined(_ARM_ARCH_6) && defined(SMP)
 #define GET_PCPU(tmp, tmp2) \
 	mrc 	p15, 0, tmp, c0, c0, 5;	\
 	and	tmp, tmp, #0xf;		\
@@ -240,8 +240,7 @@ ENTRY(cpu_switch)
 	/* Process is now on a processor. */
 	/* We have a new curthread now so make a note it */
 	GET_PCPU(r7, r2)
-	add	r7, r7, #PC_CURTHREAD
-	str	r1, [r7]
+	str	r1, [r7, #PC_CURTHREAD]
 #ifndef ARM_TP_ADDRESS
 	mcr	p15, 0, r1, c13, c0, 4
 #endif

Modified: head/sys/arm/include/pcpu.h
==============================================================================
--- head/sys/arm/include/pcpu.h	Sun Feb  2 22:26:30 2014	(r261418)
+++ head/sys/arm/include/pcpu.h	Sun Feb  2 23:29:51 2014	(r261419)
@@ -65,11 +65,15 @@ extern struct pcpu *pcpup;
 
 #define CPU_MASK (0xf)
 
+#ifndef SMP
+#define get_pcpu() (pcpup)
+#else
 #define get_pcpu() __extension__ ({			  		\
     	int id;								\
         __asm __volatile("mrc p15, 0, %0, c0, c0, 5" : "=r" (id));	\
     	(pcpup + (id & CPU_MASK));					\
     })
+#endif
 	
 static inline struct thread *
 get_curthread(void)


More information about the svn-src-head mailing list