-/* $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
#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);
/* 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,