diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-08-04 04:14:39 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-08-04 04:14:39 -0400 |
commit | c7914834ef3b8a396b7e82ea34ac07cdcfe6f868 (patch) | |
tree | 59f6f76dfca96cd7ad330ae3c281cfa57e98f44e /arch/sh/mm | |
parent | c0fe478dbb14fd32e71d1383dbe302b54ce94134 (diff) |
sh: Tidy up NEFF-based sign extension for SH-5.
This consolidates all of the NEFF-based sign extension for SH-5.
In the future the other SH code will need to make use of this as well,
so make it generic in preparation for more 32/64 consolidation.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r-- | arch/sh/mm/fault_64.c | 11 | ||||
-rw-r--r-- | arch/sh/mm/tlb-sh5.c | 21 | ||||
-rw-r--r-- | arch/sh/mm/tlbflush_64.c | 2 |
3 files changed, 7 insertions, 27 deletions
diff --git a/arch/sh/mm/fault_64.c b/arch/sh/mm/fault_64.c index bd63b961b2a9..2b356cec2489 100644 --- a/arch/sh/mm/fault_64.c +++ b/arch/sh/mm/fault_64.c | |||
@@ -56,16 +56,7 @@ inline void __do_tlb_refill(unsigned long address, | |||
56 | /* | 56 | /* |
57 | * Set PTEH register | 57 | * Set PTEH register |
58 | */ | 58 | */ |
59 | pteh = address & MMU_VPN_MASK; | 59 | pteh = neff_sign_extend(address & MMU_VPN_MASK); |
60 | |||
61 | /* Sign extend based on neff. */ | ||
62 | #if (NEFF == 32) | ||
63 | /* Faster sign extension */ | ||
64 | pteh = (unsigned long long)(signed long long)(signed long)pteh; | ||
65 | #else | ||
66 | /* General case */ | ||
67 | pteh = (pteh & NEFF_SIGN) ? (pteh | NEFF_MASK) : pteh; | ||
68 | #endif | ||
69 | 60 | ||
70 | /* Set the ASID. */ | 61 | /* Set the ASID. */ |
71 | pteh |= get_asid() << PTEH_ASID_SHIFT; | 62 | pteh |= get_asid() << PTEH_ASID_SHIFT; |
diff --git a/arch/sh/mm/tlb-sh5.c b/arch/sh/mm/tlb-sh5.c index dae131243bcc..fdb64e41ec50 100644 --- a/arch/sh/mm/tlb-sh5.c +++ b/arch/sh/mm/tlb-sh5.c | |||
@@ -117,26 +117,15 @@ int sh64_put_wired_dtlb_entry(unsigned long long entry) | |||
117 | * Load up a virtual<->physical translation for @eaddr<->@paddr in the | 117 | * Load up a virtual<->physical translation for @eaddr<->@paddr in the |
118 | * pre-allocated TLB slot @config_addr (see sh64_get_wired_dtlb_entry). | 118 | * pre-allocated TLB slot @config_addr (see sh64_get_wired_dtlb_entry). |
119 | */ | 119 | */ |
120 | inline void sh64_setup_tlb_slot(unsigned long long config_addr, | 120 | void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr, |
121 | unsigned long eaddr, | 121 | unsigned long asid, unsigned long paddr) |
122 | unsigned long asid, | ||
123 | unsigned long paddr) | ||
124 | { | 122 | { |
125 | unsigned long long pteh, ptel; | 123 | unsigned long long pteh, ptel; |
126 | 124 | ||
127 | /* Sign extension */ | 125 | pteh = neff_sign_extend(eaddr); |
128 | #if (NEFF == 32) | ||
129 | pteh = (unsigned long long)(signed long long)(signed long) eaddr; | ||
130 | #else | ||
131 | #error "Can't sign extend more than 32 bits yet" | ||
132 | #endif | ||
133 | pteh &= PAGE_MASK; | 126 | pteh &= PAGE_MASK; |
134 | pteh |= (asid << PTEH_ASID_SHIFT) | PTEH_VALID; | 127 | pteh |= (asid << PTEH_ASID_SHIFT) | PTEH_VALID; |
135 | #if (NEFF == 32) | 128 | ptel = neff_sign_extend(paddr); |
136 | ptel = (unsigned long long)(signed long long)(signed long) paddr; | ||
137 | #else | ||
138 | #error "Can't sign extend more than 32 bits yet" | ||
139 | #endif | ||
140 | ptel &= PAGE_MASK; | 129 | ptel &= PAGE_MASK; |
141 | ptel |= (_PAGE_CACHABLE | _PAGE_READ | _PAGE_WRITE); | 130 | ptel |= (_PAGE_CACHABLE | _PAGE_READ | _PAGE_WRITE); |
142 | 131 | ||
@@ -152,5 +141,5 @@ inline void sh64_setup_tlb_slot(unsigned long long config_addr, | |||
152 | * | 141 | * |
153 | * Teardown any existing mapping in the TLB slot @config_addr. | 142 | * Teardown any existing mapping in the TLB slot @config_addr. |
154 | */ | 143 | */ |
155 | inline void sh64_teardown_tlb_slot(unsigned long long config_addr) | 144 | void sh64_teardown_tlb_slot(unsigned long long config_addr) |
156 | __attribute__ ((alias("__flush_tlb_slot"))); | 145 | __attribute__ ((alias("__flush_tlb_slot"))); |
diff --git a/arch/sh/mm/tlbflush_64.c b/arch/sh/mm/tlbflush_64.c index f2e44e9ffb75..fa5a95a062d0 100644 --- a/arch/sh/mm/tlbflush_64.c +++ b/arch/sh/mm/tlbflush_64.c | |||
@@ -337,7 +337,7 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page) | |||
337 | /* | 337 | /* |
338 | * Sign-extend based on neff. | 338 | * Sign-extend based on neff. |
339 | */ | 339 | */ |
340 | lpage = (page & NEFF_SIGN) ? (page | NEFF_MASK) : page; | 340 | lpage = neff_sign_extend(page); |
341 | match = (asid << PTEH_ASID_SHIFT) | PTEH_VALID; | 341 | match = (asid << PTEH_ASID_SHIFT) | PTEH_VALID; |
342 | match |= lpage; | 342 | match |= lpage; |
343 | 343 | ||