hardware_gen: don't merge regions that are conditional

If one region is conditional and another isn't, we shouldn't merge them.
This fixes a problem where some regions wouldn't be exposed to
userspace when they were merged with a conditional region which would
cause userspace apps to fail in unexpected ways.
This commit is contained in:
Simon Shields
2019-02-01 11:21:36 +11:00
parent 4269c70800
commit 09e6fbb1c4

View File

@@ -606,6 +606,10 @@ def fixup_device_regions(regions, pagesz, merge=False):
ret = sorted(ret, key=lambda a: a.start)
i = 1
while i < len(ret):
if (ret[i].user_macro and ret[i].get_macro_string()) \
or (ret[i-1].user_macro and ret[i-1].get_macro_string()):
i += 1
continue
if ret[i].start == ret[i-1].start + ret[i-1].size:
ret[i-1].size += ret[i].size
ret[i-1].names.update(ret[i].names)