aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers
diff options
context:
space:
mode:
authorMarvin Borner2021-04-13 22:09:23 +0200
committerMarvin Borner2021-04-13 22:09:23 +0200
commit9ded3a2bde80eede5fd887812d70c2f834b53c84 (patch)
tree932a90608c5f30d38b810dc4fe9264cc43c2da68 /kernel/drivers
parentf96b8ad1ee83dec08ae636e179cc48019ca50b12 (diff)
Started IO dev manager
Diffstat (limited to 'kernel/drivers')
-rw-r--r--kernel/drivers/fb.c12
-rw-r--r--kernel/drivers/ide.c9
-rw-r--r--kernel/drivers/keyboard.c9
-rw-r--r--kernel/drivers/mouse.c8
-rw-r--r--kernel/drivers/rtc.c6
5 files changed, 16 insertions, 28 deletions
diff --git a/kernel/drivers/fb.c b/kernel/drivers/fb.c
index 78b3984..7f05014 100644
--- a/kernel/drivers/fb.c
+++ b/kernel/drivers/fb.c
@@ -26,7 +26,7 @@ PROTECTED static u32 dev_id = 0;
PROTECTED static struct vid_info *info = NULL;
static u32 fb_owner = 0;
-static res fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3, struct device *dev)
+static res fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3, struct vfs_dev *dev)
{
UNUSED(arg2);
UNUSED(arg3);
@@ -56,11 +56,6 @@ static res fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3, struct devi
}
}
-static res fb_ready(void)
-{
- return 1;
-}
-
void fb_map_buffer(struct page_dir *dir, struct vid_info *boot)
{
struct vbe_basic *vbe = (struct vbe_basic *)boot->vbe;
@@ -72,11 +67,10 @@ CLEAR void fb_install(struct vid_info *boot)
{
info = boot;
- struct device *dev = zalloc(sizeof(*dev));
+ struct vfs_dev *dev = zalloc(sizeof(*dev));
dev->name = strdup("fb");
dev->type = DEV_CHAR;
dev->ioctl = fb_ioctl;
- dev->ready = fb_ready;
- device_add(dev);
+ /* device_add(dev); */
dev_id = dev->id;
}
diff --git a/kernel/drivers/ide.c b/kernel/drivers/ide.c
index 408630d..68e797f 100644
--- a/kernel/drivers/ide.c
+++ b/kernel/drivers/ide.c
@@ -85,7 +85,7 @@ static void ide_poll(u16 io)
} while (!(status & ATA_SR_DRQ));
}
-static u8 ata_read_one(u8 *buf, u32 lba, struct device *dev)
+static u8 ata_read_one(u8 *buf, u32 lba, struct vfs_dev *dev)
{
u8 drive = ((struct ata_data *)dev->data)->drive;
u16 io = (drive & ATA_PRIMARY << 1) == ATA_PRIMARY ? ATA_PRIMARY_IO : ATA_SECONDARY_IO;
@@ -108,7 +108,7 @@ static u8 ata_read_one(u8 *buf, u32 lba, struct device *dev)
return 1;
}
-static res ata_read(void *buf, u32 lba, u32 sector_count, struct device *dev)
+static res ata_read(void *buf, u32 lba, u32 sector_count, struct vfs_dev *dev)
{
u8 *b = buf; // I love bytes, yk
for (u32 i = 0; i < sector_count; i++) {
@@ -128,7 +128,7 @@ CLEAR static void ata_probe(void)
if (!ide_find(bus, drive))
continue;
- struct device *dev = zalloc(sizeof(*dev));
+ struct vfs_dev *dev = zalloc(sizeof(*dev));
struct ata_data *data = malloc(sizeof(*data));
data->drive = (bus << 1) | drive;
@@ -139,7 +139,7 @@ CLEAR static void ata_probe(void)
dev->name = str;
dev->type = DEV_BLOCK;
dev->read = ata_read;
- device_add(dev);
+ vfs_add_dev(dev);
if (vfs_mounted(dev, "/"))
continue;
@@ -149,7 +149,6 @@ CLEAR static void ata_probe(void)
vfs->read = ext2_read;
vfs->stat = ext2_stat;
vfs->perm = ext2_perm;
- vfs->ready = ext2_ready;
dev->vfs = vfs;
dev->data = data;
vfs_mount(dev, "/");
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c
index 95b8a21..6b4b0fa 100644
--- a/kernel/drivers/keyboard.c
+++ b/kernel/drivers/keyboard.c
@@ -44,8 +44,6 @@ static void keyboard_handler(struct regs *r)
state = 0;
merged = 0;
-
- proc_unblock(dev_id, PROC_BLOCK_DEV);
}
/*static void keyboard_acknowledge(void)
@@ -61,7 +59,7 @@ static void keyboard_rate(void)
outb(0x60, 0x0); // Rate{00000} Delay{00} 0
}*/
-static res keyboard_read(void *buf, u32 offset, u32 count, struct device *dev)
+static res keyboard_read(void *buf, u32 offset, u32 count, struct vfs_dev *dev)
{
UNUSED(dev);
if (stack_empty(queue))
@@ -89,11 +87,10 @@ CLEAR void keyboard_install(void)
irq_install_handler(1, keyboard_handler);
queue = stack_new();
- struct device *dev = zalloc(sizeof(*dev));
+ struct vfs_dev *dev = zalloc(sizeof(*dev));
dev->name = strdup("kbd");
dev->type = DEV_CHAR;
dev->read = keyboard_read;
- dev->ready = keyboard_ready;
- device_add(dev);
+ /* device_add(dev); */
dev_id = dev->id;
}
diff --git a/kernel/drivers/mouse.c b/kernel/drivers/mouse.c
index 0440057..3a78bc8 100644
--- a/kernel/drivers/mouse.c
+++ b/kernel/drivers/mouse.c
@@ -46,7 +46,6 @@ static void mouse_handler(struct regs *r)
event->but3 = (mouse_byte[0] >> 2) & 1;
stack_push_bot(queue, event);
mouse_cycle = 0;
- proc_unblock(dev_id, PROC_BLOCK_DEV);
break;
default:
break;
@@ -88,7 +87,7 @@ static res mouse_ready(void)
return !stack_empty(queue);
}
-static res mouse_read(void *buf, u32 offset, u32 count, struct device *dev)
+static res mouse_read(void *buf, u32 offset, u32 count, struct vfs_dev *dev)
{
(void)dev;
if (stack_empty(queue))
@@ -186,11 +185,10 @@ CLEAR void mouse_install(void)
irq_install_handler(12, mouse_handler);
queue = stack_new();
- struct device *dev = zalloc(sizeof(*dev));
+ struct vfs_dev *dev = zalloc(sizeof(*dev));
dev->name = strdup("mouse");
dev->type = DEV_CHAR;
dev->read = mouse_read;
- dev->ready = mouse_ready;
- device_add(dev);
+ /* device_add(dev); */
dev_id = dev->id;
}
diff --git a/kernel/drivers/rtc.c b/kernel/drivers/rtc.c
index a82864f..a814fa9 100644
--- a/kernel/drivers/rtc.c
+++ b/kernel/drivers/rtc.c
@@ -70,7 +70,7 @@ u32 rtc_stamp(void)
rtc.year * 360 * 24 * 365;
}
-static res rtc_dev_read(void *buf, u32 offset, u32 count, struct device *dev)
+static res rtc_dev_read(void *buf, u32 offset, u32 count, struct vfs_dev *dev)
{
UNUSED(offset);
UNUSED(dev);
@@ -83,9 +83,9 @@ static res rtc_dev_read(void *buf, u32 offset, u32 count, struct device *dev)
CLEAR void rtc_install(void)
{
- struct device *dev = zalloc(sizeof(*dev));
+ struct vfs_dev *dev = zalloc(sizeof(*dev));
dev->name = strdup("rtc");
dev->type = DEV_CHAR;
dev->read = rtc_dev_read;
- device_add(dev);
+ /* device_add(dev); */
}