securemsm_modules.bzl 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 = "qseecom_dlkm",
  45. path = QSEECOM_PATH,
  46. default_srcs = [
  47. "qseecom.c",
  48. "ice.h",
  49. ],
  50. deps = [":qseecom_kernel_headers"],
  51. #srcs = ["config/sec-kernel_defconfig_qseecom.h"],
  52. #copts = ["-include", "config/sec-kernel_defconfig_qseecom.h"],
  53. )
  54. register_securemsm_module(
  55. name = "smcinvoke_dlkm",
  56. path = SMCINVOKE_PATH,
  57. default_srcs = [
  58. "smcinvoke.c",
  59. "smcinvoke_kernel.c",
  60. "trace_smcinvoke.h",
  61. "IQSEEComCompat.h",
  62. "smci_qseecomcompat.h",
  63. "IQSEEComCompatAppLoader.h",
  64. "smci_qseecomcompatapploader.h",
  65. ],
  66. deps = [":smcinvoke_kernel_headers", ":qseecom_kernel_headers", "%b_qseecom_dlkm"],
  67. hdrs = [":smcinvoke_kernel_headers"],
  68. )
  69. register_securemsm_module(
  70. name = "tz_log_dlkm",
  71. path = TZLOG_PATH,
  72. deps = [":qseecom_kernel_headers"],
  73. default_srcs = ["tz_log.c"],
  74. )
  75. register_securemsm_module(
  76. name = "hdcp_qseecom_dlkm",
  77. path = HDCP_PATH,
  78. default_srcs = [
  79. "hdcp_qseecom.c",
  80. "hdcp_qseecom.h",
  81. "hdcp_main.c",
  82. "smcinvoke_object.h",
  83. "smci_object.h",
  84. "hdcp_main.h",
  85. "hdcp_smcinvoke.c",
  86. "hdcp_smcinvoke.h",
  87. "CAppClient.h",
  88. "CAppLoader.h",
  89. "IAppClient.h",
  90. "smci_appclient.h",
  91. "IAppController.h",
  92. "smci_appcontroller.h",
  93. "IAppLoader.h",
  94. "smci_apploader.h",
  95. "IClientEnv.h",
  96. "smci_clientenv.h",
  97. "IOpener.h",
  98. "smci_opener.h",
  99. "hdcp1.h",
  100. "hdcp1_ops.h",
  101. "hdcp2p2.h",
  102. ],
  103. deps = [":hdcp_qseecom_dlkm", "%b_smcinvoke_dlkm", "%b_qseecom_dlkm"],
  104. srcs = ["config/sec-kernel_defconfig.h"],
  105. copts = [
  106. "-include",
  107. "config/sec-kernel_defconfig.h",
  108. ],
  109. )
  110. register_securemsm_module(
  111. name = "qce50_dlkm",
  112. path = QCEDEV_PATH,
  113. default_srcs = ["qce50.c"],
  114. deps = [":qcedev_local_headers"],
  115. )
  116. register_securemsm_module(
  117. name = "qcedev-mod_dlkm",
  118. path = QCEDEV_PATH,
  119. default_srcs = [
  120. "qcedev.c",
  121. "qcedev_smmu.c"],
  122. deps = [":qcedev_local_headers",
  123. "%b_qce50_dlkm"],
  124. )
  125. register_securemsm_module(
  126. name = "qrng_dlkm",
  127. path = QRNG_PATH,
  128. default_srcs = ["msm_rng.c"],
  129. deps = [":qcedev_local_headers"],
  130. )
  131. register_securemsm_module(
  132. name = "qcrypto-msm_dlkm",
  133. path = QCEDEV_PATH,
  134. default_srcs = ["qcrypto.c"],
  135. deps = [":qcedev_local_headers",
  136. "%b_qce50_dlkm"],
  137. )
  138. register_securemsm_module(
  139. name = "smmu_proxy_dlkm",
  140. path = SMMU_PROXY_PATH,
  141. srcs = ["qti-smmu-proxy-pvm.c", "qti-smmu-proxy-common.c"],
  142. deps = ["%b_smcinvoke_dlkm", ":smmu_proxy_headers"],
  143. )