xref: /openbmc/u-boot/arch/arm/cpu/armv8/cpu-dt.c (revision 39665bee)
1 /*
2  * Copyright 2016 NXP Semiconductor, Inc.
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include <asm/psci.h>
9 #include <asm/system.h>
10 #include <asm/armv8/sec_firmware.h>
11 
12 #ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
13 int psci_update_dt(void *fdt)
14 {
15 	/*
16 	 * If the PSCI in SEC Firmware didn't work, avoid to update the
17 	 * device node of PSCI. But still return 0 instead of an error
18 	 * number to support detecting PSCI dynamically and then switching
19 	 * the SMP boot method between PSCI and spin-table.
20 	 */
21 	if (sec_firmware_support_psci_version() == PSCI_INVALID_VER)
22 		return 0;
23 	fdt_psci(fdt);
24 
25 #if defined(CONFIG_ARMV8_PSCI) && !defined(CONFIG_ARMV8_SECURE_BASE)
26 	/* secure code lives in RAM, keep it alive */
27 	fdt_add_mem_rsv(fdt, (unsigned long)__secure_start,
28 			__secure_end - __secure_start);
29 #endif
30 
31 	return 0;
32 }
33 #endif
34