fw_payload.S 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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_PAYLOAD_FDT_ADDR
  44. li a0, FW_PAYLOAD_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, payload_bin
  58. ret
  59. .section .entry, "ax", %progbits
  60. .align 3
  61. .global fw_next_mode
  62. /*
  63. * We can only use a0, a1, and a2 registers here.
  64. * The next address should be returned in 'a0'.
  65. */
  66. fw_next_mode:
  67. li a0, PRV_S
  68. ret
  69. .section .entry, "ax", %progbits
  70. .align 3
  71. .global fw_options
  72. /*
  73. * We can only use a0, a1, and a2 registers here.
  74. * The 'a4' register will have default options.
  75. * The next address should be returned in 'a0'.
  76. */
  77. fw_options:
  78. add a0, zero, zero
  79. ret
  80. .section .payload, "ax", %progbits
  81. .align 4
  82. .globl payload_bin
  83. payload_bin:
  84. #ifndef FW_PAYLOAD_PATH
  85. wfi
  86. j payload_bin
  87. #else
  88. .incbin FW_PAYLOAD_PATH
  89. #endif