1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 15:25: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

@ -47,8 +47,8 @@ ErrorOr<void> IntelNativeGraphicsAdapter::initialize_adapter()
dmesgln_pci(*this, "framebuffer @ {}", PhysicalAddress(PCI::get_BAR2(device_identifier())));
using MMIORegion = IntelDisplayConnectorGroup::MMIORegion;
MMIORegion first_region { MMIORegion::BARAssigned::BAR0, PhysicalAddress(PCI::get_BAR0(device_identifier()) & 0xfffffff0), bar0_space_size };
MMIORegion second_region { MMIORegion::BARAssigned::BAR2, PhysicalAddress(PCI::get_BAR2(device_identifier()) & 0xfffffff0), bar2_space_size };
MMIORegion first_region { MMIORegion::BARAssigned::BAR0, PhysicalAddress(PCI::get_BAR0(device_identifier()) & PCI::bar_address_mask), bar0_space_size };
MMIORegion second_region { MMIORegion::BARAssigned::BAR2, PhysicalAddress(PCI::get_BAR2(device_identifier()) & PCI::bar_address_mask), bar2_space_size };
PCI::enable_bus_mastering(device_identifier());
PCI::enable_io_space(device_identifier());