]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: Fix some entry/exit points
authorAlexander Graf <agraf@suse.de>
Thu, 24 Mar 2016 00:37:37 +0000 (01:37 +0100)
committerTom Rini <trini@konsulko.com>
Sun, 27 Mar 2016 13:13:02 +0000 (09:13 -0400)
When switching between EFI context and U-Boot context we need to swap
the register that "gd" resides in.

Some functions slipped through here, with efi_allocate_pool / efi_free_pool
not doing the switch correctly and efi_return_handle switching too often.

Fix them all up to make sure we always have consistent register state.

Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_boottime.c
lib/efi_loader/efi_image_loader.c

index 87400dee1ad2a36b3957289142bbe2f42fed8a4b..9daca50a72fc1b7c92212c30bcbb7aed5d34e6b0 100644 (file)
@@ -137,12 +137,20 @@ efi_status_t EFIAPI efi_get_memory_map_ext(unsigned long *memory_map_size,
 static efi_status_t EFIAPI efi_allocate_pool(int pool_type, unsigned long size,
                                             void **buffer)
 {
-       return efi_allocate_pages(0, pool_type, (size + 0xfff) >> 12, (void*)buffer);
+       efi_status_t r;
+
+       EFI_ENTRY("%d, %ld, %p", pool_type, size, buffer);
+       r = efi_allocate_pages(0, pool_type, (size + 0xfff) >> 12, (void*)buffer);
+       return EFI_EXIT(r);
 }
 
 static efi_status_t EFIAPI efi_free_pool(void *buffer)
 {
-       return efi_free_pages((ulong)buffer, 0);
+       efi_status_t r;
+
+       EFI_ENTRY("%p", buffer);
+       r = efi_free_pages((ulong)buffer, 0);
+       return EFI_EXIT(r);
 }
 
 /*
@@ -706,7 +714,6 @@ static efi_status_t EFIAPI efi_handle_protocol(void *handle,
                                               efi_guid_t *protocol,
                                               void **protocol_interface)
 {
-       EFI_ENTRY("%p, %p, %p", handle, protocol, protocol_interface);
        return efi_open_protocol(handle, protocol, protocol_interface,
                                 NULL, NULL, 0);
 }
index d558f5a8a9fd7c4394966f523d41e6de842ad599..574b204f23d40dd332e242907010131dff40aebb 100644 (file)
@@ -22,11 +22,8 @@ efi_status_t EFIAPI efi_return_handle(void *handle, efi_guid_t *protocol,
                        void **protocol_interface, void *agent_handle,
                        void *controller_handle, uint32_t attributes)
 {
-       EFI_ENTRY("%p, %p, %p, %p, %p, 0x%x", handle, protocol,
-                 protocol_interface, agent_handle, controller_handle,
-                 attributes);
        *protocol_interface = handle;
-       return EFI_EXIT(EFI_SUCCESS);
+       return EFI_SUCCESS;
 }
 
 static void efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,