From: Sascha Hauer <s.hauer@pengutronix.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v3 3/4] bootm: split split bootm_load_devicetree function
Date: Wed, 6 Jun 2018 09:12:47 +0200 [thread overview]
Message-ID: <20180606071247.7zkervnjgwv7gvhu@pengutronix.de> (raw)
In-Reply-To: <20180604100546.19140-4-o.rempel@pengutronix.de>
On Mon, Jun 04, 2018 at 12:05:45PM +0200, Oleksij Rempel wrote:
> In some cases we don't won't to load devicetree some where in free ram
> area, it is easier to keep it withing allocated area of barebox
> and then give the pointer to the kernel.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> common/bootm.c | 39 +++++++++++++++++++++++++++++++++------
> include/bootm.h | 1 +
> 2 files changed, 34 insertions(+), 6 deletions(-)
Unfortunately this split is not so easy because it opens some memory
leaks. Please drop this patch and rebaase on the series I just sent.
Sascha
>
> diff --git a/common/bootm.c b/common/bootm.c
> index 5ff6683fe..a9d18fb57 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -320,20 +320,17 @@ static int bootm_open_oftree_uimage(struct image_data *data, size_t *size,
> }
>
> /*
> - * bootm_load_devicetree() - load devicetree
> + * bootm_get_devicetree() - get devicetree
> *
> * @data: image data context
> - * @load_address: The address where the devicetree should be loaded to
> *
> - * This loads the devicetree to a RAM location. load_address must be a valid
> - * address. The resulting devicetree will be found at data->oftree.
> + * Prepare devicetree for later use by boot handler.
> *
> * Return: 0 on success, negative error code otherwise
> */
> -int bootm_load_devicetree(struct image_data *data, unsigned long load_address)
> +int bootm_get_devicetree(struct image_data *data)
> {
> enum filetype type;
> - int fdt_size;
> struct fdt_header *oftree;
> int ret;
>
> @@ -410,6 +407,36 @@ int bootm_load_devicetree(struct image_data *data, unsigned long load_address)
> if (!oftree)
> return -EINVAL;
>
> + data->oftree = oftree;
> +
> + return 0;
> +}
> +
> +/*
> + * bootm_load_devicetree() - load devicetree
> + *
> + * @data: image data context
> + * @load_address: The address where the devicetree should be loaded to
> + *
> + * This loads the devicetree to a RAM location. load_address must be a valid
> + * address. The resulting devicetree will be found at data->oftree.
> + *
> + * Return: 0 on success, negative error code otherwise
> + */
> +
> +int bootm_load_devicetree(struct image_data *data, unsigned long load_address)
> +{
> + struct fdt_header *oftree;
> + int fdt_size;
> + int ret;
> +
> + ret = bootm_get_devicetree(data);
> + if (ret)
> + return ret;
> +
> + oftree = data->oftree;
> +
> +
> fdt_size = be32_to_cpu(oftree->totalsize);
>
> data->oftree_res = request_sdram_region("oftree", load_address,
> diff --git a/include/bootm.h b/include/bootm.h
> index 62951d605..410b42cde 100644
> --- a/include/bootm.h
> +++ b/include/bootm.h
> @@ -126,6 +126,7 @@ int bootm_load_os(struct image_data *data, unsigned long load_address);
> bool bootm_has_initrd(struct image_data *data);
> int bootm_load_initrd(struct image_data *data, unsigned long load_address);
>
> +int bootm_get_devicetree(struct image_data *data);
> int bootm_load_devicetree(struct image_data *data, unsigned long load_address);
> int bootm_get_os_size(struct image_data *data);
>
> --
> 2.17.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-06-06 7:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 10:05 [PATCH v3 0/4] MIPS: provide basic ELF support Oleksij Rempel
2018-06-04 10:05 ` [PATCH v3 1/4] filetype: add ELF type Oleksij Rempel
2018-06-04 10:05 ` [PATCH v3 2/4] add basic ELF parser Oleksij Rempel
2018-06-04 10:05 ` [PATCH v3 3/4] bootm: split split bootm_load_devicetree function Oleksij Rempel
2018-06-06 7:12 ` Sascha Hauer [this message]
2018-06-04 10:05 ` [PATCH v3 4/4] MIPS: bootm: add ELF handler Oleksij Rempel
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=20180606071247.7zkervnjgwv7gvhu@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=o.rempel@pengutronix.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