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