bootstage: Use show_boot_error() for -ve progress numbers

Rather than the caller negating our progress numbers to indicate an
error has occurred, which seems hacky, add a function to indicate this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Simon Glass 2011-12-10 11:07:55 +00:00 committed by Wolfgang Denk
parent 578ac1e9ba
commit 5ddb118da4
11 changed files with 72 additions and 68 deletions

View File

@ -1064,7 +1064,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
void hang(void) void hang(void)
{ {
puts("### ERROR ### Please RESET the board ###\n"); puts("### ERROR ### Please RESET the board ###\n");
show_boot_progress(-30); show_boot_error(30);
for (;;) for (;;)
; ;
} }

View File

@ -426,7 +426,7 @@ void hang(void)
{ {
puts("### ERROR ### Please RESET the board ###\n"); puts("### ERROR ### Please RESET the board ###\n");
#ifdef CONFIG_SHOW_BOOT_PROGRESS #ifdef CONFIG_SHOW_BOOT_PROGRESS
show_boot_progress(-30); show_boot_error(30);
#endif #endif
for (;;) ; for (;;) ;
} }

View File

@ -222,21 +222,21 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
if (fit_image_get_type(images.fit_hdr_os, if (fit_image_get_type(images.fit_hdr_os,
images.fit_noffset_os, &images.os.type)) { images.fit_noffset_os, &images.os.type)) {
puts("Can't get image type!\n"); puts("Can't get image type!\n");
show_boot_progress(-109); show_boot_error(109);
return 1; return 1;
} }
if (fit_image_get_comp(images.fit_hdr_os, if (fit_image_get_comp(images.fit_hdr_os,
images.fit_noffset_os, &images.os.comp)) { images.fit_noffset_os, &images.os.comp)) {
puts("Can't get image compression!\n"); puts("Can't get image compression!\n");
show_boot_progress(-110); show_boot_error(110);
return 1; return 1;
} }
if (fit_image_get_os(images.fit_hdr_os, if (fit_image_get_os(images.fit_hdr_os,
images.fit_noffset_os, &images.os.os)) { images.fit_noffset_os, &images.os.os)) {
puts("Can't get image OS!\n"); puts("Can't get image OS!\n");
show_boot_progress(-111); show_boot_error(111);
return 1; return 1;
} }
@ -245,7 +245,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os, if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
&images.os.load)) { &images.os.load)) {
puts("Can't get image load address!\n"); puts("Can't get image load address!\n");
show_boot_progress(-112); show_boot_error(112);
return 1; return 1;
} }
break; break;
@ -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 " puts("GUNZIP: uncompress, out-of-mem or overwrite "
"error - must RESET board to recover\n"); "error - must RESET board to recover\n");
if (boot_progress) if (boot_progress)
show_boot_progress(-6); show_boot_error(6);
return BOOTM_ERR_RESET; 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 " printf("BUNZIP2: uncompress or overwrite error %d "
"- must RESET board to recover\n", i); "- must RESET board to recover\n", i);
if (boot_progress) if (boot_progress)
show_boot_progress(-6); show_boot_error(6);
return BOOTM_ERR_RESET; 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) { if (ret != SZ_OK) {
printf("LZMA: uncompress or overwrite error %d " printf("LZMA: uncompress or overwrite error %d "
"- must RESET board to recover\n", ret); "- must RESET board to recover\n", ret);
show_boot_progress(-6); show_boot_error(6);
return BOOTM_ERR_RESET; return BOOTM_ERR_RESET;
} }
*load_end = load + unc_len; *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 " printf("LZO: uncompress or overwrite error %d "
"- must RESET board to recover\n", ret); "- must RESET board to recover\n", ret);
if (boot_progress) if (boot_progress)
show_boot_progress(-6); show_boot_error(6);
return BOOTM_ERR_RESET; return BOOTM_ERR_RESET;
} }
@ -649,14 +649,14 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
} else { } else {
puts("ERROR: new format image overwritten - " puts("ERROR: new format image overwritten - "
"must RESET the board to recover\n"); "must RESET the board to recover\n");
show_boot_progress(-113); show_boot_error(113);
do_reset(cmdtp, flag, argc, argv); do_reset(cmdtp, flag, argc, argv);
} }
} }
if (ret == BOOTM_ERR_UNIMPLEMENTED) { if (ret == BOOTM_ERR_UNIMPLEMENTED) {
if (iflag) if (iflag)
enable_interrupts(); enable_interrupts();
show_boot_progress(-7); show_boot_error(7);
return 1; return 1;
} }
} }
@ -685,7 +685,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
enable_interrupts(); enable_interrupts();
printf("ERROR: booting os '%s' (%d) is not supported\n", printf("ERROR: booting os '%s' (%d) is not supported\n",
genimg_get_os_name(images.os.os), images.os.os); genimg_get_os_name(images.os.os), images.os.os);
show_boot_progress(-8); show_boot_error(8);
return 1; return 1;
} }
@ -693,7 +693,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
boot_fn(0, argc, argv, &images); boot_fn(0, argc, argv, &images);
show_boot_progress(-9); show_boot_error(9);
#ifdef DEBUG #ifdef DEBUG
puts("\n## Control returned to monitor - resetting...\n"); puts("\n## Control returned to monitor - resetting...\n");
#endif #endif
@ -735,14 +735,14 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
if (!image_check_magic(hdr)) { if (!image_check_magic(hdr)) {
puts("Bad Magic Number\n"); puts("Bad Magic Number\n");
show_boot_progress(-1); show_boot_error(1);
return NULL; return NULL;
} }
show_boot_progress(2); show_boot_progress(2);
if (!image_check_hcrc(hdr)) { if (!image_check_hcrc(hdr)) {
puts("Bad Header Checksum\n"); puts("Bad Header Checksum\n");
show_boot_progress(-2); show_boot_error(2);
return NULL; return NULL;
} }
@ -753,7 +753,7 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
puts(" Verifying Checksum ... "); puts(" Verifying Checksum ... ");
if (!image_check_dcrc(hdr)) { if (!image_check_dcrc(hdr)) {
printf("Bad Data CRC\n"); printf("Bad Data CRC\n");
show_boot_progress(-3); show_boot_error(3);
return NULL; return NULL;
} }
puts("OK\n"); puts("OK\n");
@ -762,7 +762,7 @@ static image_header_t *image_get_kernel(ulong img_addr, int verify)
if (!image_check_target_arch(hdr)) { if (!image_check_target_arch(hdr)) {
printf("Unsupported Architecture 0x%x\n", image_get_arch(hdr)); printf("Unsupported Architecture 0x%x\n", image_get_arch(hdr));
show_boot_progress(-4); show_boot_error(4);
return NULL; return NULL;
} }
return hdr; return hdr;
@ -790,7 +790,7 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
puts(" Verifying Hash Integrity ... "); puts(" Verifying Hash Integrity ... ");
if (!fit_image_check_hashes(fit, os_noffset)) { if (!fit_image_check_hashes(fit, os_noffset)) {
puts("Bad Data Hash\n"); puts("Bad Data Hash\n");
show_boot_progress(-104); show_boot_error(104);
return 0; return 0;
} }
puts("OK\n"); puts("OK\n");
@ -799,7 +799,7 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
if (!fit_image_check_target_arch(fit, os_noffset)) { if (!fit_image_check_target_arch(fit, os_noffset)) {
puts("Unsupported Architecture\n"); puts("Unsupported Architecture\n");
show_boot_progress(-105); show_boot_error(105);
return 0; return 0;
} }
@ -807,7 +807,7 @@ static int fit_check_kernel(const void *fit, int os_noffset, int verify)
if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) && if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) &&
!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) { !fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
puts("Not a kernel image\n"); puts("Not a kernel image\n");
show_boot_progress(-106); show_boot_error(106);
return 0; return 0;
} }
@ -897,7 +897,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
default: default:
printf("Wrong Image Type for %s command\n", printf("Wrong Image Type for %s command\n",
cmdtp->name); cmdtp->name);
show_boot_progress(-5); show_boot_error(5);
return NULL; return NULL;
} }
@ -922,7 +922,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
if (!fit_check_format(fit_hdr)) { if (!fit_check_format(fit_hdr)) {
puts("Bad FIT kernel image format!\n"); puts("Bad FIT kernel image format!\n");
show_boot_progress(-100); show_boot_error(100);
return NULL; return NULL;
} }
show_boot_progress(100); show_boot_progress(100);
@ -938,7 +938,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
cfg_noffset = fit_conf_get_node(fit_hdr, cfg_noffset = fit_conf_get_node(fit_hdr,
fit_uname_config); fit_uname_config);
if (cfg_noffset < 0) { if (cfg_noffset < 0) {
show_boot_progress(-101); show_boot_error(101);
return NULL; return NULL;
} }
/* save configuration uname provided in the first /* save configuration uname provided in the first
@ -962,7 +962,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
fit_uname_kernel); fit_uname_kernel);
} }
if (os_noffset < 0) { if (os_noffset < 0) {
show_boot_progress(-103); show_boot_error(103);
return NULL; return NULL;
} }
@ -975,7 +975,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
/* get kernel image data address and length */ /* get kernel image data address and length */
if (fit_image_get_data(fit_hdr, os_noffset, &data, &len)) { if (fit_image_get_data(fit_hdr, os_noffset, &data, &len)) {
puts("Could not find kernel subimage data!\n"); puts("Could not find kernel subimage data!\n");
show_boot_progress(-107); show_boot_error(107);
return NULL; return NULL;
} }
show_boot_progress(108); show_boot_progress(108);
@ -989,7 +989,7 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
#endif #endif
default: default:
printf("Wrong Image Format for %s command\n", cmdtp->name); printf("Wrong Image Format for %s command\n", cmdtp->name);
show_boot_progress(-108); show_boot_error(108);
return NULL; return NULL;
} }

