33#ifndef _RTEMS_SCORE_OR1K_UTILITY_H
34#define _RTEMS_SCORE_OR1K_UTILITY_H
37#define SPR_GRP_SHAMT 11
38#define SPR_GRP0_SYS_CTRL (0 << SPR_GRP_SHAMT)
39#define SPR_GRP1_DMMU (1 << SPR_GRP_SHAMT)
40#define SPR_GRP2_IMMU (2 << SPR_GRP_SHAMT)
41#define SPR_GRP3_DC (3 << SPR_GRP_SHAMT)
42#define SPR_GRP4_IC (4 << SPR_GRP_SHAMT)
43#define SPR_GRP5_MAC (5 << SPR_GRP_SHAMT)
44#define SPR_GRP6_DEBUG (6 << SPR_GRP_SHAMT)
45#define SPR_GRP7_PERF_CTR (7 << SPR_GRP_SHAMT)
46#define SPR_GRP8_PWR_MNG (8 << SPR_GRP_SHAMT)
47#define SPR_GRP9_PIC (9 << SPR_GRP_SHAMT)
48#define SPR_GPR10_TICK_TMR (10 << SPR_GRP_SHAMT)
49#define SPR_GPR11_FPU (11 << SPR_GRP_SHAMT)
54#define CPU_OR1K_SPR_VR (SPR_GRP0_SYS_CTRL + 0)
55#define CPU_OR1K_SPR_UPR (SPR_GRP0_SYS_CTRL + 1)
56#define CPU_OR1K_SPR_CPUCFGR (SPR_GRP0_SYS_CTRL + 2)
57#define CPU_OR1K_SPR_DMMUCFGR (SPR_GRP0_SYS_CTRL + 3)
58#define CPU_OR1K_SPR_IMMUCFGR (SPR_GRP0_SYS_CTRL + 4)
59#define CPU_OR1K_SPR_DCCFGR (SPR_GRP0_SYS_CTRL + 5)
60#define CPU_OR1K_SPR_ICCFGR (SPR_GRP0_SYS_CTRL + 6)
61#define CPU_OR1K_SPR_DCFGR (SPR_GRP0_SYS_CTRL + 7)
62#define CPU_OR1K_SPR_PCCFGR (SPR_GRP0_SYS_CTRL + 8)
63#define CPU_OR1K_SPR_VR2 (SPR_GRP0_SYS_CTRL + 9)
64#define CPU_OR1K_SPR_AVR (SPR_GRP0_SYS_CTRL + 10)
65#define CPU_OR1K_SPR_EVBAR (SPR_GRP0_SYS_CTRL + 11)
66#define CPU_OR1K_SPR_AECR (SPR_GRP0_SYS_CTRL + 12)
67#define CPU_OR1K_SPR_AESR (SPR_GRP0_SYS_CTRL + 13)
68#define CPU_OR1K_SPR_NPC (SPR_GRP0_SYS_CTRL + 16)
69#define CPU_OR1K_SPR_SR (SPR_GRP0_SYS_CTRL + 17)
70#define CPU_OR1K_SPR_PPC (SPR_GRP0_SYS_CTRL + 18)
71#define CPU_OR1K_SPR_FPCSR (SPR_GRP0_SYS_CTRL + 20)
72#define CPU_OR1K_SPR_EPCR0 (SPR_GRP0_SYS_CTRL + 32)
73#define CPU_OR1K_SPR_EPCR1 (SPR_GRP0_SYS_CTRL + 33)
74#define CPU_OR1K_SPR_EPCR2 (SPR_GRP0_SYS_CTRL + 34)
75#define CPU_OR1K_SPR_EPCR3 (SPR_GRP0_SYS_CTRL + 35)
76#define CPU_OR1K_SPR_EPCR4 (SPR_GRP0_SYS_CTRL + 36)
77#define CPU_OR1K_SPR_EPCR5 (SPR_GRP0_SYS_CTRL + 37)
78#define CPU_OR1K_SPR_EPCR6 (SPR_GRP0_SYS_CTRL + 38)
79#define CPU_OR1K_SPR_EPCR7 (SPR_GRP0_SYS_CTRL + 39)
80#define CPU_OR1K_SPR_EPCR8 (SPR_GRP0_SYS_CTRL + 40)
81#define CPU_OR1K_SPR_EPCR9 (SPR_GRP0_SYS_CTRL + 41)
82#define CPU_OR1K_SPR_EPCR10 (SPR_GRP0_SYS_CTRL + 42)
83#define CPU_OR1K_SPR_EPCR11 (SPR_GRP0_SYS_CTRL + 43)
84#define CPU_OR1K_SPR_EPCR12 (SPR_GRP0_SYS_CTRL + 44)
85#define CPU_OR1K_SPR_EPCR13 (SPR_GRP0_SYS_CTRL + 45)
86#define CPU_OR1K_SPR_EPCR14 (SPR_GRP0_SYS_CTRL + 46)
87#define CPU_OR1K_SPR_EPCR15 (SPR_GRP0_SYS_CTRL + 47)
88#define CPU_OR1K_SPR_EEAR0 (SPR_GRP0_SYS_CTRL + 48)
89#define CPU_OR1K_SPR_EEAR1 (SPR_GRP0_SYS_CTRL + 49)
90#define CPU_OR1K_SPR_EEAR2 (SPR_GRP0_SYS_CTRL + 50)
91#define CPU_OR1K_SPR_EEAR3 (SPR_GRP0_SYS_CTRL + 51)
92#define CPU_OR1K_SPR_EEAR4 (SPR_GRP0_SYS_CTRL + 52)
93#define CPU_OR1K_SPR_EEAR5 (SPR_GRP0_SYS_CTRL + 53)
94#define CPU_OR1K_SPR_EEAR6 (SPR_GRP0_SYS_CTRL + 54)
95#define CPU_OR1K_SPR_EEAR7 (SPR_GRP0_SYS_CTRL + 55)
96#define CPU_OR1K_SPR_EEAR8 (SPR_GRP0_SYS_CTRL + 56)
97#define CPU_OR1K_SPR_EEAR9 (SPR_GRP0_SYS_CTRL + 57)
98#define CPU_OR1K_SPR_EEAR10 (SPR_GRP0_SYS_CTRL + 58)
99#define CPU_OR1K_SPR_EEAR11 (SPR_GRP0_SYS_CTRL + 59)
100#define CPU_OR1K_SPR_EEAR12 (SPR_GRP0_SYS_CTRL + 60)
101#define CPU_OR1K_SPR_EEAR13 (SPR_GRP0_SYS_CTRL + 61)
102#define CPU_OR1K_SPR_EEAR14 (SPR_GRP0_SYS_CTRL + 62)
103#define CPU_OR1K_SPR_EEAR15 (SPR_GRP0_SYS_CTRL + 63)
104#define CPU_OR1K_SPR_ESR0 (SPR_GRP0_SYS_CTRL + 64)
105#define CPU_OR1K_SPR_ESR1 (SPR_GRP0_SYS_CTRL + 65)
106#define CPU_OR1K_SPR_ESR2 (SPR_GRP0_SYS_CTRL + 66)
107#define CPU_OR1K_SPR_ESR3 (SPR_GRP0_SYS_CTRL + 67)
108#define CPU_OR1K_SPR_ESR4 (SPR_GRP0_SYS_CTRL + 68)
109#define CPU_OR1K_SPR_ESR5 (SPR_GRP0_SYS_CTRL + 69)
110#define CPU_OR1K_SPR_ESR6 (SPR_GRP0_SYS_CTRL + 70)
111#define CPU_OR1K_SPR_ESR7 (SPR_GRP0_SYS_CTRL + 71)
112#define CPU_OR1K_SPR_ESR8 (SPR_GRP0_SYS_CTRL + 72)
113#define CPU_OR1K_SPR_ESR9 (SPR_GRP0_SYS_CTRL + 73)
114#define CPU_OR1K_SPR_ESR10 (SPR_GRP0_SYS_CTRL + 74)
115#define CPU_OR1K_SPR_ESR11 (SPR_GRP0_SYS_CTRL + 75)
116#define CPU_OR1K_SPR_ESR12 (SPR_GRP0_SYS_CTRL + 76)
117#define CPU_OR1K_SPR_ESR13 (SPR_GRP0_SYS_CTRL + 77)
118#define CPU_OR1K_SPR_ESR14 (SPR_GRP0_SYS_CTRL + 78)
119#define CPU_OR1K_SPR_ESR15 (SPR_GRP0_SYS_CTRL + 79)
122#define CPU_OR1K_SPR_GPR32 (SPR_GRP0_SYS_CTRL + 1024)
125#define CPU_OR1K_SPR_DMMUCR (SPR_GRP1_DMMU + 0)
126#define CPU_OR1K_SPR_DMMUPR (SPR_GRP1_DMMU + 1)
127#define CPU_OR1K_SPR_DTLBEIR (SPR_GRP1_DMMU + 2)
128#define CPU_OR1K_SPR_DATBMR0 (SPR_GRP1_DMMU + 4)
129#define CPU_OR1K_SPR_DATBMR1 (SPR_GRP1_DMMU + 5)
130#define CPU_OR1K_SPR_DATBMR2 (SPR_GRP1_DMMU + 6)
131#define CPU_OR1K_SPR_DATBMR3 (SPR_GRP1_DMMU + 7)
132#define CPU_OR1K_SPR_DATBTR0 (SPR_GRP1_DMMU + 8)
133#define CPU_OR1K_SPR_DATBTR1 (SPR_GRP1_DMMU + 9)
134#define CPU_OR1K_SPR_DATBTR2 (SPR_GRP1_DMMU + 10)
135#define CPU_OR1K_SPR_DATBTR3 (SPR_GRP1_DMMU + 11)
138#define CPU_OR1K_SPR_IMMUCR (SPR_GRP2_IMMU + 0)
139#define CPU_OR1K_SPR_IMMUPR (SPR_GRP2_IMMU + 1)
140#define CPU_OR1K_SPR_ITLBEIR (SPR_GRP2_IMMU + 2)
141#define CPU_OR1K_SPR_IATBMR0 (SPR_GRP2_IMMU + 4)
142#define CPU_OR1K_SPR_IATBMR1 (SPR_GRP2_IMMU + 5)
143#define CPU_OR1K_SPR_IATBMR2 (SPR_GRP2_IMMU + 6)
144#define CPU_OR1K_SPR_IATBMR3 (SPR_GRP2_IMMU + 7)
145#define CPU_OR1K_SPR_IATBTR0 (SPR_GRP2_IMMU + 8)
146#define CPU_OR1K_SPR_IATBTR1 (SPR_GRP2_IMMU + 9)
147#define CPU_OR1K_SPR_IATBTR2 (SPR_GRP2_IMMU + 10)
148#define CPU_OR1K_SPR_IATBTR3 (SPR_GRP2_IMMU + 11)
151#define CPU_OR1K_SPR_DCCR (SPR_GRP3_DC + 0)
152#define CPU_OR1K_SPR_DCBPR (SPR_GRP3_DC + 1)
153#define CPU_OR1K_SPR_DCBFR (SPR_GRP3_DC + 2)
154#define CPU_OR1K_SPR_DCBIR (SPR_GRP3_DC + 3)
155#define CPU_OR1K_SPR_DCBWR (SPR_GRP3_DC + 4)
156#define CPU_OR1K_SPR_DCBLR (SPR_GRP3_DC + 5)
159#define CPU_OR1K_SPR_ICCR (SPR_GRP4_IC + 0)
160#define CPU_OR1K_SPR_ICBPR (SPR_GRP4_IC + 1)
161#define CPU_OR1K_SPR_ICBIR (SPR_GRP4_IC + 2)
162#define CPU_OR1K_SPR_ICBLR (SPR_GRP4_IC + 3)
165#define CPU_OR1K_SPR_MACLO (SPR_GRP5_MAC + 1)
166#define CPU_OR1K_SPR_MACHI (SPR_GRP5_MAC + 2)
169#define CPU_OR1K_SPR_DVR0 (SPR_GRP6_DEBUG + 0)
170#define CPU_OR1K_SPR_DVR1 (SPR_GRP6_DEBUG + 1)
171#define CPU_OR1K_SPR_DVR2 (SPR_GRP6_DEBUG + 2)
172#define CPU_OR1K_SPR_DVR3 (SPR_GRP6_DEBUG + 3)
173#define CPU_OR1K_SPR_DVR4 (SPR_GRP6_DEBUG + 4)
174#define CPU_OR1K_SPR_DVR5 (SPR_GRP6_DEBUG + 5)
175#define CPU_OR1K_SPR_DVR6 (SPR_GRP6_DEBUG + 6)
176#define CPU_OR1K_SPR_DVR7 (SPR_GRP6_DEBUG + 7)
177#define CPU_OR1K_SPR_DCR0 (SPR_GRP6_DEBUG + 8)
178#define CPU_OR1K_SPR_DCR1 (SPR_GRP6_DEBUG + 9)
179#define CPU_OR1K_SPR_DCR2 (SPR_GRP6_DEBUG + 10)
180#define CPU_OR1K_SPR_DCR3 (SPR_GRP6_DEBUG + 11)
181#define CPU_OR1K_SPR_DCR4 (SPR_GRP6_DEBUG + 12)
182#define CPU_OR1K_SPR_DCR5 (SPR_GRP6_DEBUG + 13)
183#define CPU_OR1K_SPR_DCR6 (SPR_GRP6_DEBUG + 14)
184#define CPU_OR1K_SPR_DCR7 (SPR_GRP6_DEBUG + 15)
185#define CPU_OR1K_SPR_DMR1 (SPR_GRP6_DEBUG + 16)
186#define CPU_OR1K_SPR_DMR2 (SPR_GRP6_DEBUG + 17)
187#define CPU_OR1K_SPR_DCWR0 (SPR_GRP6_DEBUG + 18)
188#define CPU_OR1K_SPR_DCWR1 (SPR_GRP6_DEBUG + 19)
189#define CPU_OR1K_SPR_DSR (SPR_GRP6_DEBUG + 20)
190#define CPU_OR1K_SPR_DRR (SPR_GRP6_DEBUG + 21)
193#define CPU_OR1K_SPR_PCCR0 (SPR_GRP7_PERF_CTR + 0)
194#define CPU_OR1K_SPR_PCCR1 (SPR_GRP7_PERF_CTR + 1)
195#define CPU_OR1K_SPR_PCCR2 (SPR_GRP7_PERF_CTR + 2)
196#define CPU_OR1K_SPR_PCCR3 (SPR_GRP7_PERF_CTR + 3)
197#define CPU_OR1K_SPR_PCCR4 (SPR_GRP7_PERF_CTR + 4)
198#define CPU_OR1K_SPR_PCCR5 (SPR_GRP7_PERF_CTR + 5)
199#define CPU_OR1K_SPR_PCCR6 (SPR_GRP7_PERF_CTR + 6)
200#define CPU_OR1K_SPR_PCCR7 (SPR_GRP7_PERF_CTR + 7)
201#define CPU_OR1K_SPR_PCMR0 (SPR_GRP7_PERF_CTR + 8)
202#define CPU_OR1K_SPR_PCMR1 (SPR_GRP7_PERF_CTR + 9)
203#define CPU_OR1K_SPR_PCMR2 (SPR_GRP7_PERF_CTR + 10)
204#define CPU_OR1K_SPR_PCMR3 (SPR_GRP7_PERF_CTR + 11)
205#define CPU_OR1K_SPR_PCMR4 (SPR_GRP7_PERF_CTR + 12)
206#define CPU_OR1K_SPR_PCMR5 (SPR_GRP7_PERF_CTR + 13)
207#define CPU_OR1K_SPR_PCMR6 (SPR_GRP7_PERF_CTR + 14)
208#define CPU_OR1K_SPR_PCMR7 (SPR_GRP7_PERF_CTR + 15)
211#define CPU_OR1K_SPR_PMR (SPR_GRP8_PWR_MNG + 0)
214#define CPU_OR1K_SPR_PICMR (SPR_GRP9_PIC + 0)
215#define CPU_OR1K_SPR_PICSR (SPR_GRP9_PIC + 2)
218#define CPU_OR1K_SPR_TTMR (SPR_GPR10_TICK_TMR + 0)
219#define CPU_OR1K_SPR_TTCR (SPR_GPR10_TICK_TMR + 1)
222#define CPU_OR1K_SPR_SR_SHAMT_SM (0)
223#define CPU_OR1K_SPR_SR_SHAMT_TEE (1)
224#define CPU_OR1K_SPR_SR_SHAMT_IEE (2)
225#define CPU_OR1K_SPR_SR_SHAMT_DCE (3)
226#define CPU_OR1K_SPR_SR_SHAMT_ICE (4)
227#define CPU_OR1K_SPR_SR_SHAMT_DME (5)
228#define CPU_OR1K_SPR_SR_SHAMT_IME (6)
229#define CPU_OR1K_SPR_SR_SHAMT_LEE (7)
230#define CPU_OR1K_SPR_SR_SHAMT_CE (8)
231#define CPU_OR1K_SPR_SR_SHAMT_F (9)
232#define CPU_OR1K_SPR_SR_SHAMT_CY (10)
233#define CPU_OR1K_SPR_SR_SHAMT_OV (11)
234#define CPU_OR1K_SPR_SR_SHAMT_OVE (12)
235#define CPU_OR1K_SPR_SR_SHAMT_DSX (13)
236#define CPU_OR1K_SPR_SR_SHAMT_EPH (14)
237#define CPU_OR1K_SPR_SR_SHAMT_FO (15)
238#define CPU_OR1K_SPR_SR_SHAMT_SUMRA (16)
239#define CPU_OR1K_SPR_SR_SHAMT_CID (28)
244#define CPU_OR1K_SPR_SR_SM (1 << CPU_OR1K_SPR_SR_SHAMT_SM)
246#define CPU_OR1K_SPR_SR_TEE (1 << CPU_OR1K_SPR_SR_SHAMT_TEE)
248#define CPU_OR1K_SPR_SR_IEE (1 << CPU_OR1K_SPR_SR_SHAMT_IEE)
250#define CPU_OR1K_SPR_SR_DCE (1 << CPU_OR1K_SPR_SR_SHAMT_DCE)
252#define CPU_OR1K_SPR_SR_ICE (1 << CPU_OR1K_SPR_SR_SHAMT_ICE)
254#define CPU_OR1K_SPR_SR_DME (1 << CPU_OR1K_SPR_SR_SHAMT_DME)
256#define CPU_OR1K_SPR_SR_IME (1 << CPU_OR1K_SPR_SR_SHAMT_IME)
258#define CPU_OR1K_SPR_SR_LEE (1 << CPU_OR1K_SPR_SR_SHAMT_LEE)
260#define CPU_OR1K_SPR_SR_CE (1 << CPU_OR1K_SPR_SR_SHAMT_CE)
262#define CPU_OR1K_SPR_SR_F (1 << CPU_OR1K_SPR_SR_SHAMT_F)
264#define CPU_OR1K_SPR_SR_CY (1 << CPU_OR1K_SPR_SR_SHAMT_CY)
266#define CPU_OR1K_SPR_SR_OV (1 << CPU_OR1K_SPR_SR_SHAMT_OV)
268#define CPU_OR1K_SPR_SR_OVE (1 << CPU_OR1K_SPR_SR_SHAMT_OVE)
270#define CPU_OR1K_SPR_SR_DSX (1 << CPU_OR1K_SPR_SR_SHAMT_DSX)
272#define CPU_OR1K_SPR_SR_EPH (1 << CPU_OR1K_SPR_SR_SHAMT_EPH)
274#define CPU_OR1K_SPR_SR_FO (1 << CPU_OR1K_SPR_SR_SHAMT_FO)
276#define CPU_OR1K_SPR_SR_SUMRA (1 << CPU_OR1K_SPR_SR_SHAMT_SUMRA)
278#define CPU_OR1K_SPR_SR_CID (F << CPU_OR1K_SPR_SR_SHAMT_CID)
281#define CPU_OR1K_SPR_TTMR_SHAMT_IP 28
282#define CPU_OR1K_SPR_TTMR_SHAMT_IE 29
283#define CPU_OR1K_SPR_TTMR_SHAMT_MODE 30
285#define CPU_OR1K_SPR_TTMR_TP_MASK (0x0FFFFFFF)
286#define CPU_OR1K_SPR_TTMR_IP (1 << CPU_OR1K_SPR_TTMR_SHAMT_IP)
287#define CPU_OR1K_SPR_TTMR_IE (1 << CPU_OR1K_SPR_TTMR_SHAMT_IE)
288#define CPU_OR1K_SPR_TTMR_MODE_RESTART (1 << CPU_OR1K_SPR_TTMR_SHAMT_MODE)
289#define CPU_OR1K_SPR_TTMR_MODE_ONE_SHOT (2 << CPU_OR1K_SPR_TTMR_SHAMT_MODE)
290#define CPU_OR1K_SPR_TTMR_MODE_CONT (3 << CPU_OR1K_SPR_TTMR_SHAMT_MODE)
295#define CPU_OR1K_SPR_PMR_SHAMT_SDF 0
296#define CPU_OR1K_SPR_PMR_SHAMT_DME 4
297#define CPU_OR1K_SPR_PMR_SHAMT_SME 5
298#define CPU_OR1K_SPR_PMR_SHAMT_DCGE 6
299#define CPU_OR1K_SPR_PMR_SHAMT_SUME 7
301#define CPU_OR1K_SPR_PMR_SDF (0xF << CPU_OR1K_SPR_PMR_SHAMT_SDF)
302#define CPU_OR1K_SPR_PMR_DME (1 << CPU_OR1K_SPR_PMR_SHAMT_DME)
303#define CPU_OR1K_SPR_PMR_SME (1 << CPU_OR1K_SPR_PMR_SHAMT_SME)
304#define CPU_OR1K_SPR_PMR_DCGE (1 << CPU_OR1K_SPR_PMR_SHAMT_DCGE)
305#define CPU_OR1K_SPR_PMR_SUME (1 << CPU_OR1K_SPR_PMR_SHAMT_SUME)
323 OR1K_EXCEPTION_RESET = 1,
324 OR1K_EXCEPTION_BUS_ERR = 2,
325 OR1K_EXCEPTION_D_PF = 3,
326 OR1K_EXCEPTION_I_PF = 4,
327 OR1K_EXCEPTION_TICK_TIMER = 5,
328 OR1K_EXCEPTION_ALIGNMENT = 6,
329 OR1K_EXCEPTION_I_UNDEF= 7,
330 OR1K_EXCEPTION_IRQ = 8,
331 OR1K_EXCPETION_D_TLB = 9,
332 OR1K_EXCPETION_I_TLB = 10,
333 OR1K_EXCPETION_RANGE = 11,
334 OR1K_EXCPETION_SYS_CALL = 12,
335 OR1K_EXCPETION_FP = 13,
336 OR1K_EXCPETION_TRAP = 14,
337 OR1K_EXCPETION_RESERVED1 = 15,
338 OR1K_EXCPETION_RESERVED2 = 16,
339 OR1K_EXCPETION_RESERVED3 = 17,
341 OR1K_EXCEPTION_MAKE_ENUM_32_BIT = 0xffffffff
344static inline uint32_t _OR1K_mfspr(uint32_t reg)
349 "l.mfspr %0, %1, 0;\n\t"
350 :
"=r" (spr_value) :
"r" (reg));
355static inline void _OR1K_mtspr(uint32_t reg, uint32_t value)
358 "l.mtspr %1, %0, 0;\n\t"
359 ::
"r" (value),
"r" (reg)
373#define _OR1K_CPU_SlowDown(value) \
374 _OR1K_mtspr(CPU_OR1K_SPR_PMR, (value & CPU_OR1K_SPR_PMR_SDF))
377#define _OR1K_CPU_Doze() \
378 _OR1K_mtspr(CPU_OR1K_SPR_PMR, CPU_OR1K_SPR_PMR_DME)
381#define _OR1K_CPU_Sleep() \
382 _OR1K_mtspr(CPU_OR1K_SPR_PMR, CPU_OR1K_SPR_PMR_SME)
384#define _OR1K_CPU_Suspend() \
385 _OR1K_mtspr(CPU_OR1K_SPR_PMR, CPU_OR1K_SPR_PMR_SME)
387static inline void _OR1K_Sync_mem(
void )
389 __asm__
volatile(
"l.msync");
392static inline void _OR1K_Sync_pipeline(
void )
394 __asm__
volatile(
"l.psync");
404#define _OR1KSIM_CPU_Halt() \
405 __asm__ volatile ("l.nop 0xc")
OR1K_Symbolic_exception_name
Supervision Mode registers definitions.
Definition: or1k-utility.h:322