summaryrefslogtreecommitdiff
path: root/lib
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 /lib
parent1fdafb2e3dfecdc4129a8062ad25b1adb32b0efb (diff)
parentc81883dfce7360148c72922b93bfa16b399ee3ee (diff)
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)
Diffstat (limited to 'lib')
-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
3 files changed, 7 insertions, 4 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 59479eddb9..43f32385fa 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 e063e0c79b..411a8c9226 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 dd52755d1d..ad7f3754bd 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));