1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00
os-k/include/init/boot.h

128 lines
4.7 KiB
C
Raw Normal View History

2019-01-21 15:00:04 +01:00
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
2019-02-16 23:36:33 +01:00
// Desc: Kaleid kernel base include file //
2019-01-21 15:00:04 +01:00
// //
2019-02-16 23:36:33 +01:00
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
2019-01-21 15:00:04 +01:00
//----------------------------------------------------------------------------//
2019-05-13 23:22:27 +02:00
#ifndef _KERNEL_H
#include <kernel.h>
2019-01-21 15:00:04 +01:00
#endif
2019-05-29 14:34:37 +02:00
#ifndef MULTIBOOT_HEADER
#include <init/mboot.h>
#endif
2019-05-13 23:22:27 +02:00
#ifndef _INIT_BOOT_H
#define _INIT_BOOT_H
2019-03-24 14:44:59 +01:00
2019-05-01 14:17:16 +02:00
//----------------------------------------------------------------------------//
2019-01-21 15:00:04 +01:00
2019-03-19 00:25:22 +01:00
#define FB_EGA_TEXT 2
#define FB_INDEXED 0
#define FB_RGB 1
2019-03-19 12:24:27 +01:00
#define BINFO_SIZE 4096
2019-03-24 14:44:59 +01:00
2019-03-19 00:25:22 +01:00
struct BootInfo_t
2019-03-18 17:43:41 +01:00
{
2019-04-06 07:53:58 +02:00
// The Bootloader infos
2019-03-19 00:25:22 +01:00
struct {
2019-03-19 12:24:27 +01:00
void *modulesAddr; //mods_addr
2019-03-23 23:52:18 +01:00
void *kernelAddr;
2019-04-22 20:15:32 +02:00
void *codeSegment;
2019-03-24 20:25:11 +01:00
void *kernelEndAddr;
2019-05-13 15:18:00 +02:00
void *stackEndAddr; // stack begins 16B after kernelEndAddr
2020-01-05 20:13:53 +01:00
uint grubFlags; //flags
uint modulesCount; //mods_count
ushort valid;
char *grubName; //boot_loader_name
2019-03-19 00:25:22 +01:00
} btldr;
// Informations about drives
struct {
2020-01-05 20:13:53 +01:00
void *bufferAddr; //drives_addr
2019-03-19 00:25:22 +01:00
uint bootDrv; //boot_device
uint bufferLength; //drives_length
2020-01-05 20:13:53 +01:00
ushort drvValid;
ushort bufferValid;
2019-03-19 00:25:22 +01:00
} drives;
// Informations about memory
struct {
2019-03-21 13:30:17 +01:00
ushort memValid;
ushort mapValid;
2019-03-19 00:25:22 +01:00
//BIOS provided low and up memory
uint lowMemory; //mem_lower
uint upMemory; //mem_upper
//GRUB provided memory map
2019-03-21 13:30:17 +01:00
void *mapAddr; //mmap_addr
2020-01-05 20:13:53 +01:00
uint mapLength; //mmap_length
2019-03-21 13:30:17 +01:00
uint ramSize; //The ram (init by map.c)
2019-03-19 00:25:22 +01:00
} memory;
// Informations about the video drive
struct {
2019-03-23 20:34:32 +01:00
void *vbeControl; //vbe_control_info
void *vbeModeInfo; //vbe_mode_info
void *framebufferAddr; //framebuffer_addr
2019-03-19 00:25:22 +01:00
uint framebufferPitch; //framebuffer_pitch
uint framebufferWidth; //framebuffer_width
uint framebufferHeight; //framebuffer_height
2020-01-05 20:13:53 +01:00
ushort vbeValid;
ushort fbuValid;
ushort vbeMode; //vbe_mode
ushort vbeInterfaceSeg; //vbe_interface_seg
ushort vbeInterfaceOff; //vbe_interface_off
ushort vbeInterfaceLen; //vbe_interface_len
2019-03-19 00:25:22 +01:00
uchar framebufferBpp; //framebuffer_bpp
uchar framebufferType; //framebuffer_type
} video;
// Informations about the microcode firmware (BIOS/EFI)
struct {
uint apmTable; //apm_table
uint romTable; //config_table
2020-01-05 20:13:53 +01:00
ushort apmValid;
ushort romValid;
2019-03-19 00:25:22 +01:00
} firmware;
2019-03-18 17:43:41 +01:00
};
2019-05-01 14:17:16 +02:00
//----------------------------------------------------------------------------//
2019-04-05 10:20:10 +02:00
extern volatile BootInfo_t BtBootTab;
2019-03-24 14:44:59 +01:00
2019-04-06 07:53:58 +02:00
#define BtLoaderInfo (BtBootTab.btldr)
#define BtDrivesInfo (BtBootTab.drives)
#define BtMemoryInfo (BtBootTab.memory)
#define BtVideoInfo (BtBootTab.video)
#define BtFirmwareInfo (BtBootTab.firmware)
2019-01-21 15:00:04 +01:00
2019-05-01 14:17:16 +02:00
//----------------------------------------------------------------------------//
2019-01-21 15:00:04 +01:00
2019-05-29 14:34:37 +02:00
void BtDoSanityChecks(uint);
void BtInitBootInfo(multiboot_info_t *, void *);
//----------------------------------------------------------------------------//
2019-01-21 15:00:04 +01:00
#endif