diff options
author | Toomas Soome <tsoome@me.com> | 2019-06-07 15:52:50 +0300 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-06-28 19:14:46 +0300 |
commit | a1d63828c2e12098f43bb49de5b78a6bafc80979 (patch) | |
tree | d838cd3fd0a9f6bd77becfdb850c739c3415edb6 | |
parent | ffca9b6bef40a4b4cb6c2739812326c6234f7984 (diff) | |
download | illumos-joyent-a1d63828c2e12098f43bb49de5b78a6bafc80979.tar.gz |
11212 loader: console c_probe callback must be reusable
Reviewed by: C Fraire <cfraire@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/boot/sys/boot/efi/libefi/efi_console.c | 34 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/i386/libi386/vidconsole.c | 3 |
2 files changed, 17 insertions, 20 deletions
diff --git a/usr/src/boot/sys/boot/efi/libefi/efi_console.c b/usr/src/boot/sys/boot/efi/libefi/efi_console.c index 1ad97635f1..a4bc6a27ec 100644 --- a/usr/src/boot/sys/boot/efi/libefi/efi_console.c +++ b/usr/src/boot/sys/boot/efi/libefi/efi_console.c @@ -444,10 +444,20 @@ efi_framebuffer_setup(void) static void efi_cons_probe(struct console *cp) { + cp->c_flags |= C_PRESENTIN | C_PRESENTOUT; +} + +static int +efi_cons_init(struct console *cp, int arg __unused) +{ struct efi_console_data *ecd; + void *coninex; EFI_STATUS status; UINTN i, max_dim, best_mode, cols, rows; + if (cp->c_private != NULL) + return (0); + ecd = calloc(1, sizeof (*ecd)); /* * As console probing is called very early, the only reason for @@ -457,9 +467,12 @@ efi_cons_probe(struct console *cp) panic("efi_cons_probe: This system has not enough memory\n"); cp->c_private = ecd; - conout = ST->ConOut; ecd->ecd_conin = ST->ConIn; - cp->c_flags |= C_PRESENTIN | C_PRESENTOUT; + conout = ST->ConOut; + + conout->SetAttribute(conout, EFI_TEXT_ATTR(DEFAULT_FGCOLOR, + DEFAULT_BGCOLOR)); + memset(keybuf, 0, KEYBUFSZ); status = BS->LocateProtocol(&ccontrol_protocol_guid, NULL, (VOID **)&console_control); @@ -509,21 +522,7 @@ efi_cons_probe(struct console *cp) /* some firmware enables the cursor when switching modes */ conout->EnableCursor(conout, FALSE); -} - -static int -efi_cons_init(struct console *cp, int arg __unused) -{ - struct efi_console_data *ecd; - void *coninex; - EFI_STATUS status; - int rc; - conout->SetAttribute(conout, EFI_TEXT_ATTR(DEFAULT_FGCOLOR, - DEFAULT_BGCOLOR)); - memset(keybuf, 0, KEYBUFSZ); - - ecd = cp->c_private; coninex = NULL; /* * Try to set up for SimpleTextInputEx protocol. If not available, @@ -535,9 +534,8 @@ efi_cons_init(struct console *cp, int arg __unused) ecd->ecd_coninex = coninex; gfx_framework_init(&fb_ops); - rc = tem_info_init(cp); - if (rc == 0 && tem == NULL) { + if (tem_info_init(cp) == 0 && tem == NULL) { tem = tem_init(); if (tem != NULL) tem_activate(tem, B_TRUE); diff --git a/usr/src/boot/sys/boot/i386/libi386/vidconsole.c b/usr/src/boot/sys/boot/i386/libi386/vidconsole.c index 2927c3cabb..8aefa33795 100644 --- a/usr/src/boot/sys/boot/i386/libi386/vidconsole.c +++ b/usr/src/boot/sys/boot/i386/libi386/vidconsole.c @@ -630,8 +630,6 @@ vidc_probe(struct console *cp) /* XXX for now, always assume we can do BIOS screen output */ cp->c_flags |= C_PRESENTOUT; - vbe_init(); - tem = NULL; } static int @@ -643,6 +641,7 @@ vidc_init(struct console *cp, int arg) return (0); vidc_started = 1; + vbe_init(); /* * Check Miscellaneous Output Register (Read at 3CCh, Write at 3C2h) |