1#------------------------------------------------------------------------------- 2# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved. 3# 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 11# 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) 16 17# If not found, download it 18if(NOT LINUX_FFA_USER_SHIM_INCLUDE_DIR) 19 20 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 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" 26 CACHE STRING "Linux FF-A user space shim git refspec") 27 28 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.") 30 31 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 40 ) 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 48 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() 56 57set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS 58 "${LINUX_FFA_USER_SHIM_INCLUDE_DIR}/arm_ffa_user.h") 59