board-inspector: use the same _MIN and _MAX for 0-length regions

It is typical in AML resource descriptors to have 0-length region
descriptors which are typically templates of resources that are not
assigned on the current platform. For such regions, the `base + length - 1`
formula does not calculate the max of the region properly.

This patch updates the resource descriptor parsers to use max = min when
the length of the region is 0.

Tracked-On: #6287
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2021-08-09 16:26:52 +08:00 committed by wenlingz
parent bcc8358d93
commit 065316ba1e
1 changed files with 6 additions and 3 deletions

View File

@ -86,13 +86,16 @@ def parse_irq(idx, item, elem):
add_child(elem, "resource", id=f"res{idx}", type="irq", int=irqs)
def parse_io_port(idx, item, elem):
add_child(elem, "resource", id=f"res{idx}", type="io_port", min=hex(item._MIN), max=hex(item._MAX), len=hex(item._LEN))
add_child(elem, "resource", id=f"res{idx}", type="io_port",
min=hex(item._MIN), max=hex(item._MAX), len=hex(item._LEN))
def parse_fixed_io_port(idx, item, elem):
add_child(elem, "resource", id=f"res{idx}", type="io_port", min=hex(item._BAS), max=hex(item._BAS + item._LEN - 1), len=hex(item._LEN))
add_child(elem, "resource", id=f"res{idx}", type="io_port",
min=hex(item._BAS), max=hex(item._BAS + item._LEN - 1 if item._LEN else 0), len=hex(item._LEN))
def parse_fixed_memory_range(idx, item, elem):
add_child(elem, "resource", id=f"res{idx}", type="memory", min=hex(item._BAS), max=hex(item._BAS + item._LEN - 1), len=hex(item._LEN))
add_child(elem, "resource", id=f"res{idx}", type="memory",
min=hex(item._BAS), max=hex(item._BAS + item._LEN - 1 if item._LEN else 0), len=hex(item._LEN))
def parse_address_space_resource(idx, item, elem):
if item._TYP == 0: