luxos/SysCore/include/bootinfo.h

193 lines
7.5 KiB
C

#ifndef _BOOTINFO_H
#define _BOOTINFO_H
//****************************************************************************
//** bootinfo.h
//****************************************************************************
#include <stdint.h>
/**The structure used by the VESA Controller Info table.*/
struct _VESA_CONTROLLER_INFO {
/** Vesa signature, should be "VESA". */
unsigned char Signature[4];
/** Version number, example: 0x0300 for VBE 3.0. */
uint16_t Version;
/** FAR pointer to OEM string. (seg:offset). */
uint16_t OEMString[2];
/** Capabilities, taken as 4 bytes. */
uint32_t Capabilities;
/** Video modes. FAR pointer (seg:offset). */
uint16_t VideoModes[2];
/** Total memory as number of 64k blocks. */
uint16_t TotalMemory;
} __attribute__((packed));
enum _VESA_MODE_ATTRIBUTES {
/** The mode is supported by the present hardware configuration. */
IsSupported = 0x01,
/** Optional information is available (must be = 1 for VBE v1.2+) */
OptionalInformation = 0x02,
/** BIOS output is supported. */
BiosOutput = 0x04,
/** Set if color, clear if monochrome. */
IsColor = 0x08,
/** Set if graphic mode, clear if text mode. */
IsGraphic = 0x10,
/** (VBE v2.0+) mode is not VGA compatible. */
VGACompatible = 0x20,
/** (VBE v2.0+) Bank switched mode not supported. */
BankSwitchedNotSupported = 0x40,
/** (VBE v2.0+) Linear framebuffer mode supported. */
LinearFramebufferSupported = 0x80,
/** (VBE v3.0) Interlaced mode available. */
InterlacedAvailable = 0x100,
/** (VBE/AF v1.0P) Application must call EnableDirrectAccess before calling bank-switching functions. */
EnableDirectAccess = 0x100,
/** (VBE v3.0) Hardware supports triple buffering. */
TripleBufferingSupported = 0x200,
/** (VBE v3.0) Hardware supports stereoscopic display. */
StereoscopicSupported = 0x400,
/** (VBE v3.0) Dual display start address support. */
DualDisplayStartAddress = 0x800
} VESAModeAttributeMasks;
enum _VESA_MODE_WINDOW_ATTRIBUTES {
/** Window exists. */
Exists = 0x1,
/** Window is readable. */
Readable = 0x2,
/** Window is writable. */
Writable = 0x4
} VESAModeWindowAttributeMasks;
enum _VESA_MODE_MEMORY_MODELS {
/** Text */
Text = 0x00,
/** CGA graphics*/
CGA = 0x01,
/** HGC graphics*/
HGC = 0x02,
/** 16-color EGA grahpics*/
EGA = 0x03,
/** packed pixel graphics*/
PackedPixel = 0x04,
/** "sequ 256 (non chain 4) grahpics*/
Sequ256 = 0x05,
/** Direct color (HiColor, 24bit TrueColor)*/
DirectColor = 0x06,
/** YUV (luminance-chrominance, also called YIQ)*/
YUV = 0x07
} VESAModeMemoryModels;
struct _VESA_MODE_INFO {
/** Mode attributes, defined in VESAModeAttributeMasks. */
uint16_t Attributes;
/** Window attributes (window A or B), defined in VESAModeWindowAttributeMasks. */
uint8_t WindowAttributesA, WindowAttributesB;
/** Window granularity in KB. */
uint16_t WindowGranularity;
/** Start segment of window A (0x0000 if not supported).*/
uint16_t WindowStartSegmentA;
/** Start segment of window B (0x0000 if not supported).*/
uint16_t WindowStartSegmentB;
/** FAR window positioning function (equivalent to AX = 0x4F05. */
uint32_t WindowPositioningFunction;
/** Bytes per scanline.*/
uint16_t BytesPerScanline;
/** Width in pixels (graphics) or characters (text).*/
uint16_t Width;
/** Height in pixels (graphics) or characters (text).*/
uint16_t Height;
/** Width of character cell in pixels. */
uint8_t CharacterWidth;
/** Height of character cell in pixels. */
uint8_t CharacterHeight;
/** Number of memory planes. */
uint8_t MemoryPlanes;
/** Number of bits per pixel. */
uint8_t Bpp;
/** Number of banks.*/
uint8_t Banks;
/** Memory model type, defined in VESAModeMemoryModels.*/
uint8_t MemoryModelType;
/** Size of bank in KB. */
uint8_t BankSize;
/** Number of image pages minus one, that will fit in video RAM.*/
uint8_t ImagePages;
/** Reserved, 0x00 for VBE 1.0 to 2.0, 0x01 for VBE 3.0.*/
uint8_t Reserved_0;
/** (VESA v1.2+) Self explanatory.*/
uint8_t RedMaskSize, RedFieldPosition;
uint8_t GreenMaskSize, GreenFieldPosition;
uint8_t BlueMaskSize, BlueFieldPosition;
uint8_t ReservedMaskSize, ReservedFieldPosition;
/** (VESA v1.2+) Direct Color Mode info\n
Bit 0: color ramp is programmable\n
Bit 1: bytes in reserved field may be used by application.*/
uint8_t DirectColorModeInfo;
/** (VESA v2.0+) Physical address of linear video buffer.*/
void* LinearVideoBuffer;
/** (VESA v2.0+) Pointer to start of offscreen memory.*/
void* OffscreenMemory;
/** (VESA v2.0+) KB of offscreen memory.*/
uint16_t OffscreenMemorySize;
/** (VESA v3.0) Bytes per scanline in linear modes.*/
uint16_t BytesPerScanlineLinear;
/** (VESA v3.0) Number of images minus one for banked video modes.*/
uint8_t ImagesBankedMode;
/** (VESA v3.0) Number of images minus one for linear video modes.*/
uint8_t ImagesLinearMode;
/** (VESA v3.0) LINEAR MODES ONLY\n
* \DirectColorMaskSize: size of direct color <color> mask (in bits).\n
* \BitPosition: bit position of <color> mask LSB (e.g. shift count)*/
uint8_t RedDirectColorMaskSize, RedBitPosition;
uint8_t GreenDirectColorMaskSize, GreenBitPosition;
uint8_t BlueDirectColorMaskSize, BlueBitPosition;
uint8_t ReservedDirectColorMaskSize, ReservedBitPosition;
/** (VESA v3.0) Maximum pixel clock for graphics video mode, in Hz*/
uint32_t MaxPixelClock;
} __attribute__ ((packed));
/**The structure passed by the bootloader. */
typedef struct {
/** How much memory is installed on the system (in KB). */
uint64_t Memory;
/** Boot device. */
uint32_t BootDevice;
/** Pointer to a char[] string containing kernel parameters. */
unsigned char* CommandLine;
/** Number of other modules loaded by the bootloader. */
uint32_t ModulesCount;
/** Pointer to where other modules were loaded. */
void* ModulesAddress;
/** Size of memory map. */
uint32_t MemoryMapLength;
/** Pointer to memory map. */
void* MemoryMapAddress;
/** Drives info length. */
uint32_t DrivesLength;
/** Pointer to drives info. */
void* DrivesAddress;
/** BIOS ROM configuration table. */
uint32_t ConfigurationTable;
/** Name of bootloader, should be "CTA" (0 ended string). */
unsigned char BootloaderName[4];
/** APM Table. */
uint32_t APMTable;
/** VGA current video mode information. */
uint8_t VGACurrentVideoMode;
uint8_t VGACurrentVideoModeColumns;
uint8_t VGACurrentVideoPage;
/** VESA video mode(s) information. */
struct _VESA_CONTROLLER_INFO* VESAControllerInformation;
} multiboot_info ;
#endif