xref: /rk3399_rockchip-uboot/include/optee_include/OpteeClientRPC.h (revision 7b9ee69be599bd672f1111a38fad4e6b08c23c0f)
1abdd2437Shisping /*
2abdd2437Shisping  * Copyright 2017, Rockchip Electronics Co., Ltd
3abdd2437Shisping  * hisping lin, <hisping.lin@rock-chips.com>
4abdd2437Shisping  *
5abdd2437Shisping  * SPDX-License-Identifier:	GPL-2.0+
6abdd2437Shisping  */
7*7b9ee69bSHisping Lin #ifndef _OPTEE_CLIENT_RPC_H_
8*7b9ee69bSHisping Lin #define _OPTEE_CLIENT_RPC_H_
9*7b9ee69bSHisping Lin 
10abdd2437Shisping #include <optee_include/tee_base_types.h>
11abdd2437Shisping #include <optee_include/OpteeClientApiLib.h>
12abdd2437Shisping 
13abdd2437Shisping typedef struct{
14abdd2437Shisping 	unsigned int Arg0;
15abdd2437Shisping 	unsigned int Arg1;
16abdd2437Shisping 	unsigned int Arg2;
17abdd2437Shisping 	unsigned int Arg3;
18abdd2437Shisping 	unsigned int Arg4;
19abdd2437Shisping 	unsigned int Arg5;
20abdd2437Shisping 	unsigned int Arg6;
21abdd2437Shisping 	unsigned int Arg7;
22abdd2437Shisping } ARM_SMC_ARGS;
23abdd2437Shisping 
24abdd2437Shisping #define RPMB_PACKET_DATA_TO_UINT16(d) ((d[0] << 8) + (d[1]))
25abdd2437Shisping #define RPMB_PACKET_DATA_TO_UINT16(d) ((d[0] << 8) + (d[1]))
26abdd2437Shisping #define RPMB_STUFF_DATA_SIZE                        196
27abdd2437Shisping #define RPMB_KEY_MAC_SIZE                           32
28abdd2437Shisping #define RPMB_DATA_SIZE                              256
29abdd2437Shisping #define RPMB_NONCE_SIZE                             16
30abdd2437Shisping #define RPMB_DATA_FRAME_SIZE                        512
31abdd2437Shisping 
32abdd2437Shisping typedef struct rpmb_data_frame {
33abdd2437Shisping 	unsigned char stuff_bytes[RPMB_STUFF_DATA_SIZE];
34abdd2437Shisping 	unsigned char key_mac[RPMB_KEY_MAC_SIZE];
35abdd2437Shisping 	unsigned char data[RPMB_DATA_SIZE];
36abdd2437Shisping 	unsigned char nonce[RPMB_NONCE_SIZE];
37abdd2437Shisping 	unsigned char write_counter[4];
38abdd2437Shisping 	unsigned char address[2];
39abdd2437Shisping 	unsigned char block_count[2];
40abdd2437Shisping 	unsigned char op_result[2];
41abdd2437Shisping 	unsigned char msg_type[2];
42abdd2437Shisping } EFI_RK_RPMB_DATA_PACKET;
43abdd2437Shisping 
44abdd2437Shisping typedef struct s_rpmb_back {
45abdd2437Shisping 	unsigned char stuff[RPMB_STUFF_DATA_SIZE];
46abdd2437Shisping 	unsigned char mac[RPMB_KEY_MAC_SIZE];
47abdd2437Shisping 	unsigned char data[RPMB_DATA_SIZE];
48abdd2437Shisping 	unsigned char nonce[RPMB_NONCE_SIZE];
49abdd2437Shisping 	unsigned int write_counter;
50abdd2437Shisping 	unsigned short address;
51abdd2437Shisping 	unsigned short block_count;
52abdd2437Shisping 	unsigned short result;
53abdd2437Shisping 	unsigned short request;
54abdd2437Shisping } EFI_RK_RPMB_DATA_PACKET_BACK;
55abdd2437Shisping 
56abdd2437Shisping TEEC_Result OpteeRpcCallback(ARM_SMC_ARGS *ArmSmcArgs);
57*7b9ee69bSHisping Lin 
58*7b9ee69bSHisping Lin #endif /*_OPTEE_CLIENT_RPC_H_*/
59