Commit a8fac05a authored by Guo Ren's avatar Guo Ren

csky: pgtable.h: Coding convention

C-SKY page table attributes only have 'Dirty' and 'Valid' to
emulate 'PRESENT, READ, WRITE, EXEC, DIRTY, ACCESSED'.

This patch cleanup unnecessary definition.
Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
parent 5e144c42
...@@ -5,33 +5,24 @@ ...@@ -5,33 +5,24 @@
#define __ASM_CSKY_PGTABLE_BITS_H #define __ASM_CSKY_PGTABLE_BITS_H
/* implemented in software */ /* implemented in software */
#define _PAGE_ACCESSED (1<<3) #define _PAGE_PRESENT (1<<0)
#define PAGE_ACCESSED_BIT (3)
#define _PAGE_READ (1<<1) #define _PAGE_READ (1<<1)
#define _PAGE_WRITE (1<<2) #define _PAGE_WRITE (1<<2)
#define _PAGE_PRESENT (1<<0) #define _PAGE_ACCESSED (1<<3)
#define _PAGE_MODIFIED (1<<4) #define _PAGE_MODIFIED (1<<4)
#define PAGE_MODIFIED_BIT (4)
/* implemented in hardware */ /* implemented in hardware */
#define _PAGE_GLOBAL (1<<6) #define _PAGE_GLOBAL (1<<6)
#define _PAGE_VALID (1<<7) #define _PAGE_VALID (1<<7)
#define PAGE_VALID_BIT (7)
#define _PAGE_DIRTY (1<<8) #define _PAGE_DIRTY (1<<8)
#define PAGE_DIRTY_BIT (8)
#define _PAGE_CACHE (3<<9) #define _PAGE_CACHE (3<<9)
#define _PAGE_UNCACHE (2<<9) #define _PAGE_UNCACHE (2<<9)
#define _PAGE_SO _PAGE_UNCACHE #define _PAGE_SO _PAGE_UNCACHE
#define _CACHE_MASK (7<<9) #define _CACHE_MASK (7<<9)
#define _CACHE_CACHED (_PAGE_VALID | _PAGE_CACHE) #define _CACHE_CACHED _PAGE_CACHE
#define _CACHE_UNCACHED (_PAGE_VALID | _PAGE_UNCACHE) #define _CACHE_UNCACHED _PAGE_UNCACHE
#define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA
......
...@@ -6,32 +6,22 @@ ...@@ -6,32 +6,22 @@
/* implemented in software */ /* implemented in software */
#define _PAGE_ACCESSED (1<<7) #define _PAGE_ACCESSED (1<<7)
#define PAGE_ACCESSED_BIT (7)
#define _PAGE_READ (1<<8) #define _PAGE_READ (1<<8)
#define _PAGE_WRITE (1<<9) #define _PAGE_WRITE (1<<9)
#define _PAGE_PRESENT (1<<10) #define _PAGE_PRESENT (1<<10)
#define _PAGE_MODIFIED (1<<11) #define _PAGE_MODIFIED (1<<11)
#define PAGE_MODIFIED_BIT (11)
/* implemented in hardware */ /* implemented in hardware */
#define _PAGE_GLOBAL (1<<0) #define _PAGE_GLOBAL (1<<0)
#define _PAGE_VALID (1<<1) #define _PAGE_VALID (1<<1)
#define PAGE_VALID_BIT (1)
#define _PAGE_DIRTY (1<<2) #define _PAGE_DIRTY (1<<2)
#define PAGE_DIRTY_BIT (2)
#define _PAGE_SO (1<<5) #define _PAGE_SO (1<<5)
#define _PAGE_BUF (1<<6) #define _PAGE_BUF (1<<6)
#define _PAGE_CACHE (1<<3) #define _PAGE_CACHE (1<<3)
#define _CACHE_MASK _PAGE_CACHE #define _CACHE_MASK _PAGE_CACHE
#define _CACHE_CACHED (_PAGE_VALID | _PAGE_CACHE | _PAGE_BUF) #define _CACHE_CACHED (_PAGE_CACHE | _PAGE_BUF)
#define _CACHE_UNCACHED (_PAGE_VALID) #define _CACHE_UNCACHED (0)
#endif /* __ASM_CSKY_PGTABLE_BITS_H */ #endif /* __ASM_CSKY_PGTABLE_BITS_H */
...@@ -41,9 +41,6 @@ ...@@ -41,9 +41,6 @@
#define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) \ #define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) \
| pgprot_val(prot)) | pgprot_val(prot))
#define __READABLE (_PAGE_READ | _PAGE_VALID | _PAGE_ACCESSED)
#define __WRITEABLE (_PAGE_WRITE | _PAGE_DIRTY | _PAGE_MODIFIED)
#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | \ #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | \
_CACHE_MASK) _CACHE_MASK)
...@@ -59,43 +56,46 @@ ...@@ -59,43 +56,46 @@
pgprot_val(pgprot)) pgprot_val(pgprot))
/* /*
* CSKY can't do page protection for execute, and considers that the same like * C-SKY only has VALID and DIRTY bit in hardware. So we need to use the
* read. Also, write permissions imply read permissions. This is the closest * two bits emulate PRESENT, READ, WRITE, EXEC, MODIFIED, ACCESSED.
* we can get by reasonable means..
*/ */
#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED) #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED)
#define PAGE_NONE __pgprot(_PAGE_BASE | _CACHE_CACHED) #define PAGE_NONE __pgprot(_PAGE_BASE | \
#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE | \ _CACHE_CACHED)
#define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ | \
_CACHE_CACHED) _CACHE_CACHED)
#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_READ | _CACHE_CACHED) #define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE | \
#define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_READ | _CACHE_CACHED) _CACHE_CACHED)
#define PAGE_KERNEL __pgprot(_PAGE_BASE | __READABLE | __WRITEABLE | \ #define PAGE_SHARED PAGE_WRITE
_PAGE_GLOBAL | _CACHE_CACHED)
#define PAGE_USERIO __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE | \ #define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_VALID | \
_PAGE_WRITE | _PAGE_DIRTY | _PAGE_MODIFIED | \
_PAGE_GLOBAL | \
_CACHE_CACHED) _CACHE_CACHED)
#define _PAGE_IOREMAP \ #define _PAGE_IOREMAP (_PAGE_BASE | _PAGE_READ | _PAGE_VALID | \
(_PAGE_BASE | __READABLE | __WRITEABLE | _PAGE_GLOBAL | \ _PAGE_WRITE | _PAGE_DIRTY | _PAGE_MODIFIED | \
_CACHE_UNCACHED | _PAGE_SO) _PAGE_GLOBAL | \
_CACHE_UNCACHED | _PAGE_SO)
#define __P000 PAGE_NONE #define __P000 PAGE_NONE
#define __P001 PAGE_READONLY #define __P001 PAGE_READ
#define __P010 PAGE_COPY #define __P010 PAGE_READ
#define __P011 PAGE_COPY #define __P011 PAGE_READ
#define __P100 PAGE_READONLY #define __P100 PAGE_READ
#define __P101 PAGE_READONLY #define __P101 PAGE_READ
#define __P110 PAGE_COPY #define __P110 PAGE_READ
#define __P111 PAGE_COPY #define __P111 PAGE_READ
#define __S000 PAGE_NONE #define __S000 PAGE_NONE
#define __S001 PAGE_READONLY #define __S001 PAGE_READ
#define __S010 PAGE_SHARED #define __S010 PAGE_WRITE
#define __S011 PAGE_SHARED #define __S011 PAGE_WRITE
#define __S100 PAGE_READONLY #define __S100 PAGE_READ
#define __S101 PAGE_READONLY #define __S101 PAGE_READ
#define __S110 PAGE_SHARED #define __S110 PAGE_WRITE
#define __S111 PAGE_SHARED #define __S111 PAGE_WRITE
extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
......
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