cpu-dt.c 868 B

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