git: 567ee6830d8d - stable/13 - linuxkpi: Add arch_io_{reserve,free}_memtype_wc
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 07 Sep 2022 15:10:18 UTC
The branch stable/13 has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=567ee6830d8d79a9a537b9cd0e4ac08817592019
commit 567ee6830d8d79a9a537b9cd0e4ac08817592019
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-08-02 08:27:00 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-09-07 15:09:04 +0000
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
(cherry picked from commit 789dbdbb485749340110be550a03c6df22bc9c9c)
---
sys/compat/linuxkpi/common/include/linux/io.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h
index d2ebf7e328cf..5c3e4bec5484 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.
@@ -490,4 +491,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_ */