From 78ec750610e1b7fd07804c4baee260b712c45bfb Mon Sep 17 00:00:00 2001 From: Werner Zeh Date: Fri, 11 Jun 2021 07:05:06 +0200 Subject: mb/siemens/mc_ehl: 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. For now, the PCI devices with the ID 110a:403e and 110a:403f needs this master bit to be set. Change-Id: Id3f6bda97e5f47d0613a1db8f8adac0b158ab8b1 Signed-off-by: Werner Zeh Reviewed-on: https://review.coreboot.org/c/coreboot/+/56632 Reviewed-by: Paul Menzel Reviewed-by: Mario Scheithauer Tested-by: build bot (Jenkins) --- src/mainboard/siemens/mc_ehl/mainboard.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/mainboard/siemens/mc_ehl') diff --git a/src/mainboard/siemens/mc_ehl/mainboard.c b/src/mainboard/siemens/mc_ehl/mainboard.c index 4cc5490f2a..d3475678bc 100644 --- a/src/mainboard/siemens/mc_ehl/mainboard.c +++ b/src/mainboard/siemens/mc_ehl/mainboard.c @@ -4,6 +4,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -120,8 +123,25 @@ static void mainboard_init(void *chip_info) gpio_configure_pads(pads, num); } +static void mainboard_final(void *chip_info) +{ + struct device *dev; + + if (CONFIG(PCI_ALLOW_BUS_MASTER_ANY_DEVICE)) { + /* Set Master Enable for on-board PCI devices if allowed. */ + dev = dev_find_device(PCI_VENDOR_ID_SIEMENS, 0x403e, 0); + if (dev) + pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER); + + dev = dev_find_device(PCI_VENDOR_ID_SIEMENS, 0x403f, 0); + if (dev) + pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER); + } +} + struct chip_operations mainboard_ops = { - .init = mainboard_init, + .init = mainboard_init, + .final = mainboard_final }; BOOT_STATE_INIT_ENTRY(BS_DEV_ENUMERATE, BS_ON_ENTRY, wait_for_legacy_dev, NULL); -- cgit v1.2.3