public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bartlomiej Sieka <tur@semihalf.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 06/20] [new uImage] Remove unnecessary arguments passed to	ramdisk routines
Date: Wed, 12 Mar 2008 21:11:03 +0100	[thread overview]
Message-ID: <20080312201102.6444.63560.stgit@pollux.denx.de> (raw)
In-Reply-To: <20080312201023.6444.52806.stgit@pollux.denx.de>

From: Marian Balakowicz <m8@semihalf.com>

boot_get_ramdisk() and image_get_ramdisk() do not need all
cmdtp, flag, argc and argv arguments. Simplify routines definition.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 common/image.c    |   32 ++++++++++++--------------------
 include/image.h   |    5 ++---
 lib_arm/bootm.c   |    6 ++++--
 lib_avr32/bootm.c |    6 ++++--
 lib_i386/bootm.c  |    7 +++++--
 lib_m68k/bootm.c  |    5 ++---
 lib_mips/bootm.c  |    7 +++++--
 lib_ppc/bootm.c   |    5 ++---
 8 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/common/image.c b/common/image.c
index 3b15853..6458fb1 100644
--- a/common/image.c
+++ b/common/image.c
@@ -66,9 +66,8 @@ extern int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
-		int argc, char *argv[],
-		ulong rd_addr, uint8_t arch, int verify);
+static image_header_t* image_get_ramdisk (ulong rd_addr, uint8_t arch,
+						int verify);
 #else
 #include "mkimage.h"
 #include <time.h>
@@ -379,10 +378,6 @@ inline void image_print_contents_noindent (image_header_t *hdr)
 #ifndef USE_HOSTCC
 /**
  * image_get_ramdisk - get and verify ramdisk image
- * @cmdtp: command table pointer
- * @flag: command flag
- * @argc: command argument count
- * @argv: command argument list
  * @rd_addr: ramdisk image start address
  * @arch: expected ramdisk architecture
  * @verify: checksum verification flag
@@ -399,9 +394,8 @@ inline void image_print_contents_noindent (image_header_t *hdr)
  *     pointer to a ramdisk image header, if image was found and valid
  *     otherwise, return NULL
  */
-static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
-		int argc, char *argv[],
-		ulong rd_addr, uint8_t arch, int verify)
+static image_header_t* image_get_ramdisk (ulong rd_addr, uint8_t arch,
+						int verify)
 {
 	image_header_t *rd_hdr;
 
@@ -748,8 +742,6 @@ ulong genimg_get_image (ulong img_addr)
 
 /**
  * boot_get_ramdisk - main ramdisk handling routine
- * @cmdtp: command table pointer
- * @flag: command flag
  * @argc: command argument count
  * @argv: command argument list
  * @images: pointer to the bootm images structure
@@ -763,14 +755,15 @@ ulong genimg_get_image (ulong img_addr)
  *      - commandline provided address of decicated ramdisk image.
  *
  * returns:
+ *     0, if ramdisk image was found and valid, or skiped
  *     rd_start and rd_end are set to ramdisk start/end addresses if
  *     ramdisk image is found and valid
+ *
+ *     1, if ramdisk image is found but corrupted
  *     rd_start and rd_end are set to 0 if no ramdisk exists
- *     return 1 if ramdisk image is found but corrupted
  */
-int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
-		bootm_headers_t *images, uint8_t arch,
-		ulong *rd_start, ulong *rd_end)
+int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images,
+		uint8_t arch, ulong *rd_start, ulong *rd_end)
 {
 	ulong rd_addr, rd_load;
 	ulong rd_data, rd_len;
@@ -837,8 +830,8 @@ int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 			printf ("## Loading init Ramdisk from Legacy "
 					"Image at %08lx ...\n", rd_addr);
 
-			rd_hdr = image_get_ramdisk (cmdtp, flag, argc, argv,
-						rd_addr, arch, images->verify);
+			rd_hdr = image_get_ramdisk (rd_addr, arch,
+							images->verify);
 
 			if (rd_hdr == NULL)
 				return 1;
@@ -901,8 +894,7 @@ int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 			break;
 #endif
 		default:
-			printf ("Wrong Image Format for %s command\n",
-					cmdtp->name);
+			puts ("Wrong Ramdisk Image Format\n");
 			rd_data = rd_len = rd_load = 0;
 		}
 
