pci_decode: disable MSI/MSI-X capabilities

Default disabled initialization prevents follow-up errors if one
capability is already enabled on boot, but platform_drv decides to
enable the other one. The PCI spec explicitly states that "Behavior is
undefined if both MSI and MSI-X are enabled simultaneously".

Fixes #5228
This commit is contained in:
Christian Helmuth 2024-05-23 17:04:16 +02:00
parent b793802333
commit e90f6988d8

View File

@ -145,6 +145,10 @@ bus_t Main::parse_pci_function(Bdf bdf,
bool msi_x = cfg.msi_x_cap.constructed();
irq_pin_t irq_pin = cfg.read<Config::Irq_pin>();
/* disable MSI/MSI-X by default */
if (msi) cfg.msi_cap->write<Pci::Config::Msi_capability::Control::Enable>(0);
if (msi_x) cfg.msi_x_cap->write<Pci::Config::Msi_x_capability::Control::Enable>(0);
gen.node("device", [&]
{
auto string = [&] (uint64_t v) { return String<16>(Hex(v)); };