aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-08-18 18:24:58 -0400
committerTom Rini <trini@konsulko.com>2017-08-18 18:24:58 -0400
commit5619295995e3262bb5770e8b5e945ffdc5442145 (patch)
tree6ba37499aeb10145237379ac9c54dd01ea5aaf3b
parent1fdafb2e3dfecdc4129a8062ad25b1adb32b0efb (diff)
parentc81883dfce7360148c72922b93bfa16b399ee3ee (diff)
downloadu-boot-5619295995e3262bb5770e8b5e945ffdc5442145.zip
u-boot-5619295995e3262bb5770e8b5e945ffdc5442145.tar.gz
u-boot-5619295995e3262bb5770e8b5e945ffdc5442145.tar.bz2
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
EFI Fixes for 2017.09: - Fix GOP w/o display - Fix LocateHandle - Fix exit return value truncation - Fix missing EFIAPI in efi_locate_handle (for x86)
-rw-r--r--cmd/bootefi.c4
-rw-r--r--include/efi_loader.h4
-rw-r--r--lib/efi_loader/efi_boottime.c7
-rw-r--r--lib/efi_loader/efi_gop.c2
-rw-r--r--lib/efi_loader/efi_runtime.c2
5 files changed, 11 insertions, 8 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index d20775e..3196d86 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -158,7 +158,7 @@ static void *copy_fdt(void *fdt)
}
/* Give us at least 4kb breathing room */
- fdt_size = ALIGN(fdt_size + 4096, 4096);
+ fdt_size = ALIGN(fdt_size + 4096, EFI_PAGE_SIZE);
fdt_pages = fdt_size >> EFI_PAGE_SHIFT;
/* Safe fdt location is at 128MB */
@@ -166,7 +166,7 @@ static void *copy_fdt(void *fdt)
if (efi_allocate_pages(1, EFI_BOOT_SERVICES_DATA, fdt_pages,
&new_fdt_addr) != EFI_SUCCESS) {
/* If we can't put it there, put it somewhere */
- new_fdt_addr = (ulong)memalign(4096, fdt_size);
+ new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size);
if (efi_allocate_pages(1, EFI_BOOT_SERVICES_DATA, fdt_pages,
&new_fdt_addr) != EFI_SUCCESS) {
printf("ERROR: Failed to reserve space for FDT\n");
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 037cc7c..1179234 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -33,9 +33,9 @@ const char *__efi_nesting_dec(void);
* Exit the u-boot world back to UEFI:
*/
#define EFI_EXIT(ret) ({ \
- efi_status_t _r = ret; \
+ typeof(ret) _r = ret; \
debug("%sEFI: Exit: %s: %u\n", __efi_nesting_dec(), \
- __func__, (u32)(_r & ~EFI_ERROR_MASK)); \
+ __func__, (u32)((uintptr_t) _r & ~EFI_ERROR_MASK)); \
assert(__efi_exit_check()); \
_r; \
})
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 59479ed..43f3238 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -611,7 +611,7 @@ static int efi_search(enum efi_locate_search_type search_type,
return -1;
}
-static efi_status_t EFIAPI efi_locate_handle(
+static efi_status_t efi_locate_handle(
enum efi_locate_search_type search_type,
efi_guid_t *protocol, void *search_key,
unsigned long *buffer_size, efi_handle_t *buffer)
@@ -633,6 +633,10 @@ static efi_status_t EFIAPI efi_locate_handle(
return EFI_BUFFER_TOO_SMALL;
}
+ *buffer_size = size;
+ if (size == 0)
+ return EFI_NOT_FOUND;
+
/* Then fill the array */
list_for_each(lhandle, &efi_obj_list) {
struct efi_object *efiobj;
@@ -642,7 +646,6 @@ static efi_status_t EFIAPI efi_locate_handle(
}
}
- *buffer_size = size;
return EFI_SUCCESS;
}
diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index e063e0c..411a8c9 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -137,7 +137,7 @@ int efi_gop_register(void)
struct udevice *vdev;
/* We only support a single video output device for now */
- if (uclass_first_device(UCLASS_VIDEO, &vdev))
+ if (uclass_first_device(UCLASS_VIDEO, &vdev) || !vdev)
return -1;
struct video_priv *priv = dev_get_uclass_priv(vdev);
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index dd52755..ad7f375 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -325,7 +325,7 @@ void efi_add_runtime_mmio(void *mmio_ptr, u64 len)
{
struct efi_runtime_mmio_list *newmmio;
- u64 pages = (len + EFI_PAGE_SIZE - 1) >> EFI_PAGE_SHIFT;
+ u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
efi_add_memory_map(*(uintptr_t *)mmio_ptr, pages, EFI_MMAP_IO, false);
newmmio = calloc(1, sizeof(*newmmio));