config_tools: gracefully skip invalid or ignored BARs

The board configuration generator assumes all PCI BARs are programmed when
the board inspector runs, which is sometimes not the case. Unprogrammed
BARs will be reported using plain texts wrapped by angle brackets in the
output of `lspci`.

This patch gracefully skips the unprogrammed BARs and continues when
parsing the output of `lspci`, in order to avoid build-time failures due to
unprogrammed BARs.

Tracked-On: #6355
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2022-01-29 17:40:46 +08:00 committed by acrnsi-robot
parent b5b22bf98b
commit 5118d67508

View File

@ -435,7 +435,11 @@ def parser_pci():
if "size=" not in line:
continue
bar_addr = int(get_value_after_str(line, "at"), 16)
try:
bar_addr = int(get_value_after_str(line, "at"), 16)
except ValueError:
continue
bar_num = line.split()[1].strip(':')
if bar_addr >= common.SIZE_4G or bar_addr < common.SIZE_2G:
if not tmp_bar_attr.remappable: