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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
/*
* Samsung Exynos SoC series NPU driver
*
* Copyright (c) 2017 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
/*
PURGE : Intend of this command is clean-up a session in device driver.
Firmware shoud immediatly clean-up all the outstanting requests(Both processing and
network management) for specified uid. Firmware should response with DONE
message after the clean-up is completed. If the clean-up was unsuccessful,
the firmware will resonse NDONE message and driver will forcefully restart
NPU hardware. Before the firmware response DONE message for PURGE request,
DONE/NDONE response for outstanding processing requsests are generated.
Driver should properly handle those replies.
POWER_DOWN : Intentd of this command is make the NPU ready for power down.
Driver send this command to notify the NPU is about to power down. It implies
PURGE request for all valid uid - Firmware should clean-up all the out-standing
requests at once. After the clean-up is completed, Firmware should make sure that
there is no outstanding bus request to outside of NPU. After the check is done,
Firmware should issue WFI call to allow the NPU go power down safely and reply
DONE message via mailbox.
*/
#ifndef MAILBOX_MSG_H_
#define MAILBOX_MSG_H_
/*
* * +-----------------------------+ ------------
* * | Mailbox #4 | |
* * +-----------------------------+ |
* * | Mailbox #3 | |
* * | | |
* * +-----------------------------+ |
* * | Mailbox #2 | 16K
* * | | (= NPU_MAILBOX_SIZE)
* * +-----------------------------+ |
* * | Mailbox #1 | |
* * | | |
* * +-----------------------------+ ---- |
* * | Padding | | |
* * +-----------------------------+ 4K |
* * | struct mailbox_hdr | | |
* * +-----------------------------+ ----------- <- npu_mailbox->mbox_base by Eung ju kim
* */
#define COMMAND_VERSION 6
#define MESSAGE_MAX_CNT 32
#define MESSAGE_MAGIC 0xC0DECAFE
#define MESSAGE_MARK 0xCAFEC0DE
/* payload size of load includes only ncp header */
struct cmd_load {
u32 oid; /* object id */
u32 tid; /* task id */
};
struct cmd_unload {
u32 oid;
};
struct cmd_process {
u32 oid;
u32 fid; /* frame id */
};
struct cmd_profile_ctl {
u32 ctl;
};
struct cmd_purge {
u32 oid;
};
struct cmd_powerdown {
u32 dummy;
};
struct cmd_done {
u32 fid;
};
struct cmd_ndone {
u32 fid;
u32 error; /* error code */
};
struct cmd_group_done {
u32 group_idx; /* group index points one element of group vector array */
};
struct cmd_fw_test {
u32 param; /* Number of testcase to be executed */
};
enum message_cmd {
COMMAND_LOAD,
COMMAND_UNLOAD,
COMMAND_PROCESS,
COMMAND_PROFILE_CTL,
COMMAND_PURGE,
COMMAND_POWERDOWN,
COMMAND_FW_TEST,
COMMAND_H2F_MAX_ID,
COMMAND_DONE = 100,
COMMAND_NDONE,
COMMNAD_GROUP_DONE,
COMMNAD_ROLLOVER,
COMMAND_MAX_ID,
COMMAND_F2H_MAX_ID
};
enum profile_ctl_code {
PROFILE_CTL_CODE_START, /* length: Size of profiling buffer, */
/* payload: dvaddr of profiling buffer */
PROFILE_CTL_CODE_STOP, /* length: 0, payload: 0 */
};
struct message {
u32 magic; /* magic number */
u32 mid; /* message id */
u32 command;
u32 length; /* size in bytes */
u32 self; /* self pointer */
u32 data; /* the pointer of command */
};
struct command {
union {
struct cmd_load load;
struct cmd_unload unload;
struct cmd_process process;
struct cmd_profile_ctl profile_ctl;
struct cmd_fw_test fw_test;
struct cmd_purge purge;
struct cmd_powerdown powerdown;
struct cmd_done done;
struct cmd_ndone ndone;
struct cmd_group_done gdone;
} c; /* specific command properties */
u32 length; /* the size of payload */
u32 payload;
};
#endif /* MAILBOX_MSG_H_ */
|