[PATCH 1/3] lib: sbi: Print error message during warm boot

wu.fei9 at sanechips.com.cn wu.fei9 at sanechips.com.cn
Tue Aug 5 18:00:58 PDT 2025


It's helpful to print error messages for debugging, here add them in
warm boot path just as those in the cold boot path.

Signed-off-by: Wu Fei <wu.fei9 at sanechips.com.cn>
---
 lib/sbi/sbi_init.c | 65 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 52 insertions(+), 13 deletions(-)

diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
index 84a6374..2e1ca66 100644
--- a/lib/sbi/sbi_init.c
+++ b/lib/sbi/sbi_init.c
@@ -415,60 +415,99 @@ static void __noreturn init_warm_startup(struct sbi_scratch *scratch,

        /* Note: This has to be first thing in warmboot init sequence */
        rc = sbi_hsm_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d hsm init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_platform_early_init(plat, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d platform early init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_hart_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d hart init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_pmu_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d pmu init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_dbtr_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d dbtr init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_irqchip_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d irqchip init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_ipi_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d ipi init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_tlb_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d tlb init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_timer_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d timer init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_fwft_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d fwft init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_platform_final_init(plat, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d platform final init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        rc = sbi_sse_init(scratch, false);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d sse init failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        /*
         * Configure PMP at last because if SMEPMP is detected,
         * M-mode access to the S/U space will be rescinded.
         */
        rc = sbi_hart_pmp_configure(scratch);
-       if (rc)
+       if (rc) {
+               sbi_printf("%s: hart %d PMP configure failed (error %d)\n",
+                          __func__, hartid, rc);
                sbi_hart_hang();
+       }

        count = sbi_scratch_offset_ptr(scratch, init_count_offset);
        (*count)++;
--
2.43.0



More information about the opensbi mailing list