mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-23 22:14:54 +00:00
cbfs: Don't require the CBFS size with cbfs_init_mem()
The size is not actually used since it is present in the header. Drop this parameter. Also tidy up error handling while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
03d4c298fa
commit
0621b5e1ee
3 changed files with 8 additions and 8 deletions
|
@ -81,11 +81,10 @@ static int get_cbfs_fsp(enum fsp_type_t type, ulong map_base,
|
||||||
* 'COREBOOT' (CBFS, size 1814528, offset 2117632).
|
* 'COREBOOT' (CBFS, size 1814528, offset 2117632).
|
||||||
*/
|
*/
|
||||||
ulong cbfs_base = 0x205000;
|
ulong cbfs_base = 0x205000;
|
||||||
ulong cbfs_size = 0x1bb000;
|
|
||||||
struct cbfs_priv *cbfs;
|
struct cbfs_priv *cbfs;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = cbfs_init_mem(map_base + cbfs_base, cbfs_size, &cbfs);
|
ret = cbfs_init_mem(map_base + cbfs_base, &cbfs);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <cbfs.h>
|
#include <cbfs.h>
|
||||||
|
#include <log.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
|
@ -275,7 +276,7 @@ int file_cbfs_init(ulong end_of_rom)
|
||||||
return cbfs_init(&cbfs_s, end_of_rom);
|
return cbfs_init(&cbfs_s, end_of_rom);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp)
|
int cbfs_init_mem(ulong base, struct cbfs_priv **privp)
|
||||||
{
|
{
|
||||||
struct cbfs_priv priv_s, *priv = &priv_s;
|
struct cbfs_priv priv_s, *priv = &priv_s;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -288,9 +289,10 @@ int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
file_cbfs_fill_cache(priv, priv->header.rom_size, priv->header.align);
|
ret = file_cbfs_fill_cache(priv, priv->header.rom_size,
|
||||||
if (priv->result != CBFS_SUCCESS)
|
priv->header.align);
|
||||||
return -EINVAL;
|
if (ret)
|
||||||
|
return log_msg_ret("fill", ret);
|
||||||
|
|
||||||
priv->initialized = true;
|
priv->initialized = true;
|
||||||
priv = malloc(sizeof(priv_s));
|
priv = malloc(sizeof(priv_s));
|
||||||
|
|
|
@ -149,11 +149,10 @@ const struct cbfs_cachenode *cbfs_find_file(struct cbfs_priv *cbfs,
|
||||||
* cbfs_init_mem() - Set up a new CBFS
|
* cbfs_init_mem() - Set up a new CBFS
|
||||||
*
|
*
|
||||||
* @base: Base address of CBFS
|
* @base: Base address of CBFS
|
||||||
* @size: Size of CBFS in bytes
|
|
||||||
* @cbfsp: Returns a pointer to CBFS on success
|
* @cbfsp: Returns a pointer to CBFS on success
|
||||||
* @return 0 if OK, -ve on error
|
* @return 0 if OK, -ve on error
|
||||||
*/
|
*/
|
||||||
int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp);
|
int cbfs_init_mem(ulong base, struct cbfs_priv **privp);
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
Loading…
Add table
Reference in a new issue