source: rtems/cpukit/score/cpu/mips/rtems/mips/idtcpu.h @ 0b993a94

4.104.114.84.95
Last change on this file since 0b993a94 was 7a845e2f, checked in by Joel Sherrill <joel.sherrill@…>, on 10/28/02 at 13:47:16

2002-10-28 Joel Sherrill <joel@…>

  • idtcpu.h: Removed warning by turning extra token at the end of an endif into a comment.
  • Property mode set to 100644
File size: 15.7 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 == 3
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#else
69#error "EXCEPTION VECTORS: unknown ISA level"
70#endif
71#define R_VEC   (K1BASE+0x1fc00000)     /* reset vector */
72
73/*
74** Address conversion macros
75*/
76#ifdef CLANGUAGE
77#define CAST(as) (as)
78#else
79#define CAST(as)
80#endif
81#define K0_TO_K1(x)     (CAST(unsigned)(x)|0xA0000000)  /* kseg0 to kseg1 */
82#define K1_TO_K0(x)     (CAST(unsigned)(x)&0x9FFFFFFF)  /* kseg1 to kseg0 */
83#define K0_TO_PHYS(x)   (CAST(unsigned)(x)&0x1FFFFFFF)  /* kseg0 to physical */
84#define K1_TO_PHYS(x)   (CAST(unsigned)(x)&0x1FFFFFFF)  /* kseg1 to physical */
85#define PHYS_TO_K0(x)   (CAST(unsigned)(x)|0x80000000)  /* physical to kseg0 */
86#define PHYS_TO_K1(x)   (CAST(unsigned)(x)|0xA0000000)  /* physical to kseg1 */
87
88/*
89**      Cache size constants
90*/
91#define MINCACHE        0x200           /* 512       For 3041. */
92#define MAXCACHE        0x40000         /* 256*1024   256k */   
93
94#if  __mips == 3
95/* R4000 configuration register definitions */
96#define CFG_CM          0x80000000      /* Master-Checker mode */
97#define CFG_ECMASK      0x70000000      /* System Clock Ratio */
98#define CFG_ECBY2       0x00000000      /* divide by 2 */
99#define CFG_ECBY3       0x10000000      /* divide by 3 */
100#define CFG_ECBY4       0x20000000      /* divide by 4 */
101#define CFG_EPMASK      0x0f000000      /* Transmit data pattern */
102#define CFG_EPD         0x00000000      /* D */
103#define CFG_EPDDX       0x01000000      /* DDX */
104#define CFG_EPDDXX      0x02000000      /* DDXX */
105#define CFG_EPDXDX      0x03000000      /* DXDX */
106#define CFG_EPDDXXX     0x04000000      /* DDXXX */
107#define CFG_EPDDXXXX    0x05000000      /* DDXXXX */
108#define CFG_EPDXXDXX    0x06000000      /* DXXDXX */
109#define CFG_EPDDXXXXX   0x07000000      /* DDXXXXX */
110#define CFG_EPDXXXDXXX  0x08000000      /* DXXXDXXX */
111#define CFG_SBMASK      0x00c00000      /* Secondary cache block size */
112#define CFG_SBSHIFT     22
113#define CFG_SB4         0x00000000      /* 4 words */
114#define CFG_SB8         0x00400000      /* 8 words */
115#define CFG_SB16        0x00800000      /* 16 words */
116#define CFG_SB32        0x00c00000      /* 32 words */
117#define CFG_SS          0x00200000      /* Split secondary cache */
118#define CFG_SW          0x00100000      /* Secondary cache port width */
119#define CFG_EWMASK      0x000c0000      /* System port width */
120#define CFG_EWSHIFT     18
121#define CFG_EW64        0x00000000      /* 64 bit */
122#define CFG_EW32        0x00010000      /* 32 bit */
123#define CFG_SC          0x00020000      /* Secondary cache absent */
124#define CFG_SM          0x00010000      /* Dirty Shared mode disabled */
125#define CFG_BE          0x00008000      /* Big Endian */
126#define CFG_EM          0x00004000      /* ECC mode enable */
127#define CFG_EB          0x00002000      /* Block ordering */
128#define CFG_ICMASK      0x00000e00      /* Instruction cache size */
129#define CFG_ICSHIFT     9
130#define CFG_DCMASK      0x000001c0      /* Data cache size */
131#define CFG_DCSHIFT     6
132#define CFG_IB          0x00000020      /* Instruction cache block size */
133#define CFG_DB          0x00000010      /* Data cache block size */
134#define CFG_CU          0x00000008      /* Update on Store Conditional */
135#define CFG_K0MASK      0x00000007      /* KSEG0 coherency algorithm */
136
137/*
138 * R4000 primary cache mode
139 */
140#define CFG_C_UNCACHED          2
141#define CFG_C_NONCOHERENT       3
142#define CFG_C_COHERENTXCL       4
143#define CFG_C_COHERENTXCLW      5
144#define CFG_C_COHERENTUPD       6
145
146/*
147 * R4000 cache operations (should be in assembler...?)
148 */
149#define Index_Invalidate_I               0x0         /* 0       0 */
150#define Index_Writeback_Inv_D            0x1         /* 0       1 */
151#define Index_Invalidate_SI              0x2         /* 0       2 */
152#define Index_Writeback_Inv_SD           0x3         /* 0       3 */
153#define Index_Load_Tag_I                 0x4         /* 1       0 */
154#define Index_Load_Tag_D                 0x5         /* 1       1 */
155#define Index_Load_Tag_SI                0x6         /* 1       2 */
156#define Index_Load_Tag_SD                0x7         /* 1       3 */
157#define Index_Store_Tag_I                0x8         /* 2       0 */
158#define Index_Store_Tag_D                0x9         /* 2       1 */
159#define Index_Store_Tag_SI               0xA         /* 2       2 */
160#define Index_Store_Tag_SD               0xB         /* 2       3 */
161#define Create_Dirty_Exc_D               0xD         /* 3       1 */
162#define Create_Dirty_Exc_SD              0xF         /* 3       3 */
163#define Hit_Invalidate_I                 0x10        /* 4       0 */
164#define Hit_Invalidate_D                 0x11        /* 4       1 */
165#define Hit_Invalidate_SI                0x12        /* 4       2 */
166#define Hit_Invalidate_SD                0x13        /* 4       3 */
167#define Hit_Writeback_Inv_D              0x15        /* 5       1 */
168#define Hit_Writeback_Inv_SD             0x17        /* 5       3 */
169#define Fill_I                           0x14        /* 5       0 */
170#define Hit_Writeback_D                  0x19        /* 6       1 */
171#define Hit_Writeback_SD                 0x1B        /* 6       3 */
172#define Hit_Writeback_I                  0x18        /* 6       0 */
173#define Hit_Set_Virtual_SI               0x1E        /* 7       2 */
174#define Hit_Set_Virtual_SD               0x1F        /* 7       3 */
175
176#ifndef WAIT
177#define WAIT .word 0x42000020
178#endif WAIT
179
180/* Disabled by joel -- horrible overload of common word.
181#ifndef wait
182#define wait .word 0x42000020
183#endif wait
184*/
185
186#endif
187
188/*
189** TLB resource defines
190*/
191#if  __mips == 1
192#define N_TLB_ENTRIES   64
193#define TLB_PGSIZE      0x1000
194#define RANDBASE        8
195#define TLBLO_PFNMASK   0xfffff000
196#define TLBLO_PFNSHIFT  12
197#define TLBLO_N         0x800   /* non-cacheable */
198#define TLBLO_D         0x400   /* writeable */
199#define TLBLO_V         0x200   /* valid bit */
200#define TLBLO_G         0x100   /* global access bit */
201
202#define TLBHI_VPNMASK   0xfffff000
203#define TLBHI_VPNSHIFT  12
204#define TLBHI_PIDMASK   0xfc0
205#define TLBHI_PIDSHIFT  6
206#define TLBHI_NPID      64
207
208#define TLBINX_PROBE    0x80000000
209#define TLBINX_INXMASK  0x00003f00
210#define TLBINX_INXSHIFT 8
211
212#define TLBRAND_RANDMASK        0x00003f00
213#define TLBRAND_RANDSHIFT       8
214
215#define TLBCTXT_BASEMASK        0xffe00000
216#define TLBCTXT_BASESHIFT       21
217
218#define TLBCTXT_VPNMASK         0x001ffffc
219#define TLBCTXT_VPNSHIFT        2
220#endif
221#if  __mips == 3
222#define N_TLB_ENTRIES   48
223
224#define TLBHI_VPN2MASK  0xffffe000
225#define TLBHI_PIDMASK   0x000000ff
226#define TLBHI_NPID      256
227
228#define TLBLO_PFNMASK   0x3fffffc0
229#define TLBLO_PFNSHIFT  6
230#define TLBLO_D         0x00000004      /* writeable */
231#define TLBLO_V         0x00000002      /* valid bit */
232#define TLBLO_G         0x00000001      /* global access bit */
233#define TLBLO_CMASK     0x00000038      /* cache algorithm mask */
234#define TLBLO_CSHIFT    3
235
236#define TLBLO_UNCACHED          (CFG_C_UNCACHED<<TLBLO_CSHIFT)
237#define TLBLO_NONCOHERENT       (CFG_C_NONCOHERENT<<TLBLO_CSHIFT)
238#define TLBLO_COHERENTXCL       (CFG_C_COHERENTXCL<<TLBLO_CSHIFT)
239#define TLBLO_COHERENTXCLW      (CFG_C_COHERENTXCLW<<TLBLO_CSHIFT)
240#define TLBLO_COHERENTUPD       (CFG_C_COHERENTUPD<<TLBLO_CSHIFT)
241
242#define TLBINX_PROBE    0x80000000
243#define TLBINX_INXMASK  0x0000003f
244
245#define TLBRAND_RANDMASK        0x0000003f
246
247#define TLBCTXT_BASEMASK        0xff800000
248#define TLBCTXT_BASESHIFT       23
249
250#define TLBCTXT_VPN2MASK        0x007ffff0
251#define TLBCTXT_VPN2SHIFT       4
252
253#define TLBPGMASK_MASK          0x01ffe000
254#endif
255
256#if  __mips == 1
257
258
259/* definitions for Debug and Cache Invalidate control (DCIC) register bits */
260#define DCIC_TR         0x80000000      /* Trap enable */
261#define DCIC_UD         0x40000000      /* User debug enable */
262#define DCIC_KD         0x20000000      /* Kernel debug enable */
263#define DCIC_TE         0x10000000      /* Trace enable */
264#define DCIC_DW         0x08000000      /* Enable data breakpoints on write */
265#define DCIC_DR         0x04000000      /* Enable data breakpoints on read */
266#define DCIC_DAE        0x02000000      /* Enable data addresss breakpoints */
267#define DCIC_PCE        0x01000000      /* Enable instruction breakpoints */
268#define DCIC_DE         0x00800000      /* Debug enable */
269#define DCIC_DL         0x00008000      /* Data cache line invalidate */
270#define DCIC_IL         0x00004000      /* Instruction cache line invalidate */
271#define DCIC_D          0x00002000      /* Data cache invalidate enable */
272#define DCIC_I          0x00001000      /* Instr. cache invalidate enable */
273#define DCIC_T          0x00000020      /* Trace, set by CPU */
274#define DCIC_W          0x00000010      /* Write reference, set by CPU */
275#define DCIC_R          0x00000008      /* Read reference, set by CPU */
276#define DCIC_DA         0x00000004      /* Data address, set by CPU */
277#define DCIC_PC         0x00000002      /* Program counter, set by CPU */
278#define DCIC_DB         0x00000001      /* Debug, set by CPU */
279
280
281
282
283#define SR_CUMASK       0xf0000000      /* coproc usable bits */
284#define SR_CU3          0x80000000      /* Coprocessor 3 usable */
285#define SR_CU2          0x40000000      /* Coprocessor 2 usable */
286#define SR_CU1          0x20000000      /* Coprocessor 1 usable */
287#define SR_CU0          0x10000000      /* Coprocessor 0 usable */
288
289#define SR_BEV          0x00400000      /* use boot exception vectors */
290
291/* Cache control bits */
292#define SR_TS           0x00200000      /* TLB shutdown */
293#define SR_PE           0x00100000      /* cache parity error */
294#define SR_CM           0x00080000      /* cache miss */
295#define SR_PZ           0x00040000      /* cache parity zero */
296#define SR_SWC          0x00020000      /* swap cache */
297#define SR_ISC          0x00010000      /* Isolate data cache */
298
299/*
300**      status register interrupt masks and bits
301*/
302
303#define SR_IMASK        0x0000ff00      /* Interrupt mask */
304#define SR_IMASK8       0x00000000      /* mask level 8 */
305#define SR_IMASK7       0x00008000      /* mask level 7 */
306#define SR_IMASK6       0x0000c000      /* mask level 6 */
307#define SR_IMASK5       0x0000e000      /* mask level 5 */
308#define SR_IMASK4       0x0000f000      /* mask level 4 */
309#define SR_IMASK3       0x0000f800      /* mask level 3 */
310#define SR_IMASK2       0x0000fc00      /* mask level 2 */
311#define SR_IMASK1       0x0000fe00      /* mask level 1 */
312#define SR_IMASK0       0x0000ff00      /* mask level 0 */
313
314#define SR_IMASKSHIFT   8
315
316#define SR_IBIT8        0x00008000      /* bit level 8 */
317#define SR_IBIT7        0x00004000      /* bit level 7 */
318#define SR_IBIT6        0x00002000      /* bit level 6 */
319#define SR_IBIT5        0x00001000      /* bit level 5 */
320#define SR_IBIT4        0x00000800      /* bit level 4 */
321#define SR_IBIT3        0x00000400      /* bit level 3 */
322#define SR_IBIT2        0x00000200      /* bit level 2 */
323#define SR_IBIT1        0x00000100      /* bit level 1 */
324
325#define SR_KUO          0x00000020      /* old kernel/user, 0 => k, 1 => u */
326#define SR_IEO          0x00000010      /* old interrupt enable, 1 => enable */
327#define SR_KUP          0x00000008      /* prev kernel/user, 0 => k, 1 => u */
328#define SR_IEP          0x00000004      /* prev interrupt enable, 1 => enable */
329#define SR_KUC          0x00000002      /* cur kernel/user, 0 => k, 1 => u */
330#define SR_IEC          0x00000001      /* cur interrupt enable, 1 => enable */
331#endif
332
333#if  __mips == 3
334#define SR_CUMASK       0xf0000000      /* coproc usable bits */
335#define SR_CU3          0x80000000      /* Coprocessor 3 usable */
336#define SR_CU2          0x40000000      /* Coprocessor 2 usable */
337#define SR_CU1          0x20000000      /* Coprocessor 1 usable */
338#define SR_CU0          0x10000000      /* Coprocessor 0 usable */
339
340#define SR_RP           0x08000000      /* Reduced power operation */
341#define SR_FR           0x04000000      /* Additional floating point registers */
342#define SR_RE           0x02000000      /* Reverse endian in user mode */
343
344#define SR_BEV          0x00400000      /* Use boot exception vectors */
345#define SR_TS           0x00200000      /* TLB shutdown */
346#define SR_SR           0x00100000      /* Soft reset */
347#define SR_CH           0x00040000      /* Cache hit */
348#define SR_CE           0x00020000      /* Use cache ECC  */
349#define SR_DE           0x00010000      /* Disable cache exceptions */
350
351/*
352**      status register interrupt masks and bits
353*/
354
355#define SR_IMASK        0x0000ff00      /* Interrupt mask */
356#define SR_IMASK8       0x00000000      /* mask level 8 */
357#define SR_IMASK7       0x00008000      /* mask level 7 */
358#define SR_IMASK6       0x0000c000      /* mask level 6 */
359#define SR_IMASK5       0x0000e000      /* mask level 5 */
360#define SR_IMASK4       0x0000f000      /* mask level 4 */
361#define SR_IMASK3       0x0000f800      /* mask level 3 */
362#define SR_IMASK2       0x0000fc00      /* mask level 2 */
363#define SR_IMASK1       0x0000fe00      /* mask level 1 */
364#define SR_IMASK0       0x0000ff00      /* mask level 0 */
365
366#define SR_IMASKSHIFT   8
367
368#define SR_IBIT8        0x00008000      /* bit level 8 */
369#define SR_IBIT7        0x00004000      /* bit level 7 */
370#define SR_IBIT6        0x00002000      /* bit level 6 */
371#define SR_IBIT5        0x00001000      /* bit level 5 */
372#define SR_IBIT4        0x00000800      /* bit level 4 */
373#define SR_IBIT3        0x00000400      /* bit level 3 */
374#define SR_IBIT2        0x00000200      /* bit level 2 */
375#define SR_IBIT1        0x00000100      /* bit level 1 */
376
377#define SR_KSMASK       0x00000018      /* Kernel mode mask */
378#define SR_KSUSER       0x00000010      /* User mode */
379#define SR_KSSUPER      0x00000008      /* Supervisor mode */
380#define SR_KSKERNEL     0x00000000      /* Kernel mode */
381#define SR_ERL          0x00000004      /* Error level */
382#define SR_EXL          0x00000002      /* Exception level */
383#define SR_IE           0x00000001      /* Interrupts enabled */
384#endif
385
386
387
388/*
389 * Cause Register
390 */
391#define CAUSE_BD        0x80000000      /* Branch delay slot */
392#define CAUSE_BT        0x40000000      /* Branch Taken */
393#define CAUSE_CEMASK    0x30000000      /* coprocessor error */
394#define CAUSE_CESHIFT   28
395
396
397#define CAUSE_IPMASK    0x0000FF00      /* Pending interrupt mask */
398#define CAUSE_IPSHIFT   8
399
400#define CAUSE_EXCMASK   0x0000003C      /* Cause code bits */
401#define CAUSE_EXCSHIFT  2
402
403#ifndef XDS
404/*
405**  Coprocessor 0 registers
406*/
407#define C0_INX          $0              /* tlb index */
408#define C0_RAND         $1              /* tlb random */
409#if  __mips == 1
410#define C0_TLBLO        $2              /* tlb entry low */
411#endif
412#if  __mips == 3
413#define C0_TLBLO0       $2              /* tlb entry low 0 */
414#define C0_TLBLO1       $3              /* tlb entry low 1 */
415#endif
416
417#define C0_CTXT         $4              /* tlb context */
418
419#if  __mips == 3
420#define C0_PAGEMASK     $5              /* tlb page mask */
421#define C0_WIRED        $6              /* number of wired tlb entries */
422#endif
423
424#if  __mips == 1
425#define C0_TAR          $6
426#endif
427
428#define C0_BADVADDR     $8              /* bad virtual address */
429
430#if  __mips == 3
431#define C0_COUNT        $9              /* cycle count */
432#endif
433
434#define C0_TLBHI        $10             /* tlb entry hi */
435
436#if  __mips == 3
437#define C0_COMPARE      $11             /* cyccle count comparator  */
438#endif
439
440#define C0_SR           $12             /* status register */
441#define C0_CAUSE        $13             /* exception cause */
442#define C0_EPC          $14             /* exception pc */
443#define C0_PRID         $15             /* revision identifier */
444
445#if  __mips == 1
446#define C0_CONFIG   $3     /* configuration register R3081*/
447#endif
448
449#if  __mips == 3
450#define C0_CONFIG       $16             /* configuration register */
451#define C0_LLADDR       $17             /* linked load address */
452#define C0_WATCHLO      $18             /* watchpoint trap register */
453#define C0_WATCHHI      $19             /* watchpoint trap register */
454#define C0_XCTXT    $20     /* extended tlb context */
455#define C0_ECC          $26             /* secondary cache ECC control */
456#define C0_CACHEERR     $27             /* cache error status */
457#define C0_TAGLO        $28             /* cache tag lo */
458#define C0_TAGHI        $29             /* cache tag hi */
459#define C0_ERRPC        $30             /* cache error pc */
460#endif
461
462#define C1_REVISION     $0
463#define C1_STATUS       $31
464
465#endif / * XDS */
466
467#ifdef R4650
468#define IWATCH $18
469#define DWATCH $19
470#define IBASE  $0
471#define IBOUND $1
472#define DBASE  $2
473#define DBOUND $3
474#define CALG    $17
475#endif
476
477#endif /* _IDTCPU_H__ */
478
Note: See TracBrowser for help on using the repository browser.