Commit 3a96ce8c authored by venkatesh.pallipadi@intel.com's avatar venkatesh.pallipadi@intel.com Committed by Ingo Molnar

x86: PAT make ioremap_change_attr non-static

Make ioremap_change_attr() non-static and use prot_val in place of ioremap_mode.
This interface is used in subsequent PAT patches.
Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 55c62682
...@@ -20,11 +20,6 @@ ...@@ -20,11 +20,6 @@
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
enum ioremap_mode {
IOR_MODE_UNCACHED,
IOR_MODE_CACHED,
};
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
unsigned long __phys_addr(unsigned long x) unsigned long __phys_addr(unsigned long x)
...@@ -90,18 +85,18 @@ int page_is_ram(unsigned long pagenr) ...@@ -90,18 +85,18 @@ int page_is_ram(unsigned long pagenr)
* Fix up the linear direct mapping of the kernel to avoid cache attribute * Fix up the linear direct mapping of the kernel to avoid cache attribute
* conflicts. * conflicts.
*/ */
static int ioremap_change_attr(unsigned long vaddr, unsigned long size, int ioremap_change_attr(unsigned long vaddr, unsigned long size,
enum ioremap_mode mode) unsigned long prot_val)
{ {
unsigned long nrpages = size >> PAGE_SHIFT; unsigned long nrpages = size >> PAGE_SHIFT;
int err; int err;
switch (mode) { switch (prot_val) {
case IOR_MODE_UNCACHED: case _PAGE_CACHE_UC:
default: default:
err = set_memory_uc(vaddr, nrpages); err = set_memory_uc(vaddr, nrpages);
break; break;
case IOR_MODE_CACHED: case _PAGE_CACHE_WB:
err = set_memory_wb(vaddr, nrpages); err = set_memory_wb(vaddr, nrpages);
break; break;
} }
...@@ -119,7 +114,7 @@ static int ioremap_change_attr(unsigned long vaddr, unsigned long size, ...@@ -119,7 +114,7 @@ static int ioremap_change_attr(unsigned long vaddr, unsigned long size,
* caller shouldn't need to know that small detail. * caller shouldn't need to know that small detail.
*/ */
static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size, static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size,
enum ioremap_mode mode) unsigned long prot_val)
{ {
unsigned long pfn, offset, last_addr, vaddr; unsigned long pfn, offset, last_addr, vaddr;
struct vm_struct *area; struct vm_struct *area;
...@@ -156,12 +151,12 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size, ...@@ -156,12 +151,12 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size,
WARN_ON_ONCE(is_ram); WARN_ON_ONCE(is_ram);
} }
switch (mode) { switch (prot_val) {
case IOR_MODE_UNCACHED: case _PAGE_CACHE_UC:
default: default:
prot = PAGE_KERNEL_NOCACHE; prot = PAGE_KERNEL_NOCACHE;
break; break;
case IOR_MODE_CACHED: case _PAGE_CACHE_WB:
prot = PAGE_KERNEL; prot = PAGE_KERNEL;
break; break;
} }
...@@ -186,7 +181,7 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size, ...@@ -186,7 +181,7 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size,
return NULL; return NULL;
} }
if (ioremap_change_attr(vaddr, size, mode) < 0) { if (ioremap_change_attr(vaddr, size, prot_val) < 0) {
vunmap(area->addr); vunmap(area->addr);
return NULL; return NULL;
} }
...@@ -217,13 +212,13 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size, ...@@ -217,13 +212,13 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size,
*/ */
void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size)
{ {
return __ioremap(phys_addr, size, IOR_MODE_UNCACHED); return __ioremap(phys_addr, size, _PAGE_CACHE_UC);
} }
EXPORT_SYMBOL(ioremap_nocache); EXPORT_SYMBOL(ioremap_nocache);
void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size) void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
{ {
return __ioremap(phys_addr, size, IOR_MODE_CACHED); return __ioremap(phys_addr, size, _PAGE_CACHE_WB);
} }
EXPORT_SYMBOL(ioremap_cache); EXPORT_SYMBOL(ioremap_cache);
......
...@@ -3,3 +3,6 @@ ...@@ -3,3 +3,6 @@
#else #else
# include "io_64.h" # include "io_64.h"
#endif #endif
extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
unsigned long prot_val);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment