fdt_reset_thead_asm.S 771 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. */
  4. #include <sbi/riscv_asm.h>
  5. #include "fdt_reset_thead.h"
  6. /*
  7. * csrrs rd, csr, rs1
  8. * |31 20|19 15|14 12|11 7|6 0|
  9. * csr rs1 010 rd 1110011
  10. */
  11. #define CSR_STUB addi x0, x0, 0
  12. .option norvc
  13. .align 3
  14. .global __fdt_reset_thead_csrr
  15. __fdt_reset_thead_csrr:
  16. csrrs a0, 0, x0
  17. ret
  18. .align 3
  19. .global __thead_pre_start_warm
  20. __thead_pre_start_warm:
  21. /*
  22. * Clear L1 cache & BTB & BHT ...
  23. */
  24. li t1, 0x70013
  25. csrw 0x7c2, t1
  26. fence rw,rw
  27. lla t1, custom_csr
  28. .global __reset_thead_csr_stub
  29. __reset_thead_csr_stub:
  30. .rept MAX_CUSTOM_CSR
  31. REG_L t2, 8(t1)
  32. CSR_STUB
  33. addi t1, t1, 16
  34. .endr
  35. /*
  36. * Clear L1 cache & BTB & BHT ...
  37. */
  38. li t1, 0x70013
  39. csrw 0x7c2, t1
  40. fence rw,rw
  41. j _start_warm