mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 23:55:12 +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:
committed by
Jelle Raaijmakers
parent
20d517f1da
commit
83b87a5ade
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user