1
0

securemsm-kernel: Add support for snake case smci headers

Add new smci headers that support snake case APIs, structures and macros.
Tests Done: scipp_test

Change-Id: Ie0e9529929722529ffe112f9ceadc667e58a0dd0
Signed-off-by: Ujjawal Sankhwar <quic_usankhwa@quicinc.com>
Este cometimento está contido em:
Ujjawal Sankhwar
2024-05-20 11:32:04 +05:30
ascendente fd37da76a2
cometimento f090258a21
11 ficheiros modificados com 682 adições e 1 eliminações

Ver ficheiro

@@ -2,12 +2,15 @@ headers_src = [
"include/uapi/linux/smc*ke.h",
"include/linux/smc*_object.h",
"include/linux/IClientE*v.h",
"include/linux/smc*_clientenv.h",
]
smcinvoke_headers_out = [
"include/linux/smcinvoke.h",
"include/linux/smcinvoke_object.h",
"include/linux/smci_object.h",
"include/linux/IClientEnv.h",
"include/linux/smci_clientenv.h",
]
smcinvoke_kernel_headers_verbose = "--verbose "
@@ -25,7 +28,7 @@ genrule {
smcinvoke_kernel_headers_verbose +
"--header_arch arm64 " +
"--gen_dir $(genDir) " +
"--smcinvoke_headers_to_expose $(locations include/uapi/linux/smc*ke.h) $(locations include/linux/smc*_object.h) $(locations include/linux/IClientE*v.h) " +
"--smcinvoke_headers_to_expose $(locations include/uapi/linux/smc*ke.h) $(locations include/linux/smc*_object.h) $(locations include/linux/IClientE*v.h) $(locations include/linux/smc*_clientenv.h) " +
"--unifdef $(location unifdef) " +
"--headers_install $(location headers_install.sh)",
out: smcinvoke_headers_out,

Ver ficheiro

@@ -10,8 +10,12 @@ ddk_headers(
name = "smcinvoke_kernel_headers",
hdrs = glob([
"include/linux/smcinvoke*.h",
"include/linux/smci_o*.h",
"include/uapi/linux/smcinvoke*.h",
"include/linux/IClientE*.h",
"include/linux/smci_c*.h",
"include/smci/interface/IOpener.h",
"include/smci/interface/smci_opener.h",
"include/linux/ITrustedCameraDriver.h",
"include/linux/CTrustedCameraDriver.h",
]),

108
include/linux/smci_clientenv.h Ficheiro normal
Ver ficheiro

@@ -0,0 +1,108 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __SMCI_CLIENTENV_H
#define __SMCI_CLIENTENV_H
#include "smci_object.h"
#include "IClientEnv.h"
#define SMCI_CLIENTENV_OP_OPEN 0
#define SMCI_CLIENTENV_OP_REGISTERLEGACY 1
#define SMCI_CLIENTENV_OP_REGISTER 2
#define SMCI_CLIENTENV_OP_REGISTERWITHWHITELIST 3
#define SMCI_CLIENTENV_OP_NOTIFYDOMAINCHANGE 4
#define SMCI_CLIENTENV_OP_REGISTERWITHCREDENTIALS 5
#define SMCI_CLIENTENV_OP_LOADCMNLIBFROMBUFFER 6
#define SMCI_CLIENTENV_OP_CONFIGTAREGION 7
#define SMCI_CLIENTENV_OP_ADCIACCEPT 8
#define SMCI_CLIENTENV_OP_ADCISUTDOWN 9
static inline int32_t
smci_clientenv_release(struct smci_object self)
{
return IClientEnv_release(self);
}
static inline int32_t
smci_clientenv_retain(struct smci_object self)
{
return IClientEnv_retain(self);
}
static inline int32_t
smci_clientenv_open(struct smci_object self, uint32_t uid_val, struct smci_object *obj_ptr)
{
return IClientEnv_open(self, uid_val, obj_ptr);
}
static inline int32_t
smci_clientenv_registerlegacy(struct smci_object self, const void *credentials_ptr,
size_t credentials_len, struct smci_object *clientenv_ptr)
{
return IClientEnv_registerLegacy(self, credentials_ptr,
credentials_len, clientenv_ptr);
}
static inline int32_t
smci_clientenv_register(struct smci_object self, struct smci_object credentials_val,
struct smci_object *clientenv_ptr)
{
return IClientEnv_register(self, credentials_val,
clientenv_ptr);
}
static inline int32_t
smci_clientenv_registerwithwhitelist(struct smci_object self,
struct smci_object credentials_val, const uint32_t *uids_ptr,
size_t uids_len, struct smci_object *clientenv_ptr)
{
return IClientEnv_registerWithWhitelist(self,
credentials_val, uids_ptr,
uids_len, clientenv_ptr);
}
static inline int32_t
smc_clientenv_notifydomainchange(struct smci_object self)
{
return IClientEnv_notifyDomainChange(self);
}
static inline int32_t
smci_clientenv_registerwithcredentials(struct smci_object self, struct smci_object
credentials_val, struct smci_object *clientenv_ptr)
{
return IClientEnv_registerWithCredentials(self,
credentials_val, clientenv_ptr);
}
static inline int32_t
smci_clientenv_loadcmnlibfrombuffer(struct smci_object self, const void *cmnlibelf_ptr,
size_t cmnlibelf_len)
{
return IClientEnv_loadCmnlibFromBuffer(self, cmnlibelf_ptr, cmnlibelf_len);
}
static inline int32_t
smci_clientenv_configtaregion(struct smci_object self, uint64_t apprgnaddr_val,
uint32_t apprgnsize_val)
{
return IClientEnv_configTaRegion(self, apprgnaddr_val, apprgnsize_val);
}
static inline int32_t
smci_clientenv_adciaccept(struct smci_object self)
{
return IClientEnv_adciAccept(self);
}
static inline int32_t
smci_clientenv_adcishutdown(struct smci_object self)
{
return IClientEnv_adciShutdown(self);
}
#endif /* __SMCI_CLIENTENV_H */

151
include/linux/smci_object.h Ficheiro normal
Ver ficheiro

@@ -0,0 +1,151 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __SMCI_OBJECT_H
#define __SMCI_OBJECT_H
#include <linux/types.h>
#include <linux/firmware.h>
#include <linux/qtee_shmbridge.h>
#include "smcinvoke.h"
#include "smcinvoke_object.h"
/*
* Method bits are not modified by transport layers. These describe the
* method (member function) being requested by the client.
*/
#define SMCI_OBJECT_OP_METHOD_MASK (0x0000FFFFu)
#define SMCI_OBJECT_OP_METHODID(op) ((op) & SMCI_OBJECT_OP_METHOD_MASK)
#define SMCI_OBJECT_OP_RELEASE (SMCI_OBJECT_OP_METHOD_MASK - 0)
#define SMCI_OBJECT_OP_RETAIN (SMCI_OBJECT_OP_METHOD_MASK - 1)
#define SMCI_OBJECT_OP_MAP_REGION 0
#define SMCI_OBJECT_OP_YIELD 1
#define SMCI_OBJECT_OP_SLEEP 2
#define SMCI_OBJECT_COUNTS_MAX_BI 0xF
#define SMCI_OBJECT_COUNTS_MAX_BO 0xF
#define SMCI_OBJECT_COUNTS_MAX_OI 0xF
#define SMCI_OBJECT_COUNTS_MAX_OO 0xF
/* unpack counts */
#define SMCI_OBJECT_COUNTS_NUM_BI(k) ((size_t) (((k) >> 0) & SMCI_OBJECT_COUNTS_MAX_BI))
#define SMCI_OBJECT_COUNTS_NUM_BO(k) ((size_t) (((k) >> 4) & SMCI_OBJECT_COUNTS_MAX_BO))
#define SMCI_OBJECT_COUNTS_NUM_OI(k) ((size_t) (((k) >> 8) & SMCI_OBJECT_COUNTS_MAX_OI))
#define SMCI_OBJECT_COUNTS_NUM_OO(k) ((size_t) (((k) >> 12) & SMCI_OBJECT_COUNTS_MAX_OO))
#define SMCI_OBJECT_COUNTS_NUM_BUFFERS(k) \
(SMCI_OBJECT_COUNTS_NUM_BI(k) + SMCI_OBJECT_COUNTS_NUM_BO(k))
#define SMCI_OBJECT_COUNTS_NUM_OBJECTS(k) \
(SMCI_OBJECT_COUNTS_NUM_OI(k) + SMCI_OBJECT_COUNTS_NUM_OO(k))
/* Indices into args[] */
#define SMCI_OBJECT_COUNTS_INDEX_BI(k) 0
#define SMCI_OBJECT_COUNTS_INDEX_BO(k) \
(SMCI_OBJECT_COUNTS_INDEX_BI(k) + SMCI_OBJECT_COUNTS_NUM_BI(k))
#define SMCI_OBJECT_COUNTS_INDEX_OI(k) \
(SMCI_OBJECT_COUNTS_INDEX_BO(k) + SMCI_OBJECT_COUNTS_NUM_BO(k))
#define SMCI_OBJECT_COUNTS_INDEX_OO(k) \
(SMCI_OBJECT_COUNTS_INDEX_OI(k) + SMCI_OBJECT_COUNTS_NUM_OI(k))
#define SMCI_OBJECT_COUNTS_TOTAL(k) \
(SMCI_OBJECT_COUNTS_INDEX_OO(k) + SMCI_OBJECT_COUNTS_NUM_OO(k))
#define SMCI_OBJECT_COUNTS_PACK(in_bufs, out_bufs, in_objs, out_objs) \
((uint32_t) ((in_bufs) | ((out_bufs) << 4) | \
((in_objs) << 8) | ((out_objs) << 12)))
#define SMCI_OBJECT_COUNTS_INDEX_BUFFERS(k) SMCI_OBJECT_COUNTS_INDEX_BI(k)
/* Object_invoke return codes */
#define SMCI_OBJECT_IS_OK(err) ((err) == 0)
#define SMCI_OBJECT_IS_ERROR(err) ((err) != 0)
/* Generic error codes */
#define SMCI_OBJECT_OK 0 /* non-specific success code */
#define SMCI_OBJECT_ERROR 1 /* non-specific error */
#define SMCI_OBJECT_ERROR_INVALID 2 /* unsupported/unrecognized request */
#define SMCI_OBJECT_ERROR_SIZE_IN 3 /* supplied buffer/string too large */
#define SMCI_OBJECT_ERROR_SIZE_OUT 4 /* supplied output buffer too small */
#define SMCI_OBJECT_ERROR_USERBASE 10 /* start of user-defined error range */
/* Transport layer error codes */
#define SMCI_OBJECT_ERROR_DEFUNCT -90 /* smci_object no longer exists */
#define SMCI_OBJECT_ERROR_ABORT -91 /* calling thread must exit */
#define SMCI_OBJECT_ERROR_BADOBJ -92 /* invalid smci_object context */
#define SMCI_OBJECT_ERROR_NOSLOTS -93 /* caller's smci_object table full */
#define SMCI_OBJECT_ERROR_MAXARGS -94 /* too many args */
#define SMCI_OBJECT_ERROR_MAXDATA -95 /* buffers too large */
#define SMCI_OBJECT_ERROR_UNAVAIL -96 /* the request could not be processed */
#define SMCI_OBJECT_ERROR_KMEM -97 /* kernel out of memory */
#define SMCI_OBJECT_ERROR_REMOTE -98 /* local method sent to remote smci_object */
#define SMCI_OBJECT_ERROR_BUSY -99 /* smci_object is busy */
#define SMCI_OBJECT_ERROR_TIMEOUT -103 /* Call Back smci_object invocation timed out. */
/* smci_objectop */
#define SMCI_OBJECT_OP_LOCAL ((uint32_t) 0x00008000U)
#define SMCI_OBJECT_OP_IS_LOCAL(op) (((op) & SMCI_OBJECT_OP_LOCAL) != 0)
/* smci_object */
#define SMCI_OBJECTCOUNTS_PACK(nbuffersin, nbuffersout, nobjectsin, nobjectsout) \
((uint32_t) ((nbuffersin) | \
((nbuffersout) << 4) | \
((nobjectsin) << 8) | \
((nobjectsout) << 12)))
#define smci_object_arg ObjectArg
#define smci_objectinvoke ObjectInvoke
#define smci_object Object
#define smci_object_buf ObjectBuf
#define smci_object_buf_in ObjectBufIn
static inline int32_t smci_object_invoke(struct smci_object o, uint32_t op,
union smci_object_arg *args, uint32_t k)
{
return Object_invoke(o, op, args, k);
}
#define SMCI_OBJECT_NULL ((struct smci_object){NULL, NULL})
#define SMCI_OBJECT_NOT_RETAINED
#define SMCI_OBJECT_CONSUMED
static inline int32_t smci_object_release(SMCI_OBJECT_CONSUMED struct smci_object o)
{
return Object_release(o);
}
static inline int32_t smci_object_retain(struct smci_object o)
{
return Object_retain(o);
}
#define SMCI_OBJECT_IS_NULL(o) ((o).invoke == NULL)
#define SMCI_OBJECT_RELEASE_IF(o) \
do { \
struct smci_object o_ = (o); \
if (!SMCI_OBJECT_IS_NULL(o_)) \
(void) smci_object_release(o_); \
} while (0)
static inline void smci_object_replace(struct smci_object *loc, struct smci_object obj_new)
{
Object_replace(loc, obj_new);
}
#define SMCI_OBJECT_ASSIGN_NULL(loc) smci_object_replace(&(loc), SMCI_OBJECT_NULL)
#endif /* __SMCI_OBJECT_H */

Ver ficheiro

@@ -0,0 +1,41 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __SMCI_APPCLIENT_H
#define __SMCI_APPCLIENT_H
#include "smci_object.h"
#include "IAppClient.h"
#define SMCI_APPCLIENT_ERROR_APP_NOT_FOUND INT32_C(10)
#define SMCI_APPCLIENT_ERROR_APP_RESTART_FAILED INT32_C(11)
#define SMCI_APPCLIENT_ERROR_APP_UNTRUSTED_CLIENT INT32_C(12)
#define SMCI_APPCLIENT_ERROR_CLIENT_CRED_PARSING_FAILURE INT32_C(13)
#define SMCI_APPCLIENT_ERROR_APP_LOAD_FAILED INT32_C(14)
#define SMCI_APPCLIENT_UID (0x97)
#define SMCI_APPCLIENT_OP_GETAPPOBJECT 0
static inline int32_t
smci_appclient_release(struct smci_object self)
{
return IAppClient_release(self);
}
static inline int32_t
smci_appclient_retain(struct smci_object self)
{
return IAppClient_retain(self);
}
static inline int32_t
smci_appclient_getappobject(struct smci_object self, const void *app_dist_name_ptr,
size_t app_dist_name_len, struct smci_object *obj_ptr)
{
return IAppClient_getAppObject(self, app_dist_name_ptr,
app_dist_name_len, obj_ptr);
}
#endif /* __SMCI_APPCLIENT_H */

Ver ficheiro

@@ -0,0 +1,100 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __SMCI_APPCONTROLLER_H
#define __SMCI_APPCONTROLLER_H
#include "smci_object.h"
#include "IAppController.h"
#define SMCI_APPCONTROLLER_CBO_INTERFACE_WAIT UINT32_C(1)
#define SMCI_APPCONTROLLER_ERROR_APP_SUSPENDED INT32_C(10)
#define SMCI_APPCONTROLLER_ERROR_APP_BLOCKED_ON_LISTENER INT32_C(11)
#define SMCI_APPCONTROLLER_ERROR_APP_UNLOADED INT32_C(12)
#define SMCI_APPCONTROLLER_ERROR_APP_IN_USE INT32_C(13)
#define SMCI_APPCONTROLLER_ERROR_NOT_SUPPORTED INT32_C(14)
#define SMCI_APPCONTROLLER_ERROR_CBO_UNKNOWN INT32_C(15)
#define SMCI_APPCONTROLLER_ERROR_APP_UNLOAD_NOT_ALLOWED INT32_C(16)
#define SMCI_APPCONTROLLER_ERROR_APP_DISCONNECTED INT32_C(17)
#define SMCI_APPCONTROLLER_ERROR_USER_DISCONNECT_REJECTED INT32_C(18)
#define SMCI_APPCONTROLLER_ERROR_STILL_RUNNING INT32_C(19)
#define SMCI_APPCONTROLLER_OP_OPENSESSION 0
#define SMCI_APPCONTROLLER_OP_UNLOAD 1
#define SMCI_APPCONTROLLER_OP_GETAPPOBJECT 2
#define SMCI_APPCONTROLLER_OP_INSTALLCBO 3
#define SMCI_APPCONTROLLER_OP_DISCONNECT 4
#define SMCI_APPCONTROLLER_OP_RESTART 5
static inline int32_t
smci_appcontroller_release(struct smci_object self)
{
return IAppController_release(self);
}
static inline int32_t
smci_appcontroller_retain(struct smci_object self)
{
return IAppController_retain(self);
}
static inline int32_t
smci_appcontroller_opensession(struct smci_object self, uint32_t cancel_code_val,
uint32_t connection_method_val, uint32_t connection_data_val, uint32_t param_types_val,
uint32_t ex_param_types_val, const void *i1_ptr, size_t i1_len, const void *i2_ptr,
size_t i2_len, const void *i3_ptr, size_t i3_len, const void *i4_ptr, size_t i4_len,
void *o1_ptr, size_t o1_len, size_t *o1_lenout, void *o2_ptr, size_t o2_len,
size_t *o2_lenout, void *o3_ptr, size_t o3_len, size_t *o3_lenout, void *o4_ptr,
size_t o4_len, size_t *o4_lenout, struct smci_object imem1_val,
struct smci_object imem2_val, struct smci_object imem3_val, struct smci_object imem4_val,
uint32_t *memref_out_sz1_ptr, uint32_t *memref_out_sz2_ptr, uint32_t *memref_out_sz3_ptr,
uint32_t *memref_out_sz4_ptr, struct smci_object *session_ptr, uint32_t *ret_value_ptr,
uint32_t *ret_origin_ptr)
{
return IAppController_openSession(self, cancel_code_val,
connection_method_val, connection_data_val, param_types_val,
ex_param_types_val, i1_ptr, i1_len, i2_ptr,
i2_len, i3_ptr, i3_len, i4_ptr, i4_len,
o1_ptr, o1_len, o1_lenout, o2_ptr, o2_len,
o2_lenout, o3_ptr, o3_len, o3_lenout, o4_ptr,
o4_len, o4_lenout, imem1_val,
imem2_val, imem3_val, imem4_val,
memref_out_sz1_ptr, memref_out_sz2_ptr, memref_out_sz3_ptr,
memref_out_sz4_ptr, session_ptr, ret_value_ptr,
ret_origin_ptr);
}
static inline int32_t
smci_appcontroller_unload(struct smci_object self)
{
return IAppController_unload(self);
}
static inline int32_t
smci_appcontroller_getappobject(struct smci_object self, struct smci_object *obj_ptr)
{
return IAppController_getAppObject(self, obj_ptr);
}
static inline int32_t
smci_appcontroller_installcbo(struct smci_object self, uint32_t uid_val, struct smci_object obj_val)
{
return IAppController_installCBO(self, uid_val, obj_val);
}
static inline int32_t
smci_appcontroller_disconnect(struct smci_object self)
{
return IAppController_disconnect(self);
}
static inline int32_t
smci_appcontroller_restart(struct smci_object self)
{
return IAppController_restart(self);
}
#endif /* __SMCI_APPCONTROLLER_H */

Ver ficheiro

@@ -0,0 +1,79 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __SMCI_APPLOADER_H
#define __SMCI_APPLOADER_H
#include "smci_object.h"
#include "smci_appcontroller.h"
#include "IAppLoader.h"
#define SMCI_APPLOADER_ERROR_INVALID_BUFFER INT32_C(10)
#define SMCI_APPLOADER_ERROR_PIL_ROLLBACK_FAILURE INT32_C(11)
#define SMCI_APPLOADER_ERROR_ELF_SIGNATURE_ERROR INT32_C(12)
#define SMCI_APPLOADER_ERROR_METADATA_INVALID INT32_C(13)
#define SMCI_APPLOADER_ERROR_MAX_NUM_APPS INT32_C(14)
#define SMCI_APPLOADER_ERROR_NO_NAME_IN_METADATA INT32_C(15)
#define SMCI_APPLOADER_ERROR_ALREADY_LOADED INT32_C(16)
#define SMCI_APPLOADER_ERROR_EMBEDDED_IMAGE_NOT_FOUND INT32_C(17)
#define SMCI_APPLOADER_ERROR_TZ_HEAP_MALLOC_FAILURE INT32_C(18)
#define SMCI_APPLOADER_ERROR_TA_APP_REGION_MALLOC_FAILURE INT32_C(19)
#define SMCI_APPLOADER_ERROR_CLIENT_CRED_PARSING_FAILURE INT32_C(20)
#define SMCI_APPLOADER_ERROR_APP_UNTRUSTED_CLIENT INT32_C(21)
#define SMCI_APPLOADER_ERROR_APP_NOT_LOADED INT32_C(22)
#define SMCI_APPLOADER_ERROR_APP_MAX_CLIENT_CONNECTIONS INT32_C(23)
#define SMCI_APPLOADER_ERROR_APP_BLACKLISTED INT32_C(24)
#define SMCI_APPLOADER_OP_LOADFROMBUFFER 0
#define SMCI_APPLOADER_OP_LOADFROMREGION 1
#define SMCI_APPLOADER_OP_LOADEMBEDDED 2
#define SMCI_APPLOADER_OP_CONNECT 3
#define SMCI_APPLOADER_UID (0x3)
static inline int32_t
smci_apploader_release(struct smci_object self)
{
return IAppLoader_release(self);
}
static inline int32_t
smci_apploader_retain(struct smci_object self)
{
return IAppLoader_retain(self);
}
static inline int32_t
smci_apploader_loadfrombuffer(struct smci_object self, const void *appelf_ptr, size_t appelf_len,
struct smci_object *appcontroller_ptr)
{
return IAppLoader_loadFromBuffer(self, appelf_ptr, appelf_len,
appcontroller_ptr);
}
static inline int32_t
smci_apploader_loadfromregion(struct smci_object self, struct smci_object appelf_val,
struct smci_object *appcontroller_ptr)
{
return IAppLoader_loadFromRegion(self, appelf_val,
appcontroller_ptr);
}
static inline int32_t
smci_apploader_loadembedded(struct smci_object self, const void *appname_ptr, size_t appname_len,
struct smci_object *appcontroller_ptr)
{
return IAppLoader_loadEmbedded(self, appname_ptr, appname_len,
appcontroller_ptr);
}
static inline int32_t
smci_apploader_connect(struct smci_object self, const void *appname_ptr, size_t appname_len,
struct smci_object *appcontroller_ptr)
{
return IAppLoader_connect(self, appname_ptr, appname_len,
appcontroller_ptr);
}
#endif /* __SMCI_APPLOADER_H */

Ver ficheiro

@@ -0,0 +1,40 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __SMCI_OPENER_H
#define __SMCI_OPENER_H
#include "smci_object.h"
#include "IOpener.h"
/** 0 is not a valid service ID. */
#define SMCI_OPENER_INVALID_ID UINT32_C(0)
#define SMCI_OPENER_ERROR_NOT_FOUND INT32_C(10)
#define SMCI_OPENER_ERROR_PRIVILEGE INT32_C(11)
#define SMCI_OPENER_ERROR_NOT_SUPPORTED INT32_C(12)
#define SMCI_OPENER_OP_OPEN 0
static inline int32_t
smci_opener_release(struct smci_object self)
{
return IOpener_release(self);
}
static inline int32_t
smci_opener_retain(struct smci_object self)
{
return IOpener_retain(self);
}
static inline int32_t
smci_opener_open(struct smci_object self, uint32_t id_val, struct smci_object *obj_ptr)
{
return IOpener_open(self, id_val, obj_ptr);
}
#endif /* __SMCI_OPENER_H */

Ver ficheiro

@@ -69,7 +69,9 @@ register_securemsm_module(
"smcinvoke_kernel.c",
"trace_smcinvoke.h",
"IQSEEComCompat.h",
"smci_qseecomcompat.h",
"IQSEEComCompatAppLoader.h",
"smci_qseecomcompatapploader.h",
],
deps = [":smcinvoke_kernel_headers", ":qseecom_kernel_headers", "%b_qseecom_dlkm"],
hdrs = [":smcinvoke_kernel_headers"],
@@ -90,16 +92,22 @@ register_securemsm_module(
"hdcp_qseecom.h",
"hdcp_main.c",
"smcinvoke_object.h",
"smci_object.h",
"hdcp_main.h",
"hdcp_smcinvoke.c",
"hdcp_smcinvoke.h",
"CAppClient.h",
"CAppLoader.h",
"IAppClient.h",
"smci_appclient.h",
"IAppController.h",
"smci_appcontroller.h",
"IAppLoader.h",
"smci_apploader.h",
"IClientEnv.h",
"smci_clientenv.h",
"IOpener.h",
"smci_opener.h",
"hdcp1.h",
"hdcp1_ops.h",
"hdcp2p2.h",

64
smcinvoke/smci_qseecomcompat.h Ficheiro normal
Ver ficheiro

@@ -0,0 +1,64 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __SMCI_QSEECOMCOMPAT_H
#define __SMCI_QSEECOMCOMPAT_H
#include "smci_object.h"
#include "IQSEEComCompat.h"
#define SMCI_QSEECOMCOMPAT_ERROR_APP_UNAVAILABLE INT32_C(10)
#define SMCI_QSEECOMCOMPAT_OP_SENDREQUEST 0
#define SMCI_QSEECOMCOMPAT_OP_DISCONNECT 1
#define SMCI_QSEECOMCOMPAT_OP_UNLOAD 2
static inline int32_t
smci_qseecomcompat_release(struct smci_object self)
{
return IQSEEComCompat_release(self);
}
static inline int32_t
smci_qseecomcompat_retain(struct smci_object self)
{
return IQSEEComCompat_retain(self);
}
static inline int32_t
smci_qseecomcompat_sendrequest(struct smci_object self,
const void *req_in_ptr, size_t req_in_len,
const void *rsp_in_ptr, size_t rsp_in_len,
void *req_out_ptr, size_t req_out_len, size_t *req_out_lenout,
void *rsp_out_ptr, size_t rsp_out_len, size_t *rsp_out_lenout,
const uint32_t *embedded_buf_offsets_ptr,
size_t embedded_buf_offsets_len, uint32_t is64_val,
struct smci_object smo1_val, struct smci_object smo2_val,
struct smci_object smo3_val, struct smci_object smo4_val)
{
return IQSEEComCompat_sendRequest(self,
req_in_ptr, req_in_len,
rsp_in_ptr, rsp_in_len,
req_out_ptr, req_out_len, req_out_lenout,
rsp_out_ptr, rsp_out_len, rsp_out_lenout,
embedded_buf_offsets_ptr,
embedded_buf_offsets_len, is64_val,
smo1_val, smo2_val,
smo3_val, smo4_val);
}
static inline int32_t
smci_qseecomcompat_disconnect(struct smci_object self)
{
return IQSEEComCompat_disconnect(self);
}
static inline int32_t
smci_qseecomcompat_unload(struct smci_object self)
{
return IQSEEComCompat_unload(self);
}
#endif /* __SMCI_QSEECOMCOMPAT_H */

Ver ficheiro

@@ -0,0 +1,83 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __SMCI_QSEECOMCOMPATAPPLOADER_H
#define __SMCI_QSEECOMCOMPATAPPLOADER_H
#include "smci_object.h"
#include "IQSEEComCompatAppLoader.h"
#define SMCI_QSEECOMCOMPATAPPLOADER_MAX_FILENAME_LEN UINT32_C(64)
#define SMCI_QSEECOMCOMPATAPPLOADER_ELFCLASS32 UINT32_C(1)
#define SMCI_QSEECOMCOMPATAPPLOADER_ELFCLASS64 UINT32_C(2)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_INVALID_BUFFER INT32_C(10)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_PIL_ROLLBACK_FAILURE INT32_C(11)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_ELF_SIGNATURE_ERROR INT32_C(12)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_METADATA_INVALID INT32_C(13)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_MAX_NUM_APPS INT32_C(14)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_NO_NAME_IN_METADATA INT32_C(15)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_ALREADY_LOADED INT32_C(16)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_EMBEDDED_IMAGE_NOT_FOUND INT32_C(17)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_TZ_HEAP_MALLOC_FAILURE INT32_C(18)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_TA_APP_REGION_MALLOC_FAILURE INT32_C(19)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_CLIENT_CRED_PARSING_FAILURE INT32_C(20)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_APP_UNTRUSTED_CLIENT INT32_C(21)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_APP_BLACKLISTED INT32_C(22)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_APP_NOT_LOADED INT32_C(23)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_NOT_QSEECOM_COMPAT_APP INT32_C(24)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_FILENAME_TOO_LONG INT32_C(25)
#define SMCI_QSEECOMCOMPATAPPLOADER_ERROR_APP_ARCH_NOT_SUPPORTED INT32_C(26)
#define SMCI_QSEECOMCOMPATAPPLOADER_OP_LOADFROMREGION 0
#define SMCI_QSEECOMCOMPATAPPLOADER_OP_LOADFROMBUFFER 1
#define SMCI_QSEECOMCOMPATAPPLOADER_OP_LOOKUPTA 2
static inline int32_t
smci_qseecomcompatapploader_release(struct smci_object self)
{
return IQSEEComCompatAppLoader_release(self);
}
static inline int32_t
smci_qseecomcompatapploader_retain(struct smci_object self)
{
return IQSEEComCompatAppLoader_retain(self);
}
static inline int32_t
smci_qseecomcompatapploader_loadfromregion(struct smci_object self,
struct smci_object app_elf_val, const void *filename_ptr,
size_t filename_len, struct smci_object *app_compat_ptr)
{
return IQSEEComCompatAppLoader_loadFromRegion(self,
app_elf_val, filename_ptr,
filename_len, app_compat_ptr);
}
static inline int32_t
smci_qseecomcompatapploader_loadfrombuffer(struct smci_object self,
const void *app_elf_ptr, size_t app_elf_len,
const void *filename_ptr, size_t filename_len,
void *dist_name_ptr, size_t dist_name_len,
size_t *dist_name_lenout, struct smci_object *app_compat_ptr)
{
return IQSEEComCompatAppLoader_loadFromBuffer(self,
app_elf_ptr, app_elf_len,
filename_ptr, filename_len,
dist_name_ptr, dist_name_len,
dist_name_lenout, app_compat_ptr);
}
static inline int32_t
smci_qseecomcompatapploader_lookupta(struct smci_object self, const void *app_name_ptr,
size_t app_name_len, struct smci_object *app_compat_ptr)
{
return IQSEEComCompatAppLoader_lookupTA(self, app_name_ptr,
app_name_len, app_compat_ptr);
}
#endif /* __SMCI_QSEECOMCOMPATAPPLOADER_H */