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>
This commit is contained in:
@@ -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
|
||||
|
@@ -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 */
|
||||
|
Reference in New Issue
Block a user