From: Peng Fan <b51431@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] common: image-fdt: correct fdt_blob for IMAGE_FORMAT_LEGACY
Date: Wed, 25 Nov 2015 09:12:28 +0800 [thread overview]
Message-ID: <20151125011225.GA28129@shlinux2> (raw)
In-Reply-To: <CAPnjgZ25rzewBSe-wNRBgYa_N3UtwHxZQLG=mXzKiwg=uZvj-w@mail.gmail.com>
Hi Simon,
On Tue, Nov 24, 2015 at 12:04:56PM -0700, Simon Glass wrote:
>Hi Peng,
>
>On 24 November 2015 at 01:54, Peng Fan <Peng.Fan@freescale.com> wrote:
>> If condition of "(load == image_start || load == image_data)" is true,
>> should use "fdt_addr = load;", but not "fdt_blob = (char *)image_data;",
>> or fdt_blob will be overridden by "fdt_blob = map_sysmem(fdt_addr, 0);"
>> at the end of the switch case.
>>
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> Cc: Joe Hershberger <joe.hershberger@ni.com>
>> Cc: Max Krummenacher <max.krummenacher@toradex.com>
>> Cc: Marek Vasut <marex@denx.de>
>> Cc: Suriyan Ramasami <suriyan.r@gmail.com>
>> Cc: Paul Kocialkowski <contact@paulk.fr>
>> Cc: Tom Rini <trini@konsulko.com>
>> ---
>> common/image-fdt.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/common/image-fdt.c b/common/image-fdt.c
>> index 5180a03..5e4e5bd 100644
>> --- a/common/image-fdt.c
>> +++ b/common/image-fdt.c
>> @@ -326,7 +326,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
>>
>> if (load == image_start ||
>> load == image_data) {
>> - fdt_blob = (char *)image_data;
>> + fdt_addr = load;
>> break;
>> }
>
>Are you sure that should not be:
>
>fdt_addr = image_data
>
>?
Just code inspection.
See the following code piece:
319 image_start = (ulong)fdt_hdr;
320 image_data = (ulong)image_get_data(fdt_hdr);
321 image_end = image_get_image_end(fdt_hdr);
322
323 load = image_get_load(fdt_hdr);
324 load_end = load + image_get_data_size(fdt_hdr);
325
326 if (load == image_start ||
327 load == image_data) {
328 fdt_blob = (char *)image_data;
329 break;
330 }
331
332 if ((load < image_end) && (load_end > image_start)) {
333 fdt_error("fdt overwritten");
334 goto error;
335 }
336
337 debug(" Loading FDT from 0x%08lx to 0x%08lx\n",
338 image_data, load);
339
340 memmove((void *)load,
341 (void *)image_data,
342 image_get_data_size(fdt_hdr));
343
344 fdt_addr = load;
345 break;
.........[snip code].........
386 printf(" Booting using the fdt blob at %#08lx\n", fdt_addr);
387 fdt_blob = map_sysmem(fdt_addr, 0);
Line 387 will override the settings of line 328.
To line 328, means we do not need to relocate image_data to load, since they
are same. So according to line 344, I use same way "fdt_addr = load".
>
>The idea is to pick up the FDT from inside the image, since the load
>address indicates that it should not be relocated.
>
>BTW one more thing I noticed:
>
>image_data = (ulong)image_get_data(fdt_hdr);
>
>The cast is confusing, and can be removed.
Yeah. But this patch is to avoid override settings of fdt_blob, line 328
and line 387. This cast can be discarded using another patch.
Thanks,
Peng.
>
>Regards,
>Simon
--
next prev parent reply other threads:[~2015-11-25 1:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 8:54 [U-Boot] [PATCH] common: bootm: check return value of strict_strtoul Peng Fan
2015-11-24 8:54 ` [U-Boot] [RFC] common: cli_hush: avoid dead code Peng Fan
2015-11-24 19:04 ` Simon Glass
2015-12-06 22:06 ` [U-Boot] [U-Boot,RFC] " Tom Rini
2015-11-24 8:54 ` [U-Boot] [PATCH] common: image-fdt: correct fdt_blob for IMAGE_FORMAT_LEGACY Peng Fan
2015-11-24 19:04 ` Simon Glass
2015-11-25 1:12 ` Peng Fan [this message]
2015-12-01 20:01 ` Simon Glass
2015-12-06 22:06 ` [U-Boot] " Tom Rini
2015-11-24 8:54 ` [U-Boot] [PATCH] video: ipu: simplify if else code Peng Fan
2015-11-24 9:55 ` Stefano Babic
2015-11-24 19:04 ` [U-Boot] [PATCH] common: bootm: check return value of strict_strtoul Simon Glass
2015-12-06 22:05 ` [U-Boot] " Tom Rini
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=20151125011225.GA28129@shlinux2 \
--to=b51431@freescale.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.