diff --git a/include/image.h b/include/image.h
index 681c753..6fca6f4 100644
--- a/include/image.h
+++ b/include/image.h
@@ -250,9 +250,8 @@ int genimg_get_comp_id (const char *name);
 int genimg_get_format (void *img_addr);
 ulong genimg_get_image (ulong img_addr);
 
-int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
-		bootm_headers_t *images, uint8_t arch,
-		ulong *rd_start, ulong *rd_end);
+int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images,
+		uint8_t arch, ulong *rd_start, ulong *rd_end);
 
 #if defined(CONFIG_PPC) || defined(CONFIG_M68K)
 int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
diff --git a/lib_arm/bootm.c b/lib_arm/bootm.c
index 865e711..08eef0b 100644
--- a/lib_arm/bootm.c
+++ b/lib_arm/bootm.c
@@ -95,8 +95,10 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 		printf ("Using machid 0x%x from environment\n", machid);
 	}
 
-	boot_get_ramdisk (cmdtp, flag, argc, argv, images,
-			IH_ARCH_ARM, &initrd_start, &initrd_end);
+	ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_ARM,
+			&initrd_start, &initrd_end);
+	if (ret)
+		do_reset (cmdtp, flag, argc, argv);
 
 	show_boot_progress (15);
 
diff --git a/lib_avr32/bootm.c b/lib_avr32/bootm.c
index e8e537a..c9a0190 100644
--- a/lib_avr32/bootm.c
+++ b/lib_avr32/bootm.c
@@ -196,8 +196,10 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 	}
 	theKernel = (void *)ep;
 
-	boot_get_ramdisk (cmdtp, flag, argc, argv, images,
-			IH_ARCH_AVR32, &initrd_start, &initrd_end);
+	ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_AVR32,
+			&initrd_start, &initrd_end);
+	if (ret)
+		do_reset (cmdtp, flag, argc, argv);
 
 	show_boot_progress (15);
 
diff --git a/lib_i386/bootm.c b/lib_i386/bootm.c
index 76bcf6c..b4a52fa 100644
--- a/lib_i386/bootm.c
+++ b/lib_i386/bootm.c
@@ -39,9 +39,12 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 	ulong		initrd_start, initrd_end;
 	ulong		ep;
 	image_header_t	*hdr;
+	int		ret;
 
-	boot_get_ramdisk (cmdtp, flag, argc, argv, images,
-			IH_ARCH_I386, &initrd_start, &initrd_end);
+	ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_I386,
+			&initrd_start, &initrd_end);
+	if (ret)
+		do_reset (cmdtp, flag, argc, argv);
 
 	if (images->legacy_hdr_valid) {
 		hdr = images->legacy_hdr_os;
diff --git a/lib_m68k/bootm.c b/lib_m68k/bootm.c
index fba7499..f185bea 100644
--- a/lib_m68k/bootm.c
+++ b/lib_m68k/bootm.c
@@ -111,9 +111,8 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
 	kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep;
 
 	/* find ramdisk */
-	ret = boot_get_ramdisk (cmdtp, flag, argc, argv, images,
-			IH_ARCH_M68K, &rd_data_start, &rd_data_end);
-
+	ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_M68K,
+			&rd_data_start, &rd_data_end);
 	if (ret)
 		goto error;
 
diff --git a/lib_mips/bootm.c b/lib_mips/bootm.c
index b336a36..5e7a460 100644
--- a/lib_mips/bootm.c
+++ b/lib_mips/bootm.c
@@ -53,6 +53,7 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
 	void	(*theKernel) (int, char **, char **, int *);
 	char	*commandline = getenv ("bootargs");
 	char	env_buf[12];
+	int	ret;
 
 	/* find kernel entry point */
 	if (images->legacy_hdr_valid) {
@@ -68,8 +69,10 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
 	}
 	theKernel = (void (*)(int, char **, char **, int *))ep;
 
-	boot_get_ramdisk (cmdtp, flag, argc, argv, images,
-			IH_ARCH_MIPS, &initrd_start, &initrd_end);
+	ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_MIPS,
+			&initrd_start, &initrd_end);
+	if (ret)
+		do_reset (cmdtp, flag, argc, argv);
 
 	show_boot_progress (15);
 
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 7977157..ac06b26 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -160,9 +160,8 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 	kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep;
 
 	/* find ramdisk */
