Compare commits

...

1 Commits

Author SHA1 Message Date
378e029607 Move most platform code away from multiboot 2018-09-18 02:11:40 +02:00
5 changed files with 84 additions and 18 deletions

View File

@ -8,7 +8,12 @@
# define UKERNEL_KERNEL_PLATFORM_H # define UKERNEL_KERNEL_PLATFORM_H
/* constants */ /* functions */
void platform_init(void); void platform_init(void);
/* accessors */
void platform_set_console(char const * bus, char const * name);
void platform_set_display(char const * bus, char const * name);
#endif /* !UKERNEL_KERNEL_PLATFORM_H */ #endif /* !UKERNEL_KERNEL_PLATFORM_H */

View File

@ -11,6 +11,7 @@
# include <kernel/drivers/console.h> # include <kernel/drivers/console.h>
# include <kernel/drivers/display.h> # include <kernel/drivers/display.h>
# include <kernel/drivers/pic.h> # include <kernel/drivers/pic.h>
# include <kernel/platform.h>
# include "arch/amd64/gdt.h" # include "arch/amd64/gdt.h"
# include "arch/i386/gdt.h" # include "arch/i386/gdt.h"
# include "arch/i386/idt.h" # include "arch/i386/idt.h"
@ -45,19 +46,11 @@ static const IDT _idt[] =
/* multiboot */ /* multiboot */
int multiboot(ukMultibootInfo * mi) int multiboot(ukMultibootInfo * mi)
{ {
ukBus * ioportbus;
ukBus * vgabus;
ukBus * cmosbus;
char const * console = KERNEL_CONSOLE; char const * console = KERNEL_CONSOLE;
char const * display = KERNEL_DISPLAY; char const * display = KERNEL_DISPLAY;
size_t i; size_t i;
ukMultibootMod * mod; ukMultibootMod * mod;
/* initialize the buses */
ioportbus = bus_init(NULL, "ioport");
vgabus = bus_init(ioportbus, "vga");
cmosbus = bus_init(ioportbus, "cmos");
#ifdef notyet #ifdef notyet
/* detect the video driver to use */ /* detect the video driver to use */
if(mi->flags & BOOT_MULTIBOOT_INFO_HAS_VBE) if(mi->flags & BOOT_MULTIBOOT_INFO_HAS_VBE)
@ -65,16 +58,13 @@ int multiboot(ukMultibootInfo * mi)
#endif #endif
/* initialize the display */ /* initialize the display */
display_init(vgabus, display); platform_set_display("vgaport", display);
/* initialize the console */ /* initialize the console */
console_init(ioportbus, console); platform_set_console("ioport", console);
/* initialize the PIC */ /* initialize the platform */
pic_init(ioportbus, "i8259a"); platform_init();
/* initialize the clock */
clock_init(cmosbus, "cmos");
/* report information on the boot process */ /* report information on the boot process */
puts("DeforaOS Multiboot"); puts("DeforaOS Multiboot");

View File

@ -1,3 +1,63 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS uKernel */ /* This file is part of DeforaOS uKernel */
#include <kernel/drivers/console.h>
#include <kernel/drivers/display.h>
#include <kernel/platform.h>
/* private */
/* variables */
static char const * _consolebus = NULL;
static char const * _console = NULL;
static char const * _displaybus = NULL;
static char const * _display = NULL;
/* prototypes */
static ukBus * _platform_get_bus(char const * bus);
/* public */
/* functions */
/* platform_init */
void platform_init(void)
{
ukBus * bus;
_platform_init_arch();
bus = (_displaybus != NULL) ? _platform_get_bus(_displaybus) : NULL;
display_init(bus, _display);
bus = (_consolebus != NULL) ? _platform_get_bus(_consolebus) : NULL;
console_init(bus, _console);
}
/* accessors */
/* platform_set_console */
void platform_set_console(char const * bus, char const * name)
{
_consolebus = bus;
_console = name;
}
/* platform_set_display */
void platform_set_display(char const * bus, char const * name)
{
_displaybus = bus;
_display = name;
}
/* private */
/* functions */
/* platform_get_bus */
static ukBus * _platform_get_bus(char const * bus)
{
/* FIXME implement */
return NULL;
}

View File

@ -108,10 +108,14 @@ $name $type $busname $args"
#begin the function #begin the function
echo " echo "
/* public */ /* private */
/* prototypes */
static void _platform_init_arch(void);
/* functions */ /* functions */
/* platform_init */ /* platform_init */
void platform_init(void) static void _platform_init_arch(void)
{" {"
#list the buses #list the buses

View File

@ -1,3 +1,10 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS uKernel */ /* This file is part of DeforaOS uKernel */
/* platform_init */
void platform_init(void)
{
_platform_init_arch();
}