summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64
diff options
context:
space:
mode:
authordzwdz2024-07-14 19:40:31 +0200
committerdzwdz2024-07-14 19:40:31 +0200
commit881be872675e4cff153c27c641980451c4a3f479 (patch)
treea374913fc7f1fcbd1d380719d695bf5f67b83e56 /src/kernel/arch/amd64
parent6fe8073de975ad7722043f9173fec068178e2eac (diff)
kernel: make the adhoc VfsQueue queues use ReqQueue instead
I'm still not sure if I should use sys/queue.h for this. But yeah, this is more consistent, and it will also let me switch over to O(1) insertions later on.
Diffstat (limited to 'src/kernel/arch/amd64')
-rw-r--r--src/kernel/arch/amd64/driver/ps2.c16
-rw-r--r--src/kernel/arch/amd64/driver/rtl8139.c6
-rw-r--r--src/kernel/arch/amd64/driver/serial.c8
3 files changed, 15 insertions, 15 deletions
diff --git a/src/kernel/arch/amd64/driver/ps2.c b/src/kernel/arch/amd64/driver/ps2.c
index 86fcffd..0713293 100644
--- a/src/kernel/arch/amd64/driver/ps2.c
+++ b/src/kernel/arch/amd64/driver/ps2.c
@@ -58,8 +58,8 @@ void ps2_init(void) {
irq_fn[IRQ_PS2KB] = ps2_irq;
irq_fn[IRQ_PS2MOUSE] = ps2_irq;
- postqueue_init(&kb_queue);
- postqueue_init(&mouse_queue);
+ reqqueue_init(&kb_queue);
+ reqqueue_init(&mouse_queue);
vfs_root_register("/dev/ps2/", accept);
}
@@ -70,10 +70,10 @@ static void ps2_irq(void) {
if (!(status & 1)) break; /* read while data available */
if (status & (1 << 5)) {
ring_put1b((void*)&mouse_backlog, port_in8(PS2));
- postqueue_ringreadall(&mouse_queue, (void*)&mouse_backlog);
+ reqqueue_ringreadall(&mouse_queue, (void*)&mouse_backlog);
} else {
ring_put1b((void*)&kb_backlog, port_in8(PS2));
- postqueue_ringreadall(&kb_queue, (void*)&kb_backlog);
+ reqqueue_ringreadall(&kb_queue, (void*)&kb_backlog);
}
}
}
@@ -101,11 +101,11 @@ static void accept(VfsReq *req) {
ret = req_readcopy(req, data, sizeof data);
vfsreq_finish_short(req, ret);
} else if ((long __force)req->id == H_KB) {
- postqueue_join(&kb_queue, req);
- postqueue_ringreadall(&kb_queue, (void*)&kb_backlog);
+ reqqueue_join(&kb_queue, req);
+ reqqueue_ringreadall(&kb_queue, (void*)&kb_backlog);
} else if ((long __force)req->id == H_MOUSE) {
- postqueue_join(&mouse_queue, req);
- postqueue_ringreadall(&mouse_queue, (void*)&mouse_backlog);
+ reqqueue_join(&mouse_queue, req);
+ reqqueue_ringreadall(&mouse_queue, (void*)&mouse_backlog);
} else panic_invalid_state();
break;
default:
diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c
index bce1071..c952d8a 100644
--- a/src/kernel/arch/amd64/driver/rtl8139.c
+++ b/src/kernel/arch/amd64/driver/rtl8139.c
@@ -86,7 +86,7 @@ void rtl8139_init(uint32_t bdf) {
mac[i] = port_in8(iobase + Mac + i);
}
- postqueue_init(&blocked_on);
+ reqqueue_init(&blocked_on);
vfs_root_register("/dev/eth/", accept);
}
@@ -102,7 +102,7 @@ static void rtl8139_irq(void) {
/* bit 0 of cmd - Rx Buffer Empty
* not a do while() because sometimes the bit is empty on IRQ. no clue why. */
while (!(port_in8(iobase + Cmd) & 1)) {
- VfsReq *req = postqueue_pop(&blocked_on);
+ VfsReq *req = reqqueue_pop(&blocked_on);
if (req) {
accept(req);
} else {
@@ -206,7 +206,7 @@ static void accept(VfsReq *req) {
} else if (id == HandleNet) {
ret = try_rx(req->caller, req->output.buf, req->output.len);
if (ret == WAIT) {
- postqueue_join(&blocked_on, req);
+ reqqueue_join(&blocked_on, req);
rx_irq_enable(true);
} else {
vfsreq_finish_short(req, ret);
diff --git a/src/kernel/arch/amd64/driver/serial.c b/src/kernel/arch/amd64/driver/serial.c
index eb347d0..76ec33b 100644
--- a/src/kernel/arch/amd64/driver/serial.c
+++ b/src/kernel/arch/amd64/driver/serial.c
@@ -22,7 +22,7 @@ void serial_init(void) {
if (COM1_exists) {
vfs_root_register("/dev/com1", accept);
}
- postqueue_init(&hung_reads);
+ reqqueue_init(&hung_reads);
}
static bool serial_selftest(void) {
@@ -58,7 +58,7 @@ void serial_preinit(void) {
static void serial_irq(void) {
ring_put1b((void*)&backlog, port_in8(COM1));
- postqueue_ringreadall(&hung_reads, (void*)&backlog);
+ reqqueue_ringreadall(&hung_reads, (void*)&backlog);
}
@@ -81,8 +81,8 @@ static void accept(VfsReq *req) {
vfsreq_finish_short(req, valid ? 0 : -1);
break;
case VFSOP_READ:
- postqueue_join(&hung_reads, req);
- postqueue_ringreadall(&hung_reads, (void*)&backlog);
+ reqqueue_join(&hung_reads, req);
+ reqqueue_ringreadall(&hung_reads, (void*)&backlog);
break;
case VFSOP_WRITE:
if (req->caller && !req->flags) {