fw_jump.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2019 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. */
  9. #include "fw_base.S"
  10. .section .entry, "ax", %progbits
  11. .align 3
  12. .global fw_boot_hart
  13. /*
  14. * This function is called very early even before
  15. * fw_save_info() is called.
  16. * We can only use a0, a1, and a2 registers here.
  17. * The boot HART id should be returned in 'a0'.
  18. */
  19. fw_boot_hart:
  20. li a0, -1
  21. ret
  22. .section .entry, "ax", %progbits
  23. .align 3
  24. .global fw_save_info
  25. /*
  26. * We can only use a0, a1, a2, a3, and a4 registers here.
  27. * The a0, a1, and a2 registers will be same as passed by
  28. * previous booting stage.
  29. * Nothing to be returned here.
  30. */
  31. fw_save_info:
  32. ret
  33. .section .entry, "ax", %progbits
  34. .align 3
  35. .global fw_prev_arg1
  36. /*
  37. * We can only use a0, a1, and a2 registers here.
  38. * The a0, a1, and a2 registers will be same as passed by
  39. * previous booting stage.
  40. * The previous arg1 should be returned in 'a0'.
  41. */
  42. fw_prev_arg1:
  43. add a0, zero, zero
  44. ret
  45. .section .entry, "ax", %progbits
  46. .align 3
  47. .global fw_next_arg1
  48. /*
  49. * We can only use a0, a1, and a2 registers here.
  50. * The a0, a1, and a2 registers will be same as passed by
  51. * previous booting stage.
  52. * The next arg1 should be returned in 'a0'.
  53. */
  54. fw_next_arg1:
  55. #ifdef FW_JUMP_FDT_ADDR
  56. li a0, FW_JUMP_FDT_ADDR
  57. #else
  58. add a0, a1, zero
  59. #endif
  60. ret
  61. .section .entry, "ax", %progbits
  62. .align 3
  63. .global fw_next_addr
  64. /*
  65. * We can only use a0, a1, and a2 registers here.
  66. * The next address should be returned in 'a0'.
  67. */
  68. fw_next_addr:
  69. la a0, _jump_addr
  70. REG_L a0, (a0)
  71. ret
  72. .section .entry, "ax", %progbits
  73. .align 3
  74. .global fw_next_mode
  75. /*
  76. * We can only use a0, a1, and a2 registers here.
  77. * The next address should be returned in 'a0'
  78. */
  79. fw_next_mode:
  80. li a0, PRV_S
  81. ret
  82. .section .entry, "ax", %progbits
  83. .align 3
  84. .global fw_options
  85. /*
  86. * We can only use a0, a1, and a2 registers here.
  87. * The 'a4' register will have default options.
  88. * The next address should be returned in 'a0'.
  89. */
  90. fw_options:
  91. add a0, zero, zero
  92. ret
  93. #ifndef FW_JUMP_ADDR
  94. #error "Must define FW_JUMP_ADDR"
  95. #endif
  96. .section .entry, "ax", %progbits
  97. .align 3
  98. _jump_addr:
  99. RISCV_PTR FW_JUMP_ADDR