1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 19:15:07 +00:00

Kernel: Add bar_address_mask to mask the last 4 bits of a BAR address

Create a bar_address_mask constant to mask the last 4 bits of a BAR
address instead of hand coding the mask all over the kernel.
This commit is contained in:
Pankaj Raghav 2023-04-24 12:32:12 +02:00 committed by Jelle Raaijmakers
parent 20d517f1da
commit 83b87a5ade
8 changed files with 14 additions and 15 deletions

View file

@ -227,7 +227,7 @@ size_t get_BAR_space_size(DeviceIdentifier const& identifier, HeaderType0BaseReg
write32_offsetted(identifier, field, 0xFFFFFFFF);
u32 space_size = read32_offsetted(identifier, field);
write32_offsetted(identifier, field, bar_reserved);
space_size &= 0xfffffff0;
space_size &= bar_address_mask;
space_size = (~space_size) + 1;
return space_size;
}
@ -240,7 +240,7 @@ size_t get_expansion_rom_space_size(DeviceIdentifier const& identifier)
write32_offsetted(identifier, field, 0xFFFFFFFF);
u32 space_size = read32_offsetted(identifier, field);
write32_offsetted(identifier, field, bar_reserved);
space_size &= 0xfffffff0;
space_size &= bar_address_mask;
space_size = (~space_size) + 1;
return space_size;
}