1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef __ASM_SPARC_PROCESSOR_H
25#define __ASM_SPARC_PROCESSOR_H
26
27#include <asm/arch/asi.h>
28
29#ifdef CONFIG_LEON
30
31
32#include <asm/leon.h>
33
34#else
35
36#error Unknown SPARC Processor
37#endif
38
39#ifndef __ASSEMBLY__
40
41
42static __inline__ void sparc_dcache_flush_all(void)
43{
44 __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"::"i"(ASI_DFLUSH):"memory");
45}
46
47
48static __inline__ void sparc_icache_flush_all(void)
49{
50 __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"::"i"(ASI_IFLUSH):"memory");
51}
52
53
54static __inline__ unsigned long long sparc_load_reg_cachemiss_qword(unsigned
55 long paddr)
56{
57 unsigned long long retval;
58 __asm__ __volatile__("ldda [%1] %2, %0\n\t":
59 "=r"(retval):"r"(paddr), "i"(ASI_CACHEMISS));
60 return retval;
61}
62
63static __inline__ unsigned long sparc_load_reg_cachemiss(unsigned long paddr)
64{
65 unsigned long retval;
66 __asm__ __volatile__("lda [%1] %2, %0\n\t":
67 "=r"(retval):"r"(paddr), "i"(ASI_CACHEMISS));
68 return retval;
69}
70
71static __inline__ unsigned short sparc_load_reg_cachemiss_word(unsigned long
72 paddr)
73{
74 unsigned short retval;
75 __asm__ __volatile__("lduha [%1] %2, %0\n\t":
76 "=r"(retval):"r"(paddr), "i"(ASI_CACHEMISS));
77 return retval;
78}
79
80static __inline__ unsigned char sparc_load_reg_cachemiss_byte(unsigned long
81 paddr)
82{
83 unsigned char retval;
84 __asm__ __volatile__("lduba [%1] %2, %0\n\t":
85 "=r"(retval):"r"(paddr), "i"(ASI_CACHEMISS));
86 return retval;
87}
88
89
90static __inline__ void sparc_store_reg_bypass(unsigned long paddr,
91 unsigned long value)
92{
93 __asm__ __volatile__("sta %0, [%1] %2\n\t"::"r"(value), "r"(paddr),
94 "i"(ASI_BYPASS):"memory");
95}
96
97static __inline__ unsigned long sparc_load_reg_bypass(unsigned long paddr)
98{
99 unsigned long retval;
100 __asm__ __volatile__("lda [%1] %2, %0\n\t":
101 "=r"(retval):"r"(paddr), "i"(ASI_BYPASS));
102 return retval;
103}
104
105
106#define SPARC_NOCACHE_READ_DWORD(address) sparc_load_reg_cachemiss_qword((unsigned int)(address))
107#define SPARC_NOCACHE_READ(address) sparc_load_reg_cachemiss((unsigned int)(address))
108#define SPARC_NOCACHE_READ_HWORD(address) sparc_load_reg_cachemiss_word((unsigned int)(address))
109#define SPARC_NOCACHE_READ_BYTE(address) sparc_load_reg_cachemiss_byte((unsigned int)(address))
110
111#define SPARC_BYPASS_READ(address) sparc_load_reg_bypass((unsigned int)(address))
112#define SPARC_BYPASS_WRITE(address,value) sparc_store_reg_bypass((unsigned int)(address),(unsigned int)(value))
113
114#endif
115
116#endif
117