ccci_ld_md_hal.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2015. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #include <sys/types.h>
  32. #include <stdint.h>
  33. #include <platform/partition.h>
  34. #include <platform/mt_typedefs.h>
  35. #include <platform/boot_mode.h>
  36. #include <platform/mt_reg_base.h>
  37. #include <platform/errno.h>
  38. #include <printf.h>
  39. #include <string.h>
  40. #include <malloc.h>
  41. #include <libfdt.h>
  42. #include <platform/mt_gpt.h>
  43. #include <debug.h>
  44. #include "ccci_ld_md_core.h"
  45. #define MODULE_NAME "LK_LD_MD"
  46. /******************************************************************************/
  47. /* Platform code wrapper */
  48. long long ccci_hal_get_ld_md_plat_setting(char cfg_name[])
  49. {
  50. long long (*NULL_FP)(char str[]) = 0;
  51. if (strcmp(cfg_name, "support_detect") == 0) {
  52. if (NULL_FP == plat_ccci_get_ld_md_plat_setting)
  53. return 0LL;
  54. return 1LL;
  55. }
  56. if (NULL_FP == plat_ccci_get_ld_md_plat_setting)
  57. return 0LL;
  58. return plat_ccci_get_ld_md_plat_setting(cfg_name);
  59. }
  60. int ccci_hal_get_mpu_num_for_padding_mem(void)
  61. {
  62. int (*NULL_FP)(void) = 0;
  63. if (NULL_FP == plat_get_padding_mpu_num)
  64. return 0;
  65. return plat_get_padding_mpu_num();
  66. }
  67. int ccci_hal_apply_hw_remap_for_md_ro_rw(void *md_info)
  68. {
  69. int (*NULL_FP)(void *) = 0;
  70. if (NULL_FP == plat_apply_hw_remap_for_md_ro_rw)
  71. return -1;
  72. return plat_apply_hw_remap_for_md_ro_rw(md_info);
  73. }
  74. int ccci_hal_apply_hw_remap_for_md_smem(void *addr, int size)
  75. {
  76. int (*NULL_FP)(void *, int) = 0;
  77. if (NULL_FP == plat_apply_hw_remap_for_md_smem)
  78. return -1;
  79. return plat_apply_hw_remap_for_md_smem(addr, size);
  80. }
  81. int ccci_hal_send_mpu_info_to_platorm(void *md_info, void *mem_info)
  82. {
  83. int (*NULL_FP)(void *, void *) = 0;
  84. if (NULL_FP == plat_send_mpu_info_to_platorm)
  85. return -1;
  86. return plat_send_mpu_info_to_platorm(md_info, mem_info);
  87. }
  88. int ccci_hal_apply_platform_setting(int load_flag)
  89. {
  90. int (*NULL_FP)(int) = 0;
  91. if (NULL_FP == plat_apply_platform_setting)
  92. return -1;
  93. return plat_apply_platform_setting(load_flag);
  94. }
  95. void ccci_hal_post_hdr_info(void *hdr, int ver, int id)
  96. {
  97. void (*NULL_FP)(void *, int, int) = 0;
  98. if (NULL_FP == plat_post_hdr_info)
  99. return;
  100. plat_post_hdr_info(hdr, ver, id);
  101. }