Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2016 07:49:40 -0700
From:      Conrad Meyer <cem@FreeBSD.org>
To:        Hans Petter Selasky <hselasky@freebsd.org>, Matthew Macy <mmacy@nextbsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r299364 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <CAG6CVpUX399fRcLod5UVgrds_xCYdD5KwDzw5WhWKtzGcQTwkw@mail.gmail.com>
In-Reply-To: <201605101204.u4AC4vhR007264@repo.freebsd.org>
References:  <201605101204.u4AC4vhR007264@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 10, 2016 at 5:04 AM, Hans Petter Selasky
<hselasky@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpUX399fRcLod5UVgrds_xCYdD5KwDzw5WhWKtzGcQTwkw>