43#ifndef _RTEMS_POWERPC_POWERPC_H
44#define _RTEMS_POWERPC_POWERPC_H
95#define PPC_LOW_POWER_MODE_NONE 0
96#define PPC_LOW_POWER_MODE_STANDARD 1
101#define PPC_NO_CACHE_ALIGNMENT 4
107#define PPC_NO_CACHE_ALIGNMENT_POWER 2
122#define PPC_CACHE_ALIGNMENT 32
124#define PPC_HAS_RFCI 1
125#define PPC_USE_MULTIPLE 1
126#define PPC_I_CACHE 16384
127#define PPC_D_CACHE 16384
128#define PPC_HAS_EXCEPTION_PREFIX 0
129#define PPC_HAS_EVPR 1
140#define PPC_CACHE_ALIGNMENT 16
142#define PPC_HAS_RFCI 1
143#define PPC_USE_MULTIPLE 1
144#define PPC_I_CACHE 2048
145#define PPC_D_CACHE 1024
147#define PPC_HAS_EXCEPTION_PREFIX 0
148#define PPC_HAS_EVPR 1
150#elif defined (ppc440)
152#define PPC_CACHE_ALIGNMENT 32
154#define PPC_HAS_RFCI 1
155#define PPC_USE_MULTIPLE 1
156#define PPC_I_CACHE 32768
157#define PPC_D_CACHE 32768
158#define PPC_HAS_EXCEPTION_PREFIX 0
159#define PPC_HAS_EVPR 1
164#define PPC_CACHE_ALIGNMENT PPC_NO_CACHE_ALIGNMENT
167#define PPC_LOW_POWER_MODE PPC_LOW_POWER_MODE_STANDARD
173#elif defined(mpc505) || defined(mpc509)
180#define CPU_MODEL_NAME "PowerPC 505/509"
182#define PPC_CACHE_ALIGNMENT PPC_NO_CACHE_ALIGNMENT
183#define PPC_I_CACHE 4096
193#define PPC_USE_MULTIPLE 1
195#define PPC_D_CACHE 32768
202#define PPC_I_CACHE 8192
203#define PPC_D_CACHE 8192
205#elif defined(ppc603e)
213#define PPC_I_CACHE 16384
214#define PPC_D_CACHE 16384
216#define PPC_LOW_POWER_MODE PPC_LOW_POWER_MODE_STANDARD
223#define PPC_I_CACHE 16384
224#define PPC_D_CACHE 16384
231#define PPC_I_CACHE 4096
232#define PPC_D_CACHE 4096
233#define PPC_CACHE_ALIGNMENT 16
234#define PPC_INTERRUPT_MAX 71
235#define PPC_USE_MULTIPLE 1
237#define PPC_MSR_0 0x00009000
238#define PPC_MSR_1 0x00001000
239#define PPC_MSR_2 0x00001000
240#define PPC_MSR_3 0x00000000
246#define PPC_I_CACHE 4096
247#define PPC_D_CACHE 4096
248#define PPC_CACHE_ALIGNMENT 16
249#define PPC_INTERRUPT_MAX 71
251#define PPC_MSR_0 0x00009000
252#define PPC_MSR_1 0x00001000
253#define PPC_MSR_2 0x00001000
254#define PPC_MSR_3 0x00000000
258#define PPC_I_CACHE 16384
259#define PPC_D_CACHE 16384
261#elif defined(mpc7400)
263#define PPC_I_CACHE 32768
264#define PPC_D_CACHE 32768
266#elif defined(mpc7455)
271#define PPC_CACHE_ALIGNMENT 32
272#define PPC_I_CACHE 32768
273#define PPC_D_CACHE 32768
275#elif defined(mpc8260)
279#define PPC_I_CACHE 16384
280#define PPC_D_CACHE 16384
281#define PPC_CACHE_ALIGNMENT 32
282#define PPC_INTERRUPT_MAX 125
283#define PPC_USE_MULTIPLE 1
285#elif defined(__ppc_generic)
289#error "Unsupported CPU Model"
298#ifndef PPC_INTERRUPT_MAX
299#define PPC_INTERRUPT_MAX 16
302#ifndef PPC_CACHE_ALIGNMENT
303#define PPC_CACHE_ALIGNMENT PPC_DEFAULT_CACHE_LINE_SIZE
306#if (PPC_CACHE_ALIGNMENT == 16)
307#define PPC_CACHE_ALIGN_POWER 4
308#elif (PPC_CACHE_ALIGNMENT == 32)
309#define PPC_CACHE_ALIGN_POWER 5
310#elif (PPC_CACHE_ALIGNMENT == 64)
311#define PPC_CACHE_ALIGN_POWER 6
312#elif (PPC_CACHE_ALIGNMENT == PPC_NO_CACHE_ALIGNMENT)
313#define PPC_CACHE_ALIGN_POWER PPC_NO_CACHE_ALIGNMENT_POWER
315#error "Undefined power of 2 for PPC_CACHE_ALIGNMENT"
323#ifndef PPC_HAS_EXCEPTION_PREFIX
324#define PPC_HAS_EXCEPTION_PREFIX 1
341#define PPC_HAS_EVPR 0
348#ifndef PPC_LOW_POWER_MODE
349#define PPC_LOW_POWER_MODE PPC_LOW_POWER_MODE_NONE
358#define PPC_HAS_RFCI 0
366#ifndef PPC_USE_MULTIPLE
367#define PPC_USE_MULTIPLE 0
381#define PPC_IRQ_SYSTEM_RESET 0
382#define PPC_IRQ_MCHECK 1
383#define PPC_IRQ_PROTECT 2
385#define PPC_IRQ_EXTERNAL 4
386#define PPC_IRQ_ALIGNMENT 5
387#define PPC_IRQ_PROGRAM 6
388#define PPC_IRQ_NOFP 7
389#define PPC_IRQ_DECREMENTER 8
390#define PPC_IRQ_RESERVED_A 9
391#define PPC_IRQ_RESERVED_B 10
392#define PPC_IRQ_SCALL 11
393#define PPC_IRQ_TRACE 12
394#define PPC_IRQ_FP_ASST 13
395#define PPC_STD_IRQ_LAST PPC_IRQ_FP_ASST
397#define PPC_IRQ_FIRST PPC_IRQ_SYSTEM_RESET
399#if defined(ppc403) || defined(ppc405) || defined(ppc440)
401#define PPC_IRQ_CRIT PPC_IRQ_SYSTEM_RESET
402#define PPC_IRQ_PIT (PPC_STD_IRQ_LAST+1)
403#define PPC_IRQ_FIT (PPC_STD_IRQ_LAST+2)
404#define PPC_IRQ_WATCHDOG (PPC_STD_IRQ_LAST+3)
405#define PPC_IRQ_DEBUG (PPC_STD_IRQ_LAST+4)
406#define PPC_IRQ_LAST PPC_IRQ_DEBUG
408#elif defined(mpc505) || defined(mpc509)
409#define PPC_IRQ_SOFTEMU (PPC_STD_IRQ_LAST+1)
410#define PPC_IRQ_DATA_BP (PPC_STD_IRQ_LAST+ 2)
411#define PPC_IRQ_INST_BP (PPC_STD_IRQ_LAST+ 3)
412#define PPC_IRQ_MEXT_BP (PPC_STD_IRQ_LAST+ 4)
413#define PPC_IRQ_NMEXT_BP (PPC_STD_IRQ_LAST+ 5)
416#define PPC_IRQ_SOFTEMU (PPC_STD_IRQ_LAST+1)
417#define PPC_IRQ_INST_PE (PPC_STD_IRQ_LAST+2)
418#define PPC_IRQ_DATA_PE (PPC_STD_IRQ_LAST+3)
419#define PPC_IRQ_DATA_BP (PPC_STD_IRQ_LAST+4)
420#define PPC_IRQ_INST_BP (PPC_STD_IRQ_LAST+5)
421#define PPC_IRQ_MEXT_BP (PPC_STD_IRQ_LAST+6)
422#define PPC_IRQ_NMEXT_BP (PPC_STD_IRQ_LAST+7)
423#define PPC_IRQ_LAST PPC_IRQ_NMEXT_BP
427#define PPC_IRQ_TRACE (PPC_STD_IRQ_LAST+1)
428#define PPC_IRQ_LAST PPC_IRQ_TRACE
431#define PPC_IRQ_LAST (PPC_STD_IRQ_LAST)
433#elif defined(ppc603) || defined(ppc603e)
434#define PPC_IRQ_TRANS_MISS (PPC_STD_IRQ_LAST+1)
435#define PPC_IRQ_DATA_LOAD (PPC_STD_IRQ_LAST+2)
436#define PPC_IRQ_DATA_STORE (PPC_STD_IRQ_LAST+3)
437#define PPC_IRQ_ADDR_BRK (PPC_STD_IRQ_LAST+4)
438#define PPC_IRQ_SYS_MGT (PPC_STD_IRQ_LAST+5)
439#define PPC_IRQ_LAST PPC_IRQ_SYS_MGT
442#define PPC_IRQ_ADDR_BRK (PPC_STD_IRQ_LAST+1)
443#define PPC_IRQ_SYS_MGT (PPC_STD_IRQ_LAST+2)
444#define PPC_IRQ_LAST PPC_IRQ_SYS_MGT
446#elif defined(mpc860) || defined(mpc821)
447#define PPC_IRQ_EMULATE (PPC_STD_IRQ_LAST+1)
448#define PPC_IRQ_INST_MISS (PPC_STD_IRQ_LAST+2)
449#define PPC_IRQ_DATA_MISS (PPC_STD_IRQ_LAST+3)
450#define PPC_IRQ_INST_ERR (PPC_STD_IRQ_LAST+4)
451#define PPC_IRQ_DATA_ERR (PPC_STD_IRQ_LAST+5)
452#define PPC_IRQ_DATA_BPNT (PPC_STD_IRQ_LAST+6)
453#define PPC_IRQ_INST_BPNT (PPC_STD_IRQ_LAST+7)
454#define PPC_IRQ_IO_BPNT (PPC_STD_IRQ_LAST+8)
455#define PPC_IRQ_DEV_PORT (PPC_STD_IRQ_LAST+9)
456#define PPC_IRQ_IRQ0 (PPC_STD_IRQ_LAST + 10)
457#define PPC_IRQ_LVL0 (PPC_STD_IRQ_LAST + 11)
458#define PPC_IRQ_IRQ1 (PPC_STD_IRQ_LAST + 12)
459#define PPC_IRQ_LVL1 (PPC_STD_IRQ_LAST + 13)
460#define PPC_IRQ_IRQ2 (PPC_STD_IRQ_LAST + 14)
461#define PPC_IRQ_LVL2 (PPC_STD_IRQ_LAST + 15)
462#define PPC_IRQ_IRQ3 (PPC_STD_IRQ_LAST + 16)
463#define PPC_IRQ_LVL3 (PPC_STD_IRQ_LAST + 17)
464#define PPC_IRQ_IRQ4 (PPC_STD_IRQ_LAST + 18)
465#define PPC_IRQ_LVL4 (PPC_STD_IRQ_LAST + 19)
466#define PPC_IRQ_IRQ5 (PPC_STD_IRQ_LAST + 20)
467#define PPC_IRQ_LVL5 (PPC_STD_IRQ_LAST + 21)
468#define PPC_IRQ_IRQ6 (PPC_STD_IRQ_LAST + 22)
469#define PPC_IRQ_LVL6 (PPC_STD_IRQ_LAST + 23)
470#define PPC_IRQ_IRQ7 (PPC_STD_IRQ_LAST + 24)
471#define PPC_IRQ_LVL7 (PPC_STD_IRQ_LAST + 25)
472#define PPC_IRQ_CPM_ERROR (PPC_STD_IRQ_LAST + 26)
473#define PPC_IRQ_CPM_PC4 (PPC_STD_IRQ_LAST + 27)
474#define PPC_IRQ_CPM_PC5 (PPC_STD_IRQ_LAST + 28)
475#define PPC_IRQ_CPM_SMC2 (PPC_STD_IRQ_LAST + 29)
476#define PPC_IRQ_CPM_SMC1 (PPC_STD_IRQ_LAST + 30)
477#define PPC_IRQ_CPM_SPI (PPC_STD_IRQ_LAST + 31)
478#define PPC_IRQ_CPM_PC6 (PPC_STD_IRQ_LAST + 32)
479#define PPC_IRQ_CPM_TIMER4 (PPC_STD_IRQ_LAST + 33)
480#define PPC_IRQ_CPM_RESERVED_8 (PPC_STD_IRQ_LAST + 34)
481#define PPC_IRQ_CPM_PC7 (PPC_STD_IRQ_LAST + 35)
482#define PPC_IRQ_CPM_PC8 (PPC_STD_IRQ_LAST + 36)
483#define PPC_IRQ_CPM_PC9 (PPC_STD_IRQ_LAST + 37)
484#define PPC_IRQ_CPM_TIMER3 (PPC_STD_IRQ_LAST + 38)
485#define PPC_IRQ_CPM_RESERVED_D (PPC_STD_IRQ_LAST + 39)
486#define PPC_IRQ_CPM_PC10 (PPC_STD_IRQ_LAST + 40)
487#define PPC_IRQ_CPM_PC11 (PPC_STD_IRQ_LAST + 41)
488#define PPC_IRQ_CPM_I2C (PPC_STD_IRQ_LAST + 42)
489#define PPC_IRQ_CPM_RISC_TIMER (PPC_STD_IRQ_LAST + 43)
490#define PPC_IRQ_CPM_TIMER2 (PPC_STD_IRQ_LAST + 44)
491#define PPC_IRQ_CPM_RESERVED_13 (PPC_STD_IRQ_LAST + 45)
492#define PPC_IRQ_CPM_IDMA2 (PPC_STD_IRQ_LAST + 46)
493#define PPC_IRQ_CPM_IDMA1 (PPC_STD_IRQ_LAST + 47)
494#define PPC_IRQ_CPM_SDMA_ERROR (PPC_STD_IRQ_LAST + 48)
495#define PPC_IRQ_CPM_PC12 (PPC_STD_IRQ_LAST + 49)
496#define PPC_IRQ_CPM_PC13 (PPC_STD_IRQ_LAST + 50)
497#define PPC_IRQ_CPM_TIMER1 (PPC_STD_IRQ_LAST + 51)
498#define PPC_IRQ_CPM_PC14 (PPC_STD_IRQ_LAST + 52)
499#define PPC_IRQ_CPM_SCC4 (PPC_STD_IRQ_LAST + 53)
500#define PPC_IRQ_CPM_SCC3 (PPC_STD_IRQ_LAST + 54)
501#define PPC_IRQ_CPM_SCC2 (PPC_STD_IRQ_LAST + 55)
502#define PPC_IRQ_CPM_SCC1 (PPC_STD_IRQ_LAST + 56)
503#define PPC_IRQ_CPM_PC15 (PPC_STD_IRQ_LAST + 57)
505#define PPC_IRQ_LAST PPC_IRQ_CPM_PC15
507#elif defined(mpc8260)
509#define PPC_IRQ_INST_MISS (PPC_STD_IRQ_LAST+1)
510#define PPC_IRQ_DATA_MISS (PPC_STD_IRQ_LAST+2)
511#define PPC_IRQ_DATA_L_MISS (PPC_STD_IRQ_LAST+3)
512#define PPC_IRQ_DATA_S_MISS (PPC_STD_IRQ_LAST+4)
513#define PPC_IRQ_INST_BPNT (PPC_STD_IRQ_LAST+5)
514#define PPC_IRQ_SYS_MGT (PPC_STD_IRQ_LAST+6)
516#define PPC_IRQ_CPM_NONE (PPC_STD_IRQ_LAST + 50)
517#define PPC_IRQ_CPM_I2C (PPC_STD_IRQ_LAST + 51)
518#define PPC_IRQ_CPM_SPI (PPC_STD_IRQ_LAST + 52)
519#define PPC_IRQ_CPM_RISC_TIMER (PPC_STD_IRQ_LAST + 53)
520#define PPC_IRQ_CPM_SMC1 (PPC_STD_IRQ_LAST + 54)
521#define PPC_IRQ_CPM_SMC2 (PPC_STD_IRQ_LAST + 55)
522#define PPC_IRQ_CPM_IDMA1 (PPC_STD_IRQ_LAST + 56)
523#define PPC_IRQ_CPM_IDMA2 (PPC_STD_IRQ_LAST + 57)
524#define PPC_IRQ_CPM_IDMA3 (PPC_STD_IRQ_LAST + 58)
525#define PPC_IRQ_CPM_IDMA4 (PPC_STD_IRQ_LAST + 59)
526#define PPC_IRQ_CPM_SDMA (PPC_STD_IRQ_LAST + 60)
527#define PPC_IRQ_CPM_RES_A (PPC_STD_IRQ_LAST + 61)
528#define PPC_IRQ_CPM_TIMER1 (PPC_STD_IRQ_LAST + 62)
529#define PPC_IRQ_CPM_TIMER2 (PPC_STD_IRQ_LAST + 63)
530#define PPC_IRQ_CPM_TIMER3 (PPC_STD_IRQ_LAST + 64)
531#define PPC_IRQ_CPM_TIMER4 (PPC_STD_IRQ_LAST + 65)
532#define PPC_IRQ_CPM_TMCNT (PPC_STD_IRQ_LAST + 66)
533#define PPC_IRQ_CPM_PIT (PPC_STD_IRQ_LAST + 67)
534#define PPC_IRQ_CPM_RES_B (PPC_STD_IRQ_LAST + 68)
535#define PPC_IRQ_CPM_IRQ1 (PPC_STD_IRQ_LAST + 69)
536#define PPC_IRQ_CPM_IRQ2 (PPC_STD_IRQ_LAST + 70)
537#define PPC_IRQ_CPM_IRQ3 (PPC_STD_IRQ_LAST + 71)
538#define PPC_IRQ_CPM_IRQ4 (PPC_STD_IRQ_LAST + 72)
539#define PPC_IRQ_CPM_IRQ5 (PPC_STD_IRQ_LAST + 73)
540#define PPC_IRQ_CPM_IRQ6 (PPC_STD_IRQ_LAST + 74)
541#define PPC_IRQ_CPM_IRQ7 (PPC_STD_IRQ_LAST + 75)
542#define PPC_IRQ_CPM_RES_C (PPC_STD_IRQ_LAST + 76)
543#define PPC_IRQ_CPM_RES_D (PPC_STD_IRQ_LAST + 77)
544#define PPC_IRQ_CPM_RES_E (PPC_STD_IRQ_LAST + 78)
545#define PPC_IRQ_CPM_RES_F (PPC_STD_IRQ_LAST + 79)
546#define PPC_IRQ_CPM_RES_G (PPC_STD_IRQ_LAST + 80)
547#define PPC_IRQ_CPM_RES_H (PPC_STD_IRQ_LAST + 81)
548#define PPC_IRQ_CPM_FCC1 (PPC_STD_IRQ_LAST + 82)
549#define PPC_IRQ_CPM_FCC2 (PPC_STD_IRQ_LAST + 83)
550#define PPC_IRQ_CPM_FCC3 (PPC_STD_IRQ_LAST + 84)
551#define PPC_IRQ_CPM_RES_I (PPC_STD_IRQ_LAST + 85)
552#define PPC_IRQ_CPM_MCC1 (PPC_STD_IRQ_LAST + 86)
553#define PPC_IRQ_CPM_MCC2 (PPC_STD_IRQ_LAST + 87)
554#define PPC_IRQ_CPM_RES_J (PPC_STD_IRQ_LAST + 88)
555#define PPC_IRQ_CPM_RES_K (PPC_STD_IRQ_LAST + 89)
556#define PPC_IRQ_CPM_SCC1 (PPC_STD_IRQ_LAST + 90)
557#define PPC_IRQ_CPM_SCC2 (PPC_STD_IRQ_LAST + 91)
558#define PPC_IRQ_CPM_SCC3 (PPC_STD_IRQ_LAST + 92)
559#define PPC_IRQ_CPM_SCC4 (PPC_STD_IRQ_LAST + 93)
560#define PPC_IRQ_CPM_RES_L (PPC_STD_IRQ_LAST + 94)
561#define PPC_IRQ_CPM_RES_M (PPC_STD_IRQ_LAST + 95)
562#define PPC_IRQ_CPM_RES_N (PPC_STD_IRQ_LAST + 96)
563#define PPC_IRQ_CPM_RES_O (PPC_STD_IRQ_LAST + 97)
564#define PPC_IRQ_CPM_PC15 (PPC_STD_IRQ_LAST + 98)
565#define PPC_IRQ_CPM_PC14 (PPC_STD_IRQ_LAST + 99)
566#define PPC_IRQ_CPM_PC13 (PPC_STD_IRQ_LAST + 100)
567#define PPC_IRQ_CPM_PC12 (PPC_STD_IRQ_LAST + 101)
568#define PPC_IRQ_CPM_PC11 (PPC_STD_IRQ_LAST + 102)
569#define PPC_IRQ_CPM_PC10 (PPC_STD_IRQ_LAST + 103)
570#define PPC_IRQ_CPM_PC9 (PPC_STD_IRQ_LAST + 104)
571#define PPC_IRQ_CPM_PC8 (PPC_STD_IRQ_LAST + 105)
572#define PPC_IRQ_CPM_PC7 (PPC_STD_IRQ_LAST + 106)
573#define PPC_IRQ_CPM_PC6 (PPC_STD_IRQ_LAST + 107)
574#define PPC_IRQ_CPM_PC5 (PPC_STD_IRQ_LAST + 108)
575#define PPC_IRQ_CPM_PC4 (PPC_STD_IRQ_LAST + 109)
576#define PPC_IRQ_CPM_PC3 (PPC_STD_IRQ_LAST + 110)
577#define PPC_IRQ_CPM_PC2 (PPC_STD_IRQ_LAST + 111)
578#define PPC_IRQ_CPM_PC1 (PPC_STD_IRQ_LAST + 112)
579#define PPC_IRQ_CPM_PC0 (PPC_STD_IRQ_LAST + 113)
581#define PPC_IRQ_LAST PPC_IRQ_CPM_PC0
591#if PPC_INTERRUPT_MAX <= PPC_IRQ_LAST
592#undef PPC_INTERRUPT_MAX
593#define PPC_INTERRUPT_MAX ((PPC_IRQ_LAST) + 1)
601#define PPC_MSR_RI 0x000000002
604#define PPC_MSR_DR 0x000000010
605#define PPC_MSR_IR 0x000000020
611#if (PPC_HAS_EXCEPTION_PREFIX)
612#define PPC_MSR_EP 0x000000040
614#define PPC_MSR_EP 0x000000000
618#define PPC_MSR_FP 0x000002000
620#define PPC_MSR_FP 0x000000000
623#if (PPC_LOW_POWER_MODE == PPC_LOW_POWER_MODE_NONE)
624#define PPC_MSR_POW 0x000000000
626#define PPC_MSR_POW 0x000040000
629#define PPC_MSR_ME 0x000001000
630#define PPC_MSR_EE 0x000008000
633#define PPC_MSR_CE 0x000020000
635#define PPC_MSR_CE 0x000000000
638#define PPC_MSR_DISABLE_MASK (PPC_MSR_ME|PPC_MSR_EE|PPC_MSR_CE)
640#if defined(__powerpc64__)
641#define PPC_MINIMUM_STACK_FRAME_SIZE 32
643#define PPC_MINIMUM_STACK_FRAME_SIZE PPC_STACK_ALIGNMENT
IBM/Motorola PowerPC Definitions.