diff options
author | dzwdz | 2023-01-25 21:58:18 +0100 |
---|---|---|
committer | dzwdz | 2023-01-25 21:58:18 +0100 |
commit | e06cf9993b5a40abcf6c1d6c77b497ff69a9fd44 (patch) | |
tree | 923f70a2285c878118fb2eee66446d948b35ec1f /src/kernel/arch/amd64 | |
parent | f9ce893e143a7c2356a0f2204afac1f37d3e54d2 (diff) |
kernel/driver: consolidate most header files into driver.h
Diffstat (limited to 'src/kernel/arch/amd64')
-rw-r--r-- | src/kernel/arch/amd64/boot.c | 5 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/driver.h (renamed from src/kernel/arch/amd64/driver/video.h) | 6 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/fsroot.c | 2 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/fsroot.h | 2 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/pata.c | 2 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/pata.h | 3 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/ps2.c | 5 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/ps2.h | 5 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/rtl8139.c | 5 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/rtl8139.h | 4 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/serial.c | 3 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/serial.h | 4 | ||||
-rw-r--r-- | src/kernel/arch/amd64/driver/video.c | 2 | ||||
-rw-r--r-- | src/kernel/arch/amd64/pci.c | 2 |
14 files changed, 19 insertions, 31 deletions
diff --git a/src/kernel/arch/amd64/boot.c b/src/kernel/arch/amd64/boot.c index bc9a675..c645fb6 100644 --- a/src/kernel/arch/amd64/boot.c +++ b/src/kernel/arch/amd64/boot.c @@ -1,10 +1,7 @@ #include <kernel/arch/amd64/3rdparty/multiboot2.h> #include <kernel/arch/amd64/boot.h> -#include <kernel/arch/amd64/driver/fsroot.h> -#include <kernel/arch/amd64/driver/pata.h> -#include <kernel/arch/amd64/driver/ps2.h> +#include <kernel/arch/amd64/driver/driver.h> #include <kernel/arch/amd64/driver/serial.h> -#include <kernel/arch/amd64/driver/video.h> #include <kernel/arch/amd64/interrupts.h> #include <kernel/arch/amd64/pci.h> #include <kernel/arch/amd64/tty/tty.h> diff --git a/src/kernel/arch/amd64/driver/video.h b/src/kernel/arch/amd64/driver/driver.h index e9dd8ae..0c4ecd5 100644 --- a/src/kernel/arch/amd64/driver/video.h +++ b/src/kernel/arch/amd64/driver/driver.h @@ -1,4 +1,6 @@ #pragma once +#include <kernel/types.h> +#include <stddef.h> #include <stdint.h> struct GfxInfo { @@ -9,4 +11,8 @@ struct GfxInfo { uint8_t bpp; }; +void pata_init(void); +void ps2_init(void); +void rtl8139_init(uint32_t bdf); +void vfs_root_init(void); void video_init(GfxInfo); diff --git a/src/kernel/arch/amd64/driver/fsroot.c b/src/kernel/arch/amd64/driver/fsroot.c index 6d3676d..0b0e2ef 100644 --- a/src/kernel/arch/amd64/driver/fsroot.c +++ b/src/kernel/arch/amd64/driver/fsroot.c @@ -1,6 +1,6 @@ #include <camellia/errno.h> #include <camellia/fsutil.h> -#include <kernel/arch/amd64/driver/fsroot.h> +#include <kernel/arch/amd64/driver/driver.h> #include <kernel/arch/amd64/driver/util.h> #include <kernel/panic.h> #include <kernel/proc.h> diff --git a/src/kernel/arch/amd64/driver/fsroot.h b/src/kernel/arch/amd64/driver/fsroot.h deleted file mode 100644 index dd72202..0000000 --- a/src/kernel/arch/amd64/driver/fsroot.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -void vfs_root_init(void); diff --git a/src/kernel/arch/amd64/driver/pata.c b/src/kernel/arch/amd64/driver/pata.c index 3e9fa7a..99c3102 100644 --- a/src/kernel/arch/amd64/driver/pata.c +++ b/src/kernel/arch/amd64/driver/pata.c @@ -1,7 +1,7 @@ #include <camellia/errno.h> #include <camellia/fsutil.h> #include <kernel/arch/amd64/ata.h> -#include <kernel/arch/amd64/driver/pata.h> +#include <kernel/arch/amd64/driver/driver.h> #include <kernel/arch/amd64/driver/util.h> #include <kernel/panic.h> #include <kernel/proc.h> diff --git a/src/kernel/arch/amd64/driver/pata.h b/src/kernel/arch/amd64/driver/pata.h deleted file mode 100644 index f74712b..0000000 --- a/src/kernel/arch/amd64/driver/pata.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -void pata_init(void); diff --git a/src/kernel/arch/amd64/driver/ps2.c b/src/kernel/arch/amd64/driver/ps2.c index 4aa17ff..06825d6 100644 --- a/src/kernel/arch/amd64/driver/ps2.c +++ b/src/kernel/arch/amd64/driver/ps2.c @@ -1,5 +1,5 @@ #include <camellia/errno.h> -#include <kernel/arch/amd64/driver/ps2.h> +#include <kernel/arch/amd64/driver/driver.h> #include <kernel/arch/amd64/driver/util.h> #include <kernel/arch/amd64/interrupts.h> #include <kernel/arch/amd64/port_io.h> @@ -17,6 +17,7 @@ static volatile uint8_t mouse_buf[64]; static volatile ring_t mouse_backlog = {(void*)mouse_buf, sizeof mouse_buf, 0, 0}; static void accept(VfsReq *req); +static void ps2_irq(void); static VfsReq *kb_queue = NULL; static VfsReq *mouse_queue = NULL; @@ -60,7 +61,7 @@ void ps2_init(void) { vfs_root_register("/ps2", accept); } -void ps2_irq(void) { +static void ps2_irq(void) { for (;;) { uint64_t status = port_in8(PS2 + 4); if (!(status & 1)) break; /* read while data available */ diff --git a/src/kernel/arch/amd64/driver/ps2.h b/src/kernel/arch/amd64/driver/ps2.h deleted file mode 100644 index e1b1521..0000000 --- a/src/kernel/arch/amd64/driver/ps2.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -#include <stdint.h> - -void ps2_irq(void); -void ps2_init(void); diff --git a/src/kernel/arch/amd64/driver/rtl8139.c b/src/kernel/arch/amd64/driver/rtl8139.c index bf8a67a..8a40f28 100644 --- a/src/kernel/arch/amd64/driver/rtl8139.c +++ b/src/kernel/arch/amd64/driver/rtl8139.c @@ -1,4 +1,4 @@ -#include <kernel/arch/amd64/driver/rtl8139.h> +#include <kernel/arch/amd64/driver/driver.h> #include <kernel/arch/amd64/driver/util.h> #include <kernel/arch/amd64/interrupts.h> #include <kernel/arch/amd64/pci.h> @@ -11,6 +11,7 @@ #define WAIT -1000 static void accept(VfsReq *req); +static void rtl8139_irq(void); static VfsReq *blocked_on = NULL; @@ -85,7 +86,7 @@ void rtl8139_init(uint32_t bdf) { vfs_root_register("/eth", accept); } -void rtl8139_irq(void) { +static void rtl8139_irq(void) { uint16_t status = port_in16(iobase + INTRSTATUS); if (!(status & 1)) { kprintf("bad rtl8139 status 0x%x\n", status); diff --git a/src/kernel/arch/amd64/driver/rtl8139.h b/src/kernel/arch/amd64/driver/rtl8139.h deleted file mode 100644 index 2677d82..0000000 --- a/src/kernel/arch/amd64/driver/rtl8139.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -#include <stdint.h> -void rtl8139_init(uint32_t bdf); -void rtl8139_irq(void); diff --git a/src/kernel/arch/amd64/driver/serial.c b/src/kernel/arch/amd64/driver/serial.c index e8774b6..5b42d8d 100644 --- a/src/kernel/arch/amd64/driver/serial.c +++ b/src/kernel/arch/amd64/driver/serial.c @@ -13,6 +13,7 @@ static volatile ring_t backlog = {(void*)backlog_buf, sizeof backlog_buf, 0, 0}; static const int COM1 = 0x3f8; static void accept(VfsReq *req); +static void serial_irq(void); static VfsReq *hung_reads = NULL; void serial_init(void) { vfs_root_register("/com1", accept); } @@ -43,7 +44,7 @@ void serial_preinit(void) { } -void serial_irq(void) { +static void serial_irq(void) { ring_put1b((void*)&backlog, port_in8(COM1)); postqueue_ringreadall(&hung_reads, (void*)&backlog); } diff --git a/src/kernel/arch/amd64/driver/serial.h b/src/kernel/arch/amd64/driver/serial.h index 6a4876e..2b4c104 100644 --- a/src/kernel/arch/amd64/driver/serial.h +++ b/src/kernel/arch/amd64/driver/serial.h @@ -1,10 +1,6 @@ #pragma once -#include <kernel/vfs/request.h> -#include <stdbool.h> #include <stddef.h> void serial_preinit(void); -void serial_irq(void); void serial_write(const char *buf, size_t len); - void serial_init(void); diff --git a/src/kernel/arch/amd64/driver/video.c b/src/kernel/arch/amd64/driver/video.c index ecf713f..cb70931 100644 --- a/src/kernel/arch/amd64/driver/video.c +++ b/src/kernel/arch/amd64/driver/video.c @@ -1,7 +1,7 @@ #include <camellia/errno.h> #include <camellia/fsutil.h> +#include <kernel/arch/amd64/driver/driver.h> #include <kernel/arch/amd64/driver/util.h> -#include <kernel/arch/amd64/driver/video.h> #include <kernel/panic.h> #include <kernel/proc.h> #include <kernel/vfs/request.h> diff --git a/src/kernel/arch/amd64/pci.c b/src/kernel/arch/amd64/pci.c index 23cd457..a6f1fab 100644 --- a/src/kernel/arch/amd64/pci.c +++ b/src/kernel/arch/amd64/pci.c @@ -1,4 +1,4 @@ -#include <kernel/arch/amd64/driver/rtl8139.h> +#include <kernel/arch/amd64/driver/driver.h> #include <kernel/arch/amd64/interrupts.h> #include <kernel/arch/amd64/pci.h> #include <kernel/arch/amd64/port_io.h> |