From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC v2 05/11] cmd: bootefi: merge efi_install_fdt() and efi_process_fdt()
Date: Thu, 28 Mar 2019 10:31:26 +0900 [thread overview]
Message-ID: <20190328013125.GX9937@linaro.org> (raw)
In-Reply-To: <16a33139-9651-1333-3f2a-daca9a00d023@gmx.de>
On Wed, Mar 27, 2019 at 07:33:49AM +0100, Heinrich Schuchardt wrote:
> On 3/27/19 5:40 AM, AKASHI Takahiro wrote:
> > This is a preparatory patch for reworking do_bootefi() in later patch.
> > For simplicity, merge two functions.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> > cmd/bootefi.c | 67 +++++++++++++++++++++------------------------------
> > 1 file changed, 28 insertions(+), 39 deletions(-)
> >
> > diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> > index aba8b203d419..ce0db07f8633 100644
> > --- a/cmd/bootefi.c
> > +++ b/cmd/bootefi.c
> > @@ -165,41 +165,8 @@ static void efi_carve_out_dt_rsv(void *fdt)
> > }
> > }
> >
> > -static efi_status_t efi_install_fdt(ulong fdt_addr)
> > -{
> > - bootm_headers_t img = { 0 };
> > - efi_status_t ret;
> > - void *fdt;
> > -
> > - fdt = map_sysmem(fdt_addr, 0);
> > - if (fdt_check_header(fdt)) {
> > - printf("ERROR: invalid device tree\n");
> > - return EFI_INVALID_PARAMETER;
> > - }
> > -
> > - /* Create memory reservation as indicated by the device tree */
> > - efi_carve_out_dt_rsv(fdt);
> > -
> > - /* Prepare fdt for payload */
> > - ret = copy_fdt(&fdt);
> > - if (ret)
> > - return ret;
> > -
> > - if (image_setup_libfdt(&img, fdt, 0, NULL)) {
> > - printf("ERROR: failed to process device tree\n");
> > - return EFI_LOAD_ERROR;
> > - }
> > -
> > - /* Link to it in the efi tables */
> > - ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
> > - if (ret != EFI_SUCCESS)
> > - return EFI_OUT_OF_RESOURCES;
> > -
> > - return ret;
> > -}
> > -
> > /**
> > - * efi_process_fdt() - process fdt passed by a command argument
> > + * efi_install_fdt() - install fdt passed by a command argument
> > * @fdt_opt: pointer to argument
> > * Return: CMD_RET_SUCCESS on success,
> > CMD_RET_USAGE or CMD_RET_FAILURE otherwise
> > @@ -207,21 +174,43 @@ static efi_status_t efi_install_fdt(ulong fdt_addr)
> > * If specified, fdt will be installed as configuration table,
> > * otherwise no fdt will be passed.
> > */
> > -static efi_status_t efi_process_fdt(const char *fdt_opt)
> > +static efi_status_t efi_install_fdt(const char *fdt_opt)
> > {
> > unsigned long fdt_addr;
> > + void *fdt;
> > + bootm_headers_t img = { 0 };
> > efi_status_t ret;
> >
> > if (fdt_opt) {
> > + /* Install device tree */
> > fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
> > if (!fdt_addr && *fdt_opt != '0')
> > return EFI_INVALID_PARAMETER;
> >
> > - /* Install device tree */
> > - ret = efi_install_fdt(fdt_addr);
> > + fdt = map_sysmem(fdt_addr, 0);
> > + if (fdt_check_header(fdt)) {
> > + printf("ERROR: invalid device tree\n");
> > + return EFI_INVALID_PARAMETER;
> > + }
> > +
> > + /* Create memory reservation as indicated by the device tree */
> > + efi_carve_out_dt_rsv(fdt);
> > +
> > + /* Prepare fdt for payload */
> > + ret = copy_fdt(&fdt);
> > + if (ret)
> > + return ret;
> > +
> > + if (image_setup_libfdt(&img, fdt, 0, NULL)) {
> > + printf("ERROR: failed to process device tree\n");
> > + return EFI_LOAD_ERROR;
> > + }
> > +
> > + /* Link to it in the efi tables */
> > + ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
> > if (ret != EFI_SUCCESS) {
> > printf("ERROR: failed to install device tree\n");
> > - return ret;
> > + return EFI_OUT_OF_RESOURCES;
> > }
> > } else {
> > /* Remove device tree. EFI_NOT_FOUND can be ignored here */
> > @@ -441,7 +430,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> > if (argc < 2)
> > return CMD_RET_USAGE;
> >
> > - r = fdt_process_fdt(argc > 2 ? argv[2] : NULL);
> > + r = fdt_install_fdt(argc > 2 ? argv[2] : NULL);
> > if (r != EFI_SUCCESS)
> > return r;
>
> We want to return CMD_RET_* from do_bootefi() and not EFI_*.
Right, will fix.
-Takahiro Akashi
> Best regards
>
> Heinrich
>
> >
> >
>
next prev parent reply other threads:[~2019-03-28 1:31 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-27 4:40 [U-Boot] [RFC v2 00/11] efi_loader: rework bootefi/bootmgr AKASHI Takahiro
2019-03-27 4:40 ` [U-Boot] [RFC v2 01/11] efi_loader: boottime: add loaded image device path protocol to image handle AKASHI Takahiro
2019-03-27 5:58 ` Heinrich Schuchardt
2019-03-27 21:25 ` Heinrich Schuchardt
2019-03-28 1:13 ` AKASHI Takahiro
2019-03-27 4:40 ` [U-Boot] [RFC v2 02/11] efi_loader: boottime: export efi_[un]load_image() AKASHI Takahiro
2019-03-27 21:26 ` Heinrich Schuchardt
2019-03-27 4:40 ` [U-Boot] [RFC v2 03/11] efi_loader: device_path: handle special case of loading AKASHI Takahiro
2019-03-27 6:17 ` Heinrich Schuchardt
2019-03-28 1:17 ` AKASHI Takahiro
2019-03-27 4:40 ` [U-Boot] [RFC v2 04/11] cmd: bootefi: carve out fdt handling from do_bootefi() AKASHI Takahiro
2019-03-27 6:29 ` Heinrich Schuchardt
2019-03-28 1:26 ` AKASHI Takahiro
2019-03-27 4:40 ` [U-Boot] [RFC v2 05/11] cmd: bootefi: merge efi_install_fdt() and efi_process_fdt() AKASHI Takahiro
2019-03-27 6:33 ` Heinrich Schuchardt
2019-03-28 1:31 ` AKASHI Takahiro [this message]
2019-03-27 4:40 ` [U-Boot] [RFC v2 06/11] cmd: bootefi: carve out efi_selftest code from do_bootefi() AKASHI Takahiro
2019-03-27 6:45 ` Heinrich Schuchardt
2019-03-28 2:00 ` AKASHI Takahiro
2019-03-27 4:40 ` [U-Boot] [RFC v2 07/11] cmd: bootefi: move do_bootefi_bootmgr_exec() forward AKASHI Takahiro
2019-03-27 6:50 ` Heinrich Schuchardt
2019-03-28 2:13 ` AKASHI Takahiro
2019-03-27 4:40 ` [U-Boot] [RFC v2 08/11] cmd: bootefi: carve out bootmgr code from do_bootefi() AKASHI Takahiro
2019-04-12 5:55 ` Heinrich Schuchardt
2019-04-12 7:06 ` AKASHI Takahiro
2019-04-12 8:58 ` Heinrich Schuchardt
2019-04-12 14:19 ` AKASHI Takahiro
2019-04-12 20:28 ` Heinrich Schuchardt
2019-04-16 4:20 ` AKASHI Takahiro
2019-03-27 4:40 ` [U-Boot] [RFC v2 09/11] cmd: bootefi: carve out do_boot_efi() " AKASHI Takahiro
2019-04-12 5:59 ` Heinrich Schuchardt
2019-04-12 7:22 ` AKASHI Takahiro
2019-04-12 9:01 ` Heinrich Schuchardt
2019-03-27 4:40 ` [U-Boot] [RFC v2 10/11] efi_loader: rework bootmgr/bootefi using load_image API AKASHI Takahiro
2019-04-12 5:53 ` Heinrich Schuchardt
2019-04-12 8:38 ` AKASHI Takahiro
2019-04-12 8:55 ` Heinrich Schuchardt
2019-03-27 4:40 ` [U-Boot] [RFC v2 11/11] cmd: add efibootmgr command AKASHI Takahiro
2019-03-27 7:10 ` Heinrich Schuchardt
2019-03-31 18:27 ` Alexander Graf
2019-04-12 1:18 ` [U-Boot] [RFC v2 00/11] efi_loader: rework bootefi/bootmgr AKASHI Takahiro
2019-04-12 6:11 ` Heinrich Schuchardt
2019-04-12 6:25 ` AKASHI Takahiro
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=20190328013125.GX9937@linaro.org \
--to=takahiro.akashi@linaro.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