xref: /aosp_15_r20/external/coreboot/src/commonlib/bsd/include/commonlib/bsd/cb_err.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
2 
3 #ifndef _COMMONLIB_BSD_CB_ERR_H_
4 #define _COMMONLIB_BSD_CB_ERR_H_
5 
6 #include <stdint.h>
7 
8 /**
9  * coreboot error codes
10  *
11  * Common error definitions that can be used for any function. All error values
12  * should be negative -- when useful, positive values can also be used to denote
13  * success. Allocate a new group or errors every 100 values.
14  */
15 enum cb_err {
16 	CB_SUCCESS = 0,			/**< Call completed successfully */
17 	CB_ERR = -1,			/**< Generic error code */
18 	CB_ERR_ARG = -2,		/**< Invalid argument */
19 	CB_ERR_NOT_IMPLEMENTED = -3,	/**< Function not implemented */
20 
21 	/* NVRAM/CMOS errors */
22 	CB_CMOS_OTABLE_DISABLED = -100,		/**< Option table disabled */
23 	CB_CMOS_LAYOUT_NOT_FOUND = -101,	/**< Layout file not found */
24 	CB_CMOS_OPTION_NOT_FOUND = -102,	/**< Option string not found */
25 	CB_CMOS_ACCESS_ERROR = -103,		/**< CMOS access error */
26 	CB_CMOS_CHECKSUM_INVALID = -104,	/**< CMOS checksum is invalid */
27 
28 	/* Keyboard test failures */
29 	CB_KBD_CONTROLLER_FAILURE = -200,
30 	CB_KBD_INTERFACE_FAILURE = -201,
31 
32 	/* I2C controller failures */
33 	CB_I2C_NO_DEVICE	= -300,	/**< Device is not responding */
34 	CB_I2C_BUSY		= -301,	/**< Device tells it's busy */
35 	CB_I2C_PROTOCOL_ERROR	= -302,	/**< Data lost or spurious slave
36 					     device response, try again? */
37 	CB_I2C_TIMEOUT		= -303, /**< Transmission timed out */
38 
39 	/* CBFS errors */
40 	CB_CBFS_IO		= -400, /**< Underlying I/O error */
41 	CB_CBFS_NOT_FOUND	= -401, /**< File not found in directory */
42 	CB_CBFS_HASH_MISMATCH	= -402, /**< Master hash validation failed */
43 	CB_CBFS_CACHE_FULL	= -403, /**< Metadata cache overflowed */
44 
45 	/* EFI errors */
46 	CB_EFI_FVH_INVALID		= -500, /**< UEFI FVH (Firmware Volume Header) is corrupted */
47 	CB_EFI_CHECKSUM_INVALID		= -501, /**< UEFI FVH checksum is invalid */
48 	CB_EFI_VS_NOT_FORMATTED_INVALID	= -502, /**< UEFI variable store not formatted */
49 	CB_EFI_VS_CORRUPTED_INVALID	= -503, /**< UEFI variable store is corrupted */
50 	CB_EFI_ACCESS_ERROR		= -504, /**< UEFI variable store access error */
51 	CB_EFI_STORE_FULL		= -505, /**< UEFI variable store is full */
52 	CB_EFI_OPTION_NOT_FOUND		= -506, /**< UEFI variable not found */
53 	CB_EFI_BUFFER_TOO_SMALL		= -507, /**< UEFI Buffer is too small. */
54 };
55 
56 #endif	/* _COMMONLIB_BSD_CB_ERR_H_ */
57