e500.h 3.5 KB

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