mem_map.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. * BF561 memory map
  3. *
  4. * Copyright 2004-2009 Analog Devices Inc.
  5. * Licensed under the GPL-2 or later.
  6. */
  7. #ifndef __BFIN_MACH_MEM_MAP_H__
  8. #define __BFIN_MACH_MEM_MAP_H__
  9. #ifndef __BFIN_MEM_MAP_H__
  10. # error "do not include mach/mem_map.h directly -- use asm/mem_map.h"
  11. #endif
  12. /* Async Memory Banks */
  13. #define ASYNC_BANK3_BASE 0x2C000000 /* Async Bank 3 */
  14. #define ASYNC_BANK3_SIZE 0x04000000 /* 64M */
  15. #define ASYNC_BANK2_BASE 0x28000000 /* Async Bank 2 */
  16. #define ASYNC_BANK2_SIZE 0x04000000 /* 64M */
  17. #define ASYNC_BANK1_BASE 0x24000000 /* Async Bank 1 */
  18. #define ASYNC_BANK1_SIZE 0x04000000 /* 64M */
  19. #define ASYNC_BANK0_BASE 0x20000000 /* Async Bank 0 */
  20. #define ASYNC_BANK0_SIZE 0x04000000 /* 64M */
  21. /* Boot ROM Memory */
  22. #define BOOT_ROM_START 0xEF000000
  23. #define BOOT_ROM_LENGTH 0x800
  24. /* Level 1 Memory */
  25. #ifdef CONFIG_BFIN_ICACHE
  26. #define BFIN_ICACHESIZE (16*1024)
  27. #else
  28. #define BFIN_ICACHESIZE (0*1024)
  29. #endif
  30. /* Memory Map for ADSP-BF561 processors */
  31. #define COREA_L1_CODE_START 0xFFA00000
  32. #define COREA_L1_DATA_A_START 0xFF800000
  33. #define COREA_L1_DATA_B_START 0xFF900000
  34. #define COREB_L1_CODE_START 0xFF600000
  35. #define COREB_L1_DATA_A_START 0xFF400000
  36. #define COREB_L1_DATA_B_START 0xFF500000
  37. #define L1_CODE_START COREA_L1_CODE_START
  38. #define L1_DATA_A_START COREA_L1_DATA_A_START
  39. #define L1_DATA_B_START COREA_L1_DATA_B_START
  40. #define L1_CODE_LENGTH 0x4000
  41. #ifdef CONFIG_BFIN_DCACHE
  42. #ifdef CONFIG_BFIN_DCACHE_BANKA
  43. #define DMEM_CNTR (ACACHE_BSRAM | ENDCPLB | PORT_PREF0)
  44. #define L1_DATA_A_LENGTH (0x8000 - 0x4000)
  45. #define L1_DATA_B_LENGTH 0x8000
  46. #define BFIN_DCACHESIZE (16*1024)
  47. #define BFIN_DSUPBANKS 1
  48. #else
  49. #define DMEM_CNTR (ACACHE_BCACHE | ENDCPLB | PORT_PREF0)
  50. #define L1_DATA_A_LENGTH (0x8000 - 0x4000)
  51. #define L1_DATA_B_LENGTH (0x8000 - 0x4000)
  52. #define BFIN_DCACHESIZE (32*1024)
  53. #define BFIN_DSUPBANKS 2
  54. #endif
  55. #else
  56. #define DMEM_CNTR (ASRAM_BSRAM | ENDCPLB | PORT_PREF0)
  57. #define L1_DATA_A_LENGTH 0x8000
  58. #define L1_DATA_B_LENGTH 0x8000
  59. #define BFIN_DCACHESIZE (0*1024)
  60. #define BFIN_DSUPBANKS 0
  61. #endif /*CONFIG_BFIN_DCACHE*/
  62. /*
  63. * If we are in SMP mode, then the cache settings of Core B will match
  64. * the settings of Core A. If we aren't, then we assume Core B is not
  65. * using any cache. This allows the rest of the kernel to work with
  66. * the core in either mode as we are only loading user code into it and
  67. * it is the user's problem to make sure they aren't doing something
  68. * stupid there.
  69. *
  70. * Note that we treat the L1 code region as a contiguous blob to make
  71. * the rest of the kernel simpler. Easier to check one region than a
  72. * bunch of small ones. Again, possible misbehavior here is the fault
  73. * of the user -- don't try to use memory that doesn't exist.
  74. */
  75. #ifdef CONFIG_SMP
  76. # define COREB_L1_CODE_LENGTH L1_CODE_LENGTH
  77. # define COREB_L1_DATA_A_LENGTH L1_DATA_A_LENGTH
  78. # define COREB_L1_DATA_B_LENGTH L1_DATA_B_LENGTH
  79. #else
  80. # define COREB_L1_CODE_LENGTH 0x14000
  81. # define COREB_L1_DATA_A_LENGTH 0x8000
  82. # define COREB_L1_DATA_B_LENGTH 0x8000
  83. #endif
  84. /* Level 2 Memory */
  85. #define L2_START 0xFEB00000
  86. #define L2_LENGTH 0x20000
  87. /* Scratch Pad Memory */
  88. #define COREA_L1_SCRATCH_START 0xFFB00000
  89. #define COREB_L1_SCRATCH_START 0xFF700000
  90. #ifdef __ASSEMBLY__
  91. /*
  92. * The following macros both return the address of the PDA for the
  93. * current core.
  94. *
  95. * In its first safe (and hairy) form, the macro neither clobbers any
  96. * register aside of the output Preg, nor uses the stack, since it
  97. * could be called with an invalid stack pointer, or the current stack
  98. * space being uncovered by any CPLB (e.g. early exception handling).
  99. *
  100. * The constraints on the second form are a bit relaxed, and the code
  101. * is allowed to use the specified Dreg for determining the PDA
  102. * address to be returned into Preg.
  103. */
  104. #ifdef CONFIG_SMP
  105. #define GET_PDA_SAFE(preg) \
  106. preg.l = lo(DSPID); \
  107. preg.h = hi(DSPID); \
  108. preg = [preg]; \
  109. preg = preg << 2; \
  110. preg = preg << 2; \
  111. preg = preg << 2; \
  112. preg = preg << 2; \
  113. preg = preg << 2; \
  114. preg = preg << 2; \
  115. preg = preg << 2; \
  116. preg = preg << 2; \
  117. preg = preg << 2; \
  118. preg = preg << 2; \
  119. preg = preg << 2; \
  120. preg = preg << 2; \
  121. if cc jump 2f; \
  122. cc = preg == 0x0; \
  123. preg.l = _cpu_pda; \
  124. preg.h = _cpu_pda; \
  125. if !cc jump 3f; \
  126. 1: \
  127. /* preg = 0x0; */ \
  128. cc = !cc; /* restore cc to 0 */ \
  129. jump 4f; \
  130. 2: \
  131. cc = preg == 0x0; \
  132. preg.l = _cpu_pda; \
  133. preg.h = _cpu_pda; \
  134. if cc jump 4f; \
  135. /* preg = 0x1000000; */ \
  136. cc = !cc; /* restore cc to 1 */ \
  137. 3: \
  138. preg = [preg]; \
  139. 4:
  140. #define GET_PDA(preg, dreg) \
  141. preg.l = lo(DSPID); \
  142. preg.h = hi(DSPID); \
  143. dreg = [preg]; \
  144. preg.l = _cpu_pda; \
  145. preg.h = _cpu_pda; \
  146. cc = bittst(dreg, 0); \
  147. if !cc jump 1f; \
  148. preg = [preg]; \
  149. 1: \
  150. #define GET_CPUID(preg, dreg) \
  151. preg.l = lo(DSPID); \
  152. preg.h = hi(DSPID); \
  153. dreg = [preg]; \
  154. dreg = ROT dreg BY -1; \
  155. dreg = CC;
  156. static inline unsigned long get_l1_scratch_start_cpu(int cpu)
  157. {
  158. return cpu ? COREB_L1_SCRATCH_START : COREA_L1_SCRATCH_START;
  159. }
  160. static inline unsigned long get_l1_code_start_cpu(int cpu)
  161. {
  162. return cpu ? COREB_L1_CODE_START : COREA_L1_CODE_START;
  163. }
  164. static inline unsigned long get_l1_data_a_start_cpu(int cpu)
  165. {
  166. return cpu ? COREB_L1_DATA_A_START : COREA_L1_DATA_A_START;
  167. }
  168. static inline unsigned long get_l1_data_b_start_cpu(int cpu)
  169. {
  170. return cpu ? COREB_L1_DATA_B_START : COREA_L1_DATA_B_START;
  171. }
  172. static inline unsigned long get_l1_scratch_start(void)
  173. {
  174. return get_l1_scratch_start_cpu(blackfin_core_id());
  175. }
  176. static inline unsigned long get_l1_code_start(void)
  177. {
  178. return get_l1_code_start_cpu(blackfin_core_id());
  179. }
  180. static inline unsigned long get_l1_data_a_start(void)
  181. {
  182. return get_l1_data_a_start_cpu(blackfin_core_id());
  183. }
  184. static inline unsigned long get_l1_data_b_start(void)
  185. {
  186. return get_l1_data_b_start_cpu(blackfin_core_id());
  187. }
  188. #endif /* CONFIG_SMP */
  189. #endif /* __ASSEMBLY__ */
  190. #endif