diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 03:17:17 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 03:17:17 -0400 |
commit | ef48e8e3498605351f91f195cc9af0ef981b0dde (patch) | |
tree | f2fc373ebcc3569687b06005578c9bf1389e0a5b /include | |
parent | 801e045860586b6a4ca21b3269d111dfca7ef17b (diff) |
sh: Free up some and document PTEL flags.
Drop _PAGE_SHARED/_PAGE_U0_SHARED and document Linux PTE encodings in
the PTEL value. Preserve the swap cache entry encoding semantics for
now, though it will need rework to free up _PAGE_WT from _PAGE_FILE.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sh/pgtable.h | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index 9728b58f7c13..41c559d8ba87 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h | |||
@@ -54,20 +54,41 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | |||
54 | #define VMALLOC_START (P3SEG+0x00100000) | 54 | #define VMALLOC_START (P3SEG+0x00100000) |
55 | #define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) | 55 | #define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) |
56 | 56 | ||
57 | #define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */ | 57 | /* |
58 | #define _PAGE_HW_SHARED 0x002 /* SH-bit : page is shared among processes */ | 58 | * Linux PTEL encoding. |
59 | #define _PAGE_DIRTY 0x004 /* D-bit : page changed */ | 59 | * |
60 | #define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ | 60 | * Hardware and software bit definitions for the PTEL value: |
61 | #define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */ | 61 | * |
62 | #define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ | 62 | * - Bits 0 and 7 are reserved on SH-3 (_PAGE_WT and _PAGE_SZ1 on SH-4). |
63 | #define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ | 63 | * |
64 | #define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */ | 64 | * - Bit 1 is the SH-bit, but is unused on SH-3 due to an MMU bug (the |
65 | #define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ | 65 | * hardware PTEL value can't have the SH-bit set when MMUCR.IX is set, |
66 | #define _PAGE_PROTNONE 0x200 /* software: if not present */ | 66 | * which is the default in cpu-sh3/mmu_context.h:MMU_CONTROL_INIT). |
67 | #define _PAGE_ACCESSED 0x400 /* software: page referenced */ | 67 | * |
68 | #define _PAGE_U0_SHARED 0x800 /* software: page is shared in user space */ | 68 | * In order to keep this relatively clean, do not use these for defining |
69 | 69 | * SH-3 specific flags until all of the other unused bits have been | |
70 | #define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */ | 70 | * exhausted. |
71 | * | ||
72 | * - Bit 9 is reserved by everyone and used by _PAGE_PROTNONE. | ||
73 | * | ||
74 | * - Bits 10 and 11 are low bits of the PPN that are reserved on >= 4K pages. | ||
75 | * Bit 10 is used for _PAGE_ACCESSED, bit 11 remains unused. | ||
76 | * | ||
77 | * - Bits 31, 30, and 29 remain unused by everyone and can be used for future | ||
78 | * software flags, although care must be taken to update _PAGE_CLEAR_FLAGS. | ||
79 | */ | ||
80 | #define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */ | ||
81 | #define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */ | ||
82 | #define _PAGE_DIRTY 0x004 /* D-bit : page changed */ | ||
83 | #define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ | ||
84 | #define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */ | ||
85 | #define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ | ||
86 | #define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ | ||
87 | #define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */ | ||
88 | #define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ | ||
89 | #define _PAGE_PROTNONE 0x200 /* software: if not present */ | ||
90 | #define _PAGE_ACCESSED 0x400 /* software: page referenced */ | ||
91 | #define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */ | ||
71 | 92 | ||
72 | /* software: moves to PTEA.TC (Timing Control) */ | 93 | /* software: moves to PTEA.TC (Timing Control) */ |
73 | #define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ | 94 | #define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ |
@@ -82,22 +103,17 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | |||
82 | #define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ | 103 | #define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ |
83 | #define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ | 104 | #define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ |
84 | 105 | ||
85 | /* Mask which drop software flags | 106 | /* Mask which drops unused bits from the PTEL value */ |
86 | * We also drop WT bit since it is used for _PAGE_FILE | 107 | #ifdef CONFIG_CPU_SH3 |
87 | * bit in this implementation. | 108 | #define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \ |
88 | */ | 109 | _PAGE_FILE | _PAGE_SZ1 | \ |
89 | #define _PAGE_CLEAR_FLAGS (_PAGE_WT | _PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_U0_SHARED) | 110 | _PAGE_HW_SHARED) |
90 | |||
91 | #if defined(CONFIG_CPU_SH3) | ||
92 | /* | ||
93 | * MMU on SH-3 has bug on SH-bit: We can't use it if MMUCR.IX=1. | ||
94 | * Work around: Just drop SH-bit. | ||
95 | */ | ||
96 | #define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS | _PAGE_HW_SHARED)) | ||
97 | #else | 111 | #else |
98 | #define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS)) | 112 | #define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE) |
99 | #endif | 113 | #endif |
100 | 114 | ||
115 | #define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS)) | ||
116 | |||
101 | /* Hardware flags: SZ0=1 (4k-byte) */ | 117 | /* Hardware flags: SZ0=1 (4k-byte) */ |
102 | #define _PAGE_FLAGS_HARD _PAGE_SZ0 | 118 | #define _PAGE_FLAGS_HARD _PAGE_SZ0 |
103 | 119 | ||
@@ -107,17 +123,15 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | |||
107 | #define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1) | 123 | #define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1) |
108 | #endif | 124 | #endif |
109 | 125 | ||
110 | #define _PAGE_SHARED _PAGE_U0_SHARED | ||
111 | |||
112 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) | 126 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) |
113 | #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) | 127 | #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) |
114 | #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_SHARED) | 128 | #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY) |
115 | 129 | ||
116 | #ifndef __ASSEMBLY__ | 130 | #ifndef __ASSEMBLY__ |
117 | 131 | ||
118 | #ifdef CONFIG_MMU | 132 | #ifdef CONFIG_MMU |
119 | #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) | 133 | #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) |
120 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_SHARED | _PAGE_FLAGS_HARD) | 134 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) |
121 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) | 135 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) |
122 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) | 136 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) |
123 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) | 137 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) |