mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07:45 +00:00
Kernel/Graphics: Don't try to enumerate PCI adapters if PCI is disabled
If there's no PCI bus, then it's safe to assume that the x86 machine we run on supports VGA text mode console output with an ISA VGA adapter. If this is the case, we just instantiate a ISAVGAAdapter object that assumes this situation and allows us to boot into VGA text mode console.
This commit is contained in:
parent
15315be55c
commit
fafa339264
10 changed files with 197 additions and 72 deletions
46
Kernel/Graphics/VGA/PCIAdapter.h
Normal file
46
Kernel/Graphics/VGA/PCIAdapter.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Bus/PCI/Device.h>
|
||||
#include <Kernel/Graphics/Console/Console.h>
|
||||
#include <Kernel/Graphics/FramebufferDevice.h>
|
||||
#include <Kernel/Graphics/GenericGraphicsAdapter.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class PCIVGACompatibleAdapter : public VGACompatibleAdapter
|
||||
, public PCI::Device {
|
||||
public:
|
||||
static NonnullRefPtr<PCIVGACompatibleAdapter> initialize_with_preset_resolution(PCI::DeviceIdentifier const&, PhysicalAddress, size_t framebuffer_width, size_t framebuffer_height, size_t framebuffer_pitch);
|
||||
static NonnullRefPtr<PCIVGACompatibleAdapter> initialize(PCI::DeviceIdentifier const&);
|
||||
|
||||
virtual bool framebuffer_devices_initialized() const override { return !m_framebuffer_device.is_null(); }
|
||||
|
||||
protected:
|
||||
explicit PCIVGACompatibleAdapter(PCI::Address);
|
||||
|
||||
private:
|
||||
PCIVGACompatibleAdapter(PCI::Address, PhysicalAddress, size_t framebuffer_width, size_t framebuffer_height, size_t framebuffer_pitch);
|
||||
|
||||
// ^GenericGraphicsAdapter
|
||||
virtual void initialize_framebuffer_devices() override;
|
||||
|
||||
virtual void enable_consoles() override;
|
||||
virtual void disable_consoles() override;
|
||||
|
||||
protected:
|
||||
PhysicalAddress m_framebuffer_address;
|
||||
size_t m_framebuffer_width { 0 };
|
||||
size_t m_framebuffer_height { 0 };
|
||||
size_t m_framebuffer_pitch { 0 };
|
||||
|
||||
RefPtr<FramebufferDevice> m_framebuffer_device;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue