提交 56192959 编写于 作者: T Tom Rini

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)
......@@ -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");
......
......@@ -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; \
})
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册