]> code.delx.au - refind/blob - EfiLib/Console.c
TianoCore build support; new use_graphics_for refind.conf token
[refind] / EfiLib / Console.c
1 /* $Id: Console.c $ */
2 /** @file
3 * Console.c - VirtualBox Console control emulation
4 */
5
6 /*
7 * Copyright (C) 2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18 #include "Platform.h"
19 extern EFI_RUNTIME_SERVICES* gRS;
20 static EFI_CONSOLE_CONTROL_SCREEN_MODE CurrentMode = EfiConsoleControlScreenText;
21
22 EFI_STATUS EFIAPI
23 GetModeImpl(
24 IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
25 OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
26 OUT BOOLEAN *GopUgaExists, OPTIONAL
27 OUT BOOLEAN *StdInLocked OPTIONAL
28 )
29 {
30 *Mode = CurrentMode;
31 // EfiConsoleControlScreenText;
32 // EfiConsoleControlScreenGraphics;
33
34 if (GopUgaExists)
35 *GopUgaExists = TRUE;
36 if (StdInLocked)
37 *StdInLocked = FALSE;
38 return EFI_SUCCESS;
39 }
40
41 EFI_STATUS EFIAPI
42 SetModeImpl(
43 IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
44 IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode
45 )
46 {
47 CurrentMode = Mode;
48 return EFI_SUCCESS;
49 }
50
51 EFI_STATUS EFIAPI
52 LockStdInImpl(
53 IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
54 IN CHAR16 *Password
55 )
56 {
57 return EFI_SUCCESS;
58 }
59
60
61 EFI_CONSOLE_CONTROL_PROTOCOL gConsoleController =
62 {
63 GetModeImpl,
64 SetModeImpl,
65 LockStdInImpl
66 };
67
68 EFI_GUID gEfiConsoleControlProtocolGuid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
69
70 EFI_STATUS
71 EFIAPI
72 InitializeConsoleSim ()
73 {
74 EFI_STATUS Status;
75 // EG_PIXEL BackgroundClear = {0, 0, 0, 0};
76 // CHAR16* bgc = L"BackgroundClear";
77 // UINTN dataSize = sizeof(BackgroundClear);
78
79
80 Status = gBS->InstallMultipleProtocolInterfaces (
81 &gImageHandle,
82 &gEfiConsoleControlProtocolGuid,
83 &gConsoleController,
84 NULL
85 );
86
87 // get background clear
88 // Status = gRS->GetVariable(bgc, &gEfiAppleNvramGuid, 0, &dataSize, &BackgroundClear);
89 // if(!EFI_ERROR(Status))
90 // return Status;
91
92 // Status = gRS->SetVariable(bgc, &gEfiAppleBootGuid,
93 // EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
94 // sizeof(BackgroundClear), &BackgroundClear);
95
96 ASSERT_EFI_ERROR (Status);
97
98 return Status;
99 }