mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
acrn-config: add CONFIG_SERIAL_x for new board
Add CONFIG_SERIAL_x in $(borad).config, this will help to output console log and help new board debug. Tracked-On: #3854 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
d699347e7b
commit
12a9bc29df
@ -67,6 +67,7 @@ def get_ram_range():
|
|||||||
def get_serial_type():
|
def get_serial_type():
|
||||||
""" Get the serial type of consle which set by user """
|
""" Get the serial type of consle which set by user """
|
||||||
ttys_type = ''
|
ttys_type = ''
|
||||||
|
ttys_value = ''
|
||||||
|
|
||||||
# Get ttySx information from board config file
|
# Get ttySx information from board config file
|
||||||
ttys_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "<TTYS_INFO>", "</TTYS_INFO>")
|
ttys_lines = board_cfg_lib.get_info(board_cfg_lib.BOARD_INFO_FILE, "<TTYS_INFO>", "</TTYS_INFO>")
|
||||||
@ -85,11 +86,15 @@ def get_serial_type():
|
|||||||
if ttyn in line:
|
if ttyn in line:
|
||||||
# line format:
|
# line format:
|
||||||
# seri:/dev/ttyS0 type:portio base:0x3F8 irq:4
|
# seri:/dev/ttyS0 type:portio base:0x3F8 irq:4
|
||||||
# seri:/dev/ttyS0 type:mmio base:0xB3640000 irq:4
|
# seri:/dev/ttyS0 type:mmio base:0xB3640000 irq:4 bdf:"0:x.y"
|
||||||
ttys_type = line.split()[1].split(':')[1]
|
ttys_type = line.split()[1].split(':')[1]
|
||||||
|
if ttys_type == "portio":
|
||||||
|
ttys_value = line.split()[2].split(':')[1]
|
||||||
|
elif ttys_type == "mmio":
|
||||||
|
ttys_value = line.split()[-1].split(':')[1]
|
||||||
break
|
break
|
||||||
|
|
||||||
return ttys_type
|
return (ttys_type, ttys_value)
|
||||||
|
|
||||||
|
|
||||||
def generate_file(config):
|
def generate_file(config):
|
||||||
@ -118,12 +123,14 @@ def generate_file(config):
|
|||||||
print("{}".format(DESC), file=config)
|
print("{}".format(DESC), file=config)
|
||||||
print('CONFIG_BOARD="{}"'.format(board_cfg_lib.BOARD_NAME), file=config)
|
print('CONFIG_BOARD="{}"'.format(board_cfg_lib.BOARD_NAME), file=config)
|
||||||
|
|
||||||
serial_type = get_serial_type()
|
(serial_type, serial_value) = get_serial_type()
|
||||||
|
|
||||||
if serial_type == "portio":
|
if serial_type == "portio":
|
||||||
print("CONFIG_SERIAL_LEGACY=y", file=config)
|
print("CONFIG_SERIAL_LEGACY=y", file=config)
|
||||||
|
print("CONFIG_SERIAL_PIO_BASE={}".format(serial_value), file=config)
|
||||||
if serial_type == "mmio":
|
if serial_type == "mmio":
|
||||||
print("CONFIG_SERIAL_PCI=y", file=config)
|
print("CONFIG_SERIAL_PCI=y", file=config)
|
||||||
|
print("CONFIG_SERIAL_PCI_BDF={}".format(serial_value), file=config)
|
||||||
|
|
||||||
print("CONFIG_HV_RAM_START={}".format(hex(hv_start_addr)), file=config)
|
print("CONFIG_HV_RAM_START={}".format(hex(hv_start_addr)), file=config)
|
||||||
print("CONFIG_HV_RAM_SIZE={}".format(hex(hv_ram_size)), file=config)
|
print("CONFIG_HV_RAM_SIZE={}".format(hex(hv_ram_size)), file=config)
|
||||||
|
@ -284,8 +284,10 @@ def get_valid_console():
|
|||||||
if used_console_lines:
|
if used_console_lines:
|
||||||
vuart0_valid_console.clear()
|
vuart0_valid_console.clear()
|
||||||
for console in used_console_lines:
|
for console in used_console_lines:
|
||||||
|
#seri:/dev/ttySx type:mmio base:0x91526000 irq:4 bdf:"00:18.0"
|
||||||
|
#seri:/dev/ttySy type:portio base:0x2f8 irq:5
|
||||||
tty = console.split('/')[2].split()[0]
|
tty = console.split('/')[2].split()[0]
|
||||||
ttys_irq = console.split(':')[-1].strip()
|
ttys_irq = console.split()[3].split(':')[1].strip()
|
||||||
NATIVE_CONSOLE_DIC[tty] = ttys_irq
|
NATIVE_CONSOLE_DIC[tty] = ttys_irq
|
||||||
vuart0_valid_console.append(tty)
|
vuart0_valid_console.append(tty)
|
||||||
if tty:
|
if tty:
|
||||||
|
@ -48,6 +48,30 @@ def detected_ttys():
|
|||||||
return tty_used_list
|
return tty_used_list
|
||||||
|
|
||||||
|
|
||||||
|
def irq2bdf(irq_n):
|
||||||
|
cmd = 'lspci -vv'
|
||||||
|
res = parser_lib.cmd_execute(cmd)
|
||||||
|
bdf = ''
|
||||||
|
irq = 0
|
||||||
|
while True:
|
||||||
|
line = res.stdout.readline().decode('ascii')
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
|
||||||
|
if ':' not in line:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if '.' in line.split()[0]:
|
||||||
|
bdf = line.split()[0]
|
||||||
|
|
||||||
|
if "Interrupt:" in line.strip():
|
||||||
|
irq = line.split()[-1]
|
||||||
|
if irq == irq_n and bdf:
|
||||||
|
break
|
||||||
|
|
||||||
|
return bdf
|
||||||
|
|
||||||
|
|
||||||
def dump_ttys_info(ttys_list, config):
|
def dump_ttys_info(ttys_list, config):
|
||||||
for ttys in ttys_list:
|
for ttys in ttys_list:
|
||||||
ttys_n = ttys.split('/')[-1]
|
ttys_n = ttys.split('/')[-1]
|
||||||
@ -65,7 +89,8 @@ def dump_ttys_info(ttys_list, config):
|
|||||||
elif ttys_type[serial_type] == 'MMIO':
|
elif ttys_type[serial_type] == 'MMIO':
|
||||||
base_path = '{}{}/iomem_base'.format(TTY_PATH, ttys_n)
|
base_path = '{}{}/iomem_base'.format(TTY_PATH, ttys_n)
|
||||||
base = read_ttys_node(base_path)
|
base = read_ttys_node(base_path)
|
||||||
print("\tseri:{} type:mmio base:{} irq:{}".format(ttys, base, irq), file=config)
|
bdf = irq2bdf(irq)
|
||||||
|
print('\tseri:{} type:mmio base:{} irq:{} bdf:"{}"'.format(ttys, base, irq, bdf), file=config)
|
||||||
|
|
||||||
|
|
||||||
def dump_ttys(config):
|
def dump_ttys(config):
|
||||||
|
@ -278,9 +278,9 @@
|
|||||||
</BLOCK_DEVICE_INFO>
|
</BLOCK_DEVICE_INFO>
|
||||||
|
|
||||||
<TTYS_INFO>
|
<TTYS_INFO>
|
||||||
seri:/dev/ttyS0 type:mmio base:0xB3640000 irq:4
|
seri:/dev/ttyS0 type:mmio base:0xB3640000 irq:4 bdf:"00:18.0"
|
||||||
seri:/dev/ttyS2 type:mmio base:0x80E00000 irq:6
|
seri:/dev/ttyS2 type:mmio base:0x80E00000 irq:6 bdf:"00:18.2"
|
||||||
seri:/dev/ttyS3 type:mmio base:0xB363A000 irq:7
|
seri:/dev/ttyS3 type:mmio base:0xB363A000 irq:7 bdf:"00:18.2"
|
||||||
</TTYS_INFO>
|
</TTYS_INFO>
|
||||||
|
|
||||||
<AVAILABLE_IRQ_INFO>
|
<AVAILABLE_IRQ_INFO>
|
||||||
|
@ -257,8 +257,8 @@
|
|||||||
</BLOCK_DEVICE_INFO>
|
</BLOCK_DEVICE_INFO>
|
||||||
|
|
||||||
<TTYS_INFO>
|
<TTYS_INFO>
|
||||||
seri:/dev/ttyS0 type:mmio base:0x91526000 irq:4
|
seri:/dev/ttyS0 type:mmio base:0x91526000 irq:4 bdf:"00:18.0"
|
||||||
seri:/dev/ttyS1 type:mmio base:0x91524000 irq:5
|
seri:/dev/ttyS1 type:mmio base:0x91524000 irq:5 bdf:"00:18.1"
|
||||||
</TTYS_INFO>
|
</TTYS_INFO>
|
||||||
|
|
||||||
<AVAILABLE_IRQ_INFO>
|
<AVAILABLE_IRQ_INFO>
|
||||||
|
@ -257,8 +257,8 @@
|
|||||||
</BLOCK_DEVICE_INFO>
|
</BLOCK_DEVICE_INFO>
|
||||||
|
|
||||||
<TTYS_INFO>
|
<TTYS_INFO>
|
||||||
seri:/dev/ttyS0 type:mmio base:0x91526000 irq:4
|
seri:/dev/ttyS0 type:mmio base:0x91526000 irq:4 bdf:"00:18.0"
|
||||||
seri:/dev/ttyS1 type:mmio base:0x91524000 irq:5
|
seri:/dev/ttyS1 type:mmio base:0x91524000 irq:5 bdf:"00:18.1"
|
||||||
</TTYS_INFO>
|
</TTYS_INFO>
|
||||||
|
|
||||||
<AVAILABLE_IRQ_INFO>
|
<AVAILABLE_IRQ_INFO>
|
||||||
|
Loading…
Reference in New Issue
Block a user