mem_map.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. * Memory MAP
  3. * Common header file for blackfin BF561 of processors.
  4. */
  5. #ifndef _MEM_MAP_561_H_
  6. #define _MEM_MAP_561_H_
  7. #define COREMMR_BASE 0xFFE00000 /* Core MMRs */
  8. #define SYSMMR_BASE 0xFFC00000 /* System MMRs */
  9. /* Async Memory Banks */
  10. #define ASYNC_BANK3_BASE 0x2C000000 /* Async Bank 3 */
  11. #define ASYNC_BANK3_SIZE 0x04000000 /* 64M */
  12. #define ASYNC_BANK2_BASE 0x28000000 /* Async Bank 2 */
  13. #define ASYNC_BANK2_SIZE 0x04000000 /* 64M */
  14. #define ASYNC_BANK1_BASE 0x24000000 /* Async Bank 1 */
  15. #define ASYNC_BANK1_SIZE 0x04000000 /* 64M */
  16. #define ASYNC_BANK0_BASE 0x20000000 /* Async Bank 0 */
  17. #define ASYNC_BANK0_SIZE 0x04000000 /* 64M */
  18. /* Boot ROM Memory */
  19. #define BOOT_ROM_START 0xEF000000
  20. #define BOOT_ROM_LENGTH 0x800
  21. /* Level 1 Memory */
  22. #ifdef CONFIG_BFIN_ICACHE
  23. #define BFIN_ICACHESIZE (16*1024)
  24. #else
  25. #define BFIN_ICACHESIZE (0*1024)
  26. #endif
  27. /* Memory Map for ADSP-BF561 processors */
  28. #ifdef CONFIG_BF561
  29. #define COREA_L1_CODE_START 0xFFA00000
  30. #define COREA_L1_DATA_A_START 0xFF800000
  31. #define COREA_L1_DATA_B_START 0xFF900000
  32. #define COREB_L1_CODE_START 0xFF600000
  33. #define COREB_L1_DATA_A_START 0xFF400000
  34. #define COREB_L1_DATA_B_START 0xFF500000
  35. #define L1_CODE_START COREA_L1_CODE_START
  36. #define L1_DATA_A_START COREA_L1_DATA_A_START
  37. #define L1_DATA_B_START COREA_L1_DATA_B_START
  38. #define L1_CODE_LENGTH 0x4000
  39. #ifdef CONFIG_BFIN_DCACHE
  40. #ifdef CONFIG_BFIN_DCACHE_BANKA
  41. #define DMEM_CNTR (ACACHE_BSRAM | ENDCPLB | PORT_PREF0)
  42. #define L1_DATA_A_LENGTH (0x8000 - 0x4000)
  43. #define L1_DATA_B_LENGTH 0x8000
  44. #define BFIN_DCACHESIZE (16*1024)
  45. #define BFIN_DSUPBANKS 1
  46. #else
  47. #define DMEM_CNTR (ACACHE_BCACHE | ENDCPLB | PORT_PREF0)
  48. #define L1_DATA_A_LENGTH (0x8000 - 0x4000)
  49. #define L1_DATA_B_LENGTH (0x8000 - 0x4000)
  50. #define BFIN_DCACHESIZE (32*1024)
  51. #define BFIN_DSUPBANKS 2
  52. #endif
  53. #else
  54. #define DMEM_CNTR (ASRAM_BSRAM | ENDCPLB | PORT_PREF0)
  55. #define L1_DATA_A_LENGTH 0x8000
  56. #define L1_DATA_B_LENGTH 0x8000
  57. #define BFIN_DCACHESIZE (0*1024)
  58. #define BFIN_DSUPBANKS 0
  59. #endif /*CONFIG_BFIN_DCACHE*/
  60. #endif
  61. /* Level 2 Memory */
  62. #define L2_START 0xFEB00000
  63. #define L2_LENGTH 0x20000
  64. /* Scratch Pad Memory */
  65. #define COREA_L1_SCRATCH_START 0xFFB00000
  66. #define COREB_L1_SCRATCH_START 0xFF700000
  67. #define L1_SCRATCH_START COREA_L1_SCRATCH_START
  68. #define L1_SCRATCH_LENGTH 0x1000
  69. #ifndef __ASSEMBLY__
  70. #ifdef CONFIG_SMP
  71. #define get_l1_scratch_start_cpu(cpu) \
  72. ({ unsigned long __addr; \
  73. __addr = (cpu) ? COREB_L1_SCRATCH_START : COREA_L1_SCRATCH_START;\
  74. __addr; })
  75. #define get_l1_code_start_cpu(cpu) \
  76. ({ unsigned long __addr; \
  77. __addr = (cpu) ? COREB_L1_CODE_START : COREA_L1_CODE_START; \
  78. __addr; })
  79. #define get_l1_data_a_start_cpu(cpu) \
  80. ({ unsigned long __addr; \
  81. __addr = (cpu) ? COREB_L1_DATA_A_START : COREA_L1_DATA_A_START;\
  82. __addr; })
  83. #define get_l1_data_b_start_cpu(cpu) \
  84. ({ unsigned long __addr; \
  85. __addr = (cpu) ? COREB_L1_DATA_B_START : COREA_L1_DATA_B_START;\
  86. __addr; })
  87. #define get_l1_scratch_start() get_l1_scratch_start_cpu(blackfin_core_id())
  88. #define get_l1_code_start() get_l1_code_start_cpu(blackfin_core_id())
  89. #define get_l1_data_a_start() get_l1_data_a_start_cpu(blackfin_core_id())
  90. #define get_l1_data_b_start() get_l1_data_b_start_cpu(blackfin_core_id())
  91. #else /* !CONFIG_SMP */
  92. #define get_l1_scratch_start_cpu(cpu) L1_SCRATCH_START
  93. #define get_l1_code_start_cpu(cpu) L1_CODE_START
  94. #define get_l1_data_a_start_cpu(cpu) L1_DATA_A_START
  95. #define get_l1_data_b_start_cpu(cpu) L1_DATA_B_START
  96. #define get_l1_scratch_start() L1_SCRATCH_START
  97. #define get_l1_code_start() L1_CODE_START
  98. #define get_l1_data_a_start() L1_DATA_A_START
  99. #define get_l1_data_b_start() L1_DATA_B_START
  100. #endif /* !CONFIG_SMP */
  101. #else /* __ASSEMBLY__ */
  102. /*
  103. * The following macros both return the address of the PDA for the
  104. * current core.
  105. *
  106. * In its first safe (and hairy) form, the macro neither clobbers any
  107. * register aside of the output Preg, nor uses the stack, since it
  108. * could be called with an invalid stack pointer, or the current stack
  109. * space being uncovered by any CPLB (e.g. early exception handling).
  110. *
  111. * The constraints on the second form are a bit relaxed, and the code
  112. * is allowed to use the specified Dreg for determining the PDA
  113. * address to be returned into Preg.
  114. */
  115. #ifdef CONFIG_SMP
  116. #define GET_PDA_SAFE(preg) \
  117. preg.l = lo(DSPID); \
  118. preg.h = hi(DSPID); \
  119. preg = [preg]; \
  120. preg = preg << 2; \
  121. preg = preg << 2; \
  122. preg = preg << 2; \
  123. preg = preg << 2; \
  124. preg = preg << 2; \
  125. preg = preg << 2; \
  126. preg = preg << 2; \
  127. preg = preg << 2; \
  128. preg = preg << 2; \
  129. preg = preg << 2; \
  130. preg = preg << 2; \
  131. preg = preg << 2; \
  132. if cc jump 2f; \
  133. cc = preg == 0x0; \
  134. preg.l = _cpu_pda; \
  135. preg.h = _cpu_pda; \
  136. if !cc jump 3f; \
  137. 1: \
  138. /* preg = 0x0; */ \
  139. cc = !cc; /* restore cc to 0 */ \
  140. jump 4f; \
  141. 2: \
  142. cc = preg == 0x0; \
  143. preg.l = _cpu_pda; \
  144. preg.h = _cpu_pda; \
  145. if cc jump 4f; \
  146. /* preg = 0x1000000; */ \
  147. cc = !cc; /* restore cc to 1 */ \
  148. 3: \
  149. preg = [preg]; \
  150. 4:
  151. #define GET_PDA(preg, dreg) \
  152. preg.l = lo(DSPID); \
  153. preg.h = hi(DSPID); \
  154. dreg = [preg]; \
  155. preg.l = _cpu_pda; \
  156. preg.h = _cpu_pda; \
  157. cc = bittst(dreg, 0); \
  158. if !cc jump 1f; \
  159. preg = [preg]; \
  160. 1: \
  161. #define GET_CPUID(preg, dreg) \
  162. preg.l = lo(DSPID); \
  163. preg.h = hi(DSPID); \
  164. dreg = [preg]; \
  165. dreg = ROT dreg BY -1; \
  166. dreg = CC;
  167. #else
  168. #define GET_PDA_SAFE(preg) \
  169. preg.l = _cpu_pda; \
  170. preg.h = _cpu_pda;
  171. #define GET_PDA(preg, dreg) GET_PDA_SAFE(preg)
  172. #endif /* CONFIG_SMP */
  173. #endif /* __ASSEMBLY__ */
  174. #endif /* _MEM_MAP_533_H_ */