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