mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 06:33:34 +00:00
parisc: Use constants to encode the space registers like SR_KERNEL
Use the provided space register constants instead of hardcoded values. Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
parent
5613a93085
commit
360bd6c658
@ -39,16 +39,13 @@ extern int icache_stride;
|
||||
extern struct pdc_cache_info cache_info;
|
||||
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) \
|
||||
: : "r" (addr) : "memory")
|
||||
#define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" \
|
||||
: : "i"(sr), "r" (addr) : "memory")
|
||||
#define pitlb(sr, addr) asm volatile("pitlb 0(%%sr%0,%1)" \
|
||||
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
|
||||
ALTERNATIVE(ALT_COND_NO_SPLIT_TLB, INSN_NOP) \
|
||||
: : "r" (addr) : "memory")
|
||||
#define pdtlb_kernel(addr) asm volatile("pdtlb 0(%0)" \
|
||||
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
|
||||
: : "r" (addr) : "memory")
|
||||
: : "i"(sr), "r" (addr) : "memory")
|
||||
|
||||
#define asm_io_fdc(addr) asm volatile("fdc %%r0(%0)" \
|
||||
ALTERNATIVE(ALT_COND_NO_DCACHE, INSN_NOP) \
|
||||
|
@ -43,7 +43,7 @@ static inline unsigned long __space_to_prot(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);
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,9 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
|
||||
unsigned long flags;
|
||||
|
||||
purge_tlb_start(flags);
|
||||
mtsp(mm->context.space_id, 1);
|
||||
pdtlb(addr);
|
||||
pitlb(addr);
|
||||
mtsp(mm->context.space_id, SR_TEMP1);
|
||||
pdtlb(SR_TEMP1, addr);
|
||||
pitlb(SR_TEMP1, addr);
|
||||
purge_tlb_end(flags);
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,8 @@ static inline void set_eiem(unsigned long val)
|
||||
#define mfsp(reg) ({ \
|
||||
unsigned long cr; \
|
||||
__asm__ __volatile__( \
|
||||
"mfsp " #reg ",%0" : \
|
||||
"=r" (cr) \
|
||||
"mfsp %%sr%1,%0" \
|
||||
: "=r" (cr) : "i"(reg) \
|
||||
); \
|
||||
cr; \
|
||||
})
|
||||
|
@ -457,7 +457,7 @@ void flush_kernel_dcache_page_addr(void *addr)
|
||||
|
||||
flush_kernel_dcache_page_asm(addr);
|
||||
purge_tlb_start(flags);
|
||||
pdtlb_kernel(addr);
|
||||
pdtlb(SR_KERNEL, addr);
|
||||
purge_tlb_end(flags);
|
||||
}
|
||||
EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
|
||||
@ -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. */
|
||||
while (start < end) {
|
||||
purge_tlb_start(flags);
|
||||
mtsp(sid, 1);
|
||||
pdtlb(start);
|
||||
pitlb(start);
|
||||
mtsp(sid, SR_TEMP1);
|
||||
pdtlb(SR_TEMP1, start);
|
||||
pitlb(SR_TEMP1, start);
|
||||
purge_tlb_end(flags);
|
||||
start += PAGE_SIZE;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ static inline int map_pte_uncached(pte_t * pte,
|
||||
printk(KERN_ERR "map_pte_uncached: page already exists\n");
|
||||
purge_tlb_start(flags);
|
||||
set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
|
||||
pdtlb_kernel(orig_vaddr);
|
||||
pdtlb(SR_KERNEL, orig_vaddr);
|
||||
purge_tlb_end(flags);
|
||||
vaddr += PAGE_SIZE;
|
||||
orig_vaddr += PAGE_SIZE;
|
||||
@ -175,7 +175,7 @@ static inline void unmap_uncached_pte(pmd_t * pmd, unsigned long vaddr,
|
||||
|
||||
pte_clear(&init_mm, vaddr, pte);
|
||||
purge_tlb_start(flags);
|
||||
pdtlb_kernel(orig_vaddr);
|
||||
pdtlb(SR_KERNEL, orig_vaddr);
|
||||
purge_tlb_end(flags);
|
||||
vaddr += PAGE_SIZE;
|
||||
orig_vaddr += PAGE_SIZE;
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
#define get_user_space() (uaccess_kernel() ? 0 : mfsp(3))
|
||||
#define get_kernel_space() (0)
|
||||
#define get_user_space() mfsp(SR_USER)
|
||||
#define get_kernel_space() SR_KERNEL
|
||||
|
||||
/* Returns 0 for success, otherwise, returns number of bytes not transferred. */
|
||||
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 len)
|
||||
{
|
||||
mtsp(get_kernel_space(), 1);
|
||||
mtsp(get_user_space(), 2);
|
||||
mtsp(get_kernel_space(), SR_TEMP1);
|
||||
mtsp(get_user_space(), SR_TEMP2);
|
||||
return pa_memcpy((void __force *)dst, src, len);
|
||||
}
|
||||
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 len)
|
||||
{
|
||||
mtsp(get_user_space(), 1);
|
||||
mtsp(get_kernel_space(), 2);
|
||||
mtsp(get_user_space(), SR_TEMP1);
|
||||
mtsp(get_kernel_space(), SR_TEMP2);
|
||||
return pa_memcpy(dst, (void __force *)src, len);
|
||||
}
|
||||
EXPORT_SYMBOL(raw_copy_from_user);
|
||||
|
||||
void * memcpy(void * dst,const void *src, size_t count)
|
||||
{
|
||||
mtsp(get_kernel_space(), 1);
|
||||
mtsp(get_kernel_space(), 2);
|
||||
mtsp(get_kernel_space(), SR_TEMP1);
|
||||
mtsp(get_kernel_space(), SR_TEMP2);
|
||||
pa_memcpy(dst, src, count);
|
||||
return dst;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user