From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bartlomiej Sieka Date: Wed, 20 Feb 2008 21:38:59 +0100 Subject: [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine In-Reply-To: <7814D974-88CD-4C3C-B716-7022658C810B@kernel.crashing.org> References: <20080220171950.25624.71201.stgit@pollux.denx.de> <20080220172009.25624.30095.stgit@pollux.denx.de> <7814D974-88CD-4C3C-B716-7022658C810B@kernel.crashing.org> Message-ID: <47BC8FE3.6090500@semihalf.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Kumar Gala wrote: >> +/** >> + * gen_get_image - get image from special storage (if necessary) >> + * @img_addr: image start address >> + * >> + * gen_get_image() checks if provided image start adddress is located >> + * in a dataflash storage. If so, image is moved to a system RAM memory. >> + * >> + * returns: >> + * image start address after possible relocation from special >> storage >> + */ >> +ulong gen_get_image (ulong img_addr) >> +{ >> + ulong ram_addr, h_size, d_size; >> + >> + h_size = image_get_header_size (); >> +#if defined(CONFIG_FIT) >> + if (sizeof(struct fdt_header) > h_size) >> + h_size = sizeof(struct fdt_header); >> +#endif >> + >> +#ifdef CONFIG_HAS_DATAFLASH >> + if (addr_dataflash (img_addr)){ >> + ram_addr = CFG_LOAD_ADDR; >> + debug (" Reading image header from dataflash address " >> + "%08lx to RAM address %08lx\n", img_addr, ram_addr); >> + read_dataflash (img_addr, h_size, (char *)ram_addr); >> + } else >> +#endif >> + ram_addr = img_addr; > > can we not early out at this point? I'm not sure what you mean here -- could you clarify? Thanks, Bartlomiej