summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/amd64/driver')
-rw-r--r--src/kernel/arch/amd64/driver/fsroot.c4
-rw-r--r--src/kernel/arch/amd64/driver/pata.c4
-rw-r--r--src/kernel/arch/amd64/driver/ps2.c8
-rw-r--r--src/kernel/arch/amd64/driver/rtl8139.c10
-rw-r--r--src/kernel/arch/amd64/driver/serial.c6
-rw-r--r--src/kernel/arch/amd64/driver/util.c12
-rw-r--r--src/kernel/arch/amd64/driver/util.h10
-rw-r--r--src/kernel/arch/amd64/driver/video.c8
-rw-r--r--src/kernel/arch/amd64/driver/video.h4
9 files changed, 33 insertions, 33 deletions
diff --git a/src/kernel/arch/amd64/driver/fsroot.c b/src/kernel/arch/amd64/driver/fsroot.c
index 6217e29..6d3676d 100644
--- a/src/kernel/arch/amd64/driver/fsroot.c
+++ b/src/kernel/arch/amd64/driver/fsroot.c
@@ -8,7 +8,7 @@
#include <kernel/vfs/request.h>
#include <shared/mem.h>
-static int handle(struct vfs_request *req) {
+static int handle(VfsReq *req) {
// TODO document directory read format
// TODO don't hardcode
const char dir[] =
@@ -31,7 +31,7 @@ static int handle(struct vfs_request *req) {
}
}
-static void accept(struct vfs_request *req) {
+static void accept(VfsReq *req) {
vfsreq_finish_short(req, handle(req));
}
diff --git a/src/kernel/arch/amd64/driver/pata.c b/src/kernel/arch/amd64/driver/pata.c
index 6928b4e..b0ed592 100644
--- a/src/kernel/arch/amd64/driver/pata.c
+++ b/src/kernel/arch/amd64/driver/pata.c
@@ -11,13 +11,13 @@
static const int root_id = 100;
-static void accept(struct vfs_request *req);
+static void accept(VfsReq *req);
void pata_init(void) {
ata_init();
vfs_root_register("/ata", accept);
}
-static void accept(struct vfs_request *req) {
+static void accept(VfsReq *req) {
int ret;
long id = (long __force)req->id;
char wbuf[4096];
diff --git a/src/kernel/arch/amd64/driver/ps2.c b/src/kernel/arch/amd64/driver/ps2.c
index d0629e6..cdcbf19 100644
--- a/src/kernel/arch/amd64/driver/ps2.c
+++ b/src/kernel/arch/amd64/driver/ps2.c
@@ -17,10 +17,10 @@ static volatile ring_t kb_backlog = {(void*)kb_buf, sizeof kb_buf, 0, 0};
static volatile uint8_t mouse_buf[64];
static volatile ring_t mouse_backlog = {(void*)mouse_buf, sizeof mouse_buf, 0, 0};
-static void accept(struct vfs_request *req);
+static void accept(VfsReq *req);
-static struct vfs_request *kb_queue = NULL;
-static struct vfs_request *mouse_queue = NULL;
+static VfsReq *kb_queue = NULL;
+static VfsReq *mouse_queue = NULL;
static void wait_out(void) {
while ((port_in8(PS2 + 4) & 2) != 0);
@@ -77,7 +77,7 @@ enum {
H_MOUSE,
};
-static void accept(struct vfs_request *req) {
+static void accept(VfsReq *req) {
// when you fix something here go also fix it in the COM1 driver
int ret;
switch (req->type) {
diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c
index 1face38..dd11102 100644
--- a/src/kernel/arch/amd64/driver/rtl8139.c
+++ b/src/kernel/arch/amd64/driver/rtl8139.c
@@ -10,8 +10,8 @@
#define WAIT -1000
-static void accept(struct vfs_request *req);
-static struct vfs_request *blocked_on = NULL;
+static void accept(VfsReq *req);
+static VfsReq *blocked_on = NULL;
enum {
@@ -105,7 +105,7 @@ void rtl8139_irq(void) {
port_out16(iobase + INTRSTATUS, status);
}
-static int try_rx(struct process *proc, void __user *dest, size_t dlen) {
+static int try_rx(Proc *proc, void __user *dest, size_t dlen) {
uint16_t flags, size;
/* bit 0 - Rx Buffer Empty */
if (port_in8(iobase + CMD) & 1) return WAIT;
@@ -140,7 +140,7 @@ static int try_rx(struct process *proc, void __user *dest, size_t dlen) {
return size;
}
-static int try_tx(struct process *proc, const void __user *src, size_t slen) {
+static int try_tx(Proc *proc, const void __user *src, size_t slen) {
static uint8_t desc = 0;
if (slen > 0xFFF) return -1;
@@ -164,7 +164,7 @@ static int try_tx(struct process *proc, const void __user *src, size_t slen) {
return slen;
}
-static void accept(struct vfs_request *req) {
+static void accept(VfsReq *req) {
if (!req->caller) {
vfsreq_finish_short(req, -1);
return;
diff --git a/src/kernel/arch/amd64/driver/serial.c b/src/kernel/arch/amd64/driver/serial.c
index 12c4151..6fe4500 100644
--- a/src/kernel/arch/amd64/driver/serial.c
+++ b/src/kernel/arch/amd64/driver/serial.c
@@ -14,8 +14,8 @@ static volatile ring_t backlog = {(void*)backlog_buf, sizeof backlog_buf, 0, 0};
static const int COM1 = 0x3f8;
-static void accept(struct vfs_request *req);
-static struct vfs_request *hung_reads = NULL;
+static void accept(VfsReq *req);
+static VfsReq *hung_reads = NULL;
void serial_init(void) { vfs_root_register("/com1", accept); }
@@ -59,7 +59,7 @@ void serial_write(const char *buf, size_t len) {
serial_putchar(buf[i]);
}
-static void accept(struct vfs_request *req) {
+static void accept(VfsReq *req) {
int ret;
bool valid;
switch (req->type) {
diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c
index b2c33c6..957005c 100644
--- a/src/kernel/arch/amd64/driver/util.c
+++ b/src/kernel/arch/amd64/driver/util.c
@@ -5,7 +5,7 @@
#include <kernel/proc.h>
#include <kernel/vfs/request.h>
-int req_readcopy(struct vfs_request *req, const void *buf, size_t len) {
+int req_readcopy(VfsReq *req, const void *buf, size_t len) {
if (!req->caller) return -1;
assert(req->type == VFSOP_READ);
fs_normslice(&req->offset, &req->output.len, len, false);
@@ -14,7 +14,7 @@ int req_readcopy(struct vfs_request *req, const void *buf, size_t len) {
return req->output.len;
}
-void postqueue_join(struct vfs_request **queue, struct vfs_request *req) {
+void postqueue_join(VfsReq **queue, VfsReq *req) {
if (req->postqueue_next)
panic_invalid_state();
@@ -23,16 +23,16 @@ void postqueue_join(struct vfs_request **queue, struct vfs_request *req) {
*queue = req;
}
-bool postqueue_pop(struct vfs_request **queue, void (*accept)(struct vfs_request *)) {
- struct vfs_request *req = *queue;
+bool postqueue_pop(VfsReq **queue, void (*accept)(VfsReq *)) {
+ VfsReq *req = *queue;
if (req == NULL) return false;
*queue = req->postqueue_next;
accept(req);
return true;
}
-void postqueue_ringreadall(struct vfs_request **queue, ring_t *r) {
- struct vfs_request *req;
+void postqueue_ringreadall(VfsReq **queue, ring_t *r) {
+ VfsReq *req;
char tmp[64];
size_t mlen = 0;
if (ring_used(r) == 0) return;
diff --git a/src/kernel/arch/amd64/driver/util.h b/src/kernel/arch/amd64/driver/util.h
index 06ca672..5827fa9 100644
--- a/src/kernel/arch/amd64/driver/util.h
+++ b/src/kernel/arch/amd64/driver/util.h
@@ -1,10 +1,10 @@
#pragma once
+#include <kernel/types.h>
#include <shared/container/ring.h>
#include <stdbool.h>
#include <stddef.h>
-struct vfs_request;
-int req_readcopy(struct vfs_request *req, const void *buf, size_t len);
+int req_readcopy(VfsReq *req, const void *buf, size_t len);
/* compare request path. path MUST be a static string */
#define reqpathcmp(req, path) _reqpathcmp(req, ""path"", sizeof(path) - 1)
@@ -13,9 +13,9 @@ int req_readcopy(struct vfs_request *req, const void *buf, size_t len);
req->input.len == plen && \
memcmp(req->input.buf_kern, path, plen) == 0)
-void postqueue_join(struct vfs_request **queue, struct vfs_request *req);
-bool postqueue_pop(struct vfs_request **queue, void (*accept)(struct vfs_request *));
+void postqueue_join(VfsReq **queue, VfsReq *req);
+bool postqueue_pop(VfsReq **queue, void (*accept)(VfsReq *));
/** If there are any pending read requests, and the ring buffer isn't empty, fulfill them
* all with a single read. */
-void postqueue_ringreadall(struct vfs_request **queue, ring_t *r);
+void postqueue_ringreadall(VfsReq **queue, ring_t *r);
diff --git a/src/kernel/arch/amd64/driver/video.c b/src/kernel/arch/amd64/driver/video.c
index 4cd6b0b..d7046b4 100644
--- a/src/kernel/arch/amd64/driver/video.c
+++ b/src/kernel/arch/amd64/driver/video.c
@@ -9,7 +9,7 @@
#include <shared/mem.h>
#include <shared/printf.h>
-static struct fb_info fb;
+static GfxInfo fb;
static char namebuf[64];
static size_t namelen;
@@ -18,7 +18,7 @@ enum {
H_FB,
};
-static int handle(struct vfs_request *req) {
+static int handle(VfsReq *req) {
switch (req->type) {
case VFSOP_OPEN:
if (!req->input.kern) panic_invalid_state();
@@ -54,7 +54,7 @@ static int handle(struct vfs_request *req) {
}
}
-static void accept(struct vfs_request *req) {
+static void accept(VfsReq *req) {
if (req->caller) {
vfsreq_finish_short(req, handle(req));
} else {
@@ -62,7 +62,7 @@ static void accept(struct vfs_request *req) {
}
}
-void video_init(struct fb_info fb_) {
+void video_init(GfxInfo fb_) {
fb = fb_;
snprintf(namebuf, sizeof namebuf, "%ux%ux%u", fb.width, fb.height, fb.bpp);
namelen = strlen(namebuf);
diff --git a/src/kernel/arch/amd64/driver/video.h b/src/kernel/arch/amd64/driver/video.h
index dfc1710..e9dd8ae 100644
--- a/src/kernel/arch/amd64/driver/video.h
+++ b/src/kernel/arch/amd64/driver/video.h
@@ -1,7 +1,7 @@
#pragma once
#include <stdint.h>
-struct fb_info {
+struct GfxInfo {
char *b;
uint32_t width, height;
uint32_t pitch; /* width in bytes of a single scanline */
@@ -9,4 +9,4 @@ struct fb_info {
uint8_t bpp;
};
-void video_init(struct fb_info);
+void video_init(GfxInfo);