From 5c0fa3d215216e87c4f34593a3fe2baddcb67f5d Mon Sep 17 00:00:00 2001 From: Eric Spidle Date: Mon, 10 Jun 2024 06:13:29 -0700 Subject: [PATCH] pc99,libplatsupport: rename ega --> vga to keep device names consistent Signed-off-by: Eric Spidle --- libplatsupport/CMakeLists.txt | 4 +-- .../pc99/platsupport/plat/serial.h | 12 +++---- libplatsupport/src/plat/pc99/chardev.c | 16 +++++----- libplatsupport/src/plat/pc99/{ega.c => vga.c} | 32 +++++++++---------- libplatsupport/src/plat/pc99/{ega.h => vga.h} | 2 +- 5 files changed, 33 insertions(+), 33 deletions(-) rename libplatsupport/src/plat/pc99/{ega.c => vga.c} (83%) rename libplatsupport/src/plat/pc99/{ega.h => vga.h} (73%) diff --git a/libplatsupport/CMakeLists.txt b/libplatsupport/CMakeLists.txt index 0bae33f2c..a2172e539 100644 --- a/libplatsupport/CMakeLists.txt +++ b/libplatsupport/CMakeLists.txt @@ -27,12 +27,12 @@ config_choice( com2 -> 0x2f8 \ com3 -> 0x3e8 \ com4 -> 0x2e8 \ - ega -> 80x25 text mode ega screen" + vga -> 80x25 text mode vga screen" "com1;LibPlatSupportX86ConsoleDeviceCom1;LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM1;KernelPlatPC99" "com2;LibPlatSupportX86ConsoleDeviceCom2;LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM2;KernelPlatPC99" "com3;LibPlatSupportX86ConsoleDeviceCom3;LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM3;KernelPlatPC99" "com4;LibPlatSupportX86ConsoleDeviceCom4;LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM4;KernelPlatPC99" - "ega;LibPlatSupportX86ConsoleDeviceEGA;LIB_PLAT_SUPPORT_SERIAL_TEXT_EGA;KernelPlatPC99" + "vga;LibPlatSupportX86ConsoleDeviceVGA;LIB_PLAT_SUPPORT_SERIAL_TEXT_VGA;KernelPlatPC99" ) set(LibPlatSupportMach "") diff --git a/libplatsupport/plat_include/pc99/platsupport/plat/serial.h b/libplatsupport/plat_include/pc99/platsupport/plat/serial.h index 15d0b0297..f9d13930c 100644 --- a/libplatsupport/plat_include/pc99/platsupport/plat/serial.h +++ b/libplatsupport/plat_include/pc99/platsupport/plat/serial.h @@ -24,14 +24,14 @@ #define SERIAL_CONSOLE_COM3_IRQ 4 #define SERIAL_CONSOLE_COM4_IRQ 3 -#define EGA_TEXT_FB_BASE 0xB8000 +#define VGA_TEXT_FB_BASE 0xB8000 enum chardev_id { PC99_SERIAL_COM1, PC99_SERIAL_COM2, PC99_SERIAL_COM3, PC99_SERIAL_COM4, - PC99_TEXT_EGA, + PC99_TEXT_VGA, PC99_KEYBOARD_PS2, /* Aliases */ PS_SERIAL0 = PC99_SERIAL_COM1, @@ -47,8 +47,8 @@ enum chardev_id { PS_SERIAL_DEFAULT = PC99_SERIAL_COM3 #elif defined(CONFIG_LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM4) PS_SERIAL_DEFAULT = PC99_SERIAL_COM4 -#elif defined(CONFIG_LIB_PLAT_SUPPORT_SERIAL_TEXT_EGA) - PS_SERIAL_DEFAULT = PC99_TEXT_EGA +#elif defined(CONFIG_LIB_PLAT_SUPPORT_SERIAL_TEXT_VGA) + PS_SERIAL_DEFAULT = PC99_TEXT_VGA #else PS_SERIAL_DEFAULT = PC99_SERIAL_COM1 #endif @@ -68,8 +68,8 @@ enum chardev_id { #elif defined(CONFIG_LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM4) #define DEFAULT_SERIAL_IOPORT SERIAL_CONSOLE_COM4_PORT #define DEFAULT_SERIAL_INTERRUPT SERIAL_CONSOLE_COM4_IRQ -#elif defined(CONFIG_LIB_PLAT_SUPPORT_SERIAL_TEXT_EGA) -/* Don't define a port for the EGA alphanumeric mode device */ +#elif defined(CONFIG_LIB_PLAT_SUPPORT_SERIAL_TEXT_VGA) +/* Don't define a port for the VGA alphanumeric mode device */ #else #define DEFAULT_SERIAL_IOPORT SERIAL_CONSOLE_COM1_PORT #define DEFAULT_SERIAL_INTERRUPT SERIAL_CONSOLE_COM1_IRQ diff --git a/libplatsupport/src/plat/pc99/chardev.c b/libplatsupport/src/plat/pc99/chardev.c index 561f9d089..471390c6f 100644 --- a/libplatsupport/src/plat/pc99/chardev.c +++ b/libplatsupport/src/plat/pc99/chardev.c @@ -12,7 +12,7 @@ #include "../../chardev.h" #include "../../common.h" -#include "ega.h" +#include "vga.h" #include "keyboard_chardev.h" #include @@ -21,7 +21,7 @@ static const int com2_irqs[] = {SERIAL_CONSOLE_COM2_IRQ, -1}; static const int com3_irqs[] = {SERIAL_CONSOLE_COM3_IRQ, -1}; static const int com4_irqs[] = {SERIAL_CONSOLE_COM4_IRQ, -1}; -static const int ega_irqs[] = { -1}; +static const int vga_irqs[] = { -1}; #define PC99_SERIAL_DEFN(devid) { \ .id = PC99_SERIAL_COM##devid, \ @@ -31,12 +31,12 @@ static const int ega_irqs[] = { -1}; .init_fn = &uart_init \ } -#define PC99_TEXT_EGA_DEFN() { \ - .id = PC99_TEXT_EGA, \ - .paddr = EGA_TEXT_FB_BASE, \ +#define PC99_TEXT_VGA_DEFN() { \ + .id = PC99_TEXT_VGA, \ + .paddr = VGA_TEXT_FB_BASE, \ .size = BIT(12), \ - .irqs = ega_irqs, \ - .init_fn = text_ega_init \ + .irqs = vga_irqs, \ + .init_fn = text_vga_init \ } static const int keyboard_irqs[] = {KEYBOARD_PS2_IRQ, -1}; @@ -54,7 +54,7 @@ static const struct dev_defn dev_defn[] = { PC99_SERIAL_DEFN(2), PC99_SERIAL_DEFN(3), PC99_SERIAL_DEFN(4), - PC99_TEXT_EGA_DEFN(), + PC99_TEXT_VGA_DEFN(), PC99_KEYBOARD_DEFN() }; diff --git a/libplatsupport/src/plat/pc99/ega.c b/libplatsupport/src/plat/pc99/vga.c similarity index 83% rename from libplatsupport/src/plat/pc99/ega.c rename to libplatsupport/src/plat/pc99/vga.c index 5133820dd..f3def2825 100644 --- a/libplatsupport/src/plat/pc99/ega.c +++ b/libplatsupport/src/plat/pc99/vga.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ /* - * Implementation of an 80x25 EGA text mode. All the functions are named with 'serial' since + * Implementation of an 80x25 vga text mode. All the functions are named with 'serial' since * that is what platsupport expects. This was a quick hack for a project and includes lots of * logic that is rather inspecific to the underlying frame buffer. If someone adds another text * mode frambuffer (or a linear frame buffer with a font renderer) then this should be abstracted. @@ -22,7 +22,7 @@ #include /* Assumptions on the graphics mode and frame buffer location */ -#define EGA_TEXT_FB_BASE 0xB8000 +#define VGA_TEXT_FB_BASE 0xB8000 #define MODE_WIDTH 80 #define MODE_HEIGHT 25 @@ -52,20 +52,20 @@ scroll(void) } static int -text_ega_getchar(ps_chardevice_t* d UNUSED) +text_vga_getchar(ps_chardevice_t* d UNUSED) { - assert(!"EGA framebuffer does not implement getchar"); + assert(!"vga framebuffer does not implement getchar"); return 0; } static int -text_ega_putchar(ps_chardevice_t* d, int c) +text_vga_putchar(ps_chardevice_t* d, int c) { /* emulate various control characters */ if (c == '\t') { - text_ega_putchar(d, ' '); + text_vga_putchar(d, ' '); while (cursor_x % 4 != 0) { - text_ega_putchar(d, ' '); + text_vga_putchar(d, ' '); } } else if (c == '\n') { cursor_y ++; @@ -89,12 +89,12 @@ text_ega_putchar(ps_chardevice_t* d, int c) } static ssize_t -text_ega_write(ps_chardevice_t* d, const void* vdata, size_t count, chardev_callback_t rcb UNUSED, void* token UNUSED) +text_vga_write(ps_chardevice_t* d, const void* vdata, size_t count, chardev_callback_t rcb UNUSED, void* token UNUSED) { const char* data = (const char*)vdata; int i; for (i = 0; i < count; i++) { - if (text_ega_putchar(d, *data++) < 0) { + if (text_vga_putchar(d, *data++) < 0) { return i; } } @@ -102,14 +102,14 @@ text_ega_write(ps_chardevice_t* d, const void* vdata, size_t count, chardev_call } static ssize_t -text_ega_read(ps_chardevice_t* d, void* vdata, size_t count, chardev_callback_t rcb UNUSED, void* token UNUSED) +text_vga_read(ps_chardevice_t* d, void* vdata, size_t count, chardev_callback_t rcb UNUSED, void* token UNUSED) { char* data; int ret; int i; data = (char*)vdata; for (i = 0; i < count; i++) { - ret = text_ega_getchar(d); + ret = text_vga_getchar(d); if (ret != EOF) { *data++ = ret; } else { @@ -120,13 +120,13 @@ text_ega_read(ps_chardevice_t* d, void* vdata, size_t count, chardev_callback_t } static void -text_ega_handle_irq(ps_chardevice_t* d) +text_vga_handle_irq(ps_chardevice_t* d) { /* TODO */ } int -text_ega_init(const struct dev_defn* defn, const ps_io_ops_t* ops, ps_chardevice_t* dev) +text_vga_init(const struct dev_defn* defn, const ps_io_ops_t* ops, ps_chardevice_t* dev) { /* handle an insane case where the serial might get repeatedly initialized. and * avoid clearing the entire screen if this is the case. This comes about due @@ -144,9 +144,9 @@ text_ega_init(const struct dev_defn* defn, const ps_io_ops_t* ops, ps_chardevice dev->id = defn->id; dev->vaddr = (void*)base_ptr; - dev->read = &text_ega_read; - dev->write = &text_ega_write; - dev->handle_irq = &text_ega_handle_irq; + dev->read = &text_vga_read; + dev->write = &text_vga_write; + dev->handle_irq = &text_vga_handle_irq; dev->irqs = defn->irqs; dev->ioops = *ops; diff --git a/libplatsupport/src/plat/pc99/ega.h b/libplatsupport/src/plat/pc99/vga.h similarity index 73% rename from libplatsupport/src/plat/pc99/ega.h rename to libplatsupport/src/plat/pc99/vga.h index 92efd012b..e85b40fe7 100644 --- a/libplatsupport/src/plat/pc99/ega.h +++ b/libplatsupport/src/plat/pc99/vga.h @@ -7,5 +7,5 @@ #include "../../chardev.h" -int text_ega_init(const struct dev_defn* defn, const ps_io_ops_t* ops, ps_chardevice_t* dev); +int text_vga_init(const struct dev_defn* defn, const ps_io_ops_t* ops, ps_chardevice_t* dev);