aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorSimon Glass2020-05-24 17:38:17 -0600
committerBin Meng2020-05-27 14:40:09 +0800
commita2c528fe8a2187abf444627f964b5b727bf5fd2b (patch)
treeb9f333d8312b874dca006cdb74cfbc5d15005ab8 /fs
parent54e19257a9531f0d2654a9a026bab1035a802b6c (diff)
cbfs: Adjust cbfs_load_header_ptr() to use cbfs_priv
This function is strange at the moment in that it takes a header pointer but then accesses the cbfs_s global. Currently clients have their own priv pointer, so update the function to take that as a parameter instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cbfs/cbfs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index c08fcb14a52..f3fcdab1a7b 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -8,6 +8,9 @@
#include <malloc.h>
#include <asm/byteorder.h>
+/* Offset of master header from the start of a coreboot ROM */
+#define MASTER_HDR_OFFSET 0x38
+
static const u32 good_magic = 0x4f524243;
static const u8 good_file_magic[] = "LARCHIVE";
@@ -192,9 +195,9 @@ static int file_cbfs_load_header(struct cbfs_priv *priv, ulong end_of_rom)
return 0;
}
-static int cbfs_load_header_ptr(struct cbfs_priv *priv, ulong base,
- struct cbfs_header *header)
+static int cbfs_load_header_ptr(struct cbfs_priv *priv, ulong base)
{
+ struct cbfs_header *header = &priv->header;
struct cbfs_header *header_in_rom;
header_in_rom = (struct cbfs_header *)base;
@@ -241,7 +244,7 @@ int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp)
* valid. Assume that a master header appears at the start, at offset
* 0x38.
*/
- ret = cbfs_load_header_ptr(priv, base + 0x38, &priv->header);
+ ret = cbfs_load_header_ptr(priv, base + MASTER_HDR_OFFSET);
if (ret)
return ret;