# Copyright 2023 The Hafnium Authors.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/BSD-3-Clause.

import("//build/image/image.gni")

config("config") {
  include_dirs = [
    "//test/vmapi/common/arch/aarch64/inc/",
    "//test/vmapi/common/arch/aarch64/secure/inc",
    "//test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/inc",
    "//test/inc",
  ]
}

source_set("sp_helpers") {
  testonly = true
  public_configs = [
    ":config",
    "//src/arch/aarch64:arch_config",
  ]
  sources = [ "sp_helpers.c" ]
}

vm_kernel("sel0_partition") {
  testonly = true

  deps = [
    ":sp_helpers",
    "//src/arch/aarch64/hftest/el0:interrupts",
    "//test/hftest:hftest_sel0_partition_base",
    "//test/vmapi/common/arch/aarch64/el0:exception_handler",
    "//test/vmapi/common/arch/aarch64/secure:twdog",
    "//test/vmapi/common/arch/aarch64/system_timer:ap_refclk",
    "//test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure:message_loop",
  ]
}

manifest("partition_manifest_service_sp_second") {
  source = "partition_manifest_service_sp_second.dts"
  output = "partition_manifest_service_sp_second.dtb"
}

partition_package("service_sp_second_package") {
  testonly = true
  pm_offset = "0x1000"
  img_offset = "0x2000"
  files = [ [
        "partition_manifest_service_sp_second.dtb",
        "sel0_partition.bin",
        ":partition_manifest_service_sp_second",
        ":sel0_partition",
      ] ]
  output = "service_sp_second_el0_package.img"
}
