]> git.sur5r.net Git - u-boot/commitdiff
bootstage: Convert progress numbers 1-9 into enums
authorSimon Glass <sjg@chromium.org>
Sat, 14 Jan 2012 15:24:47 +0000 (15:24 +0000)
committerWolfgang Denk <wd@denx.de>
Sun, 18 Mar 2012 19:57:37 +0000 (20:57 +0100)
Signed-off-by: Simon Glass <sjg@chromium.org>
board/bf533-stamp/bf533-stamp.c
board/hermes/hermes.c
board/ivm/ivm.c
board/matrix_vision/common/mv_common.c
board/matrix_vision/mvbc_p/mvbc_p.c
board/pcs440ep/pcs440ep.c
common/cmd_bootm.c
common/image.c
include/bootstage.h

index b1134e937d18051b4f6f33527048483ab9c9bda9..07a988a710ceb6486ae385ffeb85cfe846f1cbab 100644 (file)
@@ -91,27 +91,27 @@ static void stamp_led_set(int LED1, int LED2, int LED3)
 void show_boot_progress(int status)
 {
        switch (status) {
-       case 1:
+       case BOOTSTAGE_ID_CHECK_MAGIC:
                stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
                break;
-       case 2:
+       case BOOTSTAGE_ID_CHECK_HEADER:
                stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
                break;
-       case 3:
+       case BOOTSTAGE_ID_CHECK_CHECKSUM:
                stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
                break;
-       case 4:
+       case BOOTSTAGE_ID_CHECK_ARCH:
                stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
                break;
-       case 5:
-       case 6:
+       case BOOTSTAGE_ID_CHECK_IMAGETYPE:
+       case BOOTSTAGE_ID_DECOMP_IMAGE:
                stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
                break;
-       case 7:
-       case 8:
+       case BOOTSTAGE_ID_KERNEL_LOADED:
+       case BOOTSTAGE_ID_CHECK_BOOT_OS:
                stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
                break;
-       case 9:
+       case BOOTSTAGE_ID_BOOT_OS_RETURNED:
        case 10:
        case 11:
        case 12:
index acf364e2b90b6eb17e43195ba1c256831ec99f30..1b40ae8708520ec6b268465bbbd87ff381047b22 100644 (file)
@@ -370,7 +370,7 @@ static ulong board_init (void)
                        immr->im_ioport.iop_pcdat |= PC_REP_RES;
                }
        }
-       SHOW_BOOT_PROGRESS (0x00);
+       SHOW_BOOT_PROGRESS(BOOTSTAGE_ID_CHECK_MAGIC);
 
        return ((revision << 16) | (speed & 0xFFFF));
 }
index 9bec198c2e90f1eb8b815a5c873ae54b16b6c71a..71d64d434f317cca29519d110035c6a6bd265530 100644 (file)
@@ -322,7 +322,7 @@ void show_boot_progress (int status)
                        (status < 0) ? STATUS_LED_ON : STATUS_LED_OFF);
 # endif        /* STATUS_LED_YELLOW */
 # if defined(STATUS_LED_BOOT)
-       if (status == 6)
+       if (status == BOOTSTAGE_ID_DECOMP_IMAGE)
                status_led_set (STATUS_LED_BOOT, STATUS_LED_OFF);
 # endif        /* STATUS_LED_BOOT */
 #endif /* CONFIG_STATUS_LED */
index acb72c563c712bcf39cabe9fa0c2f4abc01ab150..7fde4acbf6d4be7833b780e7b0458427c8e36415 100644 (file)
@@ -95,7 +95,7 @@ int mv_load_fpga(void)
 
        result = fpga_load(0, fpga_data, data_size);
        if (!result)
-               show_boot_progress(0);
+               show_boot_progress(BOOTSTAGE_ID_START);
 
        return result;
 }
