Commit 360bd6c6 authored by Helge Deller's avatar Helge Deller

parisc: Use constants to encode the space registers like SR_KERNEL

Use the provided space register constants instead of hardcoded values.
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 5613a930
...@@ -39,16 +39,13 @@ extern int icache_stride; ...@@ -39,16 +39,13 @@ extern int icache_stride;
extern struct pdc_cache_info cache_info; extern struct pdc_cache_info cache_info;
void parisc_setup_cache_timing(void); void parisc_setup_cache_timing(void);
#define pdtlb(addr) asm volatile("pdtlb 0(%%sr1,%0)" \ #define pdtlb(sr, addr) asm volatile("pdtlb 0(%%sr%0,%1)" \
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \ ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
: : "r" (addr) : "memory") : : "i"(sr), "r" (addr) : "memory")
#define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" \ #define pitlb(sr, addr) asm volatile("pitlb 0(%%sr%0,%1)" \
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \ ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
ALTERNATIVE(ALT_COND_NO_SPLIT_TLB, INSN_NOP) \ ALTERNATIVE(ALT_COND_NO_SPLIT_TLB, INSN_NOP) \
: : "r" (addr) : "memory") : : "i"(sr), "r" (addr) : "memory")
#define pdtlb_kernel(addr) asm volatile("pdtlb 0(%0)" \
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
: : "r" (addr) : "memory")
#define asm_io_fdc(addr) asm volatile("fdc %%r0(%0)" \ #define asm_io_fdc(addr) asm volatile("fdc %%r0(%0)" \
ALTERNATIVE(ALT_COND_NO_DCACHE, INSN_NOP) \ ALTERNATIVE(ALT_COND_NO_DCACHE, INSN_NOP) \
......
...@@ -43,7 +43,7 @@ static inline unsigned long __space_to_prot(mm_context_t context) ...@@ -43,7 +43,7 @@ static inline unsigned long __space_to_prot(mm_context_t context)
static inline void load_context(mm_context_t context) static inline void load_context(mm_context_t context)
{ {
mtsp(context.space_id, 3); mtsp(context.space_id, SR_USER);
mtctl(__space_to_prot(context), 8); mtctl(__space_to_prot(context), 8);
} }
......
...@@ -70,9 +70,9 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) ...@@ -70,9 +70,9 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
unsigned long flags; unsigned long flags;
purge_tlb_start(flags); purge_tlb_start(flags);
mtsp(mm->context.space_id, 1); mtsp(mm->context.space_id, SR_TEMP1);
pdtlb(addr); pdtlb(SR_TEMP1, addr);
pitlb(addr); pitlb(SR_TEMP1, addr);
purge_tlb_end(flags); purge_tlb_end(flags);
} }
......
...@@ -55,8 +55,8 @@ static inline void set_eiem(unsigned long val) ...@@ -55,8 +55,8 @@ static inline void set_eiem(unsigned long val)
#define mfsp(reg) ({ \ #define mfsp(reg) ({ \
unsigned long cr; \ unsigned long cr; \
__asm__ __volatile__( \ __asm__ __volatile__( \
"mfsp " #reg ",%0" : \ "mfsp %%sr%1,%0" \
"=r" (cr) \ : "=r" (cr) : "i"(reg) \
); \ ); \
cr; \ cr; \
}) })
......
...@@ -457,7 +457,7 @@ void flush_kernel_dcache_page_addr(void *addr) ...@@ -457,7 +457,7 @@ void flush_kernel_dcache_page_addr(void *addr)
flush_kernel_dcache_page_asm(addr); flush_kernel_dcache_page_asm(addr);
purge_tlb_start(flags); purge_tlb_start(flags);
pdtlb_kernel(addr); pdtlb(SR_KERNEL, addr);
purge_tlb_end(flags); purge_tlb_end(flags);
} }
EXPORT_SYMBOL(flush_kernel_dcache_page_addr); EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
...@@ -496,9 +496,9 @@ int __flush_tlb_range(unsigned long sid, unsigned long start, ...@@ -496,9 +496,9 @@ int __flush_tlb_range(unsigned long sid, unsigned long start,
but cause a purge request to be broadcast to other TLBs. */ but cause a purge request to be broadcast to other TLBs. */
while (start < end) { while (start < end) {
purge_tlb_start(flags); purge_tlb_start(flags);
mtsp(sid, 1); mtsp(sid, SR_TEMP1);
pdtlb(start); pdtlb(SR_TEMP1, start);
pitlb(start); pitlb(SR_TEMP1, start);
purge_tlb_end(flags); purge_tlb_end(flags);
start += PAGE_SIZE; start += PAGE_SIZE;
} }
......
...@@ -91,7 +91,7 @@ static inline int map_pte_uncached(pte_t * pte, ...@@ -91,7 +91,7 @@ static inline int map_pte_uncached(pte_t * pte,
printk(KERN_ERR "map_pte_uncached: page already exists\n"); printk(KERN_ERR "map_pte_uncached: page already exists\n");
purge_tlb_start(flags); purge_tlb_start(flags);
set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC)); set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
pdtlb_kernel(orig_vaddr); pdtlb(SR_KERNEL, orig_vaddr);
purge_tlb_end(flags); purge_tlb_end(flags);
vaddr += PAGE_SIZE; vaddr += PAGE_SIZE;
orig_vaddr += PAGE_SIZE; orig_vaddr += PAGE_SIZE;
...@@ -175,7 +175,7 @@ static inline void unmap_uncached_pte(pmd_t * pmd, unsigned long vaddr, ...@@ -175,7 +175,7 @@ static inline void unmap_uncached_pte(pmd_t * pmd, unsigned long vaddr,
pte_clear(&init_mm, vaddr, pte); pte_clear(&init_mm, vaddr, pte);
purge_tlb_start(flags); purge_tlb_start(flags);
pdtlb_kernel(orig_vaddr); pdtlb(SR_KERNEL, orig_vaddr);
purge_tlb_end(flags); purge_tlb_end(flags);
vaddr += PAGE_SIZE; vaddr += PAGE_SIZE;
orig_vaddr += PAGE_SIZE; orig_vaddr += PAGE_SIZE;
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#define get_user_space() (uaccess_kernel() ? 0 : mfsp(3)) #define get_user_space() mfsp(SR_USER)
#define get_kernel_space() (0) #define get_kernel_space() SR_KERNEL
/* Returns 0 for success, otherwise, returns number of bytes not transferred. */ /* Returns 0 for success, otherwise, returns number of bytes not transferred. */
extern unsigned long pa_memcpy(void *dst, const void *src, extern unsigned long pa_memcpy(void *dst, const void *src,
...@@ -23,8 +23,8 @@ extern unsigned long pa_memcpy(void *dst, const void *src, ...@@ -23,8 +23,8 @@ extern unsigned long pa_memcpy(void *dst, const void *src,
unsigned long raw_copy_to_user(void __user *dst, const void *src, unsigned long raw_copy_to_user(void __user *dst, const void *src,
unsigned long len) unsigned long len)
{ {
mtsp(get_kernel_space(), 1); mtsp(get_kernel_space(), SR_TEMP1);
mtsp(get_user_space(), 2); mtsp(get_user_space(), SR_TEMP2);
return pa_memcpy((void __force *)dst, src, len); return pa_memcpy((void __force *)dst, src, len);
} }
EXPORT_SYMBOL(raw_copy_to_user); EXPORT_SYMBOL(raw_copy_to_user);
...@@ -32,16 +32,16 @@ EXPORT_SYMBOL(raw_copy_to_user); ...@@ -32,16 +32,16 @@ EXPORT_SYMBOL(raw_copy_to_user);
unsigned long raw_copy_from_user(void *dst, const void __user *src, unsigned long raw_copy_from_user(void *dst, const void __user *src,
unsigned long len) unsigned long len)
{ {
mtsp(get_user_space(), 1); mtsp(get_user_space(), SR_TEMP1);
mtsp(get_kernel_space(), 2); mtsp(get_kernel_space(), SR_TEMP2);
return pa_memcpy(dst, (void __force *)src, len); return pa_memcpy(dst, (void __force *)src, len);
} }
EXPORT_SYMBOL(raw_copy_from_user); EXPORT_SYMBOL(raw_copy_from_user);
void * memcpy(void * dst,const void *src, size_t count) void * memcpy(void * dst,const void *src, size_t count)
{ {
mtsp(get_kernel_space(), 1); mtsp(get_kernel_space(), SR_TEMP1);
mtsp(get_kernel_space(), 2); mtsp(get_kernel_space(), SR_TEMP2);
pa_memcpy(dst, src, count); pa_memcpy(dst, src, count);
return dst; return dst;
} }
......
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