14 #define SPRINTFCAT(str, format, param, max_alloc) \
18 tmp = kmalloc(sizeof(format) + max_alloc, GFP_ATOMIC); \
19 sprintf(tmp, format, param); \
24 static void report_jump_idx(
u32 status,
char *outstr)
30 strcat(outstr,
"jump tgt desc idx ");
32 strcat(outstr,
"desc idx ");
34 SPRINTFCAT(outstr,
"%d: ", idx,
sizeof(
"255"));
37 static void report_ccb_status(
u32 status,
char *outstr)
39 char *cha_id_list[] = {
54 char *err_id_list[] = {
59 "PKHA A memory size error.",
60 "PKHA B memory size error.",
61 "Data arrived out of sequence error.",
62 "PKHA divide-by-zero error.",
63 "PKHA modulus even error.",
64 "DES key parity error.",
67 "Unsupported CCM AAD size.",
68 "Class 1 CHA is not reset",
69 "Invalid CHA combination was selected",
70 "Invalid CHA selected.",
72 char *rng_err_id_list[] = {
79 "Prediction resistance",
80 "Prediction resistance and test request",
82 "Secure key generation",
88 report_jump_idx(status, outstr);
91 SPRINTFCAT(outstr,
"%s: ", cha_id_list[cha_id],
92 strlen(cha_id_list[cha_id]));
94 SPRINTFCAT(outstr,
"unidentified cha_id value 0x%02x: ",
95 cha_id,
sizeof(
"ff"));
100 strlen(rng_err_id_list[err_id])) {
102 SPRINTFCAT(outstr,
"%s", rng_err_id_list[err_id],
103 strlen(rng_err_id_list[err_id]));
104 }
else if (err_id <
ARRAY_SIZE(err_id_list)) {
106 strlen(err_id_list[err_id]));
108 SPRINTFCAT(outstr,
"unidentified err_id value 0x%02x",
109 err_id,
sizeof(
"ff"));
113 static void report_jump_status(
u32 status,
char *outstr)
115 SPRINTFCAT(outstr,
"%s() not implemented", __func__,
sizeof(__func__));
118 static void report_deco_status(
u32 status,
char *outstr)
123 } desc_error_list[] = {
124 { 0x00,
"No error." },
125 { 0x01,
"SGT Length Error. The descriptor is trying to read "
126 "more data than is contained in the SGT table." },
127 { 0x02,
"SGT Null Entry Error." },
128 { 0x03,
"Job Ring Control Error. There is a bad value in the "
129 "Job Ring Control register." },
130 { 0x04,
"Invalid Descriptor Command. The Descriptor Command "
131 "field is invalid." },
132 { 0x05,
"Reserved." },
133 { 0x06,
"Invalid KEY Command" },
134 { 0x07,
"Invalid LOAD Command" },
135 { 0x08,
"Invalid STORE Command" },
136 { 0x09,
"Invalid OPERATION Command" },
137 { 0x0A,
"Invalid FIFO LOAD Command" },
138 { 0x0B,
"Invalid FIFO STORE Command" },
139 { 0x0C,
"Invalid MOVE/MOVE_LEN Command" },
140 { 0x0D,
"Invalid JUMP Command. A nonlocal JUMP Command is "
141 "invalid because the target is not a Job Header "
142 "Command, or the jump is from a Trusted Descriptor to "
143 "a Job Descriptor, or because the target Descriptor "
144 "contains a Shared Descriptor." },
145 { 0x0E,
"Invalid MATH Command" },
146 { 0x0F,
"Invalid SIGNATURE Command" },
147 { 0x10,
"Invalid Sequence Command. A SEQ IN PTR OR SEQ OUT PTR "
148 "Command is invalid or a SEQ KEY, SEQ LOAD, SEQ FIFO "
149 "LOAD, or SEQ FIFO STORE decremented the input or "
150 "output sequence length below 0. This error may result "
151 "if a built-in PROTOCOL Command has encountered a "
153 { 0x11,
"Skip data type invalid. The type must be 0xE or 0xF."},
154 { 0x12,
"Shared Descriptor Header Error" },
155 { 0x13,
"Header Error. Invalid length or parity, or certain "
157 { 0x14,
"Burster Error. Burster has gotten to an illegal "
159 { 0x15,
"Context Register Length Error. The descriptor is "
160 "trying to read or write past the end of the Context "
161 "Register. A SEQ LOAD or SEQ STORE with the VLF bit "
162 "set was executed with too large a length in the "
163 "variable length register (VSOL for SEQ STORE or VSIL "
165 { 0x16,
"DMA Error" },
166 { 0x17,
"Reserved." },
167 { 0x1A,
"Job failed due to JR reset" },
168 { 0x1B,
"Job failed due to Fail Mode" },
169 { 0x1C,
"DECO Watchdog timer timeout error" },
170 { 0x1D,
"DECO tried to copy a key from another DECO but the "
171 "other DECO's Key Registers were locked" },
172 { 0x1E,
"DECO attempted to copy data from a DECO that had an "
173 "unmasked Descriptor error" },
174 { 0x1F,
"LIODN error. DECO was trying to share from itself or "
175 "from another DECO but the two Non-SEQ LIODN values "
176 "didn't match or the 'shared from' DECO's Descriptor "
177 "required that the SEQ LIODNs be the same and they "
179 { 0x20,
"DECO has completed a reset initiated via the DRR "
181 { 0x21,
"Nonce error. When using EKT (CCM) key encryption "
182 "option in the FIFO STORE Command, the Nonce counter "
183 "reached its maximum value and this encryption mode "
184 "can no longer be used." },
185 { 0x22,
"Meta data is too large (> 511 bytes) for TLS decap "
186 "(input frame; block ciphers) and IPsec decap (output "
187 "frame, when doing the next header byte update) and "
188 "DCRC (output frame)." },
189 { 0x23,
"Read Input Frame error" },
190 { 0x24,
"JDKEK, TDKEK or TDSK not loaded error" },
191 { 0x80,
"DNR (do not run) error" },
192 { 0x81,
"undefined protocol command" },
193 { 0x82,
"invalid setting in PDB" },
194 { 0x83,
"Anti-replay LATE error" },
195 { 0x84,
"Anti-replay REPLAY error" },
196 { 0x85,
"Sequence number overflow" },
197 { 0x86,
"Sigver invalid signature" },
198 { 0x87,
"DSA Sign Illegal test descriptor" },
199 { 0x88,
"Protocol Format Error - A protocol has seen an error "
200 "in the format of data received. When running RSA, "
201 "this means that formatting with random padding was "
202 "used, and did not follow the form: 0x00, 0x02, 8-to-N "
203 "bytes of non-zero pad, 0x00, F data." },
204 { 0x89,
"Protocol Size Error - A protocol has seen an error in "
205 "size. When running RSA, pdb size N < (size of F) when "
206 "no formatting is used; or pdb size N < (F + 11) when "
207 "formatting is used." },
208 { 0xC1,
"Blob Command error: Undefined mode" },
209 { 0xC2,
"Blob Command error: Secure Memory Blob mode error" },
210 { 0xC4,
"Blob Command error: Black Blob key or input size "
212 { 0xC5,
"Blob Command error: Invalid key destination" },
213 { 0xC8,
"Blob Command error: Trusted/Secure mode error" },
214 { 0xF0,
"IPsec TTL or hop limit field either came in as 0, "
215 "or was decremented to 0" },
216 { 0xF1,
"3GPP HFN matches or exceeds the Threshold" },
221 report_jump_idx(status, outstr);
223 for (i = 0; i <
ARRAY_SIZE(desc_error_list); i++)
224 if (desc_error_list[i].
value == desc_error)
227 if (i !=
ARRAY_SIZE(desc_error_list) && desc_error_list[
i].error_text) {
228 SPRINTFCAT(outstr,
"%s", desc_error_list[i].error_text,
229 strlen(desc_error_list[i].error_text));
231 SPRINTFCAT(outstr,
"unidentified error value 0x%02x",
232 desc_error,
sizeof(
"ff"));
236 static void report_jr_status(
u32 status,
char *outstr)
238 SPRINTFCAT(outstr,
"%s() not implemented", __func__,
sizeof(__func__));
241 static void report_cond_code_status(
u32 status,
char *outstr)
243 SPRINTFCAT(outstr,
"%s() not implemented", __func__,
sizeof(__func__));
252 {
NULL,
"No error" },
254 { report_ccb_status,
"CCB" },
255 { report_jump_status,
"Jump" },
256 { report_deco_status,
"DECO" },
258 { report_jr_status,
"Job Ring" },
259 { report_cond_code_status,
"Condition Code" },
265 if (status_src[ssrc].report_ssed)
266 status_src[ssrc].report_ssed(status, outstr);