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>
This commit is contained in:
@ -37,6 +37,18 @@ struct range_entry {
|
|||||||
struct range_entry *next;
|
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. */
|
/* Return inclusive base address of memory range. */
|
||||||
static inline resource_t range_entry_base(const struct range_entry *r)
|
static inline resource_t range_entry_base(const struct range_entry *r)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user