12 #define LEON_CNR_CTRL 0x000
13 #define LEON_CNR_CTXP 0x100
14 #define LEON_CNR_CTX 0x200
15 #define LEON_CNR_F 0x300
16 #define LEON_CNR_FADDR 0x400
18 #define LEON_CNR_CTX_NCTX 256
20 #define LEON_CNR_CTRL_TLBDIS 0x80000000
22 #define LEON_MMUTLB_ENT_MAX 64
30 #define LEON_DIAGF_LVL 0x3
31 #define LEON_DIAGF_WR 0x8
32 #define LEON_DIAGF_WR_SHIFT 3
33 #define LEON_DIAGF_HIT 0x10
34 #define LEON_DIAGF_HIT_SHIFT 4
35 #define LEON_DIAGF_CTX 0x1fe0
36 #define LEON_DIAGF_CTX_SHIFT 5
37 #define LEON_DIAGF_VALID 0x2000
38 #define LEON_DIAGF_VALID_SHIFT 13
41 #define LEON_HARD_INT(x) (1 << (x))
42 #define LEON_IRQMASK_R 0x0000fffe
43 #define LEON_IRQPRIO_R 0xfffe0000
45 #define LEON_MCFG2_SRAMDIS 0x00002000
46 #define LEON_MCFG2_SDRAMEN 0x00004000
47 #define LEON_MCFG2_SRAMBANKSZ 0x00001e00
48 #define LEON_MCFG2_SRAMBANKSZ_SHIFT 9
49 #define LEON_MCFG2_SDRAMBANKSZ 0x03800000
50 #define LEON_MCFG2_SDRAMBANKSZ_SHIFT 23
52 #define LEON_TCNT0_MASK 0x7fffff
55 #define ASI_LEON3_SYSCTRL 0x02
56 #define ASI_LEON3_SYSCTRL_ICFG 0x08
57 #define ASI_LEON3_SYSCTRL_DCFG 0x0c
58 #define ASI_LEON3_SYSCTRL_CFG_SNOOPING (1 << 27)
59 #define ASI_LEON3_SYSCTRL_CFG_SSIZE(c) (1 << ((c >> 20) & 0xf))
64 static inline void leon_store_reg(
unsigned long paddr,
unsigned long value)
66 __asm__ __volatile__(
"sta %0, [%1] %2\n\t" : :
"r"(value),
"r"(paddr),
71 static inline unsigned long leon_load_reg(
unsigned long paddr)
74 __asm__ __volatile__(
"lda [%1] %2, %0\n\t" :
80 #define LEON3_BYPASS_LOAD_PA(x) (leon_load_reg((unsigned long)(x)))
81 #define LEON3_BYPASS_STORE_PA(x, v) (leon_store_reg((unsigned long)(x), (unsigned long)(v)))
82 #define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x))
83 #define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v))
88 static inline unsigned long sparc_leon3_get_dcachecfg(
void)
91 __asm__ __volatile__(
"lda [%1] %2, %0\n\t" :
99 static inline void sparc_leon3_enable_snooping(
void)
101 __asm__ __volatile__ (
"lda [%%g0] 2, %%l1\n\t"
102 "set 0x800000, %%l2\n\t"
103 "or %%l2, %%l1, %%l2\n\t"
104 "sta %%l2, [%%g0] 2\n\t" : : :
"l1",
"l2");
107 static inline int sparc_leon3_snooping_enabled(
void)
110 __asm__ __volatile__(
"lda [%%g0] 2, %0\n\t" :
"=r"(cctrl));
111 return (cctrl >> 23) & 1;
114 static inline void sparc_leon3_disable_cache(
void)
116 __asm__ __volatile__ (
"lda [%%g0] 2, %%l1\n\t"
117 "set 0x00000f, %%l2\n\t"
118 "andn %%l2, %%l1, %%l2\n\t"
119 "sta %%l2, [%%g0] 2\n\t" : : :
"l1",
"l2");
122 static inline unsigned long sparc_leon3_asr17(
void)
125 __asm__ __volatile__ (
"rd %%asr17, %0\n\t" :
"=r"(asr17));
129 static inline int sparc_leon3_cpuid(
void)
131 return sparc_leon3_asr17() >> 28;
137 # define LEON3_IRQ_IPI_DEFAULT 13
138 # define LEON3_IRQ_TICKER (leon3_ticker_irq)
139 # define LEON3_IRQ_CROSS_CALL 15
142 #if defined(PAGE_SIZE_LEON_8K)
143 #define LEON_PAGE_SIZE_LEON 1
144 #elif defined(PAGE_SIZE_LEON_16K)
145 #define LEON_PAGE_SIZE_LEON 2)
147 #define LEON_PAGE_SIZE_LEON 0
150 #if LEON_PAGE_SIZE_LEON == 0
152 #define LEON_PGD_SH 24
153 #define LEON_PGD_M 0xff
154 #define LEON_PMD_SH 18
155 #define LEON_PMD_SH_V (LEON_PGD_SH-2)
156 #define LEON_PMD_M 0x3f
157 #define LEON_PTE_SH 12
158 #define LEON_PTE_M 0x3f
159 #elif LEON_PAGE_SIZE_LEON == 1
161 #define LEON_PGD_SH 25
162 #define LEON_PGD_M 0x7f
163 #define LEON_PMD_SH 19
164 #define LEON_PMD_SH_V (LEON_PGD_SH-1)
165 #define LEON_PMD_M 0x3f
166 #define LEON_PTE_SH 13
167 #define LEON_PTE_M 0x3f
168 #elif LEON_PAGE_SIZE_LEON == 2
170 #define LEON_PGD_SH 26
171 #define LEON_PGD_M 0x3f
172 #define LEON_PMD_SH 20
173 #define LEON_PMD_SH_V (LEON_PGD_SH-0)
174 #define LEON_PMD_M 0x3f
175 #define LEON_PTE_SH 14
176 #define LEON_PTE_M 0x3f
177 #elif LEON_PAGE_SIZE_LEON == 3
179 #define LEON_PGD_SH 28
180 #define LEON_PGD_M 0x0f
181 #define LEON_PMD_SH 21
182 #define LEON_PMD_SH_V (LEON_PGD_SH-0)
183 #define LEON_PMD_M 0x7f
184 #define LEON_PTE_SH 15
185 #define LEON_PTE_M 0x3f
187 #error cannot determine LEON_PAGE_SIZE_LEON
190 #define LEON3_XCCR_SETS_MASK 0x07000000UL
191 #define LEON3_XCCR_SSIZE_MASK 0x00f00000UL
193 #define LEON2_CCR_DSETS_MASK 0x03000000UL
194 #define LEON2_CFG_SSIZE_MASK 0x00007000UL
222 const char *
name,
int do_ack);
225 const char *
name,
int do_ack);
236 extern void leon_clear_profile_irq(
int cpu);
241 void leon_enable_irq_cpu(
unsigned int irq_nr,
unsigned int cpu);
244 extern unsigned int smpleon_ipi[];
245 extern unsigned int linux_trap_ipi15_leon[];
253 #define PFN(x) ((x) >> PAGE_SHIFT)
254 #define _pfn_valid(pfn) ((pfn < last_valid_pfn) && (pfn >= PFN(phys_base)))
255 #define _SRMMU_PTE_PMASK_LEON 0xffffffff