diff --git a/misc/config_tools/schema/config.xsd b/misc/config_tools/schema/config.xsd
index 0aa4f1ebb..a81d212a8 100644
--- a/misc/config_tools/schema/config.xsd
+++ b/misc/config_tools/schema/config.xsd
@@ -172,6 +172,11 @@ If your VM is not a security VM, leave this option unchecked.
+
+
+ Specify the maximum number of PCI buses. The default value is calculated from the board configuration file. Integer from 1 to 256.
+
+
diff --git a/misc/config_tools/static_allocators/board_capability.py b/misc/config_tools/static_allocators/board_capability.py
index 141afca9c..e03528a5e 100644
--- a/misc/config_tools/static_allocators/board_capability.py
+++ b/misc/config_tools/static_allocators/board_capability.py
@@ -4,7 +4,7 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
-
+import logging
import common
def powerof2_roundup(value):
@@ -22,5 +22,14 @@ def create_max_ir_entries(scenario_etree, allocation_etree):
def fn(board_etree, scenario_etree, allocation_etree):
pci_bus_nums = board_etree.xpath("//bus[@type='pci']/@address")
- common.append_node("/acrn-config/platform/MAX_PCI_BUS_NUM", hex(max(map(lambda x: int(x, 16), pci_bus_nums)) + 1), allocation_etree)
+ calc_pci_bus_nums = (max(map(lambda x: int(x, 16), pci_bus_nums)) + 1)
+ user_def_pci_bus_nums = common.get_node(f"//MAX_PCI_BUS_NUM/text()", scenario_etree)
+ if user_def_pci_bus_nums == '0':
+ common.append_node("/acrn-config/platform/MAX_PCI_BUS_NUM", hex(calc_pci_bus_nums), allocation_etree)
+ else:
+ if calc_pci_bus_nums > int(user_def_pci_bus_nums):
+ logging.error(f"MAX_PCI_BUS_NUM should be greater than {calc_pci_bus_nums}")
+ sys.exit(1)
+ else:
+ common.append_node("/acrn-config/platform/MAX_PCI_BUS_NUM", hex(int(user_def_pci_bus_nums)), allocation_etree)
create_max_ir_entries(scenario_etree, allocation_etree)