From 6ddf793f16bf66e23c6f83facc0d3923d833683f Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 27 Aug 2020 15:39:37 +0800 Subject: [PATCH] acrn-config: convert SERIAL_PCI_BDF string value to hex value Convert SERIAL_PCI_BDF string value to hex value. Tracked-On: #4937 Signed-off-by: Wei Liu Tested-by: Shuo A Liu --- misc/acrn-config/hv_config/board_defconfig.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc/acrn-config/hv_config/board_defconfig.py b/misc/acrn-config/hv_config/board_defconfig.py index 6bf706a5d..f8d0cf750 100644 --- a/misc/acrn-config/hv_config/board_defconfig.py +++ b/misc/acrn-config/hv_config/board_defconfig.py @@ -149,7 +149,11 @@ def get_serial_console(config): elif serial_type == "mmio" and pci_mmio: print("CONFIG_SERIAL_PCI=y", file=config) if serial_value: - print('CONFIG_SERIAL_PCI_BDF="{}"'.format(serial_value), file=config) + bus = int(serial_value.strip("'").split(':')[0], 16) + dev = int(serial_value.strip("'").split(':')[1].split(".")[0], 16) + fun = int(serial_value.strip("'").split('.')[1], 16) + value = ((bus & 0xFF) << 8) | ((dev & 0x1F) << 3) | (fun & 0x7) + print('CONFIG_SERIAL_PCI_BDF={}'.format(hex(value)), file=config) else: print("CONFIG_SERIAL_MMIO=y", file=config) if serial_value: