securemsm_modules.bzl 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. SMCINVOKE_PATH = "smcinvoke"
  2. QSEECOM_PATH = "qseecom"
  3. TZLOG_PATH = "tz_log"
  4. HDCP_PATH = "hdcp"
  5. QCEDEV_PATH = "crypto-qti"
  6. QRNG_PATH = "qrng"
  7. SMMU_PROXY_PATH = "smmu-proxy"
  8. # This dictionary holds all the securemsm-kernel modules included by calling register_securemsm_module
  9. securemsm_modules = {}
  10. securemsm_modules_by_config = {}
  11. # Registers securemsm module to kernel build system.
  12. # name: The name of the module. The name of the file generated for this module will be {name}.ko.
  13. # path: The path that will be prepended to all sources listed for this module.
  14. # config_option: If this module is enabled, the config optiont that will get enabled if so. Not all modules have this, and this is an optional parameter.
  15. # config_srcs: A dictionary of sources to be added to the module depending on if a configuration option is enabled or not. The keys to the dictionary are
  16. # the name of the config option, and the value depends If it is a list, it will just be the list of sources to be added to the module if the config option
  17. # is enabled. If the value is another dictionary, then you can specify sources to be added if the config option is DISABLED by having a list under the
  18. # default_srcs: A list of sources to be added to the module regardless of configuration options.
  19. # deps: A list of kernel_module or ddk_module rules that this module depends on.
  20. def register_securemsm_module(name, path = None, config_option = None, default_srcs = [], config_srcs = {}, deps = [], srcs = [], copts = [], hdrs = []):
  21. processed_config_srcs = {}
  22. for config_src_name in config_srcs:
  23. config_src = config_srcs[config_src_name]
  24. if type(config_src) == "list":
  25. processed_config_srcs[config_src_name] = {True: config_src}
  26. else:
  27. processed_config_srcs[config_src_name] = config_src
  28. module = {
  29. "name": name,
  30. "path": path,
  31. "default_srcs": default_srcs,
  32. "config_srcs": processed_config_srcs,
  33. "config_option": config_option,
  34. "deps": deps,
  35. "copts": copts,
  36. "srcs": srcs,
  37. "hdrs": hdrs,
  38. }
  39. securemsm_modules[name] = module
  40. if config_option:
  41. securemsm_modules_by_config[config_option] = name
  42. # ------------------------------------ SECUREMSM MODULE DEFINITIONS ---------------------------------
  43. register_securemsm_module(
  44. name = "smcinvoke_dlkm",
  45. path = SMCINVOKE_PATH,
  46. default_srcs = [
  47. "smcinvoke.c",
  48. "smcinvoke_kernel.c",
  49. "trace_smcinvoke.h",
  50. "IQSEEComCompat.h",
  51. "IQSEEComCompatAppLoader.h",
  52. ],
  53. deps = [":smcinvoke_kernel_headers", ":qseecom_kernel_headers"],
  54. hdrs = [":smcinvoke_kernel_headers"],
  55. )
  56. register_securemsm_module(
  57. name = "qseecom_dlkm",
  58. path = QSEECOM_PATH,
  59. default_srcs = [
  60. "qseecom.c",
  61. "ice.h",
  62. ],
  63. deps = [":qseecom_kernel_headers"],
  64. #srcs = ["config/sec-kernel_defconfig_qseecom.h"],
  65. #copts = ["-include", "config/sec-kernel_defconfig_qseecom.h"],
  66. )
  67. register_securemsm_module(
  68. name = "tz_log_dlkm",
  69. path = TZLOG_PATH,
  70. deps = [":qseecom_kernel_headers"],
  71. default_srcs = ["tz_log.c"],
  72. )
  73. register_securemsm_module(
  74. name = "hdcp_qseecom_dlkm",
  75. path = HDCP_PATH,
  76. default_srcs = [
  77. "hdcp_qseecom.c",
  78. "hdcp_qseecom.h",
  79. "hdcp_main.c",
  80. "smcinvoke_object.h",
  81. "hdcp_main.h",
  82. "hdcp_smcinvoke.c",
  83. "hdcp_smcinvoke.h",
  84. "CAppClient.h",
  85. "CAppLoader.h",
  86. "IAppClient.h",
  87. "IAppController.h",
  88. "IAppLoader.h",
  89. "IClientEnv.h",
  90. "IOpener.h",
  91. "hdcp1.h",
  92. "hdcp1_ops.h",
  93. "hdcp2p2.h",
  94. ],
  95. deps = [":hdcp_qseecom_dlkm", "%b_smcinvoke_dlkm"],
  96. srcs = ["config/sec-kernel_defconfig.h"],
  97. copts = [
  98. "-include",
  99. "config/sec-kernel_defconfig.h",
  100. ],
  101. )
  102. register_securemsm_module(
  103. name = "qce50_dlkm",
  104. path = QCEDEV_PATH,
  105. default_srcs = ["qce50.c"],
  106. deps = [":qcedev_local_headers"],
  107. )
  108. register_securemsm_module(
  109. name = "qcedev-mod_dlkm",
  110. path = QCEDEV_PATH,
  111. default_srcs = [
  112. "qcedev.c",
  113. "qcedev_smmu.c",
  114. "compat_qcedev.c"],
  115. deps = [":qcedev_local_headers",
  116. "%b_qce50_dlkm"],
  117. )
  118. register_securemsm_module(
  119. name = "qrng_dlkm",
  120. path = QRNG_PATH,
  121. default_srcs = ["msm_rng.c"],
  122. deps = [":qcedev_local_headers"],
  123. )
  124. register_securemsm_module(
  125. name = "qcrypto-msm_dlkm",
  126. path = QCEDEV_PATH,
  127. default_srcs = ["qcrypto.c"],
  128. deps = [":qcedev_local_headers",
  129. "%b_qce50_dlkm"],
  130. )
  131. register_securemsm_module(
  132. name = "smmu_proxy_dlkm",
  133. path = SMMU_PROXY_PATH,
  134. srcs = ["qti-smmu-proxy-pvm.c", "qti-smmu-proxy-common.c"],
  135. deps = ["%b_smcinvoke_dlkm", ":smmu_proxy_headers"],
  136. )