mirror of https://github.com/ipxe/ipxe.git
[efi] Use EFI_CONSOLE_CONTROL_PROTOCOL to set text mode if available
On some older EFI 1.10 implementations (observed with an old iMac), we must use the (now obsolete) EFI_CONSOLE_CONTROL_PROTOCOL to switch the console into text mode. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/20/merge
parent
eb55c6871a
commit
8a42a36942
|
@ -24,8 +24,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ipxe/efi/efi.h>
|
#include <ipxe/efi/efi.h>
|
||||||
|
#include <ipxe/efi/Protocol/ConsoleControl/ConsoleControl.h>
|
||||||
#include <ipxe/ansiesc.h>
|
#include <ipxe/ansiesc.h>
|
||||||
#include <ipxe/console.h>
|
#include <ipxe/console.h>
|
||||||
|
#include <ipxe/init.h>
|
||||||
#include <config/console.h>
|
#include <config/console.h>
|
||||||
|
|
||||||
#define ATTR_BOLD 0x08
|
#define ATTR_BOLD 0x08
|
||||||
|
@ -61,6 +63,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
/** Current character attribute */
|
/** Current character attribute */
|
||||||
static unsigned int efi_attr = ATTR_DEFAULT;
|
static unsigned int efi_attr = ATTR_DEFAULT;
|
||||||
|
|
||||||
|
/** Console control protocol */
|
||||||
|
static EFI_CONSOLE_CONTROL_PROTOCOL *conctrl;
|
||||||
|
EFI_REQUEST_PROTOCOL ( EFI_CONSOLE_CONTROL_PROTOCOL, &conctrl );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle ANSI CUP (cursor position)
|
* Handle ANSI CUP (cursor position)
|
||||||
*
|
*
|
||||||
|
@ -286,9 +292,37 @@ static int efi_iskey ( void ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** EFI console driver */
|
||||||
struct console_driver efi_console __console_driver = {
|
struct console_driver efi_console __console_driver = {
|
||||||
.putchar = efi_putchar,
|
.putchar = efi_putchar,
|
||||||
.getchar = efi_getchar,
|
.getchar = efi_getchar,
|
||||||
.iskey = efi_iskey,
|
.iskey = efi_iskey,
|
||||||
.usage = CONSOLE_EFI,
|
.usage = CONSOLE_EFI,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise EFI console
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void efi_console_init ( void ) {
|
||||||
|
EFI_CONSOLE_CONTROL_SCREEN_MODE mode;
|
||||||
|
|
||||||
|
/* On some older EFI 1.10 implementations, we must use the
|
||||||
|
* (now obsolete) EFI_CONSOLE_CONTROL_PROTOCOL to switch the
|
||||||
|
* console into text mode.
|
||||||
|
*/
|
||||||
|
if ( conctrl ) {
|
||||||
|
conctrl->GetMode ( conctrl, &mode, NULL, NULL );
|
||||||
|
if ( mode != EfiConsoleControlScreenText ) {
|
||||||
|
conctrl->SetMode ( conctrl,
|
||||||
|
EfiConsoleControlScreenText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EFI console initialisation function
|
||||||
|
*/
|
||||||
|
struct init_fn efi_console_init_fn __init_fn ( INIT_EARLY ) = {
|
||||||
|
.initialise = efi_console_init,
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue