board_inspector: do not use _MAX as the end of a memory region

According to the specification, the _MAX of memory address space resource
descriptors may not necessarily be _MIN + _LEN - 1. Typically the resource
locates at the low end of the region specified by _MIN and _MAX. This patch
makes the ACPI extractor always calculating the end of a memory region
using _MIN and _LEN instead.

Tracked-On: #6287
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2021-08-06 15:50:28 +08:00 committed by wenlingz
parent e5ba06cbe8
commit 2dd9ec8612

View File

@ -103,7 +103,7 @@ def parse_address_space_resource(idx, item, elem):
typ = "bus_number"
else:
typ = "custom"
add_child(elem, "resource", id=f"res{idx}", type=typ, min=hex(item._MIN), max=hex(item._MAX), len=hex(item._LEN))
add_child(elem, "resource", id=f"res{idx}", type=typ, min=hex(item._MIN), max=hex(item._MIN + item._LEN - 1), len=hex(item._LEN))
def parse_extended_irq(idx, item, elem):
irqs = ", ".join(map(str, item._INT))
@ -195,7 +195,7 @@ class CollectDependencyVisitor(Visitor):
LARGE_RESOURCE_ITEM_WORD_ADDRESS_SPACE,
LARGE_RESOURCE_ITEM_QWORD_ADDRESS_SPACE,
LARGE_RESOURCE_ITEM_EXTENDED_ADDRESS_SPACE]:
if item._MIN <= region_base and region_base + region_length - 1 <= item._MAX:
if item._MIN <= region_base and region_base + region_length - 1 <= item._MIN + item._LEN - 1:
op_region_is_exposed = True
break
elif op_region_type == 0x02: # PCI configuration space is always exposed