mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
Kernel/PCI: Expose PCI option ROM data from the sysfs interface
For each exposed PCI device in sysfs, there's a new node called "rom" and by reading it, it exposes the raw data of a PCI option ROM blob to a user for examining the blob.
This commit is contained in:
parent
1f9d3a3523
commit
a7677f1d9b
6 changed files with 155 additions and 0 deletions
|
@ -232,6 +232,19 @@ size_t get_BAR_space_size(DeviceIdentifier const& identifier, HeaderType0BaseReg
|
|||
return space_size;
|
||||
}
|
||||
|
||||
size_t get_expansion_rom_space_size(DeviceIdentifier const& identifier)
|
||||
{
|
||||
SpinlockLocker locker(identifier.operation_lock());
|
||||
u8 field = to_underlying(PCI::RegisterOffset::EXPANSION_ROM_POINTER);
|
||||
u32 bar_reserved = read32_offsetted(identifier, field);
|
||||
write32_offsetted(identifier, field, 0xFFFFFFFF);
|
||||
u32 space_size = read32_offsetted(identifier, field);
|
||||
write32_offsetted(identifier, field, bar_reserved);
|
||||
space_size &= 0xfffffff0;
|
||||
space_size = (~space_size) + 1;
|
||||
return space_size;
|
||||
}
|
||||
|
||||
void raw_access(DeviceIdentifier const& identifier, u32 field, size_t access_size, u32 value)
|
||||
{
|
||||
SpinlockLocker locker(identifier.operation_lock());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue