mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-07 20:31:04 +03:00
Kernel: Add write{8,16,32} to the PCI Capability struct
MSI(x) mechanism requires the device to write to its Capability structure. Add write{8,16,32} similar to read{8,16,32}.
This commit is contained in:
parent
91da264a4c
commit
71c75873c9
Notes:
sideshowbarker
2024-07-17 06:35:16 +09:00
Author: https://github.com/Panky-codes Commit: https://github.com/SerenityOS/serenity/commit/71c75873c9 Pull-request: https://github.com/SerenityOS/serenity/pull/18580 Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/kleinesfilmroellchen Reviewed-by: https://github.com/supercomputer7 ✅
@ -285,6 +285,27 @@ u32 Capability::read32(size_t offset) const
|
||||
return read32_offsetted(identifier, m_ptr + offset);
|
||||
}
|
||||
|
||||
void Capability::write8(size_t offset, u8 value) const
|
||||
{
|
||||
auto& identifier = get_device_identifier(m_address);
|
||||
SpinlockLocker locker(identifier.operation_lock());
|
||||
write8_offsetted(identifier, m_ptr + offset, value);
|
||||
}
|
||||
|
||||
void Capability::write16(size_t offset, u16 value) const
|
||||
{
|
||||
auto& identifier = get_device_identifier(m_address);
|
||||
SpinlockLocker locker(identifier.operation_lock());
|
||||
write16_offsetted(identifier, m_ptr + offset, value);
|
||||
}
|
||||
|
||||
void Capability::write32(size_t offset, u32 value) const
|
||||
{
|
||||
auto& identifier = get_device_identifier(m_address);
|
||||
SpinlockLocker locker(identifier.operation_lock());
|
||||
write32_offsetted(identifier, m_ptr + offset, value);
|
||||
}
|
||||
|
||||
DeviceIdentifier const& get_device_identifier(Address address)
|
||||
{
|
||||
return Access::the().get_device_identifier(address);
|
||||
|
@ -238,6 +238,9 @@ public:
|
||||
u8 read8(size_t offset) const;
|
||||
u16 read16(size_t offset) const;
|
||||
u32 read32(size_t offset) const;
|
||||
void write8(size_t offset, u8 value) const;
|
||||
void write16(size_t offset, u16 value) const;
|
||||
void write32(size_t offset, u32 value) const;
|
||||
|
||||
private:
|
||||
const Address m_address;
|
||||
|
Loading…
Reference in New Issue
Block a user