From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine
Date: Wed, 20 Feb 2008 14:44:14 -0600 [thread overview]
Message-ID: <3D010FD2-EE46-44C3-9266-B4F0643CF099@kernel.crashing.org> (raw)
In-Reply-To: <47BC8FE3.6090500@semihalf.com>
On Feb 20, 2008, at 2:38 PM, Bartlomiej Sieka wrote:
> 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?
Just that it seems like the code should be something like:
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash(img_addr)) {
...
} else
#endif
return img_addr;
unless I'm missing something the code should return 'img_addr' if we
don't have to deal with dataflash (either by it not being config'd in
or 'img_addr' isn't in a dataflash.
- k
next prev parent reply other threads:[~2008-02-20 20:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-20 17:19 [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches Bartlomiej Sieka
2008-02-20 17:19 ` [U-Boot-Users] [PATCH 1/6] [new uImage] Pull in libfdt if CONFIG_FIT is enabled Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c Bartlomiej Sieka
2008-02-20 17:33 ` Jerry Van Baren
2008-02-20 19:10 ` Kumar Gala
2008-02-20 20:36 ` Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine Bartlomiej Sieka
2008-02-20 19:19 ` Kumar Gala
2008-02-20 20:38 ` Bartlomiej Sieka
2008-02-20 20:44 ` Kumar Gala [this message]
2008-02-21 15:57 ` Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 4/6] [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines Bartlomiej Sieka
2008-02-20 19:27 ` Kumar Gala
2008-02-20 20:39 ` Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 5/6] [new uImage] Rename and move print_image_hdr() routine Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 6/6] [new uImage] Fix erroneous use of image_get_magic() in fdc/usb cmds 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=3D010FD2-EE46-44C3-9266-B4F0643CF099@kernel.crashing.org \
--to=galak@kernel.crashing.org \
--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