Lines Matching full:fdt

26  * Additional space needed for the FDT buffer so that we can add initrd,
34 * @fdt: Flattened device tree for the current kernel.
40 static int fdt_find_and_del_mem_rsv(void *fdt, unsigned long start, unsigned long size) in fdt_find_and_del_mem_rsv() argument
42 int i, ret, num_rsvs = fdt_num_mem_rsv(fdt); in fdt_find_and_del_mem_rsv()
47 ret = fdt_get_mem_rsv(fdt, i, &rsv_start, &rsv_size); in fdt_find_and_del_mem_rsv()
54 ret = fdt_del_mem_rsv(fdt, i); in fdt_find_and_del_mem_rsv()
193 * remove_ima_buffer - remove the IMA buffer property and reservation from @fdt
195 * @fdt: Flattened Device Tree to update
201 static void remove_ima_buffer(void *fdt, int chosen_node) in remove_ima_buffer() argument
211 prop = fdt_getprop(fdt, chosen_node, "linux,ima-kexec-buffer", &len); in remove_ima_buffer()
216 fdt_delprop(fdt, chosen_node, "linux,ima-kexec-buffer"); in remove_ima_buffer()
220 ret = fdt_find_and_del_mem_rsv(fdt, addr, size); in remove_ima_buffer()
227 * setup_ima_buffer - add IMA buffer information to the fdt
229 * @fdt: Flattened device tree for the next kernel.
234 static int setup_ima_buffer(const struct kimage *image, void *fdt, in setup_ima_buffer() argument
242 ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, in setup_ima_buffer()
249 ret = fdt_add_mem_rsv(fdt, image->ima_buffer_addr, in setup_ima_buffer()
260 static inline int setup_ima_buffer(const struct kimage *image, void *fdt, in setup_ima_buffer() argument
275 * @extra_fdt_size: Additional size for the new FDT buffer.
277 * Return: fdt on success, or NULL errno on error.
284 void *fdt; in of_kexec_alloc_and_setup_fdt() local
293 fdt = kvmalloc(fdt_size, GFP_KERNEL); in of_kexec_alloc_and_setup_fdt()
294 if (!fdt) in of_kexec_alloc_and_setup_fdt()
297 ret = fdt_open_into(initial_boot_params, fdt, fdt_size); in of_kexec_alloc_and_setup_fdt()
304 ret = fdt_find_and_del_mem_rsv(fdt, __pa(initial_boot_params), in of_kexec_alloc_and_setup_fdt()
311 chosen_node = fdt_path_offset(fdt, "/chosen"); in of_kexec_alloc_and_setup_fdt()
313 chosen_node = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"), in of_kexec_alloc_and_setup_fdt()
320 ret = fdt_delprop(fdt, chosen_node, "linux,elfcorehdr"); in of_kexec_alloc_and_setup_fdt()
323 ret = fdt_delprop(fdt, chosen_node, "linux,usable-memory-range"); in of_kexec_alloc_and_setup_fdt()
328 prop = fdt_getprop(fdt, chosen_node, "linux,initrd-start", &len); in of_kexec_alloc_and_setup_fdt()
334 prop = fdt_getprop(fdt, chosen_node, "linux,initrd-end", &len); in of_kexec_alloc_and_setup_fdt()
347 ret = fdt_find_and_del_mem_rsv(fdt, tmp_start, tmp_size); in of_kexec_alloc_and_setup_fdt()
349 ret = fdt_find_and_del_mem_rsv(fdt, tmp_start, in of_kexec_alloc_and_setup_fdt()
357 ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-start", in of_kexec_alloc_and_setup_fdt()
362 ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-end", in of_kexec_alloc_and_setup_fdt()
367 ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len); in of_kexec_alloc_and_setup_fdt()
372 ret = fdt_delprop(fdt, chosen_node, "linux,initrd-start"); in of_kexec_alloc_and_setup_fdt()
376 ret = fdt_delprop(fdt, chosen_node, "linux,initrd-end"); in of_kexec_alloc_and_setup_fdt()
383 ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, in of_kexec_alloc_and_setup_fdt()
393 ret = fdt_add_mem_rsv(fdt, image->elf_load_addr, in of_kexec_alloc_and_setup_fdt()
400 ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, in of_kexec_alloc_and_setup_fdt()
407 ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, in of_kexec_alloc_and_setup_fdt()
419 ret = fdt_setprop_string(fdt, chosen_node, "bootargs", cmdline); in of_kexec_alloc_and_setup_fdt()
423 ret = fdt_delprop(fdt, chosen_node, "bootargs"); in of_kexec_alloc_and_setup_fdt()
429 ret = fdt_delprop(fdt, chosen_node, "kaslr-seed"); in of_kexec_alloc_and_setup_fdt()
438 ret = fdt_setprop_u64(fdt, chosen_node, "kaslr-seed", seed); in of_kexec_alloc_and_setup_fdt()
450 ret = fdt_setprop_placeholder(fdt, chosen_node, "rng-seed", in of_kexec_alloc_and_setup_fdt()
460 ret = fdt_setprop(fdt, chosen_node, "linux,booted-from-kexec", NULL, 0); in of_kexec_alloc_and_setup_fdt()
464 remove_ima_buffer(fdt, chosen_node); in of_kexec_alloc_and_setup_fdt()
465 ret = setup_ima_buffer(image, fdt, fdt_path_offset(fdt, "/chosen")); in of_kexec_alloc_and_setup_fdt()
469 kvfree(fdt); in of_kexec_alloc_and_setup_fdt()
470 fdt = NULL; in of_kexec_alloc_and_setup_fdt()
473 return fdt; in of_kexec_alloc_and_setup_fdt()