Merge branch 'master' of git://git.denx.de/u-boot
[oweals/u-boot.git] / lib / efi_loader / efi_image_loader.c
index d558f5a8a9fd7c4394966f523d41e6de842ad599..3262d76bcac036b2a2f04fc93667c2e3f2e7bca5 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,
@@ -40,7 +37,7 @@ static void efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
                const uint16_t *relocs = (const uint16_t *)(rel + 1);
                i = (rel->SizeOfBlock - sizeof(*rel)) / sizeof(uint16_t);
                while (i--) {
-                       uint16_t offset = (*relocs & 0xfff) +
+                       uint32_t offset = (uint32_t)(*relocs & 0xfff) +
                                          rel->VirtualAddress;
                        int type = *relocs >> EFI_PAGE_SHIFT;
                        unsigned long delta = (unsigned long)efi_reloc;
@@ -177,7 +174,8 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info)
        efi_loader_relocate(rel, rel_size, efi_reloc);
 
        /* Flush cache */
-       flush_cache((ulong)efi_reloc, virt_size);
+       flush_cache((ulong)efi_reloc,
+                   ALIGN(virt_size, CONFIG_SYS_CACHELINE_SIZE));
        invalidate_icache_all();
 
        /* Populate the loaded image interface bits */