fw_jump.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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_next_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 next arg1 should be returned in 'a0'.
  41. */
  42. fw_next_arg1:
  43. #ifdef FW_JUMP_FDT_ADDR
  44. li a0, FW_JUMP_FDT_ADDR
  45. #else
  46. add a0, a1, zero
  47. #endif
  48. ret
  49. .section .entry, "ax", %progbits
  50. .align 3
  51. .global fw_next_addr
  52. /*
  53. * We can only use a0, a1, and a2 registers here.
  54. * The next address should be returned in 'a0'.
  55. */
  56. fw_next_addr:
  57. lla a0, _jump_addr
  58. REG_L a0, (a0)
  59. ret
  60. .section .entry, "ax", %progbits
  61. .align 3
  62. .global fw_next_mode
  63. /*
  64. * We can only use a0, a1, and a2 registers here.
  65. * The next address should be returned in 'a0'
  66. */
  67. fw_next_mode:
  68. li a0, PRV_S
  69. ret
  70. .section .entry, "ax", %progbits
  71. .align 3
  72. .global fw_options
  73. /*
  74. * We can only use a0, a1, and a2 registers here.
  75. * The 'a4' register will have default options.
  76. * The next address should be returned in 'a0'.
  77. */
  78. fw_options:
  79. add a0, zero, zero
  80. ret
  81. #ifndef FW_JUMP_ADDR
  82. #error "Must define FW_JUMP_ADDR"
  83. #endif
  84. .section .entry, "ax", %progbits
  85. .align 3
  86. _jump_addr:
  87. RISCV_PTR FW_JUMP_ADDR