1 // SPDX-License-Identifier: GPL-2.0+
2 
3 #define LOG_CATEGORY LOGC_ARCH
4 
5 #include <common.h>
6 #include <fdt_support.h>
7 #include <log.h>
8 
9 #if defined(__riscv)
arch_fixup_fdt(void * blob)10 int arch_fixup_fdt(void *blob)
11 {
12 	int ret;
13 
14 	ret = fdt_find_or_add_subnode(blob, 0, "chosen");;
15 	if (ret < 0)
16 		goto err;
17 	ret = fdt_setprop_u32(blob, ret, "boot-hartid", 1);
18 	if (ret < 0)
19 		goto err;
20 	return 0;
21 err:
22 	log_err("Setting /chosen/boot-hartid failed: %s\n", fdt_strerror(ret));
23 	return ret;
24 }
25 #endif
26