From a9cfb53b21284e450083d9ba864f9dcade501d90 Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Wed, 13 Oct 2021 09:41:50 +0300 Subject: [PATCH] Handle base system LinuxKPI addition after 1300517. --- drivers/gpu/drm/drm_cache.c | 3 ++- drivers/gpu/drm/drm_os_freebsd.h | 3 ++- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 3 ++- linuxkpi/gplv2/include/linux/highmem.h | 3 ++- linuxkpi/gplv2/include/linux/page.h | 6 ++++-- linuxkpi/gplv2/include/linux/scatterlist.h | 3 ++- linuxkpi/gplv2/src/linux_page.c | 6 ++++-- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 95843d905ae..a9754cfabb2 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -36,7 +36,8 @@ #if defined(CONFIG_X86) #include -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) #define clflushopt(addr) linux_clflushopt(addr) #endif diff --git a/drivers/gpu/drm/drm_os_freebsd.h b/drivers/gpu/drm/drm_os_freebsd.h index f58fcb329e1..abf825e1fb9 100644 --- a/drivers/gpu/drm/drm_os_freebsd.h +++ b/drivers/gpu/drm/drm_os_freebsd.h @@ -103,7 +103,8 @@ do { \ ({ __typeof__(*(ptr)) __tmp; \ memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) #define page_to_phys(x) VM_PAGE_TO_PHYS(x) #endif diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c index 8195f2132b9..28205c35616 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c @@ -33,7 +33,8 @@ #ifdef __FreeBSD__ /* CEM: Make sure we got the Linux version */ CTASSERT(PAGE_MASK != (PAGE_SIZE - 1)); -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) #define clflushopt linux_clflushopt #endif #include diff --git a/linuxkpi/gplv2/include/linux/highmem.h b/linuxkpi/gplv2/include/linux/highmem.h index 5c1bf89b8e9..abd5b34e3b6 100644 --- a/linuxkpi/gplv2/include/linux/highmem.h +++ b/linuxkpi/gplv2/include/linux/highmem.h @@ -1,5 +1,6 @@ #include -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) #ifndef _LINUX_HIGHMEM_H_ #define _LINUX_HIGHMEM_H_ diff --git a/linuxkpi/gplv2/include/linux/page.h b/linuxkpi/gplv2/include/linux/page.h index dea84dab234..fbe9acb455f 100644 --- a/linuxkpi/gplv2/include/linux/page.h +++ b/linuxkpi/gplv2/include/linux/page.h @@ -4,7 +4,8 @@ #include_next #include -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) #define PAGE_KERNEL_IO 0x0000 /* XXX note that this is incomplete */ @@ -31,7 +32,8 @@ int set_pages_wb(vm_page_t page, int numpages); int set_pages_uc(vm_page_t page, int numpages); int set_pages_wc(vm_page_t page, int numpages); -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) vm_paddr_t page_to_phys(vm_page_t page); void unmap_mapping_range(void *obj, loff_t const holebegin, diff --git a/linuxkpi/gplv2/include/linux/scatterlist.h b/linuxkpi/gplv2/include/linux/scatterlist.h index a7803411e64..e2a1e0dabb6 100644 --- a/linuxkpi/gplv2/include/linux/scatterlist.h +++ b/linuxkpi/gplv2/include/linux/scatterlist.h @@ -32,7 +32,8 @@ #include_next #include -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) static inline size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents, const void *buf, size_t buflen) diff --git a/linuxkpi/gplv2/src/linux_page.c b/linuxkpi/gplv2/src/linux_page.c index c6f7ce325b1..fb38b8e6166 100644 --- a/linuxkpi/gplv2/src/linux_page.c +++ b/linuxkpi/gplv2/src/linux_page.c @@ -49,7 +49,8 @@ #include -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) #if defined(__LP64__) #define LINUXKPI_HAVE_DMAP #else @@ -213,7 +214,8 @@ arch_io_free_memtype_wc(resource_size_t start, resource_size_t size) set_memory_wb(start, size >> PAGE_SHIFT); } -#if __FreeBSD_version <= 1400033 +#if ((__FreeBSD_version <= 1400033) && (__FreeBSD_version >= 1400000) || \ + (__FreeBSD_version <= 1300516)) vm_paddr_t page_to_phys(vm_page_t page) {