platform_drv(x86): use 32bit writes for MSI-X

Fixes #3927
This commit is contained in:
Alexander Boettcher 2020-10-28 22:08:31 +01:00 committed by Christian Helmuth
parent c93f3a1136
commit 11e261ada4
2 changed files with 9 additions and 5 deletions

View File

@ -297,15 +297,17 @@ bool Platform::Device_component::_setup_msix(Genode::uint16_t const msix_cap)
struct Msi_entry : public Mmio {
Msi_entry(addr_t const base) : Mmio(base) { }
struct Address : Register<0x0, 64> { };
struct Value : Register<0x8, 32> { };
struct Vector : Register<0xc, 32> {
struct Address_low : Register<0x0, 32> { };
struct Address_high : Register<0x4, 32> { };
struct Value : Register<0x8, 32> { };
struct Vector : Register<0xc, 32> {
struct Mask : Bitfield <0, 1> { };
};
} msi_entry_0 (msix_table);
/* setup first msi-x table entry */
msi_entry_0.write<Msi_entry::Address>(msi_address & ~(0x3UL));
msi_entry_0.write<Msi_entry::Address_low>(msi_address & ~(0x3UL));
msi_entry_0.write<Msi_entry::Address_high>(sizeof(msi_address) == 4 ? 0 : msi_address >> 32);
msi_entry_0.write<Msi_entry::Value>(msi_value);
msi_entry_0.write<Msi_entry::Vector::Mask>(0);

View File

@ -260,7 +260,9 @@ class Platform::Device_component : public Genode::Rpc_object<Platform::Device>,
/* requested io_mem not allocated by Pci::Resource - try direct */
Io_mem io_mem(_env, msix_table_phys, msix_table_size, false);
Attached_dataspace mem_io(_env.rm(), io_mem.dataspace());
Genode::addr_t const msix_table = reinterpret_cast<addr_t>(mem_io.local_addr<void>());
addr_t const offset = msix_table_phys & 0xfffull;
addr_t const msix_table = reinterpret_cast<addr_t>(mem_io.local_addr<void>()) + offset;
fn(msix_table);
};