source: rtems/cpukit/score/cpu/mips/idtcpu.h @ 5194a28

4.104.114.84.95
Last change on this file since 5194a28 was 5194a28, checked in by Greg Menke <gregory.menke@…>, on 12/06/04 at 20:29:51

PR 730

  • cpu_asm.S: Collected PR 601 changes for commit to cvshead for rtems-4.7
  • Property mode set to 100644
File size: 23.8 KB
Line 
1/*
2
3Based upon IDT provided code with the following release:
4
5This source code has been made available to you by IDT on an AS-IS
6basis. Anyone receiving this source is licensed under IDT copyrights
7to use it in any way he or she deems fit, including copying it,
8modifying it, compiling it, and redistributing it either with or
9without modifications.  No license under IDT patents or patent
10applications is to be implied by the copyright license.
11
12Any user of this software should understand that IDT cannot provide
13technical support for this software and will not be responsible for
14any consequences resulting from the use of this software.
15
16Any person who transfers this source code or any derivative work must
17include the IDT copyright notice, this paragraph, and the preceeding
18two paragraphs in the transferred software.
19
20COPYRIGHT IDT CORPORATION 1996
21LICENSED MATERIAL - PROGRAM PROPERTY OF IDT
22
23  $Id$
24*/
25
26/*
27** idtcpu.h -- cpu related defines
28*/
29
30#ifndef _IDTCPU_H__
31#define _IDTCPU_H__
32
33/*
34 * 950313: Ketan added Register definition for XContext reg.
35 *               added define for WAIT instruction.
36 * 950421: Ketan added Register definition for Config reg (R3081)
37 */
38
39/*
40** memory configuration and mapping
41*/
42#define K0BASE  0x80000000
43#define K0SIZE  0x20000000
44#define K1BASE  0xa0000000
45#define K1SIZE  0x20000000
46#define K2BASE  0xc0000000
47#define K2SIZE  0x20000000
48#if  __mips == 3
49#define KSBASE  0xe0000000
50#define KSSIZE  0x20000000
51#endif
52
53#define KUBASE  0
54#define KUSIZE  0x80000000
55
56/*
57** Exception Vectors
58*/
59#if  __mips == 1
60#define UT_VEC  K0BASE                  /* utlbmiss vector */
61#define DB_VEC  (K0BASE+0x40)           /* debug vector */
62#define E_VEC   (K0BASE+0x80)           /* exception vector */
63#elif  __mips == 32
64#define T_VEC   (K0BASE+0x000)          /* tlbmiss vector */
65#define X_VEC   (K0BASE+0x080)          /* xtlbmiss vector */
66#define C_VEC   (K0BASE+0x100)          /* cache error vector */
67#define E_VEC   (K0BASE+0x180)          /* exception vector */
68#elif  __mips == 3
69#define T_VEC   (K0BASE+0x000)          /* tlbmiss vector */
70#define X_VEC   (K0BASE+0x080)          /* xtlbmiss vector */
71#define C_VEC   (K0BASE+0x100)          /* cache error vector */
72#define E_VEC   (K0BASE+0x180)          /* exception vector */
73#else
74#error "EXCEPTION VECTORS: unknown ISA level"
75#endif
76#define R_VEC   (K1BASE+0x1fc00000)     /* reset vector */
77
78/*
79** Address conversion macros
80*/
81#ifdef CLANGUAGE
82#define CAST(as) (as)
83#else
84#define CAST(as)
85#endif
86#define K0_TO_K1(x)     (CAST(unsigned)(x)|0xA0000000)  /* kseg0 to kseg1 */
87#define K1_TO_K0(x)     (CAST(unsigned)(x)&0x9FFFFFFF)  /* kseg1 to kseg0 */
88#define K0_TO_PHYS(x)   (CAST(unsigned)(x)&0x1FFFFFFF)  /* kseg0 to physical */
89#define K1_TO_PHYS(x)   (CAST(unsigned)(x)&0x1FFFFFFF)  /* kseg1 to physical */
90#define PHYS_TO_K0(x)   (CAST(unsigned)(x)|0x80000000)  /* physical to kseg0 */
91#define PHYS_TO_K1(x)   (CAST(unsigned)(x)|0xA0000000)  /* physical to kseg1 */
92
93/*
94**      Cache size constants
95*/
96#define MINCACHE        0x200           /* 512       For 3041. */
97#define MAXCACHE        0x40000         /* 256*1024   256k */   
98
99#if  __mips == 32
100/* R4000 configuration register definitions */
101#define CFG_CM          0x80000000      /* Master-Checker mode */
102#define CFG_ECMASK      0x70000000      /* System Clock Ratio */
103#define CFG_ECBY2       0x00000000      /* divide by 2 */
104#define CFG_ECBY3       0x10000000      /* divide by 3 */
105#define CFG_ECBY4       0x20000000      /* divide by 4 */
106#define CFG_EPMASK      0x0f000000      /* Transmit data pattern */
107#define CFG_EPD         0x00000000      /* D */
108#define CFG_EPDDX       0x01000000      /* DDX */
109#define CFG_EPDDXX      0x02000000      /* DDXX */
110#define CFG_EPDXDX      0x03000000      /* DXDX */
111#define CFG_EPDDXXX     0x04000000      /* DDXXX */
112#define CFG_EPDDXXXX    0x05000000      /* DDXXXX */
113#define CFG_EPDXXDXX    0x06000000      /* DXXDXX */
114#define CFG_EPDDXXXXX   0x07000000      /* DDXXXXX */
115#define CFG_EPDXXXDXXX  0x08000000      /* DXXXDXXX */
116#define CFG_SBMASK      0x00c00000      /* Secondary cache block size */
117#define CFG_SBSHIFT     22
118#define CFG_SB4         0x00000000      /* 4 words */
119#define CFG_SB8         0x00400000      /* 8 words */
120#define CFG_SB16        0x00800000      /* 16 words */
121#define CFG_SB32        0x00c00000      /* 32 words */
122#define CFG_SS          0x00200000      /* Split secondary cache */
123#define CFG_SW          0x00100000      /* Secondary cache port width */
124#define CFG_EWMASK      0x000c0000      /* System port width */
125#define CFG_EWSHIFT     18
126#define CFG_EW64        0x00000000      /* 64 bit */
127#define CFG_EW32        0x00010000      /* 32 bit */
128#define CFG_SC          0x00020000      /* Secondary cache absent */
129#define CFG_SM          0x00010000      /* Dirty Shared mode disabled */
130#define CFG_BE          0x00008000      /* Big Endian */
131#define CFG_EM          0x00004000      /* ECC mode enable */
132#define CFG_EB          0x00002000      /* Block ordering */
133#define CFG_ICMASK      0x00000e00      /* Instruction cache size */
134#define CFG_ICSHIFT     9
135#define CFG_DCMASK      0x000001c0      /* Data cache size */
136#define CFG_DCSHIFT     6
137#define CFG_IB          0x00000020      /* Instruction cache block size */
138#define CFG_DB          0x00000010      /* Data cache block size */
139#define CFG_CU          0x00000008      /* Update on Store Conditional */
140#define CFG_K0MASK      0x00000007      /* KSEG0 coherency algorithm */
141
142/*
143 * R4000 primary cache mode
144 */
145#define CFG_C_UNCACHED          2
146#define CFG_C_NONCOHERENT       3
147#define CFG_C_COHERENTXCL       4
148#define CFG_C_COHERENTXCLW      5
149#define CFG_C_COHERENTUPD       6
150
151/*
152 * R4000 cache operations (should be in assembler...?)
153 */
154#define Index_Invalidate_I               0x0         /* 0       0 */
155#define Index_Writeback_Inv_D            0x1         /* 0       1 */
156#define Index_Invalidate_SI              0x2         /* 0       2 */
157#define Index_Writeback_Inv_SD           0x3         /* 0       3 */
158#define Index_Load_Tag_I                 0x4         /* 1       0 */
159#define Index_Load_Tag_D                 0x5         /* 1       1 */
160#define Index_Load_Tag_SI                0x6         /* 1       2 */
161#define Index_Load_Tag_SD                0x7         /* 1       3 */
162#define Index_Store_Tag_I                0x8         /* 2       0 */
163#define Index_Store_Tag_D                0x9         /* 2       1 */
164#define Index_Store_Tag_SI               0xA         /* 2       2 */
165#define Index_Store_Tag_SD               0xB         /* 2       3 */
166#define Create_Dirty_Exc_D               0xD         /* 3       1 */
167#define Create_Dirty_Exc_SD              0xF         /* 3       3 */
168#define Hit_Invalidate_I                 0x10        /* 4       0 */
169#define Hit_Invalidate_D                 0x11        /* 4       1 */
170#define Hit_Invalidate_SI                0x12        /* 4       2 */
171#define Hit_Invalidate_SD                0x13        /* 4       3 */
172#define Hit_Writeback_Inv_D              0x15        /* 5       1 */
173#define Hit_Writeback_Inv_SD             0x17        /* 5       3 */
174#define Fill_I                           0x14        /* 5       0 */
175#define Hit_Writeback_D                  0x19        /* 6       1 */
176#define Hit_Writeback_SD                 0x1B        /* 6       3 */
177#define Hit_Writeback_I                  0x18        /* 6       0 */
178#define Hit_Set_Virtual_SI               0x1E        /* 7       2 */
179#define Hit_Set_Virtual_SD               0x1F        /* 7       3 */
180
181#ifndef WAIT
182#define WAIT .word 0x42000020
183#endif /* WAIT */
184
185/* Disabled by joel -- horrible overload of common word.
186#ifndef wait
187#define wait .word 0x42000020
188#endif wait
189*/
190
191#endif
192
193#if  __mips == 3
194/* R4000 configuration register definitions */
195#define CFG_CM          0x80000000      /* Master-Checker mode */
196#define CFG_ECMASK      0x70000000      /* System Clock Ratio */
197#define CFG_ECBY2       0x00000000      /* divide by 2 */
198#define CFG_ECBY3       0x10000000      /* divide by 3 */
199#define CFG_ECBY4       0x20000000      /* divide by 4 */
200#define CFG_EPMASK      0x0f000000      /* Transmit data pattern */
201#define CFG_EPD         0x00000000      /* D */
202#define CFG_EPDDX       0x01000000      /* DDX */
203#define CFG_EPDDXX      0x02000000      /* DDXX */
204#define CFG_EPDXDX      0x03000000      /* DXDX */
205#define CFG_EPDDXXX     0x04000000      /* DDXXX */
206#define CFG_EPDDXXXX    0x05000000      /* DDXXXX */
207#define CFG_EPDXXDXX    0x06000000      /* DXXDXX */
208#define CFG_EPDDXXXXX   0x07000000      /* DDXXXXX */
209#define CFG_EPDXXXDXXX  0x08000000      /* DXXXDXXX */
210#define CFG_SBMASK      0x00c00000      /* Secondary cache block size */
211#define CFG_SBSHIFT     22
212#define CFG_SB4         0x00000000      /* 4 words */
213#define CFG_SB8         0x00400000      /* 8 words */
214#define CFG_SB16        0x00800000      /* 16 words */
215#define CFG_SB32        0x00c00000      /* 32 words */
216#define CFG_SS          0x00200000      /* Split secondary cache */
217#define CFG_SW          0x00100000      /* Secondary cache port width */
218#define CFG_EWMASK      0x000c0000      /* System port width */
219#define CFG_EWSHIFT     18
220#define CFG_EW64        0x00000000      /* 64 bit */
221#define CFG_EW32        0x00010000      /* 32 bit */
222#define CFG_SC          0x00020000      /* Secondary cache absent */
223#define CFG_SM          0x00010000      /* Dirty Shared mode disabled */
224#define CFG_BE          0x00008000      /* Big Endian */
225#define CFG_EM          0x00004000      /* ECC mode enable */
226#define CFG_EB          0x00002000      /* Block ordering */
227#define CFG_ICMASK      0x00000e00      /* Instruction cache size */
228#define CFG_ICSHIFT     9
229#define CFG_DCMASK      0x000001c0      /* Data cache size */
230#define CFG_DCSHIFT     6
231#define CFG_IB          0x00000020      /* Instruction cache block size */
232#define CFG_DB          0x00000010      /* Data cache block size */
233#define CFG_CU          0x00000008      /* Update on Store Conditional */
234#define CFG_K0MASK      0x00000007      /* KSEG0 coherency algorithm */
235
236/*
237 * R4000 primary cache mode
238 */
239#define CFG_C_UNCACHED          2
240#define CFG_C_NONCOHERENT       3
241#define CFG_C_COHERENTXCL       4
242#define CFG_C_COHERENTXCLW      5
243#define CFG_C_COHERENTUPD       6
244
245/*
246 * R4000 cache operations (should be in assembler...?)
247 */
248#define Index_Invalidate_I               0x0         /* 0       0 */
249#define Index_Writeback_Inv_D            0x1         /* 0       1 */
250#define Index_Invalidate_SI              0x2         /* 0       2 */
251#define Index_Writeback_Inv_SD           0x3         /* 0       3 */
252#define Index_Load_Tag_I                 0x4         /* 1       0 */
253#define Index_Load_Tag_D                 0x5         /* 1       1 */
254#define Index_Load_Tag_SI                0x6         /* 1       2 */
255#define Index_Load_Tag_SD                0x7         /* 1       3 */
256#define Index_Store_Tag_I                0x8         /* 2       0 */
257#define Index_Store_Tag_D                0x9         /* 2       1 */
258#define Index_Store_Tag_SI               0xA         /* 2       2 */
259#define Index_Store_Tag_SD               0xB         /* 2       3 */
260#define Create_Dirty_Exc_D               0xD         /* 3       1 */
261#define Create_Dirty_Exc_SD              0xF         /* 3       3 */
262#define Hit_Invalidate_I                 0x10        /* 4       0 */
263#define Hit_Invalidate_D                 0x11        /* 4       1 */
264#define Hit_Invalidate_SI                0x12        /* 4       2 */
265#define Hit_Invalidate_SD                0x13        /* 4       3 */
266#define Hit_Writeback_Inv_D              0x15        /* 5       1 */
267#define Hit_Writeback_Inv_SD             0x17        /* 5       3 */
268#define Fill_I                           0x14        /* 5       0 */
269#define Hit_Writeback_D                  0x19        /* 6       1 */
270#define Hit_Writeback_SD                 0x1B        /* 6       3 */
271#define Hit_Writeback_I                  0x18        /* 6       0 */
272#define Hit_Set_Virtual_SI               0x1E        /* 7       2 */
273#define Hit_Set_Virtual_SD               0x1F        /* 7       3 */
274
275#ifndef WAIT
276#define WAIT .word 0x42000020
277#endif /* WAIT */
278
279/* Disabled by joel -- horrible overload of common word.
280#ifndef wait
281#define wait .word 0x42000020
282#endif wait
283*/
284
285#endif
286
287/*
288** TLB resource defines
289*/
290#if  __mips == 1
291#define N_TLB_ENTRIES   64
292#define TLB_PGSIZE      0x1000
293#define RANDBASE        8
294#define TLBLO_PFNMASK   0xfffff000
295#define TLBLO_PFNSHIFT  12
296#define TLBLO_N         0x800   /* non-cacheable */
297#define TLBLO_D         0x400   /* writeable */
298#define TLBLO_V         0x200   /* valid bit */
299#define TLBLO_G         0x100   /* global access bit */
300
301#define TLBHI_VPNMASK   0xfffff000
302#define TLBHI_VPNSHIFT  12
303#define TLBHI_PIDMASK   0xfc0
304#define TLBHI_PIDSHIFT  6
305#define TLBHI_NPID      64
306
307#define TLBINX_PROBE    0x80000000
308#define TLBINX_INXMASK  0x00003f00
309#define TLBINX_INXSHIFT 8
310
311#define TLBRAND_RANDMASK        0x00003f00
312#define TLBRAND_RANDSHIFT       8
313
314#define TLBCTXT_BASEMASK        0xffe00000
315#define TLBCTXT_BASESHIFT       21
316
317#define TLBCTXT_VPNMASK         0x001ffffc
318#define TLBCTXT_VPNSHIFT        2
319#endif
320#if  __mips == 3
321#define N_TLB_ENTRIES   48
322
323#define TLBHI_VPN2MASK  0xffffe000
324#define TLBHI_PIDMASK   0x000000ff
325#define TLBHI_NPID      256
326
327#define TLBLO_PFNMASK   0x3fffffc0
328#define TLBLO_PFNSHIFT  6
329#define TLBLO_D         0x00000004      /* writeable */
330#define TLBLO_V         0x00000002      /* valid bit */
331#define TLBLO_G         0x00000001      /* global access bit */
332#define TLBLO_CMASK     0x00000038      /* cache algorithm mask */
333#define TLBLO_CSHIFT    3
334
335#define TLBLO_UNCACHED          (CFG_C_UNCACHED<<TLBLO_CSHIFT)
336#define TLBLO_NONCOHERENT       (CFG_C_NONCOHERENT<<TLBLO_CSHIFT)
337#define TLBLO_COHERENTXCL       (CFG_C_COHERENTXCL<<TLBLO_CSHIFT)
338#define TLBLO_COHERENTXCLW      (CFG_C_COHERENTXCLW<<TLBLO_CSHIFT)
339#define TLBLO_COHERENTUPD       (CFG_C_COHERENTUPD<<TLBLO_CSHIFT)
340
341#define TLBINX_PROBE    0x80000000
342#define TLBINX_INXMASK  0x0000003f
343
344#define TLBRAND_RANDMASK        0x0000003f
345
346#define TLBCTXT_BASEMASK        0xff800000
347#define TLBCTXT_BASESHIFT       23
348
349#define TLBCTXT_VPN2MASK        0x007ffff0
350#define TLBCTXT_VPN2SHIFT       4
351
352#define TLBPGMASK_MASK          0x01ffe000
353#endif
354
355#if  __mips == 32
356#define N_TLB_ENTRIES   16
357
358#define TLBHI_VPN2MASK  0xffffe000
359#define TLBHI_PIDMASK   0x000000ff
360#define TLBHI_NPID      256
361
362#define TLBLO_PFNMASK   0x3fffffc0
363#define TLBLO_PFNSHIFT  6
364#define TLBLO_D         0x00000004      /* writeable */
365#define TLBLO_V         0x00000002      /* valid bit */
366#define TLBLO_G         0x00000001      /* global access bit */
367#define TLBLO_CMASK     0x00000038      /* cache algorithm mask */
368#define TLBLO_CSHIFT    3
369
370#define TLBLO_UNCACHED          (CFG_C_UNCACHED<<TLBLO_CSHIFT)
371#define TLBLO_NONCOHERENT       (CFG_C_NONCOHERENT<<TLBLO_CSHIFT)
372#define TLBLO_COHERENTXCL       (CFG_C_COHERENTXCL<<TLBLO_CSHIFT)
373#define TLBLO_COHERENTXCLW      (CFG_C_COHERENTXCLW<<TLBLO_CSHIFT)
374#define TLBLO_COHERENTUPD       (CFG_C_COHERENTUPD<<TLBLO_CSHIFT)
375
376#define TLBINX_PROBE    0x80000000
377#define TLBINX_INXMASK  0x0000003f
378
379#define TLBRAND_RANDMASK        0x0000003f
380
381#define TLBCTXT_BASEMASK        0xff800000
382#define TLBCTXT_BASESHIFT       23
383
384#define TLBCTXT_VPN2MASK        0x007ffff0
385#define TLBCTXT_VPN2SHIFT       4
386
387#define TLBPGMASK_MASK          0x01ffe000
388#endif
389
390#if  __mips == 1
391
392
393/* definitions for Debug and Cache Invalidate control (DCIC) register bits */
394#define DCIC_TR         0x80000000      /* Trap enable */
395#define DCIC_UD         0x40000000      /* User debug enable */
396#define DCIC_KD         0x20000000      /* Kernel debug enable */
397#define DCIC_TE         0x10000000      /* Trace enable */
398#define DCIC_DW         0x08000000      /* Enable data breakpoints on write */
399#define DCIC_DR         0x04000000      /* Enable data breakpoints on read */
400#define DCIC_DAE        0x02000000      /* Enable data addresss breakpoints */
401#define DCIC_PCE        0x01000000      /* Enable instruction breakpoints */
402#define DCIC_DE         0x00800000      /* Debug enable */
403#define DCIC_DL         0x00008000      /* Data cache line invalidate */
404#define DCIC_IL         0x00004000      /* Instruction cache line invalidate */
405#define DCIC_D          0x00002000      /* Data cache invalidate enable */
406#define DCIC_I          0x00001000      /* Instr. cache invalidate enable */
407#define DCIC_T          0x00000020      /* Trace, set by CPU */
408#define DCIC_W          0x00000010      /* Write reference, set by CPU */
409#define DCIC_R          0x00000008      /* Read reference, set by CPU */
410#define DCIC_DA         0x00000004      /* Data address, set by CPU */
411#define DCIC_PC         0x00000002      /* Program counter, set by CPU */
412#define DCIC_DB         0x00000001      /* Debug, set by CPU */
413
414
415
416
417#define SR_CUMASK       0xf0000000      /* coproc usable bits */
418#define SR_CU3          0x80000000      /* Coprocessor 3 usable */
419#define SR_CU2          0x40000000      /* Coprocessor 2 usable */
420#define SR_CU1          0x20000000      /* Coprocessor 1 usable */
421#define SR_CU0          0x10000000      /* Coprocessor 0 usable */
422
423#define SR_BEV          0x00400000      /* use boot exception vectors */
424
425/* Cache control bits */
426#define SR_TS           0x00200000      /* TLB shutdown */
427#define SR_PE           0x00100000      /* cache parity error */
428#define SR_CM           0x00080000      /* cache miss */
429#define SR_PZ           0x00040000      /* cache parity zero */
430#define SR_SWC          0x00020000      /* swap cache */
431#define SR_ISC          0x00010000      /* Isolate data cache */
432
433/*
434**      status register interrupt masks and bits
435*/
436
437#define SR_IMASK        0x0000ff00      /* Interrupt mask */
438#define SR_IMASK8       0x00000000      /* mask level 8 */
439#define SR_IMASK7       0x00008000      /* mask level 7 */
440#define SR_IMASK6       0x0000c000      /* mask level 6 */
441#define SR_IMASK5       0x0000e000      /* mask level 5 */
442#define SR_IMASK4       0x0000f000      /* mask level 4 */
443#define SR_IMASK3       0x0000f800      /* mask level 3 */
444#define SR_IMASK2       0x0000fc00      /* mask level 2 */
445#define SR_IMASK1       0x0000fe00      /* mask level 1 */
446#define SR_IMASK0       0x0000ff00      /* mask level 0 */
447
448#define SR_IMASKSHIFT   8
449
450#define SR_IBIT8        0x00008000      /* bit level 8 */
451#define SR_IBIT7        0x00004000      /* bit level 7 */
452#define SR_IBIT6        0x00002000      /* bit level 6 */
453#define SR_IBIT5        0x00001000      /* bit level 5 */
454#define SR_IBIT4        0x00000800      /* bit level 4 */
455#define SR_IBIT3        0x00000400      /* bit level 3 */
456#define SR_IBIT2        0x00000200      /* bit level 2 */
457#define SR_IBIT1        0x00000100      /* bit level 1 */
458
459#define SR_KUO          0x00000020      /* old kernel/user, 0 => k, 1 => u */
460#define SR_IEO          0x00000010      /* old interrupt enable, 1 => enable */
461#define SR_KUP          0x00000008      /* prev kernel/user, 0 => k, 1 => u */
462#define SR_IEP          0x00000004      /* prev interrupt enable, 1 => enable */
463#define SR_KUC          0x00000002      /* cur kernel/user, 0 => k, 1 => u */
464#define SR_IEC          0x00000001      /* cur interrupt enable, 1 => enable */
465#endif
466
467#if  __mips == 3
468#define SR_CUMASK       0xf0000000      /* coproc usable bits */
469#define SR_CU3          0x80000000      /* Coprocessor 3 usable */
470#define SR_CU2          0x40000000      /* Coprocessor 2 usable */
471#define SR_CU1          0x20000000      /* Coprocessor 1 usable */
472#define SR_CU0          0x10000000      /* Coprocessor 0 usable */
473
474#define SR_RP           0x08000000      /* Reduced power operation */
475#define SR_FR           0x04000000      /* Additional floating point registers */
476#define SR_RE           0x02000000      /* Reverse endian in user mode */
477
478#define SR_BEV          0x00400000      /* Use boot exception vectors */
479#define SR_TS           0x00200000      /* TLB shutdown */
480#define SR_SR           0x00100000      /* Soft reset */
481#define SR_CH           0x00040000      /* Cache hit */
482#define SR_CE           0x00020000      /* Use cache ECC  */
483#define SR_DE           0x00010000      /* Disable cache exceptions */
484
485/*
486**      status register interrupt masks and bits
487*/
488
489#define SR_IMASK        0x0000ff00      /* Interrupt mask */
490#define SR_IMASK8       0x00000000      /* mask level 8 */
491#define SR_IMASK7       0x00008000      /* mask level 7 */
492#define SR_IMASK6       0x0000c000      /* mask level 6 */
493#define SR_IMASK5       0x0000e000      /* mask level 5 */
494#define SR_IMASK4       0x0000f000      /* mask level 4 */
495#define SR_IMASK3       0x0000f800      /* mask level 3 */
496#define SR_IMASK2       0x0000fc00      /* mask level 2 */
497#define SR_IMASK1       0x0000fe00      /* mask level 1 */
498#define SR_IMASK0       0x0000ff00      /* mask level 0 */
499
500#define SR_IMASKSHIFT   8
501
502#define SR_IBIT8        0x00008000      /* bit level 8 */
503#define SR_IBIT7        0x00004000      /* bit level 7 */
504#define SR_IBIT6        0x00002000      /* bit level 6 */
505#define SR_IBIT5        0x00001000      /* bit level 5 */
506#define SR_IBIT4        0x00000800      /* bit level 4 */
507#define SR_IBIT3        0x00000400      /* bit level 3 */
508#define SR_IBIT2        0x00000200      /* bit level 2 */
509#define SR_IBIT1        0x00000100      /* bit level 1 */
510
511#define SR_KSMASK       0x00000018      /* Kernel mode mask */
512#define SR_KSUSER       0x00000010      /* User mode */
513#define SR_KSSUPER      0x00000008      /* Supervisor mode */
514#define SR_KSKERNEL     0x00000000      /* Kernel mode */
515#define SR_ERL          0x00000004      /* Error level */
516#define SR_EXL          0x00000002      /* Exception level */
517#define SR_IE           0x00000001      /* Interrupts enabled */
518#endif
519
520#if  __mips == 32
521#define SR_CUMASK       0xf0000000      /* coproc usable bits */
522#define SR_CU3          0x80000000      /* Coprocessor 3 usable */
523#define SR_CU2          0x40000000      /* Coprocessor 2 usable */
524#define SR_CU1          0x20000000      /* Coprocessor 1 usable */
525#define SR_CU0          0x10000000      /* Coprocessor 0 usable */
526
527#define SR_RP           0x08000000      /* Reduced power operation */
528#define SR_FR           0x04000000      /* Additional floating point registers */
529#define SR_RE           0x02000000      /* Reverse endian in user mode */
530
531#define SR_BEV          0x00400000      /* Use boot exception vectors */
532#define SR_TS           0x00200000      /* TLB shutdown */
533#define SR_SR           0x00100000      /* Soft reset */
534#define SR_CH           0x00040000      /* Cache hit */
535#define SR_CE           0x00020000      /* Use cache ECC  */
536#define SR_DE           0x00010000      /* Disable cache exceptions */
537
538/*
539**      status register interrupt masks and bits
540*/
541
542#define SR_IMASK        0x0000ff00      /* Interrupt mask */
543#define SR_IMASK8       0x00000000      /* mask level 8 */
544#define SR_IMASK7       0x00008000      /* mask level 7 */
545#define SR_IMASK6       0x0000c000      /* mask level 6 */
546#define SR_IMASK5       0x0000e000      /* mask level 5 */
547#define SR_IMASK4       0x0000f000      /* mask level 4 */
548#define SR_IMASK3       0x0000f800      /* mask level 3 */
549#define SR_IMASK2       0x0000fc00      /* mask level 2 */
550#define SR_IMASK1       0x0000fe00      /* mask level 1 */
551#define SR_IMASK0       0x0000ff00      /* mask level 0 */
552
553#define SR_IMASKSHIFT   8
554
555#define SR_IBIT8        0x00008000      /* bit level 8 */
556#define SR_IBIT7        0x00004000      /* bit level 7 */
557#define SR_IBIT6        0x00002000      /* bit level 6 */
558#define SR_IBIT5        0x00001000      /* bit level 5 */
559#define SR_IBIT4        0x00000800      /* bit level 4 */
560#define SR_IBIT3        0x00000400      /* bit level 3 */
561#define SR_IBIT2        0x00000200      /* bit level 2 */
562#define SR_IBIT1        0x00000100      /* bit level 1 */
563
564#define SR_KSMASK       0x00000018      /* Kernel mode mask */
565#define SR_KSUSER       0x00000010      /* User mode */
566#define SR_KSSUPER      0x00000008      /* Supervisor mode */
567#define SR_KSKERNEL     0x00000000      /* Kernel mode */
568#define SR_ERL          0x00000004      /* Error level */
569#define SR_EXL          0x00000002      /* Exception level */
570#define SR_IE           0x00000001      /* Interrupts enabled */
571#endif
572
573/*
574 * Cause Register
575 */
576#define CAUSE_BD        0x80000000      /* Branch delay slot */
577#define CAUSE_BT        0x40000000      /* Branch Taken */
578#define CAUSE_CEMASK    0x30000000      /* coprocessor error */
579#define CAUSE_CESHIFT   28
580
581
582#define CAUSE_IPMASK    0x0000FF00      /* Pending interrupt mask */
583#define CAUSE_IPSHIFT   8
584
585#define CAUSE_EXCMASK   0x0000003C      /* Cause code bits */
586#define CAUSE_EXCSHIFT  2
587
588#ifndef XDS
589/*
590**  Coprocessor 0 registers
591*/
592#define C0_INX          $0              /* tlb index */
593#define C0_RAND         $1              /* tlb random */
594#if  __mips == 1
595#define C0_TLBLO        $2              /* tlb entry low */
596#endif
597#if  __mips == 3
598#define C0_TLBLO0       $2              /* tlb entry low 0 */
599#define C0_TLBLO1       $3              /* tlb entry low 1 */
600#endif
601
602#if  __mips == 32
603#define C0_TLBLO0       $2              /* tlb entry low 0 */
604#define C0_TLBLO1       $3              /* tlb entry low 1 */
605#endif
606
607
608#define C0_CTXT         $4              /* tlb context */
609
610#if  __mips == 3
611#define C0_PAGEMASK     $5              /* tlb page mask */
612#define C0_WIRED        $6              /* number of wired tlb entries */
613#endif
614
615#if  __mips == 32
616#define C0_PAGEMASK     $5              /* tlb page mask */
617#define C0_WIRED        $6              /* number of wired tlb entries */
618#endif
619
620#if  __mips == 1
621#define C0_TAR          $6
622#endif
623
624#define C0_BADVADDR     $8              /* bad virtual address */
625
626#if  __mips == 3
627#define C0_COUNT        $9              /* cycle count */
628#endif
629#if  __mips == 32
630#define C0_COUNT        $9              /* cycle count */
631#endif
632
633#define C0_TLBHI        $10             /* tlb entry hi */
634
635#if  __mips == 3
636#define C0_COMPARE      $11             /* cyccle count comparator  */
637#endif
638
639#if  __mips == 32
640#define C0_COMPARE      $11             /* cyccle count comparator  */
641#endif
642
643#define C0_SR           $12             /* status register */
644#define C0_CAUSE        $13             /* exception cause */
645#define C0_EPC          $14             /* exception pc */
646#define C0_PRID         $15             /* revision identifier */
647
648#if  __mips == 1
649#define C0_CONFIG   $3     /* configuration register R3081*/
650#endif
651
652#if  __mips == 3
653#define C0_CONFIG       $16             /* configuration register */
654#define C0_LLADDR       $17             /* linked load address */
655#define C0_WATCHLO      $18             /* watchpoint trap register */
656#define C0_WATCHHI      $19             /* watchpoint trap register */
657#define C0_XCTXT    $20     /* extended tlb context */
658#define C0_ECC          $26             /* secondary cache ECC control */
659#define C0_CACHEERR     $27             /* cache error status */
660#define C0_TAGLO        $28             /* cache tag lo */
661#define C0_TAGHI        $29             /* cache tag hi */
662#define C0_ERRPC        $30             /* cache error pc */
663#endif
664
665#if  __mips == 32
666#define C0_CONFIG       $16             /* configuration register */
667#define C0_LLADDR       $17             /* linked load address */
668#define C0_WATCHLO      $18             /* watchpoint trap register */
669#define C0_WATCHHI      $19             /* watchpoint trap register */
670#define C0_XCTXT    $20     /* extended tlb context */
671#define C0_ECC          $26             /* secondary cache ECC control */
672#define C0_CACHEERR     $27             /* cache error status */
673#define C0_TAGLO        $28             /* cache tag lo */
674#define C0_TAGHI        $29             /* cache tag hi */
675#define C0_ERRPC        $30             /* cache error pc */
676#endif
677
678
679#define C1_REVISION     $0
680#define C1_STATUS       $31
681
682#endif /* XDS */
683
684#ifdef R4650
685#define IWATCH $18
686#define DWATCH $19
687#define IBASE  $0
688#define IBOUND $1
689#define DBASE  $2
690#define DBOUND $3
691#define CALG    $17
692#endif
693
694#endif /* _IDTCPU_H__ */
695
Note: See TracBrowser for help on using the repository browser.