blob: c0a985187205a7145ee1f0a1786f1c3d80500218 [file] [log] [blame]
Balint Dobszay1b631eb2021-01-15 11:09:36 +01001#-------------------------------------------------------------------------------
Gyorgy Szinga82134a2023-02-10 15:07:29 +01002# Copyright (c) 2020-2023, 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")
Gyorgy Szinga82134a2023-02-10 15:07:29 +010022
23 # Note: the aim of this external component is to make the header file defining the IOCTL API
24 # available. Fetching a moving reference is ok as long as API compatibility is guaranteed.
25 set(LINUX_FFA_USER_SHIM_REFSPEC "origin/debugfs-v5"
Mark Dykes19e80282022-07-19 10:22:05 -050026 CACHE STRING "Linux FF-A user space shim git refspec")
Balint Dobszay1b631eb2021-01-15 11:09:36 +010027
Mark Dykes19e80282022-07-19 10:22:05 -050028 set(LINUX_FFA_USER_SHIM_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/linux_ffa_user_shim-src"
29 CACHE PATH "Location of Linux driver source.")
Balint Dobszay1b631eb2021-01-15 11:09:36 +010030
Mark Dykes19e80282022-07-19 10:22:05 -050031 if (DEFINED ENV{LINUX_FFA_USER_SHIM_SOURCE_DIR})
32 set(LINUX_FFA_USER_SHIM_SOURCE_DIR $ENV{LINUX_FFA_USER_SHIM_SOURCE_DIR}
33 CACHE PATH "Location of Linux driver source." FORCE)
34 endif()
35
36 set(GIT_OPTIONS
37 GIT_REPOSITORY ${LINUX_FFA_USER_SHIM_URL}
38 GIT_TAG ${LINUX_FFA_USER_SHIM_REFSPEC}
39 GIT_SHALLOW FALSE
Gyorgy Szing96669942021-12-08 04:19:50 +010040 )
41 include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED)
42 LazyFetch_MakeAvailable(
43 DEP_NAME linux_ffa_user_shim
44 FETCH_OPTIONS "${GIT_OPTIONS}"
45 SOURCE_DIR ${LINUX_FFA_USER_SHIM_SOURCE_DIR}
46 )
47
Mark Dykes19e80282022-07-19 10:22:05 -050048 find_path(LINUX_FFA_USER_SHIM_INCLUDE_DIR
49 NAMES arm_ffa_user.h
50 PATHS ${LINUX_FFA_USER_SHIM_SOURCE_DIR}
51 NO_DEFAULT_PATH
52 REQUIRED
53 DOC "Linux FF-A user space shim include directory"
54 )
55endif()
Gyorgy Szing96669942021-12-08 04:19:50 +010056
57set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
58 "${LINUX_FFA_USER_SHIM_INCLUDE_DIR}/arm_ffa_user.h")