stivale2: Ensure serial off before starting runtime term

This commit is contained in:
mintsuki 2022-03-02 18:51:32 +01:00
parent 44d3ba3ba6
commit 7db81efbb0
3 changed files with 10 additions and 3 deletions

View File

@ -592,13 +592,16 @@ void gterm_putchar(uint8_t c) {
} }
} }
static bool last_serial = false;
bool gterm_init(size_t *_rows, size_t *_cols, size_t width, size_t height) { bool gterm_init(size_t *_rows, size_t *_cols, size_t width, size_t height) {
if (current_video_mode >= 0 if (current_video_mode >= 0
&& fbinfo.default_res == true && fbinfo.default_res == true
&& width == 0 && width == 0
&& height == 0 && height == 0
&& fbinfo.framebuffer_bpp == 32 && fbinfo.framebuffer_bpp == 32
&& !early_term) { && !early_term
&& serial == last_serial) {
*_rows = rows; *_rows = rows;
*_cols = cols; *_cols = cols;
gterm_clear(true); gterm_clear(true);
@ -609,7 +612,8 @@ bool gterm_init(size_t *_rows, size_t *_cols, size_t width, size_t height) {
&& fbinfo.framebuffer_width == width && fbinfo.framebuffer_width == width
&& fbinfo.framebuffer_height == height && fbinfo.framebuffer_height == height
&& fbinfo.framebuffer_bpp == 32 && fbinfo.framebuffer_bpp == 32
&& !early_term) { && !early_term
&& serial == last_serial) {
*_rows = rows; *_rows = rows;
*_cols = cols; *_cols = cols;
gterm_clear(true); gterm_clear(true);
@ -622,6 +626,8 @@ bool gterm_init(size_t *_rows, size_t *_cols, size_t width, size_t height) {
if (!fb_init(&fbinfo, width, height, 32)) if (!fb_init(&fbinfo, width, height, 32))
return false; return false;
last_serial = serial;
cursor_status = true; cursor_status = true;
scroll_enabled = true; scroll_enabled = true;

View File

@ -213,7 +213,7 @@ out:
if (E9_OUTPUT) { if (E9_OUTPUT) {
outb(0xe9, print_buf[i]); outb(0xe9, print_buf[i]);
} }
if (serial || COM_OUTPUT) { if ((term_backend != NOT_READY && serial) || COM_OUTPUT) {
switch (print_buf[i]) { switch (print_buf[i]) {
case '\n': case '\n':
serial_out('\r'); serial_out('\r');

View File

@ -527,6 +527,7 @@ failed_to_load_header_section:
if (bits == 64 && terminal_hdr_tag != NULL) { if (bits == 64 && terminal_hdr_tag != NULL) {
quiet = false; quiet = false;
serial = false;
if (bios && if (bios &&
((avtag == NULL && hdrtag == NULL) || (avtag != NULL && preference == 1))) { ((avtag == NULL && hdrtag == NULL) || (avtag != NULL && preference == 1))) {