sip.c 884 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2017 NXP
  4. */
  5. #include <common.h>
  6. #include <asm/arch/sys_proto.h>
  7. #include <asm/cache.h>
  8. unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
  9. unsigned long reg1, unsigned long reg2,
  10. unsigned long reg3)
  11. {
  12. struct pt_regs regs;
  13. regs.regs[0] = id;
  14. regs.regs[1] = reg0;
  15. regs.regs[2] = reg1;
  16. regs.regs[3] = reg2;
  17. regs.regs[4] = reg3;
  18. smc_call(&regs);
  19. return regs.regs[0];
  20. }
  21. /*
  22. * Do an SMC call to return 2 registers by having reg1 passed in by reference
  23. */
  24. unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0,
  25. unsigned long *reg1, unsigned long reg2,
  26. unsigned long reg3)
  27. {
  28. struct pt_regs regs;
  29. regs.regs[0] = id;
  30. regs.regs[1] = reg0;
  31. regs.regs[2] = *reg1;
  32. regs.regs[3] = reg2;
  33. regs.regs[4] = reg3;
  34. smc_call(&regs);
  35. *reg1 = regs.regs[1];
  36. return regs.regs[0];
  37. }