summaryrefslogtreecommitdiff
path: root/sys/arch/arm
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2013-05-09 20:07:27 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2013-05-09 20:07:27 +0000
commit89307efdeee699ce5deeb8e6f7c527e1328869e3 (patch)
tree6fdf0a0b12d828515fd3a60f053bf6d74f1d425a /sys/arch/arm
parentbb458b14b6c2852decfe62ec88b95480c931e8bb (diff)
On ARMv7 we can't use the cache mask to check for coherency.
Therefore we add new macros to be able to check for it properly. ok miod@
Diffstat (limited to 'sys/arch/arm')
-rw-r--r--sys/arch/arm/arm/bus_dma.c8
-rw-r--r--sys/arch/arm/arm/pmap.c18
-rw-r--r--sys/arch/arm/arm/pmap7.c14
-rw-r--r--sys/arch/arm/include/pmap.h34
-rw-r--r--sys/arch/arm/include/pmap7.h34
5 files changed, 100 insertions, 8 deletions
diff --git a/sys/arch/arm/arm/bus_dma.c b/sys/arch/arm/arm/bus_dma.c
index b415c77e723..f1315c08a32 100644
--- a/sys/arch/arm/arm/bus_dma.c
+++ b/sys/arch/arm/arm/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.22 2013/05/08 21:10:33 patrick Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.23 2013/05/09 20:07:25 patrick Exp $ */
/* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */
/*-
@@ -901,7 +901,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
if (__predict_false(pmap_pde_section(pde))) {
curaddr = (*pde & L1_S_FRAME) |
(vaddr & L1_S_OFFSET);
- if (*pde & L1_S_CACHE_MASK) {
+ if (*pde & L1_S_COHERENT) {
map->_dm_flags &=
~ARM32_DMAMAP_COHERENT;
}
@@ -912,14 +912,14 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
== L2_TYPE_L)) {
curaddr = (pte & L2_L_FRAME) |
(vaddr & L2_L_OFFSET);
- if (pte & L2_L_CACHE_MASK) {
+ if (pte & L2_L_COHERENT) {
map->_dm_flags &=
~ARM32_DMAMAP_COHERENT;
}
} else {
curaddr = (pte & L2_S_FRAME) |
(vaddr & L2_S_OFFSET);
- if (pte & L2_S_CACHE_MASK) {
+ if (pte & L2_S_COHERENT) {
map->_dm_flags &=
~ARM32_DMAMAP_COHERENT;
}
diff --git a/sys/arch/arm/arm/pmap.c b/sys/arch/arm/arm/pmap.c
index b74b5e4e0ed..0e764c38df3 100644
--- a/sys/arch/arm/arm/pmap.c
+++ b/sys/arch/arm/arm/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.40 2013/05/02 03:17:13 tedu Exp $ */
+/* $OpenBSD: pmap.c,v 1.41 2013/05/09 20:07:25 patrick Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@@ -4620,6 +4620,10 @@ pt_entry_t pte_l2_s_cache_mode;
pt_entry_t pte_l2_s_cache_mode_pt;
pt_entry_t pte_l2_s_cache_mask;
+pt_entry_t pte_l1_s_coherent;
+pt_entry_t pte_l2_l_coherent;
+pt_entry_t pte_l2_s_coherent;
+
pt_entry_t pte_l2_s_prot_u;
pt_entry_t pte_l2_s_prot_w;
pt_entry_t pte_l2_s_prot_mask;
@@ -4660,6 +4664,10 @@ pmap_pte_init_generic(void)
pte_l2_s_cache_mode_pt = L2_C;
}
+ pte_l1_s_coherent = L1_S_COHERENT_generic;
+ pte_l2_l_coherent = L2_L_COHERENT_generic;
+ pte_l2_s_coherent = L2_S_COHERENT_generic;
+
pte_l2_s_prot_u = L2_S_PROT_U_generic;
pte_l2_s_prot_w = L2_S_PROT_W_generic;
pte_l2_s_prot_mask = L2_S_PROT_MASK_generic;
@@ -4777,6 +4785,10 @@ pmap_pte_init_armv7(void)
pte_l2_l_cache_mode_pt = L2_C;
pte_l2_s_cache_mode_pt = L2_C;
+ pte_l1_s_coherent = L1_S_COHERENT_v7;
+ pte_l2_l_coherent = L2_L_COHERENT_v7;
+ pte_l2_s_coherent = L2_S_COHERENT_v7;
+
pte_l2_s_prot_u = L2_S_PROT_U_v7;
pte_l2_s_prot_w = L2_S_PROT_W_v7;
pte_l2_s_prot_mask = L2_S_PROT_MASK_v7;
@@ -4903,6 +4915,10 @@ pmap_pte_init_xscale(void)
xscale_use_minidata = 1;
#endif
+ pte_l1_s_coherent = L1_S_COHERENT_xscale;
+ pte_l2_l_coherent = L2_L_COHERENT_xscale;
+ pte_l2_s_coherent = L2_S_COHERENT_xscale;
+
pte_l2_s_prot_u = L2_S_PROT_U_xscale;
pte_l2_s_prot_w = L2_S_PROT_W_xscale;
pte_l2_s_prot_mask = L2_S_PROT_MASK_xscale;
diff --git a/sys/arch/arm/arm/pmap7.c b/sys/arch/arm/arm/pmap7.c
index 4890e1712ac..96487d960a6 100644
--- a/sys/arch/arm/arm/pmap7.c
+++ b/sys/arch/arm/arm/pmap7.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap7.c,v 1.4 2013/04/28 14:39:15 patrick Exp $ */
+/* $OpenBSD: pmap7.c,v 1.5 2013/05/09 20:07:25 patrick Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@@ -3453,6 +3453,10 @@ pt_entry_t pte_l2_s_cache_mode;
pt_entry_t pte_l2_s_cache_mode_pt;
pt_entry_t pte_l2_s_cache_mask;
+pt_entry_t pte_l1_s_coherent;
+pt_entry_t pte_l2_l_coherent;
+pt_entry_t pte_l2_s_coherent;
+
pt_entry_t pte_l2_s_prot_ur;
pt_entry_t pte_l2_s_prot_uw;
pt_entry_t pte_l2_s_prot_kr;
@@ -3494,6 +3498,10 @@ pmap_pte_init_generic(void)
pte_l2_s_cache_mode_pt = L2_C;
}
+ pte_l1_s_coherent = L1_S_COHERENT_generic;
+ pte_l2_l_coherent = L2_L_COHERENT_generic;
+ pte_l2_s_coherent = L2_S_COHERENT_generic;
+
pte_l2_s_prot_ur = L2_S_PROT_UR_generic;
pte_l2_s_prot_uw = L2_S_PROT_UW_generic;
pte_l2_s_prot_kr = L2_S_PROT_KR_generic;
@@ -3520,6 +3528,10 @@ pmap_pte_init_armv7(void)
*/
pmap_pte_init_generic();
+ pte_l1_s_coherent = L1_S_COHERENT_v7;
+ pte_l2_l_coherent = L2_L_COHERENT_v7;
+ pte_l2_s_coherent = L2_S_COHERENT_v7;
+
pte_l2_s_prot_ur = L2_S_PROT_UR_v7;
pte_l2_s_prot_uw = L2_S_PROT_UW_v7;
pte_l2_s_prot_kr = L2_S_PROT_KR_v7;
diff --git a/sys/arch/arm/include/pmap.h b/sys/arch/arm/include/pmap.h
index b304b784a3b..91fd2aa887c 100644
--- a/sys/arch/arm/include/pmap.h
+++ b/sys/arch/arm/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.22 2013/04/26 11:51:22 patrick Exp $ */
+/* $OpenBSD: pmap.h,v 1.23 2013/05/09 20:07:26 patrick Exp $ */
/* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */
/*
@@ -423,6 +423,10 @@ extern pt_entry_t pte_l1_s_cache_mode_pt;
extern pt_entry_t pte_l2_l_cache_mode_pt;
extern pt_entry_t pte_l2_s_cache_mode_pt;
+extern pt_entry_t pte_l1_s_coherent;
+extern pt_entry_t pte_l2_l_coherent;
+extern pt_entry_t pte_l2_s_coherent;
+
extern pt_entry_t pte_l2_s_prot_u;
extern pt_entry_t pte_l2_s_prot_w;
extern pt_entry_t pte_l2_s_prot_mask;
@@ -459,6 +463,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L1_S_CACHE_MASK_xscale (L1_S_B|L1_S_C|L1_S_XSCALE_TEX(TEX_XSCALE_X))
#define L1_S_CACHE_MASK_v7 (L1_S_B|L1_S_C|L1_S_V7_TEX(TEX_V7_X))
+#define L1_S_COHERENT_generic (L1_S_B|L1_S_C)
+#define L1_S_COHERENT_xscale (L1_S_B|L1_S_C|L1_S_XSCALE_TEX(TEX_XSCALE_X))
+#define L1_S_COHERENT_v7 (L1_S_C|L1_S_V7_TEX(TEX_V7_X))
+
#define L2_L_PROT_U (L2_AP(AP_U))
#define L2_L_PROT_W (L2_AP(AP_W))
#define L2_L_PROT_MASK (L2_L_PROT_U|L2_L_PROT_W)
@@ -467,6 +475,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_L_TEX(TEX_XSCALE_X))
#define L2_L_CACHE_MASK_v7 (L2_B|L2_C|L2_V7_L_TEX(TEX_V7_X))
+#define L2_L_COHERENT_generic (L2_B|L2_C)
+#define L2_L_COHERENT_xscale (L2_B|L2_C|L2_XSCALE_L_TEX(TEX_XSCALE_X))
+#define L2_L_COHERENT_v7 (L2_C|L2_V7_L_TEX(TEX_V7_X))
+
#define L2_S_PROT_U_generic (L2_AP(AP_U))
#define L2_S_PROT_W_generic (L2_AP(AP_W))
#define L2_S_PROT_MASK_generic (L2_S_PROT_U|L2_S_PROT_W)
@@ -483,6 +495,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_S_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_T_TEX(TEX_XSCALE_X))
#define L2_S_CACHE_MASK_v7 (L2_B|L2_C)
+#define L2_S_COHERENT_generic (L2_B|L2_C)
+#define L2_S_COHERENT_xscale (L2_B|L2_C|L2_XSCALE_T_TEX(TEX_XSCALE_X))
+#define L2_S_COHERENT_v7 (L2_C)
+
#define L1_S_PROTO_generic (L1_TYPE_S | L1_S_IMP)
#define L1_S_PROTO_xscale (L1_TYPE_S)
#define L1_S_PROTO_v7 (L1_TYPE_S)
@@ -511,6 +527,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK pte_l2_l_cache_mask
#define L2_S_CACHE_MASK pte_l2_s_cache_mask
+#define L1_S_COHERENT pte_l1_s_coherent
+#define L2_L_COHERENT pte_l2_l_coherent
+#define L2_S_COHERENT pte_l2_s_coherent
+
#define L1_S_PROTO pte_l1_s_proto
#define L1_C_PROTO pte_l1_c_proto
#define L2_S_PROTO pte_l2_s_proto
@@ -526,6 +546,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_generic
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_generic
+#define L1_S_COHERENT L1_S_COHERENT_generic
+#define L2_L_COHERENT L2_L_COHERENT_generic
+#define L2_S_COHERENT L2_S_COHERENT_generic
+
#define L1_S_PROTO L1_S_PROTO_generic
#define L1_C_PROTO L1_C_PROTO_generic
#define L2_S_PROTO L2_S_PROTO_generic
@@ -541,6 +565,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_xscale
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_xscale
+#define L1_S_COHERENT L1_S_COHERENT_xscale
+#define L2_L_COHERENT L2_L_COHERENT_xscale
+#define L2_S_COHERENT L2_S_COHERENT_xscale
+
#define L1_S_PROTO L1_S_PROTO_xscale
#define L1_C_PROTO L1_C_PROTO_xscale
#define L2_S_PROTO L2_S_PROTO_xscale
@@ -556,6 +584,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_v7
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_v7
+#define L1_S_COHERENT L1_S_COHERENT_v7
+#define L2_L_COHERENT L2_L_COHERENT_v7
+#define L2_S_COHERENT L2_S_COHERENT_v7
+
#define L1_S_PROTO L1_S_PROTO_v7
#define L1_C_PROTO L1_C_PROTO_v7
#define L2_S_PROTO L2_S_PROTO_v7
diff --git a/sys/arch/arm/include/pmap7.h b/sys/arch/arm/include/pmap7.h
index 679a7865d36..1baab1daf6c 100644
--- a/sys/arch/arm/include/pmap7.h
+++ b/sys/arch/arm/include/pmap7.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap7.h,v 1.1 2013/04/30 13:00:21 patrick Exp $ */
+/* $OpenBSD: pmap7.h,v 1.2 2013/05/09 20:07:26 patrick Exp $ */
/* $NetBSD: pmap.h,v 1.76 2003/09/06 09:10:46 rearnsha Exp $ */
/*
@@ -434,6 +434,10 @@ extern pt_entry_t pte_l1_s_cache_mode_pt;
extern pt_entry_t pte_l2_l_cache_mode_pt;
extern pt_entry_t pte_l2_s_cache_mode_pt;
+extern pt_entry_t pte_l1_s_coherent;
+extern pt_entry_t pte_l2_l_coherent;
+extern pt_entry_t pte_l2_s_coherent;
+
extern pt_entry_t pte_l2_s_prot_ur;
extern pt_entry_t pte_l2_s_prot_uw;
extern pt_entry_t pte_l2_s_prot_kr;
@@ -472,6 +476,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L1_S_CACHE_MASK_xscale (L1_S_B|L1_S_C|L1_S_XSCALE_TEX(TEX_XSCALE_X))
#define L1_S_CACHE_MASK_v7 (L1_S_B|L1_S_C|L1_S_V7_TEX_MASK)
+#define L1_S_COHERENT_generic (L1_S_B|L1_S_C)
+#define L1_S_COHERENT_xscale (L1_S_B|L1_S_C|L1_S_XSCALE_TEX(TEX_XSCALE_X))
+#define L1_S_COHERENT_v7 (L1_S_C|L1_S_V7_TEX_MASK)
+
#define L2_L_PROT_KR (L2_AP(0))
#define L2_L_PROT_UR (L2_AP(AP_U))
#define L2_L_PROT_KW (L2_AP(AP_W))
@@ -482,6 +490,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_L_TEX(TEX_XSCALE_X))
#define L2_L_CACHE_MASK_v7 (L2_B|L2_C|L2_V7_L_TEX_MASK)
+#define L2_L_COHERENT_generic (L2_B|L2_C)
+#define L2_L_COHERENT_xscale (L2_B|L2_C|L2_XSCALE_L_TEX(TEX_XSCALE_X))
+#define L2_L_COHERENT_v7 (L2_C|L2_V7_L_TEX_MASK)
+
#define L2_S_PROT_UR_generic (L2_AP(AP_U))
#define L2_S_PROT_UW_generic (L2_AP(AP_U|AP_W))
#define L2_S_PROT_KR_generic (L2_AP(0))
@@ -504,6 +516,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_S_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_T_TEX(TEX_XSCALE_X))
#define L2_S_CACHE_MASK_v7 (L2_B|L2_C|L2_V7_S_TEX_MASK)
+#define L2_S_COHERENT_generic (L2_B|L2_C)
+#define L2_S_COHERENT_xscale (L2_B|L2_C|L2_XSCALE_T_TEX(TEX_XSCALE_X))
+#define L2_S_COHERENT_v7 (L2_C|L2_V7_S_TEX_MASK)
+
#define L1_S_PROTO_generic (L1_TYPE_S | L1_S_IMP)
#define L1_S_PROTO_xscale (L1_TYPE_S)
#define L1_S_PROTO_v7 (L1_TYPE_S)
@@ -534,6 +550,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK pte_l2_l_cache_mask
#define L2_S_CACHE_MASK pte_l2_s_cache_mask
+#define L1_S_COHERENT pte_l1_s_coherent
+#define L2_L_COHERENT pte_l2_l_coherent
+#define L2_S_COHERENT pte_l2_s_coherent
+
#define L1_S_PROTO pte_l1_s_proto
#define L1_C_PROTO pte_l1_c_proto
#define L2_S_PROTO pte_l2_s_proto
@@ -551,6 +571,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_generic
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_generic
+#define L1_S_COHERENT L1_S_COHERENT_generic
+#define L2_L_COHERENT L2_L_COHERENT_generic
+#define L2_S_COHERENT L2_S_COHERENT_generic
+
#define L1_S_PROTO L1_S_PROTO_generic
#define L1_C_PROTO L1_C_PROTO_generic
#define L2_S_PROTO L2_S_PROTO_generic
@@ -568,6 +592,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_xscale
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_xscale
+#define L1_S_COHERENT L1_S_COHERENT_xscale
+#define L2_L_COHERENT L2_L_COHERENT_xscale
+#define L2_S_COHERENT L2_S_COHERENT_xscale
+
#define L1_S_PROTO L1_S_PROTO_xscale
#define L1_C_PROTO L1_C_PROTO_xscale
#define L2_S_PROTO L2_S_PROTO_xscale
@@ -585,6 +613,10 @@ extern void (*pmap_zero_page_func)(struct vm_page *);
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_v7
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_v7
+#define L1_S_COHERENT L1_S_COHERENT_v7
+#define L2_L_COHERENT L2_L_COHERENT_v7
+#define L2_S_COHERENT L2_S_COHERENT_v7
+
#define L1_S_PROTO L1_S_PROTO_v7
#define L1_C_PROTO L1_C_PROTO_v7
#define L2_S_PROTO L2_S_PROTO_v7