On 05/10/16 16:49, Conrad Meyer wrote:
On Tue, May 10, 2016 at 5:04 AM, Hans Petter Selasky
<hsela...@freebsd.org> wrote:
Author: hselasky
Date: Tue May 10 12:04:57 2016
New Revision: 299364
URL: https://svnweb.freebsd.org/changeset/base/299364

Log:
  Add more LinuxKPI I/O functions.

  Obtained from:        kmacy @
...
@@ -166,5 +212,35 @@ __iowrite64_copy(void *to, void *from, s
 #endif
 }

+enum {
+       MEMREMAP_WB = 1 << 0,
+       MEMREMAP_WT = 1 << 1,
+       MEMREMAP_WC = 1 << 2,
+};
+
+static inline void *
+memremap(resource_size_t offset, size_t size, unsigned long flags)
+{
+       void *addr = NULL;
+
+       if ((flags & MEMREMAP_WB) &&
+           (addr = ioremap_wb(offset, size)) != NULL)
+               goto done;
+       if ((flags & MEMREMAP_WT) &&
+           (addr = ioremap_nocache(offset, size)) != NULL)
+               goto done;

x86 can actually map memory as WT rather than UC.  Why throw that away?

+       if ((flags & MEMREMAP_WC) &&
+           (addr = ioremap_wc(offset, size)) != NULL)
+               goto done;
+done:
+       return (addr);
+}
+
...

Hi Conrad,

I agree. I see no reason to not implement ioremap_wt() for x86 (32-bit and 64-bit) and use it for the WT case.

--HPS

_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to