blob: d774c24a0dee26b992b7868390b8b6474edc4e99 [file] [log] [blame]
Balint Dobszay61d2d3b2022-02-14 14:08:53 +01001#-------------------------------------------------------------------------------
Gyorgy Szinga82134a2023-02-10 15:07:29 +01002# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
Balint Dobszay61d2d3b2022-02-14 14:08:53 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8# If the driver is already installed, try to find that
9find_path(LINUX_FFA_TEE_DRIVER_INCLUDE_DIR
10 NAMES arm_ffa_tee.h
11 DOC "Linux FF-A TEE driver include directory"
12)
13
14# If not found, download it
15if(NOT LINUX_FFA_TEE_DRIVER_INCLUDE_DIR)
16 set(LINUX_FFA_TEE_DRIVER_URL "https://git.gitlab.arm.com/linux-arm/linux-trusted-services.git"
17 CACHE STRING "Linux FF-A TEE driver repository URL")
Gyorgy Szinga82134a2023-02-10 15:07:29 +010018
19 # Note: the aim of this external component is to make the header file defining the IOCTL API
20 # available. Fetching a moving reference is ok as long as API compatibility is guaranteed.
21 set(LINUX_FFA_TEE_DRIVER_REFSPEC "origin/tee-v1"
Balint Dobszay61d2d3b2022-02-14 14:08:53 +010022 CACHE STRING "Linux FF-A TEE driver git refspec")
23
24 set(LINUX_FFA_TEE_DRIVER_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/linux_ffa_tee_driver-src"
25 CACHE PATH "Location of Linux TEE driver source.")
26
27 if (DEFINED ENV{LINUX_FFA_TEE_DRIVER_SOURCE_DIR})
28 set(LINUX_FFA_TEE_DRIVER_SOURCE_DIR $ENV{LINUX_FFA_TEE_DRIVER_SOURCE_DIR}
29 CACHE PATH "Location of Linux TEE driver source." FORCE)
30 endif()
31
32 set(GIT_OPTIONS
33 GIT_REPOSITORY ${LINUX_FFA_TEE_DRIVER_URL}
34 GIT_TAG ${LINUX_FFA_TEE_DRIVER_REFSPEC}
35 GIT_SHALLOW TRUE
36 )
37 include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED)
38 LazyFetch_MakeAvailable(
39 DEP_NAME linux_ffa_tee_driver
40 FETCH_OPTIONS "${GIT_OPTIONS}"
41 SOURCE_DIR ${LINUX_FFA_TEE_DRIVER_SOURCE_DIR}
42 )
43
44 find_path(LINUX_FFA_TEE_DRIVER_INCLUDE_DIR
45 NAMES arm_ffa_tee.h
46 PATHS ${LINUX_FFA_TEE_DRIVER_SOURCE_DIR}/uapi
47 NO_DEFAULT_PATH
48 REQUIRED
49 DOC "Linux FF-A TEE driver include directory"
50 )
51endif()
52
53set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
54 "${LINUX_FFA_TEE_DRIVER_INCLUDE_DIR}/arm_ffa_tee.h")