Message ID | 20190327044042.13707-8-takahiro.akashi@linaro.org |
---|---|
State | Changes Requested, archived |
Delegated to: | Heinrich Schuchardt |
Headers | show |
Series | efi_loader: rework bootefi/bootmgr | expand |
On 3/27/19 5:40 AM, AKASHI Takahiro wrote: > This is a preparatory patch for reworking do_bootefi() in later patch. I would suggest as commit message: Move do_bootefi_bootmgr_exec() up in code to avoid a forward declaration in a later patch. Otherwise Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> > --- > cmd/bootefi.c | 42 +++++++++++++++++++++--------------------- > 1 file changed, 21 insertions(+), 21 deletions(-) > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > index 1267d895472c..e9d4881997a1 100644 > --- a/cmd/bootefi.c > +++ b/cmd/bootefi.c > @@ -309,6 +309,27 @@ err_add_protocol: > return ret; > } > > +static int do_bootefi_bootmgr_exec(void) > +{ > + struct efi_device_path *device_path, *file_path; > + void *addr; > + efi_status_t r; > + > + addr = efi_bootmgr_load(&device_path, &file_path); > + if (!addr) > + return 1; > + > + printf("## Starting EFI application at %p ...\n", addr); > + r = do_bootefi_exec(addr, device_path, file_path); > + printf("## Application terminated, r = %lu\n", > + r & ~EFI_ERROR_MASK); > + > + if (r != EFI_SUCCESS) > + return 1; > + > + return 0; > +} > + > #ifdef CONFIG_CMD_BOOTEFI_SELFTEST > static efi_status_t bootefi_run_prepare(const char *load_options_path, > struct efi_device_path *device_path, > @@ -432,27 +453,6 @@ static int do_efi_selftest(const char *fdt_opt) > } > #endif /* CONFIG_CMD_BOOTEFI_SELFTEST */ > > -static int do_bootefi_bootmgr_exec(void) > -{ > - struct efi_device_path *device_path, *file_path; > - void *addr; > - efi_status_t r; > - > - addr = efi_bootmgr_load(&device_path, &file_path); > - if (!addr) > - return 1; > - > - printf("## Starting EFI application at %p ...\n", addr); > - r = do_bootefi_exec(addr, device_path, file_path); > - printf("## Application terminated, r = %lu\n", > - r & ~EFI_ERROR_MASK); > - > - if (r != EFI_SUCCESS) > - return 1; > - > - return 0; > -} > - > /* Interpreter command to boot an arbitrary EFI image from memory */ > static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > { >
On Wed, Mar 27, 2019 at 07:50:05AM +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. > > I would suggest as commit message: > > Move do_bootefi_bootmgr_exec() up in code to avoid a forward declaration > in a later patch. No. This "move" is just from a historical reason :) I just want the main code to be placed first, and exceptional code (i.e. efi_selftest) to follow it. -Takahiro Akashi > Otherwise > > Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > > > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> > > --- > > cmd/bootefi.c | 42 +++++++++++++++++++++--------------------- > > 1 file changed, 21 insertions(+), 21 deletions(-) > > > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > > index 1267d895472c..e9d4881997a1 100644 > > --- a/cmd/bootefi.c > > +++ b/cmd/bootefi.c > > @@ -309,6 +309,27 @@ err_add_protocol: > > return ret; > > } > > > > +static int do_bootefi_bootmgr_exec(void) > > +{ > > + struct efi_device_path *device_path, *file_path; > > + void *addr; > > + efi_status_t r; > > + > > + addr = efi_bootmgr_load(&device_path, &file_path); > > + if (!addr) > > + return 1; > > + > > + printf("## Starting EFI application at %p ...\n", addr); > > + r = do_bootefi_exec(addr, device_path, file_path); > > + printf("## Application terminated, r = %lu\n", > > + r & ~EFI_ERROR_MASK); > > + > > + if (r != EFI_SUCCESS) > > + return 1; > > + > > + return 0; > > +} > > + > > #ifdef CONFIG_CMD_BOOTEFI_SELFTEST > > static efi_status_t bootefi_run_prepare(const char *load_options_path, > > struct efi_device_path *device_path, > > @@ -432,27 +453,6 @@ static int do_efi_selftest(const char *fdt_opt) > > } > > #endif /* CONFIG_CMD_BOOTEFI_SELFTEST */ > > > > -static int do_bootefi_bootmgr_exec(void) > > -{ > > - struct efi_device_path *device_path, *file_path; > > - void *addr; > > - efi_status_t r; > > - > > - addr = efi_bootmgr_load(&device_path, &file_path); > > - if (!addr) > > - return 1; > > - > > - printf("## Starting EFI application at %p ...\n", addr); > > - r = do_bootefi_exec(addr, device_path, file_path); > > - printf("## Application terminated, r = %lu\n", > > - r & ~EFI_ERROR_MASK); > > - > > - if (r != EFI_SUCCESS) > > - return 1; > > - > > - return 0; > > -} > > - > > /* Interpreter command to boot an arbitrary EFI image from memory */ > > static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > > { > > >
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 1267d895472c..e9d4881997a1 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -309,6 +309,27 @@ err_add_protocol: return ret; } +static int do_bootefi_bootmgr_exec(void) +{ + struct efi_device_path *device_path, *file_path; + void *addr; + efi_status_t r; + + addr = efi_bootmgr_load(&device_path, &file_path); + if (!addr) + return 1; + + printf("## Starting EFI application at %p ...\n", addr); + r = do_bootefi_exec(addr, device_path, file_path); + printf("## Application terminated, r = %lu\n", + r & ~EFI_ERROR_MASK); + + if (r != EFI_SUCCESS) + return 1; + + return 0; +} + #ifdef CONFIG_CMD_BOOTEFI_SELFTEST static efi_status_t bootefi_run_prepare(const char *load_options_path, struct efi_device_path *device_path, @@ -432,27 +453,6 @@ static int do_efi_selftest(const char *fdt_opt) } #endif /* CONFIG_CMD_BOOTEFI_SELFTEST */ -static int do_bootefi_bootmgr_exec(void) -{ - struct efi_device_path *device_path, *file_path; - void *addr; - efi_status_t r; - - addr = efi_bootmgr_load(&device_path, &file_path); - if (!addr) - return 1; - - printf("## Starting EFI application at %p ...\n", addr); - r = do_bootefi_exec(addr, device_path, file_path); - printf("## Application terminated, r = %lu\n", - r & ~EFI_ERROR_MASK); - - if (r != EFI_SUCCESS) - return 1; - - return 0; -} - /* Interpreter command to boot an arbitrary EFI image from memory */ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
This is a preparatory patch for reworking do_bootefi() in later patch. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> --- cmd/bootefi.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)