OcConfigurationLib: Add DataHub and move ConsoleControl reinstall

This commit is contained in:
vit9696 2019-05-14 07:52:05 +03:00
parent 54721fbcb4
commit e5efad5979
5 changed files with 83 additions and 44 deletions

View File

@ -355,6 +355,8 @@
///
#define OC_UEFI_PROTOCOLS_FIELDS(_, __) \
_(BOOLEAN , AppleBootPolicy , , FALSE , ()) \
_(BOOLEAN , ConsoleControl , , FALSE , ()) \
_(BOOLEAN , DataHub , , FALSE , ()) \
_(BOOLEAN , DeviceProperties , , FALSE , ())
OC_DECLARE (OC_UEFI_PROTOCOLS)
@ -367,7 +369,6 @@
_(BOOLEAN , IgnoreTextInGraphics , , FALSE , ()) \
_(BOOLEAN , ReleaseUsbOwnership , , FALSE , ()) \
_(BOOLEAN , RequestBootVarRouting , , FALSE , ()) \
_(BOOLEAN , ProvideConsoleControl , , FALSE , ()) \
_(BOOLEAN , ProvideConsoleGop , , FALSE , ()) \
_(BOOLEAN , SanitiseClearScreen , , FALSE , ())
OC_DECLARE (OC_UEFI_QUIRKS)

View File

