2 * console.c - Console screen handling functions
4 * Copyright (C) 2006 Christoph Pfisterer
6 * This file is part of the ELILO, the EFI Linux boot loader.
8 * ELILO is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * ELILO is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with ELILO; see the file COPYING. If not, write to the Free
20 * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 * Please check out the elilo.txt for complete documentation on how
24 * to use this program.
32 #include <efiConsoleControl.h>
34 static EFI_GUID console_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
36 static BOOLEAN console_inited = FALSE;
38 static EFI_CONSOLE_CONTROL_PROTOCOL *console_control;
41 * Initialize console functions
43 static VOID console_init(VOID)
47 if (!console_inited) {
48 console_inited = TRUE;
50 status = LibLocateProtocol(&console_guid, (VOID **) &console_control);
51 if (EFI_ERROR(status))
52 console_control = NULL;
57 * Switch the console to text mode
60 VOID console_textmode(VOID)
62 EFI_CONSOLE_CONTROL_SCREEN_MODE console_mode;
66 if (console_control != NULL) {
67 uefi_call_wrapper(console_control->GetMode, 4, console_control, &console_mode, NULL, NULL);
68 if (console_mode == EfiConsoleControlScreenGraphics)
69 uefi_call_wrapper(console_control->SetMode, 2, console_control, EfiConsoleControlScreenText);