fw_payload.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. #ifdef FW_PAYLOAD_FDT_PATH
  44. la a0, fdt_bin
  45. #else
  46. add a0, zero, zero
  47. #endif
  48. ret
  49. .section .entry, "ax", %progbits
  50. .align 3
  51. .global fw_next_arg1
  52. /*
  53. * We can only use a0, a1, and a2 registers here.
  54. * The a0, a1, and a2 registers will be same as passed by
  55. * previous booting stage.
  56. * The next arg1 should be returned in 'a0'.
  57. */
  58. fw_next_arg1:
  59. #ifdef FW_PAYLOAD_FDT_ADDR
  60. li a0, FW_PAYLOAD_FDT_ADDR
  61. #else
  62. add a0, a1, zero
  63. #endif
  64. ret
  65. .section .entry, "ax", %progbits
  66. .align 3
  67. .global fw_next_addr
  68. /*
  69. * We can only use a0, a1, and a2 registers here.
  70. * The next address should be returned in 'a0'.
  71. */
  72. fw_next_addr:
  73. la a0, payload_bin
  74. ret
  75. .section .entry, "ax", %progbits
  76. .align 3
  77. .global fw_next_mode
  78. /*
  79. * We can only use a0, a1, and a2 registers here.
  80. * The next address should be returned in 'a0'.
  81. */
  82. fw_next_mode:
  83. li a0, PRV_S
  84. ret
  85. .section .entry, "ax", %progbits
  86. .align 3
  87. .global fw_options
  88. /*
  89. * We can only use a0, a1, and a2 registers here.
  90. * The 'a4' register will have default options.
  91. * The next address should be returned in 'a0'.
  92. */
  93. fw_options:
  94. add a0, zero, zero
  95. ret
  96. #ifdef FW_PAYLOAD_FDT_PATH
  97. .section .text, "ax", %progbits
  98. .align 4
  99. .globl fdt_bin
  100. fdt_bin:
  101. .incbin FW_PAYLOAD_FDT_PATH
  102. #endif
  103. .section .payload, "ax", %progbits
  104. .align 4
  105. .globl payload_bin
  106. payload_bin:
  107. #ifndef FW_PAYLOAD_PATH
  108. wfi
  109. j payload_bin
  110. #else
  111. .incbin FW_PAYLOAD_PATH
  112. #endif