Align with Linux FF-A driver
The user space driver for FF-A has been updated. Align the necessary
parts and replace the driver header in external.
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: I8bcf601d54e93584f6a9d624bd74039dc12eda18
diff --git a/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake b/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake
new file mode 100644
index 0000000..565017b
--- /dev/null
+++ b/external/LinuxFFAUserShim/LinuxFFAUserShim.cmake
@@ -0,0 +1,54 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+# Find Linux FF-A user space shim repo location.
+# It contains a kernel module which exposes FF-A operations to user space using DebugFS.
+
+# If a CMake variable exists, use it as is.
+# If not, try to copy the value from the environment.
+# If neither is present, try to download.
+if(NOT DEFINED LINUX_FFA_USER_SHIM_DIR)
+ if(DEFINED ENV{LINUX_FFA_USER_SHIM_DIR})
+ set(LINUX_FFA_USER_SHIM_DIR $ENV{LINUX_FFA_USER_SHIM_DIR}
+ CACHE STRING "Linux FF-A user space shim dir")
+ else()
+ set(LINUX_FFA_USER_SHIM_URL "https://git.gitlab.arm.com/linux-arm/linux-trusted-services.git"
+ CACHE STRING "Linux FF-A user space shim repository URL")
+ set(LINUX_FFA_USER_SHIM_REFSPEC "main"
+ CACHE STRING "Linux FF-A user space shim git refspec")
+
+ find_program(GIT_COMMAND "git")
+ if (NOT GIT_COMMAND)
+ message(FATAL_ERROR "Please install git")
+ endif()
+
+ include(FetchContent)
+ FetchContent_Declare(linux_ffa_user_shim
+ GIT_REPOSITORY ${LINUX_FFA_USER_SHIM_URL}
+ GIT_TAG ${LINUX_FFA_USER_SHIM_REFSPEC}
+ GIT_SHALLOW TRUE
+ )
+
+ # FetchContent_GetProperties exports <name>_SOURCE_DIR and <name>_BINARY_DIR variables
+ FetchContent_GetProperties(linux_ffa_user_shim)
+ if(NOT linux_ffa_user_shim_POPULATED)
+ message(STATUS "Fetching Linux FF-A user space shim")
+ FetchContent_Populate(linux_ffa_user_shim)
+ endif()
+
+ set(LINUX_FFA_USER_SHIM_DIR ${linux_ffa_user_shim_SOURCE_DIR}
+ CACHE STRING "Linux FF-A user space shim dir")
+ endif()
+endif()
+
+find_path(LINUX_FFA_USER_SHIM_INCLUDE_DIR
+ NAMES arm_ffa_user.h
+ PATHS ${LINUX_FFA_USER_SHIM_DIR}
+ NO_DEFAULT_PATH
+ REQUIRED
+ DOC "Linux FF-A user space shim include directory"
+)
diff --git a/external/ffa_tool/buf_common.h b/external/ffa_tool/buf_common.h
deleted file mode 100644
index 326bd93..0000000
--- a/external/ffa_tool/buf_common.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef __BUF_COMMON_H
-#define __BUF_COMMON_H
-
-#ifdef __KERNEL__
-#include <linux/types.h>
-#include <uapi/asm-generic/ioctl.h>
-#else
-#include <stdint.h>
-#include <sys/ioctl.h>
-#endif
-
-struct buf_descr {
- uint8_t *buf;
- size_t length;
-};
-
-struct msg_args {
- uint16_t dst_id;
- uint32_t args[5];
-};
-
-struct endpoint_id {
- uint32_t uuid_0;
- uint32_t uuid_1;
- uint32_t uuid_2;
- uint32_t uuid_3;
- uint16_t id;
-};
-
-#define IOCTL_TYPE 0xf0
-
-#define GET_PART_ID _IOWR(IOCTL_TYPE, 0x00, struct endpoint_id)
-#define SEND_SYNC_MSG _IOWR(IOCTL_TYPE, 0x01, struct msg_args)
-
-#define SHARE_INIT _IOR(IOCTL_TYPE, 0x10, unsigned long)
-#define SHARE_DEINIT _IO(IOCTL_TYPE, 0x11)
-#define SHARE_READ _IOW(IOCTL_TYPE, 0x12, struct buf_descr)
-#define SHARE_WRITE _IOW(IOCTL_TYPE, 0x13, struct buf_descr)
-
-#endif /* __BUF_COMMON_H */