&new_fdt_addr) != EFI_SUCCESS) {
/* If we can't put it there, put it somewhere */
new_fdt_addr = (ulong)memalign(4096, 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");
+ return NULL;
+ }
}
+
new_fdt = (void*)(ulong)new_fdt_addr;
memcpy(new_fdt, fdt, fdt_totalsize(fdt));
fdt_set_totalsize(new_fdt, fdt_size);
EFI_EXIT(efi_unsupported(__func__));
}
-efi_status_t EFIAPI efi_allocate_pages_ext(int type, int memory_type,
- unsigned long pages,
- uint64_t *memory)
+static efi_status_t EFIAPI efi_allocate_pages_ext(int type, int memory_type,
+ unsigned long pages,
+ uint64_t *memory)
{
efi_status_t r;
return EFI_EXIT(r);
}
-efi_status_t EFIAPI efi_free_pages_ext(uint64_t memory, unsigned long pages)
+static efi_status_t EFIAPI efi_free_pages_ext(uint64_t memory,
+ unsigned long pages)
{
efi_status_t r;
return EFI_EXIT(r);
}
-efi_status_t EFIAPI efi_get_memory_map_ext(unsigned long *memory_map_size,
- struct efi_mem_desc *memory_map,
- unsigned long *map_key,
- unsigned long *descriptor_size,
- uint32_t *descriptor_version)
+static efi_status_t EFIAPI efi_get_memory_map_ext(
+ unsigned long *memory_map_size,
+ struct efi_mem_desc *memory_map,
+ unsigned long *map_key,
+ unsigned long *descriptor_size,
+ uint32_t *descriptor_version)
{
efi_status_t r;
return EFI_EXIT(EFI_OUT_OF_RESOURCES);
}
+ if (event == NULL)
+ return EFI_EXIT(EFI_INVALID_PARAMETER);
+
+ if ((type & EVT_NOTIFY_SIGNAL) && (type & EVT_NOTIFY_WAIT))
+ return EFI_EXIT(EFI_INVALID_PARAMETER);
+
+ if ((type & (EVT_NOTIFY_SIGNAL|EVT_NOTIFY_WAIT)) &&
+ notify_function == NULL)
+ return EFI_EXIT(EFI_INVALID_PARAMETER);
+
efi_event.type = type;
efi_event.notify_tpl = notify_tpl;
efi_event.notify_function = notify_function;
/* Triggering! */
if (efi_event.trigger_type == EFI_TIMER_PERIODIC)
efi_event.trigger_next += efi_event.trigger_time / 10;
- efi_event.notify_function(&efi_event, efi_event.notify_context);
+ if (efi_event.type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL))
+ efi_event.notify_function(&efi_event,
+ efi_event.notify_context);
}
WATCHDOG_RESET();
efi_guid_t *protocol,
void **protocol_interface)
{
- return efi_open_protocol(handle, protocol, protocol_interface,
- NULL, NULL, 0);
+ return efi_open_protocol(handle, protocol, protocol_interface, NULL,
+ NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
}
static const struct efi_boot_services efi_boot_services = {
return EFI_SUCCESS;
}
-static void efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
+static efi_status_t efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
unsigned long rel_size, void *efi_reloc)
{
const IMAGE_BASE_RELOCATION *end;
default:
printf("Unknown Relocation off %x type %x\n",
offset, type);
+ return EFI_LOAD_ERROR;
}
relocs++;
}
rel = (const IMAGE_BASE_RELOCATION *)relocs;
}
+ return EFI_SUCCESS;
}
void __weak invalidate_icache_all(void)
}
/* Run through relocations */
- efi_loader_relocate(rel, rel_size, efi_reloc);
+ if (efi_loader_relocate(rel, rel_size, efi_reloc) != EFI_SUCCESS) {
+ efi_free_pages((uintptr_t) efi_reloc,
+ (virt_size + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT);
+ return NULL;
+ }
/* Flush cache */
flush_cache((ulong)efi_reloc,