blob: a4d82242eeb82438cde62be884ff4ae8264b8982 [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.
Stefan Reinauer36c83402009-03-01 10:16:01 +000014 */
15
16#ifndef __TYPES_H
17#define __TYPES_H
18#include <stdint.h>
19#include <stddef.h>
Stefan Reinauer36c83402009-03-01 10:16:01 +000020
Alexandru Gagniuca4d784e2015-01-25 21:08:42 -060021/*
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 Gagniucfe9e30d2013-11-23 17:46:04 -060028/**
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 */
36enum cb_err {
37 CB_SUCCESS = 0, /**< Call completed succesfully */
38 CB_ERR = -1, /**< Generic error code */
39 CB_ERR_ARG = -2, /**< Invalid argument */
Alexandru Gagniucd7134e02013-11-23 18:54:44 -060040
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 Serbinenko63e35f22014-01-26 03:55:01 +010047
48 /* Keyboard test failures */
49 CB_KBD_CONTROLLER_FAILURE = -200,
50 CB_KBD_INTERFACE_FAILURE = -201
Alexandru Gagniucfe9e30d2013-11-23 17:46:04 -060051};
52
53#endif /* __TYPES_H */