mem_map.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. #ifdef CONFIG_BF561
  32. #define COREA_L1_CODE_START 0xFFA00000
  33. #define COREA_L1_DATA_A_START 0xFF800000
  34. #define COREA_L1_DATA_B_START 0xFF900000
  35. #define COREB_L1_CODE_START 0xFF600000
  36. #define COREB_L1_DATA_A_START 0xFF400000
  37. #define COREB_L1_DATA_B_START 0xFF500000
  38. #define L1_CODE_START COREA_L1_CODE_START
  39. #define L1_DATA_A_START COREA_L1_DATA_A_START
  40. #define L1_DATA_B_START COREA_L1_DATA_B_START
  41. #define L1_CODE_LENGTH 0x4000
  42. #ifdef CONFIG_BFIN_DCACHE
  43. #ifdef CONFIG_BFIN_DCACHE_BANKA
  44. #define DMEM_CNTR (ACACHE_BSRAM | ENDCPLB | PORT_PREF0)
  45. #define L1_DATA_A_LENGTH (0x8000 - 0x4000)
  46. #define L1_DATA_B_LENGTH 0x8000
  47. #define BFIN_DCACHESIZE (16*1024)
  48. #define BFIN_DSUPBANKS 1
  49. #else
  50. #define DMEM_CNTR (ACACHE_BCACHE | ENDCPLB | PORT_PREF0)
  51. #define L1_DATA_A_LENGTH (0x8000 - 0x4000)
  52. #define L1_DATA_B_LENGTH (0x8000 - 0x4000)
  53. #define BFIN_DCACHESIZE (32*1024)
  54. #define BFIN_DSUPBANKS 2
  55. #endif
  56. #else
  57. #define DMEM_CNTR (ASRAM_BSRAM | ENDCPLB | PORT_PREF0)
  58. #define L1_DATA_A_LENGTH 0x8000
  59. #define L1_DATA_B_LENGTH 0x8000
  60. #define BFIN_DCACHESIZE (0*1024)
  61. #define BFIN_DSUPBANKS 0
  62. #endif /*CONFIG_BFIN_DCACHE*/
  63. #endif
  64. /* Level 2 Memory */
  65. #define L2_START 0xFEB00000
  66. #define L2_LENGTH 0x20000
  67. /* Scratch Pad Memory */
  68. #define COREA_L1_SCRATCH_START 0xFFB00000
  69. #define COREB_L1_SCRATCH_START 0xFF700000
  70. #ifdef __ASSEMBLY__
  71. /*
  72. * The following macros both return the address of the PDA for the
  73. * current core.
  74. *
  75. * In its first safe (and hairy) form, the macro neither clobbers any
  76. * register aside of the output Preg, nor uses the stack, since it
  77. * could be called with an invalid stack pointer, or the current stack
  78. * space being uncovered by any CPLB (e.g. early exception handling).
  79. *
  80. * The constraints on the second form are a bit relaxed, and the code
  81. * is allowed to use the specified Dreg for determining the PDA
  82. * address to be returned into Preg.
  83. */
  84. #ifdef CONFIG_SMP
  85. #define GET_PDA_SAFE(preg) \
  86. preg.l = lo(DSPID); \
  87. preg.h = hi(DSPID); \
  88. preg = [preg]; \
  89. preg = preg << 2; \
  90. preg = preg << 2; \
  91. preg = preg << 2; \
  92. preg = preg << 2; \
  93. preg = preg << 2; \
  94. preg = preg << 2; \
  95. preg = preg << 2; \
  96. preg = preg << 2; \
  97. preg = preg << 2; \
  98. preg = preg << 2; \
  99. preg = preg << 2; \
  100. preg = preg << 2; \
  101. if cc jump 2f; \
  102. cc = preg == 0x0; \
  103. preg.l = _cpu_pda; \
  104. preg.h = _cpu_pda; \
  105. if !cc jump 3f; \
  106. 1: \
  107. /* preg = 0x0; */ \
  108. cc = !cc; /* restore cc to 0 */ \
  109. jump 4f; \
  110. 2: \
  111. cc = preg == 0x0; \
  112. preg.l = _cpu_pda; \
  113. preg.h = _cpu_pda; \
  114. if cc jump 4f; \
  115. /* preg = 0x1000000; */ \
  116. cc = !cc; /* restore cc to 1 */ \
  117. 3: \
  118. preg = [preg]; \
  119. 4:
  120. #define GET_PDA(preg, dreg) \
  121. preg.l = lo(DSPID); \
  122. preg.h = hi(DSPID); \
  123. dreg = [preg]; \
  124. preg.l = _cpu_pda; \
  125. preg.h = _cpu_pda; \
  126. cc = bittst(dreg, 0); \
  127. if !cc jump 1f; \
  128. preg = [preg]; \
  129. 1: \
  130. #define GET_CPUID(preg, dreg) \
  131. preg.l = lo(DSPID); \
  132. preg.h = hi(DSPID); \
  133. dreg = [preg]; \
  134. dreg = ROT dreg BY -1; \
  135. dreg = CC;
  136. static inline unsigned long get_l1_scratch_start_cpu(int cpu)
  137. {
  138. return cpu ? COREB_L1_SCRATCH_START : COREA_L1_SCRATCH_START;
  139. }
  140. static inline unsigned long get_l1_code_start_cpu(int cpu)
  141. {
  142. return cpu ? COREB_L1_CODE_START : COREA_L1_CODE_START;
  143. }
  144. static inline unsigned long get_l1_data_a_start_cpu(int cpu)
  145. {
  146. return cpu ? COREB_L1_DATA_A_START : COREA_L1_DATA_A_START;
  147. }
  148. static inline unsigned long get_l1_data_b_start_cpu(int cpu)
  149. {
  150. return cpu ? COREB_L1_DATA_B_START : COREA_L1_DATA_B_START;
  151. }
  152. static inline unsigned long get_l1_scratch_start(void)
  153. {
  154. return get_l1_scratch_start_cpu(blackfin_core_id());
  155. }
  156. static inline unsigned long get_l1_code_start(void)
  157. {
  158. return get_l1_code_start_cpu(blackfin_core_id());
  159. }
  160. static inline unsigned long get_l1_data_a_start(void)
  161. {
  162. return get_l1_data_a_start_cpu(blackfin_core_id());
  163. }
  164. static inline unsigned long get_l1_data_b_start(void)
  165. {
  166. return get_l1_data_b_start_cpu(blackfin_core_id());
  167. }
  168. #endif /* CONFIG_SMP */
  169. #endif /* __ASSEMBLY__ */
  170. #endif