Fork of the vendor (Boundary Devices) u-boot for Reform 2, with minor tweaks. The goal is to migrate to mainstream u-boot or barebox ASAP. The main impediment so far is the 4GB RAM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

179 lines
2.9 KiB

  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
  4. */
  5. #include <linux/linkage.h>
  6. /*
  7. * Note on the LD/ST addressing modes with address register write-back
  8. *
  9. * LD.a same as LD.aw
  10. *
  11. * LD.a reg1, [reg2, x] => Pre Incr
  12. * Eff Addr for load = [reg2 + x]
  13. *
  14. * LD.ab reg1, [reg2, x] => Post Incr
  15. * Eff Addr for load = [reg2]
  16. */
  17. .macro PUSH reg
  18. st.a \reg, [%sp, -4]
  19. .endm
  20. .macro PUSHAX aux
  21. lr %r9, [\aux]
  22. PUSH %r9
  23. .endm
  24. .macro SAVE_R1_TO_R24
  25. PUSH %r1
  26. PUSH %r2
  27. PUSH %r3
  28. PUSH %r4
  29. PUSH %r5
  30. PUSH %r6
  31. PUSH %r7
  32. PUSH %r8
  33. PUSH %r9
  34. PUSH %r10
  35. PUSH %r11
  36. PUSH %r12
  37. PUSH %r13
  38. PUSH %r14
  39. PUSH %r15
  40. PUSH %r16
  41. PUSH %r17
  42. PUSH %r18
  43. PUSH %r19
  44. PUSH %r20
  45. PUSH %r21
  46. PUSH %r22
  47. PUSH %r23
  48. PUSH %r24
  49. .endm
  50. .macro SAVE_ALL_SYS
  51. /* saving %r0 to reg->r0 in advance since we read %ecr into it */
  52. st %r0, [%sp, -8]
  53. lr %r0, [%ecr] /* all stack addressing is manual so far */
  54. st %r0, [%sp]
  55. st %sp, [%sp, -4]
  56. /* now move %sp to reg->r0 position so we can do "push" automatically */
  57. sub %sp, %sp, 8
  58. SAVE_R1_TO_R24
  59. PUSH %r25
  60. PUSH %gp
  61. PUSH %fp
  62. PUSH %blink
  63. PUSHAX %eret
  64. PUSHAX %erstatus
  65. PUSH %lp_count
  66. PUSHAX %lp_end
  67. PUSHAX %lp_start
  68. PUSHAX %erbta
  69. .endm
  70. .macro SAVE_EXCEPTION_SOURCE
  71. #ifdef CONFIG_MMU
  72. /* If MMU exists exception faulting address is loaded in EFA reg */
  73. lr %r0, [%efa]
  74. #else
  75. /* Otherwise in ERET (exception return) reg */
  76. lr %r0, [%eret]
  77. #endif
  78. .endm
  79. ENTRY(memory_error)
  80. SAVE_ALL_SYS
  81. SAVE_EXCEPTION_SOURCE
  82. mov %r1, %sp
  83. j do_memory_error
  84. ENDPROC(memory_error)
  85. ENTRY(instruction_error)
  86. SAVE_ALL_SYS
  87. SAVE_EXCEPTION_SOURCE
  88. mov %r1, %sp
  89. j do_instruction_error
  90. ENDPROC(instruction_error)
  91. ENTRY(interrupt_handler)
  92. /* Todo - save and restore CPU context when interrupts will be in use */
  93. bl do_interrupt_handler
  94. rtie
  95. ENDPROC(interrupt_handler)
  96. ENTRY(EV_MachineCheck)
  97. SAVE_ALL_SYS
  98. SAVE_EXCEPTION_SOURCE
  99. mov %r1, %sp
  100. j do_machine_check_fault
  101. ENDPROC(EV_MachineCheck)
  102. ENTRY(EV_TLBMissI)
  103. SAVE_ALL_SYS
  104. mov %r0, %sp
  105. j do_itlb_miss
  106. ENDPROC(EV_TLBMissI)
  107. ENTRY(EV_TLBMissD)
  108. SAVE_ALL_SYS
  109. mov %r0, %sp
  110. j do_dtlb_miss
  111. ENDPROC(EV_TLBMissD)
  112. ENTRY(EV_TLBProtV)
  113. SAVE_ALL_SYS
  114. SAVE_EXCEPTION_SOURCE
  115. mov %r1, %sp
  116. j do_tlb_prot_violation
  117. ENDPROC(EV_TLBProtV)
  118. ENTRY(EV_PrivilegeV)
  119. SAVE_ALL_SYS
  120. mov %r0, %sp
  121. j do_privilege_violation
  122. ENDPROC(EV_PrivilegeV)
  123. ENTRY(EV_Trap)
  124. SAVE_ALL_SYS
  125. mov %r0, %sp
  126. j do_trap
  127. ENDPROC(EV_Trap)
  128. ENTRY(EV_Extension)
  129. SAVE_ALL_SYS
  130. mov %r0, %sp
  131. j do_extension
  132. ENDPROC(EV_Extension)
  133. #ifdef CONFIG_ISA_ARCV2
  134. ENTRY(EV_SWI)
  135. SAVE_ALL_SYS
  136. mov %r0, %sp
  137. j do_swi
  138. ENDPROC(EV_SWI)
  139. ENTRY(EV_DivZero)
  140. SAVE_ALL_SYS
  141. SAVE_EXCEPTION_SOURCE
  142. mov %r1, %sp
  143. j do_divzero
  144. ENDPROC(EV_DivZero)
  145. ENTRY(EV_DCError)
  146. SAVE_ALL_SYS
  147. mov %r0, %sp
  148. j do_dcerror
  149. ENDPROC(EV_DCError)
  150. ENTRY(EV_Maligned)
  151. SAVE_ALL_SYS
  152. SAVE_EXCEPTION_SOURCE
  153. mov %r1, %sp
  154. j do_maligned
  155. ENDPROC(EV_Maligned)
  156. #endif