Re: [U-Boot] [PATCH 02/16] arch/arm/lib/bootm.c: Optionally use existing atags

2011-12-18 Thread Mike Frysinger
On Saturday 17 December 2011 12:03:04 Pali Rohár wrote:
 + s = getenv (atagaddr);

no space before the (

  #if defined (CONFIG_SETUP_MEMORY_TAGS) || \
  defined (CONFIG_CMDLINE_TAG) || \
  defined (CONFIG_INITRD_TAG) || \
  defined (CONFIG_SERIAL_TAG) || \
  defined (CONFIG_REVISION_TAG)
 ...
 +#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
 +defined (CONFIG_CMDLINE_TAG) || \
 +defined (CONFIG_INITRD_TAG) || \
 +defined (CONFIG_SERIAL_TAG) || \
 +defined (CONFIG_REVISION_TAG)

rather than duplicating the same list in multiple places, why not setup a 
local define in this file and then use that everywhere else.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/16] arch/arm/lib/bootm.c: Optionally use existing atags

2011-12-18 Thread Pali Rohár
On Sunday 18 December 2011 13:54:21 Mike Frysinger wrote:
 On Saturday 17 December 2011 12:03:04 Pali Rohár wrote:
  +   s = getenv (atagaddr);

 no space before the (

   #if defined (CONFIG_SETUP_MEMORY_TAGS) || \
 
   defined (CONFIG_CMDLINE_TAG) || \
   defined (CONFIG_INITRD_TAG) || \
   defined (CONFIG_SERIAL_TAG) || \
   defined (CONFIG_REVISION_TAG)
 
  ...
  +#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
  +defined (CONFIG_CMDLINE_TAG) || \
  +defined (CONFIG_INITRD_TAG) || \
  +defined (CONFIG_SERIAL_TAG) || \
  +defined (CONFIG_REVISION_TAG)

 rather than duplicating the same list in multiple places, why not setup a
 local define in this file and then use that everywhere else.
 -mike

I will add local define CONFIG_ANY_TAG to bootm.c

+#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
+defined (CONFIG_CMDLINE_TAG) || \
+defined (CONFIG_INITRD_TAG) || \
+defined (CONFIG_SERIAL_TAG) || \
+defined (CONFIG_REVISION_TAG)
+#define CONFIG_ANY_TAG
+#endif

--
Pali Rohár
pali.ro...@gmail.com

signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 02/16] arch/arm/lib/bootm.c: Optionally use existing atags

2011-12-17 Thread Pali Rohár
This patch adapts the bootm command so that it can use an existing atags command
set up by a previous bootloader. If the environment variable atagaddr is 
unset,
bootm behaves as normal. If atagaddr is set, bootm will use atags address from
environment variable and also append new boot args (if specified in u-boot). For
example, if a previous boot loader already set up the atags struct at 
0x8100:

setenv atagaddr 0x8100; bootm 0x80008000

Signed-off-by: Pali Rohár pali.ro...@gmail.com
---
 README   |2 ++
 arch/arm/lib/bootm.c |   27 +--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/README b/README
index ff72e47..3dd5a97 100644
--- a/README
+++ b/README
@@ -3564,6 +3564,8 @@ Some configuration options can be set using Environment 
Variables.
 
 List of environment variables (most likely not complete):
 
+  atagaddr - bootm will use ATAGs struct from specified address (arm only)
+
   baudrate - see CONFIG_BAUDRATE
 
   bootdelay- see CONFIG_BOOTDELAY
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 802e833..4a3c423 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -125,12 +125,24 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
debug (## Transferring control to Linux (at address %08lx) ...\n,
   (ulong) kernel_entry);
 
+   s = getenv (atagaddr);
+   if (s) {
+   bd-bi_boot_params = simple_strtoul(s, NULL, 16);
+   printf(Using existing atags at %#x\n, bd-bi_boot_params);
+
+   params = (struct tag *) bd-bi_boot_params;
+   while (params-hdr.size  0)
+   params = tag_next (params);
+   } else {
 #if defined (CONFIG_SETUP_MEMORY_TAGS) || \
 defined (CONFIG_CMDLINE_TAG) || \
 defined (CONFIG_INITRD_TAG) || \
 defined (CONFIG_SERIAL_TAG) || \
 defined (CONFIG_REVISION_TAG)
-   setup_start_tag (bd);
+   setup_start_tag (bd);
+   }
+#endif
+
 #ifdef CONFIG_SERIAL_TAG
setup_serial_tag (params);
 #endif
@@ -147,8 +159,19 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
if (images-rd_start  images-rd_end)
setup_initrd_tag (bd, images-rd_start, images-rd_end);
 #endif
-   setup_end_tag(bd);
+
+   if (s) {
+   if (params-hdr.size  0)
+   setup_end_tag(bd);
+   } else {
+#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
+defined (CONFIG_CMDLINE_TAG) || \
+defined (CONFIG_INITRD_TAG) || \
+defined (CONFIG_SERIAL_TAG) || \
+defined (CONFIG_REVISION_TAG)
+   setup_end_tag(bd);
 #endif
+   }
 
announce_and_cleanup();
 
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot