1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 11:45:08 +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

@ -40,7 +40,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::initialize(bool is_queue_polled)
PCI::enable_memory_space(device_identifier());
PCI::enable_bus_mastering(device_identifier());
m_bar = PCI::get_BAR0(device_identifier()) & BAR_ADDR_MASK;
m_bar = PCI::get_BAR0(device_identifier()) & PCI::bar_address_mask;
static_assert(sizeof(ControllerRegister) == REG_SQ0TDBL_START);
static_assert(sizeof(NVMeSubmission) == (1 << SQ_WIDTH));