From 7f0c89f37839525f53e5b0ce667912f52bee4626 Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Fri, 7 Oct 2022 14:31:42 +0200 Subject: [PATCH] pci_decode: enable all bridges set I/O port, MMIO, and bus master to enabled for bridges where disabled. issue #4578 --- repos/os/src/app/pci_decode/main.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/repos/os/src/app/pci_decode/main.cc b/repos/os/src/app/pci_decode/main.cc index cf237a12a7..9f5d22141c 100644 --- a/repos/os/src/app/pci_decode/main.cc +++ b/repos/os/src/app/pci_decode/main.cc @@ -82,6 +82,18 @@ void Main::parse_pci_function(Bdf bdf, new (heap) Bridge(parent.sub_bridges, bdf, bcfg.secondary_bus_number(), bcfg.subordinate_bus_number()); + + /* enable I/O spaces and DMA in bridges if not done already */ + using Command = Pci::Config::Command; + Command::access_t command = bcfg.read(); + if (Command::Io_space_enable::get(command) == 0 || + Command::Memory_space_enable::get(command) == 0 || + Command::Bus_master_enable::get(command) == 0) { + Command::Io_space_enable::set(command, 1); + Command::Memory_space_enable::set(command, 1); + Command::Bus_master_enable::set(command, 1); + bcfg.write(command); + } }); }