console logger - support disabling the console out.
console wrapper - comment fixes. file handle wrappers - allow for creation of layers of file interfaces to automatically convert ASCII to UCS-2. shell - add CTRL-S support and change how searching for startup.nsh. shellenvvar - zero the memory allocations. shall man parser - input verification on the help text. shellparameters protocol - input redirection verification enhanced, leave ^ behind when not used. shell protocol - remove ASSERTs, fixed GetDeviceName, allow mapping of BlockIO devices, and enhanced key monitoring for CTRL-S (now CTRL-S and CTRL-C). git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11440 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Provides interface to shell console logger.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@ -39,40 +39,40 @@ ConsoleLoggerInstall(
|
||||
EFI_STATUS Status;
|
||||
ASSERT(ConsoleInfo != NULL);
|
||||
|
||||
(*ConsoleInfo) = AllocatePool(sizeof(CONSOLE_LOGGER_PRIVATE_DATA));
|
||||
(*ConsoleInfo) = AllocateZeroPool(sizeof(CONSOLE_LOGGER_PRIVATE_DATA));
|
||||
if ((*ConsoleInfo) == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
(*ConsoleInfo)->Signature = CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE;
|
||||
(*ConsoleInfo)->OldConOut = NULL;
|
||||
(*ConsoleInfo)->OldConHandle = NULL;
|
||||
(*ConsoleInfo)->Buffer = NULL;
|
||||
(*ConsoleInfo)->BufferSize = 0;
|
||||
(*ConsoleInfo)->OriginalStartRow = 0;
|
||||
(*ConsoleInfo)->CurrentStartRow = 0;
|
||||
(*ConsoleInfo)->RowsPerScreen = 0;
|
||||
(*ConsoleInfo)->ColsPerScreen = 0;
|
||||
(*ConsoleInfo)->Attributes = NULL;
|
||||
(*ConsoleInfo)->AttribSize = 0;
|
||||
(*ConsoleInfo)->ScreenCount = ScreensToSave;
|
||||
(*ConsoleInfo)->HistoryMode.MaxMode = 1;
|
||||
(*ConsoleInfo)->HistoryMode.Mode = 0;
|
||||
(*ConsoleInfo)->HistoryMode.Attribute = 0;
|
||||
(*ConsoleInfo)->HistoryMode.CursorColumn = 0;
|
||||
(*ConsoleInfo)->HistoryMode.CursorRow = 0;
|
||||
(*ConsoleInfo)->HistoryMode.CursorVisible = FALSE;
|
||||
(*ConsoleInfo)->OurConOut.Reset = ConsoleLoggerReset;
|
||||
(*ConsoleInfo)->OurConOut.OutputString = ConsoleLoggerOutputString;
|
||||
(*ConsoleInfo)->OurConOut.TestString = ConsoleLoggerTestString;
|
||||
(*ConsoleInfo)->OurConOut.QueryMode = ConsoleLoggerQueryMode;
|
||||
(*ConsoleInfo)->OurConOut.SetMode = ConsoleLoggerSetMode;
|
||||
(*ConsoleInfo)->OurConOut.SetAttribute = ConsoleLoggerSetAttribute;
|
||||
(*ConsoleInfo)->OurConOut.ClearScreen = ConsoleLoggerClearScreen;
|
||||
(*ConsoleInfo)->Signature = CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE;
|
||||
(*ConsoleInfo)->OldConOut = gST->ConOut;
|
||||
(*ConsoleInfo)->OldConHandle = gST->ConsoleOutHandle;
|
||||
(*ConsoleInfo)->Buffer = NULL;
|
||||
(*ConsoleInfo)->BufferSize = 0;
|
||||
(*ConsoleInfo)->OriginalStartRow = 0;
|
||||
(*ConsoleInfo)->CurrentStartRow = 0;
|
||||
(*ConsoleInfo)->RowsPerScreen = 0;
|
||||
(*ConsoleInfo)->ColsPerScreen = 0;
|
||||
(*ConsoleInfo)->Attributes = NULL;
|
||||
(*ConsoleInfo)->AttribSize = 0;
|
||||
(*ConsoleInfo)->ScreenCount = ScreensToSave;
|
||||
(*ConsoleInfo)->HistoryMode.MaxMode = 1;
|
||||
(*ConsoleInfo)->HistoryMode.Mode = 0;
|
||||
(*ConsoleInfo)->HistoryMode.Attribute = 0;
|
||||
(*ConsoleInfo)->HistoryMode.CursorColumn = 0;
|
||||
(*ConsoleInfo)->HistoryMode.CursorRow = 0;
|
||||
(*ConsoleInfo)->HistoryMode.CursorVisible = FALSE;
|
||||
(*ConsoleInfo)->OurConOut.Reset = ConsoleLoggerReset;
|
||||
(*ConsoleInfo)->OurConOut.OutputString = ConsoleLoggerOutputString;
|
||||
(*ConsoleInfo)->OurConOut.TestString = ConsoleLoggerTestString;
|
||||
(*ConsoleInfo)->OurConOut.QueryMode = ConsoleLoggerQueryMode;
|
||||
(*ConsoleInfo)->OurConOut.SetMode = ConsoleLoggerSetMode;
|
||||
(*ConsoleInfo)->OurConOut.SetAttribute = ConsoleLoggerSetAttribute;
|
||||
(*ConsoleInfo)->OurConOut.ClearScreen = ConsoleLoggerClearScreen;
|
||||
(*ConsoleInfo)->OurConOut.SetCursorPosition = ConsoleLoggerSetCursorPosition;
|
||||
(*ConsoleInfo)->OurConOut.EnableCursor = ConsoleLoggerEnableCursor;
|
||||
(*ConsoleInfo)->OurConOut.Mode = NULL;
|
||||
(*ConsoleInfo)->Enabled = TRUE;
|
||||
(*ConsoleInfo)->OurConOut.EnableCursor = ConsoleLoggerEnableCursor;
|
||||
(*ConsoleInfo)->OurConOut.Mode = gST->ConOut->Mode;
|
||||
(*ConsoleInfo)->Enabled = TRUE;
|
||||
|
||||
Status = ConsoleLoggerResetBuffers(*ConsoleInfo);
|
||||
if (EFI_ERROR(Status)) {
|
||||
@ -90,11 +90,8 @@ ConsoleLoggerInstall(
|
||||
return (Status);
|
||||
}
|
||||
|
||||
(*ConsoleInfo)->OldConOut = gST->ConOut;
|
||||
(*ConsoleInfo)->OldConHandle = gST->ConsoleOutHandle;
|
||||
|
||||
gST->ConsoleOutHandle = gImageHandle;
|
||||
gST->ConOut = &(*ConsoleInfo)->OurConOut;
|
||||
gST->ConOut = &(*ConsoleInfo)->OurConOut;
|
||||
|
||||
return (Status);
|
||||
}
|
||||
@ -103,7 +100,7 @@ ConsoleLoggerInstall(
|
||||
Return the system to the state it was before InstallConsoleLogger
|
||||
was installed.
|
||||
|
||||
@param[in,out] ConsoleInfo The object from the install function.
|
||||
@param[in] ConsoleInfo The object from the install function.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful
|
||||
@return other The operation failed. This was from UninstallProtocolInterface.
|
||||
@ -631,7 +628,10 @@ ConsoleLoggerDoPageBreak(
|
||||
}
|
||||
if (*Resp == ShellPromptResponseContinue) {
|
||||
FreePool(Resp);
|
||||
ShellInfoObject.ConsoleInfo->RowCounter = 0;
|
||||
ShellInfoObject.ConsoleInfo->RowCounter = 0;
|
||||
// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorRow = 0;
|
||||
// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
|
||||
|
||||
return (EFI_SUCCESS);
|
||||
} else if (*Resp == ShellPromptResponseQuit) {
|
||||
FreePool(Resp);
|
||||
@ -660,16 +660,23 @@ ConsoleLoggerDoPageBreak(
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConsoleLoggerPrintWithPageBreak(
|
||||
IN CHAR16 *String,
|
||||
IN CONST CHAR16 *String,
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
)
|
||||
{
|
||||
CONST CHAR16 *Walker;
|
||||
CONST CHAR16 *LineStart;
|
||||
CHAR16 *StringCopy;
|
||||
CHAR16 TempChar;
|
||||
|
||||
for ( Walker = String
|
||||
, LineStart = String
|
||||
StringCopy = NULL;
|
||||
StringCopy = StrnCatGrow(&StringCopy, NULL, String, 0);
|
||||
if (StringCopy == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
for ( Walker = StringCopy
|
||||
, LineStart = StringCopy
|
||||
; Walker != NULL && *Walker != CHAR_NULL
|
||||
; Walker++
|
||||
){
|
||||
@ -766,6 +773,7 @@ ConsoleLoggerPrintWithPageBreak(
|
||||
//
|
||||
// We got an error which means 'break' and halt the printing
|
||||
//
|
||||
SHELL_FREE_NON_NULL(StringCopy);
|
||||
return (EFI_DEVICE_ERROR);
|
||||
}
|
||||
}
|
||||
@ -775,6 +783,7 @@ ConsoleLoggerPrintWithPageBreak(
|
||||
ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL(StringCopy);
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
@ -803,6 +812,9 @@ ConsoleLoggerOutputString (
|
||||
{
|
||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
|
||||
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
|
||||
return (EFI_UNSUPPORTED);
|
||||
}
|
||||
ASSERT(ShellInfoObject.ConsoleInfo == ConsoleInfo);
|
||||
if (!ShellInfoObject.ConsoleInfo->Enabled) {
|
||||
return (EFI_DEVICE_ERROR);
|
||||
@ -893,8 +905,8 @@ ConsoleLoggerQueryMode (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConsoleLoggerSetMode (
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
|
||||
IN UINTN ModeNumber
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
|
||||
IN UINTN ModeNumber
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@ -911,6 +923,7 @@ ConsoleLoggerSetMode (
|
||||
// Check that the buffers are still correct for logging
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ConsoleInfo->OurConOut.Mode = gST->ConOut->Mode;
|
||||
ConsoleLoggerResetBuffers(ConsoleInfo);
|
||||
}
|
||||
|
||||
@ -981,9 +994,12 @@ ConsoleLoggerClearScreen (
|
||||
INT32 *Attributes;
|
||||
UINTN Row;
|
||||
UINTN Column;
|
||||
|
||||
|
||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||
|
||||
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
|
||||
return (EFI_UNSUPPORTED);
|
||||
}
|
||||
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
|
||||
|
||||
//
|
||||
@ -1044,8 +1060,12 @@ ConsoleLoggerSetCursorPosition (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||
|
||||
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
|
||||
return (EFI_UNSUPPORTED);
|
||||
}
|
||||
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
|
||||
//
|
||||
// Forward the request to the original ConOut
|
||||
@ -1154,8 +1174,6 @@ ConsoleLoggerResetBuffers(
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
ConsoleInfo->OurConOut.Mode = gST->ConOut->Mode;
|
||||
ConsoleInfo->OldConOut = gST->ConOut;
|
||||
CopyMem (&ConsoleInfo->HistoryMode, ConsoleInfo->OldConOut->Mode, sizeof (EFI_SIMPLE_TEXT_OUTPUT_MODE));
|
||||
|
||||
return (EFI_SUCCESS);
|
||||
|
Reference in New Issue
Block a user