View File

@ -360,14 +360,14 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
boot_device = argv[2]; boot_device = argv[2];
break; break;
default: default:
show_boot_progress(-42); show_boot_error(42);
return CMD_RET_USAGE; return CMD_RET_USAGE;
} }
show_boot_progress(42); show_boot_progress(42);
if (!boot_device) { if (!boot_device) {
puts("\n** No boot device **\n"); puts("\n** No boot device **\n");
show_boot_progress(-43); show_boot_error(43);
return 1; return 1;
} }
show_boot_progress(43); show_boot_progress(43);
@ -376,7 +376,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN) { if (ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN) {
printf("\n** Device %d not available\n", dev); printf("\n** Device %d not available\n", dev);
show_boot_progress(-44); show_boot_error(44);
return 1; return 1;
} }
show_boot_progress(44); show_boot_progress(44);
@ -384,14 +384,14 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (*ep) { if (*ep) {
if (*ep != ':') { if (*ep != ':') {
puts("\n** Invalid boot device, use `dev[:part]' **\n"); puts("\n** Invalid boot device, use `dev[:part]' **\n");
show_boot_progress(-45); show_boot_error(45);
return 1; return 1;
} }
part = simple_strtoul(++ep, NULL, 16); part = simple_strtoul(++ep, NULL, 16);
} }
show_boot_progress(45); show_boot_progress(45);
if (get_partition_info(&ide_dev_desc[dev], part, &info)) { if (get_partition_info(&ide_dev_desc[dev], part, &info)) {
show_boot_progress(-46); show_boot_error(46);
return 1; return 1;
} }
show_boot_progress(46); show_boot_progress(46);
@ -402,7 +402,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
printf("\n** Invalid partition type \"%.32s\"" " (expect \"" printf("\n** Invalid partition type \"%.32s\"" " (expect \""
BOOT_PART_TYPE "\")\n", BOOT_PART_TYPE "\")\n",
info.type); info.type);
show_boot_progress(-47); show_boot_error(47);
return 1; return 1;
} }
show_boot_progress(47); show_boot_progress(47);
@ -416,7 +416,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (ide_dev_desc[dev]. if (ide_dev_desc[dev].
block_read(dev, info.start, 1, (ulong *) addr) != 1) { block_read(dev, info.start, 1, (ulong *) addr) != 1) {
printf("** Read error on %d:%d\n", dev, part); printf("** Read error on %d:%d\n", dev, part);
show_boot_progress(-48); show_boot_error(48);
return 1; return 1;
} }
show_boot_progress(48); show_boot_progress(48);
@ -429,7 +429,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (!image_check_hcrc(hdr)) { if (!image_check_hcrc(hdr)) {
puts("\n** Bad Header Checksum **\n"); puts("\n** Bad Header Checksum **\n");
show_boot_progress(-50); show_boot_error(50);
return 1; return 1;
} }
show_boot_progress(50); show_boot_progress(50);
@ -447,7 +447,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
break; break;
#endif #endif
default: default:
show_boot_progress(-49); show_boot_error(49);
puts("** Unknown image type\n"); puts("** Unknown image type\n");
return 1; return 1;
} }
@ -459,7 +459,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (ide_dev_desc[dev].block_read(dev, info.start + 1, cnt, if (ide_dev_desc[dev].block_read(dev, info.start + 1, cnt,
(ulong *)(addr + info.blksz)) != cnt) { (ulong *)(addr + info.blksz)) != cnt) {
printf("** Read error on %d:%d\n", dev, part); printf("** Read error on %d:%d\n", dev, part);
show_boot_progress(-51); show_boot_error(51);
return 1; return 1;
} }
show_boot_progress(51); show_boot_progress(51);
@ -468,7 +468,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
/* This cannot be done earlier, we need complete FIT image in RAM first */ /* This cannot be done earlier, we need complete FIT image in RAM first */
if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) { if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) {
if (!fit_check_format(fit_hdr)) { if (!fit_check_format(fit_hdr)) {
show_boot_progress(-140); show_boot_error(140);
puts("** Bad FIT image format\n"); puts("** Bad FIT image format\n");
return 1; return 1;
} }

View File

@ -788,7 +788,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
if (s != NULL && if (s != NULL &&
(strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) { (strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {
printf("Unknown nand load suffix '%s'\n", s); printf("Unknown nand load suffix '%s'\n", s);
show_boot_progress(-53); show_boot_error(53);
return 1; return 1;
} }
@ -798,7 +798,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr); r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
if (r) { if (r) {
puts("** Read error\n"); puts("** Read error\n");
show_boot_progress (-56); show_boot_error(56);
return 1; return 1;
} }
show_boot_progress (56); show_boot_progress (56);
@ -821,7 +821,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
break; break;
#endif #endif
default: default:
show_boot_progress (-57); show_boot_error(57);
puts ("** Unknown image type\n"); puts ("** Unknown image type\n");
return 1; return 1;
} }
@ -830,7 +830,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr); r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
if (r) { if (r) {
puts("** Read error\n"); puts("** Read error\n");
show_boot_progress (-58); show_boot_error(58);
return 1; return 1;
} }
show_boot_progress (58); show_boot_progress (58);
@ -839,7 +839,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
/* This cannot be done earlier, we need complete FIT image in RAM first */ /* This cannot be done earlier, we need complete FIT image in RAM first */
if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) { if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
if (!fit_check_format (fit_hdr)) { if (!fit_check_format (fit_hdr)) {
show_boot_progress (-150); show_boot_error(150);
puts ("** Bad FIT image format\n"); puts ("** Bad FIT image format\n");
return 1; return 1;
} }
@ -908,14 +908,14 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
#if defined(CONFIG_CMD_MTDPARTS) #if defined(CONFIG_CMD_MTDPARTS)
usage: usage:
#endif #endif
show_boot_progress(-53); show_boot_error(53);
return CMD_RET_USAGE; return CMD_RET_USAGE;
} }
show_boot_progress(53); show_boot_progress(53);
if (!boot_device) { if (!boot_device) {
puts("\n** No boot device **\n"); puts("\n** No boot device **\n");
show_boot_progress(-54); show_boot_error(54);
return 1; return 1;
} }
show_boot_progress(54); show_boot_progress(54);
@ -924,7 +924,7 @@ usage:
if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) { if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) {
printf("\n** Device %d not available\n", idx); printf("\n** Device %d not available\n", idx);
show_boot_progress(-55); show_boot_error(55);
return 1; return 1;
} }
show_boot_progress(55); show_boot_progress(55);

