summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Dabros <jsd@semihalf.com>2020-08-19 15:05:11 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-08-26 07:32:37 +0000
commit28d4c2e9075ecc053cad32f6f8fdc706a30ccf26 (patch)
treefdc3f2955cb4a8b2cfb4498ed84ec43fb6e35f8d
parentf67f3a6626e8c74ebf742246d373c80bb2d1be2c (diff)
include/imd: Improve API documentation
Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I8261c7d933435ba9f29fc3172cdfe8bcae5c1af9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44664 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
-rw-r--r--src/include/imd.h14
-rw-r--r--src/lib/imd.c1
2 files changed, 9 insertions, 6 deletions
diff --git a/src/include/imd.h b/src/include/imd.h
index 7abbb9876d..df669fd366 100644
--- a/src/include/imd.h
+++ b/src/include/imd.h
@@ -40,11 +40,13 @@
struct imd_entry;
struct imd;
+static const size_t LIMIT_ALIGN = 4096;
+
/*
* Initialize handle to use for working with an imd. Upper limit is the
- * exclusive address to start allocating down from. This function needs
- * to be called at least once before any other imd related functions
- * can be used.
+ * exclusive address (aligned down to LIMIT_ALIGN) to start allocating down
+ * from. This function needs to be called at least once before any other imd
+ * related functions can be used.
*/
void imd_handle_init(struct imd *imd, void *upper_limit);
@@ -60,7 +62,9 @@ void imd_handle_init_partial_recovery(struct imd *imd);
* Create an empty imd with a specified root_size and each entry is aligned to
* the provided entry_align. As noted above the root size encompasses the
* root pointer and root block leading to the number of imd entries being a
- * function of the root_size parameter.
+ * function of the root_size parameter. Please note, that one entry is allocated
+ * for covering root region, thus caller should consider this calculating
+ * root_size.
*/
int imd_create_empty(struct imd *imd, size_t root_size, size_t entry_align);
@@ -101,7 +105,7 @@ const struct imd_entry *imd_entry_find(const struct imd *imd, uint32_t id);
const struct imd_entry *imd_entry_find_or_add(const struct imd *imd,
uint32_t id, size_t size);
-/* Returns size of entry or 0 on failure. */
+/* Returns size of entry. */
size_t imd_entry_size(const struct imd_entry *entry);
/* Returns pointer to region described by entry or NULL on failure. */
diff --git a/src/lib/imd.c b/src/lib/imd.c
index d59c92b3cb..3be38ea678 100644
--- a/src/lib/imd.c
+++ b/src/lib/imd.c
@@ -13,7 +13,6 @@
static const uint32_t IMD_ROOT_PTR_MAGIC = 0xc0389481;
static const uint32_t IMD_ENTRY_MAGIC = ~0xc0389481;
static const uint32_t SMALL_REGION_ID = CBMEM_ID_IMD_SMALL;
-static const size_t LIMIT_ALIGN = 4096;
/* In-memory data structures. */
struct imd_root_pointer {