summaryrefslogtreecommitdiffstats
path: root/sys/arm/include/pcpu.h
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-15 16:59:47 +0000
committerian <ian@FreeBSD.org>2014-05-15 16:59:47 +0000
commitfa992863d2953ae935e914366aeafac44ad9d005 (patch)
tree5706b407ffe7e0825c55edcf803c8fc2895b8ce6 /sys/arm/include/pcpu.h
parent36cb581eaebdc860bcc7c968ed136cfe82679379 (diff)
downloadFreeBSD-src-fa992863d2953ae935e914366aeafac44ad9d005.zip
FreeBSD-src-fa992863d2953ae935e914366aeafac44ad9d005.tar.gz
MFC r261414, r261415, r261417, r261418, r261419
Don't call device_set_ivars() for the mmchs Change the way pcpu and curthread are stored per-core Invalidate cachelines for bounce pages on PREREAD too, there may still be stale entries from a previous transfer. 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.
Diffstat (limited to 'sys/arm/include/pcpu.h')
-rw-r--r--sys/arm/include/pcpu.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/sys/arm/include/pcpu.h b/sys/arm/include/pcpu.h
index 6e0eb06..1771a8e 100644
--- a/sys/arm/include/pcpu.h
+++ b/sys/arm/include/pcpu.h
@@ -62,22 +62,36 @@ struct pcpu;
extern struct pcpu *pcpup;
#if ARM_ARCH_6 || ARM_ARCH_7A
/* or ARM_TP_ADDRESS mark REMOVE ME NOTE */
-static inline struct pcpu *
-get_pcpu(void)
+
+#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)
{
- void *pcpu;
+ void *ret;
- __asm __volatile("mrc p15, 0, %0, c13, c0, 4" : "=r" (pcpu));
- return (pcpu);
+ __asm __volatile("mrc p15, 0, %0, c13, c0, 4" : "=r" (ret));
+ return (ret);
}
static inline void
-set_pcpu(void *pcpu)
+set_curthread(struct thread *td)
{
- __asm __volatile("mcr p15, 0, %0, c13, c0, 4" : : "r" (pcpu));
+ __asm __volatile("mcr p15, 0, %0, c13, c0, 4" : : "r" (td));
}
+
static inline void *
get_tls(void)
{
@@ -93,6 +107,9 @@ set_tls(void *tls)
__asm __volatile("mcr p15, 0, %0, c13, c0, 3" : : "r" (tls));
}
+
+#define curthread get_curthread()
+
#else
#define get_pcpu() pcpup
#endif
OpenPOWER on IntegriCloud