From 98eeb961353d187a26085a07889bd0414cdaa910 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Wed, 11 Dec 2019 15:47:42 -0800 Subject: 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 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 (written by me) and (same stuff exists in libpayload). Finally, I am extracting the cb_err error code definitions from 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/38420 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/include/fmap.h | 2 +- src/include/types.h | 33 +-------------------------------- 2 files changed, 2 insertions(+), 33 deletions(-) (limited to 'src/include') 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 #include -#include /* 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 #include #include #include @@ -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 */ -- cgit v1.2.3