Skip to content

Commit

Permalink
efi_loader: move efi_save_gd() call to board_r.c
Browse files Browse the repository at this point in the history
The first functions of the UEFI sub-system are invoked before reaching the
U-Boot shell, e.g. efi_set_bootdev(), efi_dp_from_name(),
efi_dp_from_file(). We should be able to print out device paths for
debugging purposes here.

When printing device paths via printf("%pD\n", dp) this invokes functions
defined as EFIAPI. So efi_save_gd() must be called beforehand.

So let's move the efi_save_gd() call to function initr_reloc_global_data(()
in board_r.c.

Signed-off-by: Heinrich Schuchardt <[email protected]>
  • Loading branch information
xypron committed Apr 12, 2019
1 parent 2337741 commit e7ac009
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
7 changes: 7 additions & 0 deletions common/board_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ static int initr_reloc_global_data(void)
gd->fdt_blob += gd->reloc_off;
#endif
#ifdef CONFIG_EFI_LOADER
/*
* On the ARM architecture gd is mapped to a fixed register (r9 or x18).
* As this register may be overwritten by an EFI payload we save it here
* and restore it on every callback entered.
*/
efi_save_gd();

efi_runtime_relocate(gd->relocaddr, NULL);
#endif

Expand Down
3 changes: 0 additions & 3 deletions lib/efi_driver/efi_uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,6 @@ efi_status_t efi_driver_init(void)
struct driver *drv;
efi_status_t ret = EFI_SUCCESS;

/* Save 'gd' pointer */
efi_save_gd();

debug("EFI: Initializing EFI driver framework\n");
for (drv = ll_entry_start(struct driver, driver);
drv < ll_entry_end(struct driver, driver); ++drv) {
Expand Down
7 changes: 0 additions & 7 deletions lib/efi_loader/efi_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ efi_status_t efi_init_obj_list(void)
{
efi_status_t ret = EFI_SUCCESS;

/*
* On the ARM architecture gd is mapped to a fixed register (r9 or x18).
* As this register may be overwritten by an EFI payload we save it here
* and restore it on every callback entered.
*/
efi_save_gd();

/*
* Variable PlatformLang defines the language that the machine has been
* configured for.
Expand Down

0 comments on commit e7ac009

Please sign in to comment.