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
This commit is contained in:
Emmanuel Vadot 2022-08-02 10:27:00 +02:00
parent a7727e1a6d
commit 789dbdbb48

View File

@ -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_ */