diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-03-22 10:33:51 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-03-22 10:33:51 +0000 |
commit | 2caab82896c4e692356057ef4d784cee3d6107ce (patch) | |
tree | ec573e9fe8a8b5de278a95d24618995b6ed40f67 /sys/arch | |
parent | b524db141fb3791bd00df99a84edc59340e469e1 (diff) |
Copy the FDT into a larger buffer such that we have space to add additional
nodes and properties to it like we do on arm64 and armv7.
ok patrick@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/riscv64/stand/efiboot/efiboot.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/arch/riscv64/stand/efiboot/efiboot.c b/sys/arch/riscv64/stand/efiboot/efiboot.c index 8760011b25e..561bf6952ca 100644 --- a/sys/arch/riscv64/stand/efiboot/efiboot.c +++ b/sys/arch/riscv64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.3 2021/10/26 10:45:55 patrick Exp $ */ +/* $OpenBSD: efiboot.c,v 1.4 2022/03/22 10:33:50 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -491,6 +491,7 @@ efi_makebootargs(char *bootargs, int howto) 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; @@ -503,6 +504,17 @@ efi_makebootargs(char *bootargs, int howto) } } + 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)); + ((struct fdt_head *)addr)->fh_size = htobe32(len); + fdt = (void *)addr; + } + if (!fdt_init(fdt)) return NULL; |