diff --git a/repos/os/include/pci/config.h b/repos/os/include/pci/config.h index a4d49be11d..f96f25e10e 100644 --- a/repos/os/include/pci/config.h +++ b/repos/os/include/pci/config.h @@ -44,16 +44,17 @@ struct Pci::Config : Genode::Mmio struct Command : Register<0x4, 16> { - struct Io_space_enable : Bitfield<0, 1> {}; - struct Memory_space_enable : Bitfield<1, 1> {}; - struct Bus_master_enable : Bitfield<2, 1> {}; - struct Special_cycle_enable : Bitfield<3, 1> {}; - struct Memory_write_invalidate : Bitfield<4, 1> {}; - struct Vga_palette_snoop : Bitfield<5, 1> {}; - struct Parity_error_response : Bitfield<6, 1> {}; - struct Idsel : Bitfield<7, 1> {}; - struct Serror_enable : Bitfield<8, 1> {}; - struct Interrupt_enable : Bitfield<10, 1> {}; + struct Io_space_enable : Bitfield<0, 1> {}; + struct Memory_space_enable : Bitfield<1, 1> {}; + struct Bus_master_enable : Bitfield<2, 1> {}; + struct Special_cycle_enable : Bitfield<3, 1> {}; + struct Memory_write_invalidate : Bitfield<4, 1> {}; + struct Vga_palette_snoop : Bitfield<5, 1> {}; + struct Parity_error_response : Bitfield<6, 1> {}; + struct Idsel : Bitfield<7, 1> {}; + struct Serror_enable : Bitfield<8, 1> {}; + struct Fast_back_to_back_enable : Bitfield<9, 1> {}; + struct Interrupt_enable : Bitfield<10, 1> {}; }; struct Status : Register<0x6, 16> diff --git a/repos/os/src/drivers/platform/pci.cc b/repos/os/src/drivers/platform/pci.cc index a73d25643e..eb0a5b92b0 100644 --- a/repos/os/src/drivers/platform/pci.cc +++ b/repos/os/src/drivers/platform/pci.cc @@ -20,6 +20,7 @@ #include #include #include +#include using namespace Genode; using namespace Pci; @@ -62,6 +63,7 @@ struct Config_helper /* apply different PCI quirks, bios handover etc. */ Driver::pci_uhci_quirks(_cfg, _config.base()); + Driver::pci_hd_audio_quirks(_cfg, _config); } void disable() diff --git a/repos/os/src/drivers/platform/pci_hd_audio.h b/repos/os/src/drivers/platform/pci_hd_audio.h new file mode 100644 index 0000000000..bf2c14523b --- /dev/null +++ b/repos/os/src/drivers/platform/pci_hd_audio.h @@ -0,0 +1,52 @@ +/* + * \brief Platform driver - PCI HD AUDIO utilities + * \author Stefan Kalkowski + * \date 2022-09-09 + */ + +/* + * Copyright (C) 2022 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#include +#include + +namespace Driver { + static void pci_hd_audio_quirks(Device::Pci_config cfg, + Pci::Config & config); +} + + +void Driver::pci_hd_audio_quirks(Device::Pci_config cfg, + Pci::Config & config) +{ + enum { HDAUDIO_CLASS_CODE = 0x40300 }; + + if ((cfg.class_code & 0xffff00) != HDAUDIO_CLASS_CODE) + return; + + /* PCI configuration register for HDAUDIO */ + struct Hdaudio : Mmio + { + struct Traffic_class_select : Register<0x44, 8> {}; + + struct Intel_device_control : Register<0x78, 16> + { + struct No_snoop : Bitfield<11,1> {}; + }; + + using Mmio::Mmio; + }; + + config.write(1); + + Hdaudio audio(config.base()); + audio.write(0); + + if (cfg.vendor_id == 0x8086) + audio.write(0); +} +