-	ret = boot_get_ramdisk (cmdtp, flag, argc, argv, images,
-			IH_ARCH_PPC, &rd_data_start, &rd_data_end);
-
+	ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_PPC,
+			&rd_data_start, &rd_data_end);
 	if (ret)
 		goto error;
 

  parent reply	other threads:[~2008-03-12 20:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 20:10 [U-Boot-Users] [PATCH 00/20] [new uImage] patchset 7 - core functionality Bartlomiej Sieka
2008-03-12 20:10 ` [U-Boot-Users] [PATCH 01/20] [new uImage] Make node unit names const in struct bootm_headers Bartlomiej Sieka
2008-03-12 20:10 ` [U-Boot-Users] [PATCH 02/20] [new uImage] Add support for new uImage format to mkimage tool Bartlomiej Sieka
2008-03-14 14:54   ` Luigi 'Comio' Mantellini
2008-03-14 16:19     ` Bartlomiej Sieka
2008-03-12 20:10 ` [U-Boot-Users] [PATCH 03/20] [new uImage] Add new uImage format support for imls and iminfo commands Bartlomiej Sieka
2008-03-12 20:10 ` [U-Boot-Users] [PATCH 04/20] [new uImage] Add new uImage format support for kernel booting Bartlomiej Sieka
2008-03-12 20:10 ` [U-Boot-Users] [PATCH 05/20] [new uImage] Add new uImage format support for ramdisk handling Bartlomiej Sieka
2008-03-12 20:11 ` Bartlomiej Sieka [this message]
2008-03-12 20:11 ` [U-Boot-Users] [PATCH 07/20] [new uImage] Re-enable interrupts for non automatic booting Bartlomiej Sieka
2008-03-12 20:11 ` [U-Boot-Users] [PATCH 08/20] [new uImage] ppc: Add new uImage format support to FDT handling routines Bartlomiej Sieka
2008-03-12 20:11 ` [U-Boot-Users] [PATCH 09/20] [new uImage] Add node offsets for FIT images listed in struct bootm_headers Bartlomiej Sieka
2008-03-12 20:11 ` [U-Boot-Users] [PATCH 10/20] [new uImage] Add new uImage format support to arch specific do_bootm_linux() routines Bartlomiej Sieka
2008-03-12 20:11 ` [U-Boot-Users] [PATCH 11/20] [new uImage] Add new uImage format support to autoscript routine Bartlomiej Sieka
2008-03-12 20:11 ` [U-Boot-Users] [PATCH 12/20] [new uImage] Add new uImage format support to imgextract command Bartlomiej Sieka
2008-03-12 20:11 ` [U-Boot-Users] [PATCH 13/20] [new uImage] Add new uImage format handling to other bootm related commands Bartlomiej Sieka
2008-03-12 20:11 ` [U-Boot-Users] [PATCH 14/20] [new uImage] Add new uImage fromat support to fpga command Bartlomiej Sieka
2008-03-12 20:12 ` [U-Boot-Users] [PATCH 15/20] [new uImage] Use show_boot_progress() for new uImage format Bartlomiej Sieka
2008-03-12 20:12 ` [U-Boot-Users] [PATCH 16/20] [new uImage] More verbose kernel image uncompress error message Bartlomiej Sieka
2008-03-12 20:12 ` [U-Boot-Users] [PATCH 17/20] [new uImage] Add proper ramdisk/FDT handling when FIT configuration is used Bartlomiej Sieka
2008-03-12 20:12 ` [U-Boot-Users] [PATCH 18/20] [new uImage] Fix build problems on trab board Bartlomiej Sieka
2008-03-12 20:55   ` Wolfgang Denk
2008-03-19  9:01     ` Bartlomiej Sieka
2008-03-12 20:12 ` [U-Boot-Users] [PATCH 19/20] [new uImage] Fix definition of common bootm_headers_t fields Bartlomiej Sieka
2008-03-12 20:12 ` [U-Boot-Users] [PATCH 20/20] [new uImage] Add new uImage format documentation and examples Bartlomiej Sieka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080312201102.6444.63560.stgit@pollux.denx.de \
    --to=tur@semihalf.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox