]> git.baikalelectronics.ru Git - uboot.git/commitdiff
imx: spl_imx_romapi: Get and print boot stage
authorYe Li <ye.li@nxp.com>
Fri, 3 Feb 2023 10:21:47 +0000 (18:21 +0800)
committerStefano Babic <sbabic@denx.de>
Wed, 29 Mar 2023 22:45:39 +0000 (00:45 +0200)
Get and print boot stage through ROM API in SPL

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
arch/arm/include/asm/mach-imx/sys_proto.h
arch/arm/mach-imx/spl_imx_romapi.c

index 27fdc16cd50113b8ca875c8ccf472147e9304ed7..2eacddb51f5ec19c651a5c8c0b6b31916b859b8c 100644 (file)
@@ -172,6 +172,13 @@ enum boot_dev_type_e {
        BT_DEV_TYPE_INVALID = 0xFF
 };
 
+enum boot_stage_type {
+       BT_STAGE_PRIMARY = 0x6,
+       BT_STAGE_SECONDARY = 0x9,
+       BT_STAGE_RECOVERY = 0xa,
+       BT_STAGE_USB = 0x5,
+};
+
 #define QUERY_ROM_VER          1
 #define QUERY_BT_DEV           2
 #define QUERY_PAGE_SZ          3
index aa5d23a6fbee8c7ce4a0ec192126f18a49b2b572..830d5d12c25450bd287884b712e368f15426e096 100644 (file)
@@ -341,15 +341,35 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
                            struct spl_boot_device *bootdev)
 {
        int ret;
-       u32 boot;
+       u32 boot, bstage;
 
        ret = rom_api_query_boot_infor(QUERY_BT_DEV, &boot);
+       ret |= rom_api_query_boot_infor(QUERY_BT_STAGE, &bstage);
 
        if (ret != ROM_API_OKAY) {
                puts("ROMAPI: failure at query_boot_info\n");
                return -1;
        }
 
+       printf("Boot Stage: ");
+
+       switch (bstage) {
+       case BT_STAGE_PRIMARY:
+               printf("Primary boot\n");
+               break;
+       case BT_STAGE_SECONDARY:
+               printf("Secondary boot\n");
+               break;
+       case BT_STAGE_RECOVERY:
+               printf("Recovery boot\n");
+               break;
+       case BT_STAGE_USB:
+               printf("USB boot\n");
+               break;
+       default:
+               printf("Unknow (0x%x)\n", bstage);
+       }
+
        if (is_boot_from_stream_device(boot))
                return spl_romapi_load_image_stream(spl_image, bootdev);