mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
Kernel/Graphics: Export Bochs definitions to a header file
These definitions will be used later when applying the DisplayConnector design on the Bochs driver.
This commit is contained in:
parent
b401f278ad
commit
9f0b5b04ff
3 changed files with 67 additions and 53 deletions
66
Kernel/Graphics/Bochs/Definitions.h
Normal file
66
Kernel/Graphics/Bochs/Definitions.h
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Types.h>
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
|
||||||
|
#define VBE_DISPI_IOPORT_INDEX 0x01CE
|
||||||
|
#define VBE_DISPI_IOPORT_DATA 0x01CF
|
||||||
|
|
||||||
|
#define BOCHS_DISPLAY_LITTLE_ENDIAN 0x1e1e1e1e
|
||||||
|
#define BOCHS_DISPLAY_BIG_ENDIAN 0xbebebebe
|
||||||
|
|
||||||
|
#define VBE_DISPI_ID5 0xB0C5
|
||||||
|
|
||||||
|
enum class BochsFramebufferSettings {
|
||||||
|
Enabled = 0x1,
|
||||||
|
LinearFramebuffer = 0x40,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class BochsDISPIRegisters {
|
||||||
|
ID = 0x0,
|
||||||
|
XRES = 0x1,
|
||||||
|
YRES = 0x2,
|
||||||
|
BPP = 0x3,
|
||||||
|
ENABLE = 0x4,
|
||||||
|
BANK = 0x5,
|
||||||
|
VIRT_WIDTH = 0x6,
|
||||||
|
VIRT_HEIGHT = 0x7,
|
||||||
|
X_OFFSET = 0x8,
|
||||||
|
Y_OFFSET = 0x9,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct [[gnu::packed]] DISPIInterface {
|
||||||
|
u16 index_id;
|
||||||
|
u16 xres;
|
||||||
|
u16 yres;
|
||||||
|
u16 bpp;
|
||||||
|
u16 enable;
|
||||||
|
u16 bank;
|
||||||
|
u16 virt_width;
|
||||||
|
u16 virt_height;
|
||||||
|
u16 x_offset;
|
||||||
|
u16 y_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct [[gnu::packed]] ExtensionRegisters {
|
||||||
|
u32 region_size;
|
||||||
|
u32 framebuffer_byteorder;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct [[gnu::packed]] BochsDisplayMMIORegisters {
|
||||||
|
u8 edid_data[0x400];
|
||||||
|
u16 vga_ioports[0x10];
|
||||||
|
u8 reserved[0xE0];
|
||||||
|
DISPIInterface bochs_regs;
|
||||||
|
u8 reserved2[0x100 - sizeof(DISPIInterface)];
|
||||||
|
ExtensionRegisters extension_regs;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -16,61 +16,8 @@
|
||||||
#include <Kernel/Memory/TypedMapping.h>
|
#include <Kernel/Memory/TypedMapping.h>
|
||||||
#include <Kernel/Sections.h>
|
#include <Kernel/Sections.h>
|
||||||
|
|
||||||
#define VBE_DISPI_IOPORT_INDEX 0x01CE
|
|
||||||
#define VBE_DISPI_IOPORT_DATA 0x01CF
|
|
||||||
|
|
||||||
#define VBE_DISPI_ID5 0xB0C5
|
|
||||||
|
|
||||||
#define BOCHS_DISPLAY_LITTLE_ENDIAN 0x1e1e1e1e
|
|
||||||
#define BOCHS_DISPLAY_BIG_ENDIAN 0xbebebebe
|
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
enum class BochsFramebufferSettings {
|
|
||||||
Enabled = 0x1,
|
|
||||||
LinearFramebuffer = 0x40,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class BochsDISPIRegisters {
|
|
||||||
ID = 0x0,
|
|
||||||
XRES = 0x1,
|
|
||||||
YRES = 0x2,
|
|
||||||
BPP = 0x3,
|
|
||||||
ENABLE = 0x4,
|
|
||||||
BANK = 0x5,
|
|
||||||
VIRT_WIDTH = 0x6,
|
|
||||||
VIRT_HEIGHT = 0x7,
|
|
||||||
X_OFFSET = 0x8,
|
|
||||||
Y_OFFSET = 0x9,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct [[gnu::packed]] DISPIInterface {
|
|
||||||
u16 index_id;
|
|
||||||
u16 xres;
|
|
||||||
u16 yres;
|
|
||||||
u16 bpp;
|
|
||||||
u16 enable;
|
|
||||||
u16 bank;
|
|
||||||
u16 virt_width;
|
|
||||||
u16 virt_height;
|
|
||||||
u16 x_offset;
|
|
||||||
u16 y_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct [[gnu::packed]] ExtensionRegisters {
|
|
||||||
u32 region_size;
|
|
||||||
u32 framebuffer_byteorder;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct [[gnu::packed]] BochsDisplayMMIORegisters {
|
|
||||||
u8 edid_data[0x400];
|
|
||||||
u16 vga_ioports[0x10];
|
|
||||||
u8 reserved[0xE0];
|
|
||||||
DISPIInterface bochs_regs;
|
|
||||||
u8 reserved2[0x100 - sizeof(DISPIInterface)];
|
|
||||||
ExtensionRegisters extension_regs;
|
|
||||||
};
|
|
||||||
|
|
||||||
UNMAP_AFTER_INIT NonnullRefPtr<BochsGraphicsAdapter> BochsGraphicsAdapter::initialize(PCI::DeviceIdentifier const& pci_device_identifier)
|
UNMAP_AFTER_INIT NonnullRefPtr<BochsGraphicsAdapter> BochsGraphicsAdapter::initialize(PCI::DeviceIdentifier const& pci_device_identifier)
|
||||||
{
|
{
|
||||||
PCI::HardwareID id = pci_device_identifier.hardware_id();
|
PCI::HardwareID id = pci_device_identifier.hardware_id();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <Kernel/Bus/PCI/Device.h>
|
#include <Kernel/Bus/PCI/Device.h>
|
||||||
|
#include <Kernel/Graphics/Bochs/Definitions.h>
|
||||||
#include <Kernel/Graphics/Console/GenericFramebufferConsole.h>
|
#include <Kernel/Graphics/Console/GenericFramebufferConsole.h>
|
||||||
#include <Kernel/Graphics/FramebufferDevice.h>
|
#include <Kernel/Graphics/FramebufferDevice.h>
|
||||||
#include <Kernel/Graphics/GenericGraphicsAdapter.h>
|
#include <Kernel/Graphics/GenericGraphicsAdapter.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue