From: York Sun <york.sun@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v5 3/4] common: image-fit: Use a common function to get address
Date: Thu, 25 Feb 2016 14:36:18 -0800 [thread overview]
Message-ID: <1456439779-4792-4-git-send-email-york.sun@nxp.com> (raw)
In-Reply-To: <1456439779-4792-1-git-send-email-york.sun@nxp.com>
FIT image supports load address and entry address. Getting these
addresses can use a common function.
Signed-off-by: York Sun <york.sun@nxp.com>
---
Changes in v5:
New patch split from fixing load and entry address patch
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/image-fit.c | 42 +++++++++++++++++++-----------------------
1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/common/image-fit.c b/common/image-fit.c
index eec0ded..2d29e88 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -433,7 +433,7 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)
if ((type == IH_TYPE_KERNEL) || (type == IH_TYPE_STANDALONE) ||
(type == IH_TYPE_RAMDISK)) {
- fit_image_get_entry(fit, image_noffset, &entry);
+ ret = fit_image_get_entry(fit, image_noffset, &entry);
printf("%s Entry Point: ", p);
if (ret)
printf("unavailable\n");
@@ -675,6 +675,22 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp)
return 0;
}
+static int fit_image_get_address(const void *fit, int noffset, char *name,
+ phys_addr_t *load)
+{
+ int len;
+ const uint32_t *data;
+
+ data = fdt_getprop(fit, noffset, name, &len);
+ if (data == NULL) {
+ fit_get_debug(fit, noffset, name, len);
+ return -1;
+ }
+
+ *load = uimage_to_cpu(*data);
+
+ return 0;
+}
/**
* fit_image_get_load() - get load addr property for given component image node
* @fit: pointer to the FIT format image header
@@ -690,17 +706,7 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp)
*/
int fit_image_get_load(const void *fit, int noffset, phys_addr_t *load)
{
- int len;
- const uint32_t *data;
-
- data = fdt_getprop(fit, noffset, FIT_LOAD_PROP, &len);
- if (data == NULL) {
- fit_get_debug(fit, noffset, FIT_LOAD_PROP, len);
- return -1;
- }
-
- *load = uimage_to_cpu(*data);
- return 0;
+ return fit_image_get_address(fit, noffset, FIT_LOAD_PROP, load);
}
/**
@@ -722,17 +728,7 @@ int fit_image_get_load(const void *fit, int noffset, phys_addr_t *load)
*/
int fit_image_get_entry(const void *fit, int noffset, phys_addr_t *entry)
{
- int len;
- const uint32_t *data;
-
- data = fdt_getprop(fit, noffset, FIT_ENTRY_PROP, &len);
- if (data == NULL) {
- fit_get_debug(fit, noffset, FIT_ENTRY_PROP, len);
- return -1;
- }
-
- *entry = uimage_to_cpu(*data);
- return 0;
+ return fit_image_get_address(fit, noffset, FIT_ENTRY_PROP, entry);
}
/**
--
1.7.9.5
next prev parent reply other threads:[~2016-02-25 22:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 22:36 [U-Boot] [RFC PATCH v5 0/4] Enable FIT image to be loaded beyond 32-bit space York Sun
2016-02-25 22:36 ` [U-Boot] [RFC PATCH v5 1/4] common: Convert ulong to phys_addr_t for image addresses York Sun
2016-02-25 23:05 ` Wolfgang Denk
2016-02-26 17:22 ` york sun
2016-02-26 17:31 ` Simon Glass
2016-02-26 17:47 ` york sun
2016-02-26 18:05 ` Simon Glass
2016-02-26 18:09 ` york sun
2016-02-25 22:36 ` [U-Boot] [RFC PATCH v5 2/4] sandbox: Fix compiling warning York Sun
2016-02-25 22:36 ` York Sun [this message]
2016-02-25 22:36 ` [U-Boot] [RFC PATCH v5 4/4] common: image-fit: Fix load and entry addresses in FIT image York Sun
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=1456439779-4792-4-git-send-email-york.sun@nxp.com \
--to=york.sun@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox