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)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJZlq5xAAoJECszeR4D/txgM9MP/3lZ8gUWCb5iNnIUhTwNyTPG
 T2tCvoI90YkNTY67L/J5JtDR8BaW4D+yJTeR+tIxB7BMMeF/UJ+kLPdncNyF082b
 9h6Ht5m47osSuBji0v8G2/wjkzNAIonXdoVFQxKQ9t3WgjvyWlp4sK6wrmGyukQJ
 Pb6cqEo/BH3u9/+xPZvyv9eZErJukfs4GHawzP1olH50mF8yVGUbJT2ctKhk5m3b
 F5gdp0pPsebISjWhoq8CKxQitDH6WG6IsLJTu0htEGjP5qPtXSIQhKMj4zIBSH9U
 paiO0k7DeQyfiKqeenk9zY+X33T/JlVPmLco4osP70pg6bzYdnjPGAuwpEhiL1cN
 QZcNb+liZceik5iWO1bjAoUd4rOKD4snl6kg6qLUiYCNF2oSo5h8Em3oyHiiw6Dw
 ohX840jdtnl3Xuuo0jCtHZoOH5glWCO+HTZTPhdE0K/9s79yPy59v9RqBNRM5LB+
 dH7Zg/50AtebOLqqd35YQdSaV1im80EbdxLaV1yJsMtQw2xucVHJC099oyTDXcSg
 0pzBDYsQia/hDDvum8TVHheHfz0cJi9u+VrjgauTK2GmcYNr1hxSyM0pSFveB3C3
 C9qP/20yI3ZMuECC67SIfYK5E03bI2gHH8/k+fQEqxYgqqr50I7aWYGw2nFZTecC
 sdWxgTolQsjn/xlfFBWY
 =wyGe
 -----END PGP SIGNATURE-----

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)
This commit is contained in:
Tom Rini 2017-08-18 18:24:58 -04:00
commit 5619295995
5 changed files with 11 additions and 8 deletions

View File

@ -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");

View File

@ -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; \
})

View File

@ -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;
}

View File

@ -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);

View File

@ -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));