standalone_v5_0.patch 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. diff -brupN old/ps7_cortexa9_1/libsrc/standalone_v5_0/src/asm_vectors.S ps7_cortexa9_1/libsrc/standalone_v5_0/src/asm_vectors.S
  2. --- old/ps7_cortexa9_1/libsrc/standalone_v5_0/src/asm_vectors.S
  3. +++ ps7_cortexa9_1/libsrc/standalone_v5_0/src/asm_vectors.S
  4. @@ -55,6 +55,7 @@
  5. *
  6. ******************************************************************************/
  7. #include "xil_errata.h"
  8. +#include "xparameters.h"
  9. #define __ARM_NEON__ 1
  10. @@ -63,6 +64,10 @@
  11. .globl _boot
  12. .globl _vector_table
  13. +.globl _cpu0_catch
  14. +.globl _cpu1_catch
  15. +.globl OKToRun
  16. +.globl EndlessLoop0
  17. .globl FIQInterrupt
  18. .globl IRQInterrupt
  19. @@ -85,6 +90,20 @@ _vector_table:
  20. B FIQHandler
  21. +#if XPAR_CPU_ID==0
  22. +_cpu0_catch:
  23. +.word OKToRun /* fixed addr for caught cpu- */
  24. +_cpu1_catch:
  25. +.word EndlessLoop0 /* fixed addr for caught cpu- */
  26. +
  27. +#elif XPAR_CPU_ID==1
  28. +_cpu0_catch:
  29. +.word EndlessLoop0
  30. +_cpu1_catch:
  31. +.word OKToRun
  32. +#endif
  33. +
  34. +
  35. IRQHandler: /* IRQ vector handler */
  36. stmdb sp!,{r0-r3,r12,lr} /* state save from compiled code*/
  37. diff -brupN old/ps7_cortexa9_1/libsrc/standalone_v5_0/src/boot.S ps7_cortexa9_1/libsrc/standalone_v5_0/src/boot.S
  38. --- old/ps7_cortexa9_1/libsrc/standalone_v5_0/src/boot.S
  39. +++ ps7_cortexa9_1/libsrc/standalone_v5_0/src/boot.S
  40. @@ -79,6 +77,11 @@
  41. .global __undef_stack
  42. .global _vector_table
  43. +.globl _cpu0_catch
  44. +.globl _cpu1_catch
  45. +.globl OKToRun
  46. +.globl EndlessLoop0
  47. +
  48. .set PSS_L2CC_BASE_ADDR, 0xF8F02000
  49. .set PSS_SLCR_BASE_ADDR, 0xF8000000
  50. @@ -137,26 +139,27 @@
  51. _prestart:
  52. _boot:
  53. -#if XPAR_CPU_ID==0
  54. -/* only allow cpu0 through */
  55. +/* Test which processor is running and jump to the catch address */
  56. mrc p15,0,r1,c0,c0,5
  57. and r1, r1, #0xf
  58. cmp r1, #0
  59. - beq OKToRun
  60. + bne NotCpu0
  61. + ldr r0, =_cpu0_catch
  62. + b cpuxCont
  63. +NotCpu0:
  64. + cmp r1, #1
  65. + bne EndlessLoop0
  66. + ldr r0, =_cpu1_catch
  67. + b cpuxCont
  68. EndlessLoop0:
  69. wfe
  70. b EndlessLoop0
  71. -#elif XPAR_CPU_ID==1
  72. -/* only allow cpu1 through */
  73. - mrc p15,0,r1,c0,c0,5
  74. - and r1, r1, #0xf
  75. - cmp r1, #1
  76. - beq OKToRun
  77. -EndlessLoop1:
  78. - wfe
  79. - b EndlessLoop1
  80. -#endif
  81. +/* Jump to address pointed to by cpux_catch */
  82. +cpuxCont:
  83. + ldr lr, [r0]
  84. + bx lr
  85. +
  86. OKToRun:
  87. mrc p15, 0, r0, c0, c0, 0 /* Get the revision */
  88. @@ -251,18 +254,42 @@ shareable_loop:
  89. bge shareable_loop /* loop till 1G is covered */
  90. #endif
  91. - /* In case of AMP, map virtual address 0x20000000 to 0x00000000 and mark it as non-cacheable */
  92. +// /* In case of AMP, map virtual address 0x20000000 to 0x00000000 and mark it as non-cacheable */
  93. +//#if USE_AMP==1
  94. +// ldr r3, =0x1ff /* 512 entries to cover 512MB DDR */
  95. +// ldr r0, =TblBase /* MMU Table address in memory */
  96. +// add r0, r0, #0x800 /* Address of entry in MMU table, for 0x20000000 */
  97. +// ldr r2, =0x0c02 /* S=b0 TEX=b000 AP=b11, Domain=b0, C=b0, B=b0 */
  98. +//mmu_loop:
  99. +// str r2, [r0] /* write the entry to MMU table */
  100. +// add r0, r0, #0x4 /* next entry in the table */
  101. +// add r2, r2, #0x100000 /* next section */
  102. +// subs r3, r3, #1
  103. +// bge mmu_loop /* loop till 512MB is covered */
  104. +//#endif
  105. +
  106. + /* In case of AMP, mark address 0x00000000 - 0x1dffffff DDR as unassigned/reserved */
  107. + /* and address 0x1e000000 - 0x1fffffff DDR as inner cached only */
  108. #if USE_AMP==1
  109. - ldr r3, =0x1ff /* 512 entries to cover 512MB DDR */
  110. + ldr r3, =0x1df /* 480 entries to cover 480MB DDR */
  111. ldr r0, =TblBase /* MMU Table address in memory */
  112. - add r0, r0, #0x800 /* Address of entry in MMU table, for 0x20000000 */
  113. - ldr r2, =0x0c02 /* S=b0 TEX=b000 AP=b11, Domain=b0, C=b0, B=b0 */
  114. + ldr r2, =0x0000 /* S=b0 TEX=b000 AP=b00, Domain=b0, C=b0, B=b0 */
  115. mmu_loop:
  116. str r2, [r0] /* write the entry to MMU table */
  117. add r0, r0, #0x4 /* next entry in the table */
  118. add r2, r2, #0x100000 /* next section */
  119. subs r3, r3, #1
  120. - bge mmu_loop /* loop till 512MB is covered */
  121. + bge mmu_loop /* loop till 480MB is covered */
  122. +
  123. + ldr r3, =0x01f /* 32 entries to cover 32MB DDR */
  124. + movw r2, #0x4de6 /* S=b0 TEX=b100 AP=b11, Domain=b1111, C=b0, B=b1 */
  125. + movt r2, #0x1e00 /* S=b0, Section start for address 0x1e000000 */
  126. +mmu_loop1:
  127. + str r2, [r0] /* write the entry to MMU table */
  128. + add r0, r0, #0x4 /* next entry in the table */
  129. + add r2, r2, #0x100000 /* next section */
  130. + subs r3, r3, #1
  131. + bge mmu_loop1 /* loop till 32MB is covered */
  132. #endif
  133. mrs r0, cpsr /* get the current PSR */
  134. diff -brupN old/ps7_cortexa9_1/libsrc/standalone_v5_0/src/xtime_l.c ps7_cortexa9_1/libsrc/standalone_v5_0/src/xtime_l.c
  135. --- old/ps7_cortexa9_1/libsrc/standalone_v5_0/src/xtime_l.c
  136. +++ ps7_cortexa9_1/libsrc/standalone_v5_0/src/xtime_l.c
  137. @@ -80,6 +80,13 @@
  138. ****************************************************************************/
  139. void XTime_SetTime(XTime Xtime_Global)
  140. {
  141. +#ifdef USE_AMP
  142. + if(Xil_In32((u32)GLOBAL_TMR_BASEADDR + (u32)GTIMER_CONTROL_OFFSET) & (u32)0x1) {
  143. + // Timer is already enabled so don't reset it
  144. + return;
  145. + }
  146. +#endif
  147. +
  148. /* Disable Global Timer */
  149. Xil_Out32((u32)GLOBAL_TMR_BASEADDR + (u32)GTIMER_CONTROL_OFFSET, (u32)0x0);