mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
Kernel: Add MSIxInfo struct to PCI DeviceIdentifier
Add a struct named MSIxInfo that stores all the relevant MSIx information as a part of PCI DeviceIdentifier struct. Populate the MSIx struct during the PCI device init. As the DeviceIdentifier struct need to populate MSIx info, don't mark DeviceIdentifier as const in the PCI::Device class.
This commit is contained in:
parent
71c75873c9
commit
d0fbaf790a
4 changed files with 39 additions and 1 deletions
|
@ -17,4 +17,16 @@ ErrorOr<NonnullRefPtr<DeviceIdentifier>> DeviceIdentifier::from_enumerable_ident
|
|||
return adopt_nonnull_ref_or_enomem(new (nothrow) DeviceIdentifier(other_identifier));
|
||||
}
|
||||
|
||||
void DeviceIdentifier::initialize()
|
||||
{
|
||||
for (auto cap : capabilities()) {
|
||||
if (cap.id() == PCI::Capabilities::ID::MSIX) {
|
||||
auto msix_bir_bar = (cap.read8(4) & msix_table_bir_mask);
|
||||
auto msix_bir_offset = (cap.read32(4) & msix_table_offset_mask);
|
||||
auto msix_count = (cap.read16(2) & msix_control_table_mask) + 1;
|
||||
m_msix_info = MSIxInfo(msix_count, msix_bir_bar, msix_bir_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue