cpu-dt.c 845 B

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