index 9dffedc9bd106071d4e05cf966c235ff1e75b828..a5dc2f0eb7ae91e513a9ceadded8c0e757853238 100644 (file)
@@ -241,7 +241,7 @@ void show_boot_progress(int val)
        struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
 
        switch(val) {
-       case 0: /* FPGA ok */
+       case BOOTSTAGE_ID_START: /* FPGA ok */
                setbits_be32(&gpio->simple_dvo, LED_G0);
                break;
        case 65:
index 36994b531cdcdeaf1923753c0b4002b9033ac432..118d81c7f29676fdfd2b4e8de786ce7b75c6cc09 100644 (file)
@@ -104,17 +104,17 @@ void show_boot_progress (int val)
                return;
        }
        switch (val) {
-               case 1:
-                       /* validating Image */
-                       status_led_set (0, STATUS_LED_OFF);
-                       status_led_set (1, STATUS_LED_ON);
-                       status_led_set (2, STATUS_LED_ON);
-                       break;
-               case BOOTSTAGE_ID_RUN_OS:
-                       status_led_set (0, STATUS_LED_ON);
-                       status_led_set (1, STATUS_LED_ON);
-                       status_led_set (2, STATUS_LED_ON);
-                       break;
+       case BOOTSTAGE_ID_CHECK_MAGIC:
+               /* validating Image */
+               status_led_set(0, STATUS_LED_OFF);
+               status_led_set(1, STATUS_LED_ON);
+               status_led_set(2, STATUS_LED_ON);
+               break;
+       case BOOTSTAGE_ID_RUN_OS:
+               status_led_set(0, STATUS_LED_ON);
+               status_led_set(1, STATUS_LED_ON);
+               status_led_set(2, STATUS_LED_ON);
+               break;
 #if 0
                case 64:
                        /* starting Ethernet configuration */
index 6adf06e81dde264eb16cc0a56a0f4509941fdcd6..c727c787caffb42fe853a833ae65f2428c554dd2 100644 (file)
@@ -348,7 +348,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
                        puts("GUNZIP: uncompress, out-of-mem or overwrite "
                                "error - must RESET board to recover\n");
                        if (boot_progress)
-                               show_boot_error(6);
+                               show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
                        return BOOTM_ERR_RESET;
                }
 
@@ -370,7 +370,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
                        printf("BUNZIP2: uncompress or overwrite error %d "
                                "- must RESET board to recover\n", i);
                        if (boot_progress)
-                               show_boot_error(6);
+                               show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
                        return BOOTM_ERR_RESET;
                }
 
@@ -389,7 +389,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
                if (ret != SZ_OK) {
                        printf("LZMA: uncompress or overwrite error %d "
                                "- must RESET board to recover\n", ret);
-                       show_boot_error(6);
+                       show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
                        return BOOTM_ERR_RESET;
                }
                *load_end = load + unc_len;
@@ -407,7 +407,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
                        printf("LZO: uncompress or overwrite error %d "
                              "- must RESET board to recover\n", ret);
                        if (boot_progress)
-                               show_boot_error(6);
+                               show_boot_error(BOOTSTAGE_ID_DECOMP_IMAGE);
                        return BOOTM_ERR_RESET;
                }
 
@@ -423,8 +423,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 
        puts("OK\n");
        debug("   kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end);
-       if (boot_progress)
-               show_boot_progress(7);
+       show_boot_progress(BOOTSTAGE_ID_KERNEL_LOADED);
 
        if (!no_overlap && (load < blob_end) && (*load_end > blob_start)) {
                debug("images.os.start = 0x%lX, images.os.end = 0x%lx\n",
@@ -656,7 +655,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if (ret == BOOTM_ERR_UNIMPLEMENTED) {
                        if (iflag)
                                enable_interrupts();
-                       show_boot_error(7);
+                       show_boot_error(BOOTSTAGE_ID_DECOMP_UNIMPL);
                        return 1;
                }
        }
@@ -671,7 +670,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 0;
        }
 
-       show_boot_progress(8);
+       show_boot_progress(BOOTSTAGE_ID_CHECK_BOOT_OS);
 
 #ifdef CONFIG_SILENT_CONSOLE
        if (images.os.os == IH_OS_LINUX)
@@ -685,7 +684,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        enable_interrupts();
                printf("ERROR: booting os '%s' (%d) is not supported\n",
                        genimg_get_os_name(images.os.os), images.os.os);
-               show_boot_error(8);
+               show_boot_error(BOOTSTAGE_ID_CHECK_BOOT_OS);
                return 1;
        }
 
@@ -693,7 +692,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        boot_fn(0, argc, argv, &images);
 
-       show_boot_error(9);
+       show_boot_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);
 #ifdef DEBUG
        puts("\n## Control returned to monitor - resetting...\n");
 #endif
@@ -735,34 +734,34 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
 
        if (!image_check_magic(hdr)) {
                puts("Bad Magic Number\n");
-               show_boot_error(1);
+               show_boot_error(BOOTSTAGE_ID_CHECK_MAGIC);
                return NULL;
        }
