From 4600d349be85ff2868868c298e4ecbb6402f8586 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 3 Jul 2017 02:01:16 +0000 Subject: [PATCH] Let io_mapping_init_wc() fall back to an uncacheable mapping. This allows usage of the function on architectures that don't support write-combining. Reported by: bz, emaste X-MFC With: r320196 --- sys/compat/linuxkpi/common/include/linux/io-mapping.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/io-mapping.h b/sys/compat/linuxkpi/common/include/linux/io-mapping.h index 7c92c50d637a..12643be9c6e6 100644 --- a/sys/compat/linuxkpi/common/include/linux/io-mapping.h +++ b/sys/compat/linuxkpi/common/include/linux/io-mapping.h @@ -53,8 +53,13 @@ io_mapping_init_wc(struct io_mapping *mapping, resource_size_t base, mapping->base = base; mapping->size = size; +#ifdef VM_MEMATTR_WRITE_COMBINING mapping->mem = ioremap_wc(base, size); mapping->attr = VM_MEMATTR_WRITE_COMBINING; +#else + mapping->mem = ioremap_nocache(base, size); + mapping->attr = VM_MEMATTR_UNCACHEABLE; +#endif return (mapping); }