securemsm_modules.bzl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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"],
  54. hdrs = [":smcinvoke_kernel_headers"],
  55. )
  56. register_securemsm_module(
  57. name = "qseecom_dlkm",
  58. path = QSEECOM_PATH,
  59. default_srcs = ["qseecom.c",
  60. "ice.h"],
  61. deps = [":securemsm_kernel_headers"],
  62. srcs = ["config/sec-kernel_defconfig_qseecom.h"],
  63. copts = ["-include", "config/sec-kernel_defconfig_qseecom.h"],
  64. )
  65. register_securemsm_module(
  66. name = "tz_log_dlkm",
  67. path = TZLOG_PATH,
  68. default_srcs = ["tz_log.c"],
  69. )
  70. register_securemsm_module(
  71. name = "hdcp_qseecom_dlkm",
  72. path = HDCP_PATH,
  73. default_srcs = ["hdcp_qseecom.c"],
  74. deps = [":hdcp_qseecom_dlkm","%b_smcinvoke_dlkm"],
  75. srcs = ["config/sec-kernel_defconfig.h"],
  76. copts = ["-include", "config/sec-kernel_defconfig.h"],
  77. )
  78. register_securemsm_module(
  79. name = "qce50_dlkm",
  80. path = QCEDEV_PATH,
  81. default_srcs = ["qce50.c"],
  82. deps = [":qcedev_local_headers"],
  83. )
  84. register_securemsm_module(
  85. name = "qcedev-mod_dlkm",
  86. path = QCEDEV_PATH,
  87. default_srcs = [
  88. "qcedev.c",
  89. "qcedev_smmu.c",
  90. "compat_qcedev.c"],
  91. deps = [":qcedev_local_headers",
  92. "%b_qce50_dlkm"],
  93. )
  94. register_securemsm_module(
  95. name = "qrng_dlkm",
  96. path = QRNG_PATH,
  97. default_srcs = ["msm_rng.c"],
  98. deps = [":qcedev_local_headers"],
  99. )
  100. register_securemsm_module(
  101. name = "qcrypto-msm_dlkm",
  102. path = QCEDEV_PATH,
  103. default_srcs = ["qcrypto.c"],
  104. deps = [":qcedev_local_headers",
  105. "%b_qce50_dlkm"],
  106. )
  107. register_securemsm_module(
  108. name = "smmu_proxy_dlkm",
  109. path = SMMU_PROXY_PATH,
  110. srcs = ["qti-smmu-proxy-pvm.c", "qti-smmu-proxy-common.c"],
  111. deps = ["%b_smcinvoke_dlkm", ":smmu_proxy_headers"],
  112. )