diff options
author | Julius Werner <jwerner@chromium.org> | 2019-12-11 15:47:42 -0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2020-01-28 06:36:13 +0000 |
commit | 98eeb961353d187a26085a07889bd0414cdaa910 (patch) | |
tree | b97e2edbdb5033a93095044be96c809271bd0be8 /src/include | |
parent | e4d6c033fe91cf777a95531669622f7829e6b44d (diff) | |
download | coreboot-98eeb961353d187a26085a07889bd0414cdaa910.tar.xz |
commonlib: Add commonlib/bsd
This patch creates a new commonlib/bsd subdirectory with a similar
purpose to the existing commonlib, with the difference that all files
under this subdirectory shall be licensed under the BSD-3-Clause license
(or compatible permissive license). The goal is to allow more code to be
shared with libpayload in the future.
Initially, I'm going to move a few files there that have already been
BSD-licensed in the existing commonlib. I am also exracting most
contents of the often-needed <commonlib/helpers.h> as long as they have
either been written by me (and are hereby relicensed) or have an
existing equivalent in BSD-licensed libpayload code. I am also
relicensing <commonlib/compression.h> (written by me) and
<commonlib/compiler.h> (same stuff exists in libpayload).
Finally, I am extracting the cb_err error code definitions from
<types.h> into a new BSD-licensed header so that future commonlib/bsd
code can build upon a common set of error values. I am making the
assumption here that the enum constants and the half-sentence fragments
of documentation next to them by themselves do not meet the threshold of
copyrightability.
Change-Id: I316cea70930f131e8e93d4218542ddb5ae4b63a2
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38420
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/fmap.h | 2 | ||||
-rw-r--r-- | src/include/types.h | 33 |
2 files changed, 2 insertions, 33 deletions
diff --git a/src/include/fmap.h b/src/include/fmap.h index 649ecc0000..9c974cea2e 100644 --- a/src/include/fmap.h +++ b/src/include/fmap.h @@ -16,8 +16,8 @@ #ifndef _FMAP_H_ #define _FMAP_H_ +#include <commonlib/bsd/fmap_serialized.h> #include <commonlib/region.h> -#include <commonlib/fmap_serialized.h> /* Locate the named area in the fmap and fill in a region device representing * that area. The region is a sub-region of the readonly boot media. Return diff --git a/src/include/types.h b/src/include/types.h index 30f243ff99..ffb14c9db4 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -17,6 +17,7 @@ #define __TYPES_H /* types.h is supposed to provide the standard headers defined in here: */ +#include <commonlib/bsd/cb_err.h> #include <stdbool.h> #include <stdint.h> #include <stddef.h> @@ -30,36 +31,4 @@ #define BIT(x) (1ul << (x)) #endif -/** - * coreboot error codes - * - * When building functions that return a status or an error code, use cb_err as - * the return type. When failure reason needs to be communicated by the return - * value, define a it here. Start new enum groups with values in decrements of - * 100. - */ -enum cb_err { - CB_SUCCESS = 0, /**< Call completed successfully */ - CB_ERR = -1, /**< Generic error code */ - CB_ERR_ARG = -2, /**< Invalid argument */ - - /* NVRAM/CMOS errors */ - CB_CMOS_OTABLE_DISABLED = -100, /**< Option table disabled */ - CB_CMOS_LAYOUT_NOT_FOUND = -101, /**< Layout file not found */ - CB_CMOS_OPTION_NOT_FOUND = -102, /**< Option string not found */ - CB_CMOS_ACCESS_ERROR = -103, /**< CMOS access error */ - CB_CMOS_CHECKSUM_INVALID = -104, /**< CMOS checksum is invalid */ - - /* Keyboard test failures */ - CB_KBD_CONTROLLER_FAILURE = -200, - CB_KBD_INTERFACE_FAILURE = -201, - - /* I2C controller failures */ - CB_I2C_NO_DEVICE = -300, /**< Device is not responding */ - CB_I2C_BUSY = -301, /**< Device tells it's busy */ - CB_I2C_PROTOCOL_ERROR = -302, /**< Data lost or spurious slave - device response, try again? */ - CB_I2C_TIMEOUT = -303, /**< Transmission timed out */ -}; - #endif /* __TYPES_H */ |