aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2022-08-02 08:27:00 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2022-08-08 13:22:36 +0000
commit789dbdbb485749340110be550a03c6df22bc9c9c (patch)
tree5da54d8c2533326f0b3020cb713fe6a0f1068253
parenta7727e1a6d5d6120d439af222f58345b4932100c (diff)
downloadsrc-789dbdbb485749340110be550a03c6df22bc9c9c.tar.gz
src-789dbdbb485749340110be550a03c6df22bc9c9c.zip
linuxkpi: Add arch_io_{reserve,free}_memtype_wc
Reviewed by: hselasky Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36022
-rw-r--r--sys/compat/linuxkpi/common/include/linux/io.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h
index 0790e518a1a3..32183707c255 100644
--- a/sys/compat/linuxkpi/common/include/linux/io.h
+++ b/sys/compat/linuxkpi/common/include/linux/io.h
@@ -38,6 +38,7 @@
#include <linux/compiler.h>
#include <linux/types.h>
+#include <asm/set_memory.h>
/*
* XXX This is all x86 specific. It should be bus space access.
@@ -494,4 +495,19 @@ void lkpi_arch_phys_wc_del(int);
#define arch_phys_wc_index(x) \
(((x) < __MTRR_ID_BASE) ? -1 : ((x) - __MTRR_ID_BASE))
+#if defined(__amd64__) || defined(__i386__) || defined(__aarch64__) || defined(__powerpc__) || defined(__riscv)
+static inline int
+arch_io_reserve_memtype_wc(resource_size_t start, resource_size_t size)
+{
+
+ return (set_memory_wc(start, size >> PAGE_SHIFT));
+}
+
+static inline void
+arch_io_free_memtype_wc(resource_size_t start, resource_size_t size)
+{
+ set_memory_wb(start, size >> PAGE_SHIFT);
+}
+#endif
+
#endif /* _LINUXKPI_LINUX_IO_H_ */