mem_map.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 CONFIG_SMP
  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. # define GET_PDA_SAFE(preg) \
  105. preg.l = lo(DSPID); \
  106. preg.h = hi(DSPID); \
  107. preg = [preg]; \
  108. preg = preg << 2; \
  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. if cc jump 2f; \
  121. cc = preg == 0x0; \
  122. preg.l = _cpu_pda; \
  123. preg.h = _cpu_pda; \
  124. if !cc jump 3f; \
  125. 1: \
  126. /* preg = 0x0; */ \
  127. cc = !cc; /* restore cc to 0 */ \
  128. jump 4f; \
  129. 2: \
  130. cc = preg == 0x0; \
  131. preg.l = _cpu_pda; \
  132. preg.h = _cpu_pda; \
  133. if cc jump 4f; \
  134. /* preg = 0x1000000; */ \
  135. cc = !cc; /* restore cc to 1 */ \
  136. 3: \
  137. preg = [preg]; \
  138. 4:
  139. # define GET_PDA(preg, dreg) \
  140. preg.l = lo(DSPID); \
  141. preg.h = hi(DSPID); \
  142. dreg = [preg]; \
  143. preg.l = _cpu_pda; \
  144. preg.h = _cpu_pda; \
  145. cc = bittst(dreg, 0); \
  146. if !cc jump 1f; \
  147. preg = [preg]; \
  148. 1: \
  149. # define GET_CPUID(preg, dreg) \
  150. preg.l = lo(DSPID); \
  151. preg.h = hi(DSPID); \
  152. dreg = [preg]; \
  153. dreg = ROT dreg BY -1; \
  154. dreg = CC;
  155. # ifndef __ASSEMBLY__
  156. # include <asm/processor.h>
  157. static inline unsigned long get_l1_scratch_start_cpu(int cpu)
  158. {
  159. return cpu ? COREB_L1_SCRATCH_START : COREA_L1_SCRATCH_START;
  160. }
  161. static inline unsigned long get_l1_code_start_cpu(int cpu)
  162. {
  163. return cpu ? COREB_L1_CODE_START : COREA_L1_CODE_START;
  164. }
  165. static inline unsigned long get_l1_data_a_start_cpu(int cpu)
  166. {
  167. return cpu ? COREB_L1_DATA_A_START : COREA_L1_DATA_A_START;
  168. }
  169. static inline unsigned long get_l1_data_b_start_cpu(int cpu)
  170. {
  171. return cpu ? COREB_L1_DATA_B_START : COREA_L1_DATA_B_START;
  172. }
  173. static inline unsigned long get_l1_scratch_start(void)
  174. {
  175. return get_l1_scratch_start_cpu(blackfin_core_id());
  176. }
  177. static inline unsigned long get_l1_code_start(void)
  178. {
  179. return get_l1_code_start_cpu(blackfin_core_id());
  180. }
  181. static inline unsigned long get_l1_data_a_start(void)
  182. {
  183. return get_l1_data_a_start_cpu(blackfin_core_id());
  184. }
  185. static inline unsigned long get_l1_data_b_start(void)
  186. {
  187. return get_l1_data_b_start_cpu(blackfin_core_id());
  188. }
  189. # endif /* __ASSEMBLY__ */
  190. #endif /* CONFIG_SMP */
  191. #endif