bootstage: Convert progress numbers 1-9 into enums

Signed-off-by: Simon Glass <sjg@chromium.org>
master
Simon Glass 13 years ago committed by Wolfgang Denk
parent 5ddb118da4
commit 5dc887164e
  1. 18
      board/bf533-stamp/bf533-stamp.c
  2. 2
      board/hermes/hermes.c
  3. 2
      board/ivm/ivm.c
  4. 2
      board/matrix_vision/common/mv_common.c
  5. 2
      board/matrix_vision/mvbc_p/mvbc_p.c
  6. 22
      board/pcs440ep/pcs440ep.c
  7. 41
      common/cmd_bootm.c
  8. 2
      common/image.c
  9. 14
      include/bootstage.h

@ -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:

@ -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));
}

@ -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 */

@ -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;
}

@ -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:

@ -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 */

@ -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:

@ -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);

@ -44,6 +44,20 @@
* 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 */
};

Loading…
Cancel
Save