e500.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. unsigned long freqDDRBus;
  13. } MPC85xx_SYS_INFO;
  14. #endif /* _ASMLANGUAGE */
  15. /* Motorola E500 core provides 16 TLB1 entries; they can be used for
  16. * initial memory mapping like legacy BAT registers do. Usually we
  17. * use four MAS registers(MAS0-3) to operate on TLB1 entries.
  18. *
  19. * While there are 16 Entries with variable Page Sizes in TLB1,
  20. * there are also 256 Entries with fixed 4K pages in TLB0.
  21. *
  22. * We also need LAWs(Local Access Window) to associate a range of
  23. * the local 32-bit address space with a particular target interface
  24. * such as PCI/PCI-X, RapidIO, Local Bus and DDR SDRAM.
  25. *
  26. * We put TLB1/LAW code here because memory mapping is board-specific
  27. * instead of cpu-specific.
  28. *
  29. * While these macros are all nominally for TLB1 by name, they can
  30. * also be used for TLB0 as well.
  31. */
  32. /*
  33. * Convert addresses to Effective and Real Page Numbers.
  34. * Grab the high 20-bits and shift 'em down, dropping the "byte offset".
  35. */
  36. #define E500_TLB_EPN(addr) (((addr) >> 12) & 0xfffff)
  37. #define E500_TLB_RPN(addr) (((addr) >> 12) & 0xfffff)
  38. /* MAS0
  39. * tlbsel(TLB Select):0,1
  40. * esel(Entry Select): 0,1,2,...,15 for TLB1
  41. * nv(Next victim):0,1
  42. */
  43. #define TLB1_MAS0(tlbsel,esel,nv) \
  44. ((((tlbsel) << 28) & MAS0_TLBSEL) |\
  45. (((esel) << 16) & MAS0_ESEL ) |\
  46. (nv) )
  47. /* MAS1
  48. * v(TLB valid bit):0,1
  49. * iprot(invalidate protect):0,1
  50. * tid(translation identity):8bit to match process IDs
  51. * ts(translation space,comparing with MSR[IS,DS]): 0,1
  52. * tsize(translation size):1,2,...,9(4K,16K,64K,256K,1M,4M,16M,64M,256M)
  53. */
  54. #define TLB1_MAS1(v,iprot,tid,ts,tsize) \
  55. ((((v) << 31) & MAS1_VALID) |\
  56. (((iprot) << 30) & MAS1_IPROT) |\
  57. (((tid) << 16) & MAS1_TID) |\
  58. (((ts) << 12) & MAS1_TS) |\
  59. (((tsize) << 8) & MAS1_TSIZE) )
  60. /* MAS2
  61. * epn(effective page number):20bits
  62. * sharen(Shared cache state):0,1
  63. * x0,x1(implementation specific page attribute):0,1
  64. * w,i,m,g,e(write-through,cache-inhibited,memory coherency,guarded,
  65. * endianness):0,1
  66. */
  67. #define TLB1_MAS2(epn,sharen,x0,x1,w,i,m,g,e) \
  68. ((((epn) << 12) & MAS2_EPN) |\
  69. (((sharen) << 9) & MAS2_SHAREN) |\
  70. (((x0) << 6) & MAS2_X0) |\
  71. (((x1) << 5) & MAS2_X1) |\
  72. (((w) << 4) & MAS2_W) |\
  73. (((i) << 3) & MAS2_I) |\
  74. (((m) << 2) & MAS2_M) |\
  75. (((g) << 1) & MAS2_G) |\
  76. (e) )
  77. /* MAS3
  78. * rpn(real page number):20bits
  79. * u0-u3(user bits, useful for page table management in OS):0,1
  80. * ux,sx,uw,sw,ur,sr(permission bits, user and supervisor read,
  81. * write,execute permission).
  82. */
  83. #define TLB1_MAS3(rpn,u0,u1,u2,u3,ux,sx,uw,sw,ur,sr) \
  84. ((((rpn) << 12) & MAS3_RPN) |\
  85. (((u0) << 9) & MAS3_U0) |\
  86. (((u1) << 8) & MAS3_U1) |\
  87. (((u2) << 7) & MAS3_U2) |\
  88. (((u3) << 6) & MAS3_U3) |\
  89. (((ux) << 5) & MAS3_UX) |\
  90. (((sx) << 4) & MAS3_SX) |\
  91. (((uw) << 3) & MAS3_UW) |\
  92. (((sw) << 2) & MAS3_SW) |\
  93. (((ur) << 1) & MAS3_UR) |\
  94. (sr) )
  95. #define RESET_VECTOR 0xfffffffc
  96. #define CACHELINE_MASK (CFG_CACHELINE_SIZE - 1) /* Address mask for cache
  97. line aligned data. */
  98. #endif /* __E500_H__ */