From ebf199b92f81d4c1228200bfc138aa32928bf373 Mon Sep 17 00:00:00 2001 From: "xypron.glpk@gmx.de" Date: Wed, 9 Aug 2017 20:55:00 +0200 Subject: efi_loader: attribute EFIAPI of efi_locate handle() efi_locate_handle is called internally so it should not be marked as EFIAPI. The external function is efi_locate_handle_ext. Signed-off-by: Heinrich Schuchardt Reviewed-by: Rob Clark Signed-off-by: Alexander Graf --- lib/efi_loader/efi_boottime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 59479eddb9..58cd6d0e89 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) -- cgit v1.2.3 From 796a78cbe5676fc7562b50c7a0191fa56c8c4772 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sun, 6 Aug 2017 14:10:07 -0400 Subject: efi_loader: LocateHandle should return EFI_NOT_FOUND if none found Spotted this debugging OpenBSD's bootloader in qemu. (Wouldn't really fix anything, the problem was not having any disks, but we should probably return the correct error code.) Signed-off-by: Rob Clark Reviewed-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- lib/efi_loader/efi_boottime.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 58cd6d0e89..43f32385fa 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -633,6 +633,10 @@ static efi_status_t 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 efi_locate_handle( } } - *buffer_size = size; return EFI_SUCCESS; } -- cgit v1.2.3 From 3d9880784ed5cd503b0d69128ea1841102ff522e Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 4 Aug 2017 07:52:03 -0400 Subject: efi_loader: GOP fix for no display uclass_first_device() returns 0 if there is no device, but error if there is a device that failed to probe. Signed-off-by: Rob Clark Signed-off-by: Alexander Graf --- lib/efi_loader/efi_gop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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); -- cgit v1.2.3 From aee4f06dff36261433d90c94a5def2c90be8407c Mon Sep 17 00:00:00 2001 From: "xypron.glpk@gmx.de" Date: Fri, 11 Aug 2017 21:19:37 +0200 Subject: efi_loader: use EFI_PAGE_MASK instead of EFI_PAGE_SIZE - 1 We should be consistent in the way we calculate page sizes. Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- lib/efi_loader/efi_runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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)); -- cgit v1.2.3