summaryrefslogtreecommitdiffstats
path: root/sys/arm/include
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
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')
-rw-r--r--sys/arm/include/asmacros.h7
-rw-r--r--sys/arm/include/pcpu.h31
2 files changed, 27 insertions, 11 deletions
diff --git a/sys/arm/include/asmacros.h b/sys/arm/include/asmacros.h
index ff92cc6..8796ae8 100644
--- a/sys/arm/include/asmacros.h
+++ b/sys/arm/include/asmacros.h
@@ -241,15 +241,15 @@ name:
#ifdef _ARM_ARCH_6
#define AST_LOCALS
#define GET_CURTHREAD_PTR(tmp) \
- mrc p15, 0, tmp, c13, c0, 4; \
- add tmp, tmp, #(PC_CURTHREAD)
+ mrc p15, 0, tmp, c13, c0, 4
#else
#define AST_LOCALS ;\
.Lcurthread: ;\
.word _C_LABEL(__pcpu) + PC_CURTHREAD
#define GET_CURTHREAD_PTR(tmp) \
- ldr tmp, .Lcurthread
+ ldr tmp, .Lcurthread; \
+ ldr tmp, [tmp]
#endif
#define DO_AST \
@@ -262,7 +262,6 @@ name:
bne 2f /* Nope, get out now */ ;\
bic r4, r4, #(I32_bit|F32_bit) ;\
1: GET_CURTHREAD_PTR(r5) ;\
- ldr r5, [r5] ;\
ldr r1, [r5, #(TD_FLAGS)] ;\
and r1, r1, #(TDF_ASTPENDING|TDF_NEEDRESCHED) ;\
teq r1, #0x00000000 ;\
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