summaryrefslogtreecommitdiff
path: root/boot/bootmeth-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2024-11-15 16:19:14 -0700
committerTom Rini <[email protected]>2025-01-15 08:48:42 -0600
commitadc621bf15cf7478e2ac46985216703219ebe778 (patch)
tree2f2abd90ad2c480c2ee6d918278c6f40b3f1f780 /boot/bootmeth-uclass.c
parent8a6bf2fb31b6a02227818e679d567ae012494467 (diff)
bootstd: Update bootmeth_alloc_file() to record images
As a first step to recording images and where they came from, update this function to do so, since it is used by two bootmeths Create a helper function in the bootflow system, since recorded images are always associated with bootflows. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'boot/bootmeth-uclass.c')
-rw-r--r--boot/bootmeth-uclass.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c
index 5b5fea39b3b..c219631816f 100644
--- a/boot/bootmeth-uclass.c
+++ b/boot/bootmeth-uclass.c
@@ -6,6 +6,7 @@
#define LOG_CATEGORY UCLASS_BOOTSTD
+#include <alist.h>
#include <blk.h>
#include <bootflow.h>
#include <bootmeth.h>
@@ -326,8 +327,10 @@ int bootmeth_try_file(struct bootflow *bflow, struct blk_desc *desc,
return 0;
}
-int bootmeth_alloc_file(struct bootflow *bflow, uint size_limit, uint align)
+int bootmeth_alloc_file(struct bootflow *bflow, uint size_limit, uint align,
+ enum bootflow_img_t type)
{
+ struct blk_desc *desc = NULL;
void *buf;
uint size;
int ret;
@@ -344,6 +347,13 @@ int bootmeth_alloc_file(struct bootflow *bflow, uint size_limit, uint align)
bflow->state = BOOTFLOWST_READY;
bflow->buf = buf;
+ if (bflow->blk)
+ desc = dev_get_uclass_plat(bflow->blk);
+
+ if (!bootflow_img_add(bflow, bflow->fname, type, map_to_sysmem(buf),
+ size))
+ return log_msg_ret("bai", -ENOMEM);
+
return 0;
}