Balint Dobszay | 1b631eb | 2021-01-15 11:09:36 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Gyorgy Szing | a82134a | 2023-02-10 15:07:29 +0100 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved. |
Balint Dobszay | 1b631eb | 2021-01-15 11:09:36 +0100 | [diff] [blame] | 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 | |
Mark Dykes | 19e8028 | 2022-07-19 10:22:05 -0500 | [diff] [blame] | 11 | # If the driver is already installed, try to find that |
| 12 | find_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 Dobszay | 1b631eb | 2021-01-15 11:09:36 +0100 | [diff] [blame] | 16 | |
Mark Dykes | 19e8028 | 2022-07-19 10:22:05 -0500 | [diff] [blame] | 17 | # If not found, download it |
| 18 | if(NOT LINUX_FFA_USER_SHIM_INCLUDE_DIR) |
Balint Dobszay | 1b631eb | 2021-01-15 11:09:36 +0100 | [diff] [blame] | 19 | |
Mark Dykes | 19e8028 | 2022-07-19 10:22:05 -0500 | [diff] [blame] | 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") |
Gyorgy Szing | a82134a | 2023-02-10 15:07:29 +0100 | [diff] [blame] | 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" |
Mark Dykes | 19e8028 | 2022-07-19 10:22:05 -0500 | [diff] [blame] | 26 | CACHE STRING "Linux FF-A user space shim git refspec") |
Balint Dobszay | 1b631eb | 2021-01-15 11:09:36 +0100 | [diff] [blame] | 27 | |
Mark Dykes | 19e8028 | 2022-07-19 10:22:05 -0500 | [diff] [blame] | 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.") |
Balint Dobszay | 1b631eb | 2021-01-15 11:09:36 +0100 | [diff] [blame] | 30 | |
Mark Dykes | 19e8028 | 2022-07-19 10:22:05 -0500 | [diff] [blame] | 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 |
Gyorgy Szing | 9666994 | 2021-12-08 04:19:50 +0100 | [diff] [blame] | 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 | |
Mark Dykes | 19e8028 | 2022-07-19 10:22:05 -0500 | [diff] [blame] | 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 | ) |
| 55 | endif() |
Gyorgy Szing | 9666994 | 2021-12-08 04:19:50 +0100 | [diff] [blame] | 56 | |
| 57 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS |
| 58 | "${LINUX_FFA_USER_SHIM_INCLUDE_DIR}/arm_ffa_user.h") |