-/* $OpenBSD: efiboot.c,v 1.35 2021/10/26 10:45:55 patrick Exp $ */
+/* $OpenBSD: efiboot.c,v 1.36 2021/10/26 14:10:02 patrick Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
u_char zero[8] = { 0 };
uint64_t uefi_system_table = htobe64((uintptr_t)ST);
uint32_t boothowto = htobe32(howto);
+ EFI_PHYSICAL_ADDRESS addr;
void *node;
size_t len;
int i;
if (fdt == NULL || acpi)
fdt = efi_acpi();
+ if (!fdt_get_size(fdt))
+ return NULL;
+
+ len = roundup(fdt_get_size(fdt) + PAGE_SIZE, PAGE_SIZE);
+ if (BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
+ EFI_SIZE_TO_PAGES(len), &addr) == EFI_SUCCESS) {
+ memcpy((void *)addr, fdt, fdt_get_size(fdt));
+ fdt = (void *)addr;
+ }
+
if (!fdt_init(fdt))
return NULL;
-/* $OpenBSD: efiboot.c,v 1.36 2021/10/26 10:45:55 patrick Exp $ */
+/* $OpenBSD: efiboot.c,v 1.37 2021/10/26 14:10:02 patrick Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
u_char zero[8] = { 0 };
uint64_t uefi_system_table = htobe64((uintptr_t)ST);
uint32_t boothowto = htobe32(howto);
+ EFI_PHYSICAL_ADDRESS addr;
void *node;
size_t len;
int i;
}
}
+ if (!fdt_get_size(fdt))
+ return NULL;
+
+ len = roundup(fdt_get_size(fdt) + PAGE_SIZE, PAGE_SIZE);
+ if (BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
+ EFI_SIZE_TO_PAGES(len), &addr) == EFI_SUCCESS) {
+ memcpy((void *)addr, fdt, fdt_get_size(fdt));
+ fdt = (void *)addr;
+ }
+
if (!fdt_init(fdt))
return NULL;