svn commit: r299364 - head/sys/compat/linuxkpi/common/include/linux

Conrad Meyer cem at FreeBSD.org
Tue May 10 16:39:53 UTC 2016


On Tue, May 10, 2016 at 5:04 AM, Hans Petter Selasky
<hselasky at 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);
> +}
> +
> ...

Best,
Conrad


More information about the svn-src-all mailing list