-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.c
71 lines (58 loc) · 1.88 KB
/
console.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* console.c - Console screen handling functions
*
* Copyright (C) 2006 Christoph Pfisterer
*
* This file is part of the ELILO, the EFI Linux boot loader.
*
* ELILO is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* ELILO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ELILO; see the file COPYING. If not, write to the Free
* Software Foundation, 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Please check out the elilo.txt for complete documentation on how
* to use this program.
*/
#include <efi.h>
#include <efilib.h>
#include "elilo.h"
#include <efiConsoleControl.h>
static EFI_GUID console_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
static BOOLEAN console_inited = FALSE;
static EFI_CONSOLE_CONTROL_PROTOCOL *console_control;
/*
* Initialize console functions
*/
static VOID console_init(VOID)
{
EFI_STATUS status;
if (!console_inited) {
console_inited = TRUE;
status = LibLocateProtocol(&console_guid, (VOID **) &console_control);
if (EFI_ERROR(status))
console_control = NULL;
}
}
/*
* Switch the console to text mode
*/
VOID console_textmode(VOID)
{
EFI_CONSOLE_CONTROL_SCREEN_MODE console_mode;
console_init();
if (console_control != NULL) {
uefi_call_wrapper(console_control->GetMode, 4, console_control, &console_mode, NULL, NULL);
if (console_mode == EfiConsoleControlScreenGraphics)
uefi_call_wrapper(console_control->SetMode, 2, console_control, EfiConsoleControlScreenText);
}
}