Stefan Reinauer | 36c8340 | 2009-03-01 10:16:01 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2009 coresystems GmbH |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Stefan Reinauer | 36c8340 | 2009-03-01 10:16:01 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef __TYPES_H |
| 17 | #define __TYPES_H |
| 18 | #include <stdint.h> |
| 19 | #include <stddef.h> |
Stefan Reinauer | 36c8340 | 2009-03-01 10:16:01 +0000 | [diff] [blame] | 20 | |
Alexandru Gagniuc | a4d784e | 2015-01-25 21:08:42 -0600 | [diff] [blame] | 21 | /* |
| 22 | * This may mean something else on architectures where the bits are numbered |
| 23 | * from the MSB (e.g. PowerPC), but until we cross that bridge, this macro is |
| 24 | * perfectly fine. |
| 25 | */ |
| 26 | #define BIT(x) (1ul << (x)) |
| 27 | |
Alexandru Gagniuc | fe9e30d | 2013-11-23 17:46:04 -0600 | [diff] [blame] | 28 | /** |
| 29 | * Coreboot error codes |
| 30 | * |
| 31 | * When building functions that return a status or an error code, use cb_err as |
| 32 | * the return type. When failure reason needs to be communicated by the return |
| 33 | * value, define a it here. Start new enum groups with values in decrements of |
| 34 | * 100. |
| 35 | */ |
| 36 | enum cb_err { |
| 37 | CB_SUCCESS = 0, /**< Call completed succesfully */ |
| 38 | CB_ERR = -1, /**< Generic error code */ |
| 39 | CB_ERR_ARG = -2, /**< Invalid argument */ |
Alexandru Gagniuc | d7134e0 | 2013-11-23 18:54:44 -0600 | [diff] [blame] | 40 | |
| 41 | /* NVRAM/CMOS errors */ |
| 42 | CB_CMOS_OTABLE_DISABLED = -100, /**< Option table disabled */ |
| 43 | CB_CMOS_LAYOUT_NOT_FOUND = -101, /**< Layout file not found */ |
| 44 | CB_CMOS_OPTION_NOT_FOUND = -102, /**< Option string not found */ |
| 45 | CB_CMOS_ACCESS_ERROR = -103, /**< CMOS access error */ |
| 46 | CB_CMOS_CHECKSUM_INVALID = -104, /**< CMOS checksum is invalid */ |
Vladimir Serbinenko | 63e35f2 | 2014-01-26 03:55:01 +0100 | [diff] [blame] | 47 | |
| 48 | /* Keyboard test failures */ |
| 49 | CB_KBD_CONTROLLER_FAILURE = -200, |
| 50 | CB_KBD_INTERFACE_FAILURE = -201 |
Alexandru Gagniuc | fe9e30d | 2013-11-23 17:46:04 -0600 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | #endif /* __TYPES_H */ |