summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-03-08 10:47:18 -0600
committerAaron Durbin <adurbin@chromium.org>2016-03-09 16:46:16 +0100
commite8845922092849c438685ee3ea580ad63537c6c7 (patch)
tree5bd025b0268508061b5142ef1a897faa884c6ce2
parent566dd3576867a513d63855c6fb5b646db301a182 (diff)
lib/memrange: add function to initialize range_entry
In order to enforce the semantics of struct range_entry provide an init function, range_entry_init(), which performs the field initialization to adhere to the internal struture's assumptions. Change-Id: I24b9296e5bcf4775974c9a8d6326717608190215 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13956 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) Reviewed-by: Andrey Petrov <andrey.petrov@intel.com>
-rw-r--r--src/include/memrange.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/memrange.h b/src/include/memrange.h
index a4f7742c5b..759f8f5152 100644
--- a/src/include/memrange.h
+++ b/src/include/memrange.h
@@ -37,6 +37,18 @@ struct range_entry {
struct range_entry *next;
};
+/* Initialize a range_entry with inclusive beginning address and exclusive
+ * end address along with the appropriate tag. */
+static inline void range_entry_init(struct range_entry *re,
+ resource_t incl_begin, resource_t excl_end,
+ unsigned long tag)
+{
+ re->begin = incl_begin;
+ re->end = excl_end - 1;
+ re->tag = tag;
+ re->next = NULL;
+}
+
/* Return inclusive base address of memory range. */
static inline resource_t range_entry_base(const struct range_entry *r)
{