View File

@ -230,23 +230,23 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
break; break;
#endif #endif
default: default:
show_boot_progress (-80); show_boot_error(80);
return CMD_RET_USAGE; return CMD_RET_USAGE;
} }
show_boot_progress (80); show_boot_progress(80);
if ((size = NetLoop(proto)) < 0) { if ((size = NetLoop(proto)) < 0) {
show_boot_progress (-81); show_boot_error(81);
return 1; return 1;
} }
show_boot_progress (81); show_boot_progress(81);
/* NetLoop ok, update environment */ /* NetLoop ok, update environment */
netboot_update_env(); netboot_update_env();
/* done if no file was loaded (no errors though) */ /* done if no file was loaded (no errors though) */
if (size == 0) { if (size == 0) {
show_boot_progress (-82); show_boot_error(82);
return 0; return 0;
} }
@ -257,9 +257,9 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
rcode = bootm_maybe_autostart(cmdtp, argv[0]); rcode = bootm_maybe_autostart(cmdtp, argv[0]);
if (rcode < 0) if (rcode < 0)
show_boot_progress (-83); show_boot_error(83);
else else
show_boot_progress (84); show_boot_progress(84);
return rcode; return rcode;
} }

View File

@ -228,7 +228,7 @@ void env_relocate(void)
#if defined(CONFIG_ENV_IS_NOWHERE) /* Environment not changable */ #if defined(CONFIG_ENV_IS_NOWHERE) /* Environment not changable */
set_default_env(NULL); set_default_env(NULL);
#else #else
show_boot_progress(-60); show_boot_error(60);
set_default_env("!bad CRC"); set_default_env("!bad CRC");
#endif #endif
} else { } else {

View File

@ -373,13 +373,13 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
if (!image_check_magic(rd_hdr)) { if (!image_check_magic(rd_hdr)) {
puts("Bad Magic Number\n"); puts("Bad Magic Number\n");
show_boot_progress(-10); show_boot_error(10);
return NULL; return NULL;
} }
if (!image_check_hcrc(rd_hdr)) { if (!image_check_hcrc(rd_hdr)) {
puts("Bad Header Checksum\n"); puts("Bad Header Checksum\n");
show_boot_progress(-11); show_boot_error(11);
return NULL; return NULL;
} }
@ -390,7 +390,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
puts(" Verifying Checksum ... "); puts(" Verifying Checksum ... ");
if (!image_check_dcrc(rd_hdr)) { if (!image_check_dcrc(rd_hdr)) {
puts("Bad Data CRC\n"); puts("Bad Data CRC\n");
show_boot_progress(-12); show_boot_error(12);
return NULL; return NULL;
} }
puts("OK\n"); puts("OK\n");
@ -403,7 +403,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
!image_check_type(rd_hdr, IH_TYPE_RAMDISK)) { !image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
printf("No Linux %s Ramdisk Image\n", printf("No Linux %s Ramdisk Image\n",
genimg_get_arch_name(arch)); genimg_get_arch_name(arch));
show_boot_progress(-13); show_boot_error(13);
return NULL; return NULL;
} }
@ -915,7 +915,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
show_boot_progress(120); show_boot_progress(120);
if (!fit_check_format(fit_hdr)) { if (!fit_check_format(fit_hdr)) {
puts("Bad FIT ramdisk image format!\n"); puts("Bad FIT ramdisk image format!\n");
show_boot_progress(-120); show_boot_error(120);
return 1; return 1;
} }
show_boot_progress(121); show_boot_progress(121);
@ -932,7 +932,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
if (cfg_noffset < 0) { if (cfg_noffset < 0) {
puts("Could not find configuration " puts("Could not find configuration "
"node\n"); "node\n");
show_boot_progress(-122); show_boot_error(122);
return 1; return 1;
} }
fit_uname_config = fdt_get_name(fit_hdr, fit_uname_config = fdt_get_name(fit_hdr,
@ -952,7 +952,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
} }
if (rd_noffset < 0) { if (rd_noffset < 0) {
puts("Could not find subimage node\n"); puts("Could not find subimage node\n");
show_boot_progress(-124); show_boot_error(124);
return 1; return 1;
} }
@ -968,7 +968,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
if (fit_image_get_data(fit_hdr, rd_noffset, &data, if (fit_image_get_data(fit_hdr, rd_noffset, &data,
&size)) { &size)) {
puts("Could not find ramdisk subimage data!\n"); puts("Could not find ramdisk subimage data!\n");
show_boot_progress(-127); show_boot_error(127);
return 1; return 1;
} }
show_boot_progress(128); show_boot_progress(128);
@ -979,7 +979,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
if (fit_image_get_load(fit_hdr, rd_noffset, &rd_load)) { if (fit_image_get_load(fit_hdr, rd_noffset, &rd_load)) {
puts("Can't get ramdisk subimage load " puts("Can't get ramdisk subimage load "
"address!\n"); "address!\n");
show_boot_progress(-129); show_boot_error(129);
return 1; return 1;
} }
show_boot_progress(129); show_boot_progress(129);
@ -3176,7 +3176,7 @@ static int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
puts(" Verifying Hash Integrity ... "); puts(" Verifying Hash Integrity ... ");
if (!fit_image_check_hashes(fit, rd_noffset)) { if (!fit_image_check_hashes(fit, rd_noffset)) {
puts("Bad Data Hash\n"); puts("Bad Data Hash\n");
show_boot_progress(-125); show_boot_error(125);
return 0; return 0;
} }
puts("OK\n"); puts("OK\n");
@ -3188,7 +3188,7 @@ static int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
!fit_image_check_type(fit, rd_noffset, IH_TYPE_RAMDISK)) { !fit_image_check_type(fit, rd_noffset, IH_TYPE_RAMDISK)) {
printf("No Linux %s Ramdisk Image\n", printf("No Linux %s Ramdisk Image\n",
genimg_get_arch_name(arch)); genimg_get_arch_name(arch));
show_boot_progress(-126); show_boot_error(126);
return 0; return 0;
} }

