Skip to content
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
7 changes: 6 additions & 1 deletion components/SerialServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ if(KernelArchARM)
set(PlatPrefix "arm_common")
endif()
else()
set(PlatPrefix "${KernelPlatform}")
if(LibPlatSupportX86ConsoleDeviceVGA)
set(OutputDevice "vga")
else()
set(OutputDevice "com")
endif()
set(PlatPrefix "${KernelPlatform}/${OutputDevice}")
endif()

DeclareCAmkESComponent(
Expand Down
20 changes: 20 additions & 0 deletions components/SerialServer/include/plat/pc99/vga/plat/serial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2024, Dornerworks
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once

#define HARDWARE_SERIAL_INTERFACES \
dataport Buf(4096) txt_buf;

#define HARDWARE_SERIAL_ATTRIBUTES


#define HARDWARE_SERIAL_COMPOSITION \
component VGADisplay vga_hw; \
connection seL4HardwareMMIO vga_text(from txt_buf, to vga_hw.txt_buf);

#define HARDWARE_SERIAL_CONFIG \
vga_hw.txt_buf_paddr = 0xb8000; \
vga_hw.txt_buf_size = 0x1000;
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <platsupport/irq.h>
#include <sel4utils/sel4_zf_logif.h>

#include "../../plat.h"
#include "../../serial.h"
#include "../../../plat.h"
#include "../../../serial.h"

void plat_post_init(ps_irq_ops_t *irq_ops)
{
Expand Down
21 changes: 21 additions & 0 deletions components/SerialServer/src/plat/pc99/vga/plat.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2024, Dornerworks, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: BSD-2-Clause
*/

#include <autoconf.h>
#include <sel4/sel4.h>
#include <camkes.h>
#include <utils/util.h>
#include <platsupport/irq.h>
#include <sel4utils/sel4_zf_logif.h>

#include "../../../plat.h"
#include "../../../serial.h"

void plat_post_init(ps_irq_ops_t *irq_ops)
{
ZF_LOGI("EGA Display registers no IRQ");
return;
}
16 changes: 13 additions & 3 deletions components/SerialServer/src/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ const char *all_output_colours[2][MAX_CLIENTS] = {
#define COLOUR_INDEX_TO_STYLE(x) ((x) / (MAX_CLIENTS - 1))
#define COLOUR_INDEX_TO_SLOT(x) ((x) % MAX_CLIENTS)

static void retag_client_prints(int client)
{
#if defined(CONFIG_LIB_PLAT_SUPPORT_SERIAL_TEXT_VGA)
// take 1 off to start at 0 and remove MAX_CLIENT offset we added earlier
printf("VM[%d]:", (client -1) - MAX_CLIENTS);
#else
printf("%s%s", COLOR_RESET, all_output_colours[COLOUR_INDEX_TO_STYLE(client)][COLOUR_INDEX_TO_SLOT(client)]);
#endif
}

static void flush_buffer(int b)
{
const char *col = all_output_colours[COLOUR_INDEX_TO_STYLE(b)][COLOUR_INDEX_TO_SLOT(b)];
Expand All @@ -113,7 +123,7 @@ static void flush_buffer(int b)
return;
}
if (b != last_out) {
printf("%s%s", COLOR_RESET, col);
retag_client_prints(b);
last_out = b;
}
for (i = 0; i < output_buffers_used[b]; i++) {
Expand Down Expand Up @@ -154,7 +164,7 @@ static bool flush_buffer_line(int b)
return 0;
}
if (b != last_out) {
printf("%s%s", COLOR_RESET, all_output_colours[COLOUR_INDEX_TO_STYLE(b)][COLOUR_INDEX_TO_SLOT(b)]);
retag_client_prints(b);
last_out = b;
}
int i;
Expand Down Expand Up @@ -294,7 +304,7 @@ static void internal_putchar(int b, int c)
* it's probably going to overflow again, so let's avoid
* that. */
if (last_out != b) {
printf("%s%s", COLOR_RESET, all_output_colours[COLOUR_INDEX_TO_STYLE(b)][COLOUR_INDEX_TO_SLOT(b)]);
retag_client_prints(b);
last_out = b;
}
} else if ((index >= 1 && is_newline(buffer + index - 1) && coalesce_status == -1)
Expand Down