e500.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright 2003 Motorola,Inc.
  3. * Xianghua Xiao(x.xiao@motorola.com)
  4. */
  5. #ifndef __E500_H__
  6. #define __E500_H__
  7. #ifndef __ASSEMBLY__
  8. typedef struct
  9. {
  10. unsigned long freqProcessor;
  11. unsigned long freqSystemBus;
  12. } MPC85xx_SYS_INFO;
  13. #endif /* _ASMLANGUAGE */
  14. /* Motorola E500 core provides 16 TLB1 entries; they can be used for
  15. * initial memory mapping like legacy BAT registers do. Usually we
  16. * use four MAS registers(MAS0-3) to operate on TLB1 entries.
  17. *
  18. * We also need LAWs(Local Access Window) to associate a range of
  19. * the local 32-bit address space with a particular target interface
  20. * such as PCI/PCI-X, RapidIO, Local Bus and DDR SDRAM.
  21. *
  22. * We put TLB1/LAW code here because memory mapping is board-specific
  23. * instead of cpu-specific.
  24. */
  25. /* MAS0
  26. * tlbsel(TLB Select):0,1
  27. * esel(Entry Select): 0,1,2,...,15 for TLB1
  28. * nv(Next victim):0,1
  29. */
  30. #define TLB1_MAS0(tlbsel,esel,nv) \
  31. ((((tlbsel) << 28) & MAS0_TLBSEL) |\
  32. (((esel) << 16) & MAS0_ESEL ) |\
  33. (nv) )
  34. /* MAS1
  35. * v(TLB valid bit):0,1
  36. * iprot(invalidate protect):0,1
  37. * tid(translation identity):8bit to match process IDs
  38. * ts(translation space,comparing with MSR[IS,DS]): 0,1
  39. * tsize(translation size):1,2,...,9(4K,16K,64K,256K,1M,4M,16M,64M,256M)
  40. */
  41. #define TLB1_MAS1(v,iprot,tid,ts,tsize) \
  42. ((((v) << 31) & MAS1_VALID) |\
  43. (((iprot) << 30) & MAS1_IPROT) |\
  44. (((tid) << 16) & MAS1_TID) |\
  45. (((ts) << 12) & MAS1_TS) |\
  46. (((tsize) << 8) & MAS1_TSIZE) )
  47. /* MAS2
  48. * epn(effective page number):20bits
  49. * sharen(Shared cache state):0,1
  50. * x0,x1(implementation specific page attribute):0,1
  51. * w,i,m,g,e(write-through,cache-inhibited,memory coherency,guarded,
  52. * endianness):0,1
  53. */
  54. #define TLB1_MAS2(epn,sharen,x0,x1,w,i,m,g,e) \
  55. ((((epn) << 12) & MAS2_EPN) |\
  56. (((sharen) << 9) & MAS2_SHAREN) |\
  57. (((x0) << 6) & MAS2_X0) |\
  58. (((x1) << 5) & MAS2_X1) |\
  59. (((w) << 4) & MAS2_W) |\
  60. (((i) << 3) & MAS2_I) |\
  61. (((m) << 2) & MAS2_M) |\
  62. (((g) << 1) & MAS2_G) |\
  63. (e) )
  64. /* MAS3
  65. * rpn(real page number):20bits
  66. * u0-u3(user bits, useful for page table management in OS):0,1
  67. * ux,sx,uw,sw,ur,sr(permission bits, user and supervisor read,
  68. * write,execute permission).
  69. */
  70. #define TLB1_MAS3(rpn,u0,u1,u2,u3,ux,sx,uw,sw,ur,sr) \
  71. ((((rpn) << 12) & MAS3_RPN) |\
  72. (((u0) << 9) & MAS3_U0) |\
  73. (((u1) << 8) & MAS3_U1) |\
  74. (((u2) << 7) & MAS3_U2) |\
  75. (((u3) << 6) & MAS3_U3) |\
  76. (((ux) << 5) & MAS3_UX) |\
  77. (((sx) << 4) & MAS3_SX) |\
  78. (((uw) << 3) & MAS3_UW) |\
  79. (((sw) << 2) & MAS3_SW) |\
  80. (((ur) << 1) & MAS3_UR) |\
  81. (sr) )
  82. #define RESET_VECTOR 0xfffffffc
  83. #define CACHELINE_MASK (CFG_CACHELINE_SIZE - 1) /* Address mask for cache
  84. line aligned data. */
  85. #endif /* __E500_H__ */