xref: /openbmc/u-boot/include/fsl_secboot_err.h (revision d9b23e26)
1 /*
2  * Copyright 2015 Freescale Semiconductor, Inc.
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #ifndef _FSL_SECBOOT_ERR_H
8 #define _FSL_SECBOOT_ERR_H
9 
10 #define ERROR_ESBC_PAMU_INIT					0x100000
11 #define ERROR_ESBC_SEC_RESET					0x200000
12 #define ERROR_ESBC_SEC_INIT					0x400000
13 #define ERROR_ESBC_SEC_DEQ					0x800000
14 #define ERROR_ESBC_SEC_DEQ_TO					0x1000000
15 #define ERROR_ESBC_SEC_ENQ					0x2000000
16 #define ERROR_ESBC_SEC_JOBQ_STATUS				0x4000000
17 #define ERROR_ESBC_CLIENT_CPUID_NO_MATCH			0x1
18 #define ERROR_ESBC_CLIENT_HDR_LOC				0x2
19 #define ERROR_ESBC_CLIENT_HEADER_BARKER				0x4
20 #define ERROR_ESBC_CLIENT_HEADER_KEY_LEN			0x8
21 #define ERROR_ESBC_CLIENT_HEADER_SIG_LEN			0x10
22 #define ERROR_ESBC_CLIENT_HEADER_KEY_REVOKED			0x11
23 #define ERROR_ESBC_CLIENT_HEADER_INVALID_SRK_NUM_ENTRY		0x12
24 #define ERROR_ESBC_CLIENT_HEADER_INVALID_KEY_NUM		0x13
25 #define ERROR_ESBC_CLIENT_HEADER_INV_SRK_ENTRY_KEYLEN		0x14
26 #define ERROR_ESBC_CLIENT_HEADER_IE_KEY_REVOKED			0x15
27 #define ERROR_ESBC_CLIENT_HEADER_INVALID_IE_NUM_ENTRY		0x16
28 #define ERROR_ESBC_CLIENT_HEADER_INVALID_IE_KEY_NUM		0x17
29 #define ERROR_ESBC_CLIENT_HEADER_INV_IE_ENTRY_KEYLEN		0x18
30 #define ERROR_IE_TABLE_NOT_FOUND				0x19
31 #define ERROR_ESBC_CLIENT_HEADER_KEY_LEN_NOT_TWICE_SIG_LEN	0x20
32 #define ERROR_KEY_TABLE_NOT_FOUND				0x21
33 #define ERROR_ESBC_CLIENT_HEADER_KEY_MOD_1			0x40
34 #define ERROR_ESBC_CLIENT_HEADER_KEY_MOD_2			0x80
35 #define ERROR_ESBC_CLIENT_HEADER_SIG_KEY_MOD			0x100
36 #define ERROR_ESBC_CLIENT_HEADER_SG_ESBC_EP			0x200
37 #define ERROR_ESBC_CLIENT_HASH_COMPARE_KEY			0x400
38 #define ERROR_ESBC_CLIENT_HASH_COMPARE_EM			0x800
39 #define ERROR_ESBC_CLIENT_SSM_TRUSTSTS				0x1000
40 #define ERROR_ESBC_CLIENT_BAD_ADDRESS				0x2000
41 #define ERROR_ESBC_CLIENT_MISC					0x4000
42 #define ERROR_ESBC_CLIENT_HEADER_SG_ENTIRES_BAD			0x8000
43 #define ERROR_ESBC_CLIENT_HEADER_SG				0x10000
44 #define ERROR_ESBC_CLIENT_HEADER_IMG_SIZE			0x20000
45 #define ERROR_ESBC_WRONG_CMD					0x40000
46 #define ERROR_ESBC_MISSING_BOOTM				0x80000
47 #define ERROR_ESBC_CLIENT_MAX					0x0
48 
49 struct fsl_secboot_errcode {
50 	int errcode;
51 	const char *name;
52 };
53 
54 static const struct fsl_secboot_errcode fsl_secboot_errcodes[] = {
55 	{ ERROR_ESBC_PAMU_INIT,
56 		"Error in initializing PAMU"},
57 	{ ERROR_ESBC_SEC_RESET,
58 		"Error in resetting Job ring of SEC"},
59 	{ ERROR_ESBC_SEC_INIT,
60 		"Error in initializing SEC"},
61 	{ ERROR_ESBC_SEC_ENQ,
62 		"Error in enqueue operation by SEC"},
63 	{ ERROR_ESBC_SEC_DEQ_TO,
64 		"Dequeue operation by SEC is timed out"},
65 	{ ERROR_ESBC_SEC_DEQ,
66 		"Error in dequeue operation by SEC"},
67 	{ ERROR_ESBC_SEC_JOBQ_STATUS,
68 		"Error in status of the job submitted to SEC"},
69 	{ ERROR_ESBC_CLIENT_CPUID_NO_MATCH,
70 		"Current core is not boot core i.e core0" },
71 	{ ERROR_ESBC_CLIENT_HDR_LOC,
72 		"Header address not in allowed memory range" },
73 	{ ERROR_ESBC_CLIENT_HEADER_BARKER,
74 		"Wrong barker code in header" },
75 	{ ERROR_ESBC_CLIENT_HEADER_KEY_LEN,
76 		"Wrong public key length in header" },
77 	{ ERROR_ESBC_CLIENT_HEADER_SIG_LEN,
78 		"Wrong signature length in header" },
79 	{ ERROR_ESBC_CLIENT_HEADER_KEY_LEN_NOT_TWICE_SIG_LEN,
80 		"Public key length not twice of signature length" },
81 	{ ERROR_ESBC_CLIENT_HEADER_KEY_MOD_1,
82 		"Public key Modulus most significant bit not set" },
83 	{ ERROR_ESBC_CLIENT_HEADER_KEY_MOD_2,
84 		"Public key Modulus in header not odd" },
85 	{ ERROR_ESBC_CLIENT_HEADER_SIG_KEY_MOD,
86 		"Signature not less than modulus" },
87 	{ ERROR_ESBC_CLIENT_HEADER_SG_ESBC_EP,
88 		"Entry point not in allowed space or one of the SG entries" },
89 	{ ERROR_ESBC_CLIENT_HASH_COMPARE_KEY,
90 		"Public key hash comparison failed" },
91 	{ ERROR_ESBC_CLIENT_HASH_COMPARE_EM,
92 		"RSA verification failed" },
93 	{ ERROR_ESBC_CLIENT_SSM_TRUSTSTS,
94 		"SNVS not in TRUSTED state" },
95 	{ ERROR_ESBC_CLIENT_BAD_ADDRESS,
96 		"Bad address error" },
97 	{ ERROR_ESBC_CLIENT_MISC,
98 		"Miscallaneous error" },
99 	{ ERROR_ESBC_CLIENT_HEADER_SG,
100 		"No SG support"  },
101 	{ ERROR_ESBC_CLIENT_HEADER_IMG_SIZE,
102 		"Invalid Image size"  },
103 	{ ERROR_ESBC_WRONG_CMD,
104 		"Unknown cmd/Wrong arguments. Core in infinite loop"},
105 	{ ERROR_ESBC_MISSING_BOOTM,
106 		"Bootm command missing from bootscript" },
107 	{ ERROR_ESBC_CLIENT_HEADER_KEY_REVOKED,
108 		"Selected key is revoked" },
109 	{ ERROR_ESBC_CLIENT_HEADER_INVALID_SRK_NUM_ENTRY,
110 		"Wrong key entry" },
111 	{ ERROR_ESBC_CLIENT_HEADER_INVALID_KEY_NUM,
112 		"Wrong key is selected" },
113 	{ ERROR_ESBC_CLIENT_HEADER_INV_SRK_ENTRY_KEYLEN,
114 		"Wrong srk public key len in header" },
115 	{ ERROR_ESBC_CLIENT_HEADER_IE_KEY_REVOKED,
116 		"Selected IE key is revoked" },
117 	{ ERROR_ESBC_CLIENT_HEADER_INVALID_IE_NUM_ENTRY,
118 		"Wrong key entry in IE Table" },
119 	{ ERROR_ESBC_CLIENT_HEADER_INVALID_IE_KEY_NUM,
120 		"Wrong IE key is selected" },
121 	{ ERROR_ESBC_CLIENT_HEADER_INV_IE_ENTRY_KEYLEN,
122 		"Wrong IE public key len in header" },
123 	{ ERROR_IE_TABLE_NOT_FOUND,
124 		"Information about IE Table missing" },
125 	{ ERROR_KEY_TABLE_NOT_FOUND,
126 		"No Key/ Key Table Found in header"},
127 	{ ERROR_ESBC_CLIENT_MAX, "NULL" }
128 };
129 
130 void fsl_secboot_handle_error(int error);
131 #endif
132