commonlib/bsd: Remove cb_err_t
cb_err_t was meant to be used in place of `enum cb_err` in all situations, but the choice to use a typedef here seems to be controversial. We should not be arbitrarily using two different identifiers for the same thing across the codebase, so since there are no use cases for serializing enum cb_err at the moment (which would be the primary reason to typedef a fixed-width integer instead), remove cb_err_t again for now. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Iaec36210d129db26d51f0a105d3de070c03b686b Reviewed-on: https://review.coreboot.org/c/coreboot/+/62600 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
parent
270b0b60ac
commit
69cc557cfb
|
@ -7,6 +7,6 @@
|
|||
#include <stddef.h>
|
||||
|
||||
/* Looks for area with |name| in FlashMap. Requires lib_sysinfo.fmap_cache. */
|
||||
cb_err_t fmap_locate_area(const char *name, size_t *offset, size_t *size);
|
||||
enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size);
|
||||
|
||||
#endif /* _FMAP_H */
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
/* Private fmap cache. */
|
||||
static struct fmap *_fmap_cache;
|
||||
|
||||
static cb_err_t fmap_find_area(struct fmap *fmap, const char *name, size_t *offset,
|
||||
size_t *size)
|
||||
static enum cb_err fmap_find_area(struct fmap *fmap, const char *name, size_t *offset,
|
||||
size_t *size)
|
||||
{
|
||||
for (size_t i = 0; i < le32toh(fmap->nareas); ++i) {
|
||||
if (strncmp((const char *)fmap->areas[i].name, name, FMAP_STRLEN) != 0)
|
||||
|
@ -71,7 +71,7 @@ static bool fmap_setup_cache(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
cb_err_t fmap_locate_area(const char *name, size_t *offset, size_t *size)
|
||||
enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size)
|
||||
{
|
||||
if (!_fmap_cache && !fmap_setup_cache())
|
||||
return CB_ERR;
|
||||
|
|
|
@ -48,7 +48,7 @@ ssize_t _cbfs_boot_lookup(const char *name, bool force_ro, union cbfs_mdata *mda
|
|||
return CB_ERR;
|
||||
|
||||
size_t data_offset;
|
||||
cb_err_t err = CB_CBFS_CACHE_FULL;
|
||||
enum cb_err err = CB_CBFS_CACHE_FULL;
|
||||
if (cbd->mcache_size)
|
||||
err = cbfs_mcache_lookup(cbd->mcache, cbd->mcache_size, name, mdata,
|
||||
&data_offset);
|
||||
|
|
|
@ -40,7 +40,7 @@ size_t ulz4fn(const void *src, size_t srcn, void *dst, size_t dstn)
|
|||
|
||||
static size_t test_fmap_offset = 0;
|
||||
static size_t test_fmap_size = 0;
|
||||
static cb_err_t test_fmap_result = CB_SUCCESS;
|
||||
static enum cb_err test_fmap_result = CB_SUCCESS;
|
||||
|
||||
static void set_fmap_locate_area_results(size_t offset, size_t size, size_t result)
|
||||
{
|
||||
|
@ -49,15 +49,15 @@ static void set_fmap_locate_area_results(size_t offset, size_t size, size_t resu
|
|||
test_fmap_result = result;
|
||||
}
|
||||
|
||||
cb_err_t fmap_locate_area(const char *name, size_t *offset, size_t *size)
|
||||
enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size)
|
||||
{
|
||||
*offset = test_fmap_offset;
|
||||
*size = test_fmap_size;
|
||||
return test_fmap_result;
|
||||
}
|
||||
|
||||
cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out)
|
||||
enum cb_err cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out)
|
||||
{
|
||||
assert_non_null(mcache);
|
||||
assert_true(mcache_size > 0 && mcache_size % CBFS_MCACHE_ALIGNMENT == 0);
|
||||
|
@ -66,7 +66,7 @@ cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *
|
|||
|
||||
check_expected(name);
|
||||
|
||||
cb_err_t ret = mock_type(cb_err_t);
|
||||
enum cb_err ret = mock_type(enum cb_err);
|
||||
if (ret != CB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@ -75,7 +75,7 @@ cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *
|
|||
return CB_SUCCESS;
|
||||
}
|
||||
|
||||
static void expect_cbfs_mcache_lookup(const char *name, cb_err_t err,
|
||||
static void expect_cbfs_mcache_lookup(const char *name, enum cb_err err,
|
||||
const union cbfs_mdata *mdata, size_t data_offset_out)
|
||||
{
|
||||
expect_string(cbfs_mcache_lookup, name, name);
|
||||
|
@ -87,13 +87,13 @@ static void expect_cbfs_mcache_lookup(const char *name, cb_err_t err,
|
|||
}
|
||||
}
|
||||
|
||||
cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
enum cb_err cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
{
|
||||
assert_non_null(dev);
|
||||
check_expected(name);
|
||||
|
||||
cb_err_t ret = mock_type(cb_err_t);
|
||||
enum cb_err ret = mock_type(enum cb_err);
|
||||
if (ret != CB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@ -102,7 +102,7 @@ cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_o
|
|||
return CB_SUCCESS;
|
||||
}
|
||||
|
||||
static void expect_cbfs_lookup(const char *name, cb_err_t err, const union cbfs_mdata *mdata,
|
||||
static void expect_cbfs_lookup(const char *name, enum cb_err err, const union cbfs_mdata *mdata,
|
||||
size_t data_offset_out)
|
||||
{
|
||||
expect_string(cbfs_lookup, name, name);
|
||||
|
|
|
@ -53,19 +53,19 @@ size_t ulz4fn(const void *src, size_t srcn, void *dst, size_t dstn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out)
|
||||
enum cb_err cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out)
|
||||
{
|
||||
return CB_CBFS_CACHE_FULL;
|
||||
}
|
||||
|
||||
cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
enum cb_err cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
{
|
||||
assert_non_null(dev);
|
||||
check_expected(name);
|
||||
|
||||
cb_err_t ret = mock_type(cb_err_t);
|
||||
enum cb_err ret = mock_type(enum cb_err);
|
||||
if (ret != CB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@ -74,7 +74,7 @@ cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_o
|
|||
return CB_SUCCESS;
|
||||
}
|
||||
|
||||
static void expect_cbfs_lookup(const char *name, cb_err_t err, const union cbfs_mdata *mdata,
|
||||
static void expect_cbfs_lookup(const char *name, enum cb_err err, const union cbfs_mdata *mdata,
|
||||
size_t data_offset_out)
|
||||
{
|
||||
expect_string(cbfs_lookup, name, name);
|
||||
|
@ -91,7 +91,7 @@ const void *cbfs_find_attr(const union cbfs_mdata *mdata, uint32_t attr_tag, siz
|
|||
return mock_ptr_type(void *);
|
||||
}
|
||||
|
||||
cb_err_t fmap_locate_area(const char *name, size_t *offset, size_t *size)
|
||||
enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size)
|
||||
{
|
||||
*offset = 0;
|
||||
*size = 0;
|
||||
|
|
|
@ -40,8 +40,8 @@ struct cbfs_mcache_build_args {
|
|||
int count;
|
||||
};
|
||||
|
||||
static cb_err_t build_walker(cbfs_dev_t dev, size_t offset, const union cbfs_mdata *mdata,
|
||||
size_t already_read, void *arg)
|
||||
static enum cb_err build_walker(cbfs_dev_t dev, size_t offset, const union cbfs_mdata *mdata,
|
||||
size_t already_read, void *arg)
|
||||
{
|
||||
struct cbfs_mcache_build_args *args = arg;
|
||||
union mcache_entry *entry = args->mcache;
|
||||
|
@ -62,8 +62,8 @@ static cb_err_t build_walker(cbfs_dev_t dev, size_t offset, const union cbfs_mda
|
|||
return CB_CBFS_NOT_FOUND;
|
||||
}
|
||||
|
||||
cb_err_t cbfs_mcache_build(cbfs_dev_t dev, void *mcache, size_t size,
|
||||
struct vb2_hash *metadata_hash)
|
||||
enum cb_err cbfs_mcache_build(cbfs_dev_t dev, void *mcache, size_t size,
|
||||
struct vb2_hash *metadata_hash)
|
||||
{
|
||||
struct cbfs_mcache_build_args args = {
|
||||
.mcache = mcache,
|
||||
|
@ -73,7 +73,7 @@ cb_err_t cbfs_mcache_build(cbfs_dev_t dev, void *mcache, size_t size,
|
|||
};
|
||||
|
||||
assert(size > sizeof(uint32_t) && IS_ALIGNED((uintptr_t)mcache, CBFS_MCACHE_ALIGNMENT));
|
||||
cb_err_t ret = cbfs_walk(dev, build_walker, &args, metadata_hash, 0);
|
||||
enum cb_err ret = cbfs_walk(dev, build_walker, &args, metadata_hash, 0);
|
||||
union mcache_entry *entry = args.mcache;
|
||||
if (ret == CB_CBFS_NOT_FOUND) {
|
||||
ret = CB_SUCCESS;
|
||||
|
@ -88,8 +88,8 @@ cb_err_t cbfs_mcache_build(cbfs_dev_t dev, void *mcache, size_t size,
|
|||
return ret;
|
||||
}
|
||||
|
||||
cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out)
|
||||
enum cb_err cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out)
|
||||
{
|
||||
const size_t namesize = strlen(name) + 1; /* Count trailing \0 so we can memcmp() it. */
|
||||
const void *end = mcache + mcache_size;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <commonlib/bsd/cbfs_private.h>
|
||||
#include <assert.h>
|
||||
|
||||
static cb_err_t read_next_header(cbfs_dev_t dev, size_t *offset, struct cbfs_file *buffer,
|
||||
const size_t devsize)
|
||||
static enum cb_err read_next_header(cbfs_dev_t dev, size_t *offset, struct cbfs_file *buffer,
|
||||
const size_t devsize)
|
||||
{
|
||||
DEBUG("Looking for next file @%#zx...\n", *offset);
|
||||
*offset = ALIGN_UP(*offset, CBFS_ALIGNMENT);
|
||||
|
@ -22,10 +22,10 @@ static cb_err_t read_next_header(cbfs_dev_t dev, size_t *offset, struct cbfs_fil
|
|||
return CB_CBFS_NOT_FOUND;
|
||||
}
|
||||
|
||||
cb_err_t cbfs_walk(cbfs_dev_t dev, cb_err_t (*walker)(cbfs_dev_t dev, size_t offset,
|
||||
const union cbfs_mdata *mdata,
|
||||
size_t already_read, void *arg),
|
||||
void *arg, struct vb2_hash *metadata_hash, enum cbfs_walk_flags flags)
|
||||
enum cb_err cbfs_walk(cbfs_dev_t dev, enum cb_err (*walker)(cbfs_dev_t dev, size_t offset,
|
||||
const union cbfs_mdata *mdata,
|
||||
size_t already_read, void *arg),
|
||||
void *arg, struct vb2_hash *metadata_hash, enum cbfs_walk_flags flags)
|
||||
{
|
||||
const bool do_hash = CBFS_ENABLE_HASHING && metadata_hash;
|
||||
const size_t devsize = cbfs_dev_size(dev);
|
||||
|
@ -39,8 +39,8 @@ cb_err_t cbfs_walk(cbfs_dev_t dev, cb_err_t (*walker)(cbfs_dev_t dev, size_t off
|
|||
}
|
||||
|
||||
size_t offset = 0;
|
||||
cb_err_t ret_header;
|
||||
cb_err_t ret_walker = CB_CBFS_NOT_FOUND;
|
||||
enum cb_err ret_header;
|
||||
enum cb_err ret_walker = CB_CBFS_NOT_FOUND;
|
||||
union cbfs_mdata mdata;
|
||||
while ((ret_header = read_next_header(dev, &offset, &mdata.h, devsize)) == CB_SUCCESS) {
|
||||
const uint32_t attr_offset = be32toh(mdata.h.attributes_offset);
|
||||
|
@ -113,8 +113,8 @@ next_file:
|
|||
return ret_walker;
|
||||
}
|
||||
|
||||
cb_err_t cbfs_copy_fill_metadata(union cbfs_mdata *dst, const union cbfs_mdata *src,
|
||||
size_t already_read, cbfs_dev_t dev, size_t offset)
|
||||
enum cb_err cbfs_copy_fill_metadata(union cbfs_mdata *dst, const union cbfs_mdata *src,
|
||||
size_t already_read, cbfs_dev_t dev, size_t offset)
|
||||
{
|
||||
/* First, copy the stuff that cbfs_walk() already read for us. */
|
||||
memcpy(dst, src, already_read);
|
||||
|
@ -135,8 +135,8 @@ struct cbfs_lookup_args {
|
|||
size_t *data_offset_out;
|
||||
};
|
||||
|
||||
static cb_err_t lookup_walker(cbfs_dev_t dev, size_t offset, const union cbfs_mdata *mdata,
|
||||
size_t already_read, void *arg)
|
||||
static enum cb_err lookup_walker(cbfs_dev_t dev, size_t offset, const union cbfs_mdata *mdata,
|
||||
size_t already_read, void *arg)
|
||||
{
|
||||
struct cbfs_lookup_args *args = arg;
|
||||
/* Check if the name we're looking for could fit, then we can safely memcmp() it. */
|
||||
|
@ -152,8 +152,8 @@ static cb_err_t lookup_walker(cbfs_dev_t dev, size_t offset, const union cbfs_md
|
|||
return CB_SUCCESS;
|
||||
}
|
||||
|
||||
cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
enum cb_err cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
{
|
||||
struct cbfs_lookup_args args = {
|
||||
.mdata_out = mdata_out,
|
||||
|
|
|
@ -42,7 +42,4 @@ enum cb_err {
|
|||
CB_CBFS_CACHE_FULL = -403, /**< Metadata cache overflowed */
|
||||
};
|
||||
|
||||
/* Don't typedef the enum directly, so the size is unambiguous for serialization. */
|
||||
typedef int32_t cb_err_t;
|
||||
|
||||
#endif /* _COMMONLIB_BSD_CB_ERR_H_ */
|
||||
|
|
|
@ -78,24 +78,24 @@ enum cbfs_walk_flags {
|
|||
* CB_SUCCESS/<other> - First non-CB_CBFS_NOT_FOUND code returned by walker()
|
||||
* CB_CBFS_NOT_FOUND - walker() returned CB_CBFS_NOT_FOUND for every file in the CBFS
|
||||
*/
|
||||
cb_err_t cbfs_walk(cbfs_dev_t dev, cb_err_t (*walker)(cbfs_dev_t dev, size_t offset,
|
||||
const union cbfs_mdata *mdata,
|
||||
size_t already_read, void *arg),
|
||||
void *arg, struct vb2_hash *metadata_hash, enum cbfs_walk_flags);
|
||||
enum cb_err cbfs_walk(cbfs_dev_t dev, enum cb_err (*walker)(cbfs_dev_t dev, size_t offset,
|
||||
const union cbfs_mdata *mdata,
|
||||
size_t already_read, void *arg),
|
||||
void *arg, struct vb2_hash *metadata_hash, enum cbfs_walk_flags);
|
||||
|
||||
/*
|
||||
* Helper function that can be used by a |walker| callback to cbfs_walk() to copy the metadata
|
||||
* of a file into a permanent buffer. Will copy the |already_read| metadata from |src| into
|
||||
* |dst| and load remaining metadata from |dev| as required.
|
||||
*/
|
||||
cb_err_t cbfs_copy_fill_metadata(union cbfs_mdata *dst, const union cbfs_mdata *src,
|
||||
size_t already_read, cbfs_dev_t dev, size_t offset);
|
||||
enum cb_err cbfs_copy_fill_metadata(union cbfs_mdata *dst, const union cbfs_mdata *src,
|
||||
size_t already_read, cbfs_dev_t dev, size_t offset);
|
||||
|
||||
/* Find a file named |name| in the CBFS on |dev|. Copy its metadata (including attributes)
|
||||
* into |mdata_out| and pass out the offset to the file data on the CBFS device.
|
||||
* Verify the metadata with |metadata_hash| if provided. */
|
||||
cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash);
|
||||
enum cb_err cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash);
|
||||
|
||||
/* Both base address and size of CBFS mcaches must be aligned to this value! */
|
||||
#define CBFS_MCACHE_ALIGNMENT sizeof(uint32_t) /* Largest data type used in CBFS */
|
||||
|
@ -105,15 +105,15 @@ cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_o
|
|||
* CB_CBFS_CACHE_FULL, the mcache is still valid and can be used, but lookups may return
|
||||
* CB_CBFS_CACHE_FULL for files that didn't fit to indicate that the caller needs to fall back
|
||||
* to cbfs_lookup(). */
|
||||
cb_err_t cbfs_mcache_build(cbfs_dev_t dev, void *mcache, size_t mcache_size,
|
||||
struct vb2_hash *metadata_hash);
|
||||
enum cb_err cbfs_mcache_build(cbfs_dev_t dev, void *mcache, size_t mcache_size,
|
||||
struct vb2_hash *metadata_hash);
|
||||
|
||||
/*
|
||||
* Find a file named |name| in a CBFS metadata cache and copy its metadata into |mdata_out|.
|
||||
* Pass out offset to the file data (on the original CBFS device used for cbfs_mcache_build()).
|
||||
*/
|
||||
cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out);
|
||||
enum cb_err cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out);
|
||||
|
||||
/* Returns the amount of bytes actually used by the CBFS metadata cache in |mcache|. */
|
||||
size_t cbfs_mcache_real_size(const void *mcache, size_t mcache_size);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <delay.h>
|
||||
#include <mipi/panel.h>
|
||||
|
||||
cb_err_t mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_func)
|
||||
enum cb_err mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_func)
|
||||
{
|
||||
const struct panel_init_command *init = buf;
|
||||
enum mipi_dsi_transaction type;
|
||||
|
@ -68,7 +68,7 @@ cb_err_t mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_fun
|
|||
return CB_ERR;
|
||||
}
|
||||
|
||||
cb_err_t ret = cmd_func(type, init->data, len);
|
||||
enum cb_err ret = cmd_func(type, init->data, len);
|
||||
if (ret != CB_SUCCESS)
|
||||
return ret;
|
||||
buf += len;
|
||||
|
|
|
@ -81,12 +81,12 @@ int ps8640_init(uint8_t bus, uint8_t chip)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static cb_err_t ps8640_bridge_aux_request(uint8_t bus,
|
||||
uint8_t chip,
|
||||
unsigned int target_reg,
|
||||
unsigned int total_size,
|
||||
enum aux_request request,
|
||||
uint8_t *data)
|
||||
static enum cb_err ps8640_bridge_aux_request(uint8_t bus,
|
||||
uint8_t chip,
|
||||
unsigned int target_reg,
|
||||
unsigned int total_size,
|
||||
enum aux_request request,
|
||||
uint8_t *data)
|
||||
{
|
||||
int i;
|
||||
uint32_t length;
|
||||
|
|
|
@ -155,12 +155,12 @@ static const unsigned int sn65dsi86_bridge_dp_rate_lut[] = {
|
|||
0, 1620, 2160, 2430, 2700, 3240, 4320, 5400
|
||||
};
|
||||
|
||||
static cb_err_t sn65dsi86_bridge_aux_request(uint8_t bus,
|
||||
uint8_t chip,
|
||||
unsigned int target_reg,
|
||||
unsigned int total_size,
|
||||
enum aux_request request,
|
||||
uint8_t *data)
|
||||
static enum cb_err sn65dsi86_bridge_aux_request(uint8_t bus,
|
||||
uint8_t chip,
|
||||
unsigned int target_reg,
|
||||
unsigned int total_size,
|
||||
enum aux_request request,
|
||||
uint8_t *data)
|
||||
{
|
||||
int i;
|
||||
uint32_t length;
|
||||
|
@ -217,9 +217,9 @@ static cb_err_t sn65dsi86_bridge_aux_request(uint8_t bus,
|
|||
return CB_SUCCESS;
|
||||
}
|
||||
|
||||
cb_err_t sn65dsi86_bridge_read_edid(uint8_t bus, uint8_t chip, struct edid *out)
|
||||
enum cb_err sn65dsi86_bridge_read_edid(uint8_t bus, uint8_t chip, struct edid *out)
|
||||
{
|
||||
cb_err_t err;
|
||||
enum cb_err err;
|
||||
u8 edid[EDID_LENGTH * 2];
|
||||
int edid_size = EDID_LENGTH;
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ void cbfs_preload(const char *name);
|
|||
void cbfs_unmap(void *mapping);
|
||||
|
||||
/* Load stage into memory filling in prog. Return 0 on success. < 0 on error. */
|
||||
int cbfs_prog_stage_load(struct prog *prog);
|
||||
enum cb_err cbfs_prog_stage_load(struct prog *prog);
|
||||
|
||||
/* Returns the size of a CBFS file, or 0 on error. Avoid using this function to allocate space,
|
||||
and instead use cbfs_alloc() so the file only needs to be looked up once. */
|
||||
|
@ -185,15 +185,15 @@ const struct cbfs_boot_device *cbfs_get_boot_device(bool force_ro);
|
|||
* hash was still verified. Should be called once per *boot* (not once per stage) before the
|
||||
* first CBFS access.
|
||||
*/
|
||||
cb_err_t cbfs_init_boot_device(const struct cbfs_boot_device *cbd,
|
||||
struct vb2_hash *metadata_hash);
|
||||
enum cb_err cbfs_init_boot_device(const struct cbfs_boot_device *cbd,
|
||||
struct vb2_hash *metadata_hash);
|
||||
|
||||
|
||||
/**********************************************************************************************
|
||||
* INTERNAL HELPERS FOR INLINES, DO NOT USE. *
|
||||
**********************************************************************************************/
|
||||
cb_err_t _cbfs_boot_lookup(const char *name, bool force_ro,
|
||||
union cbfs_mdata *mdata, struct region_device *rdev);
|
||||
enum cb_err _cbfs_boot_lookup(const char *name, bool force_ro,
|
||||
union cbfs_mdata *mdata, struct region_device *rdev);
|
||||
|
||||
void *_cbfs_alloc(const char *name, cbfs_allocator_t allocator, void *arg,
|
||||
size_t *size_out, bool force_ro, enum cbfs_type *type);
|
||||
|
|
|
@ -31,10 +31,10 @@ struct panel_serializable_data {
|
|||
u8 init[]; /* A packed array of panel_init_command */
|
||||
};
|
||||
|
||||
typedef cb_err_t (*mipi_cmd_func_t)(enum mipi_dsi_transaction type, const u8 *data, u8 len);
|
||||
typedef enum cb_err (*mipi_cmd_func_t)(enum mipi_dsi_transaction type, const u8 *data, u8 len);
|
||||
|
||||
/* Parse a command array and call cmd_func() for each entry. Delays get handled internally. */
|
||||
cb_err_t mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_func);
|
||||
enum cb_err mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_func);
|
||||
|
||||
#define PANEL_DCS(...) \
|
||||
PANEL_CMD_DCS, \
|
||||
|
|
|
@ -34,15 +34,15 @@ static void switch_to_postram_cache(int unused)
|
|||
}
|
||||
ROMSTAGE_CBMEM_INIT_HOOK(switch_to_postram_cache);
|
||||
|
||||
cb_err_t _cbfs_boot_lookup(const char *name, bool force_ro,
|
||||
union cbfs_mdata *mdata, struct region_device *rdev)
|
||||
enum cb_err _cbfs_boot_lookup(const char *name, bool force_ro,
|
||||
union cbfs_mdata *mdata, struct region_device *rdev)
|
||||
{
|
||||
const struct cbfs_boot_device *cbd = cbfs_get_boot_device(force_ro);
|
||||
if (!cbd)
|
||||
return CB_ERR;
|
||||
|
||||
size_t data_offset;
|
||||
cb_err_t err = CB_CBFS_CACHE_FULL;
|
||||
enum cb_err err = CB_CBFS_CACHE_FULL;
|
||||
if (!CONFIG(NO_CBFS_MCACHE) && !ENV_SMM && cbd->mcache_size)
|
||||
err = cbfs_mcache_lookup(cbd->mcache, cbd->mcache_size,
|
||||
name, mdata, &data_offset);
|
||||
|
@ -520,11 +520,11 @@ void *_cbfs_cbmem_allocator(void *arg, size_t size, const union cbfs_mdata *unus
|
|||
return cbmem_add((uintptr_t)arg, size);
|
||||
}
|
||||
|
||||
cb_err_t cbfs_prog_stage_load(struct prog *pstage)
|
||||
enum cb_err cbfs_prog_stage_load(struct prog *pstage)
|
||||
{
|
||||
union cbfs_mdata mdata;
|
||||
struct region_device rdev;
|
||||
cb_err_t err;
|
||||
enum cb_err err;
|
||||
|
||||
prog_locate_hook(pstage);
|
||||
|
||||
|
@ -612,8 +612,8 @@ void cbfs_boot_device_find_mcache(struct cbfs_boot_device *cbd, uint32_t id)
|
|||
}
|
||||
}
|
||||
|
||||
cb_err_t cbfs_init_boot_device(const struct cbfs_boot_device *cbd,
|
||||
struct vb2_hash *mdata_hash)
|
||||
enum cb_err cbfs_init_boot_device(const struct cbfs_boot_device *cbd,
|
||||
struct vb2_hash *mdata_hash)
|
||||
{
|
||||
/* If we have an mcache, mcache_build() will also check mdata hash. */
|
||||
if (!CONFIG(NO_CBFS_MCACHE) && !ENV_SMM && cbd->mcache_size > 0)
|
||||
|
@ -625,7 +625,7 @@ cb_err_t cbfs_init_boot_device(const struct cbfs_boot_device *cbd,
|
|||
|
||||
/* Verification only: use cbfs_walk() without a walker() function to just run through
|
||||
the CBFS once, will return NOT_FOUND by default. */
|
||||
cb_err_t err = cbfs_walk(&cbd->rdev, NULL, NULL, mdata_hash, 0);
|
||||
enum cb_err err = cbfs_walk(&cbd->rdev, NULL, NULL, mdata_hash, 0);
|
||||
if (err == CB_CBFS_NOT_FOUND)
|
||||
err = CB_SUCCESS;
|
||||
return err;
|
||||
|
@ -660,7 +660,7 @@ const struct cbfs_boot_device *cbfs_get_boot_device(bool force_ro)
|
|||
die("Cannot locate primary CBFS");
|
||||
|
||||
if (ENV_INITIAL_STAGE) {
|
||||
cb_err_t err = cbfs_init_boot_device(&ro, metadata_hash_get());
|
||||
enum cb_err err = cbfs_init_boot_device(&ro, metadata_hash_get());
|
||||
if (err == CB_CBFS_HASH_MISMATCH)
|
||||
die("RO CBFS metadata hash verification failure");
|
||||
else if (CONFIG(TOCTOU_SAFETY) && err == CB_CBFS_CACHE_FULL)
|
||||
|
|
|
@ -34,7 +34,7 @@ static void after_verstage(void)
|
|||
if (!cbd) /* Can't initialize RW CBFS in recovery mode. */
|
||||
return;
|
||||
|
||||
cb_err_t err = cbfs_init_boot_device(cbd, NULL); /* TODO: RW hash */
|
||||
enum cb_err err = cbfs_init_boot_device(cbd, NULL); /* TODO: RW hash */
|
||||
if (err && err != CB_CBFS_CACHE_FULL) /* TODO: -> recovery? */
|
||||
die("RW CBFS initialization failure: %d", err);
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ static bool mtk_dsi_is_read_command(enum mipi_dsi_transaction type)
|
|||
}
|
||||
}
|
||||
|
||||
static cb_err_t mtk_dsi_cmdq(enum mipi_dsi_transaction type, const u8 *data, u8 len)
|
||||
static enum cb_err mtk_dsi_cmdq(enum mipi_dsi_transaction type, const u8 *data, u8 len)
|
||||
{
|
||||
const u8 *tx_buf = data;
|
||||
u32 config;
|
||||
|
|
|
@ -204,11 +204,12 @@ static int mdss_dsi_cmd_dma_trigger_for_panel(void)
|
|||
return status;
|
||||
}
|
||||
|
||||
static cb_err_t mdss_dsi_send_init_cmd(enum mipi_dsi_transaction type, const u8 *body, u8 len)
|
||||
static enum cb_err mdss_dsi_send_init_cmd(enum mipi_dsi_transaction type, const u8 *body,
|
||||
u8 len)
|
||||
{
|
||||
uint8_t *pload = _dma_coherent;
|
||||
uint32_t size;
|
||||
cb_err_t ret = CB_SUCCESS;
|
||||
enum cb_err ret = CB_SUCCESS;
|
||||
int data = 0;
|
||||
uint32_t *bp = NULL;
|
||||
|
||||
|
@ -276,7 +277,7 @@ static void mdss_dsi_clear_intr(void)
|
|||
write32(&dsi0->err_int_mask0, 0x13FF3BFF);
|
||||
}
|
||||
|
||||
cb_err_t mdss_dsi_panel_initialize(const u8 *init_cmds)
|
||||
enum cb_err mdss_dsi_panel_initialize(const u8 *init_cmds)
|
||||
{
|
||||
uint32_t ctrl_mode = 0;
|
||||
|
||||
|
@ -286,7 +287,7 @@ cb_err_t mdss_dsi_panel_initialize(const u8 *init_cmds)
|
|||
/* Enable command mode before sending the commands */
|
||||
write32(&dsi0->ctrl, ctrl_mode | 0x04);
|
||||
|
||||
cb_err_t ret = mipi_panel_parse_init_commands(init_cmds, mdss_dsi_send_init_cmd);
|
||||
enum cb_err ret = mipi_panel_parse_init_commands(init_cmds, mdss_dsi_send_init_cmd);
|
||||
write32(&dsi0->ctrl, ctrl_mode);
|
||||
mdss_dsi_clear_intr();
|
||||
|
||||
|
|
|
@ -22,6 +22,6 @@ enum {
|
|||
enum cb_err mdss_dsi_config(struct edid *edid, uint32_t num_of_lanes, uint32_t bpp);
|
||||
void mdss_dsi_clock_config(void);
|
||||
void mdss_dsi_video_mode_config(struct edid *edid, uint32_t bpp);
|
||||
cb_err_t mdss_dsi_panel_initialize(const u8 *init_cmds);
|
||||
enum cb_err mdss_dsi_panel_initialize(const u8 *init_cmds);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -70,29 +70,29 @@ size_t ulz4fn(const void *src, size_t srcn, void *dst, size_t dstn)
|
|||
return dstn;
|
||||
}
|
||||
|
||||
extern cb_err_t __real_cbfs_lookup(cbfs_dev_t dev, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out,
|
||||
struct vb2_hash *metadata_hash);
|
||||
extern enum cb_err __real_cbfs_lookup(cbfs_dev_t dev, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out,
|
||||
struct vb2_hash *metadata_hash);
|
||||
|
||||
cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
enum cb_err cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
{
|
||||
const cb_err_t err =
|
||||
const enum cb_err err =
|
||||
__real_cbfs_lookup(dev, name, mdata_out, data_offset_out, metadata_hash);
|
||||
assert_int_equal(err, mock_type(cb_err_t));
|
||||
assert_int_equal(err, mock_type(enum cb_err));
|
||||
return err;
|
||||
}
|
||||
|
||||
extern cb_err_t __real_cbfs_mcache_lookup(const void *mcache, size_t mcache_size,
|
||||
extern enum cb_err __real_cbfs_mcache_lookup(const void *mcache, size_t mcache_size,
|
||||
const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out);
|
||||
|
||||
cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out)
|
||||
enum cb_err cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *name,
|
||||
union cbfs_mdata *mdata_out, size_t *data_offset_out)
|
||||
{
|
||||
const cb_err_t err = __real_cbfs_mcache_lookup(mcache, mcache_size, name, mdata_out,
|
||||
const enum cb_err err = __real_cbfs_mcache_lookup(mcache, mcache_size, name, mdata_out,
|
||||
data_offset_out);
|
||||
assert_int_equal(err, mock_type(cb_err_t));
|
||||
assert_int_equal(err, mock_type(enum cb_err));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ void *cbmem_add(u32 id, u64 size)
|
|||
struct cbfs_test_state_ex {
|
||||
u32 file_type;
|
||||
u32 file_length;
|
||||
cb_err_t lookup_result;
|
||||
enum cb_err lookup_result;
|
||||
};
|
||||
|
||||
struct cbfs_test_state {
|
||||
|
@ -198,7 +198,7 @@ static int teardown_test_cbfs(void **state)
|
|||
|
||||
/* Utils */
|
||||
|
||||
static void expect_lookup_result(cb_err_t res)
|
||||
static void expect_lookup_result(enum cb_err res)
|
||||
{
|
||||
if (CONFIG(NO_CBFS_MCACHE))
|
||||
will_return(cbfs_lookup, (res));
|
||||
|
|
|
@ -80,15 +80,15 @@ vb2_error_t vb2_digest_finalize(struct vb2_digest_context *dc, uint8_t *digest,
|
|||
}
|
||||
|
||||
/* Original function alias created by test framework. Used for call wrapping in mock below. */
|
||||
cb_err_t __real_cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash);
|
||||
enum cb_err __real_cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash);
|
||||
|
||||
cb_err_t cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
enum cb_err cbfs_lookup(cbfs_dev_t dev, const char *name, union cbfs_mdata *mdata_out,
|
||||
size_t *data_offset_out, struct vb2_hash *metadata_hash)
|
||||
{
|
||||
const cb_err_t err =
|
||||
const enum cb_err err =
|
||||
__real_cbfs_lookup(dev, name, mdata_out, data_offset_out, metadata_hash);
|
||||
assert_int_equal(mock_type(cb_err_t), err);
|
||||
assert_int_equal(mock_type(enum cb_err), err);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -247,8 +247,8 @@ static int maybe_update_metadata_hash(struct cbfs_image *cbfs)
|
|||
if (mhc->cbfs_hash.algo == VB2_HASH_INVALID)
|
||||
return 0;
|
||||
|
||||
cb_err_t err = cbfs_walk(cbfs, NULL, NULL, &mhc->cbfs_hash,
|
||||
CBFS_WALK_WRITEBACK_HASH);
|
||||
enum cb_err err = cbfs_walk(cbfs, NULL, NULL, &mhc->cbfs_hash,
|
||||
CBFS_WALK_WRITEBACK_HASH);
|
||||
if (err != CB_CBFS_NOT_FOUND) {
|
||||
ERROR("Unexpected cbfs_walk() error %d\n", err);
|
||||
return -1;
|
||||
|
@ -1508,8 +1508,8 @@ static int cbfs_print(void)
|
|||
return 0;
|
||||
|
||||
struct vb2_hash real_hash = { .algo = mhc->cbfs_hash.algo };
|
||||
cb_err_t err = cbfs_walk(&image, NULL, NULL, &real_hash,
|
||||
CBFS_WALK_WRITEBACK_HASH);
|
||||
enum cb_err err = cbfs_walk(&image, NULL, NULL, &real_hash,
|
||||
CBFS_WALK_WRITEBACK_HASH);
|
||||
if (err != CB_CBFS_NOT_FOUND) {
|
||||
ERROR("Unexpected cbfs_walk() error %d\n", err);
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue