1*84fe419dSAlexandre Ghiti // SPDX-License-Identifier: GPL-2.0-only 2*84fe419dSAlexandre Ghiti #include <linux/types.h> 3*84fe419dSAlexandre Ghiti #include <linux/init.h> 4*84fe419dSAlexandre Ghiti #include <linux/libfdt.h> 5*84fe419dSAlexandre Ghiti 6*84fe419dSAlexandre Ghiti /* 7*84fe419dSAlexandre Ghiti * Declare the functions that are exported (but prefixed) here so that LLVM 8*84fe419dSAlexandre Ghiti * does not complain it lacks the 'static' keyword (which, if added, makes 9*84fe419dSAlexandre Ghiti * LLVM complain because the function is actually unused in this file). 10*84fe419dSAlexandre Ghiti */ 11*84fe419dSAlexandre Ghiti u64 get_kaslr_seed(uintptr_t dtb_pa); 12*84fe419dSAlexandre Ghiti get_kaslr_seed(uintptr_t dtb_pa)13*84fe419dSAlexandre Ghitiu64 get_kaslr_seed(uintptr_t dtb_pa) 14*84fe419dSAlexandre Ghiti { 15*84fe419dSAlexandre Ghiti int node, len; 16*84fe419dSAlexandre Ghiti fdt64_t *prop; 17*84fe419dSAlexandre Ghiti u64 ret; 18*84fe419dSAlexandre Ghiti 19*84fe419dSAlexandre Ghiti node = fdt_path_offset((void *)dtb_pa, "/chosen"); 20*84fe419dSAlexandre Ghiti if (node < 0) 21*84fe419dSAlexandre Ghiti return 0; 22*84fe419dSAlexandre Ghiti 23*84fe419dSAlexandre Ghiti prop = fdt_getprop_w((void *)dtb_pa, node, "kaslr-seed", &len); 24*84fe419dSAlexandre Ghiti if (!prop || len != sizeof(u64)) 25*84fe419dSAlexandre Ghiti return 0; 26*84fe419dSAlexandre Ghiti 27*84fe419dSAlexandre Ghiti ret = fdt64_to_cpu(*prop); 28*84fe419dSAlexandre Ghiti *prop = 0; 29*84fe419dSAlexandre Ghiti return ret; 30*84fe419dSAlexandre Ghiti } 31