config_tools: board_inspector: parse bdf for ioport serial controler

Add bdf infomation to ioport serial controler.

Tracked-On: #8235
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao junjie.mao@intel.com
This commit is contained in:
Yuanyuan Zhao 2022-10-11 11:14:46 +08:00 committed by acrnsi-robot
parent dcb0f05efc
commit f9e16db9e1

View File

@ -3,7 +3,8 @@
# SPDX-License-Identifier: BSD-3-Clause
#
import parser_lib
import parser_lib, os
from extractors.helpers import get_bdf_from_realpath
MEM_PATH = ['/proc/iomem', '/proc/meminfo']
TTY_PATH = '/sys/class/tty/'
@ -91,7 +92,15 @@ def dump_ttys_info(ttys_list, config):
if ttys_type[serial_type] == 'PORT':
base_path = '{}{}/port'.format(TTY_PATH, ttys_n)
base = read_ttys_node(base_path)
print("\tseri:{} type:portio base:{} irq:{}".format(ttys, base, irq), file=config)
try:
b = get_bdf_from_realpath(os.path.join(TTY_PATH, ttys_n, 'device'))
bdf = f'{b[0]}:{b[1]}.{b[2]}
except AssertionError:
bdf = ''
if bdf:
print("\tseri:{} type:portio base:{} irq:{} bdf:{}".format(ttys, base, irq, bdf), file=config)
else:
print("\tseri:{} type:portio base:{} irq:{}".format(ttys, base, irq), file=config)
elif ttys_type[serial_type] == 'MMIO':
base_path = '{}{}/iomem_base'.format(TTY_PATH, ttys_n)
base = read_ttys_node(base_path)