-       show_boot_progress(2);
+       show_boot_progress(BOOTSTAGE_ID_CHECK_HEADER);
 
        if (!image_check_hcrc(hdr)) {
                puts("Bad Header Checksum\n");
-               show_boot_error(2);
+               show_boot_error(BOOTSTAGE_ID_CHECK_HEADER);
                return NULL;
        }
 
-       show_boot_progress(3);
+       show_boot_progress(BOOTSTAGE_ID_CHECK_CHECKSUM);
        image_print_contents(hdr);
 
        if (verify) {
                puts("   Verifying Checksum ... ");
                if (!image_check_dcrc(hdr)) {
                        printf("Bad Data CRC\n");
-                       show_boot_error(3);
+                       show_boot_error(BOOTSTAGE_ID_CHECK_CHECKSUM);
                        return NULL;
                }
                puts("OK\n");
        }
-       show_boot_progress(4);
+       show_boot_progress(BOOTSTAGE_ID_CHECK_ARCH);
 
        if (!image_check_target_arch(hdr)) {
                printf("Unsupported Architecture 0x%x\n", image_get_arch(hdr));
-               show_boot_error(4);
+               show_boot_error(BOOTSTAGE_ID_CHECK_ARCH);
                return NULL;
        }
        return hdr;
@@ -864,7 +863,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
                debug("*  kernel: cmdline image address = 0x%08lx\n", img_addr);
        }
 
-       show_boot_progress(1);
+       show_boot_progress(BOOTSTAGE_ID_CHECK_MAGIC);
 
        /* copy from dataflash if needed */
        img_addr = genimg_get_image(img_addr);
@@ -878,7 +877,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
                hdr = image_get_kernel(img_addr, images->verify);
                if (!hdr)
                        return NULL;
-               show_boot_progress(5);
+               show_boot_progress(BOOTSTAGE_ID_CHECK_IMAGETYPE);
 
                /* get os_data and os_len */
                switch (image_get_type(hdr)) {
@@ -897,7 +896,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
                default:
                        printf("Wrong Image Type for %s command\n",
                                cmdtp->name);
-                       show_boot_error(5);
+                       show_boot_error(BOOTSTAGE_ID_CHECK_IMAGETYPE);
                        return NULL;
                }
 
@@ -912,7 +911,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
                images->legacy_hdr_os = hdr;
 
                images->legacy_hdr_valid = 1;
-               show_boot_progress(6);
+               show_boot_progress(BOOTSTAGE_ID_DECOMP_IMAGE);
                break;
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
index 8df03f545c2f7f5ba59b3881aee923b87385a5e6..1359246792d44f4967964a6f1eb005b2acece64f 100644 (file)
@@ -895,7 +895,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
                        printf("## Loading init Ramdisk from Legacy "
                                        "Image at %08lx ...\n", rd_addr);
 
-                       show_boot_progress(9);
+                       show_boot_progress(BOOTSTAGE_ID_LOAD_RAMDISK);
                        rd_hdr = image_get_ramdisk(rd_addr, arch,
                                                        images->verify);
 
index 63a6435c2cce28c59f349c9a62605e454ff4cf74..408356c8631f8161d87d22cff887e726d31db78b 100644 (file)
  * error on action3
  */
 enum bootstage_id {
+       BOOTSTAGE_ID_START = 0,
+       BOOTSTAGE_ID_CHECK_MAGIC,       /* Checking image magic */
+       BOOTSTAGE_ID_CHECK_HEADER,      /* Checking image header */
+       BOOTSTAGE_ID_CHECK_CHECKSUM,    /* Checking image checksum */
+       BOOTSTAGE_ID_CHECK_ARCH,        /* Checking architecture */
+
+       BOOTSTAGE_ID_CHECK_IMAGETYPE = 5,/* Checking image type */
+       BOOTSTAGE_ID_DECOMP_IMAGE,      /* Decompressing image */
+       BOOTSTAGE_ID_KERNEL_LOADED,     /* Kernel has been loaded */
+       BOOTSTAGE_ID_DECOMP_UNIMPL = 7, /* Odd decompression algorithm */
+       BOOTSTAGE_ID_CHECK_BOOT_OS,     /* Calling OS-specific boot function */
+       BOOTSTAGE_ID_BOOT_OS_RETURNED,  /* Tried to boot OS, but it returned */
+       BOOTSTAGE_ID_CHECK_RAMDISK = 9, /* Checking ram disk */
+
        BOOTSTAGE_ID_RUN_OS     = 15,   /* Exiting U-Boot, entering OS */
 };