summaryrefstree
path: root/kernel/security/tz_iccc/tz_iccc.h
blob: b917ebf5e4141b4010f11d8b4f4b900a498956c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef TZ_ICCC_H
#define TZ_ICCC_H

/* ICCC Implementation in Kernel */

#include <../../drivers/gud/gud-exynos7420/MobiCoreKernelApi/public/mobicore_driver_api.h>
#include <../../drivers/gud/gud-exynos7420/MobiCoreKernelApi/public/mobicore_driver_cmd.h>
#include <linux/security/Iccc_Interface.h>
#include <linux/selinux.h>

#define TL_TZ_ICCC_UUID {{ 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41 }}

#define CMD_ICCC_INIT                     0x00000001
#define CMD_ICCC_SAVEDATA                 0x00000002
#define CMD_ICCC_READDATA                 0x00000003

#define	RET_ICCC_SUCCESS		 0
#define	RET_ICCC_FAIL			-1

#define ICCC_READ 1
#define ICCC_WRITE 2

#define MIN_PADDING_NEEDED 9

typedef struct tz_msg_header {
	/* * First 4 bytes should always be id: either cmd_id or resp_id */
	uint32_t id;
	uint32_t content_id;
	uint32_t len;
	uint32_t status;
} __attribute__ ((packed)) tz_msg_header_t;

typedef struct iccc_req_s
{
    uint32_t cmd_id;
	uint32_t type;
	uint32_t value;
	uint32_t padding[MIN_PADDING_NEEDED];    //only padding , just to make tciMessage_t's size >= 64
} __attribute__ ((packed)) iccc_req_t;

typedef struct iccc_rsp_s
{
    uint32_t cmd_id;
	uint32_t type;
    uint32_t value;
	int ret;
} __attribute__ ((packed)) iccc_rsp_t;
 
typedef struct {
	union content_u {
        iccc_req_t           iccc_req;
        iccc_rsp_t           iccc_rsp;
    } __attribute__ ((packed)) content;
} __attribute__ ((packed)) iccc_generic_payload_t;

typedef struct {
	tz_msg_header_t header;
    union payload_u {
        iccc_generic_payload_t generic;
    } __attribute__ ((packed)) payload;
} __attribute__ ((packed)) iccc_message_t;

typedef iccc_message_t tciMessage_t;

#endif	/* TZ_ICCC_H */