blob: 09a2bf815a2a15780ace4878c86ba8d41c7d74e2 [file] [log] [blame]
Balint Dobszay1b631eb2021-01-15 11:09:36 +01001#-------------------------------------------------------------------------------
Gyorgy Szing96669942021-12-08 04:19:50 +01002# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
Balint Dobszay1b631eb2021-01-15 11:09:36 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8# Find Linux FF-A user space shim repo location.
9# It contains a kernel module which exposes FF-A operations to user space using DebugFS.
10
Mark Dykes19e80282022-07-19 10:22:05 -050011# If the driver is already installed, try to find that
12find_path(LINUX_FFA_USER_SHIM_INCLUDE_DIR
13 NAMES arm_ffa_user.h
14 DOC "Linux FF-A user space shim driver include directory"
15)
Balint Dobszay1b631eb2021-01-15 11:09:36 +010016
Mark Dykes19e80282022-07-19 10:22:05 -050017# If not found, download it
18if(NOT LINUX_FFA_USER_SHIM_INCLUDE_DIR)
Balint Dobszay1b631eb2021-01-15 11:09:36 +010019
Mark Dykes19e80282022-07-19 10:22:05 -050020 set(LINUX_FFA_USER_SHIM_URL "https://git.gitlab.arm.com/linux-arm/linux-trusted-services.git"
21 CACHE STRING "Linux FF-A user space shim repository URL")
22 set(LINUX_FFA_USER_SHIM_REFSPEC "v5.0.0"
23 CACHE STRING "Linux FF-A user space shim git refspec")
Balint Dobszay1b631eb2021-01-15 11:09:36 +010024
Mark Dykes19e80282022-07-19 10:22:05 -050025 set(LINUX_FFA_USER_SHIM_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/linux_ffa_user_shim-src"
26 CACHE PATH "Location of Linux driver source.")
Balint Dobszay1b631eb2021-01-15 11:09:36 +010027
Mark Dykes19e80282022-07-19 10:22:05 -050028 if (DEFINED ENV{LINUX_FFA_USER_SHIM_SOURCE_DIR})
29 set(LINUX_FFA_USER_SHIM_SOURCE_DIR $ENV{LINUX_FFA_USER_SHIM_SOURCE_DIR}
30 CACHE PATH "Location of Linux driver source." FORCE)
31 endif()
32
33 set(GIT_OPTIONS
34 GIT_REPOSITORY ${LINUX_FFA_USER_SHIM_URL}
35 GIT_TAG ${LINUX_FFA_USER_SHIM_REFSPEC}
36 GIT_SHALLOW FALSE
Gyorgy Szing96669942021-12-08 04:19:50 +010037 )
38 include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED)
39 LazyFetch_MakeAvailable(
40 DEP_NAME linux_ffa_user_shim
41 FETCH_OPTIONS "${GIT_OPTIONS}"
42 SOURCE_DIR ${LINUX_FFA_USER_SHIM_SOURCE_DIR}
43 )
44
Mark Dykes19e80282022-07-19 10:22:05 -050045 find_path(LINUX_FFA_USER_SHIM_INCLUDE_DIR
46 NAMES arm_ffa_user.h
47 PATHS ${LINUX_FFA_USER_SHIM_SOURCE_DIR}
48 NO_DEFAULT_PATH
49 REQUIRED
50 DOC "Linux FF-A user space shim include directory"
51 )
52endif()
Gyorgy Szing96669942021-12-08 04:19:50 +010053
54set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
55 "${LINUX_FFA_USER_SHIM_INCLUDE_DIR}/arm_ffa_user.h")