From 62b6d1e336aebae7328beba3bacad571ea9476d5 Mon Sep 17 00:00:00 2001 From: Kilian Krause Date: Wed, 16 Jul 2025 14:14:33 +0200 Subject: [PATCH] mb/siemens/mc_rpl: Enable master bit in PCI config space if allowed Some legacy devices need to have the master bit set in the PCI config due to old drivers not setting it correctly. Set the master bit if the feature is enabled via Kconfig switch PCI_ALLOW_BUS_MASTER_ANY_DEVICE. This implementation is similar to the approach used in an earlier Siemens platform, as implemented in commit 78ec750610e1 ("mb/siemens/mc_ehl: Enable master bit in PCI config space if allowed"). TEST=Confirmed bus master enabled via lspci after boot. Change-Id: I6d358ba7147860fd1383abe667a7006d9a30d542 Signed-off-by: Kilian Krause Reviewed-on: https://review.coreboot.org/c/coreboot/+/88963 Reviewed-by: Paul Menzel Reviewed-by: Mario Scheithauer Tested-by: build bot (Jenkins) --- src/mainboard/siemens/mc_rpl/mainboard.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mainboard/siemens/mc_rpl/mainboard.c b/src/mainboard/siemens/mc_rpl/mainboard.c index e5c399f269..26d1947e73 100644 --- a/src/mainboard/siemens/mc_rpl/mainboard.c +++ b/src/mainboard/siemens/mc_rpl/mainboard.c @@ -9,7 +9,9 @@ #include #include #include - +#include +#include +#include #define MAX_PATH_DEPTH 12 #define MAX_NUM_MAPPINGS 10 @@ -92,6 +94,19 @@ void mainboard_silicon_init_params(FSP_S_CONFIG *params) params->TurboMode = 0; } +static void mainboard_final(void *chip_info) +{ + struct device *dev; + + if (CONFIG(PCI_ALLOW_BUS_MASTER_ANY_DEVICE)) { + /* Enable bus mastering - target OS requires firmware initialization */ + dev = dev_find_device(PCI_VID_SIEMENS, 0x403f, 0); + if (dev) + pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER); + } +} + + static void mainboard_init(void *chip_info) { variant_configure_gpio_pads(); @@ -106,4 +121,5 @@ void __weak variant_devtree_update(void) struct chip_operations mainboard_ops = { .init = mainboard_init, + .final = mainboard_final, };