Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pc99,libplatsupport: rename ega --> vga to keep device names consistent #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libplatsupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down
12 changes: 6 additions & 6 deletions libplatsupport/plat_include/pc99/platsupport/plat/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions libplatsupport/src/plat/pc99/chardev.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "../../chardev.h"
#include "../../common.h"

#include "ega.h"
#include "vga.h"
#include "keyboard_chardev.h"
#include <utils/arith.h>

Expand All @@ -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, \
Expand All @@ -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};
Expand All @@ -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()
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -22,7 +22,7 @@
#include <string.h>

/* 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

Expand Down Expand Up @@ -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 ++;
Expand All @@ -89,27 +89,27 @@ 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;
}
}
return count;
}

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 {
Expand All @@ -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
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);