diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-11-20 00:30:26 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-12-05 20:45:37 -0500 |
commit | 21440cf04a64cd1b1209c12a6e1a3afba2a28709 (patch) | |
tree | 9af7a89c4c711b8433b3b1e23e2ba0c95f82fbf7 /include/asm-sh/page.h | |
parent | b552c7e8bceae8a04ae79ecee6fa369c1ba4f8e4 (diff) |
sh: Preliminary support for SH-X2 MMU.
This adds some preliminary support for the SH-X2 MMU, used by
newer SH-4A parts (particularly SH7785).
This MMU implements a 'compat' mode with SH-X MMUs and an
'extended' mode for SH-X2 extended features. Extended features
include additional page sizes (8kB, 4MB, 64MB), as well as the
addition of page execute permissions.
The extended mode attributes are placed in a second data array,
which requires us to switch to 64-bit PTEs when in X2 mode.
With the addition of the exec perms, we also overhaul the mmap
prots somewhat, now that it's possible to handle them more
intelligently.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh/page.h')
-rw-r--r-- | include/asm-sh/page.h | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index ca8b26d90475..380fd62dd05a 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h | |||
@@ -13,9 +13,16 @@ | |||
13 | [ P4 control ] 0xE0000000 | 13 | [ P4 control ] 0xE0000000 |
14 | */ | 14 | */ |
15 | 15 | ||
16 | |||
17 | /* PAGE_SHIFT determines the page size */ | 16 | /* PAGE_SHIFT determines the page size */ |
18 | #define PAGE_SHIFT 12 | 17 | #if defined(CONFIG_PAGE_SIZE_4KB) |
18 | # define PAGE_SHIFT 12 | ||
19 | #elif defined(CONFIG_PAGE_SIZE_8KB) | ||
20 | # define PAGE_SHIFT 13 | ||
21 | #elif defined(CONFIG_PAGE_SIZE_64KB) | ||
22 | # define PAGE_SHIFT 16 | ||
23 | #else | ||
24 | # error "Bogus kernel page size?" | ||
25 | #endif | ||
19 | 26 | ||
20 | #ifdef __ASSEMBLY__ | 27 | #ifdef __ASSEMBLY__ |
21 | #define PAGE_SIZE (1 << PAGE_SHIFT) | 28 | #define PAGE_SIZE (1 << PAGE_SHIFT) |
@@ -28,8 +35,14 @@ | |||
28 | 35 | ||
29 | #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K) | 36 | #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K) |
30 | #define HPAGE_SHIFT 16 | 37 | #define HPAGE_SHIFT 16 |
38 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K) | ||
39 | #define HPAGE_SHIFT 18 | ||
31 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB) | 40 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB) |
32 | #define HPAGE_SHIFT 20 | 41 | #define HPAGE_SHIFT 20 |
42 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB) | ||
43 | #define HPAGE_SHIFT 22 | ||
44 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB) | ||
45 | #define HPAGE_SHIFT 26 | ||
33 | #endif | 46 | #endif |
34 | 47 | ||
35 | #ifdef CONFIG_HUGETLB_PAGE | 48 | #ifdef CONFIG_HUGETLB_PAGE |
@@ -69,15 +82,25 @@ extern void __copy_user_page(void *to, void *from, void *orig_to); | |||
69 | /* | 82 | /* |
70 | * These are used to make use of C type-checking.. | 83 | * These are used to make use of C type-checking.. |
71 | */ | 84 | */ |
72 | typedef struct { unsigned long pte; } pte_t; | 85 | #ifdef CONFIG_X2TLB |
73 | typedef struct { unsigned long pgd; } pgd_t; | 86 | typedef struct { unsigned long pte_low, pte_high; } pte_t; |
87 | typedef struct { unsigned long long pgprot; } pgprot_t; | ||
88 | #define pte_val(x) \ | ||
89 | ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) | ||
90 | #define __pte(x) \ | ||
91 | ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; }) | ||
92 | #else | ||
93 | typedef struct { unsigned long pte_low; } pte_t; | ||
74 | typedef struct { unsigned long pgprot; } pgprot_t; | 94 | typedef struct { unsigned long pgprot; } pgprot_t; |
95 | #define pte_val(x) ((x).pte_low) | ||
96 | #define __pte(x) ((pte_t) { (x) } ) | ||
97 | #endif | ||
98 | |||
99 | typedef struct { unsigned long pgd; } pgd_t; | ||
75 | 100 | ||
76 | #define pte_val(x) ((x).pte) | ||
77 | #define pgd_val(x) ((x).pgd) | 101 | #define pgd_val(x) ((x).pgd) |
78 | #define pgprot_val(x) ((x).pgprot) | 102 | #define pgprot_val(x) ((x).pgprot) |
79 | 103 | ||
80 | #define __pte(x) ((pte_t) { (x) } ) | ||
81 | #define __pgd(x) ((pgd_t) { (x) } ) | 104 | #define __pgd(x) ((pgd_t) { (x) } ) |
82 | #define __pgprot(x) ((pgprot_t) { (x) } ) | 105 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
83 | 106 | ||