View File

@ -54,5 +54,9 @@ enum bootstage_id {
* has occurred. * has occurred.
*/ */
void show_boot_progress(int val); void show_boot_progress(int val);
static inline void show_boot_error(int val)
{
show_boot_progress(-val);
}
#endif #endif

View File

@ -280,7 +280,7 @@ int eth_initialize(bd_t *bis)
if (!eth_devices) { if (!eth_devices) {
puts ("No ethernet found.\n"); puts ("No ethernet found.\n");
show_boot_progress (-64); show_boot_error(64);
} else { } else {
struct eth_device *dev = eth_devices; struct eth_device *dev = eth_devices;
char *ethprime = getenv ("ethprime"); char *ethprime = getenv ("ethprime");

View File

@ -158,7 +158,7 @@ void post_output_backlog(void)
post_log("PASSED\n"); post_log("PASSED\n");
else { else {
post_log("FAILED\n"); post_log("FAILED\n");
show_boot_progress(-31); show_boot_error(31);
} }
} }
} }
@ -295,7 +295,7 @@ static int post_run_single(struct post_test *test,
} else { } else {
if ((*test->test)(flags) != 0) { if ((*test->test)(flags) != 0) {
post_log("FAILED\n"); post_log("FAILED\n");
show_boot_progress(-32); show_boot_error(32);
show_post_progress(i, POST_AFTER, POST_FAILED); show_post_progress(i, POST_AFTER, POST_FAILED);
if (test_flags & POST_CRITICAL) if (test_flags & POST_CRITICAL)
gd->flags |= GD_FLG_POSTFAIL; gd->flags |= GD_FLG_POSTFAIL;