mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +00:00
Kernel: Add PCI::get_BAR convenience method
Based on pull #3236 by tomuta Co-authored-by: Tom <tomut@yahoo.com>
This commit is contained in:
parent
172d23deae
commit
40a1f89d67
2 changed files with 22 additions and 0 deletions
|
@ -252,6 +252,27 @@ u32 get_BAR5(Address address)
|
|||
return read32(address, PCI_BAR5);
|
||||
}
|
||||
|
||||
u32 get_BAR(Address address, u8 bar)
|
||||
{
|
||||
ASSERT(bar <= 5);
|
||||
switch (bar) {
|
||||
case 0:
|
||||
return get_BAR0(address);
|
||||
case 1:
|
||||
return get_BAR1(address);
|
||||
case 2:
|
||||
return get_BAR2(address);
|
||||
case 3:
|
||||
return get_BAR3(address);
|
||||
case 4:
|
||||
return get_BAR4(address);
|
||||
case 5:
|
||||
return get_BAR5(address);
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
u8 get_revision_id(Address address)
|
||||
{
|
||||
return read8(address, PCI_REVISION_ID);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue