aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers
diff options
context:
space:
mode:
authorMarvin Borner2021-05-20 20:41:24 +0200
committerMarvin Borner2021-05-20 20:41:24 +0200
commit298aaf63f15350e6248d5a96e8c6a63b0ec93e0f (patch)
tree952331f841b4d02d0b7189da716648df5cdb4d8e /kernel/drivers
parentb22346a9b830b642e684e13cf4946d8ef8d8e1ca (diff)
Major restructuring
Diffstat (limited to 'kernel/drivers')
-rw-r--r--kernel/drivers/acpi.c4
-rw-r--r--kernel/drivers/cpu.c2
-rw-r--r--kernel/drivers/gdt.c2
-rw-r--r--kernel/drivers/ide.c8
-rw-r--r--kernel/drivers/interrupts.c6
-rw-r--r--kernel/drivers/mbr.c4
-rw-r--r--kernel/drivers/pci.c4
-rw-r--r--kernel/drivers/ps2/keyboard.c6
-rw-r--r--kernel/drivers/ps2/mouse.c6
-rw-r--r--kernel/drivers/ps2/ps2.c4
-rw-r--r--kernel/drivers/rtc.c6
-rw-r--r--kernel/drivers/rtl8139.c8
-rw-r--r--kernel/drivers/serial.c4
-rw-r--r--kernel/drivers/timer.c8
-rw-r--r--kernel/drivers/vbe.c (renamed from kernel/drivers/fb.c)16
-rw-r--r--kernel/drivers/vmware.c6
16 files changed, 47 insertions, 47 deletions
diff --git a/kernel/drivers/acpi.c b/kernel/drivers/acpi.c
index b8dad22..6860a43 100644
--- a/kernel/drivers/acpi.c
+++ b/kernel/drivers/acpi.c
@@ -1,8 +1,8 @@
// MIT License, Copyright (c) 2020 Marvin Borner
-#include <acpi.h>
+#include <drivers/acpi.h>
#include <assert.h>
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
#include <mem.h>
#include <print.h>
diff --git a/kernel/drivers/cpu.c b/kernel/drivers/cpu.c
index 296e73a..8927d1d 100644
--- a/kernel/drivers/cpu.c
+++ b/kernel/drivers/cpu.c
@@ -2,7 +2,7 @@
// This file is a wrapper around some CPU asm calls
#include <assert.h>
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
#include <mem.h>
#include <print.h>
diff --git a/kernel/drivers/gdt.c b/kernel/drivers/gdt.c
index 0e8086f..aa76f2f 100644
--- a/kernel/drivers/gdt.c
+++ b/kernel/drivers/gdt.c
@@ -2,7 +2,7 @@
#include <assert.h>
#include <def.h>
-#include <gdt.h>
+#include <drivers/gdt.h>
#include <mem.h>
#define GDT_MAX_LIMIT 0xffff
diff --git a/kernel/drivers/ide.c b/kernel/drivers/ide.c
index ea02d9d..9e09860 100644
--- a/kernel/drivers/ide.c
+++ b/kernel/drivers/ide.c
@@ -1,13 +1,13 @@
// MIT License, Copyright (c) 2020 Marvin Borner
#include <assert.h>
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
#include <fs.h>
-#include <ide.h>
-#include <mbr.h>
+#include <drivers/ide.h>
+#include <drivers/mbr.h>
#include <mem.h>
-#include <pci.h>
+#include <drivers/pci.h>
#include <print.h>
#include <str.h>
diff --git a/kernel/drivers/interrupts.c b/kernel/drivers/interrupts.c
index 5b57e56..e9ab0ce 100644
--- a/kernel/drivers/interrupts.c
+++ b/kernel/drivers/interrupts.c
@@ -2,14 +2,14 @@
// TODO: Remove some magic numbers
#include <assert.h>
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
-#include <interrupts.h>
+#include <drivers/interrupts.h>
#include <mem.h>
#include <mm.h>
#include <print.h>
#include <proc.h>
-#include <serial.h>
+#include <drivers/serial.h>
/**
* IDT
diff --git a/kernel/drivers/mbr.c b/kernel/drivers/mbr.c
index c85061d..c9eba15 100644
--- a/kernel/drivers/mbr.c
+++ b/kernel/drivers/mbr.c
@@ -2,8 +2,8 @@
#include <def.h>
#include <fs.h>
-#include <ide.h>
-#include <mbr.h>
+#include <drivers/ide.h>
+#include <drivers/mbr.h>
#include <mem.h>
#include <print.h>
#include <str.h>
diff --git a/kernel/drivers/pci.c b/kernel/drivers/pci.c
index 829f5b9..55806c2 100644
--- a/kernel/drivers/pci.c
+++ b/kernel/drivers/pci.c
@@ -2,10 +2,10 @@
// Uses parts of the ToAruOS Project, released under the terms of the NCSA
// Copyright (C) 2011-2018 K. Lange
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
#include <mem.h>
-#include <pci.h>
+#include <drivers/pci.h>
CLEAR void pci_write_field(u32 device, int field, u32 value)
{
diff --git a/kernel/drivers/ps2/keyboard.c b/kernel/drivers/ps2/keyboard.c
index be057d7..bddb280 100644
--- a/kernel/drivers/ps2/keyboard.c
+++ b/kernel/drivers/ps2/keyboard.c
@@ -1,14 +1,14 @@
// MIT License, Copyright (c) 2020 Marvin Borner
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
#include <errno.h>
-#include <interrupts.h>
+#include <drivers/interrupts.h>
#include <io.h>
#include <mem.h>
#include <print.h>
#include <proc.h>
-#include <ps2.h>
+#include <drivers/ps2.h>
#include <stack.h>
#include <str.h>
#include <sys.h>
diff --git a/kernel/drivers/ps2/mouse.c b/kernel/drivers/ps2/mouse.c
index abca0a8..2942e34 100644
--- a/kernel/drivers/ps2/mouse.c
+++ b/kernel/drivers/ps2/mouse.c
@@ -1,14 +1,14 @@
// MIT License, Copyright (c) 2020 Marvin Borner
#include <assert.h>
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <errno.h>
-#include <interrupts.h>
+#include <drivers/interrupts.h>
#include <io.h>
#include <mem.h>
#include <print.h>
#include <proc.h>
-#include <ps2.h>
+#include <drivers/ps2.h>
#include <stack.h>
#include <str.h>
#include <sys.h>
diff --git a/kernel/drivers/ps2/ps2.c b/kernel/drivers/ps2/ps2.c
index 076a0bf..f8d849b 100644
--- a/kernel/drivers/ps2/ps2.c
+++ b/kernel/drivers/ps2/ps2.c
@@ -1,10 +1,10 @@
// MIT License, Copyright (c) 2021 Marvin Borner
#include <assert.h>
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
#include <print.h>
-#include <ps2.h>
+#include <drivers/ps2.h>
#define PS2_TIMEOUT 100
diff --git a/kernel/drivers/rtc.c b/kernel/drivers/rtc.c
index 2da61da..63d9461 100644
--- a/kernel/drivers/rtc.c
+++ b/kernel/drivers/rtc.c
@@ -1,12 +1,12 @@
// MIT License, Copyright (c) 2021 Marvin Borner
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
#include <fs.h>
#include <mem.h>
-#include <rtc.h>
+#include <drivers/rtc.h>
#include <str.h>
-#include <timer.h>
+#include <drivers/timer.h>
static u8 rtc_busy(void)
{
diff --git a/kernel/drivers/rtl8139.c b/kernel/drivers/rtl8139.c
index 753bd6a..fdbc0c8 100644
--- a/kernel/drivers/rtl8139.c
+++ b/kernel/drivers/rtl8139.c
@@ -2,14 +2,14 @@
// Uses parts of the ToAruOS Project, released under the terms of the NCSA
// Copyright (C) 2011-2018 K. Lange
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
-#include <interrupts.h>
+#include <drivers/interrupts.h>
#include <mem.h>
#include <net.h>
-#include <pci.h>
+#include <drivers/pci.h>
#include <print.h>
-#include <rtl8139.h>
+#include <drivers/rtl8139.h>
static int rtl_irq = 0;
static u8 mac[6] = { 0 };
diff --git a/kernel/drivers/serial.c b/kernel/drivers/serial.c
index 06403f6..95ac02d 100644
--- a/kernel/drivers/serial.c
+++ b/kernel/drivers/serial.c
@@ -1,9 +1,9 @@
// MIT License, Copyright (c) 2020 Marvin Borner
#include <assert.h>
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
-#include <serial.h>
+#include <drivers/serial.h>
#include <str.h>
#define PORT 0x3f8
diff --git a/kernel/drivers/timer.c b/kernel/drivers/timer.c
index 176b499..c586088 100644
--- a/kernel/drivers/timer.c
+++ b/kernel/drivers/timer.c
@@ -1,13 +1,13 @@
// MIT License, Copyright (c) 2020 Marvin Borner
-#include <cpu.h>
+#include <drivers/cpu.h>
#include <def.h>
-#include <interrupts.h>
+#include <drivers/interrupts.h>
#include <io.h>
#include <mem.h>
#include <proc.h>
-#include <rtc.h>
-#include <timer.h>
+#include <drivers/rtc.h>
+#include <drivers/timer.h>
static u32 timer_ticks = 0;
PROTECTED static u8 call_scheduler = 0;
diff --git a/kernel/drivers/fb.c b/kernel/drivers/vbe.c
index 7ef1088..b384936 100644
--- a/kernel/drivers/fb.c
+++ b/kernel/drivers/vbe.c
@@ -1,10 +1,10 @@
// MIT License, Copyright (c) 2021 Marvin Borner
#include <assert.h>
-#include <cpu.h>
#include <def.h>
+#include <drivers/cpu.h>
+#include <drivers/vbe.h>
#include <errno.h>
-#include <fb.h>
#include <io.h>
#include <mem.h>
#include <mm.h>
@@ -26,7 +26,7 @@ struct vbe_basic {
PROTECTED static struct vbe_basic *vbe = NULL;
-static u32 fb_map_buffer(struct page_dir *dir)
+static u32 vbe_map_buffer(struct page_dir *dir)
{
assert(vbe);
struct memory_range r =
@@ -35,7 +35,7 @@ static u32 fb_map_buffer(struct page_dir *dir)
}
static u32 fb_owner = 0;
-static res fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3)
+static res vbe_control(u32 request, void *arg1, void *arg2, void *arg3)
{
UNUSED(arg3);
@@ -52,7 +52,7 @@ static res fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3)
return -EBUSY;
fb_owner = proc_current()->pid;
- u32 fb = fb_map_buffer(proc_current()->page_dir);
+ u32 fb = vbe_map_buffer(proc_current()->page_dir);
stac();
memcpy(arg1, vbe, size);
@@ -66,12 +66,12 @@ static res fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3)
}
}
-CLEAR void fb_install(void)
+CLEAR void vbe_install(u32 data)
{
- vbe = (void *)multiboot_vbe();
+ vbe = (void *)data;
struct io_dev *dev = zalloc(sizeof(*dev));
- dev->control = fb_ioctl;
+ dev->control = vbe_control;
io_add(IO_FRAMEBUFFER, dev);
// Set framebuffer range used to prevent unwanted writing
diff --git a/kernel/drivers/vmware.c b/kernel/drivers/vmware.c
index c82042f..6f95d02 100644
--- a/kernel/drivers/vmware.c
+++ b/kernel/drivers/vmware.c
@@ -2,13 +2,13 @@
// VMWare extensions/backdoors for better VM integration
#include <def.h>
-#include <interrupts.h>
+#include <drivers/interrupts.h>
#include <io.h>
#include <mem.h>
#include <print.h>
-#include <ps2.h>
+#include <drivers/ps2.h>
#include <stack.h>
-#include <vmware.h>
+#include <drivers/vmware.h>
#define VMWARE_CMD_VERSION 0x0a