diff --git a/drivers/term/fbcon.c b/drivers/term/fbcon.c index 9489027..225f64d 100644 --- a/drivers/term/fbcon.c +++ b/drivers/term/fbcon.c @@ -31,17 +31,17 @@ static struct tty_serial_ops fbcon_serial_ops = { .serial_getchar = fbcon_getchar, }; -struct tty *fbcon_init(void) +void fbcon_init(void) { if (!fb_res || !fb_res->framebuffer_count) - return NULL; + return; struct limine_framebuffer *fb = fb_res->framebuffers[0]; size_t fb_size = fb->pitch * fb->height; void *fb_virt = map_mmio_dev((paddr_t)TO_PHYS(fb->address), fb_size); if (!fb_virt) - return NULL; + return; ft_ctx = flanterm_fb_init( NULL, NULL, fb_virt, fb->width, fb->height, fb->pitch, fb->red_mask_size, fb->red_mask_shift, fb->green_mask_size, @@ -49,7 +49,7 @@ struct tty *fbcon_init(void) 0, 0, 0, 0, FLANTERM_FB_ROTATE_0); if (!ft_ctx) - return NULL; + return; struct tty *fbtty = tty_create("tty1", NULL); @@ -57,6 +57,4 @@ struct tty *fbcon_init(void) tty_printf = fbtty; kinfo("fbcon: framebuffer console initialized (%lux%lu)\n", fb->width, fb->height); - - return fbtty; } diff --git a/include/kernel/tty.h b/include/kernel/tty.h index c9986f4..33f74c4 100644 --- a/include/kernel/tty.h +++ b/include/kernel/tty.h @@ -32,8 +32,5 @@ void tty_set_cursor_pos(struct tty *tty, int x, int y); void tty_get_cursor_pos(struct tty *tty, int *row, int *col); void tty_get_size(struct tty *tty, int *rows, int *cols); void tty_setlf(struct tty *tty); -struct tty *tty_tee_create(const char *name); -void tty_tee_add(struct tty *tee, struct tty *child); -void tty_tee_remove(struct tty *tee, struct tty *child); #endif /* _TTY_H_ */ diff --git a/init/main.c b/init/main.c index 4119256..83ed8c1 100644 --- a/init/main.c +++ b/init/main.c @@ -36,10 +36,8 @@ typedef void (*initcall_t)(void); -struct tty *fbcon_init(); -void arch_ap_startup(); - extern initcall_t __initcall_start, __initcall_end; +extern void fbcon_init(void); struct tty *tty_printf = NULL; bool kernel_init_ready = false; @@ -76,19 +74,16 @@ static void kmain() tty_layer_init(); /* init main fallback tty */ - struct tty *serial_tty = NULL; - serial_port_tty_init(&serial_tty); + struct tty *main_tty = NULL; + serial_port_tty_init(&main_tty); - struct tty *visual_tty = fbcon_init(); + tty_printf = main_tty; - struct tty *tee = tty_tee_create("broadcast"); - tty_tee_add(tee, serial_tty); - tty_tee_add(tee, visual_tty); - - tty_printf = tee; + fbcon_init(); do_initcalls(); + void arch_ap_startup(); arch_ap_startup(); /* do nothing, for now :) */ diff --git a/kernel/tty/Makefile b/kernel/tty/Makefile index 1106f7d..7b44b69 100644 --- a/kernel/tty/Makefile +++ b/kernel/tty/Makefile @@ -1,5 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-y += tee.o obj-y += tty.o obj-y += vt100.o diff --git a/kernel/tty/tee.c b/kernel/tty/tee.c deleted file mode 100644 index 703d890..0000000 --- a/kernel/tty/tee.c +++ /dev/null @@ -1,67 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#include -#include -#include - -static void serial_putchar(struct tty *tty, char c) -{ - list_t *list = tty->priv; - if (!list) - return; - list_item_t *item = list->head; - while (item) { - struct tty *next = item->ptr; - next->serial_ops.serial_putchar(next, c); - item = item->next; - } -} - -static char serial_getchar(struct tty *tty) -{ - /* can't read from a tee, duh */ - return 0; -} - -struct tty *tty_tee_create(const char *name) -{ - static struct tty_serial_ops ops = {.serial_putchar = serial_putchar, .serial_getchar = serial_getchar}; - - list_t *list = kzalloc(sizeof(list_t), ALLOC_KERN); - if (!list) - return NULL; - list_create(list); - struct tty *ret = tty_create(name, list); - - if (!ret) { - list_destroy(list); - kfree(list); - return NULL; - } - - ret->serial_ops = ops; - - return ret; -} - -void tty_tee_add(struct tty *tee, struct tty *child) -{ - list_t *list = tee->priv; - list_insert(list, child); -} - -void tty_tee_remove(struct tty *tee, struct tty *child) -{ - list_t *list = tee->priv; - if (!list) - return; - - list_item_t *item = list->head; - while (item) { - if (item->ptr == child) { - list_remove(item); - return; - } - - item = item->next; - } -} diff --git a/limine.conf b/limine.conf index de07032..2b16ac7 100644 --- a/limine.conf +++ b/limine.conf @@ -1,5 +1,5 @@ -serial: yes timeout: 1 +resolution: 1920x1080 # The entry name that will be displayed in the boot menu. /vbos diff --git a/scripts/Makefile.limine b/scripts/Makefile.limine index c679083..1a6a18e 100644 --- a/scripts/Makefile.limine +++ b/scripts/Makefile.limine @@ -47,7 +47,6 @@ run: edk2-ovmf $(INITRAMFS) $(IMG) -accel kvm \ -hda $(IMG) \ -hdb test_drive.hdd \ - -serial stdio \ $(QEMUFLAGS) .PHONY += debug @@ -58,7 +57,6 @@ debug: edk2-ovmf $(IMG) -drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \ -hda $(IMG) \ -hdb test_drive.hdd \ - -serial stdio \ $(QEMUFLAGS) edk2-ovmf: