summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-08-20 19:33:32 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-08-20 19:33:32 +0000
commit8220017759203f9a52665bc9824c10382916df6a (patch)
tree083cfe3d12e543550194d2dca67db987f2683831 /sys/dev
parentdc5a48c91272431fefeb3d0c347421d299206db3 (diff)
Add arm64 support. On ARM write-combining translates into the normal uncached
memory attribute and uncached translates into device-nGnRnE memory. This complicates the mapping onto PMAP_WC, PMAP_NOCACHE and PMAP_DEVICE a bit since the requirements of the drm(4) subsystem don't quite match the natural definitions for these. ok jsg@, mpi@, visa@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/drm_linux.h22
-rw-r--r--sys/dev/pci/drm/ttm/ttm_bo_util.c9
2 files changed, 26 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h
index 40f0da1f614..ba24e5faa83 100644
--- a/sys/dev/pci/drm/drm_linux.h
+++ b/sys/dev/pci/drm/drm_linux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.h,v 1.90 2018/07/27 21:11:31 kettenis Exp $ */
+/* $OpenBSD: drm_linux.h,v 1.91 2018/08/20 19:33:31 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
* Copyright (c) 2017 Martin Pieuchot
@@ -2120,6 +2120,26 @@ typedef int pgprot_t;
#define pgprot_val(v) (v)
#define PAGE_KERNEL 0
+static inline pgprot_t
+pgprot_writecombine(pgprot_t prot)
+{
+#ifdef PMAP_WC
+ return prot | PMAP_WC;
+#else
+ return prot | PMAP_NOCACHE;
+#endif
+}
+
+static inline pgprot_t
+pgprot_noncached(pgprot_t prot)
+{
+#ifdef PMAP_DEVICE
+ return prot | PMAP_DEVICE;
+#else
+ return prot | PMAP_NOCACHE;
+#endif
+}
+
void *kmap(struct vm_page *);
void kunmap(void *addr);
void *vmap(struct vm_page **, unsigned int, unsigned long, pgprot_t);
diff --git a/sys/dev/pci/drm/ttm/ttm_bo_util.c b/sys/dev/pci/drm/ttm/ttm_bo_util.c
index 13f408af6df..b065bba5b3e 100644
--- a/sys/dev/pci/drm/ttm/ttm_bo_util.c
+++ b/sys/dev/pci/drm/ttm/ttm_bo_util.c
@@ -517,12 +517,13 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp)
/* Cached mappings need no adjustment */
if (caching_flags & TTM_PL_FLAG_CACHED)
return tmp;
-#ifdef PMAP_WC
+
if (caching_flags & TTM_PL_FLAG_WC)
- return PMAP_WC;
+ tmp = pgprot_writecombine(tmp);
else
-#endif
- return PMAP_NOCACHE;
+ tmp = pgprot_noncached(tmp);
+
+ return tmp;
}
static int ttm_bo_ioremap(struct ttm_buffer_object *bo,