@ -15,6 +15,8 @@
#ifndef OC_CONSOLE_LIB_H
#define OC_CONSOLE_LIB_H
#include <Protocol/ConsoleControl.h>
/**
Possible console control behaviour.
**/
@ -26,16 +28,26 @@ typedef enum {
OcConsoleControlForceGraphics,
} OC_CONSOLE_CONTROL_BEHAVIOUR;
/**
Locate Console Control protocol.
@param[in] Reinstall Force local Console Control instance.
@retval Console Control protocol instance or NULL.
**/
EFI_CONSOLE_CONTROL_PROTOCOL *
OcConsoleControlInstallProtocol (
IN BOOLEAN Reinstall
);
/**
Configure console control protocol with given options.
@param[in] IgnoreTextOutput Skip console output in text mode.
@param[in] SanitiseClearScreen Workaround ClearScreen breaking resolution.
@retval EFI_SUCCESS on success.
**/
EFI_STATUS
ConsoleControlConfigure (
VOID
OcConsoleControlConfigure (
IN BOOLEAN IgnoreTextOutput,
IN BOOLEAN SanitiseClearScreen
);
@ -48,7 +60,7 @@ ConsoleControlConfigure (
@retval EFI_SUCCESS on success.
**/
EFI_STATUS
ConsoleControlSetBehaviour (
OcConsoleControlSetBehaviour (
IN OC_CONSOLE_CONTROL_BEHAVIOUR Behaviour
);

View File

@ -59,7 +59,10 @@ typedef struct {
CONST UINT8 *SmcPlatform;
} OC_DATA_HUB_DATA;
/** Locate Data Hub protocol.
/**
Locate Data Hub protocol.
@param[in] Reinstall Force local Data Hub instance.
@retval Data Hub protocol instance or NULL.
**/
@ -68,7 +71,8 @@ OcDataHubInstallProtocol (
IN BOOLEAN Reinstall
);
/** Set Data Hub entry.
/**
Set Data Hub entry.
@param[in] DataHub Data Hub protocol instance.
@param[in] DataRecordGuid The guid of the record to use.
@ -87,7 +91,8 @@ SetDataHubEntry (
IN UINT32 DataSize
);
/** Update DataHub entries.
/**
Update DataHub entries.
@param[in] Data Data to be used for updating.

View File

@ -405,7 +405,6 @@ mUefiQuirksSchema[] = {
OC_SCHEMA_INTEGER_IN ("ExitBootServicesDelay", OC_GLOBAL_CONFIG, Uefi.Quirks.ExitBootServicesDelay),
OC_SCHEMA_BOOLEAN_IN ("IgnoreInvalidFlexRatio", OC_GLOBAL_CONFIG, Uefi.Quirks.IgnoreInvalidFlexRatio),
OC_SCHEMA_BOOLEAN_IN ("IgnoreTextInGraphics", OC_GLOBAL_CONFIG, Uefi.Quirks.IgnoreTextInGraphics),
OC_SCHEMA_BOOLEAN_IN ("ProvideConsoleControl", OC_GLOBAL_CONFIG, Uefi.Quirks.ProvideConsoleControl),
OC_SCHEMA_BOOLEAN_IN ("ProvideConsoleGop", OC_GLOBAL_CONFIG, Uefi.Quirks.ProvideConsoleGop),
OC_SCHEMA_BOOLEAN_IN ("ReleaseUsbOwnership", OC_GLOBAL_CONFIG, Uefi.Quirks.ReleaseUsbOwnership),
OC_SCHEMA_BOOLEAN_IN ("RequestBootVarRouting", OC_GLOBAL_CONFIG, Uefi.Quirks.RequestBootVarRouting),
@ -416,6 +415,8 @@ STATIC
OC_SCHEMA
mUefiProtocolsSchema[] = {
OC_SCHEMA_BOOLEAN_IN ("AppleBootPolicy", OC_GLOBAL_CONFIG, Uefi.Protocols.AppleBootPolicy),
OC_SCHEMA_BOOLEAN_IN ("ConsoleControl", OC_GLOBAL_CONFIG, Uefi.Protocols.ConsoleControl),
OC_SCHEMA_BOOLEAN_IN ("DataHub", OC_GLOBAL_CONFIG, Uefi.Protocols.DataHub),
OC_SCHEMA_BOOLEAN_IN ("DeviceProperties", OC_GLOBAL_CONFIG, Uefi.Protocols.DeviceProperties),
};

View File

@ -210,10 +210,14 @@ mConsoleControlProtocol = {
ConsoleControlLockStdIn
};
EFI_STATUS
ConsoleControlConfigure (
IN BOOLEAN IgnoreTextOutput,
IN BOOLEAN SanitiseClearScreen
/**
Locate Console Control protocol.
@retval Data Hub protocol instance or NULL.
**/
EFI_CONSOLE_CONTROL_PROTOCOL *
OcConsoleControlInstallProtocol (
IN BOOLEAN Reinstall
)
{
EFI_STATUS Status;
@ -228,8 +232,52 @@ ConsoleControlConfigure (
DEBUG ((
DEBUG_INFO,
"OCC: Configuring console (%r) ignore %d san clear %d\n",
"OCC: Install console control %d - %r\n",
Status,
Reinstall
));
//
// Native implementation exists, overwrite on force.
//
if (!EFI_ERROR (Status)) {
if (Reinstall) {
CopyMem (
&mOriginalConsoleControlProtocol,
ConsoleControl,
sizeof (mOriginalConsoleControlProtocol)
);
CopyMem (
ConsoleControl,
&mConsoleControlProtocol,
sizeof (mOriginalConsoleControlProtocol)
);
}
return ConsoleControl;
}
NewHandle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&NewHandle,
&gEfiConsoleControlProtocolGuid,
&mConsoleControlProtocol,
NULL
);
return &mConsoleControlProtocol;
}
VOID
OcConsoleControlConfigure (
IN BOOLEAN IgnoreTextOutput,
IN BOOLEAN SanitiseClearScreen
)
{
DEBUG ((
DEBUG_INFO,
"OCC: Configuring console ignore %d san clear %d\n",
IgnoreTextOutput,
SanitiseClearScreen
));
@ -243,38 +291,10 @@ ConsoleControlConfigure (
mOriginalClearScreen = gST->ConOut->ClearScreen;
gST->ConOut->ClearScreen = ControlledClearScreen;
}
//
// Native implementation exists, ignore.
//
if (!EFI_ERROR (Status)) {
CopyMem (
&mOriginalConsoleControlProtocol,
ConsoleControl,
sizeof (mOriginalConsoleControlProtocol)
);
CopyMem (
ConsoleControl,
&mConsoleControlProtocol,
sizeof (mOriginalConsoleControlProtocol)
);
return EFI_SUCCESS;
}
NewHandle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&NewHandle,
&gEfiConsoleControlProtocolGuid,
&mConsoleControlProtocol,
NULL
);
return Status;
}
EFI_STATUS
ConsoleControlSetBehaviour (
OcConsoleControlSetBehaviour (
IN OC_CONSOLE_CONTROL_BEHAVIOUR Behaviour
)
{