OcConsoleControlEntryModeLib: Initial import

This commit is contained in:
Download-Fritz 2019-05-22 16:02:26 +02:00
parent 5da38ee740
commit c3c9754c26
3 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,47 @@
/** @file
Copyright (C) 2019, Download-Fritz. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Uefi.h>
#include <Protocol/ConsoleControl.h>
#include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h>
EFI_STATUS
EFIAPI
OcConsoleControlEntryModeInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
//
// On several firmwares we need to use legacy console control protocol to
// switch to text mode, otherwise a black screen will be shown.
//
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiConsoleControlProtocolGuid,
(VOID **)&ConsoleControl
);
if (!EFI_ERROR (Status)) {
ConsoleControl->SetMode (
ConsoleControl,
PcdGet8 (PcdConsoleControlEntryMode)
);
}
return EFI_SUCCESS;
}

View File

@ -0,0 +1,45 @@
## @file
# OcConsoleControlEntryModeLib
#
# Copyright (c) 2019, Download-Fritz. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = OcConsoleControlEntryModeLib
FILE_GUID = 74B78F70-2959-47C7-8EAB-62DED119972B
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
CONSTRUCTOR = OcConsoleControlEntryModeInit
LIBRARY_CLASS = OcConsoleControlEntryModeLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE UEFI_APPLICATION UEFI_DRIVER
#
# VALID_ARCHITECTURES = X64
#
[Packages]
EfiPkg/EfiPkg.dec
MdePkg/MdePkg.dec
OcSupportPkg/OcSupportPkg.dec
[Pcd]
gOcSupportPkgTokenSpaceGuid.PcdConsoleControlEntryMode
[Protocols]
gEfiConsoleControlProtocolGuid
[LibraryClasses]
PcdLib
UefiBootServicesTableLib
[Sources]
OcConsoleControlEntryModeLib.c

View File

@ -57,6 +57,13 @@
# @Prompt Register a protocol installation notify for Apple KeyMap Database when not found initially.
gOcSupportPkgTokenSpaceGuid.PcNvramInitDevicePropertyDatabase|FALSE|BOOLEAN|0x00000001
[PcdsFixedAtBuild]
## Defines the Console Control initialization mode set on entry.<BR><BR>
# 0 - EfiConsoleControlScreenText<BR>
# 1 - EfiConsoleControlScreenGraphics<BR>
# @Prompt Initialize the console to the specified mode on entry.
gOcSupportPkgTokenSpaceGuid.PcdConsoleControlEntryMode|0|UINT8|0x00000100
[LibraryClasses]
## @libraryclass
OcAcpiLib|Include/Library/OcAcpiLib.h