[U-Boot] [PATCH v3 05/15] bootstage: Convert progress numbers 10-19 to enums

Simon Glass sjg at chromium.org
Sun Jan 15 02:24:48 CET 2012


Signed-off-by: Simon Glass <sjg at chromium.org>
Acked-by: Mike Frysinger <vapier at gentoo.org>
---

 board/bf533-stamp/bf533-stamp.c     |   10 +++++-----
 board/matrix_vision/mvbc_p/mvbc_p.c |    2 +-
 common/image.c                      |   20 ++++++++++----------
 include/bootstage.h                 |    7 +++++++
 4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index 07a988a..4d36160 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -112,11 +112,11 @@ void show_boot_progress(int status)
 		stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
 		break;
 	case BOOTSTAGE_ID_BOOT_OS_RETURNED:
-	case 10:
-	case 11:
-	case 12:
-	case 13:
-	case 14:
+	case BOOTSTAGE_ID_RD_MAGIC:
+	case BOOTSTAGE_ID_RD_HDR_CHECKSUM:
+	case BOOTSTAGE_ID_RD_CHECKSUM:
+	case BOOTSTAGE_ID_RAMDISK:
+	case BOOTSTAGE_ID_NO_RAMDISK:
 	case BOOTSTAGE_ID_RUN_OS:
 		stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
 		break;
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c b/board/matrix_vision/mvbc_p/mvbc_p.c
index a5dc2f0..7e06d6c 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -247,7 +247,7 @@ void show_boot_progress(int val)
 	case 65:
 		setbits_be32(&gpio->simple_dvo, LED_G1);
 		break;
-	case 12:
+	case BOOTSTAGE_ID_COPY_RAMDISK:
 		setbits_be32(&gpio->simple_dvo, LED_Y);
 		break;
 	case BOOTSTAGE_ID_RUN_OS:
diff --git a/common/image.c b/common/image.c
index 6c69c2b..af228cc 100644
--- a/common/image.c
+++ b/common/image.c
@@ -373,37 +373,37 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 
 	if (!image_check_magic(rd_hdr)) {
 		puts("Bad Magic Number\n");
-		show_boot_error(10);
+		show_boot_error(BOOTSTAGE_ID_RD_MAGIC);
 		return NULL;
 	}
 
 	if (!image_check_hcrc(rd_hdr)) {
 		puts("Bad Header Checksum\n");
-		show_boot_error(11);
+		show_boot_error(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
 		return NULL;
 	}
 
-	show_boot_progress(10);
+	show_boot_progress(BOOTSTAGE_ID_RD_MAGIC);
 	image_print_contents(rd_hdr);
 
 	if (verify) {
 		puts("   Verifying Checksum ... ");
 		if (!image_check_dcrc(rd_hdr)) {
 			puts("Bad Data CRC\n");
-			show_boot_error(12);
+			show_boot_error(BOOTSTAGE_ID_RD_CHECKSUM);
 			return NULL;
 		}
 		puts("OK\n");
 	}
 
-	show_boot_progress(11);
+	show_boot_progress(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
 
 	if (!image_check_os(rd_hdr, IH_OS_LINUX) ||
 	    !image_check_arch(rd_hdr, arch) ||
 	    !image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
 		printf("No Linux %s Ramdisk Image\n",
 				genimg_get_arch_name(arch));
-		show_boot_error(13);
+		show_boot_error(BOOTSTAGE_ID_RAMDISK);
 		return NULL;
 	}
 
@@ -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(BOOTSTAGE_ID_LOAD_RAMDISK);
+			show_boot_progress(BOOTSTAGE_ID_CHECK_RAMDISK);
 			rd_hdr = image_get_ramdisk(rd_addr, arch,
 							images->verify);
 
@@ -1002,7 +1002,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 		 * Now check if we have a legacy mult-component image,
 		 * get second entry data start address and len.
 		 */
-		show_boot_progress(13);
+		show_boot_progress(BOOTSTAGE_ID_RAMDISK);
 		printf("## Loading init Ramdisk from multi component "
 				"Legacy Image at %08lx ...\n",
 				(ulong)images->legacy_hdr_os);
@@ -1012,7 +1012,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 		/*
 		 * no initrd image
 		 */
-		show_boot_progress(14);
+		show_boot_progress(BOOTSTAGE_ID_NO_RAMDISK);
 		rd_len = rd_data = 0;
 	}
 
@@ -1096,7 +1096,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
 				puts("ramdisk - allocation error\n");
 				goto error;
 			}
-			show_boot_progress(12);
+			show_boot_progress(BOOTSTAGE_ID_COPY_RAMDISK);
 
 			*initrd_end = *initrd_start + rd_len;
 			printf("   Loading Ramdisk to %08lx, end %08lx ... ",
diff --git a/include/bootstage.h b/include/bootstage.h
index 408356c..29082eb 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -58,6 +58,13 @@ enum bootstage_id {
 	BOOTSTAGE_ID_BOOT_OS_RETURNED,	/* Tried to boot OS, but it returned */
 	BOOTSTAGE_ID_CHECK_RAMDISK = 9,	/* Checking ram disk */
 
+	BOOTSTAGE_ID_RD_MAGIC,		/* Checking ram disk magic */
+	BOOTSTAGE_ID_RD_HDR_CHECKSUM,	/* Checking ram disk heder checksum */
+	BOOTSTAGE_ID_RD_CHECKSUM,	/* Checking ram disk checksum */
+	BOOTSTAGE_ID_COPY_RAMDISK = 12,	/* Copying ram disk into place */
+	BOOTSTAGE_ID_RAMDISK,		/* Checking for valid ramdisk */
+	BOOTSTAGE_ID_NO_RAMDISK,	/* No ram disk found (not an error) */
+
 	BOOTSTAGE_ID_RUN_OS	= 15,	/* Exiting U-Boot, entering OS */
 };
 
-- 
1.7.7.3



More information about the U-Boot mailing list