OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcConsoleControlEntryModeLib.c
Go to the documentation of this file.
1
14#include <Uefi.h>
15
17
18#include <Library/PcdLib.h>
19#include <Library/UefiBootServicesTableLib.h>
20
21EFI_STATUS
22EFIAPI
24 IN EFI_HANDLE ImageHandle,
25 IN EFI_SYSTEM_TABLE *SystemTable
26 )
27{
28 EFI_STATUS Status;
29 EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
30
31 if (FixedPcdGet8 (PcdConsoleControlEntryMode) < EfiConsoleControlScreenMaxValue) {
32 //
33 // On several types of firmware, we need to use legacy console control protocol to
34 // switch to text mode, otherwise a black screen will be shown.
35 //
36 Status = gBS->HandleProtocol (
37 gST->ConsoleOutHandle,
39 (VOID **)&ConsoleControl
40 );
41 if (EFI_ERROR (Status)) {
42 Status = gBS->LocateProtocol (
44 NULL,
45 (VOID **)&ConsoleControl
46 );
47 }
48
49 if (!EFI_ERROR (Status)) {
50 ConsoleControl->SetMode (
51 ConsoleControl,
52 FixedPcdGet8 (PcdConsoleControlEntryMode)
53 );
54 }
55 }
56
57 return EFI_SUCCESS;
58}
@ EfiConsoleControlScreenMaxValue
EFI_GUID gEfiConsoleControlProtocolGuid
EFI_SYSTEM_TABLE * gST
EFI_BOOT_SERVICES * gBS
EFI_STATUS EFIAPI OcConsoleControlEntryModeConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)