summaryrefslogtreecommitdiff
path: root/Kernel/Graphics/VMWare/GraphicsAdapter.cpp
diff options
context:
space:
mode:
authorPankaj Raghav <dev@pankajraghav.com>2023-04-24 12:32:12 +0200
committerJelle Raaijmakers <jelle@gmta.nl>2023-04-24 21:41:54 +0200
commit83b87a5adec85e262f1e7712fc421cf9ca43cfa3 (patch)
treefcb723e82735152fd437414787a83c334e7cb5bc /Kernel/Graphics/VMWare/GraphicsAdapter.cpp
parent20d517f1da2899b0ee3181ffa5585c73effd010b (diff)
downloadserenity-83b87a5adec85e262f1e7712fc421cf9ca43cfa3.zip
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.
Diffstat (limited to 'Kernel/Graphics/VMWare/GraphicsAdapter.cpp')
-rw-r--r--Kernel/Graphics/VMWare/GraphicsAdapter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Graphics/VMWare/GraphicsAdapter.cpp b/Kernel/Graphics/VMWare/GraphicsAdapter.cpp
index e79c62586b..15f86f8286 100644
--- a/Kernel/Graphics/VMWare/GraphicsAdapter.cpp
+++ b/Kernel/Graphics/VMWare/GraphicsAdapter.cpp
@@ -69,7 +69,7 @@ UNMAP_AFTER_INIT ErrorOr<void> VMWareGraphicsAdapter::initialize_fifo_registers(
{
auto framebuffer_size = read_io_register(VMWareDisplayRegistersOffset::FB_SIZE);
auto fifo_size = read_io_register(VMWareDisplayRegistersOffset::MEM_SIZE);
- auto fifo_physical_address = PhysicalAddress(PCI::get_BAR2(device_identifier()) & 0xfffffff0);
+ auto fifo_physical_address = PhysicalAddress(PCI::get_BAR2(device_identifier()) & PCI::bar_address_mask);
dbgln("VMWare SVGA @ {}: framebuffer size {} bytes, FIFO size {} bytes @ {}", device_identifier().address(), framebuffer_size, fifo_size, fifo_physical_address);
if (framebuffer_size < 0x100000 || fifo_size < 0x10000) {
@@ -185,7 +185,7 @@ UNMAP_AFTER_INIT ErrorOr<void> VMWareGraphicsAdapter::initialize_adapter()
auto bar1_space_size = PCI::get_BAR_space_size(device_identifier(), PCI::HeaderType0BaseRegister::BAR1);
- m_display_connector = VMWareDisplayConnector::must_create(*this, PhysicalAddress(PCI::get_BAR1(device_identifier()) & 0xfffffff0), bar1_space_size);
+ m_display_connector = VMWareDisplayConnector::must_create(*this, PhysicalAddress(PCI::get_BAR1(device_identifier()) & PCI::bar_address_mask), bar1_space_size);
TRY(m_display_connector->set_safe_mode_setting());
return {};
}