coreboot memrange: Two changes for zero size or empty memrange
1) Add check for zero size in memrange. 2) Add public memrange_init_empty function to allow initializing only the memrange structure without filling in device resources BUG=None BRANCH=None TEST=Compiles and runs succesfully for rush MMU memranges. Original-Change-Id: I8e4d864cbc9a770cd208f8a9f83f509dc7ace894 Original-Signed-off-by: Furquan Shaikh <furquan@google.com> Original-Reviewed-on: https://chromium-review.googlesource.com/208957 Original-Tested-by: Furquan Shaikh <furquan@chromium.org> Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org> (cherry picked from commit 5c42301c2a51a1a2a29ef58012f210d03bd37f94) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Change-Id: I8d63abb15efda74270ef6fa3c0df55c05659595d Reviewed-on: http://review.coreboot.org/8597 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
parent
2dd161f556
commit
196ee2b029
|
@ -75,6 +75,9 @@ static inline void range_entry_update_tag(struct range_entry *r,
|
||||||
#define memranges_each_entry(r, ranges) \
|
#define memranges_each_entry(r, ranges) \
|
||||||
for (r = (ranges)->entries; r != NULL; r = r->next)
|
for (r = (ranges)->entries; r != NULL; r = r->next)
|
||||||
|
|
||||||
|
/* Initialize memranges structure */
|
||||||
|
void memranges_init_empty(struct memranges *ranges);
|
||||||
|
|
||||||
/* Initialize and fill a memranges structure according to the
|
/* Initialize and fill a memranges structure according to the
|
||||||
* mask and match type for all memory resources. Tag each entry with the
|
* mask and match type for all memory resources. Tag each entry with the
|
||||||
* specified type. */
|
* specified type. */
|
||||||
|
|
|
@ -228,6 +228,9 @@ static void do_action(struct memranges *ranges,
|
||||||
resource_t end;
|
resource_t end;
|
||||||
resource_t begin;
|
resource_t begin;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
/* The addresses are aligned to 4096 bytes: the begin address is
|
/* The addresses are aligned to 4096 bytes: the begin address is
|
||||||
* aligned down while the end address is aligned up to be conservative
|
* aligned down while the end address is aligned up to be conservative
|
||||||
* about the full range covered. */
|
* about the full range covered. */
|
||||||
|
@ -290,11 +293,16 @@ void memranges_add_resources(struct memranges *ranges,
|
||||||
memranges_add_resources_filter(ranges, mask, match, tag, NULL);
|
memranges_add_resources_filter(ranges, mask, match, tag, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void memranges_init_empty(struct memranges *ranges)
|
||||||
|
{
|
||||||
|
ranges->entries = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void memranges_init(struct memranges *ranges,
|
void memranges_init(struct memranges *ranges,
|
||||||
unsigned long mask, unsigned long match,
|
unsigned long mask, unsigned long match,
|
||||||
unsigned long tag)
|
unsigned long tag)
|
||||||
{
|
{
|
||||||
ranges->entries = NULL;
|
memranges_init_empty(ranges);
|
||||||
memranges_add_resources(ranges, mask, match, tag);
|
memranges_add_resources(ranges, mask, match, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue