From: Joakim Tjernlund Date: Sat, 30 Dec 2006 14:10:18 +0100 Subject: [U-Boot-Users] builtin OF tree dtb gone In-Reply-To: <1166452757.30422.105.camel@gentoo-jocke.transmode.se> Message-ID: <013101c72c13$da606660$1e67a8c0@Jocke> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Ping. Didn't you like this either or no time to look at it? Jocke > -----Original Message----- > From: u-boot-users-bounces at lists.sourceforge.net > [mailto:u-boot-users-bounces at lists.sourceforge.net] On Behalf > Of Joakim Tjernlund > Sent: den 18 december 2006 15:39 > To: Wolfgang Denk > Cc: 'Grant Likely'; u-boot-users at lists.sourceforge.net > Subject: Re: [U-Boot-Users] builtin OF tree dtb gone > > On Mon, 2006-12-18 at 00:56 +0100, Wolfgang Denk wrote: > > Dear Joakim, > > > > in message > <1166378632.30422.98.camel@gentoo-jocke.transmode.se> you wrote: > > > > > > how about this patch: > > > > Sorry, but there are two things I don't like: > > > > > Make it possible to use a OF tree embedded in u-boot. > > > Also make sure OF tree is below 8MB. > > > > > > Signed-off-by: Joakim Tjernlund > > > > > > diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c > > > index 7aae8a6..78f8d15 100644 > > > --- a/common/cmd_bootm.c > > > +++ b/common/cmd_bootm.c > > > @@ -531,8 +531,12 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl > > > image_header_t *hdr = &header; > > > #ifdef CONFIG_OF_FLAT_TREE > > > char *of_flat_tree = NULL; > > > +#ifdef CFG_EMBEDDED_FLAT_TREE > > > > I don't want to have another #ifdef here. It should be > possible to do > > this (for example in the linker script) without this. > > Can't figure out how some linker magic would solve this. Somehow > this function needs a handle to where a default tree is stored. > Moved around the code a bit, hope you like this better. > > > > > > -#ifndef CFG_NO_FLASH > > > - if (addr2info((ulong)of_flat_tree) != NULL) > > > + if (of_flat_tree >= (char *) (8*1024*1024)) > > > > And I definitely reject such hard-wired and > uncommented magic > > constants which are wrong on most of the systems. > > Right, redid this part. If you don't like this either, we can skip > this part for now. > > Regards > Jocke > > diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c > index 7aae8a6..b3654ee 100644 > --- a/common/cmd_bootm.c > +++ b/common/cmd_bootm.c > @@ -510,6 +510,23 @@ fixup_silent_linux () > #endif /* CONFIG_SILENT_CONSOLE */ > > #ifdef CONFIG_PPC > + > +/* Define oftree_dtb to point to you own built in > + * OF tree if you need one. > + */ > +#ifndef oftree_dtb > + #define oftree_dtb 0 > +#endif > +/* Early in the linux boot process most ppc systems > + * can only access the first few MB of RAM. If the > + * OF tree is located higher up in memory than > + * LINUX_INITIAL_MEMORY, it will be copied to a > + * lower address where the kernel can access it. > + */ > +#ifndef LINUX_INITIAL_MEMORY > + #define LINUX_INITIAL_MEMORY (8*1024*1024) /* 8MB */ > +#endif > + > static void __attribute__((noinline)) > do_bootm_linux (cmd_tbl_t *cmdtp, int flag, > int argc, char *argv[], > @@ -531,7 +548,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl > image_header_t *hdr = &header; > #ifdef CONFIG_OF_FLAT_TREE > char *of_flat_tree = NULL; > - ulong of_data = 0; > + ulong of_data = (ulong)oftree_dtb; > #endif > > if ((s = getenv ("initrd_high")) != NULL) { > @@ -745,10 +762,8 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl > hdr = (image_header_t *)of_flat_tree; > > if (*(ulong *)of_flat_tree == OF_DT_HEADER) { > -#ifndef CFG_NO_FLASH > - if (addr2info((ulong)of_flat_tree) != NULL) > + if (of_flat_tree >= (char *) > LINUX_INITIAL_MEMORY) > of_data = (ulong)of_flat_tree; > -#endif > } else if (ntohl(hdr->ih_magic) == IH_MAGIC) { > printf("## Flat Device Tree Image at > %08lX\n", hdr); > print_image_hdr(hdr);