bootstage: Convert NAND progress numbers to enums
authorSimon Glass <sjg@chromium.org>
Sat, 10 Dec 2011 11:08:00 +0000 (11:08 +0000)
committerWolfgang Denk <wd@denx.de>
Sun, 18 Mar 2012 20:27:20 +0000 (21:27 +0100)
This changes over the NAND progress numbers to use enums from
bootstage.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/cmd_nand.c
include/bootstage.h

index 173e55116d7e52eeb6ab933f76a9a9e37040c5a5..09be9a773a48852579af081f79c4ffefd2683b83 100644 (file)
@@ -788,7 +788,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
        if (s != NULL &&
            (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {
                printf("Unknown nand load suffix '%s'\n", s);
-               show_boot_error(53);
+               show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
                return 1;
        }
 
@@ -798,16 +798,16 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
        r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
        if (r) {
                puts("** Read error\n");
-               show_boot_error(56);
+               show_boot_error(BOOTSTAGE_ID_NAND_HDR_READ);
                return 1;
        }
-       show_boot_progress (56);
+       show_boot_progress(BOOTSTAGE_ID_NAND_HDR_READ);
 
        switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
 
-               show_boot_progress (57);
+               show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
                image_print_contents (hdr);
 
                cnt = image_get_image_size (hdr);
@@ -821,29 +821,29 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
                break;
 #endif
        default:
-               show_boot_error(57);
+               show_boot_error(BOOTSTAGE_ID_NAND_TYPE);
                puts ("** Unknown image type\n");
                return 1;
        }
-       show_boot_progress (57);
+       show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
 
        r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
        if (r) {
                puts("** Read error\n");
-               show_boot_error(58);
+               show_boot_error(BOOTSTAGE_ID_NAND_READ);
                return 1;
        }
-       show_boot_progress (58);
+       show_boot_progress(BOOTSTAGE_ID_NAND_READ);
 
 #if defined(CONFIG_FIT)
        /* This cannot be done earlier, we need complete FIT image in RAM first */
        if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
                if (!fit_check_format (fit_hdr)) {
-                       show_boot_error(150);
+                       show_boot_error(BOOTSTAGE_ID_NAND_FIT_READ);
                        puts ("** Bad FIT image format\n");
                        return 1;
                }
-               show_boot_progress (151);
+               show_boot_progress(BOOTSTAGE_ID_NAND_FIT_READ_OK);
                fit_print_contents (fit_hdr);
        }
 #endif
@@ -885,7 +885,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        }
 #endif
 
-       show_boot_progress(52);
+       show_boot_progress(BOOTSTAGE_ID_NAND_PART);
        switch (argc) {
        case 1:
                addr = CONFIG_SYS_LOAD_ADDR;
@@ -908,26 +908,26 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 #if defined(CONFIG_CMD_MTDPARTS)
 usage:
 #endif
-               show_boot_error(53);
+               show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
                return CMD_RET_USAGE;
        }
+       show_boot_progress(BOOTSTAGE_ID_NAND_SUFFIX);
 
-       show_boot_progress(53);
        if (!boot_device) {
                puts("\n** No boot device **\n");
-               show_boot_error(54);
+               show_boot_error(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
                return 1;
        }
-       show_boot_progress(54);
+       show_boot_progress(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
 
        idx = simple_strtoul(boot_device, NULL, 16);
 
        if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) {
                printf("\n** Device %d not available\n", idx);
-               show_boot_error(55);
+               show_boot_error(BOOTSTAGE_ID_NAND_AVAILABLE);
                return 1;
        }
-       show_boot_progress(55);
+       show_boot_progress(BOOTSTAGE_ID_NAND_AVAILABLE);
 
        return nand_load_image(cmdtp, &nand_info[idx], offset, addr, argv[0]);
 }
index fec3c3cb81dd93837bd3a83304529959c15470d1..d58c46b893e8010c8511d7f3791f25ea9bc36573 100644 (file)
@@ -105,6 +105,21 @@ enum bootstage_id {
 
        BOOTSTAGE_ID_IDE_CHECKSUM,      /* 50 */
        BOOTSTAGE_ID_IDE_READ,
+
+       /* Boot stages related to loading a kernel from an NAND device */
+       BOOTSTAGE_ID_NAND_PART,
+       BOOTSTAGE_ID_NAND_SUFFIX,
+       BOOTSTAGE_ID_NAND_BOOT_DEVICE,
+       BOOTSTAGE_ID_NAND_HDR_READ = 55,
+       BOOTSTAGE_ID_NAND_AVAILABLE = 55,
+       BOOTSTAGE_ID_NAND_TYPE = 57,
+       BOOTSTAGE_ID_NAND_READ,
+
+       BOOTSTAGE_ID_IDE_FIT_READ = 140,
+       BOOTSTAGE_ID_IDE_FIT_READ_OK,
+
+       BOOTSTAGE_ID_NAND_FIT_READ = 150,
+       BOOTSTAGE_ID_NAND_FIT_READ_OK,
 };
 
 /*