blob: 24ebfafc5491d1334caf989e02b9118f317a8b59 [file] [log] [blame]
Stefan Reinauer36c83402009-03-01 10:16:01 +00001/*
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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauer36c83402009-03-01 10:16:01 +000018 */
19
20#ifndef __TYPES_H
21#define __TYPES_H
22#include <stdint.h>
23#include <stddef.h>
Stefan Reinauer36c83402009-03-01 10:16:01 +000024
Alexandru Gagniuca4d784e2015-01-25 21:08:42 -060025/*
26 * This may mean something else on architectures where the bits are numbered
27 * from the MSB (e.g. PowerPC), but until we cross that bridge, this macro is
28 * perfectly fine.
29 */
30#define BIT(x) (1ul << (x))
31
Alexandru Gagniucfe9e30d2013-11-23 17:46:04 -060032/**
33 * Coreboot error codes
34 *
35 * When building functions that return a status or an error code, use cb_err as
36 * the return type. When failure reason needs to be communicated by the return
37 * value, define a it here. Start new enum groups with values in decrements of
38 * 100.
39 */
40enum cb_err {
41 CB_SUCCESS = 0, /**< Call completed succesfully */
42 CB_ERR = -1, /**< Generic error code */
43 CB_ERR_ARG = -2, /**< Invalid argument */
Alexandru Gagniucd7134e02013-11-23 18:54:44 -060044
45 /* NVRAM/CMOS errors */
46 CB_CMOS_OTABLE_DISABLED = -100, /**< Option table disabled */
47 CB_CMOS_LAYOUT_NOT_FOUND = -101, /**< Layout file not found */
48 CB_CMOS_OPTION_NOT_FOUND = -102, /**< Option string not found */
49 CB_CMOS_ACCESS_ERROR = -103, /**< CMOS access error */
50 CB_CMOS_CHECKSUM_INVALID = -104, /**< CMOS checksum is invalid */
Vladimir Serbinenko63e35f22014-01-26 03:55:01 +010051
52 /* Keyboard test failures */
53 CB_KBD_CONTROLLER_FAILURE = -200,
54 CB_KBD_INTERFACE_FAILURE = -201
Alexandru Gagniucfe9e30d2013-11-23 17:46:04 -060055};
56
57#endif /* __TYPES_H */