From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/9] cmd: bootefi: merge efi_install_fdt() and efi_process_fdt()
Date: Fri, 19 Apr 2019 13:42:51 +0900 [thread overview]
Message-ID: <20190419044250.GX7158@linaro.org> (raw)
In-Reply-To: <cc6b3233-5172-4565-9adb-acf6604b85ec@gmx.de>
On Fri, Apr 19, 2019 at 06:06:08AM +0200, Heinrich Schuchardt wrote:
> On 4/19/19 5:22 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 fb6703ce84f3..c6d6eb7312e8 100644
> >--- a/cmd/bootefi.c
> >+++ b/cmd/bootefi.c
> >@@ -185,62 +185,51 @@ 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: status code
> > *
> > * 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;
>
> Why do you want to change the return value here? If there is not enough
> space efi_install_configuration_table() will return EFI_OUT_OF_RESOURCES
> by itself. Other possible error codes are:
The original code returns EFI_LOAD_ERROR, so I changed it.
> * EFI_INVALID_PARAMETER if you do not provide a GUID. This cannot occur.
> * EFI_NOT_FOUND if fdt is NULL.
>
> I you are ok with it I would apply the patch with the original line
> return ret;
Go ahead.
# You don't need additional patch, Just leave a note in commit message.
Thanks,
-Takahiro Akashi
> Otherwise
>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>
> > }
> > } else {
> > /* Remove device tree. EFI_NOT_FOUND can be ignored here */
> >@@ -456,7 +445,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> > if (argc < 2)
> > return CMD_RET_USAGE;
> >
> >- r = efi_process_fdt(argc > 2 ? argv[2] : NULL);
> >+ r = efi_install_fdt(argc > 2 ? argv[2] : NULL);
> > if (r == EFI_INVALID_PARAMETER)
> > return CMD_RET_USAGE;
> > else if (r != EFI_SUCCESS)
> >
>
next prev parent reply other threads:[~2019-04-19 4:42 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-19 3:22 [U-Boot] [PATCH 0/9] efi_loader: rework bootefi/bootmgr AKASHI Takahiro
2019-04-19 3:22 ` [U-Boot] [PATCH 1/9] cmd: bootefi: rework set_load_options() AKASHI Takahiro
2019-04-19 3:37 ` Heinrich Schuchardt
2019-04-19 3:22 ` [U-Boot] [PATCH 2/9] cmd: bootefi: carve out fdt handling from do_bootefi() AKASHI Takahiro
2019-04-19 3:43 ` Heinrich Schuchardt
2019-04-19 3:22 ` [U-Boot] [PATCH 3/9] cmd: bootefi: merge efi_install_fdt() and efi_process_fdt() AKASHI Takahiro
2019-04-19 4:06 ` Heinrich Schuchardt
2019-04-19 4:42 ` AKASHI Takahiro [this message]
2019-04-19 3:22 ` [U-Boot] [PATCH 4/9] cmd: bootefi: carve out efi_selftest code from do_bootefi() AKASHI Takahiro
2019-04-20 6:57 ` Heinrich Schuchardt
2019-04-19 3:22 ` [U-Boot] [PATCH 5/9] cmd: bootefi: move do_bootefi_bootmgr_exec() forward AKASHI Takahiro
2019-04-19 3:22 ` [U-Boot] [PATCH 6/9] cmd: bootefi: carve out bootmgr code from do_bootefi() AKASHI Takahiro
2019-04-20 7:47 ` Heinrich Schuchardt
2019-04-19 3:22 ` [U-Boot] [PATCH 7/9] cmd: bootefi: carve out do_bootefi_image() " AKASHI Takahiro
2019-04-19 3:22 ` [U-Boot] [PATCH 8/9] efi_loader: rework bootmgr/bootefi using load_image API AKASHI Takahiro
2019-04-20 8:07 ` Heinrich Schuchardt
2019-04-22 0:44 ` AKASHI Takahiro
2019-04-20 8:37 ` Heinrich Schuchardt
2019-04-20 17:37 ` Heinrich Schuchardt
2019-04-22 0:36 ` AKASHI Takahiro
2019-04-20 18:24 ` Heinrich Schuchardt
2019-04-22 1:05 ` AKASHI Takahiro
2019-04-21 7:02 ` Heinrich Schuchardt
2019-04-19 3:22 ` [U-Boot] [PATCH 9/9] cmd: add efibootmgr command AKASHI Takahiro
2019-04-20 8:49 ` Heinrich Schuchardt
2019-04-22 18:16 ` [U-Boot] [PATCH 0/9] efi_loader: rework bootefi/bootmgr Heinrich Schuchardt
2019-04-23 0:24 ` AKASHI, Takahiro
2019-04-23 4:57 ` Heinrich Schuchardt
2019-04-23 5:08 ` AKASHI, Takahiro
2020-01-03 0:17 ` Heinrich Schuchardt
2020-01-06 1:42 ` 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=20190419044250.GX7158@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