cpu-dt.c 991 B

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