summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/cacheflush.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/cacheflush.h')
-rw-r--r--arch/x86/include/asm/cacheflush.h38
1 files changed, 24 insertions, 14 deletions
diff --git a/arch/x86/include/asm/cacheflush.h b/arch/x86/include/asm/cacheflush.h
index 9863ee3..157644b 100644
--- a/arch/x86/include/asm/cacheflush.h
+++ b/arch/x86/include/asm/cacheflush.h
@@ -9,10 +9,10 @@
/*
* X86 PAT uses page flags WC and Uncached together to keep track of
* memory type of pages that have backing page struct. X86 PAT supports 3
- * different memory types, _PAGE_CACHE_WB, _PAGE_CACHE_WC and
- * _PAGE_CACHE_UC_MINUS and fourth state where page's memory type has not
+ * different memory types, _PAGE_CACHE_MODE_WB, _PAGE_CACHE_MODE_WC and
+ * _PAGE_CACHE_MODE_UC_MINUS and fourth state where page's memory type has not
* been changed from its default (value of -1 used to denote this).
- * Note we do not support _PAGE_CACHE_UC here.
+ * Note we do not support _PAGE_CACHE_MODE_UC here.
*/
#define _PGMT_DEFAULT 0
@@ -22,36 +22,40 @@
#define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1)
#define _PGMT_CLEAR_MASK (~_PGMT_MASK)
-static inline unsigned long get_page_memtype(struct page *pg)
+static inline enum page_cache_mode get_page_memtype(struct page *pg)
{
unsigned long pg_flags = pg->flags & _PGMT_MASK;
if (pg_flags == _PGMT_DEFAULT)
return -1;
else if (pg_flags == _PGMT_WC)
- return _PAGE_CACHE_WC;
+ return _PAGE_CACHE_MODE_WC;
else if (pg_flags == _PGMT_UC_MINUS)
- return _PAGE_CACHE_UC_MINUS;
+ return _PAGE_CACHE_MODE_UC_MINUS;
else
- return _PAGE_CACHE_WB;
+ return _PAGE_CACHE_MODE_WB;
}
-static inline void set_page_memtype(struct page *pg, unsigned long memtype)
+static inline void set_page_memtype(struct page *pg,
+ enum page_cache_mode memtype)
{
- unsigned long memtype_flags = _PGMT_DEFAULT;
+ unsigned long memtype_flags;
unsigned long old_flags;
unsigned long new_flags;
switch (memtype) {
- case _PAGE_CACHE_WC:
+ case _PAGE_CACHE_MODE_WC:
memtype_flags = _PGMT_WC;
break;
- case _PAGE_CACHE_UC_MINUS:
+ case _PAGE_CACHE_MODE_UC_MINUS:
memtype_flags = _PGMT_UC_MINUS;
break;
- case _PAGE_CACHE_WB:
+ case _PAGE_CACHE_MODE_WB:
memtype_flags = _PGMT_WB;
break;
+ default:
+ memtype_flags = _PGMT_DEFAULT;
+ break;
}
do {
@@ -60,8 +64,14 @@ static inline void set_page_memtype(struct page *pg, unsigned long memtype)
} while (cmpxchg(&pg->flags, old_flags, new_flags) != old_flags);
}
#else
-static inline unsigned long get_page_memtype(struct page *pg) { return -1; }
-static inline void set_page_memtype(struct page *pg, unsigned long memtype) { }
+static inline enum page_cache_mode get_page_memtype(struct page *pg)
+{
+ return -1;
+}
+static inline void set_page_memtype(struct page *pg,
+ enum page_cache_mode memtype)
+{
+}
#endif
/*
OpenPOWER on IntegriCloud