105 IN OC_GLOBAL_CONFIG *Config
110 UINT32 TimerResolution;
111 CONST CHAR8 *PointerSupportStr;
114 CONST CHAR8 *KeySupportStr;
118 TimerResolution = Config->Uefi.Input.TimerResolution;
119 if (TimerResolution != 0) {
121 if (EFI_ERROR (Status)) {
122 DEBUG ((DEBUG_ERROR,
"OC: Failed to initialize timer quirk\n"));
128 if (Config->Uefi.Input.PointerSupport) {
129 PointerSupportStr =
OC_BLOB_GET (&Config->Uefi.Input.PointerSupportMode);
131 if (AsciiStrCmp (PointerSupportStr,
"ASUS") == 0) {
134 DEBUG ((DEBUG_WARN,
"OC: Invalid input pointer mode %a\n", PointerSupportStr));
139 if (EFI_ERROR (Status)) {
140 DEBUG ((DEBUG_INFO,
"OC: Failed to initialize pointer\n"));
147 if (Config->Uefi.Input.KeySupport) {
148 DEBUG ((DEBUG_INFO,
"OC: Installing KeySupport...\n"));
149 KeySupportStr =
OC_BLOB_GET (&Config->Uefi.Input.KeySupportMode);
151 if (AsciiStrCmp (KeySupportStr,
"Auto") == 0) {
153 }
else if (AsciiStrCmp (KeySupportStr,
"V1") == 0) {
155 }
else if (AsciiStrCmp (KeySupportStr,
"V2") == 0) {
157 }
else if (AsciiStrCmp (KeySupportStr,
"AMI") == 0) {
160 DEBUG ((DEBUG_WARN,
"OC: Invalid input key mode %a\n", KeySupportStr));
166 Config->Uefi.Input.KeyForgetThreshold,
167 Config->Uefi.Input.KeySwap,
168 Config->Uefi.Input.KeyFiltering
170 if (EFI_ERROR (Status)) {
171 DEBUG ((DEBUG_ERROR,
"OC: Failed to initialize keycode\n"));
186 IN OC_GLOBAL_CONFIG *Config
190 CONST CHAR8 *AsciiMode;
191 CONST CHAR8 *AsciiRenderer;
192 CONST CHAR8 *GopPassThrough;
193 EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
202 GopPassThrough =
OC_BLOB_GET (&Config->Uefi.Output.GopPassThrough);
203 if (AsciiStrCmp (GopPassThrough,
"Enabled") == 0) {
205 }
else if (AsciiStrCmp (GopPassThrough,
"Apple") == 0) {
208 Status = EFI_SUCCESS;
211 if (EFI_ERROR (Status)) {
214 "OC: OcProvideGopPassThrough %a status - %r\n",
220 if (Config->Uefi.Output.ProvideConsoleGop) {
234 "OC: Requested resolution is %ux%u@%u (max: %d, force: %d) from %a\n",
239 Config->Uefi.Output.ForceResolution,
243 if (SetMax || ((Width > 0) && (Height > 0))) {
248 Config->Uefi.Output.ForceResolution
251 EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED ? DEBUG_WARN : DEBUG_INFO,
252 "OC: Changed resolution to %ux%u@%u (max: %d, force: %d) from %a - %r\n",
257 Config->Uefi.Output.ForceResolution,
262 Status = EFI_UNSUPPORTED;
265 if (Config->Uefi.Output.GopBurstMode) {
269 if (Config->Uefi.Output.DirectGopRendering) {
273 if (Config->Uefi.Output.ReconnectOnResChange && !EFI_ERROR (Status)) {
277 if (Config->Uefi.Output.UgaPassThrough) {
279 if (EFI_ERROR (Status)) {
282 "OC: OcProvideUgaPassThrough status - %r\n",
288 if ((Config->Uefi.Output.UIScale >= 0) && (Config->Uefi.Output.UIScale <= 2)) {
289 if (Config->Uefi.Output.UIScale == 0) {
290 Status =
gBS->HandleProtocol (
291 gST->ConsoleOutHandle,
295 if (!EFI_ERROR (Status)) {
296 UIScale = (UINT64)Gop->Mode->Info->HorizontalResolution
297 * Gop->Mode->Info->VerticalResolution >= 4000000 ? 2 : 1;
300 "OC: Selected UIScale %d based on %ux%u resolution\n",
302 Gop->Mode->Info->HorizontalResolution,
303 Gop->Mode->Info->VerticalResolution
309 UIScale = (UINT8)Config->Uefi.Output.UIScale;
314 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
319 DEBUG ((DEBUG_INFO,
"OC: Setting UIScale to %d - %r\n", UIScale, Status));
322 AsciiMode =
OC_BLOB_GET (&Config->Uefi.Output.InitialMode);
324 if ((AsciiMode[0] ==
'\0') || (AsciiStrCmp (AsciiMode,
"Auto") == 0)) {
326 }
else if (AsciiStrCmp (AsciiMode,
"Text") == 0) {
328 }
else if (AsciiStrCmp (AsciiMode,
"Graphics") == 0) {
331 DEBUG ((DEBUG_WARN,
"OC: Requested unknown initial mode %a\n", AsciiMode));
335 AsciiRenderer =
OC_BLOB_GET (&Config->Uefi.Output.TextRenderer);
337 if ((AsciiRenderer[0] ==
'\0') || (AsciiStrCmp (AsciiRenderer,
"BuiltinGraphics") == 0)) {
339 }
else if (AsciiStrCmp (AsciiRenderer,
"BuiltinText") == 0) {
341 }
else if (AsciiStrCmp (AsciiRenderer,
"SystemGraphics") == 0) {
343 }
else if (AsciiStrCmp (AsciiRenderer,
"SystemText") == 0) {
345 }
else if (AsciiStrCmp (AsciiRenderer,
"SystemGeneric") == 0) {
348 DEBUG ((DEBUG_WARN,
"OC: Requested unknown renderer %a\n", AsciiRenderer));
364 Config->Uefi.Output.IgnoreTextInGraphics,
365 Config->Uefi.Output.SanitiseClearScreen,
366 Config->Uefi.Output.ClearScreenOnModeSwitch,
367 Config->Uefi.Output.ReplaceTabWithSpace,
374 "OC: Requested console mode is %ux%u (max: %d) from %a\n",
381 if (SetMax || ((Width > 0) && (Height > 0))) {
384 EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO,
385 "OC: Changed console mode to %ux%u (max: %d) from %a - %r\n",
VOID OcSetupConsole(IN EFI_CONSOLE_CONTROL_SCREEN_MODE InitialMode, IN OC_CONSOLE_RENDERER Renderer, IN OC_STORAGE_CONTEXT *Storage OPTIONAL, IN CONST CHAR8 *Font OPTIONAL, IN BOOLEAN IgnoreTextOutput, IN BOOLEAN SanitiseClearScreen, IN BOOLEAN ClearScreenOnModeSwitch, IN BOOLEAN ReplaceTabWithSpace, IN UINT32 Width, IN UINT32 Height)
VOID OcScheduleExitBootServices(IN EFI_EVENT_NOTIFY Handler, IN VOID *Context)