mtk_plat_common.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch_helpers.h>
  7. #include <common/bl_common.h>
  8. #include <common/debug.h>
  9. #include <drivers/arm/cci.h>
  10. #include <drivers/console.h>
  11. #include <lib/mmio.h>
  12. #include <lib/smccc.h>
  13. #include <lib/xlat_tables/xlat_tables.h>
  14. #include <plat/common/platform.h>
  15. #include <services/arm_arch_svc.h>
  16. #include <mtk_plat_common.h>
  17. #include <mtk_sip_svc.h>
  18. #include <plat_private.h>
  19. void clean_top_32b_of_param(uint32_t smc_fid,
  20. u_register_t *px1,
  21. u_register_t *px2,
  22. u_register_t *px3,
  23. u_register_t *px4)
  24. {
  25. /* if parameters from SMC32. Clean top 32 bits */
  26. if (GET_SMC_CC(smc_fid) == SMC_64) {
  27. *px1 = *px1 & SMC32_PARAM_MASK;
  28. *px2 = *px2 & SMC32_PARAM_MASK;
  29. *px3 = *px3 & SMC32_PARAM_MASK;
  30. *px4 = *px4 & SMC32_PARAM_MASK;
  31. }
  32. }
  33. /*****************************************************************************
  34. * plat_is_smccc_feature_available() - This function checks whether SMCCC
  35. * feature is availabile for platform.
  36. * @fid: SMCCC function id
  37. *
  38. * Return SMC_OK if SMCCC feature is available and SMC_ARCH_CALL_NOT_SUPPORTED
  39. * otherwise.
  40. *****************************************************************************/
  41. int32_t plat_is_smccc_feature_available(u_register_t fid)
  42. {
  43. switch (fid) {
  44. case SMCCC_ARCH_SOC_ID:
  45. return SMC_ARCH_CALL_SUCCESS;
  46. default:
  47. return SMC_ARCH_CALL_NOT_SUPPORTED;
  48. }
  49. }
  50. int32_t plat_get_soc_version(void)
  51. {
  52. uint32_t manfid = SOC_ID_SET_JEP_106(JEDEC_MTK_BKID, JEDEC_MTK_MFID);
  53. return (int32_t)(manfid | (SOC_CHIP_ID & SOC_ID_IMPL_DEF_MASK));
  54. }
  55. int32_t plat_get_soc_revision(void)
  56. {
  57. return 0;
  58. }