Lines Matching +full:firmware +full:- +full:initialised
1 // SPDX-License-Identifier: GPL-2.0-only
27 * bootargs, kaslr-seed, rng-seed, useable-memory-range and elfcorehdr.
32 * fdt_find_and_del_mem_rsv - delete memory reservation with given address and size
50 return -EINVAL; in fdt_find_and_del_mem_rsv()
57 return -EINVAL; in fdt_find_and_del_mem_rsv()
64 return -ENOENT; in fdt_find_and_del_mem_rsv()
68 * get_addr_size_cells - Get address and size of root node
81 return -EINVAL; in get_addr_size_cells()
92 * do_get_kexec_buffer - Get address and size of device tree property
111 return -ENOENT; in do_get_kexec_buffer()
121 * ima_get_kexec_buffer - get IMA buffer from the previous kernel
135 prop = of_get_property(of_chosen, "linux,ima-kexec-buffer", &len); in ima_get_kexec_buffer()
137 return -ENOENT; in ima_get_kexec_buffer()
143 /* Do some sanity on the returned size for the ima-kexec buffer */ in ima_get_kexec_buffer()
145 return -ENOENT; in ima_get_kexec_buffer()
152 end_pfn = PHYS_PFN(tmp_addr + tmp_size - 1); in ima_get_kexec_buffer()
156 return -EINVAL; in ima_get_kexec_buffer()
166 * ima_free_kexec_buffer - free memory used by the IMA buffer
175 prop = of_find_property(of_chosen, "linux,ima-kexec-buffer", NULL); in ima_free_kexec_buffer()
177 return -ENOENT; in ima_free_kexec_buffer()
179 ret = do_get_kexec_buffer(prop->value, prop->length, &addr, &size); in ima_free_kexec_buffer()
193 * remove_ima_buffer - remove the IMA buffer property and reservation from @fdt
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()
227 * setup_ima_buffer - add IMA buffer information to the fdt
239 if (!image->ima_buffer_size) in setup_ima_buffer()
243 "linux,ima-kexec-buffer", in setup_ima_buffer()
244 image->ima_buffer_addr, in setup_ima_buffer()
245 image->ima_buffer_size); in setup_ima_buffer()
247 return -EINVAL; in setup_ima_buffer()
249 ret = fdt_add_mem_rsv(fdt, image->ima_buffer_addr, in setup_ima_buffer()
250 image->ima_buffer_size); in setup_ima_buffer()
252 return -EINVAL; in setup_ima_buffer()
255 image->ima_buffer_addr, image->ima_buffer_size); in setup_ima_buffer()
268 * of_kexec_alloc_and_setup_fdt - Alloc and setup a new Flattened Device Tree
306 if (ret == -EINVAL) { in of_kexec_alloc_and_setup_fdt()
312 if (chosen_node == -FDT_ERR_NOTFOUND) in of_kexec_alloc_and_setup_fdt()
321 if (ret && ret != -FDT_ERR_NOTFOUND) 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()
324 if (ret && ret != -FDT_ERR_NOTFOUND) 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()
336 ret = -EINVAL; in of_kexec_alloc_and_setup_fdt()
343 * kexec reserves exact initrd size, while firmware may in of_kexec_alloc_and_setup_fdt()
346 tmp_size = tmp_end - tmp_start; in of_kexec_alloc_and_setup_fdt()
348 if (ret == -ENOENT) in of_kexec_alloc_and_setup_fdt()
351 if (ret == -EINVAL) in of_kexec_alloc_and_setup_fdt()
355 /* add initrd-* */ 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()
372 ret = fdt_delprop(fdt, chosen_node, "linux,initrd-start"); in of_kexec_alloc_and_setup_fdt()
373 if (ret && (ret != -FDT_ERR_NOTFOUND)) in of_kexec_alloc_and_setup_fdt()
376 ret = fdt_delprop(fdt, chosen_node, "linux,initrd-end"); in of_kexec_alloc_and_setup_fdt()
377 if (ret && (ret != -FDT_ERR_NOTFOUND)) in of_kexec_alloc_and_setup_fdt()
381 if (image->type == KEXEC_TYPE_CRASH) { in of_kexec_alloc_and_setup_fdt()
384 "linux,elfcorehdr", image->elf_load_addr, in of_kexec_alloc_and_setup_fdt()
385 image->elf_headers_sz); 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()
394 image->elf_headers_sz); in of_kexec_alloc_and_setup_fdt()
399 /* add linux,usable-memory-range */ in of_kexec_alloc_and_setup_fdt()
401 "linux,usable-memory-range", crashk_res.start, in of_kexec_alloc_and_setup_fdt()
402 crashk_res.end - crashk_res.start + 1); in of_kexec_alloc_and_setup_fdt()
408 "linux,usable-memory-range", in of_kexec_alloc_and_setup_fdt()
410 crashk_low_res.end - crashk_low_res.start + 1); in of_kexec_alloc_and_setup_fdt()
424 if (ret && (ret != -FDT_ERR_NOTFOUND)) in of_kexec_alloc_and_setup_fdt()
428 /* add kaslr-seed */ in of_kexec_alloc_and_setup_fdt()
429 ret = fdt_delprop(fdt, chosen_node, "kaslr-seed"); in of_kexec_alloc_and_setup_fdt()
430 if (ret == -FDT_ERR_NOTFOUND) 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()
442 pr_notice("RNG is not initialised: omitting \"%s\" property\n", in of_kexec_alloc_and_setup_fdt()
443 "kaslr-seed"); in of_kexec_alloc_and_setup_fdt()
446 /* add rng-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()
456 pr_notice("RNG is not initialised: omitting \"%s\" property\n", in of_kexec_alloc_and_setup_fdt()
457 "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()