diff options
author | Simon Glass <sjg@chromium.org> | 2022-01-13 05:26:23 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-01-13 19:13:41 +0300 |
commit | e50a24a0456c07d28c0d589e061dd0576f6bb917 (patch) | |
tree | a806d836573039a451b42643ad3fcb9c0951b3e2 | |
parent | 99047f5d7f9cb013f7040edd7d20a70cc30646b5 (diff) | |
download | u-boot-e50a24a0456c07d28c0d589e061dd0576f6bb917.tar.xz |
bloblist: Add functions to obtain base address and size
Add a few convenience functions to obtain useful information about the
bloblist.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | common/bloblist.c | 12 | ||||
-rw-r--r-- | include/bloblist.h | 14 | ||||
-rw-r--r-- | test/bloblist.c | 2 |
3 files changed, 28 insertions, 0 deletions
diff --git a/common/bloblist.c b/common/bloblist.c index 0049bb9a39..1ed9172d89 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -367,6 +367,18 @@ int bloblist_finish(void) return 0; } +ulong bloblist_get_base(void) +{ + return map_to_sysmem(gd->bloblist); +} + +ulong bloblist_get_size(void) +{ + struct bloblist_hdr *hdr = gd->bloblist; + + return hdr->size; +} + void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp) { struct bloblist_hdr *hdr = gd->bloblist; diff --git a/include/bloblist.h b/include/bloblist.h index 13f2b3f100..d9e108d861 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -303,6 +303,20 @@ int bloblist_finish(void); void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp); /** + * bloblist_get_base() - Get the base address of the bloblist + * + * @returns base address of bloblist + */ +ulong bloblist_get_base(void); + +/** + * bloblist_get_size() - Get the size of the bloblist + * + * @returns the size in bytes + */ +ulong bloblist_get_size(void); + +/** * bloblist_show_stats() - Show information about the bloblist * * This shows useful information about the bloblist on the console diff --git a/test/bloblist.c b/test/bloblist.c index c5788d5cd8..720be7e244 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -107,6 +107,8 @@ static int bloblist_test_blob(struct unit_test_state *uts) hdr = clear_bloblist(); ut_assertnull(bloblist_find(TEST_TAG, TEST_BLOBLIST_SIZE)); ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_asserteq(TEST_BLOBLIST_SIZE, bloblist_get_size()); + ut_asserteq(TEST_ADDR, bloblist_get_base()); ut_asserteq(map_to_sysmem(hdr), TEST_ADDR); /* Add a record and check that we can find it */ |