ShellPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the ShellPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
c411b485b6
commit
47d20b54f9
@ -29,6 +29,7 @@ ConsoleLoggerInstall(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
ASSERT (ConsoleInfo != NULL);
|
ASSERT (ConsoleInfo != NULL);
|
||||||
|
|
||||||
(*ConsoleInfo) = AllocateZeroPool (sizeof (CONSOLE_LOGGER_PRIVATE_DATA));
|
(*ConsoleInfo) = AllocateZeroPool (sizeof (CONSOLE_LOGGER_PRIVATE_DATA));
|
||||||
@ -116,13 +117,22 @@ ConsoleLoggerUninstall(
|
|||||||
|
|
||||||
if (ConsoleInfo->Buffer != NULL) {
|
if (ConsoleInfo->Buffer != NULL) {
|
||||||
FreePool (ConsoleInfo->Buffer);
|
FreePool (ConsoleInfo->Buffer);
|
||||||
DEBUG_CODE(ConsoleInfo->Buffer = NULL;);
|
DEBUG_CODE (
|
||||||
DEBUG_CODE(ConsoleInfo->BufferSize = 0;);
|
ConsoleInfo->Buffer = NULL;
|
||||||
|
);
|
||||||
|
DEBUG_CODE (
|
||||||
|
ConsoleInfo->BufferSize = 0;
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConsoleInfo->Attributes != NULL) {
|
if (ConsoleInfo->Attributes != NULL) {
|
||||||
FreePool (ConsoleInfo->Attributes);
|
FreePool (ConsoleInfo->Attributes);
|
||||||
DEBUG_CODE(ConsoleInfo->Attributes = NULL;);
|
DEBUG_CODE (
|
||||||
DEBUG_CODE(ConsoleInfo->AttribSize = 0;);
|
ConsoleInfo->Attributes = NULL;
|
||||||
|
);
|
||||||
|
DEBUG_CODE (
|
||||||
|
ConsoleInfo->AttribSize = 0;
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
gST->ConsoleOutHandle = ConsoleInfo->OldConHandle;
|
gST->ConsoleOutHandle = ConsoleInfo->OldConHandle;
|
||||||
@ -288,10 +298,11 @@ UpdateDisplayFromHistory(
|
|||||||
Attributes = &ConsoleInfo->Attributes[ConsoleInfo->ColsPerScreen * ConsoleInfo->CurrentStartRow];
|
Attributes = &ConsoleInfo->Attributes[ConsoleInfo->ColsPerScreen * ConsoleInfo->CurrentStartRow];
|
||||||
for ( CurrentRow = 0
|
for ( CurrentRow = 0
|
||||||
; CurrentRow < ConsoleInfo->RowsPerScreen
|
; CurrentRow < ConsoleInfo->RowsPerScreen
|
||||||
; CurrentRow++
|
; CurrentRow++,
|
||||||
, Screen += (ConsoleInfo->ColsPerScreen + 2)
|
Screen += (ConsoleInfo->ColsPerScreen + 2),
|
||||||
, Attributes += ConsoleInfo->ColsPerScreen
|
Attributes += ConsoleInfo->ColsPerScreen
|
||||||
){
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// dont use the last char - prevents screen scroll
|
// dont use the last char - prevents screen scroll
|
||||||
//
|
//
|
||||||
@ -303,7 +314,8 @@ UpdateDisplayFromHistory(
|
|||||||
for ( Column = 0
|
for ( Column = 0
|
||||||
; Column < ConsoleInfo->ColsPerScreen
|
; Column < ConsoleInfo->ColsPerScreen
|
||||||
; Column++
|
; Column++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
if (Screen[Column] != CHAR_NULL) {
|
if (Screen[Column] != CHAR_NULL) {
|
||||||
CurrentAttrib = Attributes[Column];
|
CurrentAttrib = Attributes[Column];
|
||||||
CurrentColumn = Column;
|
CurrentColumn = Column;
|
||||||
@ -317,9 +329,10 @@ UpdateDisplayFromHistory(
|
|||||||
StringSegmentEndChar = CHAR_NULL;
|
StringSegmentEndChar = CHAR_NULL;
|
||||||
for ( StringSegmentEnd = StringSegment
|
for ( StringSegmentEnd = StringSegment
|
||||||
; *StringSegmentEnd != CHAR_NULL
|
; *StringSegmentEnd != CHAR_NULL
|
||||||
; StringSegmentEnd++
|
; StringSegmentEnd++,
|
||||||
, Column++
|
Column++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
if (Attributes[Column] != CurrentAttrib) {
|
if (Attributes[Column] != CurrentAttrib) {
|
||||||
StringSegmentEndChar = *StringSegmentEnd;
|
StringSegmentEndChar = *StringSegmentEnd;
|
||||||
*StringSegmentEnd = CHAR_NULL;
|
*StringSegmentEnd = CHAR_NULL;
|
||||||
@ -413,6 +426,7 @@ ConsoleLoggerReset (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||||
|
|
||||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -458,12 +472,14 @@ AppendStringToHistory(
|
|||||||
for ( Walker = String
|
for ( Walker = String
|
||||||
; Walker != NULL && *Walker != CHAR_NULL
|
; Walker != NULL && *Walker != CHAR_NULL
|
||||||
; Walker++
|
; Walker++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
switch (*Walker) {
|
switch (*Walker) {
|
||||||
case (CHAR_BACKSPACE):
|
case (CHAR_BACKSPACE):
|
||||||
if (ConsoleInfo->HistoryMode.CursorColumn > 0) {
|
if (ConsoleInfo->HistoryMode.CursorColumn > 0) {
|
||||||
ConsoleInfo->HistoryMode.CursorColumn--;
|
ConsoleInfo->HistoryMode.CursorColumn--;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case (CHAR_LINEFEED):
|
case (CHAR_LINEFEED):
|
||||||
if (ConsoleInfo->HistoryMode.CursorRow >= (INT32)((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)-1)) {
|
if (ConsoleInfo->HistoryMode.CursorRow >= (INT32)((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)-1)) {
|
||||||
@ -488,7 +504,8 @@ AppendStringToHistory(
|
|||||||
for ( Index = 0
|
for ( Index = 0
|
||||||
; Index < ConsoleInfo->ColsPerScreen
|
; Index < ConsoleInfo->ColsPerScreen
|
||||||
; Index++
|
; Index++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
*(ConsoleInfo->Attributes + (CopySize/sizeof (ConsoleInfo->Attributes[0])) + Index) = ConsoleInfo->HistoryMode.Attribute;
|
*(ConsoleInfo->Attributes + (CopySize/sizeof (ConsoleInfo->Attributes[0])) + Index) = ConsoleInfo->HistoryMode.Attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,8 +542,10 @@ AppendStringToHistory(
|
|||||||
ConsoleInfo->OriginalStartRow++;
|
ConsoleInfo->OriginalStartRow++;
|
||||||
ConsoleInfo->CurrentStartRow++;
|
ConsoleInfo->CurrentStartRow++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleInfo->HistoryMode.CursorRow++;
|
ConsoleInfo->HistoryMode.CursorRow++;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case (CHAR_CARRIAGE_RETURN):
|
case (CHAR_CARRIAGE_RETURN):
|
||||||
//
|
//
|
||||||
@ -543,18 +562,21 @@ AppendStringToHistory(
|
|||||||
|
|
||||||
for ( // no initializer needed
|
for ( // no initializer needed
|
||||||
; ConsoleInfo->HistoryMode.CursorColumn < (INT32)ConsoleInfo->ColsPerScreen
|
; ConsoleInfo->HistoryMode.CursorColumn < (INT32)ConsoleInfo->ColsPerScreen
|
||||||
; ConsoleInfo->HistoryMode.CursorColumn++
|
; ConsoleInfo->HistoryMode.CursorColumn++,
|
||||||
, PrintIndex++
|
PrintIndex++,
|
||||||
, Walker++
|
Walker++
|
||||||
){
|
)
|
||||||
if (*Walker == CHAR_NULL
|
{
|
||||||
||*Walker == CHAR_BACKSPACE
|
if ( (*Walker == CHAR_NULL)
|
||||||
||*Walker == CHAR_LINEFEED
|
|| (*Walker == CHAR_BACKSPACE)
|
||||||
||*Walker == CHAR_CARRIAGE_RETURN
|
|| (*Walker == CHAR_LINEFEED)
|
||||||
){
|
|| (*Walker == CHAR_CARRIAGE_RETURN)
|
||||||
|
)
|
||||||
|
{
|
||||||
Walker--;
|
Walker--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The buffer is 2*CursorRow more since it has that many \r\n characters at the end of each row.
|
// The buffer is 2*CursorRow more since it has that many \r\n characters at the end of each row.
|
||||||
//
|
//
|
||||||
@ -641,12 +663,15 @@ ConsoleLoggerDoPageBreak(
|
|||||||
if (Resp == NULL) {
|
if (Resp == NULL) {
|
||||||
return (EFI_NOT_FOUND);
|
return (EFI_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Resp != NULL) {
|
if (Resp != NULL) {
|
||||||
FreePool (Resp);
|
FreePool (Resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*Resp == ShellPromptResponseContinue) {
|
if (*Resp == ShellPromptResponseContinue) {
|
||||||
FreePool (Resp);
|
FreePool (Resp);
|
||||||
ShellInfoObject.ConsoleInfo->RowCounter = 0;
|
ShellInfoObject.ConsoleInfo->RowCounter = 0;
|
||||||
@ -665,8 +690,10 @@ ConsoleLoggerDoPageBreak(
|
|||||||
} else {
|
} else {
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function to handle printing the output with page breaks.
|
Worker function to handle printing the output with page breaks.
|
||||||
|
|
||||||
@ -699,16 +726,18 @@ ConsoleLoggerPrintWithPageBreak(
|
|||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Walker = StringCopy
|
for ( Walker = StringCopy,
|
||||||
, LineStart = StringCopy
|
LineStart = StringCopy
|
||||||
; Walker != NULL && *Walker != CHAR_NULL
|
; Walker != NULL && *Walker != CHAR_NULL
|
||||||
; Walker++
|
; Walker++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
switch (*Walker) {
|
switch (*Walker) {
|
||||||
case (CHAR_BACKSPACE):
|
case (CHAR_BACKSPACE):
|
||||||
if (ConsoleInfo->OurConOut.Mode->CursorColumn > 0) {
|
if (ConsoleInfo->OurConOut.Mode->CursorColumn > 0) {
|
||||||
ConsoleInfo->OurConOut.Mode->CursorColumn--;
|
ConsoleInfo->OurConOut.Mode->CursorColumn--;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case (CHAR_LINEFEED):
|
case (CHAR_LINEFEED):
|
||||||
//
|
//
|
||||||
@ -786,6 +815,7 @@ ConsoleLoggerPrintWithPageBreak(
|
|||||||
ConsoleInfo->OurConOut.Mode->CursorRow++;
|
ConsoleInfo->OurConOut.Mode->CursorRow++;
|
||||||
ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
|
ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
|
||||||
} // last column on line
|
} // last column on line
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} // switch for character
|
} // switch for character
|
||||||
|
|
||||||
@ -803,7 +833,7 @@ ConsoleLoggerPrintWithPageBreak(
|
|||||||
}
|
}
|
||||||
} // for loop
|
} // for loop
|
||||||
|
|
||||||
if (LineStart != NULL && *LineStart != CHAR_NULL) {
|
if ((LineStart != NULL) && (*LineStart != CHAR_NULL)) {
|
||||||
ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo);
|
ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,12 +874,12 @@ ConsoleLoggerOutputString (
|
|||||||
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
|
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
|
||||||
return (EFI_UNSUPPORTED);
|
return (EFI_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (ShellInfoObject.ConsoleInfo == ConsoleInfo);
|
ASSERT (ShellInfoObject.ConsoleInfo == ConsoleInfo);
|
||||||
|
|
||||||
Status = gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **)&TxtInEx);
|
Status = gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **)&TxtInEx);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
while (ShellInfoObject.HaltOutput) {
|
while (ShellInfoObject.HaltOutput) {
|
||||||
|
|
||||||
ShellInfoObject.HaltOutput = FALSE;
|
ShellInfoObject.HaltOutput = FALSE;
|
||||||
//
|
//
|
||||||
// just get some key
|
// just get some key
|
||||||
@ -865,7 +895,8 @@ ConsoleLoggerOutputString (
|
|||||||
((KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED)) ||
|
((KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED)) ||
|
||||||
(KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED))
|
(KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED))
|
||||||
)
|
)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ShellInfoObject.HaltOutput = TRUE;
|
ShellInfoObject.HaltOutput = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -902,6 +933,7 @@ ConsoleLoggerTestString (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||||
|
|
||||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||||
//
|
//
|
||||||
// Forward the request to the original ConOut
|
// Forward the request to the original ConOut
|
||||||
@ -933,6 +965,7 @@ ConsoleLoggerQueryMode (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||||
|
|
||||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||||
//
|
//
|
||||||
// Forward the request to the original ConOut
|
// Forward the request to the original ConOut
|
||||||
@ -967,6 +1000,7 @@ ConsoleLoggerSetMode (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||||
|
|
||||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1013,6 +1047,7 @@ ConsoleLoggerSetAttribute (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||||
|
|
||||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1074,21 +1109,25 @@ ConsoleLoggerClearScreen (
|
|||||||
for ( Row = ConsoleInfo->OriginalStartRow
|
for ( Row = ConsoleInfo->OriginalStartRow
|
||||||
; Row < (ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)
|
; Row < (ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)
|
||||||
; Row++
|
; Row++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
for ( Column = 0
|
for ( Column = 0
|
||||||
; Column < ConsoleInfo->ColsPerScreen
|
; Column < ConsoleInfo->ColsPerScreen
|
||||||
; Column++
|
; Column++,
|
||||||
, Screen++
|
Screen++,
|
||||||
, Attributes++
|
Attributes++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
*Screen = L' ';
|
*Screen = L' ';
|
||||||
*Attributes = ConsoleInfo->OldConOut->Mode->Attribute;
|
*Attributes = ConsoleInfo->OldConOut->Mode->Attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Skip the NULL on each column end in text buffer only
|
// Skip the NULL on each column end in text buffer only
|
||||||
//
|
//
|
||||||
Screen += 2;
|
Screen += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleInfo->HistoryMode.CursorColumn = 0;
|
ConsoleInfo->HistoryMode.CursorColumn = 0;
|
||||||
ConsoleInfo->HistoryMode.CursorRow = 0;
|
ConsoleInfo->HistoryMode.CursorRow = 0;
|
||||||
}
|
}
|
||||||
@ -1168,6 +1207,7 @@ ConsoleLoggerEnableCursor (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||||
|
|
||||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||||
//
|
//
|
||||||
// Forward the request to the original ConOut
|
// Forward the request to the original ConOut
|
||||||
@ -1204,6 +1244,7 @@ ConsoleLoggerResetBuffers(
|
|||||||
ConsoleInfo->Buffer = NULL;
|
ConsoleInfo->Buffer = NULL;
|
||||||
ConsoleInfo->BufferSize = 0;
|
ConsoleInfo->BufferSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConsoleInfo->Attributes != NULL) {
|
if (ConsoleInfo->Attributes != NULL) {
|
||||||
FreePool (ConsoleInfo->Attributes);
|
FreePool (ConsoleInfo->Attributes);
|
||||||
ConsoleInfo->Attributes = NULL;
|
ConsoleInfo->Attributes = NULL;
|
||||||
|
@ -314,4 +314,3 @@ ConsoleLoggerResetBuffers(
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif //_CONSOLE_LOGGER_HEADER_
|
#endif //_CONSOLE_LOGGER_HEADER_
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ FileBasedSimpleTextInReadKeyStroke(
|
|||||||
//
|
//
|
||||||
// Verify the parameters
|
// Verify the parameters
|
||||||
//
|
//
|
||||||
if (Key == NULL || This == NULL) {
|
if ((Key == NULL) || (This == NULL)) {
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +100,7 @@ FileBasedSimpleTextInReadKeyStroke(
|
|||||||
} else {
|
} else {
|
||||||
CharSize = sizeof (CHAR8);
|
CharSize = sizeof (CHAR8);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Decrement the amount of free space by Size or set to zero (for odd length files)
|
// Decrement the amount of free space by Size or set to zero (for odd length files)
|
||||||
//
|
//
|
||||||
@ -113,7 +114,8 @@ FileBasedSimpleTextInReadKeyStroke(
|
|||||||
return (ShellInfoObject.NewEfiShellProtocol->ReadFile (
|
return (ShellInfoObject.NewEfiShellProtocol->ReadFile (
|
||||||
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle,
|
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle,
|
||||||
&Size,
|
&Size,
|
||||||
&Key->UnicodeChar));
|
&Key->UnicodeChar
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,7 +139,7 @@ CreateSimpleTextInOnFile(
|
|||||||
UINT64 CurrentPosition;
|
UINT64 CurrentPosition;
|
||||||
UINT64 FileSize;
|
UINT64 FileSize;
|
||||||
|
|
||||||
if (HandleLocation == NULL || FileHandleToUse == NULL) {
|
if ((HandleLocation == NULL) || (FileHandleToUse == NULL)) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,12 +171,14 @@ CreateSimpleTextInOnFile(
|
|||||||
FreePool (ProtocolToReturn);
|
FreePool (ProtocolToReturn);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @todo possibly also install SimpleTextInputEx on the handle at this point.
|
/// @todo possibly also install SimpleTextInputEx on the handle at this point.
|
||||||
Status = gBS->InstallProtocolInterface (
|
Status = gBS->InstallProtocolInterface (
|
||||||
&(ProtocolToReturn->TheHandle),
|
&(ProtocolToReturn->TheHandle),
|
||||||
&gEfiSimpleTextInProtocolGuid,
|
&gEfiSimpleTextInProtocolGuid,
|
||||||
EFI_NATIVE_INTERFACE,
|
EFI_NATIVE_INTERFACE,
|
||||||
&(ProtocolToReturn->SimpleTextIn));
|
&(ProtocolToReturn->SimpleTextIn)
|
||||||
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
*HandleLocation = ProtocolToReturn->TheHandle;
|
*HandleLocation = ProtocolToReturn->TheHandle;
|
||||||
return ((EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)ProtocolToReturn);
|
return ((EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)ProtocolToReturn);
|
||||||
@ -209,7 +213,8 @@ CloseSimpleTextInOnFile(
|
|||||||
Status1 = gBS->UninstallProtocolInterface (
|
Status1 = gBS->UninstallProtocolInterface (
|
||||||
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->TheHandle,
|
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->TheHandle,
|
||||||
&gEfiSimpleTextInProtocolGuid,
|
&gEfiSimpleTextInProtocolGuid,
|
||||||
&(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->SimpleTextIn));
|
&(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn)
|
||||||
|
);
|
||||||
|
|
||||||
FreePool (SimpleTextIn);
|
FreePool (SimpleTextIn);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
@ -285,7 +290,8 @@ FileBasedSimpleTextOutQueryMode (
|
|||||||
PassThruProtocol,
|
PassThruProtocol,
|
||||||
ModeNumber,
|
ModeNumber,
|
||||||
Columns,
|
Columns,
|
||||||
Rows));
|
Rows
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -407,11 +413,13 @@ FileBasedSimpleTextOutOutputString (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
Size = StrLen (WString) * sizeof (CHAR16);
|
Size = StrLen (WString) * sizeof (CHAR16);
|
||||||
return (ShellInfoObject.NewEfiShellProtocol->WriteFile (
|
return (ShellInfoObject.NewEfiShellProtocol->WriteFile (
|
||||||
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle,
|
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle,
|
||||||
&Size,
|
&Size,
|
||||||
WString));
|
WString
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -435,7 +443,7 @@ CreateSimpleTextOutOnFile(
|
|||||||
SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ProtocolToReturn;
|
SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ProtocolToReturn;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if (HandleLocation == NULL || FileHandleToUse == NULL) {
|
if ((HandleLocation == NULL) || (FileHandleToUse == NULL)) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,6 +451,7 @@ CreateSimpleTextOutOnFile(
|
|||||||
if (ProtocolToReturn == NULL) {
|
if (ProtocolToReturn == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtocolToReturn->FileHandle = FileHandleToUse;
|
ProtocolToReturn->FileHandle = FileHandleToUse;
|
||||||
ProtocolToReturn->OriginalSimpleTextOut = OriginalProtocol;
|
ProtocolToReturn->OriginalSimpleTextOut = OriginalProtocol;
|
||||||
ProtocolToReturn->SimpleTextOut.Reset = FileBasedSimpleTextOutReset;
|
ProtocolToReturn->SimpleTextOut.Reset = FileBasedSimpleTextOutReset;
|
||||||
@ -459,6 +468,7 @@ CreateSimpleTextOutOnFile(
|
|||||||
FreePool (ProtocolToReturn);
|
FreePool (ProtocolToReturn);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtocolToReturn->SimpleTextOut.Mode->MaxMode = OriginalProtocol->Mode->MaxMode;
|
ProtocolToReturn->SimpleTextOut.Mode->MaxMode = OriginalProtocol->Mode->MaxMode;
|
||||||
ProtocolToReturn->SimpleTextOut.Mode->Mode = OriginalProtocol->Mode->Mode;
|
ProtocolToReturn->SimpleTextOut.Mode->Mode = OriginalProtocol->Mode->Mode;
|
||||||
ProtocolToReturn->SimpleTextOut.Mode->Attribute = OriginalProtocol->Mode->Attribute;
|
ProtocolToReturn->SimpleTextOut.Mode->Attribute = OriginalProtocol->Mode->Attribute;
|
||||||
@ -470,7 +480,8 @@ CreateSimpleTextOutOnFile(
|
|||||||
&(ProtocolToReturn->TheHandle),
|
&(ProtocolToReturn->TheHandle),
|
||||||
&gEfiSimpleTextOutProtocolGuid,
|
&gEfiSimpleTextOutProtocolGuid,
|
||||||
EFI_NATIVE_INTERFACE,
|
EFI_NATIVE_INTERFACE,
|
||||||
&(ProtocolToReturn->SimpleTextOut));
|
&(ProtocolToReturn->SimpleTextOut)
|
||||||
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
*HandleLocation = ProtocolToReturn->TheHandle;
|
*HandleLocation = ProtocolToReturn->TheHandle;
|
||||||
return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)ProtocolToReturn);
|
return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)ProtocolToReturn);
|
||||||
@ -495,13 +506,16 @@ CloseSimpleTextOutOnFile(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if (SimpleTextOut == NULL) {
|
if (SimpleTextOut == NULL) {
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->UninstallProtocolInterface (
|
Status = gBS->UninstallProtocolInterface (
|
||||||
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->TheHandle,
|
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->TheHandle,
|
||||||
&gEfiSimpleTextOutProtocolGuid,
|
&gEfiSimpleTextOutProtocolGuid,
|
||||||
&(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut));
|
&(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->SimpleTextOut)
|
||||||
|
);
|
||||||
FreePool (SimpleTextOut->Mode);
|
FreePool (SimpleTextOut->Mode);
|
||||||
FreePool (SimpleTextOut);
|
FreePool (SimpleTextOut);
|
||||||
return (Status);
|
return (Status);
|
||||||
|
@ -71,4 +71,3 @@ CloseSimpleTextOutOnFile(
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif //_SHELL_CONSOLE_WRAPPERS_HEADER_
|
#endif //_SHELL_CONSOLE_WRAPPERS_HEADER_
|
||||||
|
|
||||||
|
@ -56,4 +56,3 @@ PrintCommandHistory (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif //_FILE_HANDLE_INTERNAL_HEADER_
|
#endif //_FILE_HANDLE_INTERNAL_HEADER_
|
||||||
|
|
||||||
|
@ -157,9 +157,11 @@ FileInterfaceStdOutWrite(
|
|||||||
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
|
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
|
||||||
return (EFI_UNSUPPORTED);
|
return (EFI_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*((CHAR16 *)Buffer) == gUnicodeFileTag) {
|
if (*((CHAR16 *)Buffer) == gUnicodeFileTag) {
|
||||||
return (gST->ConOut->OutputString (gST->ConOut, (CHAR16 *)Buffer + 1));
|
return (gST->ConOut->OutputString (gST->ConOut, (CHAR16 *)Buffer + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (gST->ConOut->OutputString (gST->ConOut, Buffer));
|
return (gST->ConOut->OutputString (gST->ConOut, Buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,6 +345,7 @@ CreateTabCompletionList (
|
|||||||
TabPos = Index + 1;
|
TabPos = Index + 1;
|
||||||
*TabUpdatePos = TabPos;
|
*TabUpdatePos = TabPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L':':
|
case L':':
|
||||||
@ -382,6 +385,7 @@ CreateTabCompletionList (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StrnCatS (TabStr, (BufferSize) / sizeof (CHAR16), InputString + TabPos, StringLen - TabPos);
|
StrnCatS (TabStr, (BufferSize) / sizeof (CHAR16), InputString + TabPos, StringLen - TabPos);
|
||||||
StrnCatS (TabStr, (BufferSize) / sizeof (CHAR16), L"*", (BufferSize) / sizeof (CHAR16) - 1 - StrLen (TabStr));
|
StrnCatS (TabStr, (BufferSize) / sizeof (CHAR16), L"*", (BufferSize) / sizeof (CHAR16) - 1 - StrLen (TabStr));
|
||||||
Status = ShellInfoObject.NewEfiShellProtocol->FindFiles (TabStr, &FileList);
|
Status = ShellInfoObject.NewEfiShellProtocol->FindFiles (TabStr, &FileList);
|
||||||
@ -390,7 +394,7 @@ CreateTabCompletionList (
|
|||||||
// Filter out the non-directory for "CD" command
|
// Filter out the non-directory for "CD" command
|
||||||
// Filter "." and ".." for all
|
// Filter "." and ".." for all
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR (Status) && FileList != NULL) {
|
if (!EFI_ERROR (Status) && (FileList != NULL)) {
|
||||||
//
|
//
|
||||||
// Skip the spaces in the beginning
|
// Skip the spaces in the beginning
|
||||||
//
|
//
|
||||||
@ -400,8 +404,9 @@ CreateTabCompletionList (
|
|||||||
|
|
||||||
for (FileInfo = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link); !IsNull (&FileList->Link, &FileInfo->Link); ) {
|
for (FileInfo = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link); !IsNull (&FileList->Link, &FileInfo->Link); ) {
|
||||||
if (((StrCmp (FileInfo->FileName, L".") == 0) || (StrCmp (FileInfo->FileName, L"..") == 0)) ||
|
if (((StrCmp (FileInfo->FileName, L".") == 0) || (StrCmp (FileInfo->FileName, L"..") == 0)) ||
|
||||||
(((InputString[0] == L'c' || InputString[0] == L'C') && (InputString[1] == L'd' || InputString[1] == L'D')) &&
|
((((InputString[0] == L'c') || (InputString[0] == L'C')) && ((InputString[1] == L'd') || (InputString[1] == L'D'))) &&
|
||||||
(ShellIsDirectory (FileInfo->FullName) != EFI_SUCCESS))) {
|
(ShellIsDirectory (FileInfo->FullName) != EFI_SUCCESS)))
|
||||||
|
{
|
||||||
TempFileInfo = FileInfo;
|
TempFileInfo = FileInfo;
|
||||||
FileInfo = (EFI_SHELL_FILE_INFO *)RemoveEntryList (&FileInfo->Link);
|
FileInfo = (EFI_SHELL_FILE_INFO *)RemoveEntryList (&FileInfo->Link);
|
||||||
InternalFreeShellFileInfoNode (TempFileInfo);
|
InternalFreeShellFileInfoNode (TempFileInfo);
|
||||||
@ -411,7 +416,7 @@ CreateTabCompletionList (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileList != NULL && !IsListEmpty (&FileList->Link)) {
|
if ((FileList != NULL) && !IsListEmpty (&FileList->Link)) {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FileList);
|
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&FileList);
|
||||||
@ -524,6 +529,7 @@ FileInterfaceStdInRead(
|
|||||||
if (MaxStr > *BufferSize / sizeof (CHAR16)) {
|
if (MaxStr > *BufferSize / sizeof (CHAR16)) {
|
||||||
MaxStr = *BufferSize / sizeof (CHAR16);
|
MaxStr = *BufferSize / sizeof (CHAR16);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (CurrentString, MaxStr * sizeof (CHAR16));
|
ZeroMem (CurrentString, MaxStr * sizeof (CHAR16));
|
||||||
do {
|
do {
|
||||||
//
|
//
|
||||||
@ -532,9 +538,9 @@ FileInterfaceStdInRead(
|
|||||||
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
|
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
|
||||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
if (Status == EFI_NOT_READY) {
|
||||||
if (Status == EFI_NOT_READY)
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ZeroMem (CurrentString, MaxStr * sizeof (CHAR16));
|
ZeroMem (CurrentString, MaxStr * sizeof (CHAR16));
|
||||||
StringLen = 0;
|
StringLen = 0;
|
||||||
@ -545,7 +551,7 @@ FileInterfaceStdInRead(
|
|||||||
// Press PageUp or PageDown to scroll the history screen up or down.
|
// Press PageUp or PageDown to scroll the history screen up or down.
|
||||||
// Press any other key to quit scrolling.
|
// Press any other key to quit scrolling.
|
||||||
//
|
//
|
||||||
if (Key.UnicodeChar == 0 && (Key.ScanCode == SCAN_PAGE_UP || Key.ScanCode == SCAN_PAGE_DOWN)) {
|
if ((Key.UnicodeChar == 0) && ((Key.ScanCode == SCAN_PAGE_UP) || (Key.ScanCode == SCAN_PAGE_DOWN))) {
|
||||||
if (Key.ScanCode == SCAN_PAGE_UP) {
|
if (Key.ScanCode == SCAN_PAGE_UP) {
|
||||||
ConsoleLoggerDisplayHistory (FALSE, 0, ShellInfoObject.ConsoleInfo);
|
ConsoleLoggerDisplayHistory (FALSE, 0, ShellInfoObject.ConsoleInfo);
|
||||||
} else if (Key.ScanCode == SCAN_PAGE_DOWN) {
|
} else if (Key.ScanCode == SCAN_PAGE_DOWN) {
|
||||||
@ -563,11 +569,14 @@ FileInterfaceStdInRead(
|
|||||||
//
|
//
|
||||||
// If we are quitting TAB scrolling...
|
// If we are quitting TAB scrolling...
|
||||||
//
|
//
|
||||||
if (InTabScrolling && Key.UnicodeChar != CHAR_TAB) {
|
if (InTabScrolling && (Key.UnicodeChar != CHAR_TAB)) {
|
||||||
if (TabCompleteList != NULL) {
|
if (TabCompleteList != NULL) {
|
||||||
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&TabCompleteList);
|
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&TabCompleteList);
|
||||||
DEBUG_CODE(TabCompleteList = NULL;);
|
DEBUG_CODE (
|
||||||
|
TabCompleteList = NULL;
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
InTabScrolling = FALSE;
|
InTabScrolling = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,6 +607,7 @@ FileInterfaceStdInRead(
|
|||||||
//
|
//
|
||||||
MoveCursorBackward (TotalColumn, &Column, &Row);
|
MoveCursorBackward (TotalColumn, &Column, &Row);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHAR_TAB:
|
case CHAR_TAB:
|
||||||
@ -636,6 +646,7 @@ FileInterfaceStdInRead(
|
|||||||
TabCurrent = (EFI_SHELL_FILE_INFO *)GetNextNode (&TabCompleteList->Link, &TabCurrent->Link);
|
TabCurrent = (EFI_SHELL_FILE_INFO *)GetNextNode (&TabCompleteList->Link, &TabCurrent->Link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -643,9 +654,10 @@ FileInterfaceStdInRead(
|
|||||||
//
|
//
|
||||||
// If we are at the buffer's end, drop the key
|
// If we are at the buffer's end, drop the key
|
||||||
//
|
//
|
||||||
if (StringLen == MaxStr - 1 && (ShellInfoObject.ViewingSettings.InsertMode || StringCurPos == StringLen)) {
|
if ((StringLen == MaxStr - 1) && (ShellInfoObject.ViewingSettings.InsertMode || (StringCurPos == StringLen))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If in insert mode, make space by moving each other character 1
|
// If in insert mode, make space by moving each other character 1
|
||||||
// space higher in the array
|
// space higher in the array
|
||||||
@ -660,6 +672,7 @@ FileInterfaceStdInRead(
|
|||||||
StringCurPos += 1;
|
StringCurPos += 1;
|
||||||
OutputLength = 1;
|
OutputLength = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
@ -673,6 +686,7 @@ FileInterfaceStdInRead(
|
|||||||
Delete = 1;
|
Delete = 1;
|
||||||
CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos));
|
CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_UP:
|
case SCAN_UP:
|
||||||
@ -683,6 +697,7 @@ FileInterfaceStdInRead(
|
|||||||
if (IsNull (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link)) {
|
if (IsNull (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link)) {
|
||||||
NewPos = (BUFFER_LIST *)GetPreviousNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
|
NewPos = (BUFFER_LIST *)GetPreviousNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_DOWN:
|
case SCAN_DOWN:
|
||||||
@ -693,6 +708,7 @@ FileInterfaceStdInRead(
|
|||||||
if (NewPos == (BUFFER_LIST *)(&ShellInfoObject.ViewingSettings.CommandHistory)) {
|
if (NewPos == (BUFFER_LIST *)(&ShellInfoObject.ViewingSettings.CommandHistory)) {
|
||||||
NewPos = (BUFFER_LIST *)GetNextNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
|
NewPos = (BUFFER_LIST *)GetNextNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_LEFT:
|
case SCAN_LEFT:
|
||||||
@ -703,6 +719,7 @@ FileInterfaceStdInRead(
|
|||||||
--StringCurPos;
|
--StringCurPos;
|
||||||
MoveCursorBackward (TotalColumn, &Column, &Row);
|
MoveCursorBackward (TotalColumn, &Column, &Row);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_RIGHT:
|
case SCAN_RIGHT:
|
||||||
@ -713,6 +730,7 @@ FileInterfaceStdInRead(
|
|||||||
++StringCurPos;
|
++StringCurPos;
|
||||||
MoveCursorForward (TotalColumn, TotalRow, &Column, &Row);
|
MoveCursorForward (TotalColumn, TotalRow, &Column, &Row);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_HOME:
|
case SCAN_HOME:
|
||||||
@ -780,8 +798,7 @@ FileInterfaceStdInRead(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InTabScrolling && TabOutputStr != NULL) {
|
if (InTabScrolling && (TabOutputStr != NULL)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Adjust the column and row to the start of TAB-completion string.
|
// Adjust the column and row to the start of TAB-completion string.
|
||||||
//
|
//
|
||||||
@ -801,6 +818,7 @@ FileInterfaceStdInRead(
|
|||||||
CopyMem (TabOutputStr, TabCurrent->FileName, OutputLength * sizeof (CHAR16));
|
CopyMem (TabOutputStr, TabCurrent->FileName, OutputLength * sizeof (CHAR16));
|
||||||
TabOutputStr[OutputLength] = CHAR_NULL;
|
TabOutputStr[OutputLength] = CHAR_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputLength = StrLen (TabOutputStr) < MaxStr - 1 ? StrLen (TabOutputStr) : MaxStr - 1;
|
OutputLength = StrLen (TabOutputStr) < MaxStr - 1 ? StrLen (TabOutputStr) : MaxStr - 1;
|
||||||
CopyMem (CurrentString + TabUpdatePos, TabOutputStr, OutputLength * sizeof (CHAR16));
|
CopyMem (CurrentString + TabUpdatePos, TabOutputStr, OutputLength * sizeof (CHAR16));
|
||||||
CurrentString[TabUpdatePos + OutputLength] = CHAR_NULL;
|
CurrentString[TabUpdatePos + OutputLength] = CHAR_NULL;
|
||||||
@ -841,6 +859,7 @@ FileInterfaceStdInRead(
|
|||||||
Delete = StringLen - OutputLength;
|
Delete = StringLen - OutputLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we need to update the output do so now
|
// If we need to update the output do so now
|
||||||
//
|
//
|
||||||
@ -863,7 +882,7 @@ FileInterfaceStdInRead(
|
|||||||
// BACKSPACE and DELETE, we need to move the cursor position forward,
|
// BACKSPACE and DELETE, we need to move the cursor position forward,
|
||||||
// so adjust row and column here.
|
// so adjust row and column here.
|
||||||
//
|
//
|
||||||
if (Key.UnicodeChar != CHAR_BACKSPACE && !(Key.UnicodeChar == 0 && Key.ScanCode == SCAN_DELETE)) {
|
if ((Key.UnicodeChar != CHAR_BACKSPACE) && !((Key.UnicodeChar == 0) && (Key.ScanCode == SCAN_DELETE))) {
|
||||||
//
|
//
|
||||||
// Calculate row and column of the tail of current string
|
// Calculate row and column of the tail of current string
|
||||||
//
|
//
|
||||||
@ -877,9 +896,10 @@ FileInterfaceStdInRead(
|
|||||||
// (if we are recalling commands using UPPER and DOWN key, and if the
|
// (if we are recalling commands using UPPER and DOWN key, and if the
|
||||||
// old command is too long to fit the screen, TailColumn must be 79.
|
// old command is too long to fit the screen, TailColumn must be 79.
|
||||||
//
|
//
|
||||||
if (TailColumn == 0 && TailRow >= TotalRow && Row != TailRow) {
|
if ((TailColumn == 0) && (TailRow >= TotalRow) && (Row != TailRow)) {
|
||||||
Row--;
|
Row--;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Calculate the cursor position after current operation. If cursor
|
// Calculate the cursor position after current operation. If cursor
|
||||||
// reaches line end, update both row and column, otherwise, only
|
// reaches line end, update both row and column, otherwise, only
|
||||||
@ -901,13 +921,14 @@ FileInterfaceStdInRead(
|
|||||||
|
|
||||||
Delete = 0;
|
Delete = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set the cursor position for this key
|
// Set the cursor position for this key
|
||||||
//
|
//
|
||||||
gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row);
|
gST->ConOut->SetCursorPosition (gST->ConOut, Column, Row);
|
||||||
} while (!Done);
|
} while (!Done);
|
||||||
|
|
||||||
if (CurrentString != NULL && StrLen(CurrentString) > 0) {
|
if ((CurrentString != NULL) && (StrLen (CurrentString) > 0)) {
|
||||||
//
|
//
|
||||||
// add the line to the history buffer
|
// add the line to the history buffer
|
||||||
//
|
//
|
||||||
@ -926,6 +947,7 @@ FileInterfaceStdInRead(
|
|||||||
if (TabCompleteList != NULL) {
|
if (TabCompleteList != NULL) {
|
||||||
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&TabCompleteList);
|
ShellInfoObject.NewEfiShellProtocol->FreeFileList (&TabCompleteList);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (TabCompleteList == NULL);
|
ASSERT (TabCompleteList == NULL);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
@ -990,9 +1012,6 @@ EFI_FILE_PROTOCOL FileInterfaceNulFile = {
|
|||||||
FileInterfaceNopGeneric
|
FileInterfaceNopGeneric
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is identical to EFI_FILE_PROTOCOL except for the additional member
|
// This is identical to EFI_FILE_PROTOCOL except for the additional member
|
||||||
// for the name.
|
// for the name.
|
||||||
@ -1058,15 +1077,16 @@ FileInterfaceEnvClose(
|
|||||||
if (NewBuffer == NULL) {
|
if (NewBuffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
|
Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR(Status) && NewBuffer != NULL) {
|
if (!EFI_ERROR (Status) && (NewBuffer != NULL)) {
|
||||||
|
|
||||||
if (TotalSize / sizeof (CHAR16) >= 3) {
|
if (TotalSize / sizeof (CHAR16) >= 3) {
|
||||||
if ((((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 2] == CHAR_LINEFEED) &&
|
if ((((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 2] == CHAR_LINEFEED) &&
|
||||||
(((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] == CHAR_CARRIAGE_RETURN)
|
(((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] == CHAR_CARRIAGE_RETURN)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] = CHAR_NULL;
|
((CHAR16 *)NewBuffer)[TotalSize / sizeof (CHAR16) - 3] = CHAR_NULL;
|
||||||
//
|
//
|
||||||
// If the NewBuffer end with \r\n\0, We will replace '\r' by '\0' and then update TotalSize.
|
// If the NewBuffer end with \r\n\0, We will replace '\r' by '\0' and then update TotalSize.
|
||||||
@ -1170,6 +1190,7 @@ FileInterfaceEnvRead(
|
|||||||
//
|
//
|
||||||
*BufferSize += sizeof (gUnicodeFileTag);
|
*BufferSize += sizeof (gUnicodeFileTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1219,7 +1240,7 @@ FileInterfaceEnvVolWrite(
|
|||||||
Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
|
Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
|
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
|
||||||
FreePool (NewBuffer);
|
FreePool (NewBuffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -1249,7 +1270,6 @@ FileInterfaceEnvVolWrite(
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
File style interface for Non Volatile Environment Variable (Write).
|
File style interface for Non Volatile Environment Variable (Write).
|
||||||
This function also caches the environment variable into gShellEnvVarList.
|
This function also caches the environment variable into gShellEnvVarList.
|
||||||
@ -1296,7 +1316,7 @@ FileInterfaceEnvNonVolWrite(
|
|||||||
Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
|
Status = SHELL_GET_ENVIRONMENT_VARIABLE (((EFI_FILE_PROTOCOL_ENVIRONMENT *)This)->Name, &NewSize, NewBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {
|
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
|
||||||
FreePool (NewBuffer);
|
FreePool (NewBuffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -1387,6 +1407,7 @@ CreateFileInterfaceEnv(
|
|||||||
} else {
|
} else {
|
||||||
EnvFileInterface->Write = FileInterfaceEnvNonVolWrite;
|
EnvFileInterface->Write = FileInterfaceEnvNonVolWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((EFI_FILE_PROTOCOL *)EnvFileInterface);
|
return ((EFI_FILE_PROTOCOL *)EnvFileInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1413,8 +1434,10 @@ MoveCursorBackward (
|
|||||||
if (*Row > 0) {
|
if (*Row > 0) {
|
||||||
(*Row)--;
|
(*Row)--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*Column)--;
|
(*Column)--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1478,7 +1501,8 @@ PrintCommandHistory (
|
|||||||
for ( Node = (BUFFER_LIST *)GetFirstNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link)
|
for ( Node = (BUFFER_LIST *)GetFirstNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link)
|
||||||
; !IsNull (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
|
; !IsNull (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
|
||||||
; Node = (BUFFER_LIST *)GetNextNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
|
; Node = (BUFFER_LIST *)GetNextNode (&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
Index++;
|
Index++;
|
||||||
LineCount = ((StrLen (Node->Buffer) + StartColumn + 1) / TotalCols) + 1;
|
LineCount = ((StrLen (Node->Buffer) + StartColumn + 1) / TotalCols) + 1;
|
||||||
|
|
||||||
@ -1491,16 +1515,12 @@ PrintCommandHistory (
|
|||||||
);
|
);
|
||||||
LineNumber = 0;
|
LineNumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintEx (-1, -1, L"%2d. %s\n", Index, Node->Buffer);
|
ShellPrintEx (-1, -1, L"%2d. %s\n", Index, Node->Buffer);
|
||||||
LineNumber += LineCount;
|
LineNumber += LineCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is identical to EFI_FILE_PROTOCOL except for the additional members
|
// This is identical to EFI_FILE_PROTOCOL except for the additional members
|
||||||
// for the buffer, size, and position.
|
// for the buffer, size, and position.
|
||||||
@ -1602,9 +1622,11 @@ FileInterfaceMemGetInfo(
|
|||||||
*BufferSize = sizeof (EFI_FILE_INFO);
|
*BufferSize = sizeof (EFI_FILE_INFO);
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileInfo = (EFI_FILE_INFO *)Buffer;
|
FileInfo = (EFI_FILE_INFO *)Buffer;
|
||||||
FileInfo->Size = sizeof (*FileInfo);
|
FileInfo->Size = sizeof (*FileInfo);
|
||||||
ZeroMem (FileInfo, sizeof (*FileInfo));
|
ZeroMem (FileInfo, sizeof (*FileInfo));
|
||||||
@ -1647,8 +1669,10 @@ FileInterfaceMemWrite(
|
|||||||
if (MemFile->Buffer == NULL) {
|
if (MemFile->Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemFile->BufferSize += (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD;
|
MemFile->BufferSize += (*BufferSize) + MEM_WRITE_REALLOC_OVERHEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (((UINT8 *)MemFile->Buffer) + MemFile->Position, Buffer, *BufferSize);
|
CopyMem (((UINT8 *)MemFile->Buffer) + MemFile->Position, Buffer, *BufferSize);
|
||||||
MemFile->Position += (*BufferSize);
|
MemFile->Position += (*BufferSize);
|
||||||
MemFile->FileSize = MemFile->Position;
|
MemFile->FileSize = MemFile->Position;
|
||||||
@ -1661,6 +1685,7 @@ FileInterfaceMemWrite(
|
|||||||
if (AsciiBuffer == NULL) {
|
if (AsciiBuffer == NULL) {
|
||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiSPrint (AsciiBuffer, *BufferSize, "%S", Buffer);
|
AsciiSPrint (AsciiBuffer, *BufferSize, "%S", Buffer);
|
||||||
if ((UINTN)(MemFile->Position + AsciiStrSize (AsciiBuffer)) > (UINTN)(MemFile->BufferSize)) {
|
if ((UINTN)(MemFile->Position + AsciiStrSize (AsciiBuffer)) > (UINTN)(MemFile->BufferSize)) {
|
||||||
MemFile->Buffer = ReallocatePool ((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + AsciiStrSize (AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer);
|
MemFile->Buffer = ReallocatePool ((UINTN)(MemFile->BufferSize), (UINTN)(MemFile->BufferSize) + AsciiStrSize (AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD, MemFile->Buffer);
|
||||||
@ -1668,8 +1693,10 @@ FileInterfaceMemWrite(
|
|||||||
FreePool (AsciiBuffer);
|
FreePool (AsciiBuffer);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemFile->BufferSize += AsciiStrSize (AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD;
|
MemFile->BufferSize += AsciiStrSize (AsciiBuffer) + MEM_WRITE_REALLOC_OVERHEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (((UINT8 *)MemFile->Buffer) + MemFile->Position, AsciiBuffer, AsciiStrSize (AsciiBuffer));
|
CopyMem (((UINT8 *)MemFile->Buffer) + MemFile->Position, AsciiBuffer, AsciiStrSize (AsciiBuffer));
|
||||||
MemFile->Position += (*BufferSize / sizeof (CHAR16));
|
MemFile->Position += (*BufferSize / sizeof (CHAR16));
|
||||||
MemFile->FileSize = MemFile->Position;
|
MemFile->FileSize = MemFile->Position;
|
||||||
@ -1701,6 +1728,7 @@ FileInterfaceMemRead(
|
|||||||
if (*BufferSize > (UINTN)((MemFile->FileSize) - (UINTN)(MemFile->Position))) {
|
if (*BufferSize > (UINTN)((MemFile->FileSize) - (UINTN)(MemFile->Position))) {
|
||||||
(*BufferSize) = (UINTN)((MemFile->FileSize) - (UINTN)(MemFile->Position));
|
(*BufferSize) = (UINTN)((MemFile->FileSize) - (UINTN)(MemFile->Position));
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Buffer, ((UINT8 *)MemFile->Buffer) + MemFile->Position, (*BufferSize));
|
CopyMem (Buffer, ((UINT8 *)MemFile->Buffer) + MemFile->Position, (*BufferSize));
|
||||||
MemFile->Position = MemFile->Position + (*BufferSize);
|
MemFile->Position = MemFile->Position + (*BufferSize);
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
@ -1776,6 +1804,7 @@ CreateFileInterfaceMem(
|
|||||||
FreePool (FileInterface);
|
FreePool (FileInterface);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*((CHAR16 *)(FileInterface->Buffer)) = EFI_UNICODE_BYTE_ORDER_MARK;
|
*((CHAR16 *)(FileInterface->Buffer)) = EFI_UNICODE_BYTE_ORDER_MARK;
|
||||||
FileInterface->BufferSize = 2;
|
FileInterface->BufferSize = 2;
|
||||||
FileInterface->Position = 2;
|
FileInterface->Position = 2;
|
||||||
@ -1950,6 +1979,7 @@ FileInterfaceFileRead(
|
|||||||
CHAR8 *AsciiStrBuffer;
|
CHAR8 *AsciiStrBuffer;
|
||||||
CHAR16 *UscStrBuffer;
|
CHAR16 *UscStrBuffer;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
if (((EFI_FILE_PROTOCOL_FILE *)This)->Unicode) {
|
if (((EFI_FILE_PROTOCOL_FILE *)This)->Unicode) {
|
||||||
//
|
//
|
||||||
// Unicode
|
// Unicode
|
||||||
@ -1965,10 +1995,12 @@ FileInterfaceFileRead(
|
|||||||
if (*BufferSize == 0) {
|
if (*BufferSize == 0) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->GetPosition (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, &Position);
|
Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->GetPosition (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, &Position);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Position == 0) {
|
if (Position == 0) {
|
||||||
//
|
//
|
||||||
// First two bytes in Buffer is for the Unicode file tag.
|
// First two bytes in Buffer is for the Unicode file tag.
|
||||||
@ -1979,21 +2011,25 @@ FileInterfaceFileRead(
|
|||||||
} else {
|
} else {
|
||||||
Size = *BufferSize / sizeof (CHAR16);
|
Size = *BufferSize / sizeof (CHAR16);
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrBuffer = AllocateZeroPool (Size + 1);
|
AsciiStrBuffer = AllocateZeroPool (Size + 1);
|
||||||
if (AsciiStrBuffer == NULL) {
|
if (AsciiStrBuffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
UscStrBuffer = AllocateZeroPool ((Size + 1) * sizeof (CHAR16));
|
UscStrBuffer = AllocateZeroPool ((Size + 1) * sizeof (CHAR16));
|
||||||
if (UscStrBuffer == NULL) {
|
if (UscStrBuffer == NULL) {
|
||||||
SHELL_FREE_NON_NULL (AsciiStrBuffer);
|
SHELL_FREE_NON_NULL (AsciiStrBuffer);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Read (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, &Size, AsciiStrBuffer);
|
Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Read (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, &Size, AsciiStrBuffer);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
AsciiStrToUnicodeStrS (AsciiStrBuffer, UscStrBuffer, Size + 1);
|
AsciiStrToUnicodeStrS (AsciiStrBuffer, UscStrBuffer, Size + 1);
|
||||||
*BufferSize = Size * sizeof (CHAR16);
|
*BufferSize = Size * sizeof (CHAR16);
|
||||||
CopyMem (Buffer, UscStrBuffer, *BufferSize);
|
CopyMem (Buffer, UscStrBuffer, *BufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (AsciiStrBuffer);
|
SHELL_FREE_NON_NULL (AsciiStrBuffer);
|
||||||
SHELL_FREE_NON_NULL (UscStrBuffer);
|
SHELL_FREE_NON_NULL (UscStrBuffer);
|
||||||
return Status;
|
return Status;
|
||||||
@ -2048,6 +2084,7 @@ FileInterfaceFileDelete(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Delete (((EFI_FILE_PROTOCOL_FILE *)This)->Orig);
|
Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Delete (((EFI_FILE_PROTOCOL_FILE *)This)->Orig);
|
||||||
FreePool (This);
|
FreePool (This);
|
||||||
return (Status);
|
return (Status);
|
||||||
@ -2067,6 +2104,7 @@ FileInterfaceFileClose(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Close (((EFI_FILE_PROTOCOL_FILE *)This)->Orig);
|
Status = ((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Close (((EFI_FILE_PROTOCOL_FILE *)This)->Orig);
|
||||||
FreePool (This);
|
FreePool (This);
|
||||||
return (Status);
|
return (Status);
|
||||||
@ -2095,6 +2133,7 @@ FileInterfaceFileWrite(
|
|||||||
CHAR8 *AsciiBuffer;
|
CHAR8 *AsciiBuffer;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if (((EFI_FILE_PROTOCOL_FILE *)This)->Unicode) {
|
if (((EFI_FILE_PROTOCOL_FILE *)This)->Unicode) {
|
||||||
//
|
//
|
||||||
// Unicode
|
// Unicode
|
||||||
@ -2136,6 +2175,7 @@ CreateFileInterfaceFile(
|
|||||||
if (NewOne == NULL) {
|
if (NewOne == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (NewOne, Template, sizeof (EFI_FILE_PROTOCOL_FILE));
|
CopyMem (NewOne, Template, sizeof (EFI_FILE_PROTOCOL_FILE));
|
||||||
NewOne->Orig = (EFI_FILE_PROTOCOL *)Template;
|
NewOne->Orig = (EFI_FILE_PROTOCOL *)Template;
|
||||||
NewOne->Unicode = Unicode;
|
NewOne->Unicode = Unicode;
|
||||||
|
@ -84,4 +84,3 @@ CreateFileInterfaceFile(
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif //_SHELL_FILE_HANDLE_WRAPPERS_HEADER_
|
#endif //_SHELL_FILE_HANDLE_WRAPPERS_HEADER_
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -303,7 +303,6 @@ RunShellCommand(
|
|||||||
OUT EFI_STATUS *CommandStatus
|
OUT EFI_STATUS *CommandStatus
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function to process a NSH script file via SHELL_FILE_HANDLE.
|
Function to process a NSH script file via SHELL_FILE_HANDLE.
|
||||||
|
|
||||||
@ -384,7 +383,4 @@ RestoreBufferList (
|
|||||||
IN OUT LIST_ENTRY *OldBufferList
|
IN OUT LIST_ENTRY *OldBufferList
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //_SHELL_INTERNAL_HEADER_
|
#endif //_SHELL_INTERNAL_HEADER_
|
||||||
|
|
||||||
|
@ -44,23 +44,29 @@ IsVolatileEnv (
|
|||||||
//
|
//
|
||||||
// get the variable
|
// get the variable
|
||||||
//
|
//
|
||||||
Status = gRT->GetVariable((CHAR16*)EnvVarName,
|
Status = gRT->GetVariable (
|
||||||
|
(CHAR16 *)EnvVarName,
|
||||||
&gShellVariableGuid,
|
&gShellVariableGuid,
|
||||||
&Attribs,
|
&Attribs,
|
||||||
&Size,
|
&Size,
|
||||||
Buffer);
|
Buffer
|
||||||
|
);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
Buffer = AllocateZeroPool (Size);
|
Buffer = AllocateZeroPool (Size);
|
||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
Status = gRT->GetVariable((CHAR16*)EnvVarName,
|
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
(CHAR16 *)EnvVarName,
|
||||||
&gShellVariableGuid,
|
&gShellVariableGuid,
|
||||||
&Attribs,
|
&Attribs,
|
||||||
&Size,
|
&Size,
|
||||||
Buffer);
|
Buffer
|
||||||
|
);
|
||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// not found means volatile
|
// not found means volatile
|
||||||
//
|
//
|
||||||
@ -68,6 +74,7 @@ IsVolatileEnv (
|
|||||||
*Volatile = TRUE;
|
*Volatile = TRUE;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -99,15 +106,18 @@ FreeEnvironmentVariableList(
|
|||||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (List)
|
for ( Node = (ENV_VAR_LIST *)GetFirstNode (List)
|
||||||
; !IsListEmpty (List)
|
; !IsListEmpty (List)
|
||||||
; Node = (ENV_VAR_LIST *)GetFirstNode (List)
|
; Node = (ENV_VAR_LIST *)GetFirstNode (List)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ASSERT (Node != NULL);
|
ASSERT (Node != NULL);
|
||||||
RemoveEntryList (&Node->Link);
|
RemoveEntryList (&Node->Link);
|
||||||
if (Node->Key != NULL) {
|
if (Node->Key != NULL) {
|
||||||
FreePool (Node->Key);
|
FreePool (Node->Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Node->Val != NULL) {
|
if (Node->Val != NULL) {
|
||||||
FreePool (Node->Val);
|
FreePool (Node->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Node);
|
FreePool (Node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,6 +156,7 @@ GetEnvironmentVariableList(
|
|||||||
if (VariableName == NULL) {
|
if (VariableName == NULL) {
|
||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
*VariableName = CHAR_NULL;
|
*VariableName = CHAR_NULL;
|
||||||
|
|
||||||
while (!EFI_ERROR (Status)) {
|
while (!EFI_ERROR (Status)) {
|
||||||
@ -162,6 +173,7 @@ GetEnvironmentVariableList(
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
NameSize = NameBufferSize;
|
NameSize = NameBufferSize;
|
||||||
Status = gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
|
Status = gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
|
||||||
}
|
}
|
||||||
@ -181,6 +193,7 @@ GetEnvironmentVariableList(
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (VariableName, &VarList->Atts, &ValSize, VarList->Val);
|
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (VariableName, &VarList->Atts, &ValSize, VarList->Val);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
ValBufferSize = ValSize > ValBufferSize * 2 ? ValSize : ValBufferSize * 2;
|
ValBufferSize = ValSize > ValBufferSize * 2 ? ValSize : ValBufferSize * 2;
|
||||||
@ -198,6 +211,7 @@ GetEnvironmentVariableList(
|
|||||||
ValSize = ValBufferSize;
|
ValSize = ValBufferSize;
|
||||||
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (VariableName, &VarList->Atts, &ValSize, VarList->Val);
|
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (VariableName, &VarList->Atts, &ValSize, VarList->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
VarList->Key = AllocateCopyPool (StrSize (VariableName), VariableName);
|
VarList->Key = AllocateCopyPool (StrSize (VariableName), VariableName);
|
||||||
if (VarList->Key == NULL) {
|
if (VarList->Key == NULL) {
|
||||||
@ -214,6 +228,7 @@ GetEnvironmentVariableList(
|
|||||||
} // if (VarList == NULL) ... else ...
|
} // if (VarList == NULL) ... else ...
|
||||||
} // compare guid
|
} // compare guid
|
||||||
} // while
|
} // while
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (VariableName);
|
SHELL_FREE_NON_NULL (VariableName);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -256,10 +271,12 @@ SetEnvironmentVariableList(
|
|||||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&VarList.Link)
|
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&VarList.Link)
|
||||||
; !IsNull (&VarList.Link, &Node->Link)
|
; !IsNull (&VarList.Link, &Node->Link)
|
||||||
; Node = (ENV_VAR_LIST *)GetNextNode (&VarList.Link, &Node->Link)
|
; Node = (ENV_VAR_LIST *)GetNextNode (&VarList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
if (Node->Key != NULL) {
|
if (Node->Key != NULL) {
|
||||||
Status = SHELL_DELETE_ENVIRONMENT_VARIABLE (Node->Key);
|
Status = SHELL_DELETE_ENVIRONMENT_VARIABLE (Node->Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,15 +288,18 @@ SetEnvironmentVariableList(
|
|||||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (ListHead)
|
for ( Node = (ENV_VAR_LIST *)GetFirstNode (ListHead)
|
||||||
; !IsNull (ListHead, &Node->Link)
|
; !IsNull (ListHead, &Node->Link)
|
||||||
; Node = (ENV_VAR_LIST *)GetNextNode (ListHead, &Node->Link)
|
; Node = (ENV_VAR_LIST *)GetNextNode (ListHead, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
Size = StrSize (Node->Val) - sizeof (CHAR16);
|
Size = StrSize (Node->Val) - sizeof (CHAR16);
|
||||||
if (Node->Atts & EFI_VARIABLE_NON_VOLATILE) {
|
if (Node->Atts & EFI_VARIABLE_NON_VOLATILE) {
|
||||||
Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV (Node->Key, Size, Node->Val);
|
Status = SHELL_SET_ENVIRONMENT_VARIABLE_NV (Node->Key, Size, Node->Val);
|
||||||
} else {
|
} else {
|
||||||
Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (Node->Key, Size, Node->Val);
|
Status = SHELL_SET_ENVIRONMENT_VARIABLE_V (Node->Key, Size, Node->Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeEnvironmentVariableList (ListHead);
|
FreeEnvironmentVariableList (ListHead);
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
@ -320,11 +340,13 @@ SetEnvironmentVariables(
|
|||||||
for ( CurrentCount = 0
|
for ( CurrentCount = 0
|
||||||
;
|
;
|
||||||
; CurrentCount++
|
; CurrentCount++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
CurrentString = Environment[CurrentCount];
|
CurrentString = Environment[CurrentCount];
|
||||||
if (CurrentString == NULL) {
|
if (CurrentString == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (StrStr (CurrentString, L"=") != NULL);
|
ASSERT (StrStr (CurrentString, L"=") != NULL);
|
||||||
Node = AllocateZeroPool (sizeof (ENV_VAR_LIST));
|
Node = AllocateZeroPool (sizeof (ENV_VAR_LIST));
|
||||||
if (Node == NULL) {
|
if (Node == NULL) {
|
||||||
@ -342,7 +364,8 @@ SetEnvironmentVariables(
|
|||||||
//
|
//
|
||||||
// Copy the string into the Key, leaving the last character allocated as NULL to terminate
|
// Copy the string into the Key, leaving the last character allocated as NULL to terminate
|
||||||
//
|
//
|
||||||
StrnCpyS( Node->Key,
|
StrnCpyS (
|
||||||
|
Node->Key,
|
||||||
StrStr (CurrentString, L"=") - CurrentString + 1,
|
StrStr (CurrentString, L"=") - CurrentString + 1,
|
||||||
CurrentString,
|
CurrentString,
|
||||||
StrStr (CurrentString, L"=") - CurrentString
|
StrStr (CurrentString, L"=") - CurrentString
|
||||||
@ -369,10 +392,11 @@ SetEnvironmentVariables(
|
|||||||
SHELL_FREE_NON_NULL (Node);
|
SHELL_FREE_NON_NULL (Node);
|
||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeListHead (&VarList->Link);
|
InitializeListHead (&VarList->Link);
|
||||||
}
|
}
|
||||||
InsertTailList(&VarList->Link, &Node->Link);
|
|
||||||
|
|
||||||
|
InsertTailList (&VarList->Link, &Node->Link);
|
||||||
} // for loop
|
} // for loop
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -408,20 +432,22 @@ ShellFindEnvVarInList (
|
|||||||
{
|
{
|
||||||
ENV_VAR_LIST *Node;
|
ENV_VAR_LIST *Node;
|
||||||
|
|
||||||
if (Key == NULL || Value == NULL || ValueSize == NULL) {
|
if ((Key == NULL) || (Value == NULL) || (ValueSize == NULL)) {
|
||||||
return SHELL_INVALID_PARAMETER;
|
return SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
||||||
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
||||||
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
|
{
|
||||||
|
if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
|
||||||
*Value = AllocateCopyPool (StrSize (Node->Val), Node->Val);
|
*Value = AllocateCopyPool (StrSize (Node->Val), Node->Val);
|
||||||
*ValueSize = StrSize (Node->Val);
|
*ValueSize = StrSize (Node->Val);
|
||||||
if (Atts != NULL) {
|
if (Atts != NULL) {
|
||||||
*Atts = Node->Atts;
|
*Atts = Node->Atts;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -454,7 +480,7 @@ ShellAddEnvVarToList (
|
|||||||
CHAR16 *LocalKey;
|
CHAR16 *LocalKey;
|
||||||
CHAR16 *LocalValue;
|
CHAR16 *LocalValue;
|
||||||
|
|
||||||
if (Key == NULL || Value == NULL || ValueSize == 0) {
|
if ((Key == NULL) || (Value == NULL) || (ValueSize == 0)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,8 +495,9 @@ ShellAddEnvVarToList (
|
|||||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
||||||
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
||||||
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
|
{
|
||||||
|
if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
|
||||||
Node->Atts = Atts;
|
Node->Atts = Atts;
|
||||||
SHELL_FREE_NON_NULL (Node->Val);
|
SHELL_FREE_NON_NULL (Node->Val);
|
||||||
Node->Val = LocalValue;
|
Node->Val = LocalValue;
|
||||||
@ -487,12 +514,14 @@ ShellAddEnvVarToList (
|
|||||||
FreePool (LocalValue);
|
FreePool (LocalValue);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node = (ENV_VAR_LIST *)AllocateZeroPool (sizeof (ENV_VAR_LIST));
|
Node = (ENV_VAR_LIST *)AllocateZeroPool (sizeof (ENV_VAR_LIST));
|
||||||
if (Node == NULL) {
|
if (Node == NULL) {
|
||||||
FreePool (LocalKey);
|
FreePool (LocalKey);
|
||||||
FreePool (LocalValue);
|
FreePool (LocalValue);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Key = LocalKey;
|
Node->Key = LocalKey;
|
||||||
Node->Val = LocalValue;
|
Node->Val = LocalValue;
|
||||||
Node->Atts = Atts;
|
Node->Atts = Atts;
|
||||||
@ -524,8 +553,9 @@ ShellRemvoeEnvVarFromList (
|
|||||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
||||||
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
||||||
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
|
{
|
||||||
|
if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
|
||||||
SHELL_FREE_NON_NULL (Node->Key);
|
SHELL_FREE_NON_NULL (Node->Key);
|
||||||
SHELL_FREE_NON_NULL (Node->Val);
|
SHELL_FREE_NON_NULL (Node->Val);
|
||||||
RemoveEntryList (&Node->Link);
|
RemoveEntryList (&Node->Link);
|
||||||
@ -569,4 +599,3 @@ ShellFreeEnvVarList (
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
extern ENV_VAR_LIST gShellEnvVarList;
|
extern ENV_VAR_LIST gShellEnvVarList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reports whether an environment variable is Volatile or Non-Volatile.
|
Reports whether an environment variable is Volatile or Non-Volatile.
|
||||||
|
|
||||||
@ -279,4 +278,3 @@ ShellFreeEnvVarList (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_
|
#endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
EFI_HII_HANDLE mShellManHiiHandle = NULL;
|
EFI_HII_HANDLE mShellManHiiHandle = NULL;
|
||||||
EFI_HANDLE mShellManDriverHandle = NULL;
|
EFI_HANDLE mShellManDriverHandle = NULL;
|
||||||
|
|
||||||
|
|
||||||
SHELL_MAN_HII_VENDOR_DEVICE_PATH mShellManHiiDevicePath = {
|
SHELL_MAN_HII_VENDOR_DEVICE_PATH mShellManHiiDevicePath = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -57,6 +56,7 @@ GetExecuatableFileName (
|
|||||||
{
|
{
|
||||||
CHAR16 *Buffer;
|
CHAR16 *Buffer;
|
||||||
CHAR16 *SuffixStr;
|
CHAR16 *SuffixStr;
|
||||||
|
|
||||||
if (NameString == NULL) {
|
if (NameString == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -75,20 +75,22 @@ GetExecuatableFileName (
|
|||||||
} else {
|
} else {
|
||||||
Buffer = AllocateZeroPool (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16));
|
Buffer = AllocateZeroPool (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16));
|
||||||
if (Buffer != NULL) {
|
if (Buffer != NULL) {
|
||||||
StrnCpyS( Buffer,
|
StrnCpyS (
|
||||||
|
Buffer,
|
||||||
(StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
|
(StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
|
||||||
NameString,
|
NameString,
|
||||||
StrLen (NameString)
|
StrLen (NameString)
|
||||||
);
|
);
|
||||||
StrnCatS( Buffer,
|
StrnCatS (
|
||||||
|
Buffer,
|
||||||
(StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
|
(StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
|
||||||
L".efi",
|
L".efi",
|
||||||
StrLen (L".efi")
|
StrLen (L".efi")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (Buffer);
|
|
||||||
|
|
||||||
|
return (Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,9 +110,11 @@ GetManFileName(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 *Buffer;
|
CHAR16 *Buffer;
|
||||||
|
|
||||||
if (ManFileName == NULL) {
|
if (ManFileName == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fix the file name
|
// Fix the file name
|
||||||
//
|
//
|
||||||
@ -119,18 +123,21 @@ GetManFileName(
|
|||||||
} else {
|
} else {
|
||||||
Buffer = AllocateZeroPool (StrSize (ManFileName) + 4*sizeof (CHAR16));
|
Buffer = AllocateZeroPool (StrSize (ManFileName) + 4*sizeof (CHAR16));
|
||||||
if (Buffer != NULL) {
|
if (Buffer != NULL) {
|
||||||
StrnCpyS( Buffer,
|
StrnCpyS (
|
||||||
|
Buffer,
|
||||||
(StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
|
(StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
|
||||||
ManFileName,
|
ManFileName,
|
||||||
StrLen (ManFileName)
|
StrLen (ManFileName)
|
||||||
);
|
);
|
||||||
StrnCatS( Buffer,
|
StrnCatS (
|
||||||
|
Buffer,
|
||||||
(StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
|
(StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
|
||||||
L".man",
|
L".man",
|
||||||
4
|
4
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Buffer);
|
return (Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,10 +164,11 @@ SearchPathForFile(
|
|||||||
CHAR16 *FullFileName;
|
CHAR16 *FullFileName;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if ( FileName == NULL
|
if ( (FileName == NULL)
|
||||||
|| Handle == NULL
|
|| (Handle == NULL)
|
||||||
|| StrLen(FileName) == 0
|
|| (StrLen (FileName) == 0)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,10 +221,11 @@ ManFileFindSections(
|
|||||||
UINTN SectionLen;
|
UINTN SectionLen;
|
||||||
BOOLEAN Found;
|
BOOLEAN Found;
|
||||||
|
|
||||||
if ( Handle == NULL
|
if ( (Handle == NULL)
|
||||||
|| HelpText == NULL
|
|| (HelpText == NULL)
|
||||||
|| HelpSize == NULL
|
|| (HelpSize == NULL)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,12 +247,14 @@ ManFileFindSections(
|
|||||||
//
|
//
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ignore too small of buffer...
|
// ignore too small of buffer...
|
||||||
//
|
//
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
break;
|
break;
|
||||||
} else if (StrnCmp (ReadLine, L".TH", 3) == 0) {
|
} else if (StrnCmp (ReadLine, L".TH", 3) == 0) {
|
||||||
@ -256,24 +267,30 @@ ManFileFindSections(
|
|||||||
CurrentlyReading = TRUE;
|
CurrentlyReading = TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// we found a section
|
// we found a section
|
||||||
//
|
//
|
||||||
if (CurrentlyReading) {
|
if (CurrentlyReading) {
|
||||||
CurrentlyReading = FALSE;
|
CurrentlyReading = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// is this a section we want to read in?
|
// is this a section we want to read in?
|
||||||
//
|
//
|
||||||
for ( SectionName = ReadLine + 3
|
for ( SectionName = ReadLine + 3
|
||||||
; *SectionName == L' '
|
; *SectionName == L' '
|
||||||
; SectionName++);
|
; SectionName++)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
SectionLen = StrLen (SectionName);
|
SectionLen = StrLen (SectionName);
|
||||||
SectionName = StrStr (Sections, SectionName);
|
SectionName = StrStr (Sections, SectionName);
|
||||||
if (SectionName == NULL) {
|
if (SectionName == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (*(SectionName + SectionLen) == CHAR_NULL || *(SectionName + SectionLen) == L',') {
|
|
||||||
|
if ((*(SectionName + SectionLen) == CHAR_NULL) || (*(SectionName + SectionLen) == L',')) {
|
||||||
CurrentlyReading = TRUE;
|
CurrentlyReading = TRUE;
|
||||||
}
|
}
|
||||||
} else if (CurrentlyReading) {
|
} else if (CurrentlyReading) {
|
||||||
@ -286,10 +303,12 @@ ManFileFindSections(
|
|||||||
StrnCatGrow (HelpText, HelpSize, L"\r\n", 0);
|
StrnCatGrow (HelpText, HelpSize, L"\r\n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (ReadLine);
|
FreePool (ReadLine);
|
||||||
if (!Found && !EFI_ERROR (Status)) {
|
if (!Found && !EFI_ERROR (Status)) {
|
||||||
return (EFI_NOT_FOUND);
|
return (EFI_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,28 +359,25 @@ IsTitleHeader(
|
|||||||
State = LookForThMacro;
|
State = LookForThMacro;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (*Line == L'\0') {
|
if (*Line == L'\0') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (State) {
|
switch (State) {
|
||||||
|
|
||||||
// Handle "^\s*.TH\s"
|
// Handle "^\s*.TH\s"
|
||||||
// Go to state LookForCommandName if the title header macro is present; otherwise,
|
// Go to state LookForCommandName if the title header macro is present; otherwise,
|
||||||
// eat white space. If we see something other than white space, this is not a
|
// eat white space. If we see something other than white space, this is not a
|
||||||
// title header line.
|
// title header line.
|
||||||
case LookForThMacro:
|
case LookForThMacro:
|
||||||
if (StrnCmp (L".TH ", Line, 4) == 0 || StrnCmp (L".TH\t", Line, 4) == 0) {
|
if ((StrnCmp (L".TH ", Line, 4) == 0) || (StrnCmp (L".TH\t", Line, 4) == 0)) {
|
||||||
Line += 4;
|
Line += 4;
|
||||||
State = LookForCommandName;
|
State = LookForCommandName;
|
||||||
}
|
} else if ((*Line == L' ') || (*Line == L'\t')) {
|
||||||
else if (*Line == L' ' || *Line == L'\t') {
|
|
||||||
Line++;
|
Line++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
State = Final;
|
State = Final;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Handle "\s*"
|
// Handle "\s*"
|
||||||
@ -369,15 +385,15 @@ IsTitleHeader(
|
|||||||
// at least one white space character). Go to state CompareCommands when a
|
// at least one white space character). Go to state CompareCommands when a
|
||||||
// non-white space is seen.
|
// non-white space is seen.
|
||||||
case LookForCommandName:
|
case LookForCommandName:
|
||||||
if (*Line == L' ' || *Line == L'\t') {
|
if ((*Line == L' ') || (*Line == L'\t')) {
|
||||||
Line++;
|
Line++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ReturnValue = TRUE; // This is *some* command's title header line.
|
ReturnValue = TRUE; // This is *some* command's title header line.
|
||||||
State = CompareCommands;
|
State = CompareCommands;
|
||||||
// Do not increment Line; it points to the first character of the command
|
// Do not increment Line; it points to the first character of the command
|
||||||
// name on the title header line.
|
// name on the title header line.
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Handle "(\S)\s"
|
// Handle "(\S)\s"
|
||||||
@ -385,13 +401,13 @@ IsTitleHeader(
|
|||||||
// reach the end of the command (i.e. we see white space), the next state
|
// reach the end of the command (i.e. we see white space), the next state
|
||||||
// depends on whether the caller wants a copy of the Brief Description.
|
// depends on whether the caller wants a copy of the Brief Description.
|
||||||
case CompareCommands:
|
case CompareCommands:
|
||||||
if (*Line == L' ' || *Line == L'\t') {
|
if ((*Line == L' ') || (*Line == L'\t')) {
|
||||||
ReturnFound = TRUE; // This is the desired command's title header line.
|
ReturnFound = TRUE; // This is the desired command's title header line.
|
||||||
State = (BriefDesc == NULL) ? Final : GetBriefDescription;
|
State = (BriefDesc == NULL) ? Final : GetBriefDescription;
|
||||||
}
|
} else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {
|
||||||
else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {
|
|
||||||
State = Final;
|
State = Final;
|
||||||
}
|
}
|
||||||
|
|
||||||
Line++;
|
Line++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -399,21 +415,22 @@ IsTitleHeader(
|
|||||||
// Skip whitespace, '0', and '1' characters, if any, prior to the brief description.
|
// Skip whitespace, '0', and '1' characters, if any, prior to the brief description.
|
||||||
// Return the description to the caller.
|
// Return the description to the caller.
|
||||||
case GetBriefDescription:
|
case GetBriefDescription:
|
||||||
if (*Line != L' ' && *Line != L'\t' && *Line != L'0' && *Line != L'1') {
|
if ((*Line != L' ') && (*Line != L'\t') && (*Line != L'0') && (*Line != L'1')) {
|
||||||
*BriefSize = StrSize (Line);
|
*BriefSize = StrSize (Line);
|
||||||
*BriefDesc = AllocateZeroPool (*BriefSize);
|
*BriefDesc = AllocateZeroPool (*BriefSize);
|
||||||
if (*BriefDesc != NULL) {
|
if (*BriefDesc != NULL) {
|
||||||
StrCpyS (*BriefDesc, (*BriefSize)/sizeof (CHAR16), Line);
|
StrCpyS (*BriefDesc, (*BriefSize)/sizeof (CHAR16), Line);
|
||||||
}
|
}
|
||||||
|
|
||||||
State = Final;
|
State = Final;
|
||||||
}
|
}
|
||||||
|
|
||||||
Line++;
|
Line++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (State < Final);
|
} while (State < Final);
|
||||||
|
|
||||||
*Found = ReturnFound;
|
*Found = ReturnFound;
|
||||||
@ -455,10 +472,11 @@ ManFileFindTitleSection(
|
|||||||
BOOLEAN Found;
|
BOOLEAN Found;
|
||||||
UINTN Start;
|
UINTN Start;
|
||||||
|
|
||||||
if ( Handle == NULL
|
if ( (Handle == NULL)
|
||||||
|| Command == NULL
|
|| (Command == NULL)
|
||||||
|| (BriefDesc != NULL && BriefSize == NULL)
|
|| ((BriefDesc != NULL) && (BriefSize == NULL))
|
||||||
){
|
)
|
||||||
|
{
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +496,8 @@ ManFileFindTitleSection(
|
|||||||
while ( (Start != 0)
|
while ( (Start != 0)
|
||||||
&& (*(Command + Start - 1) != L'\\')
|
&& (*(Command + Start - 1) != L'\\')
|
||||||
&& (*(Command + Start - 1) != L'/')
|
&& (*(Command + Start - 1) != L'/')
|
||||||
&& (*(Command + Start - 1) != L':')) {
|
&& (*(Command + Start - 1) != L':'))
|
||||||
|
{
|
||||||
--Start;
|
--Start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +506,7 @@ ManFileFindTitleSection(
|
|||||||
//
|
//
|
||||||
// ignore too small of buffer...
|
// ignore too small of buffer...
|
||||||
//
|
//
|
||||||
if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {
|
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,10 +574,11 @@ ProcessManFile(
|
|||||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
||||||
|
|
||||||
if ( ManFileName == NULL
|
if ( (ManFileName == NULL)
|
||||||
|| Command == NULL
|
|| (Command == NULL)
|
||||||
|| HelpText == NULL
|
|| (HelpText == NULL)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,9 +606,10 @@ ProcessManFile(
|
|||||||
HelpSize = 0;
|
HelpSize = 0;
|
||||||
BriefSize = 0;
|
BriefSize = 0;
|
||||||
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||||
if (!EFI_ERROR(Status) && HelpText != NULL){
|
if (!EFI_ERROR (Status) && (HelpText != NULL)) {
|
||||||
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellCloseFile (&FileHandle);
|
ShellCloseFile (&FileHandle);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
@ -613,9 +634,10 @@ ProcessManFile(
|
|||||||
HelpSize = 0;
|
HelpSize = 0;
|
||||||
BriefSize = 0;
|
BriefSize = 0;
|
||||||
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||||
if (!EFI_ERROR(Status) && HelpText != NULL){
|
if (!EFI_ERROR (Status) && (HelpText != NULL)) {
|
||||||
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellInfoObject.NewEfiShellProtocol->CloseFile (FileHandle);
|
ShellInfoObject.NewEfiShellProtocol->CloseFile (FileHandle);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
@ -633,6 +655,7 @@ ProcessManFile(
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the file in CWD then use the file name, else use the full
|
// If the file in CWD then use the file name, else use the full
|
||||||
// path name.
|
// path name.
|
||||||
@ -642,6 +665,7 @@ ProcessManFile(
|
|||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath (CmdFilePathName);
|
DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath (CmdFilePathName);
|
||||||
Status = gBS->LoadImage (FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);
|
Status = gBS->LoadImage (FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -654,9 +678,11 @@ ProcessManFile(
|
|||||||
if (Status == EFI_SECURITY_VIOLATION) {
|
if (Status == EFI_SECURITY_VIOLATION) {
|
||||||
gBS->UnloadImage (CmdFileImgHandle);
|
gBS->UnloadImage (CmdFileImgHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
*HelpText = NULL;
|
*HelpText = NULL;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
CmdFileImgHandle,
|
CmdFileImgHandle,
|
||||||
&gEfiHiiPackageListProtocolGuid,
|
&gEfiHiiPackageListProtocolGuid,
|
||||||
@ -699,11 +725,13 @@ ProcessManFile(
|
|||||||
if (BriefDesc != NULL) {
|
if (BriefDesc != NULL) {
|
||||||
SHELL_FREE_NON_NULL (*BriefDesc);
|
SHELL_FREE_NON_NULL (*BriefDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
TempString = HiiGetString (mShellManHiiHandle, (EFI_STRING_ID)StringIdWalker, NULL);
|
TempString = HiiGetString (mShellManHiiHandle, (EFI_STRING_ID)StringIdWalker, NULL);
|
||||||
if (TempString == NULL) {
|
if (TempString == NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);
|
FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);
|
||||||
HelpSize = StrLen (TempString) * sizeof (CHAR16);
|
HelpSize = StrLen (TempString) * sizeof (CHAR16);
|
||||||
ShellWriteFile (FileHandle, &HelpSize, TempString);
|
ShellWriteFile (FileHandle, &HelpSize, TempString);
|
||||||
@ -711,9 +739,10 @@ ProcessManFile(
|
|||||||
HelpSize = 0;
|
HelpSize = 0;
|
||||||
BriefSize = 0;
|
BriefSize = 0;
|
||||||
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||||
if (!EFI_ERROR(Status) && HelpText != NULL){
|
if (!EFI_ERROR (Status) && (HelpText != NULL)) {
|
||||||
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellCloseFile (&FileHandle);
|
ShellCloseFile (&FileHandle);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
@ -724,7 +753,6 @@ ProcessManFile(
|
|||||||
|
|
||||||
StringIdWalker += 1;
|
StringIdWalker += 1;
|
||||||
} while (StringIdWalker < 0xFFFF && TempString != NULL);
|
} while (StringIdWalker < 0xFFFF && TempString != NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
@ -754,4 +782,3 @@ Done:
|
|||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,4 +75,3 @@ ManFileFindSections(
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif //_SHELL_MAN_FILE_PARSER_HEADER_
|
#endif //_SHELL_MAN_FILE_PARSER_HEADER_
|
||||||
|
|
||||||
|
@ -88,15 +88,15 @@ GetNextParameter(
|
|||||||
{
|
{
|
||||||
CONST CHAR16 *NextDelim;
|
CONST CHAR16 *NextDelim;
|
||||||
|
|
||||||
if (Walker == NULL
|
if ( (Walker == NULL)
|
||||||
||*Walker == NULL
|
|| (*Walker == NULL)
|
||||||
||TempParameter == NULL
|
|| (TempParameter == NULL)
|
||||||
||*TempParameter == NULL
|
|| (*TempParameter == NULL)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// make sure we dont have any leading spaces
|
// make sure we dont have any leading spaces
|
||||||
//
|
//
|
||||||
@ -144,16 +144,15 @@ DEBUG_CODE_END();
|
|||||||
for (NextDelim = FindFirstCharacter (*TempParameter, L"\"^", CHAR_NULL)
|
for (NextDelim = FindFirstCharacter (*TempParameter, L"\"^", CHAR_NULL)
|
||||||
; *NextDelim != CHAR_NULL
|
; *NextDelim != CHAR_NULL
|
||||||
; NextDelim = FindFirstCharacter (NextDelim, L"\"^", CHAR_NULL)
|
; NextDelim = FindFirstCharacter (NextDelim, L"\"^", CHAR_NULL)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
if (*NextDelim == L'^') {
|
if (*NextDelim == L'^') {
|
||||||
|
|
||||||
//
|
//
|
||||||
// eliminate the escape ^
|
// eliminate the escape ^
|
||||||
//
|
//
|
||||||
CopyMem ((CHAR16 *)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));
|
CopyMem ((CHAR16 *)NextDelim, NextDelim + 1, StrSize (NextDelim + 1));
|
||||||
NextDelim++;
|
NextDelim++;
|
||||||
} else if (*NextDelim == L'\"') {
|
} else if (*NextDelim == L'\"') {
|
||||||
|
|
||||||
//
|
//
|
||||||
// eliminate the unescaped quote
|
// eliminate the unescaped quote
|
||||||
//
|
//
|
||||||
@ -207,7 +206,7 @@ ParseCommandLineToArgs(
|
|||||||
ASSERT (Argc != NULL);
|
ASSERT (Argc != NULL);
|
||||||
ASSERT (Argv != NULL);
|
ASSERT (Argv != NULL);
|
||||||
|
|
||||||
if (CommandLine == NULL || StrLen(CommandLine)==0) {
|
if ((CommandLine == NULL) || (StrLen (CommandLine) == 0)) {
|
||||||
(*Argc) = 0;
|
(*Argc) = 0;
|
||||||
(*Argv) = NULL;
|
(*Argv) = NULL;
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
@ -226,11 +225,12 @@ ParseCommandLineToArgs(
|
|||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Count = 0
|
for ( Count = 0,
|
||||||
, Walker = (CHAR16*)NewCommandLine
|
Walker = (CHAR16 *)NewCommandLine
|
||||||
; Walker != NULL && *Walker != CHAR_NULL
|
; Walker != NULL && *Walker != CHAR_NULL
|
||||||
; Count++
|
; Count++
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
if (EFI_ERROR (GetNextParameter (&Walker, &TempParameter, Size, TRUE))) {
|
if (EFI_ERROR (GetNextParameter (&Walker, &TempParameter, Size, TRUE))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -259,9 +259,11 @@ ParseCommandLineToArgs(
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
((CHAR16 **)(*Argv))[(*Argc)] = NewParam;
|
((CHAR16 **)(*Argv))[(*Argc)] = NewParam;
|
||||||
(*Argc)++;
|
(*Argc)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Count >= (*Argc));
|
ASSERT (Count >= (*Argc));
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
@ -354,6 +356,7 @@ CreatePopulateInstallShellParametersProtocol (
|
|||||||
FullCommandLine = AllocateZeroPool (Size + LoadedImage->LoadOptionsSize);
|
FullCommandLine = AllocateZeroPool (Size + LoadedImage->LoadOptionsSize);
|
||||||
Status = SHELL_GET_ENVIRONMENT_VARIABLE (L"ShellOpt", &Size, FullCommandLine);
|
Status = SHELL_GET_ENVIRONMENT_VARIABLE (L"ShellOpt", &Size, FullCommandLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
//
|
//
|
||||||
// no parameters via environment... ok
|
// no parameters via environment... ok
|
||||||
@ -363,7 +366,8 @@ CreatePopulateInstallShellParametersProtocol (
|
|||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Size == 0 && LoadedImage->LoadOptionsSize != 0) {
|
|
||||||
|
if ((Size == 0) && (LoadedImage->LoadOptionsSize != 0)) {
|
||||||
ASSERT (FullCommandLine == NULL);
|
ASSERT (FullCommandLine == NULL);
|
||||||
//
|
//
|
||||||
// Now we need to include a NULL terminator in the size.
|
// Now we need to include a NULL terminator in the size.
|
||||||
@ -371,15 +375,18 @@ CreatePopulateInstallShellParametersProtocol (
|
|||||||
Size = LoadedImage->LoadOptionsSize + sizeof (FullCommandLine[0]);
|
Size = LoadedImage->LoadOptionsSize + sizeof (FullCommandLine[0]);
|
||||||
FullCommandLine = AllocateZeroPool (Size);
|
FullCommandLine = AllocateZeroPool (Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FullCommandLine != NULL) {
|
if (FullCommandLine != NULL) {
|
||||||
CopyMem (FullCommandLine, LoadedImage->LoadOptions, LoadedImage->LoadOptionsSize);
|
CopyMem (FullCommandLine, LoadedImage->LoadOptions, LoadedImage->LoadOptionsSize);
|
||||||
//
|
//
|
||||||
// Populate Argc and Argv
|
// Populate Argc and Argv
|
||||||
//
|
//
|
||||||
Status = ParseCommandLineToArgs(FullCommandLine,
|
Status = ParseCommandLineToArgs (
|
||||||
|
FullCommandLine,
|
||||||
TRUE,
|
TRUE,
|
||||||
&(*NewShellParameters)->Argv,
|
&(*NewShellParameters)->Argv,
|
||||||
&(*NewShellParameters)->Argc);
|
&(*NewShellParameters)->Argc
|
||||||
|
);
|
||||||
|
|
||||||
FreePool (FullCommandLine);
|
FreePool (FullCommandLine);
|
||||||
|
|
||||||
@ -396,10 +403,12 @@ CreatePopulateInstallShellParametersProtocol (
|
|||||||
(*NewShellParameters)->StdIn = &FileInterfaceStdIn;
|
(*NewShellParameters)->StdIn = &FileInterfaceStdIn;
|
||||||
(*NewShellParameters)->StdOut = &FileInterfaceStdOut;
|
(*NewShellParameters)->StdOut = &FileInterfaceStdOut;
|
||||||
(*NewShellParameters)->StdErr = &FileInterfaceStdErr;
|
(*NewShellParameters)->StdErr = &FileInterfaceStdErr;
|
||||||
Status = gBS->InstallProtocolInterface(&gImageHandle,
|
Status = gBS->InstallProtocolInterface (
|
||||||
|
&gImageHandle,
|
||||||
&gEfiShellParametersProtocolGuid,
|
&gEfiShellParametersProtocolGuid,
|
||||||
EFI_NATIVE_INTERFACE,
|
EFI_NATIVE_INTERFACE,
|
||||||
(VOID*)(*NewShellParameters));
|
(VOID *)(*NewShellParameters)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// copy from the existing ones
|
// copy from the existing ones
|
||||||
@ -407,10 +416,12 @@ CreatePopulateInstallShellParametersProtocol (
|
|||||||
(*NewShellParameters)->StdIn = ShellInfoObject.OldShellParameters->StdIn;
|
(*NewShellParameters)->StdIn = ShellInfoObject.OldShellParameters->StdIn;
|
||||||
(*NewShellParameters)->StdOut = ShellInfoObject.OldShellParameters->StdOut;
|
(*NewShellParameters)->StdOut = ShellInfoObject.OldShellParameters->StdOut;
|
||||||
(*NewShellParameters)->StdErr = ShellInfoObject.OldShellParameters->StdErr;
|
(*NewShellParameters)->StdErr = ShellInfoObject.OldShellParameters->StdErr;
|
||||||
Status = gBS->ReinstallProtocolInterface(gImageHandle,
|
Status = gBS->ReinstallProtocolInterface (
|
||||||
|
gImageHandle,
|
||||||
&gEfiShellParametersProtocolGuid,
|
&gEfiShellParametersProtocolGuid,
|
||||||
(VOID *)ShellInfoObject.OldShellParameters,
|
(VOID *)ShellInfoObject.OldShellParameters,
|
||||||
(VOID*)(*NewShellParameters));
|
(VOID *)(*NewShellParameters)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
@ -440,28 +451,38 @@ CleanUpShellParametersProtocol (
|
|||||||
// If the old exists we need to restore it
|
// If the old exists we need to restore it
|
||||||
//
|
//
|
||||||
if (ShellInfoObject.OldShellParameters != NULL) {
|
if (ShellInfoObject.OldShellParameters != NULL) {
|
||||||
Status = gBS->ReinstallProtocolInterface(gImageHandle,
|
Status = gBS->ReinstallProtocolInterface (
|
||||||
|
gImageHandle,
|
||||||
&gEfiShellParametersProtocolGuid,
|
&gEfiShellParametersProtocolGuid,
|
||||||
(VOID *)NewShellParameters,
|
(VOID *)NewShellParameters,
|
||||||
(VOID*)ShellInfoObject.OldShellParameters);
|
(VOID *)ShellInfoObject.OldShellParameters
|
||||||
DEBUG_CODE(ShellInfoObject.OldShellParameters = NULL;);
|
);
|
||||||
|
DEBUG_CODE (
|
||||||
|
ShellInfoObject.OldShellParameters = NULL;
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// No old one, just uninstall us...
|
// No old one, just uninstall us...
|
||||||
//
|
//
|
||||||
Status = gBS->UninstallProtocolInterface(gImageHandle,
|
Status = gBS->UninstallProtocolInterface (
|
||||||
|
gImageHandle,
|
||||||
&gEfiShellParametersProtocolGuid,
|
&gEfiShellParametersProtocolGuid,
|
||||||
(VOID*)NewShellParameters);
|
(VOID *)NewShellParameters
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NewShellParameters->Argv != NULL) {
|
if (NewShellParameters->Argv != NULL) {
|
||||||
for ( LoopCounter = 0
|
for ( LoopCounter = 0
|
||||||
; LoopCounter < NewShellParameters->Argc
|
; LoopCounter < NewShellParameters->Argc
|
||||||
; LoopCounter++
|
; LoopCounter++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
FreePool (NewShellParameters->Argv[LoopCounter]);
|
FreePool (NewShellParameters->Argv[LoopCounter]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (NewShellParameters->Argv);
|
FreePool (NewShellParameters->Argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (NewShellParameters);
|
FreePool (NewShellParameters);
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
@ -489,13 +510,15 @@ IsUnicodeFile(
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
gEfiShellProtocol->GetFilePosition (Handle, &OriginalFilePosition);
|
gEfiShellProtocol->GetFilePosition (Handle, &OriginalFilePosition);
|
||||||
gEfiShellProtocol->SetFilePosition (Handle, 0);
|
gEfiShellProtocol->SetFilePosition (Handle, 0);
|
||||||
CharSize = sizeof (CHAR16);
|
CharSize = sizeof (CHAR16);
|
||||||
Status = gEfiShellProtocol->ReadFile (Handle, &CharSize, &CharBuffer);
|
Status = gEfiShellProtocol->ReadFile (Handle, &CharSize, &CharBuffer);
|
||||||
if (EFI_ERROR(Status) || CharBuffer != gUnicodeFileTag) {
|
if (EFI_ERROR (Status) || (CharBuffer != gUnicodeFileTag)) {
|
||||||
Status = EFI_BUFFER_TOO_SMALL;
|
Status = EFI_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gEfiShellProtocol->SetFilePosition (Handle, OriginalFilePosition);
|
gEfiShellProtocol->SetFilePosition (Handle, OriginalFilePosition);
|
||||||
gEfiShellProtocol->CloseFile (Handle);
|
gEfiShellProtocol->CloseFile (Handle);
|
||||||
return (Status);
|
return (Status);
|
||||||
@ -516,7 +539,7 @@ StripQuotes (
|
|||||||
BOOLEAN RemoveNow;
|
BOOLEAN RemoveNow;
|
||||||
|
|
||||||
for (RemoveNow = FALSE; TheString != NULL && *TheString != CHAR_NULL; TheString++) {
|
for (RemoveNow = FALSE; TheString != NULL && *TheString != CHAR_NULL; TheString++) {
|
||||||
if (*TheString == L'^' && *(TheString + 1) == L'\"') {
|
if ((*TheString == L'^') && (*(TheString + 1) == L'\"')) {
|
||||||
TheString++;
|
TheString++;
|
||||||
} else if (*TheString == L'\"') {
|
} else if (*TheString == L'\"') {
|
||||||
RemoveNow = (BOOLEAN) !RemoveNow;
|
RemoveNow = (BOOLEAN) !RemoveNow;
|
||||||
@ -581,6 +604,7 @@ FixFileName (
|
|||||||
while (Copy[0] == L' ') {
|
while (Copy[0] == L' ') {
|
||||||
Copy++;
|
Copy++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((TempLocation = StrStr (Copy, L" ")) != NULL) {
|
if ((TempLocation = StrStr (Copy, L" ")) != NULL) {
|
||||||
TempLocation[0] = CHAR_NULL;
|
TempLocation[0] = CHAR_NULL;
|
||||||
}
|
}
|
||||||
@ -621,7 +645,6 @@ FixVarName (
|
|||||||
return (FixFileName (Copy));
|
return (FixFileName (Copy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write the unicode file tag to the specified file.
|
Write the unicode file tag to the specified file.
|
||||||
|
|
||||||
@ -644,13 +667,15 @@ WriteFileTag (
|
|||||||
|
|
||||||
FileTag = gUnicodeFileTag;
|
FileTag = gUnicodeFileTag;
|
||||||
Size = sizeof FileTag;
|
Size = sizeof FileTag;
|
||||||
Status = ShellInfoObject.NewEfiShellProtocol->WriteFile (FileHandle, &Size,
|
Status = ShellInfoObject.NewEfiShellProtocol->WriteFile (
|
||||||
&FileTag);
|
FileHandle,
|
||||||
|
&Size,
|
||||||
|
&FileTag
|
||||||
|
);
|
||||||
ASSERT (EFI_ERROR (Status) || Size == sizeof FileTag);
|
ASSERT (EFI_ERROR (Status) || Size == sizeof FileTag);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function will replace the current StdIn and StdOut in the ShellParameters protocol
|
Function will replace the current StdIn and StdOut in the ShellParameters protocol
|
||||||
structure by parsing NewCommandLine. The current values are returned to the
|
structure by parsing NewCommandLine. The current values are returned to the
|
||||||
@ -714,7 +739,7 @@ UpdateStdInStdOutStdErr(
|
|||||||
CommandLineCopy = NULL;
|
CommandLineCopy = NULL;
|
||||||
FirstLocation = NULL;
|
FirstLocation = NULL;
|
||||||
|
|
||||||
if (ShellParameters == NULL || SystemTableInfo == NULL || OldStdIn == NULL || OldStdOut == NULL || OldStdErr == NULL) {
|
if ((ShellParameters == NULL) || (SystemTableInfo == NULL) || (OldStdIn == NULL) || (OldStdOut == NULL) || (OldStdErr == NULL)) {
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,6 +761,7 @@ UpdateStdInStdOutStdErr(
|
|||||||
if (CommandLineCopy == NULL) {
|
if (CommandLineCopy == NULL) {
|
||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
Split = NULL;
|
Split = NULL;
|
||||||
FirstLocation = CommandLineCopy + StrLen (CommandLineCopy);
|
FirstLocation = CommandLineCopy + StrLen (CommandLineCopy);
|
||||||
@ -744,15 +770,16 @@ UpdateStdInStdOutStdErr(
|
|||||||
|
|
||||||
if (!IsListEmpty (&ShellInfoObject.SplitList.Link)) {
|
if (!IsListEmpty (&ShellInfoObject.SplitList.Link)) {
|
||||||
Split = (SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link);
|
Split = (SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link);
|
||||||
if (Split != NULL && Split->SplitStdIn != NULL) {
|
if ((Split != NULL) && (Split->SplitStdIn != NULL)) {
|
||||||
ShellParameters->StdIn = Split->SplitStdIn;
|
ShellParameters->StdIn = Split->SplitStdIn;
|
||||||
}
|
}
|
||||||
if (Split != NULL && Split->SplitStdOut != NULL) {
|
|
||||||
|
if ((Split != NULL) && (Split->SplitStdOut != NULL)) {
|
||||||
ShellParameters->StdOut = Split->SplitStdOut;
|
ShellParameters->StdOut = Split->SplitStdOut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>>v ")) != NULL) {
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2>>v ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 12, L' ');
|
SetMem16 (CommandLineWalker, 12, L' ');
|
||||||
StdErrVarName = CommandLineWalker += 6;
|
StdErrVarName = CommandLineWalker += 6;
|
||||||
@ -761,7 +788,8 @@ UpdateStdInStdOutStdErr(
|
|||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>>v ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>>v ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 12, L' ');
|
SetMem16 (CommandLineWalker, 12, L' ');
|
||||||
StdOutVarName = CommandLineWalker += 6;
|
StdOutVarName = CommandLineWalker += 6;
|
||||||
@ -769,7 +797,7 @@ UpdateStdInStdOutStdErr(
|
|||||||
if (StrStr (CommandLineWalker, L" 1>>v ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 1>>v ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
} else if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >>v ")) != NULL) {
|
} else if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >>v ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 10, L' ');
|
SetMem16 (CommandLineWalker, 10, L' ');
|
||||||
StdOutVarName = CommandLineWalker += 5;
|
StdOutVarName = CommandLineWalker += 5;
|
||||||
@ -777,7 +805,7 @@ UpdateStdInStdOutStdErr(
|
|||||||
if (StrStr (CommandLineWalker, L" >>v ") != NULL) {
|
if (StrStr (CommandLineWalker, L" >>v ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
} else if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >v ")) != NULL) {
|
} else if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >v ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 8, L' ');
|
SetMem16 (CommandLineWalker, 8, L' ');
|
||||||
StdOutVarName = CommandLineWalker += 4;
|
StdOutVarName = CommandLineWalker += 4;
|
||||||
@ -786,7 +814,8 @@ UpdateStdInStdOutStdErr(
|
|||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>>a ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>>a ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 12, L' ');
|
SetMem16 (CommandLineWalker, 12, L' ');
|
||||||
StdOutFileName = CommandLineWalker += 6;
|
StdOutFileName = CommandLineWalker += 6;
|
||||||
@ -796,7 +825,8 @@ UpdateStdInStdOutStdErr(
|
|||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>> ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>> ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 10, L' ');
|
SetMem16 (CommandLineWalker, 10, L' ');
|
||||||
if (StdOutFileName != NULL) {
|
if (StdOutFileName != NULL) {
|
||||||
@ -805,11 +835,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
StdOutFileName = CommandLineWalker += 5;
|
StdOutFileName = CommandLineWalker += 5;
|
||||||
OutAppend = TRUE;
|
OutAppend = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" 1>> ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 1>> ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >> ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >> ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 8, L' ');
|
SetMem16 (CommandLineWalker, 8, L' ');
|
||||||
if (StdOutFileName != NULL) {
|
if (StdOutFileName != NULL) {
|
||||||
@ -818,11 +850,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
StdOutFileName = CommandLineWalker += 4;
|
StdOutFileName = CommandLineWalker += 4;
|
||||||
OutAppend = TRUE;
|
OutAppend = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" >> ") != NULL) {
|
if (StrStr (CommandLineWalker, L" >> ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >>a ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >>a ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 10, L' ');
|
SetMem16 (CommandLineWalker, 10, L' ');
|
||||||
if (StdOutFileName != NULL) {
|
if (StdOutFileName != NULL) {
|
||||||
@ -832,11 +866,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
OutAppend = TRUE;
|
OutAppend = TRUE;
|
||||||
OutUnicode = FALSE;
|
OutUnicode = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" >>a ") != NULL) {
|
if (StrStr (CommandLineWalker, L" >>a ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>a ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>a ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 10, L' ');
|
SetMem16 (CommandLineWalker, 10, L' ');
|
||||||
if (StdOutFileName != NULL) {
|
if (StdOutFileName != NULL) {
|
||||||
@ -846,11 +882,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
OutAppend = FALSE;
|
OutAppend = FALSE;
|
||||||
OutUnicode = FALSE;
|
OutUnicode = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" 1>a ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 1>a ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" >a ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" >a ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 8, L' ');
|
SetMem16 (CommandLineWalker, 8, L' ');
|
||||||
if (StdOutFileName != NULL) {
|
if (StdOutFileName != NULL) {
|
||||||
@ -860,11 +898,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
OutAppend = FALSE;
|
OutAppend = FALSE;
|
||||||
OutUnicode = FALSE;
|
OutUnicode = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" >a ") != NULL) {
|
if (StrStr (CommandLineWalker, L" >a ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>> ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2>> ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 10, L' ');
|
SetMem16 (CommandLineWalker, 10, L' ');
|
||||||
if (StdErrFileName != NULL) {
|
if (StdErrFileName != NULL) {
|
||||||
@ -873,12 +913,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
StdErrFileName = CommandLineWalker += 5;
|
StdErrFileName = CommandLineWalker += 5;
|
||||||
ErrAppend = TRUE;
|
ErrAppend = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" 2>> ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 2>> ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>v ")) != NULL) {
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2>v ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 10, L' ');
|
SetMem16 (CommandLineWalker, 10, L' ');
|
||||||
if (StdErrVarName != NULL) {
|
if (StdErrVarName != NULL) {
|
||||||
@ -887,11 +928,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
StdErrVarName = CommandLineWalker += 5;
|
StdErrVarName = CommandLineWalker += 5;
|
||||||
ErrAppend = FALSE;
|
ErrAppend = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" 2>v ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 2>v ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1>v ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1>v ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 10, L' ');
|
SetMem16 (CommandLineWalker, 10, L' ');
|
||||||
if (StdOutVarName != NULL) {
|
if (StdOutVarName != NULL) {
|
||||||
@ -900,11 +943,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
StdOutVarName = CommandLineWalker += 5;
|
StdOutVarName = CommandLineWalker += 5;
|
||||||
OutAppend = FALSE;
|
OutAppend = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" 1>v ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 1>v ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2>a ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2>a ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 10, L' ');
|
SetMem16 (CommandLineWalker, 10, L' ');
|
||||||
if (StdErrFileName != NULL) {
|
if (StdErrFileName != NULL) {
|
||||||
@ -914,11 +959,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
ErrAppend = FALSE;
|
ErrAppend = FALSE;
|
||||||
ErrUnicode = FALSE;
|
ErrUnicode = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" 2>a ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 2>a ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 2> ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 2> ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 8, L' ');
|
SetMem16 (CommandLineWalker, 8, L' ');
|
||||||
if (StdErrFileName != NULL) {
|
if (StdErrFileName != NULL) {
|
||||||
@ -927,12 +974,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
StdErrFileName = CommandLineWalker += 4;
|
StdErrFileName = CommandLineWalker += 4;
|
||||||
ErrAppend = FALSE;
|
ErrAppend = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" 2> ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 2> ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" 1> ")) != NULL) {
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" 1> ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 8, L' ');
|
SetMem16 (CommandLineWalker, 8, L' ');
|
||||||
if (StdOutFileName != NULL) {
|
if (StdOutFileName != NULL) {
|
||||||
@ -941,12 +989,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
StdOutFileName = CommandLineWalker += 4;
|
StdOutFileName = CommandLineWalker += 4;
|
||||||
OutAppend = FALSE;
|
OutAppend = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" 1> ") != NULL) {
|
if (StrStr (CommandLineWalker, L" 1> ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" > ")) != NULL) {
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" > ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 6, L' ');
|
SetMem16 (CommandLineWalker, 6, L' ');
|
||||||
if (StdOutFileName != NULL) {
|
if (StdOutFileName != NULL) {
|
||||||
@ -955,12 +1004,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
StdOutFileName = CommandLineWalker += 3;
|
StdOutFileName = CommandLineWalker += 3;
|
||||||
OutAppend = FALSE;
|
OutAppend = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" > ") != NULL) {
|
if (StrStr (CommandLineWalker, L" > ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" < ")) != NULL) {
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" < ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 6, L' ');
|
SetMem16 (CommandLineWalker, 6, L' ');
|
||||||
if (StdInFileName != NULL) {
|
if (StdInFileName != NULL) {
|
||||||
@ -968,11 +1018,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
} else {
|
} else {
|
||||||
StdInFileName = CommandLineWalker += 3;
|
StdInFileName = CommandLineWalker += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" < ") != NULL) {
|
if (StrStr (CommandLineWalker, L" < ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" <a ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" <a ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 8, L' ');
|
SetMem16 (CommandLineWalker, 8, L' ');
|
||||||
if (StdInFileName != NULL) {
|
if (StdInFileName != NULL) {
|
||||||
@ -982,11 +1034,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
InUnicode = FALSE;
|
InUnicode = FALSE;
|
||||||
AsciiRedirection = TRUE;
|
AsciiRedirection = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" <a ") != NULL) {
|
if (StrStr (CommandLineWalker, L" <a ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR(Status) && (CommandLineWalker = StrStr(CommandLineCopy, L" <v ")) != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && ((CommandLineWalker = StrStr (CommandLineCopy, L" <v ")) != NULL)) {
|
||||||
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
FirstLocation = MIN (CommandLineWalker, FirstLocation);
|
||||||
SetMem16 (CommandLineWalker, 8, L' ');
|
SetMem16 (CommandLineWalker, 8, L' ');
|
||||||
if (StdInVarName != NULL) {
|
if (StdInVarName != NULL) {
|
||||||
@ -994,6 +1048,7 @@ UpdateStdInStdOutStdErr(
|
|||||||
} else {
|
} else {
|
||||||
StdInVarName = CommandLineWalker += 4;
|
StdInVarName = CommandLineWalker += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrStr (CommandLineWalker, L" <v ") != NULL) {
|
if (StrStr (CommandLineWalker, L" <v ") != NULL) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@ -1004,39 +1059,44 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
StrnCpyS (CommandLineCopy, StrSize (CommandLineCopy)/sizeof (CHAR16), NewCommandLine, StrLen (NewCommandLine));
|
StrnCpyS (CommandLineCopy, StrSize (CommandLineCopy)/sizeof (CHAR16), NewCommandLine, StrLen (NewCommandLine));
|
||||||
|
|
||||||
if (FirstLocation != CommandLineCopy + StrLen(CommandLineCopy)
|
if ( (FirstLocation != CommandLineCopy + StrLen (CommandLineCopy))
|
||||||
&& (((UINTN)FirstLocation - (UINTN)CommandLineCopy)/sizeof (CHAR16) < StrLen (NewCommandLine))
|
&& (((UINTN)FirstLocation - (UINTN)CommandLineCopy)/sizeof (CHAR16) < StrLen (NewCommandLine))
|
||||||
){
|
)
|
||||||
|
{
|
||||||
*(NewCommandLine + ((UINTN)FirstLocation - (UINTN)CommandLineCopy)/sizeof (CHAR16)) = CHAR_NULL;
|
*(NewCommandLine + ((UINTN)FirstLocation - (UINTN)CommandLineCopy)/sizeof (CHAR16)) = CHAR_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
if (StdErrFileName != NULL) {
|
if (StdErrFileName != NULL) {
|
||||||
if ((StdErrFileName = FixFileName (StdErrFileName)) == NULL) {
|
if ((StdErrFileName = FixFileName (StdErrFileName)) == NULL) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StdOutFileName != NULL) {
|
if (StdOutFileName != NULL) {
|
||||||
if ((StdOutFileName = FixFileName (StdOutFileName)) == NULL) {
|
if ((StdOutFileName = FixFileName (StdOutFileName)) == NULL) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StdInFileName != NULL) {
|
if (StdInFileName != NULL) {
|
||||||
if ((StdInFileName = FixFileName (StdInFileName)) == NULL) {
|
if ((StdInFileName = FixFileName (StdInFileName)) == NULL) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StdErrVarName != NULL) {
|
if (StdErrVarName != NULL) {
|
||||||
if ((StdErrVarName = FixVarName (StdErrVarName)) == NULL) {
|
if ((StdErrVarName = FixVarName (StdErrVarName)) == NULL) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StdOutVarName != NULL) {
|
if (StdOutVarName != NULL) {
|
||||||
if ((StdOutVarName = FixVarName (StdOutVarName)) == NULL) {
|
if ((StdOutVarName = FixVarName (StdOutVarName)) == NULL) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StdInVarName != NULL) {
|
if (StdInVarName != NULL) {
|
||||||
if ((StdInVarName = FixVarName (StdInVarName)) == NULL) {
|
if ((StdInVarName = FixVarName (StdInVarName)) == NULL) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
@ -1050,44 +1110,45 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
// Check that no 2 filenames are the same
|
// Check that no 2 filenames are the same
|
||||||
//
|
//
|
||||||
(StdErrFileName != NULL && StdOutFileName!= NULL && StringNoCaseCompare(&StdErrFileName, &StdOutFileName) == 0)
|
((StdErrFileName != NULL) && (StdOutFileName != NULL) && (StringNoCaseCompare (&StdErrFileName, &StdOutFileName) == 0))
|
||||||
||(StdErrFileName != NULL && StdInFileName != NULL && StringNoCaseCompare(&StdErrFileName, &StdInFileName ) == 0)
|
|| ((StdErrFileName != NULL) && (StdInFileName != NULL) && (StringNoCaseCompare (&StdErrFileName, &StdInFileName) == 0))
|
||||||
||(StdOutFileName != NULL && StdInFileName != NULL && StringNoCaseCompare(&StdOutFileName, &StdInFileName ) == 0)
|
|| ((StdOutFileName != NULL) && (StdInFileName != NULL) && (StringNoCaseCompare (&StdOutFileName, &StdInFileName) == 0))
|
||||||
//
|
//
|
||||||
// Check that no 2 variable names are the same
|
// Check that no 2 variable names are the same
|
||||||
//
|
//
|
||||||
||(StdErrVarName != NULL && StdInVarName != NULL && StringNoCaseCompare(&StdErrVarName , &StdInVarName ) == 0)
|
|| ((StdErrVarName != NULL) && (StdInVarName != NULL) && (StringNoCaseCompare (&StdErrVarName, &StdInVarName) == 0))
|
||||||
||(StdOutVarName != NULL && StdInVarName != NULL && StringNoCaseCompare(&StdOutVarName , &StdInVarName ) == 0)
|
|| ((StdOutVarName != NULL) && (StdInVarName != NULL) && (StringNoCaseCompare (&StdOutVarName, &StdInVarName) == 0))
|
||||||
||(StdErrVarName != NULL && StdOutVarName != NULL && StringNoCaseCompare(&StdErrVarName , &StdOutVarName ) == 0)
|
|| ((StdErrVarName != NULL) && (StdOutVarName != NULL) && (StringNoCaseCompare (&StdErrVarName, &StdOutVarName) == 0))
|
||||||
//
|
//
|
||||||
// When a split (using | operator) is in place some are not allowed
|
// When a split (using | operator) is in place some are not allowed
|
||||||
//
|
//
|
||||||
||(Split != NULL && Split->SplitStdIn != NULL && (StdInVarName != NULL || StdInFileName != NULL))
|
|| ((Split != NULL) && (Split->SplitStdIn != NULL) && ((StdInVarName != NULL) || (StdInFileName != NULL)))
|
||||||
||(Split != NULL && Split->SplitStdOut != NULL && (StdOutVarName != NULL || StdOutFileName != NULL))
|
|| ((Split != NULL) && (Split->SplitStdOut != NULL) && ((StdOutVarName != NULL) || (StdOutFileName != NULL)))
|
||||||
//
|
//
|
||||||
// Check that nothing is trying to be output to 2 locations.
|
// Check that nothing is trying to be output to 2 locations.
|
||||||
//
|
//
|
||||||
||(StdErrFileName != NULL && StdErrVarName != NULL)
|
|| ((StdErrFileName != NULL) && (StdErrVarName != NULL))
|
||||||
||(StdOutFileName != NULL && StdOutVarName != NULL)
|
|| ((StdOutFileName != NULL) && (StdOutVarName != NULL))
|
||||||
||(StdInFileName != NULL && StdInVarName != NULL)
|
|| ((StdInFileName != NULL) && (StdInVarName != NULL))
|
||||||
//
|
//
|
||||||
// Check for no volatile environment variables
|
// Check for no volatile environment variables
|
||||||
//
|
//
|
||||||
||(StdErrVarName != NULL && !EFI_ERROR (IsVolatileEnv (StdErrVarName, &Volatile)) && !Volatile)
|
|| ((StdErrVarName != NULL) && !EFI_ERROR (IsVolatileEnv (StdErrVarName, &Volatile)) && !Volatile)
|
||||||
||(StdOutVarName != NULL && !EFI_ERROR (IsVolatileEnv (StdOutVarName, &Volatile)) && !Volatile)
|
|| ((StdOutVarName != NULL) && !EFI_ERROR (IsVolatileEnv (StdOutVarName, &Volatile)) && !Volatile)
|
||||||
//
|
//
|
||||||
// Cant redirect during a reconnect operation.
|
// Cant redirect during a reconnect operation.
|
||||||
//
|
//
|
||||||
||(StrStr(NewCommandLine, L"connect -r") != NULL
|
|| ( (StrStr (NewCommandLine, L"connect -r") != NULL)
|
||||||
&& (StdOutVarName != NULL || StdOutFileName != NULL || StdErrFileName != NULL || StdErrVarName != NULL))
|
&& ((StdOutVarName != NULL) || (StdOutFileName != NULL) || (StdErrFileName != NULL) || (StdErrVarName != NULL)))
|
||||||
//
|
//
|
||||||
// Check that filetypes (Unicode/Ascii) do not change during an append
|
// Check that filetypes (Unicode/Ascii) do not change during an append
|
||||||
//
|
//
|
||||||
||(StdOutFileName != NULL && OutUnicode && OutAppend && (!EFI_ERROR(ShellFileExists(StdOutFileName)) && EFI_ERROR(IsUnicodeFile(StdOutFileName))))
|
|| ((StdOutFileName != NULL) && OutUnicode && OutAppend && (!EFI_ERROR (ShellFileExists (StdOutFileName)) && EFI_ERROR (IsUnicodeFile (StdOutFileName))))
|
||||||
||(StdErrFileName != NULL && ErrUnicode && ErrAppend && (!EFI_ERROR(ShellFileExists(StdErrFileName)) && EFI_ERROR(IsUnicodeFile(StdErrFileName))))
|
|| ((StdErrFileName != NULL) && ErrUnicode && ErrAppend && (!EFI_ERROR (ShellFileExists (StdErrFileName)) && EFI_ERROR (IsUnicodeFile (StdErrFileName))))
|
||||||
||(StdOutFileName != NULL && !OutUnicode && OutAppend && (!EFI_ERROR(ShellFileExists(StdOutFileName)) && !EFI_ERROR(IsUnicodeFile(StdOutFileName))))
|
|| ((StdOutFileName != NULL) && !OutUnicode && OutAppend && (!EFI_ERROR (ShellFileExists (StdOutFileName)) && !EFI_ERROR (IsUnicodeFile (StdOutFileName))))
|
||||||
||(StdErrFileName != NULL && !ErrUnicode && ErrAppend && (!EFI_ERROR(ShellFileExists(StdErrFileName)) && !EFI_ERROR(IsUnicodeFile(StdErrFileName))))
|
|| ((StdErrFileName != NULL) && !ErrUnicode && ErrAppend && (!EFI_ERROR (ShellFileExists (StdErrFileName)) && !EFI_ERROR (IsUnicodeFile (StdErrFileName))))
|
||||||
){
|
)
|
||||||
|
{
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
ShellParameters->StdIn = *OldStdIn;
|
ShellParameters->StdIn = *OldStdIn;
|
||||||
ShellParameters->StdOut = *OldStdOut;
|
ShellParameters->StdOut = *OldStdOut;
|
||||||
@ -1107,14 +1168,17 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
ShellInfoObject.NewEfiShellProtocol->DeleteFileByName (StdErrFileName);
|
ShellInfoObject.NewEfiShellProtocol->DeleteFileByName (StdErrFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ShellOpenFileByName (StdErrFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, 0);
|
Status = ShellOpenFileByName (StdErrFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, 0);
|
||||||
if (!ErrAppend && ErrUnicode && !EFI_ERROR (Status)) {
|
if (!ErrAppend && ErrUnicode && !EFI_ERROR (Status)) {
|
||||||
Status = WriteFileTag (TempHandle);
|
Status = WriteFileTag (TempHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ErrUnicode && !EFI_ERROR (Status)) {
|
if (!ErrUnicode && !EFI_ERROR (Status)) {
|
||||||
TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
|
TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
|
||||||
ASSERT (TempHandle != NULL);
|
ASSERT (TempHandle != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
ShellParameters->StdErr = TempHandle;
|
ShellParameters->StdErr = TempHandle;
|
||||||
gST->StdErr = CreateSimpleTextOutOnFile (TempHandle, &gST->StandardErrorHandle, gST->StdErr);
|
gST->StdErr = CreateSimpleTextOutOnFile (TempHandle, &gST->StandardErrorHandle, gST->StdErr);
|
||||||
@ -1124,13 +1188,14 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
// StdOut to a file
|
// StdOut to a file
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR(Status) && StdOutFileName != NULL) {
|
if (!EFI_ERROR (Status) && (StdOutFileName != NULL)) {
|
||||||
if (!OutAppend) {
|
if (!OutAppend) {
|
||||||
//
|
//
|
||||||
// delete existing file.
|
// delete existing file.
|
||||||
//
|
//
|
||||||
ShellInfoObject.NewEfiShellProtocol->DeleteFileByName (StdOutFileName);
|
ShellInfoObject.NewEfiShellProtocol->DeleteFileByName (StdOutFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ShellOpenFileByName (StdOutFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, 0);
|
Status = ShellOpenFileByName (StdOutFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, 0);
|
||||||
if (TempHandle == NULL) {
|
if (TempHandle == NULL) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
@ -1151,13 +1216,16 @@ UpdateStdInStdOutStdErr(
|
|||||||
WriteFileTag (TempHandle) :
|
WriteFileTag (TempHandle) :
|
||||||
ShellInfoObject.NewEfiShellProtocol->SetFilePosition (
|
ShellInfoObject.NewEfiShellProtocol->SetFilePosition (
|
||||||
TempHandle,
|
TempHandle,
|
||||||
FileSize);
|
FileSize
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OutUnicode && !EFI_ERROR (Status)) {
|
if (!OutUnicode && !EFI_ERROR (Status)) {
|
||||||
TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
|
TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
|
||||||
ASSERT (TempHandle != NULL);
|
ASSERT (TempHandle != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
ShellParameters->StdOut = TempHandle;
|
ShellParameters->StdOut = TempHandle;
|
||||||
gST->ConOut = CreateSimpleTextOutOnFile (TempHandle, &gST->ConsoleOutHandle, gST->ConOut);
|
gST->ConOut = CreateSimpleTextOutOnFile (TempHandle, &gST->ConsoleOutHandle, gST->ConOut);
|
||||||
@ -1168,13 +1236,14 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
// StdOut to a var
|
// StdOut to a var
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR(Status) && StdOutVarName != NULL) {
|
if (!EFI_ERROR (Status) && (StdOutVarName != NULL)) {
|
||||||
if (!OutAppend) {
|
if (!OutAppend) {
|
||||||
//
|
//
|
||||||
// delete existing variable.
|
// delete existing variable.
|
||||||
//
|
//
|
||||||
SHELL_SET_ENVIRONMENT_VARIABLE_V (StdOutVarName, 0, L"");
|
SHELL_SET_ENVIRONMENT_VARIABLE_V (StdOutVarName, 0, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TempHandle = CreateFileInterfaceEnv (StdOutVarName);
|
TempHandle = CreateFileInterfaceEnv (StdOutVarName);
|
||||||
ASSERT (TempHandle != NULL);
|
ASSERT (TempHandle != NULL);
|
||||||
ShellParameters->StdOut = TempHandle;
|
ShellParameters->StdOut = TempHandle;
|
||||||
@ -1184,13 +1253,14 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
// StdErr to a var
|
// StdErr to a var
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR(Status) && StdErrVarName != NULL) {
|
if (!EFI_ERROR (Status) && (StdErrVarName != NULL)) {
|
||||||
if (!ErrAppend) {
|
if (!ErrAppend) {
|
||||||
//
|
//
|
||||||
// delete existing variable.
|
// delete existing variable.
|
||||||
//
|
//
|
||||||
SHELL_SET_ENVIRONMENT_VARIABLE_V (StdErrVarName, 0, L"");
|
SHELL_SET_ENVIRONMENT_VARIABLE_V (StdErrVarName, 0, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
TempHandle = CreateFileInterfaceEnv (StdErrVarName);
|
TempHandle = CreateFileInterfaceEnv (StdErrVarName);
|
||||||
ASSERT (TempHandle != NULL);
|
ASSERT (TempHandle != NULL);
|
||||||
ShellParameters->StdErr = TempHandle;
|
ShellParameters->StdErr = TempHandle;
|
||||||
@ -1200,7 +1270,7 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
// StdIn from a var
|
// StdIn from a var
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR(Status) && StdInVarName != NULL) {
|
if (!EFI_ERROR (Status) && (StdInVarName != NULL)) {
|
||||||
TempHandle = CreateFileInterfaceEnv (StdInVarName);
|
TempHandle = CreateFileInterfaceEnv (StdInVarName);
|
||||||
if (TempHandle == NULL) {
|
if (TempHandle == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
@ -1208,8 +1278,9 @@ UpdateStdInStdOutStdErr(
|
|||||||
if (!InUnicode) {
|
if (!InUnicode) {
|
||||||
TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
|
TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Size = 0;
|
Size = 0;
|
||||||
if (TempHandle == NULL || ((EFI_FILE_PROTOCOL*)TempHandle)->Read(TempHandle, &Size, NULL) != EFI_BUFFER_TOO_SMALL) {
|
if ((TempHandle == NULL) || (((EFI_FILE_PROTOCOL *)TempHandle)->Read (TempHandle, &Size, NULL) != EFI_BUFFER_TOO_SMALL)) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
ShellParameters->StdIn = TempHandle;
|
ShellParameters->StdIn = TempHandle;
|
||||||
@ -1221,12 +1292,13 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
// StdIn from a file
|
// StdIn from a file
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR(Status) && StdInFileName != NULL) {
|
if (!EFI_ERROR (Status) && (StdInFileName != NULL)) {
|
||||||
Status = ShellOpenFileByName (
|
Status = ShellOpenFileByName (
|
||||||
StdInFileName,
|
StdInFileName,
|
||||||
&TempHandle,
|
&TempHandle,
|
||||||
EFI_FILE_MODE_READ,
|
EFI_FILE_MODE_READ,
|
||||||
0);
|
0
|
||||||
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
if (!InUnicode) {
|
if (!InUnicode) {
|
||||||
//
|
//
|
||||||
@ -1234,17 +1306,19 @@ UpdateStdInStdOutStdErr(
|
|||||||
//
|
//
|
||||||
TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
|
TempHandle = CreateFileInterfaceFile (TempHandle, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellParameters->StdIn = TempHandle;
|
ShellParameters->StdIn = TempHandle;
|
||||||
gST->ConIn = CreateSimpleTextInOnFile (TempHandle, &gST->ConsoleInHandle);
|
gST->ConIn = CreateSimpleTextInOnFile (TempHandle, &gST->ConsoleInHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (CommandLineCopy);
|
FreePool (CommandLineCopy);
|
||||||
|
|
||||||
CalculateEfiHdrCrc (&gST->Hdr);
|
CalculateEfiHdrCrc (&gST->Hdr);
|
||||||
|
|
||||||
if (gST->ConIn == NULL ||gST->ConOut == NULL) {
|
if ((gST->ConIn == NULL) || (gST->ConOut == NULL)) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1278,30 +1352,37 @@ RestoreStdInStdOutStdErr (
|
|||||||
{
|
{
|
||||||
SPLIT_LIST *Split;
|
SPLIT_LIST *Split;
|
||||||
|
|
||||||
if (ShellParameters == NULL
|
if ( (ShellParameters == NULL)
|
||||||
||OldStdIn == NULL
|
|| (OldStdIn == NULL)
|
||||||
||OldStdOut == NULL
|
|| (OldStdOut == NULL)
|
||||||
||OldStdErr == NULL
|
|| (OldStdErr == NULL)
|
||||||
||SystemTableInfo == NULL) {
|
|| (SystemTableInfo == NULL))
|
||||||
|
{
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsListEmpty (&ShellInfoObject.SplitList.Link)) {
|
if (!IsListEmpty (&ShellInfoObject.SplitList.Link)) {
|
||||||
Split = (SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link);
|
Split = (SPLIT_LIST *)GetFirstNode (&ShellInfoObject.SplitList.Link);
|
||||||
} else {
|
} else {
|
||||||
Split = NULL;
|
Split = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellParameters->StdIn != *OldStdIn) {
|
if (ShellParameters->StdIn != *OldStdIn) {
|
||||||
if ((Split != NULL && Split->SplitStdIn != ShellParameters->StdIn) || Split == NULL) {
|
if (((Split != NULL) && (Split->SplitStdIn != ShellParameters->StdIn)) || (Split == NULL)) {
|
||||||
gEfiShellProtocol->CloseFile (ShellParameters->StdIn);
|
gEfiShellProtocol->CloseFile (ShellParameters->StdIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellParameters->StdIn = *OldStdIn;
|
ShellParameters->StdIn = *OldStdIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellParameters->StdOut != *OldStdOut) {
|
if (ShellParameters->StdOut != *OldStdOut) {
|
||||||
if ((Split != NULL && Split->SplitStdOut != ShellParameters->StdOut) || Split == NULL) {
|
if (((Split != NULL) && (Split->SplitStdOut != ShellParameters->StdOut)) || (Split == NULL)) {
|
||||||
gEfiShellProtocol->CloseFile (ShellParameters->StdOut);
|
gEfiShellProtocol->CloseFile (ShellParameters->StdOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellParameters->StdOut = *OldStdOut;
|
ShellParameters->StdOut = *OldStdOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellParameters->StdErr != *OldStdErr) {
|
if (ShellParameters->StdErr != *OldStdErr) {
|
||||||
gEfiShellProtocol->CloseFile (ShellParameters->StdErr);
|
gEfiShellProtocol->CloseFile (ShellParameters->StdErr);
|
||||||
ShellParameters->StdErr = *OldStdErr;
|
ShellParameters->StdErr = *OldStdErr;
|
||||||
@ -1312,11 +1393,13 @@ RestoreStdInStdOutStdErr (
|
|||||||
gST->ConIn = SystemTableInfo->ConIn;
|
gST->ConIn = SystemTableInfo->ConIn;
|
||||||
gST->ConsoleInHandle = SystemTableInfo->ConInHandle;
|
gST->ConsoleInHandle = SystemTableInfo->ConInHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gST->ConOut != SystemTableInfo->ConOut) {
|
if (gST->ConOut != SystemTableInfo->ConOut) {
|
||||||
CloseSimpleTextOutOnFile (gST->ConOut);
|
CloseSimpleTextOutOnFile (gST->ConOut);
|
||||||
gST->ConOut = SystemTableInfo->ConOut;
|
gST->ConOut = SystemTableInfo->ConOut;
|
||||||
gST->ConsoleOutHandle = SystemTableInfo->ConOutHandle;
|
gST->ConsoleOutHandle = SystemTableInfo->ConOutHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gST->StdErr != SystemTableInfo->ErrOut) {
|
if (gST->StdErr != SystemTableInfo->ErrOut) {
|
||||||
CloseSimpleTextOutOnFile (gST->StdErr);
|
CloseSimpleTextOutOnFile (gST->StdErr);
|
||||||
gST->StdErr = SystemTableInfo->ErrOut;
|
gST->StdErr = SystemTableInfo->ErrOut;
|
||||||
@ -1327,6 +1410,7 @@ RestoreStdInStdOutStdErr (
|
|||||||
|
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function will replace the current Argc and Argv in the ShellParameters protocol
|
Function will replace the current Argc and Argv in the ShellParameters protocol
|
||||||
structure by parsing NewCommandLine. The current values are returned to the
|
structure by parsing NewCommandLine. The current values are returned to the
|
||||||
@ -1362,6 +1446,7 @@ UpdateArgcArgv(
|
|||||||
if (OldArgc != NULL) {
|
if (OldArgc != NULL) {
|
||||||
*OldArgc = ShellParameters->Argc;
|
*OldArgc = ShellParameters->Argc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OldArgc != NULL) {
|
if (OldArgc != NULL) {
|
||||||
*OldArgv = ShellParameters->Argv;
|
*OldArgv = ShellParameters->Argv;
|
||||||
}
|
}
|
||||||
@ -1370,7 +1455,8 @@ UpdateArgcArgv(
|
|||||||
StripParamQuotation = FALSE;
|
StripParamQuotation = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ParseCommandLineToArgs( NewCommandLine,
|
return ParseCommandLineToArgs (
|
||||||
|
NewCommandLine,
|
||||||
StripParamQuotation,
|
StripParamQuotation,
|
||||||
&(ShellParameters->Argv),
|
&(ShellParameters->Argv),
|
||||||
&(ShellParameters->Argc)
|
&(ShellParameters->Argc)
|
||||||
@ -1394,6 +1480,7 @@ RestoreArgcArgv(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN LoopCounter;
|
UINTN LoopCounter;
|
||||||
|
|
||||||
ASSERT (ShellParameters != NULL);
|
ASSERT (ShellParameters != NULL);
|
||||||
ASSERT (OldArgv != NULL);
|
ASSERT (OldArgv != NULL);
|
||||||
ASSERT (OldArgc != NULL);
|
ASSERT (OldArgc != NULL);
|
||||||
@ -1402,11 +1489,14 @@ RestoreArgcArgv(
|
|||||||
for ( LoopCounter = 0
|
for ( LoopCounter = 0
|
||||||
; LoopCounter < ShellParameters->Argc
|
; LoopCounter < ShellParameters->Argc
|
||||||
; LoopCounter++
|
; LoopCounter++
|
||||||
){
|
)
|
||||||
|
{
|
||||||
FreePool (ShellParameters->Argv[LoopCounter]);
|
FreePool (ShellParameters->Argv[LoopCounter]);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (ShellParameters->Argv);
|
FreePool (ShellParameters->Argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellParameters->Argv = *OldArgv;
|
ShellParameters->Argv = *OldArgv;
|
||||||
*OldArgv = NULL;
|
*OldArgv = NULL;
|
||||||
ShellParameters->Argc = *OldArgc;
|
ShellParameters->Argc = *OldArgc;
|
||||||
|
@ -208,4 +208,3 @@ GetNextParameter(
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_
|
#endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -934,5 +934,5 @@ EFIAPI
|
|||||||
NotificationFunction (
|
NotificationFunction (
|
||||||
IN EFI_KEY_DATA *KeyData
|
IN EFI_KEY_DATA *KeyData
|
||||||
);
|
);
|
||||||
#endif //_SHELL_PROTOCOL_HEADER_
|
|
||||||
|
|
||||||
|
#endif //_SHELL_PROTOCOL_HEADER_
|
||||||
|
@ -34,9 +34,11 @@ ShellAppMain (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
if (Argc == 1) {
|
if (Argc == 1) {
|
||||||
Print (L"Argv[1] = NULL\n");
|
Print (L"Argv[1] = NULL\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 1; Index < Argc; Index++) {
|
for (Index = 1; Index < Argc; Index++) {
|
||||||
Print (L"Argv[%d]: \"%s\"\n", Index, Argv[Index]);
|
Print (L"Argv[%d]: \"%s\"\n", Index, Argv[Index]);
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,19 @@
|
|||||||
**/
|
**/
|
||||||
INTN
|
INTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Test(CONST VOID *b1, CONST VOID *b2)
|
Test (
|
||||||
|
CONST VOID *b1,
|
||||||
|
CONST VOID *b2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (*(INTN *)b1 == *(INTN *)b2) {
|
if (*(INTN *)b1 == *(INTN *)b2) {
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(INTN *)b1 < *(INTN *)b2) {
|
if (*(INTN *)b1 < *(INTN *)b2) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,14 +93,23 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||||||
Display the trailing Verbose information.
|
Display the trailing Verbose information.
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
DumpStatistics( void )
|
DumpStatistics (
|
||||||
|
void
|
||||||
|
)
|
||||||
{
|
{
|
||||||
EFI_STRING StringPtr;
|
EFI_STRING StringPtr;
|
||||||
EFI_STRING StringPtrUnknown;
|
EFI_STRING StringPtrUnknown;
|
||||||
|
|
||||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL);
|
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL);
|
||||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||||
|
mDpHiiHandle,
|
||||||
|
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||||
|
);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMTRACE), mDpHiiHandle, SummaryData.NumTrace);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMTRACE), mDpHiiHandle, SummaryData.NumTrace);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMINCOMPLETE), mDpHiiHandle, SummaryData.NumIncomplete);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMINCOMPLETE), mDpHiiHandle, SummaryData.NumIncomplete);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPHASES), mDpHiiHandle, SummaryData.NumSummary);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPHASES), mDpHiiHandle, SummaryData.NumSummary);
|
||||||
@ -153,6 +162,7 @@ GetHandleFormModuleGuid (
|
|||||||
if (IsZeroGuid (ModuleGuid)) {
|
if (IsZeroGuid (ModuleGuid)) {
|
||||||
*Handle = NULL;
|
*Handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try to get the Handle from the cached array.
|
// Try to get the Handle from the cached array.
|
||||||
//
|
//
|
||||||
@ -162,6 +172,7 @@ GetHandleFormModuleGuid (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index >= mCachePairCount) {
|
if (Index >= mCachePairCount) {
|
||||||
*Handle = NULL;
|
*Handle = NULL;
|
||||||
}
|
}
|
||||||
@ -229,14 +240,15 @@ BuildCachedGuidHandleTable (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status) && LoadedImage != NULL) {
|
if (!EFI_ERROR (Status) && (LoadedImage != NULL)) {
|
||||||
//
|
//
|
||||||
// Get Module Guid from DevicePath.
|
// Get Module Guid from DevicePath.
|
||||||
//
|
//
|
||||||
if (LoadedImage->FilePath != NULL &&
|
if ((LoadedImage->FilePath != NULL) &&
|
||||||
LoadedImage->FilePath->Type == MEDIA_DEVICE_PATH &&
|
(LoadedImage->FilePath->Type == MEDIA_DEVICE_PATH) &&
|
||||||
LoadedImage->FilePath->SubType == MEDIA_PIWG_FW_FILE_DP
|
(LoadedImage->FilePath->SubType == MEDIA_PIWG_FW_FILE_DP)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)LoadedImage->FilePath;
|
FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)LoadedImage->FilePath;
|
||||||
TempGuid = &FvFilePath->FvFileName;
|
TempGuid = &FvFilePath->FvFileName;
|
||||||
|
|
||||||
@ -246,10 +258,12 @@ BuildCachedGuidHandleTable (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
FreePool (HandleBuffer);
|
FreePool (HandleBuffer);
|
||||||
HandleBuffer = NULL;
|
HandleBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,6 +294,7 @@ GetMeasurementInfo (
|
|||||||
} else {
|
} else {
|
||||||
Measurement->EndTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp;
|
Measurement->EndTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Measurement->Identifier) {
|
switch (Measurement->Identifier) {
|
||||||
case MODULE_START_ID:
|
case MODULE_START_ID:
|
||||||
case MODULE_END_ID:
|
case MODULE_END_ID:
|
||||||
@ -290,12 +305,13 @@ GetMeasurementInfo (
|
|||||||
Measurement->Token = ALit_START_IMAGE;
|
Measurement->Token = ALit_START_IMAGE;
|
||||||
Measurement->Module = ALit_START_IMAGE;
|
Measurement->Module = ALit_START_IMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Measurement->Token != NULL && AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0) {
|
if ((Measurement->Token != NULL) && (AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0)) {
|
||||||
Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
|
Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
|
||||||
} else {
|
} else {
|
||||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||||
@ -305,7 +321,7 @@ GetMeasurementInfo (
|
|||||||
// For start image, we need detect the PEIM and non PEIM here.
|
// For start image, we need detect the PEIM and non PEIM here.
|
||||||
//
|
//
|
||||||
if (Measurement->Token == NULL) {
|
if (Measurement->Token == NULL) {
|
||||||
if (StartHandle == NULL && !IsZeroGuid (ModuleGuid)) {
|
if ((StartHandle == NULL) && !IsZeroGuid (ModuleGuid)) {
|
||||||
Measurement->Token = ALit_PEIM;
|
Measurement->Token = ALit_PEIM;
|
||||||
Measurement->Module = ALit_PEIM;
|
Measurement->Module = ALit_PEIM;
|
||||||
Measurement->Handle = ModuleGuid;
|
Measurement->Handle = ModuleGuid;
|
||||||
@ -315,6 +331,7 @@ GetMeasurementInfo (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FPDT_DYNAMIC_STRING_EVENT_TYPE:
|
case FPDT_DYNAMIC_STRING_EVENT_TYPE:
|
||||||
@ -325,6 +342,7 @@ GetMeasurementInfo (
|
|||||||
} else {
|
} else {
|
||||||
Measurement->EndTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
Measurement->EndTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Measurement->Identifier) {
|
switch (Measurement->Identifier) {
|
||||||
case MODULE_START_ID:
|
case MODULE_START_ID:
|
||||||
case MODULE_END_ID:
|
case MODULE_END_ID:
|
||||||
@ -333,6 +351,7 @@ GetMeasurementInfo (
|
|||||||
} else if (mDxePhase) {
|
} else if (mDxePhase) {
|
||||||
Measurement->Token = ALit_START_IMAGE;
|
Measurement->Token = ALit_START_IMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MODULE_LOADIMAGE_START_ID:
|
case MODULE_LOADIMAGE_START_ID:
|
||||||
@ -362,7 +381,7 @@ GetMeasurementInfo (
|
|||||||
|
|
||||||
Measurement->Module = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->String;
|
Measurement->Module = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->String;
|
||||||
|
|
||||||
if (Measurement->Token != NULL && AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0) {
|
if ((Measurement->Token != NULL) && (AsciiStrCmp (Measurement->Token, ALit_PEIM) == 0)) {
|
||||||
Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
|
Measurement->Handle = &(((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Guid);
|
||||||
} else {
|
} else {
|
||||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||||
@ -371,8 +390,8 @@ GetMeasurementInfo (
|
|||||||
// When no perf entry to record the PEI and DXE phase,
|
// When no perf entry to record the PEI and DXE phase,
|
||||||
// For start image, we need detect the PEIM and non PEIM here.
|
// For start image, we need detect the PEIM and non PEIM here.
|
||||||
//
|
//
|
||||||
if (Measurement->Token == NULL && (Measurement->Identifier == MODULE_START_ID || Measurement->Identifier == MODULE_END_ID)) {
|
if ((Measurement->Token == NULL) && ((Measurement->Identifier == MODULE_START_ID) || (Measurement->Identifier == MODULE_END_ID))) {
|
||||||
if (StartHandle == NULL && !IsZeroGuid (ModuleGuid)) {
|
if ((StartHandle == NULL) && !IsZeroGuid (ModuleGuid)) {
|
||||||
Measurement->Token = ALit_PEIM;
|
Measurement->Token = ALit_PEIM;
|
||||||
Measurement->Handle = ModuleGuid;
|
Measurement->Handle = ModuleGuid;
|
||||||
} else {
|
} else {
|
||||||
@ -380,6 +399,7 @@ GetMeasurementInfo (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FPDT_GUID_QWORD_EVENT_TYPE:
|
case FPDT_GUID_QWORD_EVENT_TYPE:
|
||||||
@ -390,6 +410,7 @@ GetMeasurementInfo (
|
|||||||
} else {
|
} else {
|
||||||
Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp;
|
Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Measurement->Identifier) {
|
switch (Measurement->Identifier) {
|
||||||
case MODULE_DB_START_ID:
|
case MODULE_DB_START_ID:
|
||||||
Measurement->Token = ALit_DB_START;
|
Measurement->Token = ALit_DB_START;
|
||||||
@ -417,6 +438,7 @@ GetMeasurementInfo (
|
|||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||||
Measurement->Handle = StartHandle;
|
Measurement->Handle = StartHandle;
|
||||||
break;
|
break;
|
||||||
@ -429,6 +451,7 @@ GetMeasurementInfo (
|
|||||||
} else {
|
} else {
|
||||||
Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Currently only "DB:Start:" end record with FPDT_GUID_QWORD_STRING_EVENT_TYPE.
|
// Currently only "DB:Start:" end record with FPDT_GUID_QWORD_STRING_EVENT_TYPE.
|
||||||
//
|
//
|
||||||
@ -440,6 +463,7 @@ GetMeasurementInfo (
|
|||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||||
Measurement->Handle = StartHandle;
|
Measurement->Handle = StartHandle;
|
||||||
break;
|
break;
|
||||||
@ -452,6 +476,7 @@ GetMeasurementInfo (
|
|||||||
} else {
|
} else {
|
||||||
Measurement->EndTimeStamp = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
Measurement->EndTimeStamp = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
Measurement->Token = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String;
|
Measurement->Token = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String;
|
||||||
Measurement->Module = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String;
|
Measurement->Module = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String;
|
||||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||||
@ -478,25 +503,28 @@ SearchMeasurement (
|
|||||||
|
|
||||||
for (Index = mMeasurementNum - 1; Index >= 0; Index--) {
|
for (Index = mMeasurementNum - 1; Index >= 0; Index--) {
|
||||||
if (AsciiStrCmp (EndMeasureMent->Token, ALit_PEIM) == 0) {
|
if (AsciiStrCmp (EndMeasureMent->Token, ALit_PEIM) == 0) {
|
||||||
if (mMeasurementList[Index].EndTimeStamp == 0 && EndMeasureMent->Handle!= NULL && mMeasurementList[Index].Handle != NULL&&
|
if ((mMeasurementList[Index].EndTimeStamp == 0) && (EndMeasureMent->Handle != NULL) && (mMeasurementList[Index].Handle != NULL) &&
|
||||||
CompareGuid (mMeasurementList[Index].Handle, EndMeasureMent->Handle) &&
|
CompareGuid (mMeasurementList[Index].Handle, EndMeasureMent->Handle) &&
|
||||||
(AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
|
(AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
|
||||||
(AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0)) {
|
(AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0))
|
||||||
|
{
|
||||||
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
|
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (EndMeasureMent->Identifier == PERF_CROSSMODULE_END_ID) {
|
} else if (EndMeasureMent->Identifier == PERF_CROSSMODULE_END_ID) {
|
||||||
if (mMeasurementList[Index].EndTimeStamp == 0 &&
|
if ((mMeasurementList[Index].EndTimeStamp == 0) &&
|
||||||
(AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
|
(AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
|
||||||
(AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0) &&
|
(AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0) &&
|
||||||
mMeasurementList[Index].Identifier == PERF_CROSSMODULE_START_ID) {
|
(mMeasurementList[Index].Identifier == PERF_CROSSMODULE_START_ID))
|
||||||
|
{
|
||||||
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
|
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mMeasurementList[Index].EndTimeStamp == 0 && mMeasurementList[Index].Handle == EndMeasureMent->Handle &&
|
if ((mMeasurementList[Index].EndTimeStamp == 0) && (mMeasurementList[Index].Handle == EndMeasureMent->Handle) &&
|
||||||
(AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
|
(AsciiStrCmp (mMeasurementList[Index].Token, EndMeasureMent->Token) == 0) &&
|
||||||
(AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0)) {
|
(AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0))
|
||||||
|
{
|
||||||
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
|
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -540,8 +568,9 @@ BuildMeasurementList (
|
|||||||
if (StartProgressId == 0) {
|
if (StartProgressId == 0) {
|
||||||
GetMeasurementInfo (RecordHeader, FALSE, &(mMeasurementList[mMeasurementNum]));
|
GetMeasurementInfo (RecordHeader, FALSE, &(mMeasurementList[mMeasurementNum]));
|
||||||
mMeasurementNum++;
|
mMeasurementNum++;
|
||||||
} else if (((StartProgressId >= PERF_EVENTSIGNAL_START_ID && ((StartProgressId & 0x000F) == 0)) ||
|
} else if ((((StartProgressId >= PERF_EVENTSIGNAL_START_ID) && ((StartProgressId & 0x000F) == 0)) ||
|
||||||
(StartProgressId < PERF_EVENTSIGNAL_START_ID && ((StartProgressId & 0x0001) != 0)))) {
|
((StartProgressId < PERF_EVENTSIGNAL_START_ID) && ((StartProgressId & 0x0001) != 0))))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Since PEIM and StartImage has same Type and ID when PCD PcdEdkiiFpdtStringRecordEnableOnly = FALSE
|
// Since PEIM and StartImage has same Type and ID when PCD PcdEdkiiFpdtStringRecordEnableOnly = FALSE
|
||||||
// So we need to identify these two kinds of record through different phase.
|
// So we need to identify these two kinds of record through different phase.
|
||||||
@ -554,6 +583,7 @@ BuildMeasurementList (
|
|||||||
mPeiPhase = FALSE;
|
mPeiPhase = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get measurement info form the start record to the mMeasurementList.
|
// Get measurement info form the start record to the mMeasurementList.
|
||||||
GetMeasurementInfo (RecordHeader, TRUE, &(mMeasurementList[mMeasurementNum]));
|
GetMeasurementInfo (RecordHeader, TRUE, &(mMeasurementList[mMeasurementNum]));
|
||||||
mMeasurementNum++;
|
mMeasurementNum++;
|
||||||
@ -562,9 +592,11 @@ BuildMeasurementList (
|
|||||||
GetMeasurementInfo (RecordHeader, FALSE, &MeasureMent);
|
GetMeasurementInfo (RecordHeader, FALSE, &MeasureMent);
|
||||||
SearchMeasurement (&MeasureMent);
|
SearchMeasurement (&MeasureMent);
|
||||||
}
|
}
|
||||||
|
|
||||||
TableLength += RecordHeader->Length;
|
TableLength += RecordHeader->Length;
|
||||||
PerformanceTablePtr += RecordHeader->Length;
|
PerformanceTablePtr += RecordHeader->Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,13 +729,14 @@ RunDp (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_NO_RAW_ALL), mDpHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_NO_RAW_ALL), mDpHiiHandle);
|
||||||
return SHELL_INVALID_PARAMETER;
|
return SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ShellConvertStringToUint64 (CmdLineArg, &Intermediate, FALSE, TRUE);
|
Status = ShellConvertStringToUint64 (CmdLineArg, &Intermediate, FALSE, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_NUM_ARG), mDpHiiHandle, L"-n");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_NUM_ARG), mDpHiiHandle, L"-n");
|
||||||
return SHELL_INVALID_PARAMETER;
|
return SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
Number2Display = (UINTN)Intermediate;
|
Number2Display = (UINTN)Intermediate;
|
||||||
if (Number2Display == 0 || Number2Display > MAXIMUM_DISPLAYCOUNT) {
|
if ((Number2Display == 0) || (Number2Display > MAXIMUM_DISPLAYCOUNT)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_RANGE), mDpHiiHandle, L"-n", 0, MAXIMUM_DISPLAYCOUNT);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_RANGE), mDpHiiHandle, L"-n", 0, MAXIMUM_DISPLAYCOUNT);
|
||||||
return SHELL_INVALID_PARAMETER;
|
return SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -742,6 +775,7 @@ RunDp (
|
|||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomCumulativeData->MinDur = PERF_MAXDUR;
|
CustomCumulativeData->MinDur = PERF_MAXDUR;
|
||||||
CustomCumulativeData->MaxDur = 0;
|
CustomCumulativeData->MaxDur = 0;
|
||||||
CustomCumulativeData->Count = 0;
|
CustomCumulativeData->Count = 0;
|
||||||
@ -752,6 +786,7 @@ RunDp (
|
|||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);
|
UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -827,11 +862,19 @@ RunDp (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_KHZ), mDpHiiHandle, TimerInfo.Frequency);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_KHZ), mDpHiiHandle, TimerInfo.Frequency);
|
||||||
|
|
||||||
if (VerboseMode && !RawMode) {
|
if (VerboseMode && !RawMode) {
|
||||||
StringPtr = HiiGetString (mDpHiiHandle,
|
StringPtr = HiiGetString (
|
||||||
(EFI_STRING_ID) (TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)), NULL);
|
mDpHiiHandle,
|
||||||
|
(EFI_STRING_ID)(TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
ASSERT (StringPtr != NULL);
|
ASSERT (StringPtr != NULL);
|
||||||
// Print Timer count range and direction
|
// Print Timer count range and direction
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TIMER_PROPERTIES), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_TIMER_PROPERTIES),
|
||||||
|
mDpHiiHandle,
|
||||||
StringPtr,
|
StringPtr,
|
||||||
TimerInfo.StartCount,
|
TimerInfo.StartCount,
|
||||||
TimerInfo.EndCount
|
TimerInfo.EndCount
|
||||||
@ -893,6 +936,7 @@ RunDp (
|
|||||||
ProcessCumulative (NULL);
|
ProcessCumulative (NULL);
|
||||||
}
|
}
|
||||||
} // ------------- End of Cooked Mode Processing
|
} // ------------- End of Cooked Mode Processing
|
||||||
|
|
||||||
if ( VerboseMode || SummaryMode) {
|
if ( VerboseMode || SummaryMode) {
|
||||||
DumpStatistics ();
|
DumpStatistics ();
|
||||||
}
|
}
|
||||||
@ -901,10 +945,12 @@ Done:
|
|||||||
if (ParamPackage != NULL) {
|
if (ParamPackage != NULL) {
|
||||||
ShellCommandLineFreeVarList (ParamPackage);
|
ShellCommandLineFreeVarList (ParamPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (StringPtr);
|
SHELL_FREE_NON_NULL (StringPtr);
|
||||||
if (CustomCumulativeData != NULL) {
|
if (CustomCumulativeData != NULL) {
|
||||||
SHELL_FREE_NON_NULL (CustomCumulativeData->Name);
|
SHELL_FREE_NON_NULL (CustomCumulativeData->Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (CustomCumulativeData);
|
SHELL_FREE_NON_NULL (CustomCumulativeData);
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (mMeasurementList);
|
SHELL_FREE_NON_NULL (mMeasurementList);
|
||||||
@ -916,7 +962,6 @@ Done:
|
|||||||
return ShellStatus;
|
return ShellStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieve HII package list from ImageHandle and publish to HII database.
|
Retrieve HII package list from ImageHandle and publish to HII database.
|
||||||
|
|
||||||
@ -962,5 +1007,6 @@ InitializeHiiPackage (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HiiHandle;
|
return HiiHandle;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#ifndef _DP_H_
|
#ifndef _DP_H_
|
||||||
#define _DP_H_
|
#define _DP_H_
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#include <Guid/Performance.h>
|
#include <Guid/Performance.h>
|
||||||
@ -137,4 +136,5 @@ EFI_HII_HANDLE
|
|||||||
InitializeHiiPackage (
|
InitializeHiiPackage (
|
||||||
EFI_HANDLE ImageHandle
|
EFI_HANDLE ImageHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // _DP_H_
|
#endif // _DP_H_
|
||||||
|
@ -36,6 +36,7 @@ DpAppInitialize (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
mDpHiiHandle = InitializeHiiPackage (ImageHandle);
|
mDpHiiHandle = InitializeHiiPackage (ImageHandle);
|
||||||
if (mDpHiiHandle == NULL) {
|
if (mDpHiiHandle == NULL) {
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
|
@ -82,6 +82,7 @@ DpCommandInitialize (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
mDpHiiHandle = InitializeHiiPackage (ImageHandle);
|
mDpHiiHandle = InitializeHiiPackage (ImageHandle);
|
||||||
if (mDpHiiHandle == NULL) {
|
if (mDpHiiHandle == NULL) {
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
@ -112,6 +113,7 @@ DpUnload (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = gBS->UninstallProtocolInterface (
|
Status = gBS->UninstallProtocolInterface (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
&gEfiShellDynamicCommandProtocolGuid,
|
&gEfiShellDynamicCommandProtocolGuid,
|
||||||
@ -120,6 +122,7 @@ DpUnload (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
HiiRemovePackages (mDpHiiHandle);
|
HiiRemovePackages (mDpHiiHandle);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _DP_INTELNAL_H_
|
#ifndef _DP_INTELNAL_H_
|
||||||
#define _DP_INTELNAL_H_
|
#define _DP_INTELNAL_H_
|
||||||
|
|
||||||
@ -251,7 +252,6 @@ ProcessPhases(
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gather and print Handle data.
|
Gather and print Handle data.
|
||||||
|
|
||||||
@ -266,7 +266,6 @@ ProcessHandles(
|
|||||||
IN BOOLEAN ExcludeFlag
|
IN BOOLEAN ExcludeFlag
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gather and print PEIM data.
|
Gather and print PEIM data.
|
||||||
|
|
||||||
|
@ -106,7 +106,8 @@ GatherStatistics(
|
|||||||
&Measurement.Module,
|
&Measurement.Module,
|
||||||
&Measurement.StartTimeStamp,
|
&Measurement.StartTimeStamp,
|
||||||
&Measurement.EndTimeStamp,
|
&Measurement.EndTimeStamp,
|
||||||
&Measurement.Identifier)) != 0)
|
&Measurement.Identifier
|
||||||
|
)) != 0)
|
||||||
{
|
{
|
||||||
++SummaryData.NumTrace; // Count the number of TRACE Measurement records
|
++SummaryData.NumTrace; // Count the number of TRACE Measurement records
|
||||||
if (Measurement.EndTimeStamp == 0) {
|
if (Measurement.EndTimeStamp == 0) {
|
||||||
@ -120,8 +121,8 @@ GatherStatistics(
|
|||||||
|
|
||||||
if (IsPhase (&Measurement)) {
|
if (IsPhase (&Measurement)) {
|
||||||
++SummaryData.NumSummary; // Count the number of major phases
|
++SummaryData.NumSummary; // Count the number of major phases
|
||||||
}
|
} else {
|
||||||
else { // !IsPhase
|
// !IsPhase
|
||||||
if (Measurement.Handle == NULL) {
|
if (Measurement.Handle == NULL) {
|
||||||
++SummaryData.NumGlobal;
|
++SummaryData.NumGlobal;
|
||||||
}
|
}
|
||||||
@ -139,6 +140,7 @@ GatherStatistics(
|
|||||||
if ( Duration < CumData[TIndex].MinDur ) {
|
if ( Duration < CumData[TIndex].MinDur ) {
|
||||||
CumData[TIndex].MinDur = Duration;
|
CumData[TIndex].MinDur = Duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Duration > CumData[TIndex].MaxDur ) {
|
if ( Duration > CumData[TIndex].MaxDur ) {
|
||||||
CumData[TIndex].MaxDur = Duration;
|
CumData[TIndex].MaxDur = Duration;
|
||||||
}
|
}
|
||||||
@ -153,6 +155,7 @@ GatherStatistics(
|
|||||||
if (Duration < CustomCumulativeData->MinDur) {
|
if (Duration < CustomCumulativeData->MinDur) {
|
||||||
CustomCumulativeData->MinDur = Duration;
|
CustomCumulativeData->MinDur = Duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Duration > CustomCumulativeData->MaxDur) {
|
if (Duration > CustomCumulativeData->MaxDur) {
|
||||||
CustomCumulativeData->MaxDur = Duration;
|
CustomCumulativeData->MaxDur = Duration;
|
||||||
}
|
}
|
||||||
@ -203,8 +206,14 @@ DumpAllTrace(
|
|||||||
|
|
||||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||||
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL);
|
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
(IncFlag == NULL) ? StringPtrUnknown : IncFlag);
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||||
|
mDpHiiHandle,
|
||||||
|
(IncFlag == NULL) ? StringPtrUnknown : IncFlag
|
||||||
|
);
|
||||||
FreePool (StringPtrUnknown);
|
FreePool (StringPtrUnknown);
|
||||||
|
|
||||||
// Get Handle information
|
// Get Handle information
|
||||||
@ -212,8 +221,7 @@ DumpAllTrace(
|
|||||||
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);
|
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// We have successfully populated the HandleBuffer
|
// We have successfully populated the HandleBuffer
|
||||||
// Display ALL Measurement Records
|
// Display ALL Measurement Records
|
||||||
// Up to Limit lines displayed
|
// Up to Limit lines displayed
|
||||||
@ -239,7 +247,8 @@ DumpAllTrace(
|
|||||||
&Measurement.Module,
|
&Measurement.Module,
|
||||||
&Measurement.StartTimeStamp,
|
&Measurement.StartTimeStamp,
|
||||||
&Measurement.EndTimeStamp,
|
&Measurement.EndTimeStamp,
|
||||||
&Measurement.Identifier)) != 0)
|
&Measurement.Identifier
|
||||||
|
)) != 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
++Index; // Count every record. First record is 1.
|
++Index; // Count every record. First record is 1.
|
||||||
@ -249,15 +258,17 @@ DumpAllTrace(
|
|||||||
Duration = GetDuration (&Measurement);
|
Duration = GetDuration (&Measurement);
|
||||||
ElapsedTime = DurationInMicroSeconds (Duration);
|
ElapsedTime = DurationInMicroSeconds (Duration);
|
||||||
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);
|
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_INCOMPLETE), NULL); // Mark incomplete records
|
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_INCOMPLETE), NULL); // Mark incomplete records
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((Measurement.EndTimeStamp != 0) && (ElapsedTime < mInterestThreshold)) ||
|
if (((Measurement.EndTimeStamp != 0) && (ElapsedTime < mInterestThreshold)) ||
|
||||||
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
||||||
) { // Ignore "uninteresting" or excluded records
|
) // Ignore "uninteresting" or excluded records
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
++Count; // Count the number of records printed
|
++Count; // Count the number of records printed
|
||||||
|
|
||||||
// If Handle is non-zero, see if we can determine a name for the driver
|
// If Handle is non-zero, see if we can determine a name for the driver
|
||||||
@ -282,7 +293,12 @@ DumpAllTrace(
|
|||||||
mUnicodeToken[13] = 0;
|
mUnicodeToken[13] = 0;
|
||||||
|
|
||||||
if (mShowId) {
|
if (mShowId) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS2), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_ALL_VARS2),
|
||||||
|
mDpHiiHandle,
|
||||||
Index, // 1 based, Which measurement record is being printed
|
Index, // 1 based, Which measurement record is being printed
|
||||||
IncFlag,
|
IncFlag,
|
||||||
Measurement.Handle,
|
Measurement.Handle,
|
||||||
@ -292,7 +308,12 @@ DumpAllTrace(
|
|||||||
Measurement.Identifier
|
Measurement.Identifier
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_ALL_VARS),
|
||||||
|
mDpHiiHandle,
|
||||||
Index, // 1 based, Which measurement record is being printed
|
Index, // 1 based, Which measurement record is being printed
|
||||||
IncFlag,
|
IncFlag,
|
||||||
Measurement.Handle,
|
Measurement.Handle,
|
||||||
@ -301,15 +322,18 @@ DumpAllTrace(
|
|||||||
ElapsedTime
|
ElapsedTime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellGetExecutionBreakFlag ()) {
|
if (ShellGetExecutionBreakFlag ()) {
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
FreePool (HandleBuffer);
|
FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (IncFlag);
|
SHELL_FREE_NON_NULL (IncFlag);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
@ -356,8 +380,14 @@ DumpRawTrace(
|
|||||||
|
|
||||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);
|
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||||
|
mDpHiiHandle,
|
||||||
|
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||||
|
);
|
||||||
FreePool (StringPtr);
|
FreePool (StringPtr);
|
||||||
FreePool (StringPtrUnknown);
|
FreePool (StringPtrUnknown);
|
||||||
|
|
||||||
@ -380,7 +410,8 @@ DumpRawTrace(
|
|||||||
&Measurement.Module,
|
&Measurement.Module,
|
||||||
&Measurement.StartTimeStamp,
|
&Measurement.StartTimeStamp,
|
||||||
&Measurement.EndTimeStamp,
|
&Measurement.EndTimeStamp,
|
||||||
&Measurement.Identifier)) != 0)
|
&Measurement.Identifier
|
||||||
|
)) != 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
++Index; // Count every record. First record is 1.
|
++Index; // Count every record. First record is 1.
|
||||||
@ -389,15 +420,23 @@ DumpRawTrace(
|
|||||||
Duration = GetDuration (&Measurement);
|
Duration = GetDuration (&Measurement);
|
||||||
ElapsedTime = DurationInMicroSeconds (Duration);
|
ElapsedTime = DurationInMicroSeconds (Duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ElapsedTime < mInterestThreshold) ||
|
if ((ElapsedTime < mInterestThreshold) ||
|
||||||
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
||||||
) { // Ignore "uninteresting" or Excluded records
|
) // Ignore "uninteresting" or Excluded records
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
++Count; // Count the number of records printed
|
++Count; // Count the number of records printed
|
||||||
|
|
||||||
if (mShowId) {
|
if (mShowId) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS2), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_RAW_VARS2),
|
||||||
|
mDpHiiHandle,
|
||||||
Index, // 1 based, Which measurement record is being printed
|
Index, // 1 based, Which measurement record is being printed
|
||||||
Measurement.Handle,
|
Measurement.Handle,
|
||||||
Measurement.StartTimeStamp,
|
Measurement.StartTimeStamp,
|
||||||
@ -407,7 +446,12 @@ DumpRawTrace(
|
|||||||
Measurement.Identifier
|
Measurement.Identifier
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_RAW_VARS),
|
||||||
|
mDpHiiHandle,
|
||||||
Index, // 1 based, Which measurement record is being printed
|
Index, // 1 based, Which measurement record is being printed
|
||||||
Measurement.Handle,
|
Measurement.Handle,
|
||||||
Measurement.StartTimeStamp,
|
Measurement.StartTimeStamp,
|
||||||
@ -416,11 +460,13 @@ DumpRawTrace(
|
|||||||
Measurement.Module
|
Measurement.Module
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellGetExecutionBreakFlag ()) {
|
if (ShellGetExecutionBreakFlag ()) {
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,8 +502,14 @@ ProcessPhases(
|
|||||||
//
|
//
|
||||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL);
|
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||||
|
mDpHiiHandle,
|
||||||
|
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||||
|
);
|
||||||
FreePool (StringPtr);
|
FreePool (StringPtr);
|
||||||
FreePool (StringPtrUnknown);
|
FreePool (StringPtrUnknown);
|
||||||
|
|
||||||
@ -469,13 +521,16 @@ ProcessPhases(
|
|||||||
&Measurement.Module,
|
&Measurement.Module,
|
||||||
&Measurement.StartTimeStamp,
|
&Measurement.StartTimeStamp,
|
||||||
&Measurement.EndTimeStamp,
|
&Measurement.EndTimeStamp,
|
||||||
&Measurement.Identifier)) != 0)
|
&Measurement.Identifier
|
||||||
|
)) != 0)
|
||||||
{
|
{
|
||||||
if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
|
if (Measurement.EndTimeStamp == 0) {
|
||||||
|
// Skip "incomplete" records
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration = GetDuration (&Measurement);
|
Duration = GetDuration (&Measurement);
|
||||||
if ( Measurement.Handle != NULL
|
if ( (Measurement.Handle != NULL)
|
||||||
&& (AsciiStrCmp (Measurement.Token, ALit_BdsTO) == 0)
|
&& (AsciiStrCmp (Measurement.Token, ALit_BdsTO) == 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -561,16 +616,21 @@ ProcessHandles(
|
|||||||
|
|
||||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL);
|
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||||
|
mDpHiiHandle,
|
||||||
|
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||||
|
);
|
||||||
FreePool (StringPtr);
|
FreePool (StringPtr);
|
||||||
FreePool (StringPtrUnknown);
|
FreePool (StringPtrUnknown);
|
||||||
|
|
||||||
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);
|
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
#if DP_DEBUG == 2
|
#if DP_DEBUG == 2
|
||||||
Print (L"There are %,d Handles defined.\n", (Size / sizeof (HandleBuffer[0])));
|
Print (L"There are %,d Handles defined.\n", (Size / sizeof (HandleBuffer[0])));
|
||||||
#endif
|
#endif
|
||||||
@ -580,6 +640,7 @@ ProcessHandles(
|
|||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION), mDpHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION), mDpHiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
||||||
|
|
||||||
LogEntryKey = 0;
|
LogEntryKey = 0;
|
||||||
@ -591,7 +652,8 @@ ProcessHandles(
|
|||||||
&Measurement.Module,
|
&Measurement.Module,
|
||||||
&Measurement.StartTimeStamp,
|
&Measurement.StartTimeStamp,
|
||||||
&Measurement.EndTimeStamp,
|
&Measurement.EndTimeStamp,
|
||||||
&Measurement.Identifier)) != 0)
|
&Measurement.Identifier
|
||||||
|
)) != 0)
|
||||||
{
|
{
|
||||||
Count++;
|
Count++;
|
||||||
Duration = GetDuration (&Measurement);
|
Duration = GetDuration (&Measurement);
|
||||||
@ -600,9 +662,11 @@ ProcessHandles(
|
|||||||
(Measurement.EndTimeStamp == 0) ||
|
(Measurement.EndTimeStamp == 0) ||
|
||||||
(!IsCorePerf (&Measurement)) ||
|
(!IsCorePerf (&Measurement)) ||
|
||||||
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
||||||
) { // Ignore "uninteresting" or excluded records
|
) // Ignore "uninteresting" or excluded records
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mGaugeString[0] = 0; // Empty driver name by default
|
mGaugeString[0] = 0; // Empty driver name by default
|
||||||
AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));
|
AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));
|
||||||
// See if the Handle is in the HandleBuffer
|
// See if the Handle is in the HandleBuffer
|
||||||
@ -612,13 +676,19 @@ ProcessHandles(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the argument strings are not too long.
|
// Ensure that the argument strings are not too long.
|
||||||
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
|
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
|
||||||
mUnicodeToken[11] = 0;
|
mUnicodeToken[11] = 0;
|
||||||
if (mGaugeString[0] != 0) {
|
if (mGaugeString[0] != 0) {
|
||||||
// Display the record if it has a valid handle.
|
// Display the record if it has a valid handle.
|
||||||
if (mShowId) {
|
if (mShowId) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS2), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_HANDLE_VARS2),
|
||||||
|
mDpHiiHandle,
|
||||||
Count, // 1 based, Which measurement record is being printed
|
Count, // 1 based, Which measurement record is being printed
|
||||||
Index + 1, // 1 based, Which handle is being printed
|
Index + 1, // 1 based, Which handle is being printed
|
||||||
mGaugeString,
|
mGaugeString,
|
||||||
@ -627,7 +697,12 @@ ProcessHandles(
|
|||||||
Measurement.Identifier
|
Measurement.Identifier
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_HANDLE_VARS),
|
||||||
|
mDpHiiHandle,
|
||||||
Count, // 1 based, Which measurement record is being printed
|
Count, // 1 based, Which measurement record is being printed
|
||||||
Index + 1, // 1 based, Which handle is being printed
|
Index + 1, // 1 based, Which handle is being printed
|
||||||
mGaugeString,
|
mGaugeString,
|
||||||
@ -636,15 +711,18 @@ ProcessHandles(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellGetExecutionBreakFlag ()) {
|
if (ShellGetExecutionBreakFlag ()) {
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
FreePool (HandleBuffer);
|
FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,8 +752,14 @@ ProcessPeims(
|
|||||||
|
|
||||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);
|
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||||
|
mDpHiiHandle,
|
||||||
|
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||||
|
);
|
||||||
FreePool (StringPtr);
|
FreePool (StringPtr);
|
||||||
FreePool (StringPtrUnknown);
|
FreePool (StringPtrUnknown);
|
||||||
|
|
||||||
@ -684,6 +768,7 @@ ProcessPeims(
|
|||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), mDpHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), mDpHiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
||||||
TIndex = 0;
|
TIndex = 0;
|
||||||
LogEntryKey = 0;
|
LogEntryKey = 0;
|
||||||
@ -694,12 +779,14 @@ ProcessPeims(
|
|||||||
&Measurement.Module,
|
&Measurement.Module,
|
||||||
&Measurement.StartTimeStamp,
|
&Measurement.StartTimeStamp,
|
||||||
&Measurement.EndTimeStamp,
|
&Measurement.EndTimeStamp,
|
||||||
&Measurement.Identifier)) != 0)
|
&Measurement.Identifier
|
||||||
|
)) != 0)
|
||||||
{
|
{
|
||||||
TIndex++;
|
TIndex++;
|
||||||
if ((Measurement.EndTimeStamp == 0) ||
|
if ((Measurement.EndTimeStamp == 0) ||
|
||||||
(AsciiStrCmp (Measurement.Token, ALit_PEIM) != 0)
|
(AsciiStrCmp (Measurement.Token, ALit_PEIM) != 0)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -708,25 +795,37 @@ ProcessPeims(
|
|||||||
if (ElapsedTime >= mInterestThreshold) {
|
if (ElapsedTime >= mInterestThreshold) {
|
||||||
// PEIM FILE Handle is the start address of its FFS file that contains its file guid.
|
// PEIM FILE Handle is the start address of its FFS file that contains its file guid.
|
||||||
if (mShowId) {
|
if (mShowId) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS2), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_PEIM_VARS2),
|
||||||
|
mDpHiiHandle,
|
||||||
TIndex, // 1 based, Which measurement record is being printed
|
TIndex, // 1 based, Which measurement record is being printed
|
||||||
Measurement.Handle, // file guid
|
Measurement.Handle, // file guid
|
||||||
ElapsedTime,
|
ElapsedTime,
|
||||||
Measurement.Identifier
|
Measurement.Identifier
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_PEIM_VARS),
|
||||||
|
mDpHiiHandle,
|
||||||
TIndex, // 1 based, Which measurement record is being printed
|
TIndex, // 1 based, Which measurement record is being printed
|
||||||
Measurement.Handle, // file guid
|
Measurement.Handle, // file guid
|
||||||
ElapsedTime
|
ElapsedTime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellGetExecutionBreakFlag ()) {
|
if (ShellGetExecutionBreakFlag ()) {
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,8 +858,14 @@ ProcessGlobal(
|
|||||||
|
|
||||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);
|
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
(StringPtr == NULL) ? StringPtrUnknown: StringPtr);
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||||
|
mDpHiiHandle,
|
||||||
|
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||||
|
);
|
||||||
FreePool (StringPtr);
|
FreePool (StringPtr);
|
||||||
FreePool (StringPtrUnknown);
|
FreePool (StringPtrUnknown);
|
||||||
|
|
||||||
@ -769,6 +874,7 @@ ProcessGlobal(
|
|||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), mDpHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), mDpHiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
||||||
|
|
||||||
Index = 1;
|
Index = 1;
|
||||||
@ -781,7 +887,8 @@ ProcessGlobal(
|
|||||||
&Measurement.Module,
|
&Measurement.Module,
|
||||||
&Measurement.StartTimeStamp,
|
&Measurement.StartTimeStamp,
|
||||||
&Measurement.EndTimeStamp,
|
&Measurement.EndTimeStamp,
|
||||||
&Measurement.Identifier)) != 0)
|
&Measurement.Identifier
|
||||||
|
)) != 0)
|
||||||
{
|
{
|
||||||
AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE (mGaugeString));
|
AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE (mGaugeString));
|
||||||
AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));
|
AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));
|
||||||
@ -796,7 +903,12 @@ ProcessGlobal(
|
|||||||
ElapsedTime = DurationInMicroSeconds (Duration);
|
ElapsedTime = DurationInMicroSeconds (Duration);
|
||||||
if (ElapsedTime >= mInterestThreshold) {
|
if (ElapsedTime >= mInterestThreshold) {
|
||||||
if (mShowId) {
|
if (mShowId) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS2), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_GLOBAL_VARS2),
|
||||||
|
mDpHiiHandle,
|
||||||
Index,
|
Index,
|
||||||
mGaugeString,
|
mGaugeString,
|
||||||
mUnicodeToken,
|
mUnicodeToken,
|
||||||
@ -804,7 +916,12 @@ ProcessGlobal(
|
|||||||
Measurement.Identifier
|
Measurement.Identifier
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_GLOBAL_VARS),
|
||||||
|
mDpHiiHandle,
|
||||||
Index,
|
Index,
|
||||||
mGaugeString,
|
mGaugeString,
|
||||||
mUnicodeToken,
|
mUnicodeToken,
|
||||||
@ -813,12 +930,15 @@ ProcessGlobal(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellGetExecutionBreakFlag ()) {
|
if (ShellGetExecutionBreakFlag ()) {
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,8 +968,14 @@ ProcessCumulative(
|
|||||||
|
|
||||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL);
|
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
(StringPtr == NULL) ? StringPtrUnknown: StringPtr);
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||||
|
mDpHiiHandle,
|
||||||
|
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||||
|
);
|
||||||
FreePool (StringPtr);
|
FreePool (StringPtr);
|
||||||
FreePool (StringPtrUnknown);
|
FreePool (StringPtrUnknown);
|
||||||
|
|
||||||
@ -865,7 +991,12 @@ ProcessCumulative(
|
|||||||
MaxDur = DurationInMicroSeconds (CumData[TIndex].MaxDur);
|
MaxDur = DurationInMicroSeconds (CumData[TIndex].MaxDur);
|
||||||
MinDur = DurationInMicroSeconds (CumData[TIndex].MinDur);
|
MinDur = DurationInMicroSeconds (CumData[TIndex].MinDur);
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), mDpHiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_CUMULATIVE_STATS),
|
||||||
|
mDpHiiHandle,
|
||||||
CumData[TIndex].Name,
|
CumData[TIndex].Name,
|
||||||
CumData[TIndex].Count,
|
CumData[TIndex].Count,
|
||||||
Dur,
|
Dur,
|
||||||
@ -892,7 +1023,13 @@ ProcessCumulative(
|
|||||||
MaxDur = 0;
|
MaxDur = 0;
|
||||||
MinDur = 0;
|
MinDur = 0;
|
||||||
}
|
}
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), mDpHiiHandle,
|
|
||||||
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DP_CUMULATIVE_STATS),
|
||||||
|
mDpHiiHandle,
|
||||||
CustomCumulativeData->Name,
|
CustomCumulativeData->Name,
|
||||||
CustomCumulativeData->Count,
|
CustomCumulativeData->Count,
|
||||||
Dur,
|
Dur,
|
||||||
|
@ -72,6 +72,7 @@ GetDuration (
|
|||||||
DEBUG ((DEBUG_ERROR, ALit_TimerLibError));
|
DEBUG ((DEBUG_ERROR, ALit_TimerLibError));
|
||||||
Duration = 0;
|
Duration = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Duration;
|
return Duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,8 +163,9 @@ DpGetShortPdbFileName (
|
|||||||
StrnCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ", 1);
|
StrnCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ", 1);
|
||||||
} else {
|
} else {
|
||||||
StartIndex = 0;
|
StartIndex = 0;
|
||||||
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
|
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++) {
|
||||||
;
|
}
|
||||||
|
|
||||||
for (IndexA = 0; PdbFileName[IndexA] != 0; IndexA++) {
|
for (IndexA = 0; PdbFileName[IndexA] != 0; IndexA++) {
|
||||||
if ((PdbFileName[IndexA] == '\\') || (PdbFileName[IndexA] == '/')) {
|
if ((PdbFileName[IndexA] == '\\') || (PdbFileName[IndexA] == '/')) {
|
||||||
StartIndex = IndexA + 1;
|
StartIndex = IndexA + 1;
|
||||||
@ -317,6 +319,7 @@ DpGetNameFromHandle (
|
|||||||
if (NameGuid != NULL) {
|
if (NameGuid != NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DevicePath = NextDevicePathNode (DevicePath);
|
DevicePath = NextDevicePathNode (DevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,6 +350,7 @@ DpGetNameFromHandle (
|
|||||||
//
|
//
|
||||||
UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);
|
UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
@ -417,6 +421,7 @@ GetCumulativeItem(
|
|||||||
return Index; // Exit, we found a match
|
return Index; // Exit, we found a match
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the for loop exits, Token was not found.
|
// If the for loop exits, Token was not found.
|
||||||
return -1; // Indicate failure
|
return -1; // Indicate failure
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _LITERALS_H_
|
#ifndef _LITERALS_H_
|
||||||
#define _LITERALS_H_
|
#define _LITERALS_H_
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ TrimSpaces (
|
|||||||
//
|
//
|
||||||
do {
|
do {
|
||||||
Len = StrLen (Str);
|
Len = StrLen (Str);
|
||||||
if (!Len || (Str[Len - 1] != L' ' && Str[Len - 1] != '\t')) {
|
if (!Len || ((Str[Len - 1] != L' ') && (Str[Len - 1] != '\t'))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +629,8 @@ RunHttp (
|
|||||||
Walker = RemoteFilePath + StrLen (RemoteFilePath);
|
Walker = RemoteFilePath + StrLen (RemoteFilePath);
|
||||||
while ((--Walker) >= RemoteFilePath) {
|
while ((--Walker) >= RemoteFilePath) {
|
||||||
if ((*Walker == L'\\') ||
|
if ((*Walker == L'\\') ||
|
||||||
(*Walker == L'/' ) ) {
|
(*Walker == L'/'))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -674,7 +675,7 @@ RunHttp (
|
|||||||
ValueStr = ShellCommandLineGetValue (CheckPackage, L"-s");
|
ValueStr = ShellCommandLineGetValue (CheckPackage, L"-s");
|
||||||
if (ValueStr != NULL) {
|
if (ValueStr != NULL) {
|
||||||
Context.BufferSize = ShellStrToUintn (ValueStr);
|
Context.BufferSize = ShellStrToUintn (ValueStr);
|
||||||
if (!Context.BufferSize || Context.BufferSize > MAX_BUF_SIZE) {
|
if (!Context.BufferSize || (Context.BufferSize > MAX_BUF_SIZE)) {
|
||||||
PRINT_HII_APP (STRING_TOKEN (STR_GEN_PARAM_INV), ValueStr);
|
PRINT_HII_APP (STRING_TOKEN (STR_GEN_PARAM_INV), ValueStr);
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
@ -1023,7 +1024,7 @@ WaitForCompletion (
|
|||||||
{
|
{
|
||||||
Status = Context->Http->Poll (Context->Http);
|
Status = Context->Http->Poll (Context->Http);
|
||||||
if ( !Context->ContentDownloaded
|
if ( !Context->ContentDownloaded
|
||||||
&& CallBackComplete == &gResponseCallbackComplete)
|
&& (CallBackComplete == &gResponseCallbackComplete))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// An HTTP server may just send a response redirection header.
|
// An HTTP server may just send a response redirection header.
|
||||||
@ -1265,7 +1266,6 @@ SavePortion (
|
|||||||
NbOfKb
|
NbOfKb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
ShellPrintEx (-1, -1, L"%s", Progress);
|
ShellPrintEx (-1, -1, L"%s", Progress);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -1476,7 +1476,6 @@ ParseMsg (
|
|||||||
return SavePortion (Context, Length, Data);
|
return SavePortion (Context, Length, Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get HTTP server response and collect the whole body as a file.
|
Get HTTP server response and collect the whole body as a file.
|
||||||
Set appropriate status in Context (REQ_OK, REQ_REPEAT, REQ_ERROR).
|
Set appropriate status in Context (REQ_OK, REQ_REPEAT, REQ_ERROR).
|
||||||
@ -1642,7 +1641,7 @@ GetResponse (
|
|||||||
|
|
||||||
HttpGetEntityLength (MsgParser, &Context->ContentLength);
|
HttpGetEntityLength (MsgParser, &Context->ContentLength);
|
||||||
|
|
||||||
if (ResponseData.StatusCode >= HTTP_STATUS_400_BAD_REQUEST
|
if ( (ResponseData.StatusCode >= HTTP_STATUS_400_BAD_REQUEST)
|
||||||
&& (ResponseData.StatusCode != HTTP_STATUS_308_PERMANENT_REDIRECT))
|
&& (ResponseData.StatusCode != HTTP_STATUS_308_PERMANENT_REDIRECT))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@ -1684,8 +1683,8 @@ GetResponse (
|
|||||||
&& !EFI_ERROR (Status)
|
&& !EFI_ERROR (Status)
|
||||||
&& ResponseMessage.BodyLength);
|
&& ResponseMessage.BodyLength);
|
||||||
|
|
||||||
if (Context->Status != REQ_NEED_REPEAT
|
if ( (Context->Status != REQ_NEED_REPEAT)
|
||||||
&& Status == EFI_SUCCESS
|
&& (Status == EFI_SUCCESS)
|
||||||
&& CanMeasureTime)
|
&& CanMeasureTime)
|
||||||
{
|
{
|
||||||
if (!EFI_ERROR (gRT->GetTime (&EndTime, NULL))) {
|
if (!EFI_ERROR (gRT->GetTime (&EndTime, NULL))) {
|
||||||
@ -1814,7 +1813,8 @@ DownloadFile (
|
|||||||
&DownloadUrl,
|
&DownloadUrl,
|
||||||
&UrlSize,
|
&UrlSize,
|
||||||
Context->Uri,
|
Context->Uri,
|
||||||
StrLen (Context->Uri));
|
StrLen (Context->Uri)
|
||||||
|
);
|
||||||
|
|
||||||
PRINT_HII (STRING_TOKEN (STR_HTTP_DOWNLOADING), DownloadUrl);
|
PRINT_HII (STRING_TOKEN (STR_HTTP_DOWNLOADING), DownloadUrl);
|
||||||
|
|
||||||
@ -1828,7 +1828,6 @@ DownloadFile (
|
|||||||
if (Status) {
|
if (Status) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (Context->Status == REQ_NEED_REPEAT);
|
} while (Context->Status == REQ_NEED_REPEAT);
|
||||||
|
|
||||||
if (Context->Status) {
|
if (Context->Status) {
|
||||||
|
@ -89,4 +89,5 @@ EFI_HII_HANDLE
|
|||||||
InitializeHiiPackage (
|
InitializeHiiPackage (
|
||||||
IN EFI_HANDLE ImageHandle
|
IN EFI_HANDLE ImageHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // _HTTP_H_
|
#endif // _HTTP_H_
|
||||||
|
@ -208,11 +208,19 @@ CheckPacket (
|
|||||||
|
|
||||||
EFI_MTFTP4_CONFIG_DATA DefaultMtftp4ConfigData = {
|
EFI_MTFTP4_CONFIG_DATA DefaultMtftp4ConfigData = {
|
||||||
TRUE, // Use default setting
|
TRUE, // Use default setting
|
||||||
{ { 0, 0, 0, 0 } }, // StationIp - Not relevant as UseDefaultSetting=TRUE
|
{
|
||||||
{ { 0, 0, 0, 0 } }, // SubnetMask - Not relevant as UseDefaultSetting=TRUE
|
{ 0, 0, 0, 0 }
|
||||||
|
}, // StationIp - Not relevant as UseDefaultSetting=TRUE
|
||||||
|
{
|
||||||
|
{ 0, 0, 0, 0 }
|
||||||
|
}, // SubnetMask - Not relevant as UseDefaultSetting=TRUE
|
||||||
0, // LocalPort - Automatically assigned port number.
|
0, // LocalPort - Automatically assigned port number.
|
||||||
{ { 0, 0, 0, 0 } }, // GatewayIp - Not relevant as UseDefaultSetting=TRUE
|
{
|
||||||
{ { 0, 0, 0, 0 } }, // ServerIp - Not known yet
|
{ 0, 0, 0, 0 }
|
||||||
|
}, // GatewayIp - Not relevant as UseDefaultSetting=TRUE
|
||||||
|
{
|
||||||
|
{ 0, 0, 0, 0 }
|
||||||
|
}, // ServerIp - Not known yet
|
||||||
69, // InitialServerPort - Standard TFTP server port
|
69, // InitialServerPort - Standard TFTP server port
|
||||||
6, // TryCount - The number of times to transmit request packets and wait for a response.
|
6, // TryCount - The number of times to transmit request packets and wait for a response.
|
||||||
4 // TimeoutValue - Retransmission timeout in seconds.
|
4 // TimeoutValue - Retransmission timeout in seconds.
|
||||||
@ -319,15 +327,22 @@ RunTftp (
|
|||||||
Status = ShellCommandLineParse (ParamList, &CheckPackage, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &CheckPackage, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if ((Status == EFI_VOLUME_CORRUPTED) &&
|
if ((Status == EFI_VOLUME_CORRUPTED) &&
|
||||||
(ProblemParam != NULL) ) {
|
(ProblemParam != NULL))
|
||||||
|
{
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), mTftpHiiHandle,
|
-1,
|
||||||
L"tftp", ProblemParam
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_PROBLEM),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp",
|
||||||
|
ProblemParam
|
||||||
);
|
);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
} else {
|
} else {
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,15 +352,24 @@ RunTftp (
|
|||||||
ParamCount = ShellCommandLineGetCount (CheckPackage);
|
ParamCount = ShellCommandLineGetCount (CheckPackage);
|
||||||
if (ParamCount > 4) {
|
if (ParamCount > 4) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY),
|
-1,
|
||||||
mTftpHiiHandle, L"tftp"
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_TOO_MANY),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp"
|
||||||
);
|
);
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ParamCount < 3) {
|
if (ParamCount < 3) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW),
|
-1,
|
||||||
mTftpHiiHandle, L"tftp"
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_TOO_FEW),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp"
|
||||||
);
|
);
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
@ -359,8 +383,13 @@ RunTftp (
|
|||||||
Status = NetLibStrToIp4 (ValueStr, &Mtftp4ConfigData.ServerIp);
|
Status = NetLibStrToIp4 (ValueStr, &Mtftp4ConfigData.ServerIp);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
-1,
|
||||||
mTftpHiiHandle, L"tftp", ValueStr
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp",
|
||||||
|
ValueStr
|
||||||
);
|
);
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
@ -373,6 +402,7 @@ RunTftp (
|
|||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStrS (RemoteFilePath, AsciiRemoteFilePath, FilePathSize);
|
UnicodeStrToAsciiStrS (RemoteFilePath, AsciiRemoteFilePath, FilePathSize);
|
||||||
|
|
||||||
if (ParamCount == 4) {
|
if (ParamCount == 4) {
|
||||||
@ -381,10 +411,12 @@ RunTftp (
|
|||||||
Walker = RemoteFilePath + StrLen (RemoteFilePath);
|
Walker = RemoteFilePath + StrLen (RemoteFilePath);
|
||||||
while ((--Walker) >= RemoteFilePath) {
|
while ((--Walker) >= RemoteFilePath) {
|
||||||
if ((*Walker == L'\\') ||
|
if ((*Walker == L'\\') ||
|
||||||
(*Walker == L'/' ) ) {
|
(*Walker == L'/'))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mLocalFilePath = Walker + 1;
|
mLocalFilePath = Walker + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,10 +455,16 @@ RunTftp (
|
|||||||
if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TimeoutValue)) {
|
if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TimeoutValue)) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mtftp4ConfigData.TimeoutValue == 0) {
|
if (Mtftp4ConfigData.TimeoutValue == 0) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
-1,
|
||||||
mTftpHiiHandle, L"tftp", ValueStr
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp",
|
||||||
|
ValueStr
|
||||||
);
|
);
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
@ -437,10 +475,16 @@ RunTftp (
|
|||||||
if (!StringToUint16 (ValueStr, &BlockSize)) {
|
if (!StringToUint16 (ValueStr, &BlockSize)) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
if (BlockSize < MTFTP_MIN_BLKSIZE || BlockSize > MTFTP_MAX_BLKSIZE) {
|
|
||||||
|
if ((BlockSize < MTFTP_MIN_BLKSIZE) || (BlockSize > MTFTP_MAX_BLKSIZE)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
-1,
|
||||||
mTftpHiiHandle, L"tftp", ValueStr
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp",
|
||||||
|
ValueStr
|
||||||
);
|
);
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
@ -451,10 +495,16 @@ RunTftp (
|
|||||||
if (!StringToUint16 (ValueStr, &WindowSize)) {
|
if (!StringToUint16 (ValueStr, &WindowSize)) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
if (WindowSize < MTFTP_MIN_WINDOWSIZE || WindowSize > MTFTP_MAX_WINDOWSIZE) {
|
|
||||||
|
if ((WindowSize < MTFTP_MIN_WINDOWSIZE) || (WindowSize > MTFTP_MAX_WINDOWSIZE)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
-1,
|
||||||
mTftpHiiHandle, L"tftp", ValueStr
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp",
|
||||||
|
ValueStr
|
||||||
);
|
);
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
@ -473,7 +523,10 @@ RunTftp (
|
|||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || (HandleCount == 0)) {
|
if (EFI_ERROR (Status) || (HandleCount == 0)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NO_NIC),
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_ERR_NO_NIC),
|
||||||
mTftpHiiHandle
|
mTftpHiiHandle
|
||||||
);
|
);
|
||||||
goto Error;
|
goto Error;
|
||||||
@ -481,14 +534,20 @@ RunTftp (
|
|||||||
|
|
||||||
for (NicNumber = 0;
|
for (NicNumber = 0;
|
||||||
(NicNumber < HandleCount) && (ShellStatus != SHELL_SUCCESS);
|
(NicNumber < HandleCount) && (ShellStatus != SHELL_SUCCESS);
|
||||||
NicNumber++) {
|
NicNumber++)
|
||||||
|
{
|
||||||
ControllerHandle = Handles[NicNumber];
|
ControllerHandle = Handles[NicNumber];
|
||||||
|
|
||||||
Status = GetNicName (ControllerHandle, NicNumber, NicName);
|
Status = GetNicName (ControllerHandle, NicNumber, NicName);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NAME),
|
-1,
|
||||||
mTftpHiiHandle, NicNumber, Status
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_ERR_NIC_NAME),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
NicNumber,
|
||||||
|
Status
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -497,6 +556,7 @@ RunTftp (
|
|||||||
if (StrCmp (NicName, UserNicName) != 0) {
|
if (StrCmp (NicName, UserNicName) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
NicFound = TRUE;
|
NicFound = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,8 +569,13 @@ RunTftp (
|
|||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_OPEN_PROTOCOL),
|
-1,
|
||||||
mTftpHiiHandle, NicName, Status
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_ERR_OPEN_PROTOCOL),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
NicName,
|
||||||
|
Status
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -518,8 +583,13 @@ RunTftp (
|
|||||||
Status = Mtftp4->Configure (Mtftp4, &Mtftp4ConfigData);
|
Status = Mtftp4->Configure (Mtftp4, &Mtftp4ConfigData);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_CONFIGURE),
|
-1,
|
||||||
mTftpHiiHandle, NicName, Status
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_ERR_CONFIGURE),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
NicName,
|
||||||
|
Status
|
||||||
);
|
);
|
||||||
goto NextHandle;
|
goto NextHandle;
|
||||||
}
|
}
|
||||||
@ -527,8 +597,14 @@ RunTftp (
|
|||||||
Status = GetFileSize (Mtftp4, AsciiRemoteFilePath, &FileSize);
|
Status = GetFileSize (Mtftp4, AsciiRemoteFilePath, &FileSize);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_FILE_SIZE),
|
-1,
|
||||||
mTftpHiiHandle, RemoteFilePath, NicName, Status
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_ERR_FILE_SIZE),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
RemoteFilePath,
|
||||||
|
NicName,
|
||||||
|
Status
|
||||||
);
|
);
|
||||||
goto NextHandle;
|
goto NextHandle;
|
||||||
}
|
}
|
||||||
@ -536,8 +612,14 @@ RunTftp (
|
|||||||
Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, FileSize, BlockSize, WindowSize);
|
Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, FileSize, BlockSize, WindowSize);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD),
|
-1,
|
||||||
mTftpHiiHandle, RemoteFilePath, NicName, Status
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
RemoteFilePath,
|
||||||
|
NicName,
|
||||||
|
Status
|
||||||
);
|
);
|
||||||
goto NextHandle;
|
goto NextHandle;
|
||||||
}
|
}
|
||||||
@ -556,8 +638,12 @@ RunTftp (
|
|||||||
|
|
||||||
if ((UserNicName != NULL) && (!NicFound)) {
|
if ((UserNicName != NULL) && (!NicFound)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND),
|
-1,
|
||||||
mTftpHiiHandle, UserNicName
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
UserNicName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,6 +653,7 @@ RunTftp (
|
|||||||
if (AsciiRemoteFilePath != NULL) {
|
if (AsciiRemoteFilePath != NULL) {
|
||||||
FreePool (AsciiRemoteFilePath);
|
FreePool (AsciiRemoteFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Handles != NULL) {
|
if (Handles != NULL) {
|
||||||
FreePool (Handles);
|
FreePool (Handles);
|
||||||
}
|
}
|
||||||
@ -599,8 +686,13 @@ StringToUint16 (
|
|||||||
Val = ShellStrToUintn (ValueStr);
|
Val = ShellStrToUintn (ValueStr);
|
||||||
if (Val > MAX_UINT16) {
|
if (Val > MAX_UINT16) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
-1,
|
||||||
mTftpHiiHandle, L"tftp", ValueStr
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp",
|
||||||
|
ValueStr
|
||||||
);
|
);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -847,9 +939,11 @@ GetFileSize (
|
|||||||
*FileSize = AsciiStrDecimalToUintn ((CHAR8 *)Option->ValueStr);
|
*FileSize = AsciiStrDecimalToUintn ((CHAR8 *)Option->ValueStr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
OptCnt--;
|
OptCnt--;
|
||||||
Option++;
|
Option++;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (TableOfOptions);
|
FreePool (TableOfOptions);
|
||||||
|
|
||||||
if (OptCnt == 0) {
|
if (OptCnt == 0) {
|
||||||
@ -902,6 +996,7 @@ DownloadFile (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
TftpContext->FileSize = FileSize;
|
TftpContext->FileSize = FileSize;
|
||||||
TftpContext->DownloadedNbOfBytes = 0;
|
TftpContext->DownloadedNbOfBytes = 0;
|
||||||
TftpContext->LastReportedNbOfBytes = 0;
|
TftpContext->LastReportedNbOfBytes = 0;
|
||||||
@ -931,8 +1026,12 @@ DownloadFile (
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_DOWNLOADING),
|
-1,
|
||||||
mTftpHiiHandle, FilePath
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_DOWNLOADING),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
FilePath
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -952,15 +1051,23 @@ DownloadFile (
|
|||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL),
|
-1,
|
||||||
mTftpHiiHandle, L"tftp", mLocalFilePath
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
L"tftp",
|
||||||
|
mLocalFilePath
|
||||||
);
|
);
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Mtftp4->ReadFile (Mtftp4, &Mtftp4Token);
|
Status = Mtftp4->ReadFile (Mtftp4, &Mtftp4Token);
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF),
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_CRLF),
|
||||||
mTftpHiiHandle
|
mTftpHiiHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1030,13 +1137,22 @@ CheckPacket (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Context->DownloadedNbOfBytes > 0) {
|
if (Context->DownloadedNbOfBytes > 0) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF),
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_CRLF),
|
||||||
mTftpHiiHandle
|
mTftpHiiHandle
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_WRITE),
|
-1,
|
||||||
mTftpHiiHandle, mLocalFilePath, Status
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_TFTP_ERR_WRITE),
|
||||||
|
mTftpHiiHandle,
|
||||||
|
mLocalFilePath,
|
||||||
|
Status
|
||||||
);
|
);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -1062,9 +1178,11 @@ CheckPacket (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 1; Index < Step; Index++) {
|
for (Index = 1; Index < Step; Index++) {
|
||||||
Progress[Index] = L'=';
|
Progress[Index] = L'=';
|
||||||
}
|
}
|
||||||
|
|
||||||
Progress[Step] = L'>';
|
Progress[Step] = L'>';
|
||||||
|
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
@ -1125,5 +1243,6 @@ InitializeHiiPackage (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HiiHandle;
|
return HiiHandle;
|
||||||
}
|
}
|
||||||
|
@ -66,4 +66,5 @@ EFI_HII_HANDLE
|
|||||||
InitializeHiiPackage (
|
InitializeHiiPackage (
|
||||||
EFI_HANDLE ImageHandle
|
EFI_HANDLE ImageHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // _TFTP_H_
|
#endif // _TFTP_H_
|
||||||
|
@ -37,6 +37,7 @@ TftpAppInitialize (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
|
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
|
||||||
if (mTftpHiiHandle == NULL) {
|
if (mTftpHiiHandle == NULL) {
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
|
@ -83,6 +83,7 @@ TftpCommandInitialize (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
|
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
|
||||||
if (mTftpHiiHandle == NULL) {
|
if (mTftpHiiHandle == NULL) {
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
@ -113,6 +114,7 @@ TftpUnload (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = gBS->UninstallProtocolInterface (
|
Status = gBS->UninstallProtocolInterface (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
&gEfiShellDynamicCommandProtocolGuid,
|
&gEfiShellDynamicCommandProtocolGuid,
|
||||||
@ -121,6 +123,7 @@ TftpUnload (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
HiiRemovePackages (mTftpHiiHandle);
|
HiiRemovePackages (mTftpHiiHandle);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -43,4 +43,3 @@ BcfgLibraryUnregisterBcfgCommand (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -315,7 +315,6 @@ ParseHandleDatabaseForChildControllers(
|
|||||||
OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
|
OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function to retrieve the human-friendly index of a given handle. If the handle
|
Function to retrieve the human-friendly index of a given handle. If the handle
|
||||||
does not have a index one will be automatically assigned. The index value is valid
|
does not have a index one will be automatically assigned. The index value is valid
|
||||||
@ -382,7 +381,6 @@ GetHandleListByProtocolList (
|
|||||||
IN CONST EFI_GUID **ProtocolGuids
|
IN CONST EFI_GUID **ProtocolGuids
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return all supported GUIDs.
|
Return all supported GUIDs.
|
||||||
|
|
||||||
|
@ -31,4 +31,3 @@ ShellAppMain (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -191,7 +191,6 @@ ShellCommandGetManFileNameHandler (
|
|||||||
IN CONST CHAR16 *CommandString
|
IN CONST CHAR16 *CommandString
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link;
|
||||||
CHAR16 *CommandString;
|
CHAR16 *CommandString;
|
||||||
@ -327,8 +326,6 @@ ShellCommandSetEchoState (
|
|||||||
IN BOOLEAN State
|
IN BOOLEAN State
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Indicate that the current shell or script should exit.
|
Indicate that the current shell or script should exit.
|
||||||
|
|
||||||
@ -644,7 +641,6 @@ ShellFileHandleGetPath(
|
|||||||
IN CONST SHELL_FILE_HANDLE Handle
|
IN CONST SHELL_FILE_HANDLE Handle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function to determine if a SHELL_FILE_HANDLE is at the end of the file.
|
Function to determine if a SHELL_FILE_HANDLE is at the end of the file.
|
||||||
|
|
||||||
@ -795,4 +791,5 @@ ShellSortFileList (
|
|||||||
OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL,
|
OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL,
|
||||||
IN SHELL_SORT_FILE_LIST Order
|
IN SHELL_SORT_FILE_LIST Order
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif //_SHELL_COMMAND_LIB_
|
#endif //_SHELL_COMMAND_LIB_
|
||||||
|
@ -711,7 +711,6 @@ typedef struct {
|
|||||||
SHELL_PARAM_TYPE Type;
|
SHELL_PARAM_TYPE Type;
|
||||||
} SHELL_PARAM_ITEM;
|
} SHELL_PARAM_ITEM;
|
||||||
|
|
||||||
|
|
||||||
/// Helper structure for no parameters (besides -? and -b)
|
/// Helper structure for no parameters (besides -? and -b)
|
||||||
extern SHELL_PARAM_ITEM EmptyParamList[];
|
extern SHELL_PARAM_ITEM EmptyParamList[];
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_
|
#ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_
|
||||||
#define _SHELL_ENVIRONMENT_2_PROTOCOL_H_
|
#define _SHELL_ENVIRONMENT_2_PROTOCOL_H_
|
||||||
|
|
||||||
@ -486,6 +485,7 @@ VOID
|
|||||||
//
|
//
|
||||||
// declarations of handle enumerator
|
// declarations of handle enumerator
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
For ease of use the shell maps handle #'s to short numbers.
|
For ease of use the shell maps handle #'s to short numbers.
|
||||||
This is only done on request for various internal commands and the references
|
This is only done on request for various internal commands and the references
|
||||||
@ -621,12 +621,12 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
UINTN NoHandles; ///< The number of handles producing this protocol.
|
UINTN NoHandles; ///< The number of handles producing this protocol.
|
||||||
EFI_HANDLE *Handles; ///< The array of handles.
|
EFI_HANDLE *Handles; ///< The array of handles.
|
||||||
|
|
||||||
} PROTOCOL_INFO;
|
} PROTOCOL_INFO;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Declarations of protocol info enumerator.
|
// Declarations of protocol info enumerator.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is an internal shell function to initialize the protocol enumerator.
|
This is an internal shell function to initialize the protocol enumerator.
|
||||||
|
|
||||||
@ -692,7 +692,6 @@ VOID
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is an internal shell function for enumeration of protocols.
|
This function is an internal shell function for enumeration of protocols.
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -207,7 +207,6 @@ typedef struct {
|
|||||||
UINT64 Compatibilities;
|
UINT64 Compatibilities;
|
||||||
} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1;
|
} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec > 2.4a and < 2.5
|
/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec > 2.4a and < 2.5
|
||||||
///
|
///
|
||||||
@ -291,4 +290,3 @@ typedef struct _GUID_INFO_BLOCK{
|
|||||||
} GUID_INFO_BLOCK;
|
} GUID_INFO_BLOCK;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -140,22 +140,29 @@ VerifyChecksum (
|
|||||||
if (GetColourHighlighting ()) {
|
if (GetColourHighlighting ()) {
|
||||||
gST->ConOut->SetAttribute (
|
gST->ConOut->SetAttribute (
|
||||||
gST->ConOut,
|
gST->ConOut,
|
||||||
EFI_TEXT_ATTR (EFI_GREEN,
|
EFI_TEXT_ATTR (
|
||||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
EFI_GREEN,
|
||||||
|
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"Table Checksum : OK\n\n");
|
Print (L"Table Checksum : OK\n\n");
|
||||||
} else {
|
} else {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
if (GetColourHighlighting ()) {
|
if (GetColourHighlighting ()) {
|
||||||
gST->ConOut->SetAttribute (
|
gST->ConOut->SetAttribute (
|
||||||
gST->ConOut,
|
gST->ConOut,
|
||||||
EFI_TEXT_ATTR (EFI_RED,
|
EFI_TEXT_ATTR (
|
||||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
EFI_RED,
|
||||||
|
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"Table Checksum : FAILED (0x%X)\n\n", Checksum);
|
Print (L"Table Checksum : FAILED (0x%X)\n\n", Checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetColourHighlighting ()) {
|
if (GetColourHighlighting ()) {
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
|
gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
|
||||||
}
|
}
|
||||||
@ -216,6 +223,7 @@ DumpRaw (
|
|||||||
if ((Length & 0x0F) <= 8) {
|
if ((Length & 0x0F) <= 8) {
|
||||||
PartLineChars += 2;
|
PartLineChars += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (PartLineChars > 0) {
|
while (PartLineChars > 0) {
|
||||||
Print (L" ");
|
Print (L" ");
|
||||||
PartLineChars--;
|
PartLineChars--;
|
||||||
@ -526,10 +534,13 @@ ParseAcpi (
|
|||||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||||
gST->ConOut->SetAttribute (
|
gST->ConOut->SetAttribute (
|
||||||
gST->ConOut,
|
gST->ConOut,
|
||||||
EFI_TEXT_ATTR(EFI_YELLOW,
|
EFI_TEXT_ATTR (
|
||||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
EFI_YELLOW,
|
||||||
|
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (
|
Print (
|
||||||
L"%*a%-*a :\n",
|
L"%*a%-*a :\n",
|
||||||
gIndent,
|
gIndent,
|
||||||
@ -544,7 +555,6 @@ ParseAcpi (
|
|||||||
|
|
||||||
for (Index = 0; Index < ParserItems; Index++) {
|
for (Index = 0; Index < ParserItems; Index++) {
|
||||||
if ((Offset + Parser[Index].Length) > Length) {
|
if ((Offset + Parser[Index].Length) > Length) {
|
||||||
|
|
||||||
// For fields outside the buffer length provided, reset any pointers
|
// For fields outside the buffer length provided, reset any pointers
|
||||||
// which were supposed to be updated by this function call
|
// which were supposed to be updated by this function call
|
||||||
if (Parser[Index].ItemPtr != NULL) {
|
if (Parser[Index].ItemPtr != NULL) {
|
||||||
@ -556,7 +566,8 @@ ParseAcpi (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (GetConsistencyChecking () &&
|
if (GetConsistencyChecking () &&
|
||||||
(Offset != Parser[Index].Offset)) {
|
(Offset != Parser[Index].Offset))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"\nERROR: %a: Offset Mismatch for %s\n"
|
L"\nERROR: %a: Offset Mismatch for %s\n"
|
||||||
@ -597,12 +608,15 @@ ParseAcpi (
|
|||||||
);
|
);
|
||||||
} // switch
|
} // switch
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validating only makes sense if we are tracing
|
// Validating only makes sense if we are tracing
|
||||||
// the parsed table entries, to report by table name.
|
// the parsed table entries, to report by table name.
|
||||||
if (GetConsistencyChecking () &&
|
if (GetConsistencyChecking () &&
|
||||||
(Parser[Index].FieldValidator != NULL)) {
|
(Parser[Index].FieldValidator != NULL))
|
||||||
|
{
|
||||||
Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
|
Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
} // if (Trace)
|
} // if (Trace)
|
||||||
|
|
||||||
|
@ -258,7 +258,6 @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context);
|
|||||||
representing the field data.
|
representing the field data.
|
||||||
**/
|
**/
|
||||||
typedef struct AcpiParser {
|
typedef struct AcpiParser {
|
||||||
|
|
||||||
/// String describing the ACPI table field
|
/// String describing the ACPI table field
|
||||||
/// (Field column from ACPI table spec)
|
/// (Field column from ACPI table spec)
|
||||||
CONST CHAR16 *NameStr;
|
CONST CHAR16 *NameStr;
|
||||||
|
@ -231,6 +231,7 @@ ProcessAcpiTable (
|
|||||||
if (GetMandatoryTableValidate ()) {
|
if (GetMandatoryTableValidate ()) {
|
||||||
ArmSbbrIncrementTableCount (*AcpiTableSignature);
|
ArmSbbrIncrementTableCount (*AcpiTableSignature);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Status = GetParser (*AcpiTableSignature, &ParserProc);
|
Status = GetParser (*AcpiTableSignature, &ParserProc);
|
||||||
@ -239,6 +240,7 @@ ProcessAcpiTable (
|
|||||||
if (Trace) {
|
if (Trace) {
|
||||||
DumpAcpiHeader (Ptr);
|
DumpAcpiHeader (Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +106,7 @@ ProcessTableReportOptions (
|
|||||||
Log = TRUE;
|
Log = TRUE;
|
||||||
SelectedTable->Found = TRUE;
|
SelectedTable->Found = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ReportTableList:
|
case ReportTableList:
|
||||||
if (mTableCount == 0) {
|
if (mTableCount == 0) {
|
||||||
@ -113,15 +114,19 @@ ProcessTableReportOptions (
|
|||||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||||
gST->ConOut->SetAttribute (
|
gST->ConOut->SetAttribute (
|
||||||
gST->ConOut,
|
gST->ConOut,
|
||||||
EFI_TEXT_ATTR(EFI_CYAN,
|
EFI_TEXT_ATTR (
|
||||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
EFI_CYAN,
|
||||||
|
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\nInstalled Table(s):\n");
|
Print (L"\nInstalled Table(s):\n");
|
||||||
if (HighLight) {
|
if (HighLight) {
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
|
gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (
|
Print (
|
||||||
L"\t%4d. %c%c%c%c\n",
|
L"\t%4d. %c%c%c%c\n",
|
||||||
++mTableCount,
|
++mTableCount,
|
||||||
@ -136,6 +141,7 @@ ProcessTableReportOptions (
|
|||||||
SelectedTable->Found = TRUE;
|
SelectedTable->Found = TRUE;
|
||||||
DumpAcpiTableToFile (TablePtr, Length);
|
DumpAcpiTableToFile (TablePtr, Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ReportMax:
|
case ReportMax:
|
||||||
// We should never be here.
|
// We should never be here.
|
||||||
@ -148,10 +154,13 @@ ProcessTableReportOptions (
|
|||||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||||
gST->ConOut->SetAttribute (
|
gST->ConOut->SetAttribute (
|
||||||
gST->ConOut,
|
gST->ConOut,
|
||||||
EFI_TEXT_ATTR(EFI_LIGHTBLUE,
|
EFI_TEXT_ATTR (
|
||||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
EFI_LIGHTBLUE,
|
||||||
|
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (
|
Print (
|
||||||
L"\n\n --------------- %c%c%c%c Table --------------- \n\n",
|
L"\n\n --------------- %c%c%c%c Table --------------- \n\n",
|
||||||
SignaturePtr[0],
|
SignaturePtr[0],
|
||||||
@ -167,8 +176,6 @@ ProcessTableReportOptions (
|
|||||||
return Log;
|
return Log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function iterates the configuration table entries in the
|
This function iterates the configuration table entries in the
|
||||||
system table, retrieves the RSDP pointer and starts parsing the ACPI tables.
|
system table, retrieves the RSDP pointer and starts parsing the ACPI tables.
|
||||||
@ -219,8 +226,11 @@ AcpiView (
|
|||||||
// Search the table for an entry that matches the ACPI Table Guid
|
// Search the table for an entry that matches the ACPI Table Guid
|
||||||
FoundAcpiTable = FALSE;
|
FoundAcpiTable = FALSE;
|
||||||
for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
|
for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
|
||||||
if (CompareGuid (&gEfiAcpiTableGuid,
|
if (CompareGuid (
|
||||||
&(SystemTable->ConfigurationTable[Index].VendorGuid))) {
|
&gEfiAcpiTableGuid,
|
||||||
|
&(SystemTable->ConfigurationTable[Index].VendorGuid)
|
||||||
|
))
|
||||||
|
{
|
||||||
EfiConfigurationTable = &SystemTable->ConfigurationTable[Index];
|
EfiConfigurationTable = &SystemTable->ConfigurationTable[Index];
|
||||||
FoundAcpiTable = TRUE;
|
FoundAcpiTable = TRUE;
|
||||||
break;
|
break;
|
||||||
@ -244,6 +254,7 @@ AcpiView (
|
|||||||
if (GetMandatoryTableValidate ()) {
|
if (GetMandatoryTableValidate ()) {
|
||||||
ArmSbbrResetTableCounts ();
|
ArmSbbrResetTableCounts ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The RSDP length is 4 bytes starting at offset 20
|
// The RSDP length is 4 bytes starting at offset 20
|
||||||
@ -265,7 +276,6 @@ AcpiView (
|
|||||||
RsdpLength,
|
RsdpLength,
|
||||||
RsdpRevision
|
RsdpRevision
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
@ -278,16 +288,19 @@ AcpiView (
|
|||||||
if (GetMandatoryTableValidate ()) {
|
if (GetMandatoryTableValidate ()) {
|
||||||
ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ());
|
ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ReportOption = GetReportOption ();
|
ReportOption = GetReportOption ();
|
||||||
if (ReportTableList != ReportOption) {
|
if (ReportTableList != ReportOption) {
|
||||||
if (((ReportSelected == ReportOption) ||
|
if (((ReportSelected == ReportOption) ||
|
||||||
(ReportDumpBinFile == ReportOption)) &&
|
(ReportDumpBinFile == ReportOption)) &&
|
||||||
(!SelectedTable->Found)) {
|
(!SelectedTable->Found))
|
||||||
|
{
|
||||||
Print (L"\nRequested ACPI Table not found.\n");
|
Print (L"\nRequested ACPI Table not found.\n");
|
||||||
} else if (GetConsistencyChecking () &&
|
} else if (GetConsistencyChecking () &&
|
||||||
(ReportDumpBinFile != ReportOption)) {
|
(ReportDumpBinFile != ReportOption))
|
||||||
|
{
|
||||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||||
|
|
||||||
Print (L"\nTable Statistics:\n");
|
Print (L"\nTable Statistics:\n");
|
||||||
@ -301,6 +314,7 @@ AcpiView (
|
|||||||
OriginalAttribute;
|
OriginalAttribute;
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
|
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\t%d Error(s)\n", GetErrorCount ());
|
Print (L"\t%d Error(s)\n", GetErrorCount ());
|
||||||
|
|
||||||
if (GetColourHighlighting ()) {
|
if (GetColourHighlighting ()) {
|
||||||
@ -313,6 +327,7 @@ AcpiView (
|
|||||||
|
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
|
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\t%d Warning(s)\n", GetWarningCount ());
|
Print (L"\t%d Warning(s)\n", GetWarningCount ());
|
||||||
|
|
||||||
if (GetColourHighlighting ()) {
|
if (GetColourHighlighting ()) {
|
||||||
@ -320,5 +335,6 @@ AcpiView (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,15 @@ ConvertStrToAcpiSignature (
|
|||||||
|
|
||||||
// Convert to Upper case and convert to ASCII
|
// Convert to Upper case and convert to ASCII
|
||||||
while ((Index < 4) && (Str[Index] != 0)) {
|
while ((Index < 4) && (Str[Index] != 0)) {
|
||||||
if (Str[Index] >= L'a' && Str[Index] <= L'z') {
|
if ((Str[Index] >= L'a') && (Str[Index] <= L'z')) {
|
||||||
Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A'));
|
Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A'));
|
||||||
} else {
|
} else {
|
||||||
Ptr[Index] = (CHAR8)Str[Index];
|
Ptr[Index] = (CHAR8)Str[Index];
|
||||||
}
|
}
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *(UINT32 *)Ptr;
|
return *(UINT32 *)Ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,8 @@ ArmSbbrReqsValidate (
|
|||||||
// Locate the instance count for the table with the given signature
|
// Locate the instance count for the table with the given signature
|
||||||
Index = 0;
|
Index = 0;
|
||||||
while ((Index < ARRAY_SIZE (ArmSbbrTableCounts)) &&
|
while ((Index < ARRAY_SIZE (ArmSbbrTableCounts)) &&
|
||||||
(ArmSbbrTableCounts[Index].Signature != MandatoryTable)) {
|
(ArmSbbrTableCounts[Index].Signature != MandatoryTable))
|
||||||
|
{
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,10 @@ ValidateProcessorFlags (
|
|||||||
// field must be set to 0 and ignored.
|
// field must be set to 0 and ignored.
|
||||||
if (((*Ptr & 0x3) != 0) && (*ProcessorId != 0)) {
|
if (((*Ptr & 0x3) != 0) && (*ProcessorId != 0)) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global"
|
Print (
|
||||||
L" or shared nodes.");
|
L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global"
|
||||||
|
L" or shared nodes."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +339,8 @@ DumpProcessorNode (
|
|||||||
// successfully read.
|
// successfully read.
|
||||||
if ((ProcessorId == NULL) ||
|
if ((ProcessorId == NULL) ||
|
||||||
(ProcessorResourceType == NULL) ||
|
(ProcessorResourceType == NULL) ||
|
||||||
(ProcessorFlags == NULL)) {
|
(ProcessorFlags == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient Processor Error Node length. Length = %d.\n",
|
L"ERROR: Insufficient Processor Error Node length. Length = %d.\n",
|
||||||
@ -716,7 +719,8 @@ ParseAcpiAest (
|
|||||||
(NodeDataOffset == NULL) ||
|
(NodeDataOffset == NULL) ||
|
||||||
(NodeInterfaceOffset == NULL) ||
|
(NodeInterfaceOffset == NULL) ||
|
||||||
(NodeInterruptArrayOffset == NULL) ||
|
(NodeInterruptArrayOffset == NULL) ||
|
||||||
(NodeInterruptCount == NULL)) {
|
(NodeInterruptCount == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient length left for Node Structure.\n" \
|
L"ERROR: Insufficient length left for Node Structure.\n" \
|
||||||
@ -728,7 +732,8 @@ ParseAcpiAest (
|
|||||||
|
|
||||||
// Validate AEST Node length
|
// Validate AEST Node length
|
||||||
if ((*AestNodeLength == 0) ||
|
if ((*AestNodeLength == 0) ||
|
||||||
((Offset + (*AestNodeLength)) > AcpiTableLength)) {
|
((Offset + (*AestNodeLength)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid AEST Node length. " \
|
L"ERROR: Invalid AEST Node length. " \
|
||||||
|
@ -131,7 +131,8 @@ DumpDbgDeviceInfo (
|
|||||||
(OEMDataLength == NULL) ||
|
(OEMDataLength == NULL) ||
|
||||||
(OEMDataOffset == NULL) ||
|
(OEMDataOffset == NULL) ||
|
||||||
(BaseAddrRegOffset == NULL) ||
|
(BaseAddrRegOffset == NULL) ||
|
||||||
(AddrSizeOffset == NULL)) {
|
(AddrSizeOffset == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient Debug Device Information Structure length. " \
|
L"ERROR: Insufficient Debug Device Information Structure length. " \
|
||||||
@ -145,7 +146,8 @@ DumpDbgDeviceInfo (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
Offset = *BaseAddrRegOffset;
|
Offset = *BaseAddrRegOffset;
|
||||||
while ((Index++ < *GasCount) &&
|
while ((Index++ < *GasCount) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
PrintFieldName (4, L"BaseAddressRegister");
|
PrintFieldName (4, L"BaseAddressRegister");
|
||||||
Offset += (UINT16)DumpGasStruct (
|
Offset += (UINT16)DumpGasStruct (
|
||||||
Ptr + Offset,
|
Ptr + Offset,
|
||||||
@ -171,7 +173,8 @@ DumpDbgDeviceInfo (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
Offset = *AddrSizeOffset;
|
Offset = *AddrSizeOffset;
|
||||||
while ((Index++ < *GasCount) &&
|
while ((Index++ < *GasCount) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
PrintFieldName (4, L"Address Size");
|
PrintFieldName (4, L"Address Size");
|
||||||
Print (L"0x%x\n", *((UINT32 *)(Ptr + Offset)));
|
Print (L"0x%x\n", *((UINT32 *)(Ptr + Offset)));
|
||||||
Offset += sizeof (UINT32);
|
Offset += sizeof (UINT32);
|
||||||
@ -182,10 +185,12 @@ DumpDbgDeviceInfo (
|
|||||||
Offset = *NameSpaceStringOffset;
|
Offset = *NameSpaceStringOffset;
|
||||||
PrintFieldName (4, L"NameSpace String");
|
PrintFieldName (4, L"NameSpace String");
|
||||||
while ((Index++ < *NameSpaceStringLength) &&
|
while ((Index++ < *NameSpaceStringLength) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
Print (L"%c", *(Ptr + Offset));
|
Print (L"%c", *(Ptr + Offset));
|
||||||
Offset++;
|
Offset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
|
|
||||||
// OEM Data
|
// OEM Data
|
||||||
@ -194,13 +199,16 @@ DumpDbgDeviceInfo (
|
|||||||
Offset = *OEMDataOffset;
|
Offset = *OEMDataOffset;
|
||||||
PrintFieldName (4, L"OEM Data");
|
PrintFieldName (4, L"OEM Data");
|
||||||
while ((Index++ < *OEMDataLength) &&
|
while ((Index++ < *OEMDataLength) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
Print (L"%x ", *(Ptr + Offset));
|
Print (L"%x ", *(Ptr + Offset));
|
||||||
if ((Index & 7) == 0) {
|
if ((Index & 7) == 0) {
|
||||||
Print (L"\n%-*s ", OUTPUT_FIELD_COLUMN_WIDTH, L"");
|
Print (L"\n%-*s ", OUTPUT_FIELD_COLUMN_WIDTH, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset++;
|
Offset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,7 +253,8 @@ ParseAcpiDbg2 (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((OffsetDbgDeviceInfo == NULL) ||
|
if ((OffsetDbgDeviceInfo == NULL) ||
|
||||||
(NumberDbgDeviceInfo == NULL)) {
|
(NumberDbgDeviceInfo == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient table length. AcpiTableLength = %d\n",
|
L"ERROR: Insufficient table length. AcpiTableLength = %d\n",
|
||||||
@ -258,7 +267,6 @@ ParseAcpiDbg2 (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
while (Index++ < *NumberDbgDeviceInfo) {
|
while (Index++ < *NumberDbgDeviceInfo) {
|
||||||
|
|
||||||
// Parse the Debug Device Information Structure header to obtain Length
|
// Parse the Debug Device Information Structure header to obtain Length
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
FALSE,
|
FALSE,
|
||||||
@ -284,7 +292,8 @@ ParseAcpiDbg2 (
|
|||||||
|
|
||||||
// Validate Debug Device Information Structure length
|
// Validate Debug Device Information Structure length
|
||||||
if ((*DbgDevInfoLen == 0) ||
|
if ((*DbgDevInfoLen == 0) ||
|
||||||
((Offset + (*DbgDevInfoLen)) > AcpiTableLength)) {
|
((Offset + (*DbgDevInfoLen)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid Debug Device Information Structure length. " \
|
L"ERROR: Invalid Debug Device Information Structure length. " \
|
||||||
|
@ -74,6 +74,7 @@ ValidateFirmwareCtrl (
|
|||||||
L"\nERROR: Firmware Control must be zero for ARM platforms."
|
L"\nERROR: Firmware Control must be zero for ARM platforms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ ValidateXFirmwareCtrl (
|
|||||||
L"\nERROR: X Firmware Control must be zero for ARM platforms."
|
L"\nERROR: X Firmware Control must be zero for ARM platforms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,6 +126,7 @@ ValidateFlags (
|
|||||||
L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms."
|
L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,10 +258,13 @@ ParseAcpiFadt (
|
|||||||
// present.
|
// present.
|
||||||
if ((Trace) &&
|
if ((Trace) &&
|
||||||
(Flags != NULL) &&
|
(Flags != NULL) &&
|
||||||
((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI)) {
|
((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (L"ERROR: No FACS table found, "
|
Print (
|
||||||
L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n");
|
L"ERROR: No FACS table found, "
|
||||||
|
L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,6 +317,7 @@ ParseAcpiFadt (
|
|||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n");
|
Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,8 @@ DumpGTBlock (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((GtBlockTimerCount == NULL) ||
|
if ((GtBlockTimerCount == NULL) ||
|
||||||
(GtBlockTimerOffset == NULL)) {
|
(GtBlockTimerOffset == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient GT Block Structure length. Length = %d.\n",
|
L"ERROR: Insufficient GT Block Structure length. Length = %d.\n",
|
||||||
@ -208,7 +209,8 @@ DumpGTBlock (
|
|||||||
// Parse the specified number of GT Block Timer Structures or the GT Block
|
// Parse the specified number of GT Block Timer Structures or the GT Block
|
||||||
// Structure buffer length. Whichever is minimum.
|
// Structure buffer length. Whichever is minimum.
|
||||||
while ((Index++ < *GtBlockTimerCount) &&
|
while ((Index++ < *GtBlockTimerCount) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
Offset += ParseAcpi (
|
Offset += ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -288,7 +290,8 @@ ParseAcpiGtdt (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((GtdtPlatformTimerCount == NULL) ||
|
if ((GtdtPlatformTimerCount == NULL) ||
|
||||||
(GtdtPlatformTimerOffset == NULL)) {
|
(GtdtPlatformTimerOffset == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
|
L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
|
||||||
@ -304,7 +307,8 @@ ParseAcpiGtdt (
|
|||||||
// Parse the specified number of Platform Timer Structures or the GTDT
|
// Parse the specified number of Platform Timer Structures or the GTDT
|
||||||
// buffer length. Whichever is minimum.
|
// buffer length. Whichever is minimum.
|
||||||
while ((Index++ < *GtdtPlatformTimerCount) &&
|
while ((Index++ < *GtdtPlatformTimerCount) &&
|
||||||
(Offset < AcpiTableLength)) {
|
(Offset < AcpiTableLength))
|
||||||
|
{
|
||||||
// Parse the Platform Timer Header to obtain Length and Type
|
// Parse the Platform Timer Header to obtain Length and Type
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
FALSE,
|
FALSE,
|
||||||
@ -318,7 +322,8 @@ ParseAcpiGtdt (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((PlatformTimerType == NULL) ||
|
if ((PlatformTimerType == NULL) ||
|
||||||
(PlatformTimerLength == NULL)) {
|
(PlatformTimerLength == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
@ -330,7 +335,8 @@ ParseAcpiGtdt (
|
|||||||
|
|
||||||
// Validate Platform Timer Structure length
|
// Validate Platform Timer Structure length
|
||||||
if ((*PlatformTimerLength == 0) ||
|
if ((*PlatformTimerLength == 0) ||
|
||||||
((Offset + (*PlatformTimerLength)) > AcpiTableLength)) {
|
((Offset + (*PlatformTimerLength)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid Platform Timer Structure length. " \
|
L"ERROR: Invalid Platform Timer Structure length. " \
|
||||||
|
@ -78,6 +78,7 @@ ValidateCacheAttributes (
|
|||||||
Attributes->TotalCacheLevels
|
Attributes->TotalCacheLevels
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Attributes->CacheLevel > 0x3) {
|
if (Attributes->CacheLevel > 0x3) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
@ -85,6 +86,7 @@ ValidateCacheAttributes (
|
|||||||
Attributes->CacheLevel
|
Attributes->CacheLevel
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Attributes->CacheAssociativity > 0x2) {
|
if (Attributes->CacheAssociativity > 0x2) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
@ -92,6 +94,7 @@ ValidateCacheAttributes (
|
|||||||
Attributes->CacheAssociativity
|
Attributes->CacheAssociativity
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Attributes->WritePolicy > 0x2) {
|
if (Attributes->WritePolicy > 0x2) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
@ -278,7 +281,8 @@ DumpSllbi (
|
|||||||
if ((SllbiFlags == NULL) ||
|
if ((SllbiFlags == NULL) ||
|
||||||
(SllbiDataType == NULL) ||
|
(SllbiDataType == NULL) ||
|
||||||
(NumberInitiatorProximityDomain == NULL) ||
|
(NumberInitiatorProximityDomain == NULL) ||
|
||||||
(NumberTargetProximityDomain == NULL)) {
|
(NumberTargetProximityDomain == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
@ -350,6 +354,7 @@ DumpSllbi (
|
|||||||
Print (L"Error: Unkown Data Type. DataType = 0x%x.\n", *SllbiDataType);
|
Print (L"Error: Unkown Data Type. DataType = 0x%x.\n", *SllbiDataType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrCpyS (Buffer, sizeof (Buffer), SllbiNames[*SllbiDataType]);
|
StrCpyS (Buffer, sizeof (Buffer), SllbiNames[*SllbiDataType]);
|
||||||
|
|
||||||
// Adjust base name depending on Memory Hierarchy in this Structure
|
// Adjust base name depending on Memory Hierarchy in this Structure
|
||||||
@ -381,7 +386,6 @@ DumpSllbi (
|
|||||||
SllbiFlags->MemoryHierarchy
|
SllbiFlags->MemoryHierarchy
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} // switch
|
} // switch
|
||||||
|
|
||||||
if (*NumberTargetProximityDomain <= MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX) {
|
if (*NumberTargetProximityDomain <= MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX) {
|
||||||
@ -400,34 +404,41 @@ DumpSllbi (
|
|||||||
|
|
||||||
for (IndexTarget = 0;
|
for (IndexTarget = 0;
|
||||||
IndexTarget < *NumberTargetProximityDomain;
|
IndexTarget < *NumberTargetProximityDomain;
|
||||||
IndexTarget++) {
|
IndexTarget++)
|
||||||
|
{
|
||||||
Print (L" %2d", IndexTarget);
|
Print (L" %2d", IndexTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\n ---+");
|
Print (L"\n ---+");
|
||||||
for (IndexTarget = 0;
|
for (IndexTarget = 0;
|
||||||
IndexTarget < *NumberTargetProximityDomain;
|
IndexTarget < *NumberTargetProximityDomain;
|
||||||
IndexTarget++) {
|
IndexTarget++)
|
||||||
|
{
|
||||||
Print (L"------");
|
Print (L"------");
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
|
|
||||||
TargetStartOffset = 0;
|
TargetStartOffset = 0;
|
||||||
for (IndexInitiator = 0;
|
for (IndexInitiator = 0;
|
||||||
IndexInitiator < *NumberInitiatorProximityDomain;
|
IndexInitiator < *NumberInitiatorProximityDomain;
|
||||||
IndexInitiator++) {
|
IndexInitiator++)
|
||||||
|
{
|
||||||
Print (L" %2d |", IndexInitiator);
|
Print (L" %2d |", IndexInitiator);
|
||||||
for (IndexTarget = 0;
|
for (IndexTarget = 0;
|
||||||
IndexTarget < *NumberTargetProximityDomain;
|
IndexTarget < *NumberTargetProximityDomain;
|
||||||
IndexTarget++) {
|
IndexTarget++)
|
||||||
|
{
|
||||||
Print (
|
Print (
|
||||||
L" %5d",
|
L" %5d",
|
||||||
LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
|
LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
|
||||||
);
|
);
|
||||||
} // for Target
|
} // for Target
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
TargetStartOffset += (*NumberTargetProximityDomain);
|
TargetStartOffset += (*NumberTargetProximityDomain);
|
||||||
} // for Initiator
|
} // for Initiator
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
} else {
|
} else {
|
||||||
// Display the latency/bandwidth matrix as a list
|
// Display the latency/bandwidth matrix as a list
|
||||||
@ -441,10 +452,12 @@ DumpSllbi (
|
|||||||
TargetStartOffset = 0;
|
TargetStartOffset = 0;
|
||||||
for (IndexInitiator = 0;
|
for (IndexInitiator = 0;
|
||||||
IndexInitiator < *NumberInitiatorProximityDomain;
|
IndexInitiator < *NumberInitiatorProximityDomain;
|
||||||
IndexInitiator++) {
|
IndexInitiator++)
|
||||||
|
{
|
||||||
for (IndexTarget = 0;
|
for (IndexTarget = 0;
|
||||||
IndexTarget < *NumberTargetProximityDomain;
|
IndexTarget < *NumberTargetProximityDomain;
|
||||||
IndexTarget++) {
|
IndexTarget++)
|
||||||
|
{
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
SecondBuffer,
|
SecondBuffer,
|
||||||
sizeof (SecondBuffer),
|
sizeof (SecondBuffer),
|
||||||
@ -459,6 +472,7 @@ DumpSllbi (
|
|||||||
LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
|
LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
|
||||||
);
|
);
|
||||||
} // for Target
|
} // for Target
|
||||||
|
|
||||||
TargetStartOffset += (*NumberTargetProximityDomain);
|
TargetStartOffset += (*NumberTargetProximityDomain);
|
||||||
} // for Initiator
|
} // for Initiator
|
||||||
}
|
}
|
||||||
@ -591,7 +605,8 @@ ParseAcpiHmat (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((HmatStructureType == NULL) ||
|
if ((HmatStructureType == NULL) ||
|
||||||
(HmatStructureLength == NULL)) {
|
(HmatStructureLength == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
@ -603,7 +618,8 @@ ParseAcpiHmat (
|
|||||||
|
|
||||||
// Validate HMAT Structure length.
|
// Validate HMAT Structure length.
|
||||||
if ((*HmatStructureLength == 0) ||
|
if ((*HmatStructureLength == 0) ||
|
||||||
((Offset + (*HmatStructureLength)) > AcpiTableLength)) {
|
((Offset + (*HmatStructureLength)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid HMAT Structure length. " \
|
L"ERROR: Invalid HMAT Structure length. " \
|
||||||
|
@ -273,7 +273,8 @@ DumpIortNodeIdMappings (
|
|||||||
Offset = 0;
|
Offset = 0;
|
||||||
|
|
||||||
while ((Index < MappingCount) &&
|
while ((Index < MappingCount) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
AsciiSPrint (
|
AsciiSPrint (
|
||||||
Buffer,
|
Buffer,
|
||||||
sizeof (Buffer),
|
sizeof (Buffer),
|
||||||
@ -328,7 +329,8 @@ DumpIortNodeSmmuV1V2 (
|
|||||||
if ((InterruptContextCount == NULL) ||
|
if ((InterruptContextCount == NULL) ||
|
||||||
(InterruptContextOffset == NULL) ||
|
(InterruptContextOffset == NULL) ||
|
||||||
(PmuInterruptCount == NULL) ||
|
(PmuInterruptCount == NULL) ||
|
||||||
(PmuInterruptOffset == NULL)) {
|
(PmuInterruptOffset == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient SMMUv1/2 node length. Length = %d\n",
|
L"ERROR: Insufficient SMMUv1/2 node length. Length = %d\n",
|
||||||
@ -341,7 +343,8 @@ DumpIortNodeSmmuV1V2 (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
while ((Index < *InterruptContextCount) &&
|
while ((Index < *InterruptContextCount) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
AsciiSPrint (
|
AsciiSPrint (
|
||||||
Buffer,
|
Buffer,
|
||||||
sizeof (Buffer),
|
sizeof (Buffer),
|
||||||
@ -363,7 +366,8 @@ DumpIortNodeSmmuV1V2 (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
while ((Index < *PmuInterruptCount) &&
|
while ((Index < *PmuInterruptCount) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
AsciiSPrint (
|
AsciiSPrint (
|
||||||
Buffer,
|
Buffer,
|
||||||
sizeof (Buffer),
|
sizeof (Buffer),
|
||||||
@ -462,7 +466,8 @@ DumpIortNodeIts (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
while ((Index < *ItsCount) &&
|
while ((Index < *ItsCount) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
AsciiSPrint (
|
AsciiSPrint (
|
||||||
Buffer,
|
Buffer,
|
||||||
sizeof (Buffer),
|
sizeof (Buffer),
|
||||||
@ -481,7 +486,6 @@ DumpIortNodeIts (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note: ITS does not have the ID Mappings Array
|
// Note: ITS does not have the ID Mappings Array
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -517,10 +521,12 @@ DumpIortNodeNamedComponent (
|
|||||||
PrintFieldName (2, L"Device Object Name");
|
PrintFieldName (2, L"Device Object Name");
|
||||||
|
|
||||||
while ((*(Ptr + Offset) != 0) &&
|
while ((*(Ptr + Offset) != 0) &&
|
||||||
(Offset < Length)) {
|
(Offset < Length))
|
||||||
|
{
|
||||||
Print (L"%c", *(Ptr + Offset));
|
Print (L"%c", *(Ptr + Offset));
|
||||||
Offset++;
|
Offset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
|
|
||||||
DumpIortNodeIdMappings (
|
DumpIortNodeIdMappings (
|
||||||
@ -646,7 +652,8 @@ ParseAcpiIort (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((IortNodeCount == NULL) ||
|
if ((IortNodeCount == NULL) ||
|
||||||
(IortNodeOffset == NULL)) {
|
(IortNodeOffset == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
|
L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
|
||||||
@ -662,7 +669,8 @@ ParseAcpiIort (
|
|||||||
// Parse the specified number of IORT nodes or the IORT table buffer length.
|
// Parse the specified number of IORT nodes or the IORT table buffer length.
|
||||||
// Whichever is minimum.
|
// Whichever is minimum.
|
||||||
while ((Index++ < *IortNodeCount) &&
|
while ((Index++ < *IortNodeCount) &&
|
||||||
(Offset < AcpiTableLength)) {
|
(Offset < AcpiTableLength))
|
||||||
|
{
|
||||||
// Parse the IORT Node Header
|
// Parse the IORT Node Header
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
FALSE,
|
FALSE,
|
||||||
@ -678,7 +686,8 @@ ParseAcpiIort (
|
|||||||
if ((IortNodeType == NULL) ||
|
if ((IortNodeType == NULL) ||
|
||||||
(IortNodeLength == NULL) ||
|
(IortNodeLength == NULL) ||
|
||||||
(IortIdMappingCount == NULL) ||
|
(IortIdMappingCount == NULL) ||
|
||||||
(IortIdMappingOffset == NULL)) {
|
(IortIdMappingOffset == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
@ -690,7 +699,8 @@ ParseAcpiIort (
|
|||||||
|
|
||||||
// Validate IORT Node length
|
// Validate IORT Node length
|
||||||
if ((*IortNodeLength == 0) ||
|
if ((*IortNodeLength == 0) ||
|
||||||
((Offset + (*IortNodeLength)) > AcpiTableLength)) {
|
((Offset + (*IortNodeLength)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid IORT Node length. " \
|
L"ERROR: Invalid IORT Node length. " \
|
||||||
|
@ -73,7 +73,8 @@ ValidateSpeOverflowInterrupt (
|
|||||||
if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) ||
|
if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) ||
|
||||||
((SpeOverflowInterrupt > ARM_PPI_ID_MAX) &&
|
((SpeOverflowInterrupt > ARM_PPI_ID_MAX) &&
|
||||||
(SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) ||
|
(SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) ||
|
||||||
(SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) {
|
(SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID "
|
L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID "
|
||||||
@ -205,7 +206,6 @@ STATIC CONST ACPI_PARSER InterruptSourceOverride[] = {
|
|||||||
{ L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL }
|
{ L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
An ACPI_PARSER array describing the Processor Local x2APIC Structure.
|
An ACPI_PARSER array describing the Processor Local x2APIC Structure.
|
||||||
**/
|
**/
|
||||||
@ -315,7 +315,8 @@ ParseAcpiMadt (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((MadtInterruptControllerType == NULL) ||
|
if ((MadtInterruptControllerType == NULL) ||
|
||||||
(MadtInterruptControllerLength == NULL)) {
|
(MadtInterruptControllerLength == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
@ -327,7 +328,8 @@ ParseAcpiMadt (
|
|||||||
|
|
||||||
// Validate Interrupt Controller Structure length
|
// Validate Interrupt Controller Structure length
|
||||||
if ((*MadtInterruptControllerLength == 0) ||
|
if ((*MadtInterruptControllerLength == 0) ||
|
||||||
((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength)) {
|
((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid Interrupt Controller Structure length. " \
|
L"ERROR: Invalid Interrupt Controller Structure length. " \
|
||||||
@ -340,7 +342,8 @@ ParseAcpiMadt (
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (*MadtInterruptControllerType) {
|
switch (*MadtInterruptControllerType) {
|
||||||
case EFI_ACPI_6_3_GIC: {
|
case EFI_ACPI_6_3_GIC:
|
||||||
|
{
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -352,7 +355,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFI_ACPI_6_3_GICD: {
|
case EFI_ACPI_6_3_GICD:
|
||||||
|
{
|
||||||
if (++GICDCount > 1) {
|
if (++GICDCount > 1) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
@ -361,6 +365,7 @@ ParseAcpiMadt (
|
|||||||
GICDCount
|
GICDCount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -372,7 +377,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFI_ACPI_6_3_GIC_MSI_FRAME: {
|
case EFI_ACPI_6_3_GIC_MSI_FRAME:
|
||||||
|
{
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -384,7 +390,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFI_ACPI_6_3_GICR: {
|
case EFI_ACPI_6_3_GICR:
|
||||||
|
{
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -396,7 +403,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFI_ACPI_6_3_GIC_ITS: {
|
case EFI_ACPI_6_3_GIC_ITS:
|
||||||
|
{
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -408,7 +416,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFI_ACPI_6_3_IO_APIC: {
|
case EFI_ACPI_6_3_IO_APIC:
|
||||||
|
{
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -420,7 +429,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE: {
|
case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE:
|
||||||
|
{
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -432,7 +442,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC: {
|
case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
|
||||||
|
{
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -444,7 +455,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EFI_ACPI_6_3_LOCAL_X2APIC_NMI: {
|
case EFI_ACPI_6_3_LOCAL_X2APIC_NMI:
|
||||||
|
{
|
||||||
ParseAcpi (
|
ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
2,
|
2,
|
||||||
@ -456,7 +468,8 @@ ParseAcpiMadt (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Unknown Interrupt Controller Structure,"
|
L"ERROR: Unknown Interrupt Controller Structure,"
|
||||||
|
@ -152,7 +152,8 @@ ValidatePccDoorbellGas (
|
|||||||
if (IsZeroBuffer (
|
if (IsZeroBuffer (
|
||||||
Ptr,
|
Ptr,
|
||||||
sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
|
sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,11 +185,13 @@ ValidatePccIntAckGas (
|
|||||||
EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) ||
|
EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) ||
|
||||||
((*ExtendedPccSubspaceInterruptFlags &
|
((*ExtendedPccSubspaceInterruptFlags &
|
||||||
EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) ==
|
EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) ==
|
||||||
EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) {
|
EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE))
|
||||||
|
{
|
||||||
if (IsZeroBuffer (
|
if (IsZeroBuffer (
|
||||||
Ptr,
|
Ptr,
|
||||||
sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
|
sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,7 +241,8 @@ ValidatePlatInterrupt (
|
|||||||
// Interrupt flag must be set to 1.
|
// Interrupt flag must be set to 1.
|
||||||
if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
|
if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
|
||||||
((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
|
((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
|
||||||
EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT)) {
|
EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"\nError: Global Platform interrupt flag must be set to 1" \
|
L"\nError: Global Platform interrupt flag must be set to 1" \
|
||||||
@ -584,7 +588,8 @@ ParseAcpiPcct (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((PccSubspaceType == NULL) ||
|
if ((PccSubspaceType == NULL) ||
|
||||||
(PccSubspaceLength == NULL)) {
|
(PccSubspaceLength == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
@ -596,7 +601,8 @@ ParseAcpiPcct (
|
|||||||
|
|
||||||
// Validate Structure length
|
// Validate Structure length
|
||||||
if ((*PccSubspaceLength == 0) ||
|
if ((*PccSubspaceLength == 0) ||
|
||||||
((Offset + (*PccSubspaceLength)) > AcpiTableLength)) {
|
((Offset + (*PccSubspaceLength)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid Structure length. " \
|
L"ERROR: Invalid Structure length. " \
|
||||||
|
@ -39,6 +39,7 @@ ValidateCacheNumberOfSets (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 NumberOfSets;
|
UINT32 NumberOfSets;
|
||||||
|
|
||||||
NumberOfSets = *(UINT32 *)Ptr;
|
NumberOfSets = *(UINT32 *)Ptr;
|
||||||
|
|
||||||
if (NumberOfSets == 0) {
|
if (NumberOfSets == 0) {
|
||||||
@ -68,8 +69,8 @@ ValidateCacheNumberOfSets (
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,6 +90,7 @@ ValidateCacheAssociativity (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 Associativity;
|
UINT8 Associativity;
|
||||||
|
|
||||||
Associativity = *(UINT8 *)Ptr;
|
Associativity = *(UINT8 *)Ptr;
|
||||||
|
|
||||||
if (Associativity == 0) {
|
if (Associativity == 0) {
|
||||||
@ -123,7 +125,8 @@ ValidateCacheLineSize (
|
|||||||
LineSize = *(UINT16 *)Ptr;
|
LineSize = *(UINT16 *)Ptr;
|
||||||
|
|
||||||
if ((LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) ||
|
if ((LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) ||
|
||||||
(LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX)) {
|
(LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"\nERROR: The cache line size must be between %d and %d bytes"
|
L"\nERROR: The cache line size must be between %d and %d bytes"
|
||||||
@ -138,6 +141,7 @@ ValidateCacheLineSize (
|
|||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (L"\nERROR: The cache line size is not a power of 2.");
|
Print (L"\nERROR: The cache line size is not a power of 2.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +164,7 @@ ValidateCacheAttributes (
|
|||||||
// Version 6.2 Errata A, September 2017
|
// Version 6.2 Errata A, September 2017
|
||||||
// Table 5-153: Cache Type Structure
|
// Table 5-153: Cache Type Structure
|
||||||
UINT8 Attributes;
|
UINT8 Attributes;
|
||||||
|
|
||||||
Attributes = *(UINT8 *)Ptr;
|
Attributes = *(UINT8 *)Ptr;
|
||||||
|
|
||||||
if ((Attributes & 0xE0) != 0) {
|
if ((Attributes & 0xE0) != 0) {
|
||||||
@ -416,7 +421,8 @@ ParseAcpiPptt (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((ProcessorTopologyStructureType == NULL) ||
|
if ((ProcessorTopologyStructureType == NULL) ||
|
||||||
(ProcessorTopologyStructureLength == NULL)) {
|
(ProcessorTopologyStructureLength == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
@ -428,7 +434,8 @@ ParseAcpiPptt (
|
|||||||
|
|
||||||
// Validate Processor Topology Structure length
|
// Validate Processor Topology Structure length
|
||||||
if ((*ProcessorTopologyStructureLength == 0) ||
|
if ((*ProcessorTopologyStructureLength == 0) ||
|
||||||
((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) {
|
((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid Processor Topology Structure length. " \
|
L"ERROR: Invalid Processor Topology Structure length. " \
|
||||||
|
@ -47,6 +47,7 @@ ValidateRsdtAddress (
|
|||||||
RsdtAddr
|
RsdtAddr
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ ValidateXsdtAddress (
|
|||||||
XsdtAddr
|
XsdtAddr
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +144,14 @@ ParseAcpiSlit (
|
|||||||
for (Index = 0; Index < LocalityCount; Index++) {
|
for (Index = 0; Index < LocalityCount; Index++) {
|
||||||
Print (L" (%3d) ", Index);
|
Print (L" (%3d) ", Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
for (Count = 0; Count < LocalityCount; Count++) {
|
for (Count = 0; Count < LocalityCount; Count++) {
|
||||||
Print (L" (%3d) ", Count);
|
Print (L" (%3d) ", Count);
|
||||||
for (Index = 0; Index < LocalityCount; Index++) {
|
for (Index = 0; Index < LocalityCount; Index++) {
|
||||||
Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index));
|
Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,9 +170,11 @@ ParseAcpiSlit (
|
|||||||
SLIT_ELEMENT (LocalityPtr, Count, Index)
|
SLIT_ELEMENT (LocalityPtr, Count, Index)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Element[i][j] must be equal to Element[j][i]
|
// Element[i][j] must be equal to Element[j][i]
|
||||||
if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=
|
if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=
|
||||||
SLIT_ELEMENT (LocalityPtr, Index, Count)) {
|
SLIT_ELEMENT (LocalityPtr, Index, Count))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
|
L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
|
||||||
|
@ -39,13 +39,15 @@ ValidateInterruptType (
|
|||||||
InterruptType = *Ptr;
|
InterruptType = *Ptr;
|
||||||
|
|
||||||
if (InterruptType !=
|
if (InterruptType !=
|
||||||
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) {
|
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC)
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms",
|
L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms",
|
||||||
InterruptType
|
InterruptType
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +78,7 @@ ValidateIrq (
|
|||||||
Irq
|
Irq
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,7 +403,8 @@ ParseAcpiSrat (
|
|||||||
// Check if the values used to control the parsing logic have been
|
// Check if the values used to control the parsing logic have been
|
||||||
// successfully read.
|
// successfully read.
|
||||||
if ((SratRAType == NULL) ||
|
if ((SratRAType == NULL) ||
|
||||||
(SratRALength == NULL)) {
|
(SratRALength == NULL))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||||
@ -415,7 +416,8 @@ ParseAcpiSrat (
|
|||||||
|
|
||||||
// Validate Static Resource Allocation Structure length
|
// Validate Static Resource Allocation Structure length
|
||||||
if ((*SratRALength == 0) ||
|
if ((*SratRALength == 0) ||
|
||||||
((Offset + (*SratRALength)) > AcpiTableLength)) {
|
((Offset + (*SratRALength)) > AcpiTableLength))
|
||||||
|
{
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Invalid Static Resource Allocation Structure length. " \
|
L"ERROR: Invalid Static Resource Allocation Structure length. " \
|
||||||
|
@ -122,6 +122,7 @@ ParseAcpiXsdt (
|
|||||||
*TablePointer
|
*TablePointer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset += sizeof (UINT64);
|
Offset += sizeof (UINT64);
|
||||||
TablePointer++;
|
TablePointer++;
|
||||||
} // while
|
} // while
|
||||||
@ -134,6 +135,7 @@ ParseAcpiXsdt (
|
|||||||
if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
|
if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
|
||||||
ProcessAcpiTable ((UINT8 *)(UINTN)(*TablePointer));
|
ProcessAcpiTable ((UINT8 *)(UINTN)(*TablePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset += sizeof (UINT64);
|
Offset += sizeof (UINT64);
|
||||||
TablePointer++;
|
TablePointer++;
|
||||||
} // while
|
} // while
|
||||||
|
@ -101,6 +101,7 @@ RegisterAllParsers (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +211,7 @@ ShellCommandRunAcpiView (
|
|||||||
|
|
||||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -224,6 +225,7 @@ ShellCommandRunAcpiView (
|
|||||||
} else {
|
} else {
|
||||||
Print (L"acpiview: Error processing input parameter(s)\n");
|
Print (L"acpiview: Error processing input parameter(s)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
if (ShellCommandLineGetCount (Package) > 1) {
|
if (ShellCommandLineGetCount (Package) > 1) {
|
||||||
@ -246,7 +248,8 @@ ShellCommandRunAcpiView (
|
|||||||
L"acpiview"
|
L"acpiview"
|
||||||
);
|
);
|
||||||
} else if (ShellCommandLineGetFlag (Package, L"-s") &&
|
} else if (ShellCommandLineGetFlag (Package, L"-s") &&
|
||||||
ShellCommandLineGetValue (Package, L"-s") == NULL) {
|
(ShellCommandLineGetValue (Package, L"-s") == NULL))
|
||||||
|
{
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -258,7 +261,8 @@ ShellCommandRunAcpiView (
|
|||||||
);
|
);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else if (ShellCommandLineGetFlag (Package, L"-r") &&
|
} else if (ShellCommandLineGetFlag (Package, L"-r") &&
|
||||||
ShellCommandLineGetValue (Package, L"-r") == NULL) {
|
(ShellCommandLineGetValue (Package, L"-r") == NULL))
|
||||||
|
{
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -270,7 +274,8 @@ ShellCommandRunAcpiView (
|
|||||||
);
|
);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else if ((ShellCommandLineGetFlag (Package, L"-s") &&
|
} else if ((ShellCommandLineGetFlag (Package, L"-s") &&
|
||||||
ShellCommandLineGetFlag (Package, L"-l"))) {
|
ShellCommandLineGetFlag (Package, L"-l")))
|
||||||
|
{
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -281,7 +286,8 @@ ShellCommandRunAcpiView (
|
|||||||
);
|
);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else if (ShellCommandLineGetFlag (Package, L"-d") &&
|
} else if (ShellCommandLineGetFlag (Package, L"-d") &&
|
||||||
!ShellCommandLineGetFlag (Package, L"-s")) {
|
!ShellCommandLineGetFlag (Package, L"-s"))
|
||||||
|
{
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -349,6 +355,7 @@ ShellCommandRunAcpiView (
|
|||||||
);
|
);
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete Temporary file.
|
// Delete Temporary file.
|
||||||
ShellDeleteFile (&TmpDumpFileHandle);
|
ShellDeleteFile (&TmpDumpFileHandle);
|
||||||
} // -d
|
} // -d
|
||||||
@ -367,6 +374,7 @@ Done:
|
|||||||
if (Package != NULL) {
|
if (Package != NULL) {
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShellStatus;
|
return ShellStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,6 +398,7 @@ UefiShellAcpiViewCommandLibConstructor (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
gShellAcpiViewHiiHandle = NULL;
|
gShellAcpiViewHiiHandle = NULL;
|
||||||
|
|
||||||
// Check Shell Profile Debug1 bit of the profiles mask
|
// Check Shell Profile Debug1 bit of the profiles mask
|
||||||
@ -412,6 +421,7 @@ UefiShellAcpiViewCommandLibConstructor (
|
|||||||
if (gShellAcpiViewHiiHandle == NULL) {
|
if (gShellAcpiViewHiiHandle == NULL) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Install our Shell command handler
|
// Install our Shell command handler
|
||||||
ShellCommandRegisterCommandName (
|
ShellCommandRegisterCommandName (
|
||||||
L"acpiview",
|
L"acpiview",
|
||||||
@ -443,5 +453,6 @@ UefiShellAcpiViewCommandLibDestructor (
|
|||||||
if (gShellAcpiViewHiiHandle != NULL) {
|
if (gShellAcpiViewHiiHandle != NULL) {
|
||||||
HiiRemovePackages (gShellAcpiViewHiiHandle);
|
HiiRemovePackages (gShellAcpiViewHiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#include <Guid/GlobalVariable.h>
|
#include <Guid/GlobalVariable.h>
|
||||||
@ -114,18 +113,21 @@ UpdateOptionalData(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&OriginalSize,
|
&OriginalSize,
|
||||||
OriginalData);
|
OriginalData
|
||||||
|
);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
OriginalData = AllocateZeroPool (OriginalSize);
|
OriginalData = AllocateZeroPool (OriginalSize);
|
||||||
if (OriginalData == NULL) {
|
if (OriginalData == NULL) {
|
||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
VariableName,
|
VariableName,
|
||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&OriginalSize,
|
&OriginalSize,
|
||||||
OriginalData);
|
OriginalData
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
@ -155,7 +157,8 @@ UpdateOptionalData(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
NewSize,
|
NewSize,
|
||||||
NewData);
|
NewData
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (OriginalData);
|
SHELL_FREE_NON_NULL (OriginalData);
|
||||||
@ -195,7 +198,8 @@ GetBootOptionCrc(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
Buffer = AllocateZeroPool (BufferSize);
|
Buffer = AllocateZeroPool (BufferSize);
|
||||||
Status = gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
@ -203,7 +207,8 @@ GetBootOptionCrc(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
Buffer);
|
Buffer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -263,14 +268,18 @@ GetDevicePathForDriverHandle (
|
|||||||
LoadedImage->DeviceHandle,
|
LoadedImage->DeviceHandle,
|
||||||
&gEfiDevicePathProtocolGuid,
|
&gEfiDevicePathProtocolGuid,
|
||||||
gImageHandle,
|
gImageHandle,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
TheHandle,
|
TheHandle,
|
||||||
&gEfiLoadedImageProtocolGuid,
|
&gEfiLoadedImageProtocolGuid,
|
||||||
gImageHandle,
|
gImageHandle,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,11 +332,12 @@ GetDevicePathByHandle(
|
|||||||
|
|
||||||
Status = gBS->HandleProtocol (TheHandle, &gEfiDevicePathProtocolGuid, (VOID **)DevicePath);
|
Status = gBS->HandleProtocol (TheHandle, &gEfiDevicePathProtocolGuid, (VOID **)DevicePath);
|
||||||
|
|
||||||
if ( DriverBindingHandleCount > 0 ||
|
if ((DriverBindingHandleCount > 0) ||
|
||||||
ParentControllerHandleCount > 0 ||
|
(ParentControllerHandleCount > 0) ||
|
||||||
ChildControllerHandleCount > 0 ||
|
(ChildControllerHandleCount > 0) ||
|
||||||
!EFI_ERROR (Status)
|
!EFI_ERROR (Status)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// The handle points to a real controller which has a device path.
|
// The handle points to a real controller which has a device path.
|
||||||
//
|
//
|
||||||
@ -335,7 +345,8 @@ GetDevicePathByHandle(
|
|||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
NULL,STRING_TOKEN (STR_GEN_PARAM_INV),
|
NULL,
|
||||||
|
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||||
gShellBcfgHiiHandle,
|
gShellBcfgHiiHandle,
|
||||||
L"bcfg",
|
L"bcfg",
|
||||||
L"Handle should point to driver image."
|
L"Handle should point to driver image."
|
||||||
@ -401,12 +412,13 @@ BcfgMod (
|
|||||||
|
|
||||||
ZeroMem (&LoadOption, sizeof (EFI_BOOT_MANAGER_LOAD_OPTION));
|
ZeroMem (&LoadOption, sizeof (EFI_BOOT_MANAGER_LOAD_OPTION));
|
||||||
|
|
||||||
if ( (BcfgOperation->Type == BcfgTypeMod && BcfgOperation->Description == NULL) ||
|
if (((BcfgOperation->Type == BcfgTypeMod) && (BcfgOperation->Description == NULL)) ||
|
||||||
(BcfgOperation->Type == BcfgTypeModf && BcfgOperation->FileName == NULL) ||
|
((BcfgOperation->Type == BcfgTypeModf) && (BcfgOperation->FileName == NULL)) ||
|
||||||
(BcfgOperation->Type == BcfgTypeModp && BcfgOperation->FileName == NULL) ||
|
((BcfgOperation->Type == BcfgTypeModp) && (BcfgOperation->FileName == NULL)) ||
|
||||||
(BcfgOperation->Type == BcfgTypeModh && BcfgOperation->HandleIndex == 0) ||
|
((BcfgOperation->Type == BcfgTypeModh) && (BcfgOperation->HandleIndex == 0)) ||
|
||||||
(BcfgOperation->Number1 > OrderCount)
|
(BcfgOperation->Number1 > OrderCount)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return (SHELL_INVALID_PARAMETER);
|
return (SHELL_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +428,7 @@ BcfgMod (
|
|||||||
if (ShellStatus == SHELL_SUCCESS) {
|
if (ShellStatus == SHELL_SUCCESS) {
|
||||||
DevicePath = DuplicateDevicePath (DevicePathBuffer);
|
DevicePath = DuplicateDevicePath (DevicePathBuffer);
|
||||||
}
|
}
|
||||||
} else if (BcfgOperation->Type == BcfgTypeModf || BcfgOperation->Type == BcfgTypeModp) {
|
} else if ((BcfgOperation->Type == BcfgTypeModf) || (BcfgOperation->Type == BcfgTypeModp)) {
|
||||||
//
|
//
|
||||||
// Get Device Path by FileName.
|
// Get Device Path by FileName.
|
||||||
//
|
//
|
||||||
@ -427,8 +439,7 @@ BcfgMod (
|
|||||||
//
|
//
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellBcfgHiiHandle, L"bcfg", BcfgOperation->FileName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellBcfgHiiHandle, L"bcfg", BcfgOperation->FileName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
} else if (FileList->Link.ForwardLink != FileList->Link.BackLink) {
|
||||||
else if (FileList->Link.ForwardLink != FileList->Link.BackLink) {
|
|
||||||
//
|
//
|
||||||
// If the name of file expanded to multiple names, it's fail.
|
// If the name of file expanded to multiple names, it's fail.
|
||||||
//
|
//
|
||||||
@ -453,9 +464,10 @@ BcfgMod (
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
DevicePathWalker = DevicePathBuffer;
|
DevicePathWalker = DevicePathBuffer;
|
||||||
while (!IsDevicePathEnd (DevicePathWalker)) {
|
while (!IsDevicePathEnd (DevicePathWalker)) {
|
||||||
if ( DevicePathType (DevicePathWalker) == MEDIA_DEVICE_PATH &&
|
if ((DevicePathType (DevicePathWalker) == MEDIA_DEVICE_PATH) &&
|
||||||
DevicePathSubType (DevicePathWalker) == MEDIA_HARDDRIVE_DP
|
(DevicePathSubType (DevicePathWalker) == MEDIA_HARDDRIVE_DP)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// We found the portion of device path starting with the hard driver partition.
|
// We found the portion of device path starting with the hard driver partition.
|
||||||
//
|
//
|
||||||
@ -480,6 +492,7 @@ BcfgMod (
|
|||||||
} else {
|
} else {
|
||||||
UnicodeSPrint (OptionStr, sizeof (OptionStr), L"Driver%04x", BcfgOperation->Order[BcfgOperation->Number1]);
|
UnicodeSPrint (OptionStr, sizeof (OptionStr), L"Driver%04x", BcfgOperation->Order[BcfgOperation->Number1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EfiBootManagerVariableToLoadOption (OptionStr, &LoadOption);
|
Status = EfiBootManagerVariableToLoadOption (OptionStr, &LoadOption);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NONE), gShellBcfgHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NONE), gShellBcfgHiiHandle);
|
||||||
@ -568,7 +581,7 @@ BcfgAdd(
|
|||||||
UINT16 *NewOrder;
|
UINT16 *NewOrder;
|
||||||
|
|
||||||
if (!UseHandle) {
|
if (!UseHandle) {
|
||||||
if (File == NULL || Desc == NULL) {
|
if ((File == NULL) || (Desc == NULL)) {
|
||||||
return (SHELL_INVALID_PARAMETER);
|
return (SHELL_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -601,27 +614,33 @@ BcfgAdd(
|
|||||||
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
|
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
|
||||||
CurHandle,
|
CurHandle,
|
||||||
&DriverBindingHandleCount,
|
&DriverBindingHandleCount,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
Status = PARSE_HANDLE_DATABASE_PARENTS (
|
Status = PARSE_HANDLE_DATABASE_PARENTS (
|
||||||
CurHandle,
|
CurHandle,
|
||||||
&ParentControllerHandleCount,
|
&ParentControllerHandleCount,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
Status = ParseHandleDatabaseForChildControllers (
|
Status = ParseHandleDatabaseForChildControllers (
|
||||||
CurHandle,
|
CurHandle,
|
||||||
&ChildControllerHandleCount,
|
&ChildControllerHandleCount,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
if (DriverBindingHandleCount > 0
|
if ( (DriverBindingHandleCount > 0)
|
||||||
|| ParentControllerHandleCount > 0
|
|| (ParentControllerHandleCount > 0)
|
||||||
|| ChildControllerHandleCount > 0) {
|
|| (ChildControllerHandleCount > 0))
|
||||||
|
{
|
||||||
FilePath = NULL;
|
FilePath = NULL;
|
||||||
Status = gBS->HandleProtocol (
|
Status = gBS->HandleProtocol (
|
||||||
CurHandle,
|
CurHandle,
|
||||||
&gEfiDevicePathProtocolGuid,
|
&gEfiDevicePathProtocolGuid,
|
||||||
(VOID**)&FilePath);
|
(VOID **)&FilePath
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_HANDLE), gShellBcfgHiiHandle, L"bcfg", HandleNumber);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_HANDLE), gShellBcfgHiiHandle, L"bcfg", HandleNumber);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -633,27 +652,32 @@ BcfgAdd(
|
|||||||
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
|
Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (
|
||||||
CurHandle,
|
CurHandle,
|
||||||
&DriverBindingHandleCount,
|
&DriverBindingHandleCount,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
Status = PARSE_HANDLE_DATABASE_PARENTS (
|
Status = PARSE_HANDLE_DATABASE_PARENTS (
|
||||||
CurHandle,
|
CurHandle,
|
||||||
&ParentControllerHandleCount,
|
&ParentControllerHandleCount,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
Status = ParseHandleDatabaseForChildControllers (
|
Status = ParseHandleDatabaseForChildControllers (
|
||||||
CurHandle,
|
CurHandle,
|
||||||
&ChildControllerHandleCount,
|
&ChildControllerHandleCount,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
Status = gBS->HandleProtocol (
|
Status = gBS->HandleProtocol (
|
||||||
CurHandle,
|
CurHandle,
|
||||||
&gEfiDevicePathProtocolGuid,
|
&gEfiDevicePathProtocolGuid,
|
||||||
(VOID**)&FilePath);
|
(VOID **)&FilePath
|
||||||
|
);
|
||||||
|
|
||||||
if (DriverBindingHandleCount > 0
|
if ( (DriverBindingHandleCount > 0)
|
||||||
|| ParentControllerHandleCount > 0
|
|| (ParentControllerHandleCount > 0)
|
||||||
|| ChildControllerHandleCount > 0
|
|| (ChildControllerHandleCount > 0)
|
||||||
|| !EFI_ERROR(Status) ) {
|
|| !EFI_ERROR (Status))
|
||||||
|
{
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Handle Number");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -705,8 +729,8 @@ BcfgAdd(
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
while (!IsDevicePathEnd (DevPath)) {
|
while (!IsDevicePathEnd (DevPath)) {
|
||||||
if ((DevicePathType (DevPath) == MEDIA_DEVICE_PATH) &&
|
if ((DevicePathType (DevPath) == MEDIA_DEVICE_PATH) &&
|
||||||
(DevicePathSubType(DevPath) == MEDIA_HARDDRIVE_DP)) {
|
(DevicePathSubType (DevPath) == MEDIA_HARDDRIVE_DP))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// If we find it use it instead
|
// If we find it use it instead
|
||||||
//
|
//
|
||||||
@ -714,18 +738,19 @@ BcfgAdd(
|
|||||||
FilePath = DuplicateDevicePath (DevPath);
|
FilePath = DuplicateDevicePath (DevPath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DevPath = NextDevicePathNode (DevPath);
|
DevPath = NextDevicePathNode (DevPath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FilePath = DuplicateDevicePath (DevicePath);
|
FilePath = DuplicateDevicePath (DevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (DevicePath);
|
FreePool (DevicePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ShellStatus == SHELL_SUCCESS) {
|
if (ShellStatus == SHELL_SUCCESS) {
|
||||||
//
|
//
|
||||||
// Find a free target ,a brute force implementation
|
// Find a free target ,a brute force implementation
|
||||||
@ -825,7 +850,7 @@ BcfgAdd(
|
|||||||
//
|
//
|
||||||
// If always Free FilePath, will free devicepath in system when use "addh"
|
// If always Free FilePath, will free devicepath in system when use "addh"
|
||||||
//
|
//
|
||||||
if (FilePath!=NULL && !UseHandle) {
|
if ((FilePath != NULL) && !UseHandle) {
|
||||||
FreePool (FilePath);
|
FreePool (FilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,11 +899,13 @@ BcfgRemove(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
0,
|
0,
|
||||||
NULL);
|
NULL
|
||||||
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
||||||
return (SHELL_INVALID_PARAMETER);
|
return (SHELL_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewOrder = AllocateZeroPool (OrderCount*sizeof (CurrentOrder[0]));
|
NewOrder = AllocateZeroPool (OrderCount*sizeof (CurrentOrder[0]));
|
||||||
if (NewOrder != NULL) {
|
if (NewOrder != NULL) {
|
||||||
NewCount = OrderCount;
|
NewCount = OrderCount;
|
||||||
@ -891,15 +918,18 @@ BcfgRemove(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
NewCount*sizeof (NewOrder[0]),
|
NewCount*sizeof (NewOrder[0]),
|
||||||
NewOrder);
|
NewOrder
|
||||||
|
);
|
||||||
FreePool (NewOrder);
|
FreePool (NewOrder);
|
||||||
} else {
|
} else {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder");
|
||||||
return (SHELL_INVALID_PARAMETER);
|
return (SHELL_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (SHELL_SUCCESS);
|
return (SHELL_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,7 +984,8 @@ BcfgMove(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
OrderCount*sizeof (CurrentOrder[0]),
|
OrderCount*sizeof (CurrentOrder[0]),
|
||||||
NewOrder);
|
NewOrder
|
||||||
|
);
|
||||||
|
|
||||||
FreePool (NewOrder);
|
FreePool (NewOrder);
|
||||||
|
|
||||||
@ -962,6 +993,7 @@ BcfgMove(
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellBcfgHiiHandle, L"bcfg", Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder");
|
||||||
return (SHELL_INVALID_PARAMETER);
|
return (SHELL_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (SHELL_SUCCESS);
|
return (SHELL_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1020,17 +1052,19 @@ BcfgAddOpt(
|
|||||||
// Get the index of the variable we are changing.
|
// Get the index of the variable we are changing.
|
||||||
//
|
//
|
||||||
Status = ShellConvertStringToUint64 (Walker, &Intermediate, TRUE, TRUE);
|
Status = ShellConvertStringToUint64 (Walker, &Intermediate, TRUE, TRUE);
|
||||||
if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL || ((UINT16)Intermediate) > ((UINT16)OrderCount)) {
|
if (EFI_ERROR (Status) || (((UINT16)Intermediate) != Intermediate) || (StrStr (Walker, L" ") == NULL) || (((UINT16)Intermediate) > ((UINT16)OrderCount))) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Option Index");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", L"Option Index");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionIndex = (UINT16)Intermediate;
|
OptionIndex = (UINT16)Intermediate;
|
||||||
|
|
||||||
Temp = StrStr (Walker, L" ");
|
Temp = StrStr (Walker, L" ");
|
||||||
if (Temp != NULL) {
|
if (Temp != NULL) {
|
||||||
Walker = Temp;
|
Walker = Temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Walker[0] == L' ') {
|
while (Walker[0] == L' ') {
|
||||||
Walker++;
|
Walker++;
|
||||||
}
|
}
|
||||||
@ -1043,7 +1077,7 @@ BcfgAddOpt(
|
|||||||
// quoted filename or quoted information.
|
// quoted filename or quoted information.
|
||||||
//
|
//
|
||||||
Temp = StrStr (Walker+1, L"\"");
|
Temp = StrStr (Walker+1, L"\"");
|
||||||
if (Temp == NULL || StrLen(Temp) != 1) {
|
if ((Temp == NULL) || (StrLen (Temp) != 1)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1053,6 +1087,7 @@ BcfgAddOpt(
|
|||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
Temp2 = StrStr (FileName, L"\"");
|
Temp2 = StrStr (FileName, L"\"");
|
||||||
ASSERT (Temp2 != NULL);
|
ASSERT (Temp2 != NULL);
|
||||||
Temp2[0] = CHAR_NULL;
|
Temp2[0] = CHAR_NULL;
|
||||||
@ -1061,6 +1096,7 @@ BcfgAddOpt(
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (ShellFileExists (Walker))) {
|
if (EFI_ERROR (ShellFileExists (Walker))) {
|
||||||
//
|
//
|
||||||
// Not a file. must be misc information.
|
// Not a file. must be misc information.
|
||||||
@ -1096,15 +1132,17 @@ BcfgAddOpt(
|
|||||||
// Get hot key information
|
// Get hot key information
|
||||||
//
|
//
|
||||||
Status = ShellConvertStringToUint64 (Walker, &Intermediate, FALSE, TRUE);
|
Status = ShellConvertStringToUint64 (Walker, &Intermediate, FALSE, TRUE);
|
||||||
if (EFI_ERROR(Status) || (((UINT32)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL) {
|
if (EFI_ERROR (Status) || (((UINT32)Intermediate) != Intermediate) || (StrStr (Walker, L" ") == NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate;
|
NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate;
|
||||||
Temp = StrStr (Walker, L" ");
|
Temp = StrStr (Walker, L" ");
|
||||||
if (Temp != NULL) {
|
if (Temp != NULL) {
|
||||||
Walker = Temp;
|
Walker = Temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Walker[0] == L' ') {
|
while (Walker[0] == L' ') {
|
||||||
Walker++;
|
Walker++;
|
||||||
}
|
}
|
||||||
@ -1121,22 +1159,26 @@ BcfgAddOpt(
|
|||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
return ShellStatus;
|
return ShellStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (KeyOptionBuffer, &NewKeyOption, sizeof (EFI_KEY_OPTION));
|
CopyMem (KeyOptionBuffer, &NewKeyOption, sizeof (EFI_KEY_OPTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (LoopCounter = 0; ShellStatus == SHELL_SUCCESS && LoopCounter < NewKeyOption.KeyData.Options.InputKeyCount; LoopCounter++) {
|
for (LoopCounter = 0; ShellStatus == SHELL_SUCCESS && LoopCounter < NewKeyOption.KeyData.Options.InputKeyCount; LoopCounter++) {
|
||||||
//
|
//
|
||||||
// ScanCode
|
// ScanCode
|
||||||
//
|
//
|
||||||
Status = ShellConvertStringToUint64 (Walker, &Intermediate, FALSE, TRUE);
|
Status = ShellConvertStringToUint64 (Walker, &Intermediate, FALSE, TRUE);
|
||||||
if (EFI_ERROR(Status) || (((UINT16)Intermediate) != Intermediate) || StrStr(Walker, L" ") == NULL) {
|
if (EFI_ERROR (Status) || (((UINT16)Intermediate) != Intermediate) || (StrStr (Walker, L" ") == NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
((EFI_INPUT_KEY *)(((UINT8 *)KeyOptionBuffer) + sizeof (EFI_KEY_OPTION)))[LoopCounter].ScanCode = (UINT16)Intermediate;
|
((EFI_INPUT_KEY *)(((UINT8 *)KeyOptionBuffer) + sizeof (EFI_KEY_OPTION)))[LoopCounter].ScanCode = (UINT16)Intermediate;
|
||||||
Temp = StrStr (Walker, L" ");
|
Temp = StrStr (Walker, L" ");
|
||||||
if (Temp != NULL) {
|
if (Temp != NULL) {
|
||||||
Walker = Temp;
|
Walker = Temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Walker[0] == L' ') {
|
while (Walker[0] == L' ') {
|
||||||
Walker++;
|
Walker++;
|
||||||
}
|
}
|
||||||
@ -1149,11 +1191,13 @@ BcfgAddOpt(
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", Walker);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
((EFI_INPUT_KEY *)(((UINT8 *)KeyOptionBuffer) + sizeof (EFI_KEY_OPTION)))[LoopCounter].UnicodeChar = (UINT16)Intermediate;
|
((EFI_INPUT_KEY *)(((UINT8 *)KeyOptionBuffer) + sizeof (EFI_KEY_OPTION)))[LoopCounter].UnicodeChar = (UINT16)Intermediate;
|
||||||
Temp = StrStr (Walker, L" ");
|
Temp = StrStr (Walker, L" ");
|
||||||
if (Temp != NULL) {
|
if (Temp != NULL) {
|
||||||
Walker = Temp;
|
Walker = Temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Walker[0] == L' ') {
|
while (Walker[0] == L' ') {
|
||||||
Walker++;
|
Walker++;
|
||||||
}
|
}
|
||||||
@ -1179,17 +1223,20 @@ BcfgAddOpt(
|
|||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
SHELL_FREE_NON_NULL (VariableData);
|
SHELL_FREE_NON_NULL (VariableData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeyIndex <= 0xFFFF) {
|
if (KeyIndex <= 0xFFFF) {
|
||||||
Status = gRT->SetVariable (
|
Status = gRT->SetVariable (
|
||||||
VariableName,
|
VariableName,
|
||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
sizeof (EFI_KEY_OPTION) + (sizeof (EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount),
|
sizeof (EFI_KEY_OPTION) + (sizeof (EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount),
|
||||||
KeyOptionBuffer);
|
KeyOptionBuffer
|
||||||
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -1198,6 +1245,7 @@ BcfgAddOpt(
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_VAR_NO_NUM), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_VAR_NO_NUM), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (FileName == NULL && Data == NULL);
|
ASSERT (FileName == NULL && Data == NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1208,7 +1256,7 @@ BcfgAddOpt(
|
|||||||
//
|
//
|
||||||
ASSERT (FileName == NULL || Data == NULL);
|
ASSERT (FileName == NULL || Data == NULL);
|
||||||
|
|
||||||
if (ShellStatus == SHELL_SUCCESS && (FileName != NULL || Data != NULL)) {
|
if ((ShellStatus == SHELL_SUCCESS) && ((FileName != NULL) || (Data != NULL))) {
|
||||||
if (FileName != NULL) {
|
if (FileName != NULL) {
|
||||||
//
|
//
|
||||||
// Open the file and populate the data buffer.
|
// Open the file and populate the data buffer.
|
||||||
@ -1217,15 +1265,18 @@ BcfgAddOpt(
|
|||||||
FileName,
|
FileName,
|
||||||
&FileHandle,
|
&FileHandle,
|
||||||
EFI_FILE_MODE_READ,
|
EFI_FILE_MODE_READ,
|
||||||
0);
|
0
|
||||||
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = ShellGetFileSize (FileHandle, &Intermediate);
|
Status = ShellGetFileSize (FileHandle, &Intermediate);
|
||||||
}
|
}
|
||||||
|
|
||||||
Data = AllocateZeroPool ((UINTN)Intermediate);
|
Data = AllocateZeroPool ((UINTN)Intermediate);
|
||||||
if (Data == NULL) {
|
if (Data == NULL) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = ShellReadFile (FileHandle, (UINTN *)&Intermediate, Data);
|
Status = ShellReadFile (FileHandle, (UINTN *)&Intermediate, Data);
|
||||||
}
|
}
|
||||||
@ -1233,14 +1284,15 @@ BcfgAddOpt(
|
|||||||
Intermediate = StrSize (Data);
|
Intermediate = StrSize (Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS && Data != NULL) {
|
if (!EFI_ERROR (Status) && (ShellStatus == SHELL_SUCCESS) && (Data != NULL)) {
|
||||||
Status = UpdateOptionalData (CurrentOrder[OptionIndex], (UINTN)Intermediate, (UINT8 *)Data, Target);
|
Status = UpdateOptionalData (CurrentOrder[OptionIndex], (UINTN)Intermediate, (UINT8 *)Data, Target);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (EFI_ERROR(Status) && ShellStatus == SHELL_SUCCESS) {
|
|
||||||
|
if (EFI_ERROR (Status) && (ShellStatus == SHELL_SUCCESS)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -1303,7 +1355,8 @@ BcfgDisplayDump(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
Buffer);
|
Buffer
|
||||||
|
);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
Buffer = AllocateZeroPool (BufferSize);
|
Buffer = AllocateZeroPool (BufferSize);
|
||||||
Status = gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
@ -1311,10 +1364,11 @@ BcfgDisplayDump(
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
Buffer);
|
Buffer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR(Status) || Buffer == NULL) {
|
if (EFI_ERROR (Status) || (Buffer == NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_READ_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_READ_FAIL), gShellBcfgHiiHandle, L"bcfg", VariableName);
|
||||||
++Errors;
|
++Errors;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
@ -1375,10 +1429,12 @@ Cleanup:
|
|||||||
if (Buffer != NULL) {
|
if (Buffer != NULL) {
|
||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DevPathString != NULL) {
|
if (DevPathString != NULL) {
|
||||||
FreePool (DevPathString);
|
FreePool (DevPathString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Errors > 0) ? SHELL_INVALID_PARAMETER : SHELL_SUCCESS;
|
return (Errors > 0) ? SHELL_INVALID_PARAMETER : SHELL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1404,7 +1460,6 @@ InitBcfgStruct(
|
|||||||
Struct->OptData = NULL;
|
Struct->OptData = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||||
{ L"-v", TypeFlag },
|
{ L"-v", TypeFlag },
|
||||||
{ L"-opt", TypeMaxValue },
|
{ L"-opt", TypeMaxValue },
|
||||||
@ -1456,7 +1511,7 @@ ShellCommandRunBcfg (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellBcfgHiiHandle, L"bcfg", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellBcfgHiiHandle, L"bcfg", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -1473,15 +1528,17 @@ ShellCommandRunBcfg (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellBcfgHiiHandle, L"bcfg", L"-opt");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellBcfgHiiHandle, L"bcfg", L"-opt");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentOperation.Type = BcfgTypeOpt;
|
CurrentOperation.Type = BcfgTypeOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// small block to read the target of the operation
|
// small block to read the target of the operation
|
||||||
//
|
//
|
||||||
if ((ShellCommandLineGetCount(Package) < 3 && CurrentOperation.Type != BcfgTypeOpt) ||
|
if (((ShellCommandLineGetCount (Package) < 3) && (CurrentOperation.Type != BcfgTypeOpt)) ||
|
||||||
(ShellCommandLineGetCount(Package) < 2 && CurrentOperation.Type == BcfgTypeOpt)
|
((ShellCommandLineGetCount (Package) < 2) && (CurrentOperation.Type == BcfgTypeOpt))
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)ShellCommandLineGetRawValue (Package, 1), L"driver") == 0) {
|
} else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)ShellCommandLineGetRawValue (Package, 1), L"driver") == 0) {
|
||||||
@ -1493,18 +1550,18 @@ ShellCommandRunBcfg (
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read in the boot or driver order environment variable (not needed for opt)
|
// Read in the boot or driver order environment variable (not needed for opt)
|
||||||
//
|
//
|
||||||
if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax) {
|
if ((ShellStatus == SHELL_SUCCESS) && (CurrentOperation.Target < BcfgTargetMax)) {
|
||||||
Length = 0;
|
Length = 0;
|
||||||
Status = gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
CurrentOperation.Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder",
|
CurrentOperation.Target == BcfgTargetBootOrder ? (CHAR16 *)L"BootOrder" : (CHAR16 *)L"DriverOrder",
|
||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&Length,
|
&Length,
|
||||||
CurrentOperation.Order);
|
CurrentOperation.Order
|
||||||
|
);
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
CurrentOperation.Order = AllocateZeroPool (Length+(4*sizeof (CurrentOperation.Order[0])));
|
CurrentOperation.Order = AllocateZeroPool (Length+(4*sizeof (CurrentOperation.Order[0])));
|
||||||
if (CurrentOperation.Order == NULL) {
|
if (CurrentOperation.Order == NULL) {
|
||||||
@ -1515,7 +1572,8 @@ ShellCommandRunBcfg (
|
|||||||
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
(EFI_GUID *)&gEfiGlobalVariableGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&Length,
|
&Length,
|
||||||
CurrentOperation.Order);
|
CurrentOperation.Order
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1525,7 +1583,7 @@ ShellCommandRunBcfg (
|
|||||||
//
|
//
|
||||||
// large block to read the type of operation and verify parameter types for the info.
|
// large block to read the type of operation and verify parameter types for the info.
|
||||||
//
|
//
|
||||||
if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax) {
|
if ((ShellStatus == SHELL_SUCCESS) && (CurrentOperation.Target < BcfgTargetMax)) {
|
||||||
for (ParamNumber = 2; ParamNumber < ShellCommandLineGetCount (Package) && ShellStatus == SHELL_SUCCESS; ParamNumber++) {
|
for (ParamNumber = 2; ParamNumber < ShellCommandLineGetCount (Package) && ShellStatus == SHELL_SUCCESS; ParamNumber++) {
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ParamNumber);
|
||||||
if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"dump") == 0) {
|
if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"dump") == 0) {
|
||||||
@ -1542,9 +1600,10 @@ ShellCommandRunBcfg (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentOperation.Type = BcfgTypeAdd;
|
CurrentOperation.Type = BcfgTypeAdd;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1560,9 +1619,10 @@ ShellCommandRunBcfg (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentOperation.Type = BcfgTypeAddp;
|
CurrentOperation.Type = BcfgTypeAddp;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1578,16 +1638,17 @@ ShellCommandRunBcfg (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentOperation.Type = BcfgTypeAddh;
|
CurrentOperation.Type = BcfgTypeAddh;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
|
Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
|
||||||
CurrentOperation.Number1 = (UINT16)Intermediate;
|
CurrentOperation.Number1 = (UINT16)Intermediate;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1602,9 +1663,10 @@ ShellCommandRunBcfg (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentOperation.Type = BcfgTypeRm;
|
CurrentOperation.Type = BcfgTypeRm;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1620,9 +1682,10 @@ ShellCommandRunBcfg (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentOperation.Type = BcfgTypeMv;
|
CurrentOperation.Type = BcfgTypeMv;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1633,30 +1696,31 @@ ShellCommandRunBcfg (
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
|
Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
|
||||||
CurrentOperation.Number2 = (UINT16)Intermediate;
|
CurrentOperation.Number2 = (UINT16)Intermediate;
|
||||||
}
|
}
|
||||||
if (CurrentOperation.Number2 == CurrentOperation.Number1
|
|
||||||
||CurrentOperation.Number2 >= Count
|
if ( (CurrentOperation.Number2 == CurrentOperation.Number1)
|
||||||
){
|
|| (CurrentOperation.Number2 >= Count)
|
||||||
|
)
|
||||||
|
{
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellBcfgHiiHandle, L"bcfg", Count);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)CurrentParam, L"mod") == 0) {
|
||||||
else if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16*)CurrentParam, L"mod") == 0) {
|
|
||||||
if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) {
|
if ((ParamNumber + 2) >= ShellCommandLineGetCount (Package)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellBcfgHiiHandle, L"bcfg");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
CurrentOperation.Type = BcfgTypeMod;
|
CurrentOperation.Type = BcfgTypeMod;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1678,7 +1742,7 @@ ShellCommandRunBcfg (
|
|||||||
} else {
|
} else {
|
||||||
CurrentOperation.Type = BcfgTypeModf;
|
CurrentOperation.Type = BcfgTypeModf;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1700,7 +1764,7 @@ ShellCommandRunBcfg (
|
|||||||
} else {
|
} else {
|
||||||
CurrentOperation.Type = BcfgTypeModp;
|
CurrentOperation.Type = BcfgTypeModp;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1722,11 +1786,10 @@ ShellCommandRunBcfg (
|
|||||||
} else {
|
} else {
|
||||||
CurrentOperation.Type = BcfgTypeModh;
|
CurrentOperation.Type = BcfgTypeModh;
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
|
Status = ShellConvertStringToUint64 (CurrentParam, &Intermediate, TRUE, FALSE);
|
||||||
CurrentOperation.Number1 = (UINT16)Intermediate;
|
CurrentOperation.Number1 = (UINT16)Intermediate;
|
||||||
if (CurrentOperation.Number1 >= Count) {
|
if (CurrentOperation.Number1 >= Count) {
|
||||||
@ -1734,7 +1797,7 @@ ShellCommandRunBcfg (
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
CurrentParam = ShellCommandLineGetRawValue (Package, ++ParamNumber);
|
||||||
if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
if ((CurrentParam == NULL) || !ShellIsHexOrDecimalNumber (CurrentParam, TRUE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellBcfgHiiHandle, L"bcfg", CurrentParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -1750,7 +1813,8 @@ ShellCommandRunBcfg (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BcfgTargetMax && CurrentOperation.Type < BcfgTypeMax) {
|
|
||||||
|
if ((ShellStatus == SHELL_SUCCESS) && (CurrentOperation.Target < BcfgTargetMax) && (CurrentOperation.Type < BcfgTypeMax)) {
|
||||||
//
|
//
|
||||||
// we have all the info. Do the work
|
// we have all the info. Do the work
|
||||||
//
|
//
|
||||||
@ -1760,7 +1824,8 @@ ShellCommandRunBcfg (
|
|||||||
CurrentOperation.Target == BcfgTargetBootOrder ? L"Boot" : L"Driver",
|
CurrentOperation.Target == BcfgTargetBootOrder ? L"Boot" : L"Driver",
|
||||||
Count,
|
Count,
|
||||||
CurrentOperation.Order,
|
CurrentOperation.Order,
|
||||||
ShellCommandLineGetFlag(Package, L"-v"));
|
ShellCommandLineGetFlag (Package, L"-v")
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case BcfgTypeMv:
|
case BcfgTypeMv:
|
||||||
ShellStatus = BcfgMove (
|
ShellStatus = BcfgMove (
|
||||||
@ -1768,14 +1833,16 @@ ShellCommandRunBcfg (
|
|||||||
CurrentOperation.Order,
|
CurrentOperation.Order,
|
||||||
Count,
|
Count,
|
||||||
CurrentOperation.Number1,
|
CurrentOperation.Number1,
|
||||||
CurrentOperation.Number2);
|
CurrentOperation.Number2
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case BcfgTypeRm:
|
case BcfgTypeRm:
|
||||||
ShellStatus = BcfgRemove (
|
ShellStatus = BcfgRemove (
|
||||||
CurrentOperation.Target,
|
CurrentOperation.Target,
|
||||||
CurrentOperation.Order,
|
CurrentOperation.Order,
|
||||||
Count,
|
Count,
|
||||||
CurrentOperation.Number1);
|
CurrentOperation.Number1
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case BcfgTypeAdd:
|
case BcfgTypeAdd:
|
||||||
case BcfgTypeAddp:
|
case BcfgTypeAddp:
|
||||||
@ -1789,7 +1856,8 @@ ShellCommandRunBcfg (
|
|||||||
CurrentOperation.Target,
|
CurrentOperation.Target,
|
||||||
(BOOLEAN)(CurrentOperation.Type == BcfgTypeAddh),
|
(BOOLEAN)(CurrentOperation.Type == BcfgTypeAddh),
|
||||||
(BOOLEAN)(CurrentOperation.Type == BcfgTypeAddp),
|
(BOOLEAN)(CurrentOperation.Type == BcfgTypeAddp),
|
||||||
CurrentOperation.HandleIndex);
|
CurrentOperation.HandleIndex
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case BcfgTypeMod:
|
case BcfgTypeMod:
|
||||||
case BcfgTypeModf:
|
case BcfgTypeModf:
|
||||||
@ -1802,7 +1870,8 @@ ShellCommandRunBcfg (
|
|||||||
CurrentOperation.OptData,
|
CurrentOperation.OptData,
|
||||||
CurrentOperation.Order,
|
CurrentOperation.Order,
|
||||||
Count,
|
Count,
|
||||||
CurrentOperation.Target);
|
CurrentOperation.Target
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
@ -1813,12 +1882,15 @@ ShellCommandRunBcfg (
|
|||||||
if (Package != NULL) {
|
if (Package != NULL) {
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentOperation.FileName != NULL) {
|
if (CurrentOperation.FileName != NULL) {
|
||||||
FreePool (CurrentOperation.FileName);
|
FreePool (CurrentOperation.FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentOperation.Description != NULL) {
|
if (CurrentOperation.Description != NULL) {
|
||||||
FreePool (CurrentOperation.Description);
|
FreePool (CurrentOperation.Description);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentOperation.Order != NULL) {
|
if (CurrentOperation.Order != NULL) {
|
||||||
FreePool (CurrentOperation.Order);
|
FreePool (CurrentOperation.Order);
|
||||||
}
|
}
|
||||||
@ -1826,7 +1898,6 @@ ShellCommandRunBcfg (
|
|||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function to get the filename with help context if HII will not be used.
|
Function to get the filename with help context if HII will not be used.
|
||||||
|
|
||||||
@ -1894,7 +1965,7 @@ BcfgLibraryUnregisterBcfgCommand (
|
|||||||
if (gShellBcfgHiiHandle != NULL) {
|
if (gShellBcfgHiiHandle != NULL) {
|
||||||
HiiRemovePackages (gShellBcfgHiiHandle);
|
HiiRemovePackages (gShellBcfgHiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
gShellBcfgHiiHandle = NULL;
|
gShellBcfgHiiHandle = NULL;
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,8 @@ ShellCEntryLib (
|
|||||||
EfiShellParametersProtocol = NULL;
|
EfiShellParametersProtocol = NULL;
|
||||||
EfiShellInterface = NULL;
|
EfiShellInterface = NULL;
|
||||||
|
|
||||||
Status = SystemTable->BootServices->OpenProtocol(ImageHandle,
|
Status = SystemTable->BootServices->OpenProtocol (
|
||||||
|
ImageHandle,
|
||||||
&gEfiShellParametersProtocolGuid,
|
&gEfiShellParametersProtocolGuid,
|
||||||
(VOID **)&EfiShellParametersProtocol,
|
(VOID **)&EfiShellParametersProtocol,
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
@ -70,7 +71,8 @@ ShellCEntryLib (
|
|||||||
//
|
//
|
||||||
// try to get shell 1.0 interface instead.
|
// try to get shell 1.0 interface instead.
|
||||||
//
|
//
|
||||||
Status = SystemTable->BootServices->OpenProtocol(ImageHandle,
|
Status = SystemTable->BootServices->OpenProtocol (
|
||||||
|
ImageHandle,
|
||||||
&gEfiShellInterfaceGuid,
|
&gEfiShellInterfaceGuid,
|
||||||
(VOID **)&EfiShellInterface,
|
(VOID **)&EfiShellInterface,
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
@ -89,5 +91,6 @@ ShellCEntryLib (
|
|||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ReturnFromMain;
|
return ReturnFromMain;
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
#include <Protocol/BlockIo.h>
|
#include <Protocol/BlockIo.h>
|
||||||
#include <Protocol/SimpleFileSystem.h>
|
#include <Protocol/SimpleFileSystem.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MTDTypeUnknown,
|
MTDTypeUnknown,
|
||||||
MTDTypeFloppy,
|
MTDTypeFloppy,
|
||||||
@ -65,7 +63,6 @@ typedef struct {
|
|||||||
INTN (EFIAPI *CompareFun)(EFI_DEVICE_PATH_PROTOCOL *DevPath, EFI_DEVICE_PATH_PROTOCOL *DevPath2);
|
INTN (EFIAPI *CompareFun)(EFI_DEVICE_PATH_PROTOCOL *DevPath, EFI_DEVICE_PATH_PROTOCOL *DevPath2);
|
||||||
} DEV_PATH_CONSIST_MAPPING_TABLE;
|
} DEV_PATH_CONSIST_MAPPING_TABLE;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Concatenates a formatted unicode string to allocated pool.
|
Concatenates a formatted unicode string to allocated pool.
|
||||||
The caller must free the resulting buffer.
|
The caller must free the resulting buffer.
|
||||||
@ -112,6 +109,7 @@ CatPrint (
|
|||||||
Str->Str
|
Str->Str
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NewStr == NULL) {
|
if (NewStr == NULL) {
|
||||||
FreePool (AppendStr);
|
FreePool (AppendStr);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
@ -197,6 +195,7 @@ AppendCSDNum (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
ASSERT (MappingItem != NULL);
|
ASSERT (MappingItem != NULL);
|
||||||
|
|
||||||
if (MappingItem->Digital) {
|
if (MappingItem->Digital) {
|
||||||
@ -288,11 +287,11 @@ AppendCSDStr (
|
|||||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||||
// a b c d e f g h i j k l m n o p
|
// a b c d e f g h i j k l m n o p
|
||||||
//
|
//
|
||||||
if (*Index >= '0' && *Index <= '9') {
|
if ((*Index >= '0') && (*Index <= '9')) {
|
||||||
Status = CatPrint (&MappingItem->Csd, L"%c", *Index - '0' + 'a');
|
Status = CatPrint (&MappingItem->Csd, L"%c", *Index - '0' + 'a');
|
||||||
} else if (*Index >= 'a' && *Index <= 'f') {
|
} else if ((*Index >= 'a') && (*Index <= 'f')) {
|
||||||
Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'a' + 'k');
|
Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'a' + 'k');
|
||||||
} else if (*Index >= 'A' && *Index <= 'F') {
|
} else if ((*Index >= 'A') && (*Index <= 'F')) {
|
||||||
Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'A' + 'k');
|
Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'A' + 'k');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,17 +354,17 @@ DevPathCompareAcpi (
|
|||||||
ACPI_HID_DEVICE_PATH *Acpi1;
|
ACPI_HID_DEVICE_PATH *Acpi1;
|
||||||
ACPI_HID_DEVICE_PATH *Acpi2;
|
ACPI_HID_DEVICE_PATH *Acpi2;
|
||||||
|
|
||||||
if (DevicePath1 == NULL || DevicePath2 == NULL) {
|
if ((DevicePath1 == NULL) || (DevicePath2 == NULL)) {
|
||||||
return (-2);
|
return (-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Acpi1 = (ACPI_HID_DEVICE_PATH *)DevicePath1;
|
Acpi1 = (ACPI_HID_DEVICE_PATH *)DevicePath1;
|
||||||
Acpi2 = (ACPI_HID_DEVICE_PATH *)DevicePath2;
|
Acpi2 = (ACPI_HID_DEVICE_PATH *)DevicePath2;
|
||||||
if (Acpi1->HID > Acpi2->HID || (Acpi1->HID == Acpi2->HID && Acpi1->UID > Acpi2->UID)) {
|
if ((Acpi1->HID > Acpi2->HID) || ((Acpi1->HID == Acpi2->HID) && (Acpi1->UID > Acpi2->UID))) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Acpi1->HID == Acpi2->HID && Acpi1->UID == Acpi2->UID) {
|
if ((Acpi1->HID == Acpi2->HID) && (Acpi1->UID == Acpi2->UID)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,11 +395,11 @@ DevPathComparePci (
|
|||||||
|
|
||||||
Pci1 = (PCI_DEVICE_PATH *)DevicePath1;
|
Pci1 = (PCI_DEVICE_PATH *)DevicePath1;
|
||||||
Pci2 = (PCI_DEVICE_PATH *)DevicePath2;
|
Pci2 = (PCI_DEVICE_PATH *)DevicePath2;
|
||||||
if (Pci1->Device > Pci2->Device || (Pci1->Device == Pci2->Device && Pci1->Function > Pci2->Function)) {
|
if ((Pci1->Device > Pci2->Device) || ((Pci1->Device == Pci2->Device) && (Pci1->Function > Pci2->Function))) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pci1->Device == Pci2->Device && Pci1->Function == Pci2->Function) {
|
if ((Pci1->Device == Pci2->Device) && (Pci1->Function == Pci2->Function)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,6 +551,7 @@ DevPathSerialFibre (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Fibre->Lun);
|
Status = AppendCSDNum (MappingItem, Fibre->Lun);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,12 +583,15 @@ DevPathSerialUart (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Uart->DataBits);
|
Status = AppendCSDNum (MappingItem, Uart->DataBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Uart->Parity);
|
Status = AppendCSDNum (MappingItem, Uart->Parity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Uart->StopBits);
|
Status = AppendCSDNum (MappingItem, Uart->StopBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +618,6 @@ DevPathSerialUsb (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
USB_INTERFACE_DESCRIPTOR InterfaceDesc;
|
USB_INTERFACE_DESCRIPTOR InterfaceDesc;
|
||||||
|
|
||||||
|
|
||||||
ASSERT (DevicePathNode != NULL);
|
ASSERT (DevicePathNode != NULL);
|
||||||
ASSERT (MappingItem != NULL);
|
ASSERT (MappingItem != NULL);
|
||||||
|
|
||||||
@ -640,7 +642,7 @@ DevPathSerialUsb (
|
|||||||
ASSERT (UsbIo != NULL);
|
ASSERT (UsbIo != NULL);
|
||||||
Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc);
|
Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
if (InterfaceDesc.InterfaceClass == USB_MASS_STORE_CLASS && MappingItem->Mtd == MTDTypeUnknown) {
|
if ((InterfaceDesc.InterfaceClass == USB_MASS_STORE_CLASS) && (MappingItem->Mtd == MTDTypeUnknown)) {
|
||||||
switch (InterfaceDesc.InterfaceSubClass) {
|
switch (InterfaceDesc.InterfaceSubClass) {
|
||||||
case USB_MASS_STORE_SCSI:
|
case USB_MASS_STORE_SCSI:
|
||||||
MappingItem->Mtd = MTDTypeHardDisk;
|
MappingItem->Mtd = MTDTypeHardDisk;
|
||||||
@ -657,6 +659,7 @@ DevPathSerialUsb (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,9 +703,11 @@ DevPathSerialVendor (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Sas->Lun);
|
Status = AppendCSDNum (MappingItem, Sas->Lun);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Sas->DeviceTopology);
|
Status = AppendCSDNum (MappingItem, Sas->DeviceTopology);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Sas->RelativeTargetPort);
|
Status = AppendCSDNum (MappingItem, Sas->RelativeTargetPort);
|
||||||
}
|
}
|
||||||
@ -726,6 +731,7 @@ DevPathSerialVendor (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer = NewBuffer;
|
Buffer = NewBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -739,6 +745,7 @@ DevPathSerialVendor (
|
|||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,9 +803,11 @@ DevPathSerialSata (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Sata->PortMultiplierPortNumber);
|
Status = AppendCSDNum (MappingItem, Sata->PortMultiplierPortNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Sata->Lun);
|
Status = AppendCSDNum (MappingItem, Sata->Lun);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,15 +846,19 @@ DevPathSerialIScsi (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, IScsi->LoginOption);
|
Status = AppendCSDNum (MappingItem, IScsi->LoginOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, IScsi->Lun);
|
Status = AppendCSDNum (MappingItem, IScsi->Lun);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, IScsi->TargetPortalGroupTag);
|
Status = AppendCSDNum (MappingItem, IScsi->TargetPortalGroupTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetNameLength = DevicePathNodeLength (DevicePathNode) - sizeof (ISCSI_DEVICE_PATH);
|
TargetNameLength = DevicePathNodeLength (DevicePathNode) - sizeof (ISCSI_DEVICE_PATH);
|
||||||
if (TargetNameLength > 0) {
|
if (TargetNameLength > 0) {
|
||||||
TargetName = AllocateZeroPool ((TargetNameLength + 1) * sizeof (CHAR16));
|
TargetName = AllocateZeroPool ((TargetNameLength + 1) * sizeof (CHAR16));
|
||||||
@ -856,11 +869,13 @@ DevPathSerialIScsi (
|
|||||||
for (Index = 0; Index < TargetNameLength; Index++) {
|
for (Index = 0; Index < TargetNameLength; Index++) {
|
||||||
TargetName[Index] = (CHAR16)IScsiTargetName[Index];
|
TargetName[Index] = (CHAR16)IScsiTargetName[Index];
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = AppendCSDStr (MappingItem, TargetName);
|
Status = AppendCSDStr (MappingItem, TargetName);
|
||||||
FreePool (TargetName);
|
FreePool (TargetName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,7 +934,7 @@ DevPathSerialMacAddr (
|
|||||||
Mac = (MAC_ADDR_DEVICE_PATH *)DevicePathNode;
|
Mac = (MAC_ADDR_DEVICE_PATH *)DevicePathNode;
|
||||||
|
|
||||||
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
|
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
|
||||||
if (Mac->IfType == 0x01 || Mac->IfType == 0x00) {
|
if ((Mac->IfType == 0x01) || (Mac->IfType == 0x00)) {
|
||||||
HwAddressSize = 6;
|
HwAddressSize = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -965,12 +980,15 @@ DevPathSerialInfiniBand (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, InfiniBand->ServiceId);
|
Status = AppendCSDNum (MappingItem, InfiniBand->ServiceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, InfiniBand->TargetPortId);
|
Status = AppendCSDNum (MappingItem, InfiniBand->TargetPortId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, InfiniBand->DeviceId);
|
Status = AppendCSDNum (MappingItem, InfiniBand->DeviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,6 +1030,7 @@ DevPathSerialIPv4 (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Ip->LocalPort);
|
Status = AppendCSDNum (MappingItem, Ip->LocalPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
Buffer,
|
Buffer,
|
||||||
@ -1024,9 +1043,11 @@ DevPathSerialIPv4 (
|
|||||||
);
|
);
|
||||||
Status = AppendCSDStr (MappingItem, Buffer);
|
Status = AppendCSDStr (MappingItem, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Ip->RemotePort);
|
Status = AppendCSDNum (MappingItem, Ip->RemotePort);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,6 +1086,7 @@ DevPathSerialIPv6 (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Ip->LocalPort);
|
Status = AppendCSDNum (MappingItem, Ip->LocalPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) {
|
for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) {
|
||||||
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)Ip->RemoteIpAddress.Addr[Index]);
|
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)Ip->RemoteIpAddress.Addr[Index]);
|
||||||
@ -1072,9 +1094,11 @@ DevPathSerialIPv6 (
|
|||||||
|
|
||||||
Status = AppendCSDStr (MappingItem, Buffer);
|
Status = AppendCSDStr (MappingItem, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Ip->RemotePort);
|
Status = AppendCSDNum (MappingItem, Ip->RemotePort);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1106,6 +1130,7 @@ DevPathSerialScsi (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = AppendCSDNum (MappingItem, Scsi->Lun);
|
Status = AppendCSDNum (MappingItem, Scsi->Lun);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1166,6 +1191,7 @@ DevPathSerialAcpi (
|
|||||||
return AppendCSDNum (MappingItem, Acpi->UID);
|
return AppendCSDNum (MappingItem, Acpi->UID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1399,6 +1425,7 @@ GetHIDevicePath (
|
|||||||
} else {
|
} else {
|
||||||
NonHIDevicePathNodeCount++;
|
NonHIDevicePathNodeCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Next device path node
|
// Next device path node
|
||||||
//
|
//
|
||||||
@ -1439,10 +1466,10 @@ GetDeviceConsistMappingInfo (
|
|||||||
// initialize with generic function in case nothing is found
|
// initialize with generic function in case nothing is found
|
||||||
//
|
//
|
||||||
for (SerialFun = DevPathSerialDefault, Index = 0; DevPathConsistMappingTable[Index].SerialFun != NULL; Index += 1) {
|
for (SerialFun = DevPathSerialDefault, Index = 0; DevPathConsistMappingTable[Index].SerialFun != NULL; Index += 1) {
|
||||||
|
if ((DevicePathType (DevicePath) == DevPathConsistMappingTable[Index].Type) &&
|
||||||
if (DevicePathType (DevicePath) == DevPathConsistMappingTable[Index].Type &&
|
(DevicePathSubType (DevicePath) == DevPathConsistMappingTable[Index].SubType)
|
||||||
DevicePathSubType (DevicePath) == DevPathConsistMappingTable[Index].SubType
|
)
|
||||||
) {
|
{
|
||||||
SerialFun = DevPathConsistMappingTable[Index].SerialFun;
|
SerialFun = DevPathConsistMappingTable[Index].SerialFun;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1514,12 +1541,14 @@ ShellCommandConsistMappingInitialize (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->HandleProtocol( HandleBuffer[HandleLoop],
|
Status = gBS->HandleProtocol (
|
||||||
|
HandleBuffer[HandleLoop],
|
||||||
&gEfiBlockIoProtocolGuid,
|
&gEfiBlockIoProtocolGuid,
|
||||||
(VOID **)&BlockIo
|
(VOID **)&BlockIo
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Status = gBS->HandleProtocol( HandleBuffer[HandleLoop],
|
Status = gBS->HandleProtocol (
|
||||||
|
HandleBuffer[HandleLoop],
|
||||||
&gEfiSimpleFileSystemProtocolGuid,
|
&gEfiSimpleFileSystemProtocolGuid,
|
||||||
(VOID **)&SimpleFileSystem
|
(VOID **)&SimpleFileSystem
|
||||||
);
|
);
|
||||||
@ -1541,7 +1570,9 @@ ShellCommandConsistMappingInitialize (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0; TempTable[Index] != NULL; Index++);
|
for (Index = 0; TempTable[Index] != NULL; Index++) {
|
||||||
|
}
|
||||||
|
|
||||||
PerformQuickSort (TempTable, Index, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
|
PerformQuickSort (TempTable, Index, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
|
||||||
*Table = TempTable;
|
*Table = TempTable;
|
||||||
|
|
||||||
@ -1647,14 +1678,16 @@ ShellCommandConsistMappingGenMappingName (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = CatPrint (&Str, L"%d", (UINTN)MappingInfo.Hi);
|
Status = CatPrint (&Str, L"%d", (UINTN)MappingInfo.Hi);
|
||||||
}
|
}
|
||||||
if (!EFI_ERROR (Status) && MappingInfo.Csd.Str != NULL) {
|
|
||||||
|
if (!EFI_ERROR (Status) && (MappingInfo.Csd.Str != NULL)) {
|
||||||
Status = CatPrint (&Str, L"%s", MappingInfo.Csd.Str);
|
Status = CatPrint (&Str, L"%s", MappingInfo.Csd.Str);
|
||||||
FreePool (MappingInfo.Csd.Str);
|
FreePool (MappingInfo.Csd.Str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status) && Str.Str != NULL) {
|
if (!EFI_ERROR (Status) && (Str.Str != NULL)) {
|
||||||
Status = CatPrint (&Str, L":");
|
Status = CatPrint (&Str, L":");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
SHELL_FREE_NON_NULL (Str.Str);
|
SHELL_FREE_NON_NULL (Str.Str);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1681,12 +1714,12 @@ ShellCommandFindMapItem (
|
|||||||
for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
||||||
; !IsNull (&gShellMapList.Link, &MapListItem->Link)
|
; !IsNull (&gShellMapList.Link, &MapListItem->Link)
|
||||||
; MapListItem = (SHELL_MAP_LIST *)GetNextNode (&gShellMapList.Link, &MapListItem->Link)
|
; MapListItem = (SHELL_MAP_LIST *)GetNextNode (&gShellMapList.Link, &MapListItem->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
if (gUnicodeCollation->StriColl (gUnicodeCollation, MapListItem->MapName, (CHAR16 *)MapKey) == 0) {
|
if (gUnicodeCollation->StriColl (gUnicodeCollation, MapListItem->MapName, (CHAR16 *)MapKey) == 0) {
|
||||||
return (MapListItem);
|
return (MapListItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ CommandInit(
|
|||||||
CHAR8 *PlatformLang;
|
CHAR8 *PlatformLang;
|
||||||
|
|
||||||
if (gUnicodeCollation == NULL) {
|
if (gUnicodeCollation == NULL) {
|
||||||
|
|
||||||
GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID **)&PlatformLang, NULL);
|
GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME, (VOID **)&PlatformLang, NULL);
|
||||||
|
|
||||||
Status = gBS->LocateHandleBuffer (
|
Status = gBS->LocateHandleBuffer (
|
||||||
@ -89,6 +88,7 @@ CommandInit(
|
|||||||
NumHandles = 0;
|
NumHandles = 0;
|
||||||
Handles = NULL;
|
Handles = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < NumHandles; Index++) {
|
for (Index = 0; Index < NumHandles; Index++) {
|
||||||
//
|
//
|
||||||
// Open Unicode Collation Protocol
|
// Open Unicode Collation Protocol
|
||||||
@ -113,6 +113,7 @@ CommandInit(
|
|||||||
if (gUnicodeCollation == NULL) {
|
if (gUnicodeCollation == NULL) {
|
||||||
gUnicodeCollation = Uc;
|
gUnicodeCollation = Uc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlatformLang == NULL) {
|
if (PlatformLang == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -133,9 +134,11 @@ CommandInit(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Handles != NULL) {
|
if (Handles != NULL) {
|
||||||
FreePool (Handles);
|
FreePool (Handles);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlatformLang != NULL) {
|
if (PlatformLang != NULL) {
|
||||||
FreePool (PlatformLang);
|
FreePool (PlatformLang);
|
||||||
}
|
}
|
||||||
@ -162,6 +165,7 @@ ShellCommandLibConstructor (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
InitializeListHead (&gShellMapList.Link);
|
InitializeListHead (&gShellMapList.Link);
|
||||||
InitializeListHead (&mCommandList.Link);
|
InitializeListHead (&mCommandList.Link);
|
||||||
InitializeListHead (&mAliasList.Link);
|
InitializeListHead (&mAliasList.Link);
|
||||||
@ -197,13 +201,15 @@ FreeFileHandleList (
|
|||||||
if (List == NULL) {
|
if (List == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// enumerate through the buffer list and free all memory
|
// enumerate through the buffer list and free all memory
|
||||||
//
|
//
|
||||||
for ( BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
|
for ( BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
|
||||||
; !IsListEmpty (&List->Link)
|
; !IsListEmpty (&List->Link)
|
||||||
; BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
|
; BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
RemoveEntryList (&BufferListEntry->Link);
|
RemoveEntryList (&BufferListEntry->Link);
|
||||||
ASSERT (BufferListEntry->Buffer != NULL);
|
ASSERT (BufferListEntry->Buffer != NULL);
|
||||||
SHELL_FREE_NON_NULL (((SHELL_COMMAND_FILE_HANDLE *)(BufferListEntry->Buffer))->Path);
|
SHELL_FREE_NON_NULL (((SHELL_COMMAND_FILE_HANDLE *)(BufferListEntry->Buffer))->Path);
|
||||||
@ -231,6 +237,7 @@ ShellCommandLibDestructor (
|
|||||||
ALIAS_LIST *Node2;
|
ALIAS_LIST *Node2;
|
||||||
SCRIPT_FILE_LIST *Node3;
|
SCRIPT_FILE_LIST *Node3;
|
||||||
SHELL_MAP_LIST *MapNode;
|
SHELL_MAP_LIST *MapNode;
|
||||||
|
|
||||||
//
|
//
|
||||||
// enumerate throught the list and free all the memory
|
// enumerate throught the list and free all the memory
|
||||||
//
|
//
|
||||||
@ -239,7 +246,9 @@ ShellCommandLibDestructor (
|
|||||||
RemoveEntryList (&Node->Link);
|
RemoveEntryList (&Node->Link);
|
||||||
SHELL_FREE_NON_NULL (Node->CommandString);
|
SHELL_FREE_NON_NULL (Node->CommandString);
|
||||||
FreePool (Node);
|
FreePool (Node);
|
||||||
DEBUG_CODE(Node = NULL;);
|
DEBUG_CODE (
|
||||||
|
Node = NULL;
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -251,7 +260,9 @@ ShellCommandLibDestructor (
|
|||||||
SHELL_FREE_NON_NULL (Node2->CommandString);
|
SHELL_FREE_NON_NULL (Node2->CommandString);
|
||||||
SHELL_FREE_NON_NULL (Node2->Alias);
|
SHELL_FREE_NON_NULL (Node2->Alias);
|
||||||
SHELL_FREE_NON_NULL (Node2);
|
SHELL_FREE_NON_NULL (Node2);
|
||||||
DEBUG_CODE(Node2 = NULL;);
|
DEBUG_CODE (
|
||||||
|
Node2 = NULL;
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -271,7 +282,8 @@ ShellCommandLibDestructor (
|
|||||||
for (MapNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
for (MapNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
||||||
; !IsListEmpty (&gShellMapList.Link)
|
; !IsListEmpty (&gShellMapList.Link)
|
||||||
; MapNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
; MapNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ASSERT (MapNode != NULL);
|
ASSERT (MapNode != NULL);
|
||||||
RemoveEntryList (&MapNode->Link);
|
RemoveEntryList (&MapNode->Link);
|
||||||
SHELL_FREE_NON_NULL (MapNode->DevicePath);
|
SHELL_FREE_NON_NULL (MapNode->DevicePath);
|
||||||
@ -280,6 +292,7 @@ ShellCommandLibDestructor (
|
|||||||
FreePool (MapNode);
|
FreePool (MapNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsListEmpty (&mFileHandleList.Link)) {
|
if (!IsListEmpty (&mFileHandleList.Link)) {
|
||||||
FreeFileHandleList (&mFileHandleList);
|
FreeFileHandleList (&mFileHandleList);
|
||||||
}
|
}
|
||||||
@ -334,8 +347,10 @@ ShellCommandFindDynamicCommand (
|
|||||||
if (gUnicodeCollation->StriColl (
|
if (gUnicodeCollation->StriColl (
|
||||||
gUnicodeCollation,
|
gUnicodeCollation,
|
||||||
(CHAR16 *)CommandString,
|
(CHAR16 *)CommandString,
|
||||||
(CHAR16*)DynamicCommand->CommandName) == 0
|
(CHAR16 *)DynamicCommand->CommandName
|
||||||
){
|
) == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
FreePool (CommandHandleList);
|
FreePool (CommandHandleList);
|
||||||
return (DynamicCommand);
|
return (DynamicCommand);
|
||||||
}
|
}
|
||||||
@ -381,16 +396,20 @@ ShellCommandIsCommandOnInternalList(
|
|||||||
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
||||||
; !IsNull (&mCommandList.Link, &Node->Link)
|
; !IsNull (&mCommandList.Link, &Node->Link)
|
||||||
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
|
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ASSERT (Node->CommandString != NULL);
|
ASSERT (Node->CommandString != NULL);
|
||||||
if (gUnicodeCollation->StriColl (
|
if (gUnicodeCollation->StriColl (
|
||||||
gUnicodeCollation,
|
gUnicodeCollation,
|
||||||
(CHAR16 *)CommandString,
|
(CHAR16 *)CommandString,
|
||||||
Node->CommandString) == 0
|
Node->CommandString
|
||||||
){
|
) == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,16 +483,20 @@ ShellCommandGetInternalCommandHelp(
|
|||||||
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
||||||
; !IsNull (&mCommandList.Link, &Node->Link)
|
; !IsNull (&mCommandList.Link, &Node->Link)
|
||||||
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
|
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ASSERT (Node->CommandString != NULL);
|
ASSERT (Node->CommandString != NULL);
|
||||||
if (gUnicodeCollation->StriColl (
|
if (gUnicodeCollation->StriColl (
|
||||||
gUnicodeCollation,
|
gUnicodeCollation,
|
||||||
(CHAR16 *)CommandString,
|
(CHAR16 *)CommandString,
|
||||||
Node->CommandString) == 0
|
Node->CommandString
|
||||||
){
|
) == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
return (HiiGetString (Node->HiiHandle, Node->ManFormatHelp, NULL));
|
return (HiiGetString (Node->HiiHandle, Node->ManFormatHelp, NULL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,6 +515,7 @@ ShellCommandGetCommandHelp (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 *HelpStr;
|
CHAR16 *HelpStr;
|
||||||
|
|
||||||
HelpStr = ShellCommandGetInternalCommandHelp (CommandString);
|
HelpStr = ShellCommandGetInternalCommandHelp (CommandString);
|
||||||
|
|
||||||
if (HelpStr == NULL) {
|
if (HelpStr == NULL) {
|
||||||
@ -501,7 +525,6 @@ ShellCommandGetCommandHelp (
|
|||||||
return HelpStr;
|
return HelpStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Registers handlers of type SHELL_RUN_COMMAND and
|
Registers handlers of type SHELL_RUN_COMMAND and
|
||||||
SHELL_GET_MAN_FILENAME for each shell command.
|
SHELL_GET_MAN_FILENAME for each shell command.
|
||||||
@ -603,6 +626,7 @@ ShellCommandRegisterCommandName (
|
|||||||
if (Node == NULL) {
|
if (Node == NULL) {
|
||||||
return RETURN_OUT_OF_RESOURCES;
|
return RETURN_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->CommandString = AllocateCopyPool (StrSize (CommandString), CommandString);
|
Node->CommandString = AllocateCopyPool (StrSize (CommandString), CommandString);
|
||||||
if (Node->CommandString == NULL) {
|
if (Node->CommandString == NULL) {
|
||||||
FreePool (Node);
|
FreePool (Node);
|
||||||
@ -615,10 +639,11 @@ ShellCommandRegisterCommandName (
|
|||||||
Node->HiiHandle = HiiHandle;
|
Node->HiiHandle = HiiHandle;
|
||||||
Node->ManFormatHelp = ManFormatHelp;
|
Node->ManFormatHelp = ManFormatHelp;
|
||||||
|
|
||||||
if ( StrLen(ProfileName)>0
|
if ( (StrLen (ProfileName) > 0)
|
||||||
&& ((mProfileList != NULL
|
&& (( (mProfileList != NULL)
|
||||||
&& StrStr(mProfileList, ProfileName) == NULL) || mProfileList == NULL)
|
&& (StrStr (mProfileList, ProfileName) == NULL)) || (mProfileList == NULL))
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ASSERT ((mProfileList == NULL && mProfileListSize == 0) || (mProfileList != NULL));
|
ASSERT ((mProfileList == NULL && mProfileListSize == 0) || (mProfileList != NULL));
|
||||||
if (mProfileList == NULL) {
|
if (mProfileList == NULL) {
|
||||||
//
|
//
|
||||||
@ -626,6 +651,7 @@ ShellCommandRegisterCommandName (
|
|||||||
//
|
//
|
||||||
StrnCatGrow (&mProfileList, &mProfileListSize, L";", 0);
|
StrnCatGrow (&mProfileList, &mProfileListSize, L";", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
StrnCatGrow (&mProfileList, &mProfileListSize, ProfileName, 0);
|
StrnCatGrow (&mProfileList, &mProfileListSize, ProfileName, 0);
|
||||||
StrnCatGrow (&mProfileList, &mProfileListSize, L";", 0);
|
StrnCatGrow (&mProfileList, &mProfileListSize, L";", 0);
|
||||||
}
|
}
|
||||||
@ -641,8 +667,8 @@ ShellCommandRegisterCommandName (
|
|||||||
for (Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link),
|
for (Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link),
|
||||||
PrevCommand = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
PrevCommand = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
||||||
; !IsNull (&mCommandList.Link, &Command->Link)
|
; !IsNull (&mCommandList.Link, &Command->Link)
|
||||||
; Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Command->Link)) {
|
; Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Command->Link))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Get Lexical Comparison Value between PrevCommand and Command list entry
|
// Get Lexical Comparison Value between PrevCommand and Command list entry
|
||||||
//
|
//
|
||||||
@ -730,21 +756,26 @@ ShellCommandRunCommandHandler (
|
|||||||
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
||||||
; !IsNull (&mCommandList.Link, &Node->Link)
|
; !IsNull (&mCommandList.Link, &Node->Link)
|
||||||
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
|
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ASSERT (Node->CommandString != NULL);
|
ASSERT (Node->CommandString != NULL);
|
||||||
if (gUnicodeCollation->StriColl (
|
if (gUnicodeCollation->StriColl (
|
||||||
gUnicodeCollation,
|
gUnicodeCollation,
|
||||||
(CHAR16 *)CommandString,
|
(CHAR16 *)CommandString,
|
||||||
Node->CommandString) == 0
|
Node->CommandString
|
||||||
){
|
) == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
if (CanAffectLE != NULL) {
|
if (CanAffectLE != NULL) {
|
||||||
*CanAffectLE = Node->LastError;
|
*CanAffectLE = Node->LastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RetVal != NULL) {
|
if (RetVal != NULL) {
|
||||||
*RetVal = Node->CommandHandler (NULL, gST);
|
*RetVal = Node->CommandHandler (NULL, gST);
|
||||||
} else {
|
} else {
|
||||||
Node->CommandHandler (NULL, gST);
|
Node->CommandHandler (NULL, gST);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (RETURN_SUCCESS);
|
return (RETURN_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -759,6 +790,7 @@ ShellCommandRunCommandHandler (
|
|||||||
} else {
|
} else {
|
||||||
DynamicCommand->Handler (DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol);
|
DynamicCommand->Handler (DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (RETURN_SUCCESS);
|
return (RETURN_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,16 +829,20 @@ ShellCommandGetManFileNameHandler (
|
|||||||
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
|
||||||
; !IsNull (&mCommandList.Link, &Node->Link)
|
; !IsNull (&mCommandList.Link, &Node->Link)
|
||||||
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
|
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ASSERT (Node->CommandString != NULL);
|
ASSERT (Node->CommandString != NULL);
|
||||||
if (gUnicodeCollation->StriColl (
|
if (gUnicodeCollation->StriColl (
|
||||||
gUnicodeCollation,
|
gUnicodeCollation,
|
||||||
(CHAR16 *)CommandString,
|
(CHAR16 *)CommandString,
|
||||||
Node->CommandString) == 0
|
Node->CommandString
|
||||||
){
|
) == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
return (Node->GetManFileName ());
|
return (Node->GetManFileName ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,11 +905,13 @@ ShellCommandRegisterAlias (
|
|||||||
if (Node == NULL) {
|
if (Node == NULL) {
|
||||||
return RETURN_OUT_OF_RESOURCES;
|
return RETURN_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->CommandString = AllocateCopyPool (StrSize (Command), Command);
|
Node->CommandString = AllocateCopyPool (StrSize (Command), Command);
|
||||||
if (Node->CommandString == NULL) {
|
if (Node->CommandString == NULL) {
|
||||||
FreePool (Node);
|
FreePool (Node);
|
||||||
return RETURN_OUT_OF_RESOURCES;
|
return RETURN_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Alias = AllocateCopyPool (StrSize (Alias), Alias);
|
Node->Alias = AllocateCopyPool (StrSize (Alias), Alias);
|
||||||
if (Node->Alias == NULL) {
|
if (Node->Alias == NULL) {
|
||||||
FreePool (Node->CommandString);
|
FreePool (Node->CommandString);
|
||||||
@ -889,7 +927,8 @@ ShellCommandRegisterAlias (
|
|||||||
for ( CommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link),
|
for ( CommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link),
|
||||||
PrevCommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link)
|
PrevCommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link)
|
||||||
; !IsNull (&mAliasList.Link, &CommandAlias->Link)
|
; !IsNull (&mAliasList.Link, &CommandAlias->Link)
|
||||||
; CommandAlias = (ALIAS_LIST *) GetNextNode (&mAliasList.Link, &CommandAlias->Link) ) {
|
; CommandAlias = (ALIAS_LIST *)GetNextNode (&mAliasList.Link, &CommandAlias->Link))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Get Lexical comparison value between PrevCommandAlias and CommandAlias List Entry
|
// Get Lexical comparison value between PrevCommandAlias and CommandAlias List Entry
|
||||||
//
|
//
|
||||||
@ -959,24 +998,31 @@ ShellCommandIsOnAliasList(
|
|||||||
for ( Node = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link)
|
for ( Node = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link)
|
||||||
; !IsNull (&mAliasList.Link, &Node->Link)
|
; !IsNull (&mAliasList.Link, &Node->Link)
|
||||||
; Node = (ALIAS_LIST *)GetNextNode (&mAliasList.Link, &Node->Link)
|
; Node = (ALIAS_LIST *)GetNextNode (&mAliasList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
ASSERT (Node->CommandString != NULL);
|
ASSERT (Node->CommandString != NULL);
|
||||||
ASSERT (Node->Alias != NULL);
|
ASSERT (Node->Alias != NULL);
|
||||||
if (gUnicodeCollation->StriColl (
|
if (gUnicodeCollation->StriColl (
|
||||||
gUnicodeCollation,
|
gUnicodeCollation,
|
||||||
(CHAR16 *)Alias,
|
(CHAR16 *)Alias,
|
||||||
Node->CommandString) == 0
|
Node->CommandString
|
||||||
){
|
) == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gUnicodeCollation->StriColl (
|
if (gUnicodeCollation->StriColl (
|
||||||
gUnicodeCollation,
|
gUnicodeCollation,
|
||||||
(CHAR16 *)Alias,
|
(CHAR16 *)Alias,
|
||||||
Node->Alias) == 0
|
Node->Alias
|
||||||
){
|
) == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1033,6 +1079,7 @@ ShellCommandRegisterExit (
|
|||||||
} else {
|
} else {
|
||||||
mExitScript = FALSE;
|
mExitScript = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mExitCode = ErrorCode;
|
mExitCode = ErrorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,6 +1113,7 @@ ShellCommandGetExitCode (
|
|||||||
{
|
{
|
||||||
return (mExitCode);
|
return (mExitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieve the Exit script indicator.
|
Retrieve the Exit script indicator.
|
||||||
|
|
||||||
@ -1103,9 +1151,11 @@ DeleteScriptFileStruct (
|
|||||||
for (LoopVar = 0; LoopVar < Script->Argc; LoopVar++) {
|
for (LoopVar = 0; LoopVar < Script->Argc; LoopVar++) {
|
||||||
SHELL_FREE_NON_NULL (Script->Argv[LoopVar]);
|
SHELL_FREE_NON_NULL (Script->Argv[LoopVar]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Script->Argv != NULL) {
|
if (Script->Argv != NULL) {
|
||||||
SHELL_FREE_NON_NULL (Script->Argv);
|
SHELL_FREE_NON_NULL (Script->Argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Script->CurrentCommand = NULL;
|
Script->CurrentCommand = NULL;
|
||||||
while (!IsListEmpty (&Script->CommandList)) {
|
while (!IsListEmpty (&Script->CommandList)) {
|
||||||
Script->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode (&Script->CommandList);
|
Script->CurrentCommand = (SCRIPT_COMMAND_LIST *)GetFirstNode (&Script->CommandList);
|
||||||
@ -1114,12 +1164,15 @@ DeleteScriptFileStruct (
|
|||||||
if (Script->CurrentCommand->Cl != NULL) {
|
if (Script->CurrentCommand->Cl != NULL) {
|
||||||
SHELL_FREE_NON_NULL (Script->CurrentCommand->Cl);
|
SHELL_FREE_NON_NULL (Script->CurrentCommand->Cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Script->CurrentCommand->Data != NULL) {
|
if (Script->CurrentCommand->Data != NULL) {
|
||||||
SHELL_FREE_NON_NULL (Script->CurrentCommand->Data);
|
SHELL_FREE_NON_NULL (Script->CurrentCommand->Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (Script->CurrentCommand);
|
SHELL_FREE_NON_NULL (Script->CurrentCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (Script->ScriptName);
|
SHELL_FREE_NON_NULL (Script->ScriptName);
|
||||||
SHELL_FREE_NON_NULL (Script);
|
SHELL_FREE_NON_NULL (Script);
|
||||||
}
|
}
|
||||||
@ -1137,9 +1190,11 @@ ShellCommandGetCurrentScriptFile (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
SCRIPT_FILE_LIST *List;
|
SCRIPT_FILE_LIST *List;
|
||||||
|
|
||||||
if (IsListEmpty (&mScriptList.Link)) {
|
if (IsListEmpty (&mScriptList.Link)) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
List = ((SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link));
|
List = ((SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link));
|
||||||
return (List->Data);
|
return (List->Data);
|
||||||
}
|
}
|
||||||
@ -1162,10 +1217,12 @@ ShellCommandSetNewScript (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
SCRIPT_FILE_LIST *Node;
|
SCRIPT_FILE_LIST *Node;
|
||||||
|
|
||||||
if (Script == NULL) {
|
if (Script == NULL) {
|
||||||
if (IsListEmpty (&mScriptList.Link)) {
|
if (IsListEmpty (&mScriptList.Link)) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node = (SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link);
|
Node = (SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link);
|
||||||
RemoveEntryList (&Node->Link);
|
RemoveEntryList (&Node->Link);
|
||||||
DeleteScriptFileStruct (Node->Data);
|
DeleteScriptFileStruct (Node->Data);
|
||||||
@ -1175,9 +1232,11 @@ ShellCommandSetNewScript (
|
|||||||
if (Node == NULL) {
|
if (Node == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Data = Script;
|
Node->Data = Script;
|
||||||
InsertHeadList (&mScriptList.Link, &Node->Link);
|
InsertHeadList (&mScriptList.Link, &Node->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ShellCommandGetCurrentScriptFile ());
|
return (ShellCommandGetCurrentScriptFile ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1198,6 +1257,7 @@ ShellCommandCreateNewMappingName(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 *String;
|
CHAR16 *String;
|
||||||
|
|
||||||
ASSERT (Type < MappingTypeMax);
|
ASSERT (Type < MappingTypeMax);
|
||||||
|
|
||||||
String = NULL;
|
String = NULL;
|
||||||
@ -1207,7 +1267,8 @@ ShellCommandCreateNewMappingName(
|
|||||||
String,
|
String,
|
||||||
PcdGet8 (PcdShellMapNameLength) * sizeof (String[0]),
|
PcdGet8 (PcdShellMapNameLength) * sizeof (String[0]),
|
||||||
Type == MappingTypeFileSystem ? L"FS%d:" : L"BLK%d:",
|
Type == MappingTypeFileSystem ? L"FS%d:" : L"BLK%d:",
|
||||||
Type == MappingTypeFileSystem?mFsMaxCount++:mBlkMaxCount++);
|
Type == MappingTypeFileSystem ? mFsMaxCount++ : mBlkMaxCount++
|
||||||
|
);
|
||||||
|
|
||||||
return (String);
|
return (String);
|
||||||
}
|
}
|
||||||
@ -1262,14 +1323,17 @@ ShellCommandAddMapItemAndUpdatePath(
|
|||||||
InsertTailList (&gShellMapList.Link, &MapListNode->Link);
|
InsertTailList (&gShellMapList.Link, &MapListNode->Link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (MapListNode != NULL) {
|
if (MapListNode != NULL) {
|
||||||
if (MapListNode->DevicePath != NULL) {
|
if (MapListNode->DevicePath != NULL) {
|
||||||
FreePool (MapListNode->DevicePath);
|
FreePool (MapListNode->DevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MapListNode->MapName != NULL) {
|
if (MapListNode->MapName != NULL) {
|
||||||
FreePool (MapListNode->MapName);
|
FreePool (MapListNode->MapName);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (MapListNode);
|
FreePool (MapListNode);
|
||||||
}
|
}
|
||||||
} else if (Path) {
|
} else if (Path) {
|
||||||
@ -1283,6 +1347,7 @@ ShellCommandAddMapItemAndUpdatePath(
|
|||||||
StrnCatGrow (&NewPath, &NewPathSize, OriginalPath, 0);
|
StrnCatGrow (&NewPath, &NewPathSize, OriginalPath, 0);
|
||||||
StrnCatGrow (&NewPath, &NewPathSize, L";", 0);
|
StrnCatGrow (&NewPath, &NewPathSize, L";", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
StrnCatGrow (&NewPath, &NewPathSize, Name, 0);
|
StrnCatGrow (&NewPath, &NewPathSize, Name, 0);
|
||||||
StrnCatGrow (&NewPath, &NewPathSize, L"\\efi\\tools\\;", 0);
|
StrnCatGrow (&NewPath, &NewPathSize, L"\\efi\\tools\\;", 0);
|
||||||
StrnCatGrow (&NewPath, &NewPathSize, Name, 0);
|
StrnCatGrow (&NewPath, &NewPathSize, Name, 0);
|
||||||
@ -1294,6 +1359,7 @@ ShellCommandAddMapItemAndUpdatePath(
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
FreePool (NewPath);
|
FreePool (NewPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1353,7 +1419,8 @@ ShellCommandCreateInitialMappingsAndPaths(
|
|||||||
for ( MapListNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
for ( MapListNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
||||||
; !IsListEmpty (&gShellMapList.Link)
|
; !IsListEmpty (&gShellMapList.Link)
|
||||||
; MapListNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
; MapListNode = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
RemoveEntryList (&MapListNode->Link);
|
RemoveEntryList (&MapListNode->Link);
|
||||||
SHELL_FREE_NON_NULL (MapListNode->DevicePath);
|
SHELL_FREE_NON_NULL (MapListNode->DevicePath);
|
||||||
SHELL_FREE_NON_NULL (MapListNode->MapName);
|
SHELL_FREE_NON_NULL (MapListNode->MapName);
|
||||||
@ -1370,7 +1437,8 @@ ShellCommandCreateInitialMappingsAndPaths(
|
|||||||
//
|
//
|
||||||
// Do a count of the handles
|
// Do a count of the handles
|
||||||
//
|
//
|
||||||
for (Count = 0 ; HandleList[Count] != NULL ; Count++);
|
for (Count = 0; HandleList[Count] != NULL; Count++) {
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get all Device Paths
|
// Get all Device Paths
|
||||||
@ -1435,16 +1503,19 @@ ShellCommandCreateInitialMappingsAndPaths(
|
|||||||
if (MapName == NULL) {
|
if (MapName == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitCurDir = StrStr (MapName, L":");
|
SplitCurDir = StrStr (MapName, L":");
|
||||||
if (SplitCurDir == NULL) {
|
if (SplitCurDir == NULL) {
|
||||||
SHELL_FREE_NON_NULL (MapName);
|
SHELL_FREE_NON_NULL (MapName);
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(SplitCurDir + 1) = CHAR_NULL;
|
*(SplitCurDir + 1) = CHAR_NULL;
|
||||||
MapListItem = ShellCommandFindMapItem (MapName);
|
MapListItem = ShellCommandFindMapItem (MapName);
|
||||||
if (MapListItem != NULL) {
|
if (MapListItem != NULL) {
|
||||||
gShellCurMapping = MapListItem;
|
gShellCurMapping = MapListItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (MapName);
|
SHELL_FREE_NON_NULL (MapName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1457,7 +1528,8 @@ ShellCommandCreateInitialMappingsAndPaths(
|
|||||||
//
|
//
|
||||||
HandleList = GetHandleListByProtocol (&gEfiBlockIoProtocolGuid);
|
HandleList = GetHandleListByProtocol (&gEfiBlockIoProtocolGuid);
|
||||||
if (HandleList != NULL) {
|
if (HandleList != NULL) {
|
||||||
for (Count = 0 ; HandleList[Count] != NULL ; Count++);
|
for (Count = 0; HandleList[Count] != NULL; Count++) {
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get all Device Paths
|
// Get all Device Paths
|
||||||
@ -1534,7 +1606,8 @@ ShellCommandUpdateMapping (
|
|||||||
//
|
//
|
||||||
// Do a count of the handles
|
// Do a count of the handles
|
||||||
//
|
//
|
||||||
for (Count = 0 ; HandleList[Count] != NULL ; Count++);
|
for (Count = 0; HandleList[Count] != NULL; Count++) {
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get all Device Paths
|
// Get all Device Paths
|
||||||
@ -1565,6 +1638,7 @@ ShellCommandUpdateMapping (
|
|||||||
if (gEfiShellProtocol->GetMapFromDevicePath (&DevicePathList[Count]) != NULL) {
|
if (gEfiShellProtocol->GetMapFromDevicePath (&DevicePathList[Count]) != NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get default name
|
// Get default name
|
||||||
//
|
//
|
||||||
@ -1592,6 +1666,7 @@ ShellCommandUpdateMapping (
|
|||||||
|
|
||||||
FreePool (NewDefaultName);
|
FreePool (NewDefaultName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellCommandConsistMappingUnInitialize (ConsistMappingTable);
|
ShellCommandConsistMappingUnInitialize (ConsistMappingTable);
|
||||||
SHELL_FREE_NON_NULL (HandleList);
|
SHELL_FREE_NON_NULL (HandleList);
|
||||||
SHELL_FREE_NON_NULL (DevicePathList);
|
SHELL_FREE_NON_NULL (DevicePathList);
|
||||||
@ -1600,6 +1675,7 @@ ShellCommandUpdateMapping (
|
|||||||
} else {
|
} else {
|
||||||
Count = (UINTN)-1;
|
Count = (UINTN)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do it all over again for gEfiBlockIoProtocolGuid
|
// Do it all over again for gEfiBlockIoProtocolGuid
|
||||||
//
|
//
|
||||||
@ -1647,11 +1723,13 @@ ConvertEfiFileProtocolToShellHandle(
|
|||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewNode = AllocateZeroPool (sizeof (BUFFER_LIST));
|
NewNode = AllocateZeroPool (sizeof (BUFFER_LIST));
|
||||||
if (NewNode == NULL) {
|
if (NewNode == NULL) {
|
||||||
SHELL_FREE_NON_NULL (Buffer);
|
SHELL_FREE_NON_NULL (Buffer);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer->FileHandle = (EFI_FILE_PROTOCOL *)Handle;
|
Buffer->FileHandle = (EFI_FILE_PROTOCOL *)Handle;
|
||||||
Buffer->Path = StrnCatGrow (&Buffer->Path, NULL, Path, 0);
|
Buffer->Path = StrnCatGrow (&Buffer->Path, NULL, Path, 0);
|
||||||
if (Buffer->Path == NULL) {
|
if (Buffer->Path == NULL) {
|
||||||
@ -1659,10 +1737,12 @@ ConvertEfiFileProtocolToShellHandle(
|
|||||||
SHELL_FREE_NON_NULL (Buffer);
|
SHELL_FREE_NON_NULL (Buffer);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewNode->Buffer = Buffer;
|
NewNode->Buffer = Buffer;
|
||||||
|
|
||||||
InsertHeadList (&mFileHandleList.Link, &NewNode->Link);
|
InsertHeadList (&mFileHandleList.Link, &NewNode->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((SHELL_FILE_HANDLE)(Handle));
|
return ((SHELL_FILE_HANDLE)(Handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1684,11 +1764,13 @@ ShellFileHandleGetPath(
|
|||||||
for (Node = (BUFFER_LIST *)GetFirstNode (&mFileHandleList.Link)
|
for (Node = (BUFFER_LIST *)GetFirstNode (&mFileHandleList.Link)
|
||||||
; !IsNull (&mFileHandleList.Link, &Node->Link)
|
; !IsNull (&mFileHandleList.Link, &Node->Link)
|
||||||
; Node = (BUFFER_LIST *)GetNextNode (&mFileHandleList.Link, &Node->Link)
|
; Node = (BUFFER_LIST *)GetNextNode (&mFileHandleList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)) {
|
if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)) {
|
||||||
return (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path);
|
return (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1711,7 +1793,8 @@ ShellFileHandleRemove(
|
|||||||
for (Node = (BUFFER_LIST *)GetFirstNode (&mFileHandleList.Link)
|
for (Node = (BUFFER_LIST *)GetFirstNode (&mFileHandleList.Link)
|
||||||
; !IsNull (&mFileHandleList.Link, &Node->Link)
|
; !IsNull (&mFileHandleList.Link, &Node->Link)
|
||||||
; Node = (BUFFER_LIST *)GetNextNode (&mFileHandleList.Link, &Node->Link)
|
; Node = (BUFFER_LIST *)GetNextNode (&mFileHandleList.Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)) {
|
if ((Node->Buffer) && (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->FileHandle == Handle)) {
|
||||||
RemoveEntryList (&Node->Link);
|
RemoveEntryList (&Node->Link);
|
||||||
SHELL_FREE_NON_NULL (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path);
|
SHELL_FREE_NON_NULL (((SHELL_COMMAND_FILE_HANDLE *)Node->Buffer)->Path);
|
||||||
@ -1720,6 +1803,7 @@ ShellFileHandleRemove(
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1785,17 +1869,20 @@ FreeBufferList (
|
|||||||
if (List == NULL) {
|
if (List == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// enumerate through the buffer list and free all memory
|
// enumerate through the buffer list and free all memory
|
||||||
//
|
//
|
||||||
for ( BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
|
for ( BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
|
||||||
; !IsListEmpty (&List->Link)
|
; !IsListEmpty (&List->Link)
|
||||||
; BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
|
; BufferListEntry = (BUFFER_LIST *)GetFirstNode (&List->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
RemoveEntryList (&BufferListEntry->Link);
|
RemoveEntryList (&BufferListEntry->Link);
|
||||||
if (BufferListEntry->Buffer != NULL) {
|
if (BufferListEntry->Buffer != NULL) {
|
||||||
FreePool (BufferListEntry->Buffer);
|
FreePool (BufferListEntry->Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (BufferListEntry);
|
FreePool (BufferListEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2077,12 +2164,14 @@ ShellSortFileList (
|
|||||||
if (Duplicates != NULL) {
|
if (Duplicates != NULL) {
|
||||||
*Duplicates = NULL;
|
*Duplicates = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*FileList == NULL) {
|
if (*FileList == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesHead = &(*FileList)->Link;
|
FilesHead = &(*FileList)->Link;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2104,6 +2193,7 @@ ShellSortFileList (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto UninitSort;
|
goto UninitSort;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unique->Alias = ((Order == ShellSortFileListByFileName) ?
|
Unique->Alias = ((Order == ShellSortFileListByFileName) ?
|
||||||
FileInfo->FileName :
|
FileInfo->FileName :
|
||||||
FileInfo->FullName);
|
FileInfo->FullName);
|
||||||
@ -2124,6 +2214,7 @@ ShellSortFileList (
|
|||||||
if (Status == EFI_OUT_OF_RESOURCES) {
|
if (Status == EFI_OUT_OF_RESOURCES) {
|
||||||
goto UninitSort;
|
goto UninitSort;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Status == EFI_ALREADY_STARTED);
|
ASSERT (Status == EFI_ALREADY_STARTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2143,6 +2234,7 @@ ShellSortFileList (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto UninitSort;
|
goto UninitSort;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeListHead (&Dupes->Link);
|
InitializeListHead (&Dupes->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2176,7 +2268,8 @@ ShellSortFileList (
|
|||||||
//
|
//
|
||||||
for (SortEntry = OrderedCollectionMin (Sort);
|
for (SortEntry = OrderedCollectionMin (Sort);
|
||||||
SortEntry != NULL;
|
SortEntry != NULL;
|
||||||
SortEntry = OrderedCollectionNext (SortEntry)) {
|
SortEntry = OrderedCollectionNext (SortEntry))
|
||||||
|
{
|
||||||
Unique = OrderedCollectionUserStruct (SortEntry);
|
Unique = OrderedCollectionUserStruct (SortEntry);
|
||||||
//
|
//
|
||||||
// The first FileInfo encountered for each unique name goes back on
|
// The first FileInfo encountered for each unique name goes back on
|
||||||
@ -2207,6 +2300,7 @@ ShellSortFileList (
|
|||||||
*Duplicates = Dupes;
|
*Duplicates = Dupes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2215,13 +2309,15 @@ ShellSortFileList (
|
|||||||
UninitSort:
|
UninitSort:
|
||||||
for (SortEntry = OrderedCollectionMin (Sort);
|
for (SortEntry = OrderedCollectionMin (Sort);
|
||||||
SortEntry != NULL;
|
SortEntry != NULL;
|
||||||
SortEntry = NextSortEntry) {
|
SortEntry = NextSortEntry)
|
||||||
|
{
|
||||||
NextSortEntry = OrderedCollectionNext (SortEntry);
|
NextSortEntry = OrderedCollectionNext (SortEntry);
|
||||||
OrderedCollectionDelete (Sort, SortEntry, &UniqueAsVoid);
|
OrderedCollectionDelete (Sort, SortEntry, &UniqueAsVoid);
|
||||||
Unique = UniqueAsVoid;
|
Unique = UniqueAsVoid;
|
||||||
ASSERT (IsListEmpty (&Unique->SameNameList));
|
ASSERT (IsListEmpty (&Unique->SameNameList));
|
||||||
FreePool (Unique);
|
FreePool (Unique);
|
||||||
}
|
}
|
||||||
|
|
||||||
OrderedCollectionUninit (Sort);
|
OrderedCollectionUninit (Sort);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -81,4 +81,3 @@ typedef struct {
|
|||||||
} SHELL_SORT_UNIQUE_NAME;
|
} SHELL_SORT_UNIQUE_NAME;
|
||||||
|
|
||||||
#endif //_UEFI_COMMAND_LIB_INTERNAL_HEADER_
|
#endif //_UEFI_COMMAND_LIB_INTERNAL_HEADER_
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ PrintDifferentPoint(
|
|||||||
// Print data in char-format.
|
// Print data in char-format.
|
||||||
//
|
//
|
||||||
for (Index = 0; Index < BufferSize; Index++) {
|
for (Index = 0; Index < BufferSize; Index++) {
|
||||||
if (Buffer[Index] >= 0x20 && Buffer[Index] <= 0x7E) {
|
if ((Buffer[Index] >= 0x20) && (Buffer[Index] <= 0x7E)) {
|
||||||
ShellPrintEx (-1, -1, L"%c", Buffer[Index]);
|
ShellPrintEx (-1, -1, L"%c", Buffer[Index]);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
@ -165,15 +165,20 @@ FileBufferReadByte (
|
|||||||
|
|
||||||
if (FileBuffer->Left == 0) {
|
if (FileBuffer->Left == 0) {
|
||||||
ReadSize = FileBuffer->Allocated;
|
ReadSize = FileBuffer->Allocated;
|
||||||
Status = gEfiShellProtocol->ReadFile (FileHandle, &ReadSize,
|
Status = gEfiShellProtocol->ReadFile (
|
||||||
FileBuffer->Data);
|
FileHandle,
|
||||||
|
&ReadSize,
|
||||||
|
FileBuffer->Data
|
||||||
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReadSize == 0) {
|
if (ReadSize == 0) {
|
||||||
*BytesRead = 0;
|
*BytesRead = 0;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileBuffer->Next = 0;
|
FileBuffer->Next = 0;
|
||||||
FileBuffer->Left = ReadSize;
|
FileBuffer->Left = ReadSize;
|
||||||
}
|
}
|
||||||
@ -259,7 +264,7 @@ ShellCommandRunComp (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"comp", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"comp", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -287,6 +292,7 @@ ShellCommandRunComp (
|
|||||||
ShellStatus = SHELL_NOT_FOUND;
|
ShellStatus = SHELL_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TempParam = ShellCommandLineGetRawValue (Package, 2);
|
TempParam = ShellCommandLineGetRawValue (Package, 2);
|
||||||
ASSERT (TempParam != NULL);
|
ASSERT (TempParam != NULL);
|
||||||
FileName2 = ShellFindFilePath (TempParam);
|
FileName2 = ShellFindFilePath (TempParam);
|
||||||
@ -300,6 +306,7 @@ ShellCommandRunComp (
|
|||||||
ShellStatus = SHELL_NOT_FOUND;
|
ShellStatus = SHELL_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellStatus == SHELL_SUCCESS) {
|
if (ShellStatus == SHELL_SUCCESS) {
|
||||||
Status = gEfiShellProtocol->GetFileSize (FileHandle1, &Size1);
|
Status = gEfiShellProtocol->GetFileSize (FileHandle1, &Size1);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
@ -316,7 +323,7 @@ ShellCommandRunComp (
|
|||||||
DifferentCount = MAX_UINTN;
|
DifferentCount = MAX_UINTN;
|
||||||
} else {
|
} else {
|
||||||
Status = ShellConvertStringToUint64 (TempParam, &DifferentCount, FALSE, TRUE);
|
Status = ShellConvertStringToUint64 (TempParam, &DifferentCount, FALSE, TRUE);
|
||||||
if (EFI_ERROR(Status) || DifferentCount == 0) {
|
if (EFI_ERROR (Status) || (DifferentCount == 0)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-n");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-n");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -331,7 +338,7 @@ ShellCommandRunComp (
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
Status = ShellConvertStringToUint64 (TempParam, &DifferentBytes, FALSE, TRUE);
|
Status = ShellConvertStringToUint64 (TempParam, &DifferentBytes, FALSE, TRUE);
|
||||||
if (EFI_ERROR(Status) || DifferentBytes == 0) {
|
if (EFI_ERROR (Status) || (DifferentBytes == 0)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-s");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"comp", TempParam, L"-s");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -348,8 +355,9 @@ ShellCommandRunComp (
|
|||||||
DataFromFile2 = AllocateZeroPool ((UINTN)DifferentBytes);
|
DataFromFile2 = AllocateZeroPool ((UINTN)DifferentBytes);
|
||||||
FileBufferInit (&FileBuffer1);
|
FileBufferInit (&FileBuffer1);
|
||||||
FileBufferInit (&FileBuffer2);
|
FileBufferInit (&FileBuffer2);
|
||||||
if (DataFromFile1 == NULL || DataFromFile2 == NULL ||
|
if ((DataFromFile1 == NULL) || (DataFromFile2 == NULL) ||
|
||||||
FileBuffer1.Data == NULL || FileBuffer2.Data == NULL) {
|
(FileBuffer1.Data == NULL) || (FileBuffer2.Data == NULL))
|
||||||
|
{
|
||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
SHELL_FREE_NON_NULL (DataFromFile1);
|
SHELL_FREE_NON_NULL (DataFromFile1);
|
||||||
SHELL_FREE_NON_NULL (DataFromFile2);
|
SHELL_FREE_NON_NULL (DataFromFile2);
|
||||||
@ -364,11 +372,19 @@ ShellCommandRunComp (
|
|||||||
DataSizeFromFile2 = 1;
|
DataSizeFromFile2 = 1;
|
||||||
OneByteFromFile1 = 0;
|
OneByteFromFile1 = 0;
|
||||||
OneByteFromFile2 = 0;
|
OneByteFromFile2 = 0;
|
||||||
Status = FileBufferReadByte (FileHandle1, &FileBuffer1,
|
Status = FileBufferReadByte (
|
||||||
&DataSizeFromFile1, &OneByteFromFile1);
|
FileHandle1,
|
||||||
|
&FileBuffer1,
|
||||||
|
&DataSizeFromFile1,
|
||||||
|
&OneByteFromFile1
|
||||||
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
Status = FileBufferReadByte (FileHandle2, &FileBuffer2,
|
Status = FileBufferReadByte (
|
||||||
&DataSizeFromFile2, &OneByteFromFile2);
|
FileHandle2,
|
||||||
|
&FileBuffer2,
|
||||||
|
&DataSizeFromFile2,
|
||||||
|
&OneByteFromFile2
|
||||||
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
TempAddress++;
|
TempAddress++;
|
||||||
@ -378,9 +394,10 @@ ShellCommandRunComp (
|
|||||||
// 2.If no more char in File1 or File2, The ReadStatus is InPrevDiffPoint forever.
|
// 2.If no more char in File1 or File2, The ReadStatus is InPrevDiffPoint forever.
|
||||||
// So the previous different point is the last one, then break the while block.
|
// So the previous different point is the last one, then break the while block.
|
||||||
//
|
//
|
||||||
if ( (DataSizeFromFile1 == 0 && InsertPosition1 == 0 && DataSizeFromFile2 == 0 && InsertPosition2 == 0) ||
|
if (((DataSizeFromFile1 == 0) && (InsertPosition1 == 0) && (DataSizeFromFile2 == 0) && (InsertPosition2 == 0)) ||
|
||||||
(ReadStatus == InPrevDiffPoint && (DataSizeFromFile1 == 0 || DataSizeFromFile2 == 0))
|
((ReadStatus == InPrevDiffPoint) && ((DataSizeFromFile1 == 0) || (DataSizeFromFile2 == 0)))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,6 +408,7 @@ ShellCommandRunComp (
|
|||||||
if (DataSizeFromFile1 == 1) {
|
if (DataSizeFromFile1 == 1) {
|
||||||
DataFromFile1[InsertPosition1++] = OneByteFromFile1;
|
DataFromFile1[InsertPosition1++] = OneByteFromFile1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataSizeFromFile2 == 1) {
|
if (DataSizeFromFile2 == 1) {
|
||||||
DataFromFile2[InsertPosition2++] = OneByteFromFile2;
|
DataFromFile2[InsertPosition2++] = OneByteFromFile2;
|
||||||
}
|
}
|
||||||
@ -399,6 +417,7 @@ ShellCommandRunComp (
|
|||||||
if (DataSizeFromFile1 == 1) {
|
if (DataSizeFromFile1 == 1) {
|
||||||
DataFromFile1[InsertPosition1++] = OneByteFromFile1;
|
DataFromFile1[InsertPosition1++] = OneByteFromFile1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataSizeFromFile2 == 1) {
|
if (DataSizeFromFile2 == 1) {
|
||||||
DataFromFile2[InsertPosition2++] = OneByteFromFile2;
|
DataFromFile2[InsertPosition2++] = OneByteFromFile2;
|
||||||
}
|
}
|
||||||
@ -411,11 +430,11 @@ ShellCommandRunComp (
|
|||||||
//
|
//
|
||||||
// ReadStatus should be always equal InDiffPoint.
|
// ReadStatus should be always equal InDiffPoint.
|
||||||
//
|
//
|
||||||
if ( InsertPosition1 == DifferentBytes ||
|
if ((InsertPosition1 == DifferentBytes) ||
|
||||||
InsertPosition2 == DifferentBytes ||
|
(InsertPosition2 == DifferentBytes) ||
|
||||||
(DataSizeFromFile1 == 0 && DataSizeFromFile2 == 0)
|
((DataSizeFromFile1 == 0) && (DataSizeFromFile2 == 0))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_DIFFERENCE_POINT), gShellDebug1HiiHandle, ++DiffPointNumber);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_DIFFERENCE_POINT), gShellDebug1HiiHandle, ++DiffPointNumber);
|
||||||
PrintDifferentPoint (FileName1, L"File1", DataFromFile1, InsertPosition1, DiffPointAddress, DifferentBytes);
|
PrintDifferentPoint (FileName1, L"File1", DataFromFile1, InsertPosition1, DiffPointAddress, DifferentBytes);
|
||||||
PrintDifferentPoint (FileName2, L"File2", DataFromFile2, InsertPosition2, DiffPointAddress, DifferentBytes);
|
PrintDifferentPoint (FileName2, L"File2", DataFromFile2, InsertPosition2, DiffPointAddress, DifferentBytes);
|
||||||
@ -423,7 +442,7 @@ ShellCommandRunComp (
|
|||||||
//
|
//
|
||||||
// One of two buffuers is empty, it means this is the last different point.
|
// One of two buffuers is empty, it means this is the last different point.
|
||||||
//
|
//
|
||||||
if (InsertPosition1 == 0 || InsertPosition2 == 0) {
|
if ((InsertPosition1 == 0) || (InsertPosition2 == 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,12 +498,14 @@ ShellCommandRunComp (
|
|||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (FileName1);
|
SHELL_FREE_NON_NULL (FileName1);
|
||||||
SHELL_FREE_NON_NULL (FileName2);
|
SHELL_FREE_NON_NULL (FileName2);
|
||||||
|
|
||||||
if (FileHandle1 != NULL) {
|
if (FileHandle1 != NULL) {
|
||||||
gEfiShellProtocol->CloseFile (FileHandle1);
|
gEfiShellProtocol->CloseFile (FileHandle1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileHandle2 != NULL) {
|
if (FileHandle2 != NULL) {
|
||||||
gEfiShellProtocol->CloseFile (FileHandle2);
|
gEfiShellProtocol->CloseFile (FileHandle2);
|
||||||
}
|
}
|
||||||
|
@ -401,6 +401,7 @@ InsertNode (
|
|||||||
|
|
||||||
mMatchLen = 2;
|
mMatchLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Traverse down the tree to find a match.
|
// Traverse down the tree to find a match.
|
||||||
// Update Position value along the route.
|
// Update Position value along the route.
|
||||||
@ -460,7 +461,6 @@ InsertNode (
|
|||||||
// Special usage of 'next'
|
// Special usage of 'next'
|
||||||
//
|
//
|
||||||
mNext[LoopVar4] = mPos;
|
mNext[LoopVar4] = mPos;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -609,6 +609,7 @@ GetNextMatch (
|
|||||||
if (Temp == NULL) {
|
if (Temp == NULL) {
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Temp, &mText[WNDSIZ], WNDSIZ + MAXMATCH);
|
CopyMem (Temp, &mText[WNDSIZ], WNDSIZ + MAXMATCH);
|
||||||
CopyMem (&mText[0], Temp, WNDSIZ + MAXMATCH);
|
CopyMem (&mText[0], Temp, WNDSIZ + MAXMATCH);
|
||||||
FreePool (Temp);
|
FreePool (Temp);
|
||||||
@ -643,7 +644,7 @@ DownHeap (
|
|||||||
LoopVar2 = mHeap[i];
|
LoopVar2 = mHeap[i];
|
||||||
LoopVar1 = 2 * i;
|
LoopVar1 = 2 * i;
|
||||||
while (LoopVar1 <= mHeapSize) {
|
while (LoopVar1 <= mHeapSize) {
|
||||||
if (LoopVar1 < mHeapSize && mFreq[mHeap[LoopVar1]] > mFreq[mHeap[LoopVar1 + 1]]) {
|
if ((LoopVar1 < mHeapSize) && (mFreq[mHeap[LoopVar1]] > mFreq[mHeap[LoopVar1 + 1]])) {
|
||||||
LoopVar1++;
|
LoopVar1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,21 +864,21 @@ PutBits (
|
|||||||
if (LoopVar8 < mBitCount) {
|
if (LoopVar8 < mBitCount) {
|
||||||
mSubBitBuf |= x << (mBitCount -= LoopVar8);
|
mSubBitBuf |= x << (mBitCount -= LoopVar8);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Temp = (UINT8)(mSubBitBuf | (x >> (LoopVar8 -= mBitCount)));
|
Temp = (UINT8)(mSubBitBuf | (x >> (LoopVar8 -= mBitCount)));
|
||||||
if (mDst < mDstUpperLimit) {
|
if (mDst < mDstUpperLimit) {
|
||||||
*mDst++ = Temp;
|
*mDst++ = Temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
mCompSize++;
|
mCompSize++;
|
||||||
|
|
||||||
if (LoopVar8 < UINT8_BIT) {
|
if (LoopVar8 < UINT8_BIT) {
|
||||||
mSubBitBuf = x << (mBitCount = UINT8_BIT - LoopVar8);
|
mSubBitBuf = x << (mBitCount = UINT8_BIT - LoopVar8);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Temp = (UINT8)(x >> (LoopVar8 - UINT8_BIT));
|
Temp = (UINT8)(x >> (LoopVar8 - UINT8_BIT));
|
||||||
if (mDst < mDstUpperLimit) {
|
if (mDst < mDstUpperLimit) {
|
||||||
*mDst++ = Temp;
|
*mDst++ = Temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
mCompSize++;
|
mCompSize++;
|
||||||
|
|
||||||
mSubBitBuf = x << (mBitCount = 2 * UINT8_BIT - LoopVar8);
|
mSubBitBuf = x << (mBitCount = 2 * UINT8_BIT - LoopVar8);
|
||||||
@ -1095,6 +1096,7 @@ SendBlock (
|
|||||||
UINT32 Pos;
|
UINT32 Pos;
|
||||||
|
|
||||||
UINT32 Size;
|
UINT32 Size;
|
||||||
|
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
|
|
||||||
Root = MakeTree (NC, mCFreq, mCLen, mCCode);
|
Root = MakeTree (NC, mCFreq, mCLen, mCCode);
|
||||||
@ -1133,6 +1135,7 @@ SendBlock (
|
|||||||
} else {
|
} else {
|
||||||
Flags <<= 1;
|
Flags <<= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Flags & (1U << (UINT8_BIT - 1))) != 0) {
|
if ((Flags & (1U << (UINT8_BIT - 1))) != 0) {
|
||||||
EncodeC (mBuf[Pos++] + (1U << UINT8_BIT));
|
EncodeC (mBuf[Pos++] + (1U << UINT8_BIT));
|
||||||
LoopVar3 = mBuf[Pos++] << UINT8_BIT;
|
LoopVar3 = mBuf[Pos++] << UINT8_BIT;
|
||||||
@ -1191,6 +1194,7 @@ CompressOutput (
|
|||||||
CPos = mOutputPos++;
|
CPos = mOutputPos++;
|
||||||
mBuf[CPos] = 0;
|
mBuf[CPos] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mBuf[mOutputPos++] = (UINT8)LoopVar5;
|
mBuf[mOutputPos++] = (UINT8)LoopVar5;
|
||||||
mCFreq[LoopVar5]++;
|
mCFreq[LoopVar5]++;
|
||||||
if (LoopVar5 >= (1U << UINT8_BIT)) {
|
if (LoopVar5 >= (1U << UINT8_BIT)) {
|
||||||
@ -1202,6 +1206,7 @@ CompressOutput (
|
|||||||
LoopVar7 >>= 1;
|
LoopVar7 >>= 1;
|
||||||
LoopVar5++;
|
LoopVar5++;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPFreq[LoopVar5]++;
|
mPFreq[LoopVar5]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1263,11 +1268,12 @@ Encode (
|
|||||||
if (!GetNextMatch ()) {
|
if (!GetNextMatch ()) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMatchLen > mRemainder) {
|
if (mMatchLen > mRemainder) {
|
||||||
mMatchLen = mRemainder;
|
mMatchLen = mRemainder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {
|
if ((mMatchLen > LastMatchLen) || (LastMatchLen < THRESHOLD)) {
|
||||||
//
|
//
|
||||||
// Not enough benefits are gained by outputting a pointer,
|
// Not enough benefits are gained by outputting a pointer,
|
||||||
// so just output the original character
|
// so just output the original character
|
||||||
@ -1278,13 +1284,16 @@ Encode (
|
|||||||
// Outputting a pointer is beneficial enough, do it.
|
// Outputting a pointer is beneficial enough, do it.
|
||||||
//
|
//
|
||||||
|
|
||||||
CompressOutput(LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
|
CompressOutput (
|
||||||
(mPos - LastMatchPos - 2) & (WNDSIZ - 1));
|
LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
|
||||||
|
(mPos - LastMatchPos - 2) & (WNDSIZ - 1)
|
||||||
|
);
|
||||||
LastMatchLen--;
|
LastMatchLen--;
|
||||||
while (LastMatchLen > 0) {
|
while (LastMatchLen > 0) {
|
||||||
if (!GetNextMatch ()) {
|
if (!GetNextMatch ()) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
LastMatchLen--;
|
LastMatchLen--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1354,12 +1363,14 @@ Compress (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Null terminate the compressed data
|
// Null terminate the compressed data
|
||||||
//
|
//
|
||||||
if (mDst < mDstUpperLimit) {
|
if (mDst < mDstUpperLimit) {
|
||||||
*mDst++ = 0;
|
*mDst++ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill in compressed size and original size
|
// Fill in compressed size and original size
|
||||||
//
|
//
|
||||||
@ -1377,6 +1388,4 @@ Compress (
|
|||||||
*DstSize = mCompSize + 1 + 8;
|
*DstSize = mCompSize + 1 + 8;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,4 +30,3 @@ Compress (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ DisplayTheBlocks(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status = BlockIo->ReadBlocks (BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);
|
Status = BlockIo->ReadBlocks (BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);
|
||||||
if (!EFI_ERROR(Status) && Buffer != NULL) {
|
if (!EFI_ERROR (Status) && (Buffer != NULL)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
@ -128,7 +128,7 @@ ShellCommandRunDblk (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dblk", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dblk", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -157,6 +157,7 @@ ShellCommandRunDblk (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", LbaString);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", LbaString);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellConvertStringToUint64 (LbaString, &Lba, TRUE, FALSE);
|
ShellConvertStringToUint64 (LbaString, &Lba, TRUE, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,6 +168,7 @@ ShellCommandRunDblk (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellConvertStringToUint64 (BlockCountString, &BlockCount, TRUE, FALSE);
|
ShellConvertStringToUint64 (BlockCountString, &BlockCount, TRUE, FALSE);
|
||||||
if (BlockCount > 0x10) {
|
if (BlockCount > 0x10) {
|
||||||
BlockCount = 0x10;
|
BlockCount = 0x10;
|
||||||
@ -197,5 +199,6 @@ ShellCommandRunDblk (
|
|||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,10 @@ MakePrintable(
|
|||||||
IN CONST CHAR16 Char
|
IN CONST CHAR16 Char
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ((Char < 0x20 && Char > 0)||(Char > 126)) {
|
if (((Char < 0x20) && (Char > 0)) || (Char > 126)) {
|
||||||
return (L'?');
|
return (L'?');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Char);
|
return (Char);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ DisplayMmioMemory(
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"dmem");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"dmem");
|
||||||
return (SHELL_NOT_FOUND);
|
return (SHELL_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer = AllocateZeroPool (Size);
|
Buffer = AllocateZeroPool (Size);
|
||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return SHELL_OUT_OF_RESOURCES;
|
return SHELL_OUT_OF_RESOURCES;
|
||||||
@ -127,7 +129,7 @@ ShellCommandRunDmem (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmem", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmem", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -148,6 +150,7 @@ ShellCommandRunDmem (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Temp1 = ShellCommandLineGetRawValue (Package, 2);
|
Temp1 = ShellCommandLineGetRawValue (Package, 2);
|
||||||
if (Temp1 == NULL) {
|
if (Temp1 == NULL) {
|
||||||
Size = 512;
|
Size = 512;
|
||||||
@ -175,25 +178,34 @@ ShellCommandRunDmem (
|
|||||||
Acpi20TableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
Acpi20TableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi10TableGuid)) {
|
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi10TableGuid)) {
|
||||||
AcpiTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
AcpiTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbiosTableGuid)) {
|
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbiosTableGuid)) {
|
||||||
SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbios3TableGuid)) {
|
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbios3TableGuid)) {
|
||||||
SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMpsTableGuid)) {
|
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMpsTableGuid)) {
|
||||||
MpsTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
MpsTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_SYSTEM_TABLE), gShellDebug1HiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DMEM_SYSTEM_TABLE),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
(UINT64)(UINTN)Address,
|
(UINT64)(UINTN)Address,
|
||||||
gST->Hdr.HeaderSize,
|
gST->Hdr.HeaderSize,
|
||||||
gST->Hdr.Revision,
|
gST->Hdr.Revision,
|
||||||
@ -214,7 +226,6 @@ ShellCommandRunDmem (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,17 +49,21 @@ GetAttrType (
|
|||||||
if ((Atts & EFI_VARIABLE_NON_VOLATILE) != 0) {
|
if ((Atts & EFI_VARIABLE_NON_VOLATILE) != 0) {
|
||||||
StrnCatGrow (&RetString, &BufLen, L"+NV", 0);
|
StrnCatGrow (&RetString, &BufLen, L"+NV", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Atts & EFI_VARIABLE_RUNTIME_ACCESS) != 0) {
|
if ((Atts & EFI_VARIABLE_RUNTIME_ACCESS) != 0) {
|
||||||
StrnCatGrow (&RetString, &BufLen, L"+RT+BS", 0);
|
StrnCatGrow (&RetString, &BufLen, L"+RT+BS", 0);
|
||||||
} else if ((Atts & EFI_VARIABLE_BOOTSERVICE_ACCESS) != 0) {
|
} else if ((Atts & EFI_VARIABLE_BOOTSERVICE_ACCESS) != 0) {
|
||||||
StrnCatGrow (&RetString, &BufLen, L"+BS", 0);
|
StrnCatGrow (&RetString, &BufLen, L"+BS", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Atts & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) {
|
if ((Atts & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) {
|
||||||
StrnCatGrow (&RetString, &BufLen, L"+HR", 0);
|
StrnCatGrow (&RetString, &BufLen, L"+HR", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Atts & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
if ((Atts & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
||||||
StrnCatGrow (&RetString, &BufLen, L"+AW", 0);
|
StrnCatGrow (&RetString, &BufLen, L"+AW", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Atts & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
if ((Atts & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
||||||
StrnCatGrow (&RetString, &BufLen, L"+AT", 0);
|
StrnCatGrow (&RetString, &BufLen, L"+AT", 0);
|
||||||
}
|
}
|
||||||
@ -108,6 +112,7 @@ BinaryToHexString (
|
|||||||
((UINT8 *)Buffer)[Index]
|
((UINT8 *)Buffer)[Index]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return HexString;
|
return HexString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +193,7 @@ LoadVariablesFromFile (
|
|||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferSize = RemainingSize;
|
BufferSize = RemainingSize;
|
||||||
Status = ShellReadFile (FileHandle, &BufferSize, (UINT32 *)Buffer + 2);
|
Status = ShellReadFile (FileHandle, &BufferSize, (UINT32 *)Buffer + 2);
|
||||||
if (EFI_ERROR (Status) || (BufferSize != RemainingSize)) {
|
if (EFI_ERROR (Status) || (BufferSize != RemainingSize)) {
|
||||||
@ -221,6 +227,7 @@ LoadVariablesFromFile (
|
|||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variable->Signature = DMP_STORE_VARIABLE_SIGNATURE;
|
Variable->Signature = DMP_STORE_VARIABLE_SIGNATURE;
|
||||||
Variable->Name = (CHAR16 *)(Variable + 1);
|
Variable->Name = (CHAR16 *)(Variable + 1);
|
||||||
Variable->DataSize = DataSize;
|
Variable->DataSize = DataSize;
|
||||||
@ -244,16 +251,25 @@ LoadVariablesFromFile (
|
|||||||
for ( Link = GetFirstNode (&List)
|
for ( Link = GetFirstNode (&List)
|
||||||
; !IsNull (&List, Link) && (ShellStatus == SHELL_SUCCESS)
|
; !IsNull (&List, Link) && (ShellStatus == SHELL_SUCCESS)
|
||||||
; Link = GetNextNode (&List, Link)
|
; Link = GetNextNode (&List, Link)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE);
|
Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE);
|
||||||
|
|
||||||
if (((Name == NULL) || gUnicodeCollation->MetaiMatch (gUnicodeCollation, Variable->Name, (CHAR16 *)Name)) &&
|
if (((Name == NULL) || gUnicodeCollation->MetaiMatch (gUnicodeCollation, Variable->Name, (CHAR16 *)Name)) &&
|
||||||
((Guid == NULL) || CompareGuid (&Variable->Guid, Guid))
|
((Guid == NULL) || CompareGuid (&Variable->Guid, Guid))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Attributes = GetAttrType (Variable->Attributes);
|
Attributes = GetAttrType (Variable->Attributes);
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN(STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
|
-1,
|
||||||
Attributes, &Variable->Guid, Variable->Name, Variable->DataSize
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DMPSTORE_HEADER_LINE),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
Attributes,
|
||||||
|
&Variable->Guid,
|
||||||
|
Variable->Name,
|
||||||
|
Variable->DataSize
|
||||||
);
|
);
|
||||||
SHELL_FREE_NON_NULL (Attributes);
|
SHELL_FREE_NON_NULL (Attributes);
|
||||||
|
|
||||||
@ -365,7 +381,8 @@ AppendSingleVariableToFile (
|
|||||||
|
|
||||||
if (!EFI_ERROR (Status) &&
|
if (!EFI_ERROR (Status) &&
|
||||||
(BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize + sizeof (UINT32))
|
(BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize + sizeof (UINT32))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,11 +491,12 @@ CascadeProcessVariables (
|
|||||||
// No matter what happened we process our own variable
|
// No matter what happened we process our own variable
|
||||||
// Only continue if Guid and VariableName are each either NULL or a match
|
// Only continue if Guid and VariableName are each either NULL or a match
|
||||||
//
|
//
|
||||||
if ( ( Name == NULL
|
if ( ( (Name == NULL)
|
||||||
|| gUnicodeCollation->MetaiMatch (gUnicodeCollation, FoundVarName, (CHAR16 *)Name))
|
|| gUnicodeCollation->MetaiMatch (gUnicodeCollation, FoundVarName, (CHAR16 *)Name))
|
||||||
&& ( Guid == NULL
|
&& ( (Guid == NULL)
|
||||||
|| CompareGuid (&FoundVarGuid, Guid))
|
|| CompareGuid (&FoundVarGuid, Guid))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
DataBuffer = NULL;
|
DataBuffer = NULL;
|
||||||
//
|
//
|
||||||
@ -495,6 +513,7 @@ CascadeProcessVariables (
|
|||||||
Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
|
Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Last error check then print this variable out.
|
// Last error check then print this variable out.
|
||||||
//
|
//
|
||||||
@ -505,10 +524,20 @@ CascadeProcessVariables (
|
|||||||
HexString = AllocatePool ((DataSize * 2 + 1) * sizeof (CHAR16));
|
HexString = AllocatePool ((DataSize * 2 + 1) * sizeof (CHAR16));
|
||||||
if (HexString != NULL) {
|
if (HexString != NULL) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_VAR_SFO), gShellDebug1HiiHandle,
|
-1,
|
||||||
FoundVarName, &FoundVarGuid, Atts, DataSize,
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DMPSTORE_VAR_SFO),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
FoundVarName,
|
||||||
|
&FoundVarGuid,
|
||||||
|
Atts,
|
||||||
|
DataSize,
|
||||||
BinaryToHexString (
|
BinaryToHexString (
|
||||||
DataBuffer, DataSize, HexString, (DataSize * 2 + 1) * sizeof (CHAR16)
|
DataBuffer,
|
||||||
|
DataSize,
|
||||||
|
HexString,
|
||||||
|
(DataSize * 2 + 1) * sizeof (CHAR16)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
FreePool (HexString);
|
FreePool (HexString);
|
||||||
@ -519,25 +548,48 @@ CascadeProcessVariables (
|
|||||||
Status = gEfiShellProtocol->GetGuidName (&FoundVarGuid, &GuidName);
|
Status = gEfiShellProtocol->GetGuidName (&FoundVarGuid, &GuidName);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
|
-1,
|
||||||
AttrString, &FoundVarGuid, FoundVarName, DataSize
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DMPSTORE_HEADER_LINE),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
AttrString,
|
||||||
|
&FoundVarGuid,
|
||||||
|
FoundVarName,
|
||||||
|
DataSize
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE2), gShellDebug1HiiHandle,
|
-1,
|
||||||
AttrString, GuidName, FoundVarName, DataSize
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DMPSTORE_HEADER_LINE2),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
AttrString,
|
||||||
|
GuidName,
|
||||||
|
FoundVarName,
|
||||||
|
DataSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
DumpHex (2, 0, DataSize, DataBuffer);
|
DumpHex (2, 0, DataSize, DataBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (AttrString);
|
SHELL_FREE_NON_NULL (AttrString);
|
||||||
}
|
}
|
||||||
} else if (Type == DmpStoreSave) {
|
} else if (Type == DmpStoreSave) {
|
||||||
if (!EFI_ERROR (Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
|
if (!EFI_ERROR (Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
|
||||||
AttrString = GetAttrType (Atts);
|
AttrString = GetAttrType (Atts);
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
|
-1,
|
||||||
AttrString, &FoundVarGuid, FoundVarName, DataSize
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DMPSTORE_HEADER_LINE),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
AttrString,
|
||||||
|
&FoundVarGuid,
|
||||||
|
FoundVarName,
|
||||||
|
DataSize
|
||||||
);
|
);
|
||||||
Status = AppendSingleVariableToFile (
|
Status = AppendSingleVariableToFile (
|
||||||
FileHandle,
|
FileHandle,
|
||||||
@ -557,17 +609,29 @@ CascadeProcessVariables (
|
|||||||
if (StandardFormatOutput) {
|
if (StandardFormatOutput) {
|
||||||
if (SetStatus == EFI_SUCCESS) {
|
if (SetStatus == EFI_SUCCESS) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_NG_SFO), gShellDebug1HiiHandle,
|
-1,
|
||||||
FoundVarName, &FoundVarGuid
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_NG_SFO),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
FoundVarName,
|
||||||
|
&FoundVarGuid
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_DELETE_LINE), gShellDebug1HiiHandle,
|
-1,
|
||||||
&FoundVarGuid, FoundVarName, SetStatus
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_DMPSTORE_DELETE_LINE),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
&FoundVarGuid,
|
||||||
|
FoundVarName,
|
||||||
|
SetStatus
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (DataBuffer);
|
SHELL_FREE_NON_NULL (DataBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,29 +694,31 @@ ProcessVariables (
|
|||||||
if (ShellStatus == SHELL_OUT_OF_RESOURCES) {
|
if (ShellStatus == SHELL_OUT_OF_RESOURCES) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"dmpstore");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"dmpstore");
|
||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
} else if (Name != NULL && Guid == NULL) {
|
} else if ((Name != NULL) && (Guid == NULL)) {
|
||||||
if (StandardFormatOutput) {
|
if (StandardFormatOutput) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N_SFO), gShellDebug1HiiHandle, Name);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N_SFO), gShellDebug1HiiHandle, Name);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N), gShellDebug1HiiHandle, L"dmpstore", Name);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N), gShellDebug1HiiHandle, L"dmpstore", Name);
|
||||||
}
|
}
|
||||||
} else if (Name != NULL && Guid != NULL) {
|
} else if ((Name != NULL) && (Guid != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_GN), gShellDebug1HiiHandle, L"dmpstore", Guid, Name);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_GN), gShellDebug1HiiHandle, L"dmpstore", Guid, Name);
|
||||||
} else if (Name == NULL && Guid == NULL) {
|
} else if ((Name == NULL) && (Guid == NULL)) {
|
||||||
if (StandardFormatOutput) {
|
if (StandardFormatOutput) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_SFO), gShellDebug1HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_SFO), gShellDebug1HiiHandle);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND), gShellDebug1HiiHandle, L"dmpstore");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND), gShellDebug1HiiHandle, L"dmpstore");
|
||||||
}
|
}
|
||||||
} else if (Name == NULL && Guid != NULL) {
|
} else if ((Name == NULL) && (Guid != NULL)) {
|
||||||
if (StandardFormatOutput) {
|
if (StandardFormatOutput) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G_SFO), gShellDebug1HiiHandle, Guid);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G_SFO), gShellDebug1HiiHandle, Guid);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G), gShellDebug1HiiHandle, L"dmpstore", Guid);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G), gShellDebug1HiiHandle, L"dmpstore", Guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (SHELL_NOT_FOUND);
|
return (SHELL_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +769,7 @@ ShellCommandRunDmpStore (
|
|||||||
|
|
||||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmpstore", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmpstore", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -738,6 +804,7 @@ ShellCommandRunDmpStore (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmpstore", GuidStr);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmpstore", GuidStr);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Guid = &GuidData;
|
Guid = &GuidData;
|
||||||
} else {
|
} else {
|
||||||
Guid = &gEfiGlobalVariableGuid;
|
Guid = &gEfiGlobalVariableGuid;
|
||||||
@ -778,6 +845,7 @@ ShellCommandRunDmpStore (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_DELETE_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_DELETE_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (FileInfo);
|
FreePool (FileInfo);
|
||||||
}
|
}
|
||||||
} else if (Status == EFI_NOT_FOUND) {
|
} else if (Status == EFI_NOT_FOUND) {
|
||||||
@ -824,6 +892,7 @@ ShellCommandRunDmpStore (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, L"dmpstore", File);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, L"dmpstore", File);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (FileInfo);
|
FreePool (FileInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -843,6 +912,7 @@ ShellCommandRunDmpStore (
|
|||||||
} else if (Type == DmpStoreLoad) {
|
} else if (Type == DmpStoreLoad) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD), gShellDebug1HiiHandle, File);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD), gShellDebug1HiiHandle, File);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellStatus = ProcessVariables (Name, Guid, Type, FileHandle, StandardFormatOutput);
|
ShellStatus = ProcessVariables (Name, Guid, Type, FileHandle, StandardFormatOutput);
|
||||||
if ((Type == DmpStoreLoad) || (Type == DmpStoreSave)) {
|
if ((Type == DmpStoreLoad) || (Type == DmpStoreSave)) {
|
||||||
ShellCloseFile (&FileHandle);
|
ShellCloseFile (&FileHandle);
|
||||||
@ -854,6 +924,6 @@ ShellCommandRunDmpStore (
|
|||||||
if (Package != NULL) {
|
if (Package != NULL) {
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShellStatus;
|
return ShellStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ ShellCommandRunEdit (
|
|||||||
CHAR16 *Nfs;
|
CHAR16 *Nfs;
|
||||||
CHAR16 *Spot;
|
CHAR16 *Spot;
|
||||||
CONST CHAR16 *TempParam;
|
CONST CHAR16 *TempParam;
|
||||||
|
|
||||||
// SHELL_FILE_HANDLE TempHandle;
|
// SHELL_FILE_HANDLE TempHandle;
|
||||||
|
|
||||||
Buffer = NULL;
|
Buffer = NULL;
|
||||||
@ -52,7 +53,7 @@ ShellCommandRunEdit (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -74,10 +75,12 @@ ShellCommandRunEdit (
|
|||||||
if (Spot != NULL) {
|
if (Spot != NULL) {
|
||||||
*Spot = CHAR_NULL;
|
*Spot = CHAR_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spot = StrStr (Nfs, L"\\");
|
Spot = StrStr (Nfs, L"\\");
|
||||||
if (Spot != NULL) {
|
if (Spot != NULL) {
|
||||||
Spot[1] = CHAR_NULL;
|
Spot[1] = CHAR_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gEfiShellProtocol->SetCurDir (NULL, Nfs);
|
gEfiShellProtocol->SetCurDir (NULL, Nfs);
|
||||||
FreePool (Nfs);
|
FreePool (Nfs);
|
||||||
}
|
}
|
||||||
@ -150,7 +153,9 @@ ShellCommandRunEdit (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShellStatus;
|
return ShellStatus;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ InternalEditorMiscLineAdvance (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
CONST EFI_EDITOR_LINE *Line;
|
CONST EFI_EDITOR_LINE *Line;
|
||||||
|
|
||||||
if (CurrentLine == NULL || LineList == NULL) {
|
if ((CurrentLine == NULL) || (LineList == NULL)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ InternalEditorMiscLineRetreat (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
CONST EFI_EDITOR_LINE *Line;
|
CONST EFI_EDITOR_LINE *Line;
|
||||||
|
|
||||||
if (CurrentLine == NULL || LineList == NULL) {
|
if ((CurrentLine == NULL) || (LineList == NULL)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,20 +271,20 @@ FileBufferRestoreMousePosition (
|
|||||||
Line = NULL;
|
Line = NULL;
|
||||||
|
|
||||||
if (MainEditor.MouseSupported) {
|
if (MainEditor.MouseSupported) {
|
||||||
|
|
||||||
if (FileBufferMouseNeedRefresh) {
|
if (FileBufferMouseNeedRefresh) {
|
||||||
|
|
||||||
FileBufferMouseNeedRefresh = FALSE;
|
FileBufferMouseNeedRefresh = FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// if mouse position not moved and only mouse action
|
// if mouse position not moved and only mouse action
|
||||||
// so do not need to refresh mouse position
|
// so do not need to refresh mouse position
|
||||||
//
|
//
|
||||||
if ((FileBuffer.MousePosition.Row == FileBufferBackupVar.MousePosition.Row &&
|
if ( ((FileBuffer.MousePosition.Row == FileBufferBackupVar.MousePosition.Row) &&
|
||||||
FileBuffer.MousePosition.Column == FileBufferBackupVar.MousePosition.Column)
|
(FileBuffer.MousePosition.Column == FileBufferBackupVar.MousePosition.Column))
|
||||||
&& EditorMouseAction) {
|
&& EditorMouseAction)
|
||||||
|
{
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// backup the old screen attributes
|
// backup the old screen attributes
|
||||||
//
|
//
|
||||||
@ -307,7 +307,7 @@ FileBufferRestoreMousePosition (
|
|||||||
CurrentLine = FileBuffer.CurrentLine;
|
CurrentLine = FileBuffer.CurrentLine;
|
||||||
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);
|
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);
|
||||||
|
|
||||||
if (Line == NULL || FColumn > Line->Size) {
|
if ((Line == NULL) || (FColumn > Line->Size)) {
|
||||||
HasCharacter = FALSE;
|
HasCharacter = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,6 +329,7 @@ FileBufferRestoreMousePosition (
|
|||||||
Value
|
Value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// set the new mouse position
|
// set the new mouse position
|
||||||
//
|
//
|
||||||
@ -347,7 +348,7 @@ FileBufferRestoreMousePosition (
|
|||||||
CurrentLine = FileBuffer.CurrentLine;
|
CurrentLine = FileBuffer.CurrentLine;
|
||||||
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);
|
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);
|
||||||
|
|
||||||
if (Line == NULL || FColumn > Line->Size) {
|
if ((Line == NULL) || (FColumn > Line->Size)) {
|
||||||
HasCharacter = FALSE;
|
HasCharacter = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,15 +370,18 @@ FileBufferRestoreMousePosition (
|
|||||||
Value
|
Value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of HasCharacter
|
// end of HasCharacter
|
||||||
//
|
//
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of MouseNeedRefresh
|
// end of MouseNeedRefresh
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of MouseSupported
|
// end of MouseSupported
|
||||||
//
|
//
|
||||||
@ -406,7 +410,6 @@ FileBufferFreeLines (
|
|||||||
// free all the lines
|
// free all the lines
|
||||||
//
|
//
|
||||||
if (FileBuffer.Lines != NULL) {
|
if (FileBuffer.Lines != NULL) {
|
||||||
|
|
||||||
Line = FileBuffer.Lines;
|
Line = FileBuffer.Lines;
|
||||||
Link = &(Line->Link);
|
Link = &(Line->Link);
|
||||||
do {
|
do {
|
||||||
@ -419,6 +422,7 @@ FileBufferFreeLines (
|
|||||||
LineFree (Line);
|
LineFree (Line);
|
||||||
} while (Link != FileBuffer.ListHead);
|
} while (Link != FileBuffer.ListHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// clean the line list related structure
|
// clean the line list related structure
|
||||||
//
|
//
|
||||||
@ -456,7 +460,6 @@ FileBufferCleanup (
|
|||||||
|
|
||||||
SHELL_FREE_NON_NULL (FileBufferBackupVar.FileName);
|
SHELL_FREE_NON_NULL (FileBufferBackupVar.FileName);
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -473,7 +476,6 @@ FileBufferPrintLine (
|
|||||||
IN CONST UINTN Row
|
IN CONST UINTN Row
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
CHAR16 *Buffer;
|
CHAR16 *Buffer;
|
||||||
UINTN Limit;
|
UINTN Limit;
|
||||||
CHAR16 *PrintLine;
|
CHAR16 *PrintLine;
|
||||||
@ -512,6 +514,7 @@ FileBufferPrintLine (
|
|||||||
);
|
);
|
||||||
FreePool (PrintLine2);
|
FreePool (PrintLine2);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (PrintLine);
|
FreePool (PrintLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,10 +566,10 @@ FileBufferRefresh (
|
|||||||
//
|
//
|
||||||
if (!FileBufferNeedRefresh &&
|
if (!FileBufferNeedRefresh &&
|
||||||
!FileBufferOnlyLineNeedRefresh &&
|
!FileBufferOnlyLineNeedRefresh &&
|
||||||
FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row &&
|
(FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row) &&
|
||||||
FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column
|
(FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
FileBufferRestoreMousePosition ();
|
FileBufferRestoreMousePosition ();
|
||||||
FileBufferRestorePosition ();
|
FileBufferRestorePosition ();
|
||||||
|
|
||||||
@ -580,10 +583,10 @@ FileBufferRefresh (
|
|||||||
// only need to refresh current line
|
// only need to refresh current line
|
||||||
//
|
//
|
||||||
if (FileBufferOnlyLineNeedRefresh &&
|
if (FileBufferOnlyLineNeedRefresh &&
|
||||||
FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row &&
|
(FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row) &&
|
||||||
FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column
|
(FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
EditorClearLine (FileBuffer.DisplayPosition.Row, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row);
|
EditorClearLine (FileBuffer.DisplayPosition.Row, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row);
|
||||||
FileBufferPrintLine (
|
FileBufferPrintLine (
|
||||||
FileBuffer.CurrentLine,
|
FileBuffer.CurrentLine,
|
||||||
@ -604,6 +607,7 @@ FileBufferRefresh (
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get the first line that will be displayed
|
// get the first line that will be displayed
|
||||||
//
|
//
|
||||||
@ -627,6 +631,7 @@ FileBufferRefresh (
|
|||||||
Link = Link->ForwardLink;
|
Link = Link->ForwardLink;
|
||||||
Row++;
|
Row++;
|
||||||
} while (Link != FileBuffer.ListHead && Row <= (MainEditor.ScreenSize.Row - 1));
|
} while (Link != FileBuffer.ListHead && Row <= (MainEditor.ScreenSize.Row - 1));
|
||||||
|
|
||||||
//
|
//
|
||||||
// while not file end and not screen full
|
// while not file end and not screen full
|
||||||
//
|
//
|
||||||
@ -669,6 +674,7 @@ FileBufferCreateLine (
|
|||||||
if (Line == NULL) {
|
if (Line == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize the structure
|
// initialize the structure
|
||||||
//
|
//
|
||||||
@ -720,6 +726,7 @@ FileBufferSetFileName (
|
|||||||
if (!IsValidFileName (Str)) {
|
if (!IsValidFileName (Str)) {
|
||||||
return (EFI_INVALID_PARAMETER);
|
return (EFI_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// free the old file name
|
// free the old file name
|
||||||
//
|
//
|
||||||
@ -735,6 +742,7 @@ FileBufferSetFileName (
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free the existing file lines and reset the modified flag.
|
Free the existing file lines and reset the modified flag.
|
||||||
|
|
||||||
@ -754,7 +762,6 @@ FileBufferFree (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read a file from disk into the FileBuffer.
|
Read a file from disk into the FileBuffer.
|
||||||
|
|
||||||
@ -829,6 +836,7 @@ FileBufferRead (
|
|||||||
} else {
|
} else {
|
||||||
FileBuffer.ReadOnly = FALSE;
|
FileBuffer.ReadOnly = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get file size
|
// get file size
|
||||||
//
|
//
|
||||||
@ -841,13 +849,14 @@ FileBufferRead (
|
|||||||
//
|
//
|
||||||
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_WRITE_PROTECTED ||
|
if ((Status == EFI_WRITE_PROTECTED) ||
|
||||||
Status == EFI_ACCESS_DENIED ||
|
(Status == EFI_ACCESS_DENIED) ||
|
||||||
Status == EFI_NO_MEDIA ||
|
(Status == EFI_NO_MEDIA) ||
|
||||||
Status == EFI_MEDIA_CHANGED
|
(Status == EFI_MEDIA_CHANGED)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
StatusBarSetStatusString (L"Access Denied");
|
StatusBarSetStatusString (L"Access Denied");
|
||||||
} else if (Status == EFI_DEVICE_ERROR || Status == EFI_VOLUME_CORRUPTED || Status == EFI_VOLUME_FULL) {
|
} else if ((Status == EFI_DEVICE_ERROR) || (Status == EFI_VOLUME_CORRUPTED) || (Status == EFI_VOLUME_FULL)) {
|
||||||
StatusBarSetStatusString (L"Disk Error");
|
StatusBarSetStatusString (L"Disk Error");
|
||||||
} else {
|
} else {
|
||||||
StatusBarSetStatusString (L"Invalid File Name or Current-working-directory");
|
StatusBarSetStatusString (L"Invalid File Name or Current-working-directory");
|
||||||
@ -862,12 +871,14 @@ FileBufferRead (
|
|||||||
if (Status == EFI_WARN_DELETE_FAILURE) {
|
if (Status == EFI_WARN_DELETE_FAILURE) {
|
||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileHandle = NULL;
|
FileHandle = NULL;
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
StatusBarSetStatusString (L"Access Denied");
|
StatusBarSetStatusString (L"Access Denied");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// file doesn't exist, so set CreateFile to TRUE
|
// file doesn't exist, so set CreateFile to TRUE
|
||||||
//
|
//
|
||||||
@ -881,12 +892,13 @@ FileBufferRead (
|
|||||||
if (StrCmp (FileName, FileBuffer.FileName) != 0) {
|
if (StrCmp (FileName, FileBuffer.FileName) != 0) {
|
||||||
FileBufferSetFileName (FileName);
|
FileBufferSetFileName (FileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// free the old lines
|
// free the old lines
|
||||||
//
|
//
|
||||||
FileBufferFree ();
|
FileBufferFree ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the file exists
|
// the file exists
|
||||||
//
|
//
|
||||||
@ -898,6 +910,7 @@ FileBufferRead (
|
|||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// read file into Buffer
|
// read file into Buffer
|
||||||
//
|
//
|
||||||
@ -909,6 +922,7 @@ FileBufferRead (
|
|||||||
SHELL_FREE_NON_NULL (Buffer);
|
SHELL_FREE_NON_NULL (Buffer);
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// nothing in this file
|
// nothing in this file
|
||||||
//
|
//
|
||||||
@ -956,10 +970,12 @@ FileBufferRead (
|
|||||||
} else {
|
} else {
|
||||||
FileBuffer.FileType = FileTypeAscii;
|
FileBuffer.FileType = FileTypeAscii;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of AsciiBuffer ==
|
// end of AsciiBuffer ==
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of FileSize < 2
|
// end of FileSize < 2
|
||||||
// all the check ends
|
// all the check ends
|
||||||
@ -1038,10 +1054,12 @@ FileBufferRead (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// endif == ASCII
|
// endif == ASCII
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of for LineSize
|
// end of for LineSize
|
||||||
//
|
//
|
||||||
@ -1064,6 +1082,7 @@ FileBufferRead (
|
|||||||
SHELL_FREE_NON_NULL (Buffer);
|
SHELL_FREE_NON_NULL (Buffer);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// calculate file length
|
// calculate file length
|
||||||
//
|
//
|
||||||
@ -1079,6 +1098,7 @@ FileBufferRead (
|
|||||||
RemoveEntryList (&Line->Link);
|
RemoveEntryList (&Line->Link);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// copy this line to Line->Buffer
|
// copy this line to Line->Buffer
|
||||||
//
|
//
|
||||||
@ -1091,6 +1111,7 @@ FileBufferRead (
|
|||||||
|
|
||||||
LoopVar1++;
|
LoopVar1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// LoopVar1 now points to where CHAR_CARRIAGE_RETURN or CHAR_LINEFEED;
|
// LoopVar1 now points to where CHAR_CARRIAGE_RETURN or CHAR_LINEFEED;
|
||||||
//
|
//
|
||||||
@ -1100,32 +1121,35 @@ FileBufferRead (
|
|||||||
Line->TotalSize = LineSize;
|
Line->TotalSize = LineSize;
|
||||||
Line->Type = Type;
|
Line->Type = Type;
|
||||||
|
|
||||||
if (Type == NewLineTypeCarriageReturnLineFeed || Type == NewLineTypeLineFeedCarriageReturn) {
|
if ((Type == NewLineTypeCarriageReturnLineFeed) || (Type == NewLineTypeLineFeedCarriageReturn)) {
|
||||||
LoopVar1++;
|
LoopVar1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// last character is a return, SO create a new line
|
// last character is a return, SO create a new line
|
||||||
//
|
//
|
||||||
if (((Type == NewLineTypeCarriageReturnLineFeed || Type == NewLineTypeLineFeedCarriageReturn) && LineSizeBackup == FileSize - 2) ||
|
if ((((Type == NewLineTypeCarriageReturnLineFeed) || (Type == NewLineTypeLineFeedCarriageReturn)) && (LineSizeBackup == FileSize - 2)) ||
|
||||||
((Type == NewLineTypeLineFeed || Type == NewLineTypeCarriageReturn) && LineSizeBackup == FileSize - 1)
|
(((Type == NewLineTypeLineFeed) || (Type == NewLineTypeCarriageReturn)) && (LineSizeBackup == FileSize - 1))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Line = FileBufferCreateLine ();
|
Line = FileBufferCreateLine ();
|
||||||
if (Line == NULL) {
|
if (Line == NULL) {
|
||||||
SHELL_FREE_NON_NULL (Buffer);
|
SHELL_FREE_NON_NULL (Buffer);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of if
|
// end of if
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of LoopVar1
|
// end of LoopVar1
|
||||||
//
|
//
|
||||||
SHELL_FREE_NON_NULL (Buffer);
|
SHELL_FREE_NON_NULL (Buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of if CreateFile
|
// end of if CreateFile
|
||||||
//
|
//
|
||||||
@ -1149,6 +1173,7 @@ Done:
|
|||||||
StatusBarSetStatusString (UnicodeBuffer);
|
StatusBarSetStatusString (UnicodeBuffer);
|
||||||
FreePool (UnicodeBuffer);
|
FreePool (UnicodeBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//
|
//
|
||||||
// check whether we have fs?: in filename
|
// check whether we have fs?: in filename
|
||||||
@ -1248,7 +1273,6 @@ Done:
|
|||||||
FileBufferOnlyLineNeedRefresh = FALSE;
|
FileBufferOnlyLineNeedRefresh = FALSE;
|
||||||
FileBufferMouseNeedRefresh = TRUE;
|
FileBufferMouseNeedRefresh = TRUE;
|
||||||
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1278,10 +1302,11 @@ GetNewLine (
|
|||||||
//
|
//
|
||||||
// not legal new line type
|
// not legal new line type
|
||||||
//
|
//
|
||||||
if (Type != NewLineTypeLineFeed && Type != NewLineTypeCarriageReturn && Type != NewLineTypeCarriageReturnLineFeed && Type != NewLineTypeLineFeedCarriageReturn) {
|
if ((Type != NewLineTypeLineFeed) && (Type != NewLineTypeCarriageReturn) && (Type != NewLineTypeCarriageReturnLineFeed) && (Type != NewLineTypeLineFeedCarriageReturn)) {
|
||||||
*Size = 0;
|
*Size = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// use_cr: give 0x0d
|
// use_cr: give 0x0d
|
||||||
//
|
//
|
||||||
@ -1298,6 +1323,7 @@ GetNewLine (
|
|||||||
*Size = NewLineSize;
|
*Size = NewLineSize;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// use_lf: give 0x0a
|
// use_lf: give 0x0a
|
||||||
//
|
//
|
||||||
@ -1314,6 +1340,7 @@ GetNewLine (
|
|||||||
*Size = NewLineSize;
|
*Size = NewLineSize;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// use_crlf: give 0x0d 0x0a
|
// use_crlf: give 0x0d 0x0a
|
||||||
//
|
//
|
||||||
@ -1334,6 +1361,7 @@ GetNewLine (
|
|||||||
*Size = NewLineSize;
|
*Size = NewLineSize;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// use_lfcr: give 0x0a 0x0d
|
// use_lfcr: give 0x0a 0x0d
|
||||||
//
|
//
|
||||||
@ -1354,7 +1382,6 @@ GetNewLine (
|
|||||||
*Size = NewLineSize;
|
*Size = NewLineSize;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1433,12 +1460,10 @@ FileBufferSave (
|
|||||||
|
|
||||||
Attribute = 0;
|
Attribute = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// if is the old file
|
// if is the old file
|
||||||
//
|
//
|
||||||
if (FileBuffer.FileName != NULL && StrCmp (FileName, FileBuffer.FileName) == 0) {
|
if ((FileBuffer.FileName != NULL) && (StrCmp (FileName, FileBuffer.FileName) == 0)) {
|
||||||
//
|
//
|
||||||
// file has not been modified
|
// file has not been modified
|
||||||
//
|
//
|
||||||
@ -1460,7 +1485,7 @@ FileBufferSave (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Info = ShellGetFileInfo (FileHandle);
|
Info = ShellGetFileInfo (FileHandle);
|
||||||
|
|
||||||
if (Info != NULL && Info->Attribute & EFI_FILE_DIRECTORY) {
|
if ((Info != NULL) && Info->Attribute & EFI_FILE_DIRECTORY) {
|
||||||
StatusBarSetStatusString (L"Directory Can Not Be Saved");
|
StatusBarSetStatusString (L"Directory Can Not Be Saved");
|
||||||
ShellCloseFile (&FileHandle);
|
ShellCloseFile (&FileHandle);
|
||||||
FreePool (Info);
|
FreePool (Info);
|
||||||
@ -1476,7 +1501,7 @@ FileBufferSave (
|
|||||||
// if file exits, so delete it
|
// if file exits, so delete it
|
||||||
//
|
//
|
||||||
Status = ShellDeleteFile (&FileHandle);
|
Status = ShellDeleteFile (&FileHandle);
|
||||||
if (EFI_ERROR (Status) || Status == EFI_WARN_DELETE_FAILURE) {
|
if (EFI_ERROR (Status) || (Status == EFI_WARN_DELETE_FAILURE)) {
|
||||||
StatusBarSetStatusString (L"Write File Failed");
|
StatusBarSetStatusString (L"Write File Failed");
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
@ -1522,16 +1547,18 @@ FileBufferSave (
|
|||||||
if (Line->Type != NewLineTypeDefault) {
|
if (Line->Type != NewLineTypeDefault) {
|
||||||
Type = Line->Type;
|
Type = Line->Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// newline character is at most 4 bytes ( two Unicode characters )
|
// newline character is at most 4 bytes ( two Unicode characters )
|
||||||
//
|
//
|
||||||
Length = 4;
|
Length = 4;
|
||||||
if (Line->Buffer != NULL && Line->Size != 0) {
|
if ((Line->Buffer != NULL) && (Line->Size != 0)) {
|
||||||
if (FileBuffer.FileType == FileTypeAscii) {
|
if (FileBuffer.FileType == FileTypeAscii) {
|
||||||
Length += Line->Size;
|
Length += Line->Size;
|
||||||
} else {
|
} else {
|
||||||
Length += (Line->Size * 2);
|
Length += (Line->Size * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end if FileTypeAscii
|
// end if FileTypeAscii
|
||||||
//
|
//
|
||||||
@ -1548,11 +1575,12 @@ FileBufferSave (
|
|||||||
FreePool (Cache);
|
FreePool (Cache);
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr = Cache;
|
Ptr = Cache;
|
||||||
LeftSize = TotalSize;
|
LeftSize = TotalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Line->Buffer != NULL && Line->Size != 0) {
|
if ((Line->Buffer != NULL) && (Line->Size != 0)) {
|
||||||
if (FileBuffer.FileType == FileTypeAscii) {
|
if (FileBuffer.FileType == FileTypeAscii) {
|
||||||
UnicodeToAscii (Line->Buffer, Line->Size, Ptr);
|
UnicodeToAscii (Line->Buffer, Line->Size, Ptr);
|
||||||
Length = Line->Size;
|
Length = Line->Size;
|
||||||
@ -1560,13 +1588,14 @@ FileBufferSave (
|
|||||||
Length = (Line->Size * 2);
|
Length = (Line->Size * 2);
|
||||||
CopyMem (Ptr, (CHAR8 *)Line->Buffer, Length);
|
CopyMem (Ptr, (CHAR8 *)Line->Buffer, Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end if FileTypeAscii
|
// end if FileTypeAscii
|
||||||
//
|
//
|
||||||
Ptr += Length;
|
Ptr += Length;
|
||||||
LeftSize -= Length;
|
LeftSize -= Length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of if Line -> Buffer != NULL && Line -> Size != 0
|
// end of if Line -> Buffer != NULL && Line -> Size != 0
|
||||||
//
|
//
|
||||||
@ -1613,7 +1642,7 @@ FileBufferSave (
|
|||||||
//
|
//
|
||||||
// now everything is ready , you can set the new file name to filebuffer
|
// now everything is ready , you can set the new file name to filebuffer
|
||||||
//
|
//
|
||||||
if (FileName != NULL && FileBuffer.FileName != NULL && StrCmp (FileName, FileBuffer.FileName) != 0) {
|
if ((FileName != NULL) && (FileBuffer.FileName != NULL) && (StrCmp (FileName, FileBuffer.FileName) != 0)) {
|
||||||
//
|
//
|
||||||
// not the same
|
// not the same
|
||||||
//
|
//
|
||||||
@ -1781,6 +1810,7 @@ FileBufferDoBackspace (
|
|||||||
if (Line->Buffer == NULL) {
|
if (Line->Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// remove End from line list
|
// remove End from line list
|
||||||
//
|
//
|
||||||
@ -1791,7 +1821,6 @@ FileBufferDoBackspace (
|
|||||||
|
|
||||||
FileBufferNeedRefresh = TRUE;
|
FileBufferNeedRefresh = TRUE;
|
||||||
FileBufferOnlyLineNeedRefresh = FALSE;
|
FileBufferOnlyLineNeedRefresh = FALSE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// just delete the previous character
|
// just delete the previous character
|
||||||
@ -1873,6 +1902,7 @@ FileBufferDoReturn (
|
|||||||
Line->Buffer[FileColumn - 1] = CHAR_NULL;
|
Line->Buffer[FileColumn - 1] = CHAR_NULL;
|
||||||
Line->Size = FileColumn - 1;
|
Line->Size = FileColumn - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// increase NumLines
|
// increase NumLines
|
||||||
//
|
//
|
||||||
@ -1933,6 +1963,7 @@ FileBufferDoDelete (
|
|||||||
if (Line->Link.ForwardLink == FileBuffer.ListHead) {
|
if (Line->Link.ForwardLink == FileBuffer.ListHead) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// since last character,
|
// since last character,
|
||||||
// so will add the next line to this line
|
// so will add the next line to this line
|
||||||
@ -1951,7 +1982,6 @@ FileBufferDoDelete (
|
|||||||
|
|
||||||
FileBufferNeedRefresh = TRUE;
|
FileBufferNeedRefresh = TRUE;
|
||||||
FileBufferOnlyLineNeedRefresh = FALSE;
|
FileBufferOnlyLineNeedRefresh = FALSE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// just delete current character
|
// just delete current character
|
||||||
@ -2052,6 +2082,7 @@ LineStrInsert (
|
|||||||
|
|
||||||
Line->TotalSize += 8;
|
Line->TotalSize += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// move the later part of the string one character right
|
// move the later part of the string one character right
|
||||||
//
|
//
|
||||||
@ -2059,6 +2090,7 @@ LineStrInsert (
|
|||||||
for (Index = StrSize; Index > Pos; Index--) {
|
for (Index = StrSize; Index > Pos; Index--) {
|
||||||
TempStringPtr[Index] = TempStringPtr[Index - 1];
|
TempStringPtr[Index] = TempStringPtr[Index - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// insert char into it.
|
// insert char into it.
|
||||||
//
|
//
|
||||||
@ -2098,11 +2130,12 @@ FileBufferAddChar (
|
|||||||
// or replace the character.
|
// or replace the character.
|
||||||
//
|
//
|
||||||
FilePos = FileBuffer.FilePosition.Column - 1;
|
FilePos = FileBuffer.FilePosition.Column - 1;
|
||||||
if (FileBuffer.ModeInsert || FilePos + 1 > Line->Size) {
|
if (FileBuffer.ModeInsert || (FilePos + 1 > Line->Size)) {
|
||||||
LineStrInsert (Line, Char, FilePos, Line->Size + 1);
|
LineStrInsert (Line, Char, FilePos, Line->Size + 1);
|
||||||
} else {
|
} else {
|
||||||
Line->Buffer[FilePos] = Char;
|
Line->Buffer[FilePos] = Char;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// move cursor to right
|
// move cursor to right
|
||||||
//
|
//
|
||||||
@ -2156,14 +2189,13 @@ FileBufferDoCharInput (
|
|||||||
//
|
//
|
||||||
// DEAL WITH ASCII CHAR, filter out thing like ctrl+f
|
// DEAL WITH ASCII CHAR, filter out thing like ctrl+f
|
||||||
//
|
//
|
||||||
if (Char > 127 || Char < 32) {
|
if ((Char > 127) || (Char < 32)) {
|
||||||
Status = StatusBarSetStatusString (L"Unknown Command");
|
Status = StatusBarSetStatusString (L"Unknown Command");
|
||||||
} else {
|
} else {
|
||||||
Status = FileBufferAddChar (Char);
|
Status = FileBufferAddChar (Char);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
@ -2204,7 +2236,6 @@ FileBufferScrollDown (
|
|||||||
if (FCol > Line->Size) {
|
if (FCol > Line->Size) {
|
||||||
FCol = Line->Size + 1;
|
FCol = Line->Size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -2246,7 +2277,6 @@ FileBufferScrollUp (
|
|||||||
if (FCol > Line->Size) {
|
if (FCol > Line->Size) {
|
||||||
FCol = Line->Size + 1;
|
FCol = Line->Size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -2287,6 +2317,7 @@ FileBufferPageDown (
|
|||||||
//
|
//
|
||||||
Gap = FileBuffer.NumLines - FRow;
|
Gap = FileBuffer.NumLines - FRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get correct line
|
// get correct line
|
||||||
//
|
//
|
||||||
@ -2295,7 +2326,7 @@ FileBufferPageDown (
|
|||||||
//
|
//
|
||||||
// if that line, is not that long, so move to the end of that line
|
// if that line, is not that long, so move to the end of that line
|
||||||
//
|
//
|
||||||
if (Line != NULL && FCol > Line->Size) {
|
if ((Line != NULL) && (FCol > Line->Size)) {
|
||||||
FCol = Line->Size + 1;
|
FCol = Line->Size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2350,7 +2381,7 @@ FileBufferPageUp (
|
|||||||
//
|
//
|
||||||
// if that line is not that long, so move to the end of that line
|
// if that line is not that long, so move to the end of that line
|
||||||
//
|
//
|
||||||
if (Line != NULL && FCol > Line->Size) {
|
if ((Line != NULL) && (FCol > Line->Size)) {
|
||||||
FCol = Line->Size + 1;
|
FCol = Line->Size + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2744,7 +2775,6 @@ FileBufferMovePosition (
|
|||||||
// let CurrentLine point to correct line;
|
// let CurrentLine point to correct line;
|
||||||
//
|
//
|
||||||
FileBuffer.CurrentLine = MoveCurrentLine (RowGap);
|
FileBuffer.CurrentLine = MoveCurrentLine (RowGap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2779,17 +2809,19 @@ FileBufferCutLine (
|
|||||||
//
|
//
|
||||||
// if is the last dummy line, SO CAN not cut
|
// if is the last dummy line, SO CAN not cut
|
||||||
//
|
//
|
||||||
if (StrCmp (Line->Buffer, L"\0") == 0 && Line->Link.ForwardLink == FileBuffer.ListHead
|
if ((StrCmp (Line->Buffer, L"\0") == 0) && (Line->Link.ForwardLink == FileBuffer.ListHead)
|
||||||
//
|
//
|
||||||
// last line
|
// last line
|
||||||
//
|
//
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// LAST LINE AND NOTHING ON THIS LINE, SO CUT NOTHING
|
// LAST LINE AND NOTHING ON THIS LINE, SO CUT NOTHING
|
||||||
//
|
//
|
||||||
StatusBarSetStatusString (L"Nothing to Cut");
|
StatusBarSetStatusString (L"Nothing to Cut");
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if is the last line, so create a dummy line
|
// if is the last line, so create a dummy line
|
||||||
//
|
//
|
||||||
@ -2855,6 +2887,7 @@ FileBufferPasteLine (
|
|||||||
if (MainEditor.CutLine == NULL) {
|
if (MainEditor.CutLine == NULL) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// read only file can not be pasted on
|
// read only file can not be pasted on
|
||||||
//
|
//
|
||||||
@ -2867,6 +2900,7 @@ FileBufferPasteLine (
|
|||||||
if (NewLine == NULL) {
|
if (NewLine == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// insert it above current line
|
// insert it above current line
|
||||||
//
|
//
|
||||||
@ -3051,6 +3085,7 @@ FileBufferReplace (
|
|||||||
if (FileBuffer.CurrentLine->Buffer == NULL) {
|
if (FileBuffer.CurrentLine->Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the end CHAR_NULL character;
|
// the end CHAR_NULL character;
|
||||||
//
|
//
|
||||||
@ -3064,6 +3099,7 @@ FileBufferReplace (
|
|||||||
*Buffer = *(Buffer - Gap);
|
*Buffer = *(Buffer - Gap);
|
||||||
Buffer--;
|
Buffer--;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// set replace into it
|
// set replace into it
|
||||||
//
|
//
|
||||||
@ -3162,29 +3198,30 @@ FileBufferAdjustMousePosition (
|
|||||||
CoordinateY = 0;
|
CoordinateY = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// check whether new mouse column position is beyond screen
|
// check whether new mouse column position is beyond screen
|
||||||
// if not, adjust it
|
// if not, adjust it
|
||||||
//
|
//
|
||||||
if (CoordinateX >= 1 && CoordinateX <= MainEditor.ScreenSize.Column) {
|
if ((CoordinateX >= 1) && (CoordinateX <= MainEditor.ScreenSize.Column)) {
|
||||||
FileBuffer.MousePosition.Column = CoordinateX;
|
FileBuffer.MousePosition.Column = CoordinateX;
|
||||||
} else if (CoordinateX < 1) {
|
} else if (CoordinateX < 1) {
|
||||||
FileBuffer.MousePosition.Column = 1;
|
FileBuffer.MousePosition.Column = 1;
|
||||||
} else if (CoordinateX > MainEditor.ScreenSize.Column) {
|
} else if (CoordinateX > MainEditor.ScreenSize.Column) {
|
||||||
FileBuffer.MousePosition.Column = MainEditor.ScreenSize.Column;
|
FileBuffer.MousePosition.Column = MainEditor.ScreenSize.Column;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// check whether new mouse row position is beyond screen
|
// check whether new mouse row position is beyond screen
|
||||||
// if not, adjust it
|
// if not, adjust it
|
||||||
//
|
//
|
||||||
if (CoordinateY >= 2 && CoordinateY <= (MainEditor.ScreenSize.Row - 1)) {
|
if ((CoordinateY >= 2) && (CoordinateY <= (MainEditor.ScreenSize.Row - 1))) {
|
||||||
FileBuffer.MousePosition.Row = CoordinateY;
|
FileBuffer.MousePosition.Row = CoordinateY;
|
||||||
} else if (CoordinateY < 2) {
|
} else if (CoordinateY < 2) {
|
||||||
FileBuffer.MousePosition.Row = 2;
|
FileBuffer.MousePosition.Row = 2;
|
||||||
} else if (CoordinateY > (MainEditor.ScreenSize.Row - 1)) {
|
} else if (CoordinateY > (MainEditor.ScreenSize.Row - 1)) {
|
||||||
FileBuffer.MousePosition.Row = (MainEditor.ScreenSize.Row - 1);
|
FileBuffer.MousePosition.Row = (MainEditor.ScreenSize.Row - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3255,6 +3292,7 @@ FileBufferReplaceAll (
|
|||||||
if (Line->Buffer == NULL) {
|
if (Line->Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the end CHAR_NULL character;
|
// the end CHAR_NULL character;
|
||||||
//
|
//
|
||||||
@ -3268,7 +3306,6 @@ FileBufferReplaceAll (
|
|||||||
*Buffer = *(Buffer - Gap);
|
*Buffer = *(Buffer - Gap);
|
||||||
Buffer--;
|
Buffer--;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ReplaceLen < SearchLen) {
|
} else if (ReplaceLen < SearchLen) {
|
||||||
Buffer = Line->Buffer + Position + ReplaceLen;
|
Buffer = Line->Buffer + Position + ReplaceLen;
|
||||||
Gap = SearchLen - ReplaceLen;
|
Gap = SearchLen - ReplaceLen;
|
||||||
@ -3280,6 +3317,7 @@ FileBufferReplaceAll (
|
|||||||
} else {
|
} else {
|
||||||
ASSERT (ReplaceLen == SearchLen);
|
ASSERT (ReplaceLen == SearchLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// set replace into it
|
// set replace into it
|
||||||
//
|
//
|
||||||
@ -3298,6 +3336,7 @@ FileBufferReplaceAll (
|
|||||||
Link = Link->ForwardLink;
|
Link = Link->ForwardLink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// call refresh to fresh edit area
|
// call refresh to fresh edit area
|
||||||
//
|
//
|
||||||
@ -3318,4 +3357,3 @@ FileBufferSetModified (
|
|||||||
{
|
{
|
||||||
FileBuffer.FileModified = TRUE;
|
FileBuffer.FileModified = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar;
|
|||||||
|
|
||||||
EFI_EDITOR_GLOBAL_EDITOR MainEditor;
|
EFI_EDITOR_GLOBAL_EDITOR MainEditor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load a file from disk to editor
|
Load a file from disk to editor
|
||||||
|
|
||||||
@ -272,7 +271,6 @@ EDITOR_MENU_ITEM MainMenuItems[] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load a file from disk to editor
|
Load a file from disk to editor
|
||||||
|
|
||||||
@ -317,11 +315,11 @@ MainCommandOpenFile (
|
|||||||
// whether to save it first.
|
// whether to save it first.
|
||||||
//
|
//
|
||||||
if (MainEditor.FileBuffer->FileModified) {
|
if (MainEditor.FileBuffer->FileModified) {
|
||||||
|
|
||||||
Status = InputBarSetPrompt (L"File modified. Save (Yes/No/Cancel) ? ");
|
Status = InputBarSetPrompt (L"File modified. Save (Yes/No/Cancel) ? ");
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the answer is just one character
|
// the answer is just one character
|
||||||
//
|
//
|
||||||
@ -329,6 +327,7 @@ MainCommandOpenFile (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// loop for user's answer
|
// loop for user's answer
|
||||||
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
||||||
@ -375,6 +374,7 @@ MainCommandOpenFile (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TO get the open file name
|
// TO get the open file name
|
||||||
//
|
//
|
||||||
@ -400,6 +400,7 @@ MainCommandOpenFile (
|
|||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The input string length should > 0
|
// The input string length should > 0
|
||||||
//
|
//
|
||||||
@ -416,6 +417,7 @@ MainCommandOpenFile (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// read from disk
|
// read from disk
|
||||||
//
|
//
|
||||||
@ -529,7 +531,6 @@ MainCommandPasteLine (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
search string in file buffer
|
search string in file buffer
|
||||||
|
|
||||||
@ -584,6 +585,7 @@ MainCommandSearch (
|
|||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// just enter pressed
|
// just enter pressed
|
||||||
//
|
//
|
||||||
@ -595,6 +597,7 @@ MainCommandSearch (
|
|||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the first time , search from current position
|
// the first time , search from current position
|
||||||
//
|
//
|
||||||
@ -611,6 +614,7 @@ MainCommandSearch (
|
|||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find next
|
// Find next
|
||||||
//
|
//
|
||||||
@ -649,19 +653,20 @@ MainCommandSearch (
|
|||||||
case L'N':
|
case L'N':
|
||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of which
|
// end of which
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of while !Done
|
// end of while !Done
|
||||||
// for search second, third time, search from current position + strlen
|
// for search second, third time, search from current position + strlen
|
||||||
//
|
//
|
||||||
Offset = StrLen (Buffer);
|
Offset = StrLen (Buffer);
|
||||||
|
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of do
|
// end of do
|
||||||
//
|
//
|
||||||
@ -744,6 +749,7 @@ MainCommandSearchReplace (
|
|||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if just pressed enter
|
// if just pressed enter
|
||||||
//
|
//
|
||||||
@ -815,6 +821,7 @@ MainCommandSearchReplace (
|
|||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// replace or not?
|
// replace or not?
|
||||||
//
|
//
|
||||||
@ -872,12 +879,13 @@ MainCommandSearchReplace (
|
|||||||
FreePool (Search);
|
FreePool (Search);
|
||||||
FreePool (Replace);
|
FreePool (Replace);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of which
|
// end of which
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of while !Done
|
// end of while !Done
|
||||||
// Decide to Replace
|
// Decide to Replace
|
||||||
@ -890,6 +898,7 @@ MainCommandSearchReplace (
|
|||||||
StatusBarSetStatusString (L"Read Only File Can Not Be Modified");
|
StatusBarSetStatusString (L"Read Only File Can Not Be Modified");
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// replace all
|
// replace all
|
||||||
//
|
//
|
||||||
@ -899,6 +908,7 @@ MainCommandSearchReplace (
|
|||||||
FreePool (Replace);
|
FreePool (Replace);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// replace
|
// replace
|
||||||
//
|
//
|
||||||
@ -909,6 +919,7 @@ MainCommandSearchReplace (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find next
|
// Find next
|
||||||
//
|
//
|
||||||
@ -951,18 +962,19 @@ MainCommandSearchReplace (
|
|||||||
FreePool (Search);
|
FreePool (Search);
|
||||||
FreePool (Replace);
|
FreePool (Replace);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of which
|
// end of which
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of while !Done
|
// end of while !Done
|
||||||
//
|
//
|
||||||
First = FALSE;
|
First = FALSE;
|
||||||
|
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of do
|
// end of do
|
||||||
//
|
//
|
||||||
@ -1004,7 +1016,6 @@ MainCommandExit (
|
|||||||
// if file has been modified, so will prompt user whether to save the changes
|
// if file has been modified, so will prompt user whether to save the changes
|
||||||
//
|
//
|
||||||
if (MainEditor.FileBuffer->FileModified) {
|
if (MainEditor.FileBuffer->FileModified) {
|
||||||
|
|
||||||
Status = InputBarSetPrompt (L"File modified. Save (Yes/No/Cancel) ? ");
|
Status = InputBarSetPrompt (L"File modified. Save (Yes/No/Cancel) ? ");
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
@ -1047,14 +1058,12 @@ MainCommandExit (
|
|||||||
case L'c':
|
case L'c':
|
||||||
case L'C':
|
case L'C':
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorExit = TRUE;
|
EditorExit = TRUE;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1086,6 +1095,7 @@ MainCommandGotoLine (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// line number's digit <= 6
|
// line number's digit <= 6
|
||||||
//
|
//
|
||||||
@ -1103,6 +1113,7 @@ MainCommandGotoLine (
|
|||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if JUST press enter
|
// if JUST press enter
|
||||||
//
|
//
|
||||||
@ -1115,10 +1126,11 @@ MainCommandGotoLine (
|
|||||||
//
|
//
|
||||||
// invalid line number
|
// invalid line number
|
||||||
//
|
//
|
||||||
if (Row > MainEditor.FileBuffer->NumLines || Row <= 0) {
|
if ((Row > MainEditor.FileBuffer->NumLines) || (Row <= 0)) {
|
||||||
StatusBarSetStatusString (L"No Such Line");
|
StatusBarSetStatusString (L"No Such Line");
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// move cursor to that line's start
|
// move cursor to that line's start
|
||||||
//
|
//
|
||||||
@ -1206,11 +1218,11 @@ MainCommandSaveFile (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = InputBarSetStringSize (100);
|
Status = InputBarSetStringSize (100);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get new file name
|
// get new file name
|
||||||
//
|
//
|
||||||
@ -1289,6 +1301,7 @@ MainCommandSaveFile (
|
|||||||
FreePool (FileName);
|
FreePool (FileName);
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Info);
|
FreePool (Info);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1376,13 +1389,15 @@ MainCommandDisplayHelp (
|
|||||||
if (EFI_ERROR (Status) || (EventIndex != 0)) {
|
if (EFI_ERROR (Status) || (EventIndex != 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = MainEditor.TextInputEx->ReadKeyStrokeEx (MainEditor.TextInputEx, &KeyData);
|
Status = MainEditor.TextInputEx->ReadKeyStrokeEx (MainEditor.TextInputEx, &KeyData);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
||||||
(KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) {
|
(KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// For consoles that don't support/report shift state,
|
// For consoles that don't support/report shift state,
|
||||||
// CTRL+W is translated to L'W' - L'A' + 1.
|
// CTRL+W is translated to L'W' - L'A' + 1.
|
||||||
@ -1392,7 +1407,8 @@ MainCommandDisplayHelp (
|
|||||||
}
|
}
|
||||||
} else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
} else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
||||||
((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) &&
|
((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) &&
|
||||||
((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0)) {
|
((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// For consoles that supports/reports shift state,
|
// For consoles that supports/reports shift state,
|
||||||
// make sure that only CONTROL shift key is pressed.
|
// make sure that only CONTROL shift key is pressed.
|
||||||
@ -1402,6 +1418,7 @@ MainCommandDisplayHelp (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// update screen with file buffer's info
|
// update screen with file buffer's info
|
||||||
//
|
//
|
||||||
@ -1416,7 +1433,6 @@ MainCommandDisplayHelp (
|
|||||||
EFI_EDITOR_COLOR_ATTRIBUTES OriginalColors;
|
EFI_EDITOR_COLOR_ATTRIBUTES OriginalColors;
|
||||||
INTN OriginalMode;
|
INTN OriginalMode;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// basic initialization for MainEditor
|
// basic initialization for MainEditor
|
||||||
//
|
//
|
||||||
@ -1510,7 +1526,7 @@ MainEditorInit (
|
|||||||
&HandleCount,
|
&HandleCount,
|
||||||
&HandleBuffer
|
&HandleBuffer
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status) && HandleCount > 0) {
|
if (!EFI_ERROR (Status) && (HandleCount > 0)) {
|
||||||
//
|
//
|
||||||
// Try to find the first available mouse device
|
// Try to find the first available mouse device
|
||||||
//
|
//
|
||||||
@ -1525,12 +1541,13 @@ MainEditorInit (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
FreePool (HandleBuffer);
|
FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status) && MainEditor.MouseInterface != NULL) {
|
if (!EFI_ERROR (Status) && (MainEditor.MouseInterface != NULL)) {
|
||||||
MainEditor.MouseAccumulatorX = 0;
|
MainEditor.MouseAccumulatorX = 0;
|
||||||
MainEditor.MouseAccumulatorY = 0;
|
MainEditor.MouseAccumulatorY = 0;
|
||||||
MainEditor.MouseSupported = TRUE;
|
MainEditor.MouseSupported = TRUE;
|
||||||
@ -1565,6 +1582,7 @@ MainEditorInit (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_LIBEDITOR_FILEBUFFER), gShellDebug1HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_LIBEDITOR_FILEBUFFER), gShellDebug1HiiHandle);
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// clear whole screen and enable cursor
|
// clear whole screen and enable cursor
|
||||||
//
|
//
|
||||||
@ -1608,12 +1626,14 @@ MainEditorCleanup (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_LIBEDITOR_FILEBUFFER_CLEANUP), gShellDebug1HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_LIBEDITOR_FILEBUFFER_CLEANUP), gShellDebug1HiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// restore old mode
|
// restore old mode
|
||||||
//
|
//
|
||||||
if (OriginalMode != gST->ConOut->Mode->Mode) {
|
if (OriginalMode != gST->ConOut->Mode->Mode) {
|
||||||
gST->ConOut->SetMode (gST->ConOut, OriginalMode);
|
gST->ConOut->SetMode (gST->ConOut, OriginalMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// restore old screen color
|
// restore old screen color
|
||||||
//
|
//
|
||||||
@ -1644,21 +1664,21 @@ MainEditorRefresh (
|
|||||||
// call the components refresh function
|
// call the components refresh function
|
||||||
//
|
//
|
||||||
if ( EditorFirst
|
if ( EditorFirst
|
||||||
|| StrCmp (FileBufferBackupVar.FileName, FileBuffer.FileName) != 0
|
|| (StrCmp (FileBufferBackupVar.FileName, FileBuffer.FileName) != 0)
|
||||||
|| FileBufferBackupVar.FileType != FileBuffer.FileType
|
|| (FileBufferBackupVar.FileType != FileBuffer.FileType)
|
||||||
|| FileBufferBackupVar.FileModified != FileBuffer.FileModified
|
|| (FileBufferBackupVar.FileModified != FileBuffer.FileModified)
|
||||||
|| FileBufferBackupVar.ReadOnly != FileBuffer.ReadOnly) {
|
|| (FileBufferBackupVar.ReadOnly != FileBuffer.ReadOnly))
|
||||||
|
{
|
||||||
MainTitleBarRefresh (MainEditor.FileBuffer->FileName, MainEditor.FileBuffer->FileType, MainEditor.FileBuffer->ReadOnly, MainEditor.FileBuffer->FileModified, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row, 0, 0);
|
MainTitleBarRefresh (MainEditor.FileBuffer->FileName, MainEditor.FileBuffer->FileType, MainEditor.FileBuffer->ReadOnly, MainEditor.FileBuffer->FileModified, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row, 0, 0);
|
||||||
FileBufferRestorePosition ();
|
FileBufferRestorePosition ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( EditorFirst
|
if ( EditorFirst
|
||||||
|| FileBufferBackupVar.FilePosition.Row != FileBuffer.FilePosition.Row
|
|| (FileBufferBackupVar.FilePosition.Row != FileBuffer.FilePosition.Row)
|
||||||
|| FileBufferBackupVar.FilePosition.Column != FileBuffer.FilePosition.Column
|
|| (FileBufferBackupVar.FilePosition.Column != FileBuffer.FilePosition.Column)
|
||||||
|| FileBufferBackupVar.ModeInsert != FileBuffer.ModeInsert
|
|| (FileBufferBackupVar.ModeInsert != FileBuffer.ModeInsert)
|
||||||
|| StatusBarGetRefresh()) {
|
|| StatusBarGetRefresh ())
|
||||||
|
{
|
||||||
StatusBarRefresh (EditorFirst, MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column, MainEditor.FileBuffer->FilePosition.Row, MainEditor.FileBuffer->FilePosition.Column, MainEditor.FileBuffer->ModeInsert);
|
StatusBarRefresh (EditorFirst, MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column, MainEditor.FileBuffer->FilePosition.Row, MainEditor.FileBuffer->FilePosition.Column, MainEditor.FileBuffer->ModeInsert);
|
||||||
FileBufferRestorePosition ();
|
FileBufferRestorePosition ();
|
||||||
}
|
}
|
||||||
@ -1731,7 +1751,6 @@ MainEditorHandleMouseInput (
|
|||||||
IN EFI_SIMPLE_POINTER_STATE MouseState
|
IN EFI_SIMPLE_POINTER_STATE MouseState
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
INT32 TextX;
|
INT32 TextX;
|
||||||
INT32 TextY;
|
INT32 TextY;
|
||||||
UINTN FRow;
|
UINTN FRow;
|
||||||
@ -1763,14 +1782,12 @@ MainEditorHandleMouseInput (
|
|||||||
FileBufferAdjustMousePosition (TextX, TextY);
|
FileBufferAdjustMousePosition (TextX, TextY);
|
||||||
|
|
||||||
Action = TRUE;
|
Action = TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if left button pushed down
|
// if left button pushed down
|
||||||
//
|
//
|
||||||
if (MouseState.LeftButton) {
|
if (MouseState.LeftButton) {
|
||||||
|
|
||||||
FCol = MainEditor.FileBuffer->MousePosition.Column - 1 + 1;
|
FCol = MainEditor.FileBuffer->MousePosition.Column - 1 + 1;
|
||||||
|
|
||||||
FRow = MainEditor.FileBuffer->FilePosition.Row +
|
FRow = MainEditor.FileBuffer->FilePosition.Row +
|
||||||
@ -1806,6 +1823,7 @@ MainEditorHandleMouseInput (
|
|||||||
|
|
||||||
Action = TRUE;
|
Action = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// mouse has action
|
// mouse has action
|
||||||
//
|
//
|
||||||
@ -1837,7 +1855,6 @@ MainEditorKeyInput (
|
|||||||
BOOLEAN NoShiftState;
|
BOOLEAN NoShiftState;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
EditorMouseAction = FALSE;
|
EditorMouseAction = FALSE;
|
||||||
|
|
||||||
@ -1857,7 +1874,6 @@ MainEditorKeyInput (
|
|||||||
&MouseState
|
&MouseState
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
Status = MainEditorHandleMouseInput (MouseState);
|
Status = MainEditorHandleMouseInput (MouseState);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
@ -1903,22 +1919,21 @@ MainEditorKeyInput (
|
|||||||
FileBufferMouseNeedRefresh = FALSE;
|
FileBufferMouseNeedRefresh = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status != EFI_SUCCESS && Status != EFI_OUT_OF_RESOURCES) {
|
if ((Status != EFI_SUCCESS) && (Status != EFI_OUT_OF_RESOURCES)) {
|
||||||
//
|
//
|
||||||
// not already has some error status
|
// not already has some error status
|
||||||
//
|
//
|
||||||
if (StatusBarGetString() != NULL && StrCmp (L"", StatusBarGetString()) == 0) {
|
if ((StatusBarGetString () != NULL) && (StrCmp (L"", StatusBarGetString ()) == 0)) {
|
||||||
StatusBarSetStatusString (L"Disk Error. Try Again");
|
StatusBarSetStatusString (L"Disk Error. Try Again");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// after handling, refresh editor
|
// after handling, refresh editor
|
||||||
//
|
//
|
||||||
MainEditorRefresh ();
|
MainEditorRefresh ();
|
||||||
|
|
||||||
} while (Status != EFI_OUT_OF_RESOURCES && !EditorExit);
|
} while (Status != EFI_OUT_OF_RESOURCES && !EditorExit);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
@ -1947,6 +1962,7 @@ MainEditorSetCutLine (
|
|||||||
//
|
//
|
||||||
LineFree (MainEditor.CutLine);
|
LineFree (MainEditor.CutLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// duplicate the line to clipboard
|
// duplicate the line to clipboard
|
||||||
//
|
//
|
||||||
|
@ -31,6 +31,7 @@ LineDup (
|
|||||||
if (Dest == NULL) {
|
if (Dest == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// allocate and set the line buffer
|
// allocate and set the line buffer
|
||||||
//
|
//
|
||||||
@ -65,20 +66,10 @@ LineFree (
|
|||||||
if (Src == NULL) {
|
if (Src == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// free the line buffer and then the line structure itself
|
// free the line buffer and then the line structure itself
|
||||||
//
|
//
|
||||||
SHELL_FREE_NON_NULL (Src->Buffer);
|
SHELL_FREE_NON_NULL (Src->Buffer);
|
||||||
SHELL_FREE_NON_NULL (Src);
|
SHELL_FREE_NON_NULL (Src);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
#include "TextEditorTypes.h"
|
#include "TextEditorTypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free a EFI_EDITOR_LINE structure.
|
Free a EFI_EDITOR_LINE structure.
|
||||||
|
|
||||||
@ -36,9 +34,4 @@ LineDup (
|
|||||||
IN EFI_EDITOR_LINE *Src
|
IN EFI_EDITOR_LINE *Src
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -91,7 +91,6 @@ typedef struct {
|
|||||||
EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;
|
EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;
|
||||||
INT32 MouseAccumulatorX;
|
INT32 MouseAccumulatorX;
|
||||||
INT32 MouseAccumulatorY;
|
INT32 MouseAccumulatorY;
|
||||||
|
|
||||||
} EFI_EDITOR_GLOBAL_EDITOR;
|
} EFI_EDITOR_GLOBAL_EDITOR;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,7 +106,6 @@ typedef union {
|
|||||||
UINTN Data;
|
UINTN Data;
|
||||||
} INPUT_BAR_COLOR_UNION;
|
} INPUT_BAR_COLOR_UNION;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The refresh function for InputBar, it will wait for user input
|
The refresh function for InputBar, it will wait for user input
|
||||||
|
|
||||||
@ -168,6 +167,7 @@ InputBarRefresh (
|
|||||||
} else {
|
} else {
|
||||||
NoDisplay = FALSE;
|
NoDisplay = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// wait for user input
|
// wait for user input
|
||||||
//
|
//
|
||||||
@ -176,17 +176,21 @@ InputBarRefresh (
|
|||||||
if (EFI_ERROR (Status) || (EventIndex != 0)) {
|
if (EFI_ERROR (Status) || (EventIndex != 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = mTextInEx->ReadKeyStrokeEx (mTextInEx, &KeyData);
|
Status = mTextInEx->ReadKeyStrokeEx (mTextInEx, &KeyData);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
||||||
(KeyData.KeyState.KeyShiftState != EFI_SHIFT_STATE_VALID)) {
|
(KeyData.KeyState.KeyShiftState != EFI_SHIFT_STATE_VALID))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Shift key pressed.
|
// Shift key pressed.
|
||||||
//
|
//
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// pressed ESC
|
// pressed ESC
|
||||||
//
|
//
|
||||||
@ -195,10 +199,11 @@ InputBarRefresh (
|
|||||||
Status = EFI_NOT_READY;
|
Status = EFI_NOT_READY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// return pressed
|
// return pressed
|
||||||
//
|
//
|
||||||
if (KeyData.Key.UnicodeChar == CHAR_LINEFEED || KeyData.Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
|
if ((KeyData.Key.UnicodeChar == CHAR_LINEFEED) || (KeyData.Key.UnicodeChar == CHAR_CARRIAGE_RETURN)) {
|
||||||
break;
|
break;
|
||||||
} else if (KeyData.Key.UnicodeChar == CHAR_BACKSPACE) {
|
} else if (KeyData.Key.UnicodeChar == CHAR_BACKSPACE) {
|
||||||
//
|
//
|
||||||
@ -208,12 +213,10 @@ InputBarRefresh (
|
|||||||
Size--;
|
Size--;
|
||||||
mReturnString[Size] = CHAR_NULL;
|
mReturnString[Size] = CHAR_NULL;
|
||||||
if (!NoDisplay) {
|
if (!NoDisplay) {
|
||||||
|
|
||||||
InputBarPrintInput (LastColumn, LastRow);
|
InputBarPrintInput (LastColumn, LastRow);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (KeyData.Key.UnicodeChar <= 127 && KeyData.Key.UnicodeChar >= 32) {
|
} else if ((KeyData.Key.UnicodeChar <= 127) && (KeyData.Key.UnicodeChar >= 32)) {
|
||||||
//
|
//
|
||||||
// VALID ASCII char pressed
|
// VALID ASCII char pressed
|
||||||
//
|
//
|
||||||
@ -231,22 +234,18 @@ InputBarRefresh (
|
|||||||
mReturnString[Size] = CHAR_NULL;
|
mReturnString[Size] = CHAR_NULL;
|
||||||
|
|
||||||
if (!NoDisplay) {
|
if (!NoDisplay) {
|
||||||
|
|
||||||
InputBarPrintInput (LastColumn, LastRow);
|
InputBarPrintInput (LastColumn, LastRow);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// if just choose yes/no
|
// if just choose yes/no
|
||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mReturnString[Size] = CHAR_NULL;
|
mReturnString[Size] = CHAR_NULL;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// restore screen attributes
|
// restore screen attributes
|
||||||
//
|
//
|
||||||
|
@ -40,12 +40,14 @@ MenuBarInit (
|
|||||||
{
|
{
|
||||||
CONST EDITOR_MENU_ITEM *ItemsWalker;
|
CONST EDITOR_MENU_ITEM *ItemsWalker;
|
||||||
|
|
||||||
for (NumItems = 0, ItemsWalker = Items ; ItemsWalker != NULL && ItemsWalker->Function != NULL ; ItemsWalker++,NumItems++);
|
for (NumItems = 0, ItemsWalker = Items; ItemsWalker != NULL && ItemsWalker->Function != NULL; ItemsWalker++, NumItems++) {
|
||||||
|
}
|
||||||
|
|
||||||
MenuItems = AllocateZeroPool ((NumItems+1) * sizeof (EDITOR_MENU_ITEM));
|
MenuItems = AllocateZeroPool ((NumItems+1) * sizeof (EDITOR_MENU_ITEM));
|
||||||
if (MenuItems == NULL) {
|
if (MenuItems == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (MenuItems, Items, (NumItems+1) * sizeof (EDITOR_MENU_ITEM));
|
CopyMem (MenuItems, Items, (NumItems+1) * sizeof (EDITOR_MENU_ITEM));
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -65,6 +67,7 @@ ControlHotKeyInit (
|
|||||||
ControlBasedMenuFunctions = Items;
|
ControlBasedMenuFunctions = Items;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Refresh function for the menu bar.
|
Refresh function for the menu bar.
|
||||||
|
|
||||||
@ -99,16 +102,12 @@ MenuBarRefresh (
|
|||||||
EditorClearLine (LastRow - 1, LastCol, LastRow);
|
EditorClearLine (LastRow - 1, LastCol, LastRow);
|
||||||
EditorClearLine (LastRow, LastCol, LastRow);
|
EditorClearLine (LastRow, LastCol, LastRow);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// print out the menu items
|
// print out the menu items
|
||||||
//
|
//
|
||||||
for (Item = MenuItems; Item != NULL && Item->Function != NULL; Item++) {
|
for (Item = MenuItems; Item != NULL && Item->Function != NULL; Item++) {
|
||||||
|
|
||||||
|
|
||||||
NameString = HiiGetString (gShellDebug1HiiHandle, Item->NameToken, NULL);
|
NameString = HiiGetString (gShellDebug1HiiHandle, Item->NameToken, NULL);
|
||||||
|
|
||||||
|
|
||||||
Width = MAX ((StrLen (NameString) + 6), 20);
|
Width = MAX ((StrLen (NameString) + 6), 20);
|
||||||
if (((Col + Width) > LastCol)) {
|
if (((Col + Width) > LastCol)) {
|
||||||
Row++;
|
Row++;
|
||||||
@ -178,7 +177,8 @@ MenuBarDispatchControlHotKey (
|
|||||||
ControlIndex = MAX_UINT16;
|
ControlIndex = MAX_UINT16;
|
||||||
|
|
||||||
if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
||||||
(KeyData->KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) {
|
(KeyData->KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// For consoles that don't support/report shift state,
|
// For consoles that don't support/report shift state,
|
||||||
// Ctrl+A is translated to 1 (UnicodeChar).
|
// Ctrl+A is translated to 1 (UnicodeChar).
|
||||||
@ -186,7 +186,8 @@ MenuBarDispatchControlHotKey (
|
|||||||
ControlIndex = KeyData->Key.UnicodeChar;
|
ControlIndex = KeyData->Key.UnicodeChar;
|
||||||
} else if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
} else if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
||||||
((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) != 0) &&
|
((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) != 0) &&
|
||||||
((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) == 0)) {
|
((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// For consoles that supports/reports shift state,
|
// For consoles that supports/reports shift state,
|
||||||
// make sure only CONTROL is pressed.
|
// make sure only CONTROL is pressed.
|
||||||
@ -197,6 +198,7 @@ MenuBarDispatchControlHotKey (
|
|||||||
ControlIndex = KeyData->Key.UnicodeChar - L'a' + 1;
|
ControlIndex = KeyData->Key.UnicodeChar - L'a' + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (SCAN_CONTROL_Z < ControlIndex)
|
if ( (SCAN_CONTROL_Z < ControlIndex)
|
||||||
|| (NULL == ControlBasedMenuFunctions[ControlIndex]))
|
|| (NULL == ControlBasedMenuFunctions[ControlIndex]))
|
||||||
{
|
{
|
||||||
@ -206,5 +208,3 @@ MenuBarDispatchControlHotKey (
|
|||||||
ControlBasedMenuFunctions[ControlIndex]();
|
ControlBasedMenuFunctions[ControlIndex]();
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#define SCAN_CONTROL_W 23
|
#define SCAN_CONTROL_W 23
|
||||||
#define SCAN_CONTROL_Z 26
|
#define SCAN_CONTROL_Z 26
|
||||||
|
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(*MENU_ITEM_FUNCTION) (
|
(*MENU_ITEM_FUNCTION) (
|
||||||
|
@ -91,6 +91,7 @@ StatusBarRefresh (
|
|||||||
if (!StatusStringChanged && StatusBarNeedRefresh) {
|
if (!StatusStringChanged && StatusBarNeedRefresh) {
|
||||||
StatusBarSetStatusString (L"\0");
|
StatusBarSetStatusString (L"\0");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// when it's called first time after editor launch, so refresh is mandatory
|
// when it's called first time after editor launch, so refresh is mandatory
|
||||||
//
|
//
|
||||||
@ -117,7 +118,7 @@ StatusBarRefresh (
|
|||||||
//
|
//
|
||||||
// print row, column fields
|
// print row, column fields
|
||||||
//
|
//
|
||||||
if (FileRow != (UINTN)(-1) && FileCol != (UINTN)(-1)) {
|
if ((FileRow != (UINTN)(-1)) && (FileCol != (UINTN)(-1))) {
|
||||||
ShellPrintEx (
|
ShellPrintEx (
|
||||||
0,
|
0,
|
||||||
(INT32)(LastRow) - 1,
|
(INT32)(LastRow) - 1,
|
||||||
@ -143,6 +144,7 @@ StatusBarRefresh (
|
|||||||
} else {
|
} else {
|
||||||
ShellPrintEx ((INT32)(LastCol) - 21, (INT32)(LastRow) - 1, L"|%s| Help: Ctrl-E", L"OVR");
|
ShellPrintEx ((INT32)(LastCol) - 21, (INT32)(LastRow) - 1, L"|%s| Help: Ctrl-E", L"OVR");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// restore the old screen attributes
|
// restore the old screen attributes
|
||||||
//
|
//
|
||||||
|
@ -34,6 +34,7 @@ MainTitleBarInit (
|
|||||||
//
|
//
|
||||||
Title = CatSPrint (NULL, L"%s", Prompt);
|
Title = CatSPrint (NULL, L"%s", Prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Title == NULL) {
|
if (Title == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
@ -94,7 +95,6 @@ MainTitleBarRefresh (
|
|||||||
CONST CHAR16 *FileNameTmp;
|
CONST CHAR16 *FileNameTmp;
|
||||||
INTN TempInteger;
|
INTN TempInteger;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// backup the old screen attributes
|
// backup the old screen attributes
|
||||||
//
|
//
|
||||||
@ -121,10 +121,12 @@ MainTitleBarRefresh (
|
|||||||
Title
|
Title
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileName == NULL) {
|
if (FileName == NULL) {
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// First Extract the FileName from fullpath
|
// First Extract the FileName from fullpath
|
||||||
//
|
//
|
||||||
@ -145,16 +147,17 @@ MainTitleBarRefresh (
|
|||||||
for (TempInteger = StrLen (FileNameTmp); TempInteger < 20; TempInteger++) {
|
for (TempInteger = StrLen (FileNameTmp); TempInteger < 20; TempInteger++) {
|
||||||
ShellPrintEx (-1, -1, L" ");
|
ShellPrintEx (-1, -1, L" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (TempInteger = 0; TempInteger < 17; TempInteger++) {
|
for (TempInteger = 0; TempInteger < 17; TempInteger++) {
|
||||||
ShellPrintEx (-1, -1, L"%c", FileNameTmp[TempInteger]);
|
ShellPrintEx (-1, -1, L"%c", FileNameTmp[TempInteger]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// print "..."
|
// print "..."
|
||||||
//
|
//
|
||||||
ShellPrintEx (-1, -1, L"... ");
|
ShellPrintEx (-1, -1, L"... ");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// print file type field
|
// print file type field
|
||||||
//
|
//
|
||||||
@ -166,6 +169,7 @@ MainTitleBarRefresh (
|
|||||||
} else {
|
} else {
|
||||||
ShellPrintEx (-1, -1, L" UNICODE ");
|
ShellPrintEx (-1, -1, L" UNICODE ");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// print read-only field for text files
|
// print read-only field for text files
|
||||||
//
|
//
|
||||||
@ -174,6 +178,7 @@ MainTitleBarRefresh (
|
|||||||
} else {
|
} else {
|
||||||
ShellPrintEx (-1, -1, L" ");
|
ShellPrintEx (-1, -1, L" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case FileTypeDiskBuffer:
|
case FileTypeDiskBuffer:
|
||||||
case FileTypeMemBuffer:
|
case FileTypeMemBuffer:
|
||||||
@ -186,12 +191,14 @@ MainTitleBarRefresh (
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// print modified field
|
// print modified field
|
||||||
//
|
//
|
||||||
if (Modified) {
|
if (Modified) {
|
||||||
ShellPrintEx (-1, -1, L"Modified");
|
ShellPrintEx (-1, -1, L"Modified");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// restore the old attribute
|
// restore the old attribute
|
||||||
//
|
//
|
||||||
|
@ -63,7 +63,7 @@ ShellCommandRunEfiCompress (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"eficompress", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"eficompress", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -90,22 +90,26 @@ ShellCommandRunEfiCompress (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", InFileName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", InFileName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellIsDirectory (OutFileName) == EFI_SUCCESS) {
|
if (ShellIsDirectory (OutFileName) == EFI_SUCCESS) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", OutFileName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", OutFileName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellStatus == SHELL_SUCCESS) {
|
if (ShellStatus == SHELL_SUCCESS) {
|
||||||
Status = ShellOpenFileByName (InFileName, &InShellFileHandle, EFI_FILE_MODE_READ, 0);
|
Status = ShellOpenFileByName (InFileName, &InShellFileHandle, EFI_FILE_MODE_READ, 0);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue (Package, 1));
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue (Package, 1));
|
||||||
ShellStatus = SHELL_NOT_FOUND;
|
ShellStatus = SHELL_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ShellOpenFileByName (OutFileName, &OutShellFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
Status = ShellOpenFileByName (OutFileName, &OutShellFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue (Package, 2));
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue (Package, 2));
|
||||||
ShellStatus = SHELL_NOT_FOUND;
|
ShellStatus = SHELL_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellStatus == SHELL_SUCCESS) {
|
if (ShellStatus == SHELL_SUCCESS) {
|
||||||
Status = gEfiShellProtocol->GetFileSize (InShellFileHandle, &InSize);
|
Status = gEfiShellProtocol->GetFileSize (InShellFileHandle, &InSize);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
@ -127,6 +131,7 @@ ShellCommandRunEfiCompress (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EFI_COMPRESS_FAIL), gShellDebug1HiiHandle, Status);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EFI_COMPRESS_FAIL), gShellDebug1HiiHandle, Status);
|
||||||
ShellStatus = ((Status == EFI_OUT_OF_RESOURCES) ? SHELL_OUT_OF_RESOURCES : SHELL_DEVICE_ERROR);
|
ShellStatus = ((Status == EFI_OUT_OF_RESOURCES) ? SHELL_OUT_OF_RESOURCES : SHELL_DEVICE_ERROR);
|
||||||
@ -144,12 +149,15 @@ ShellCommandRunEfiCompress (
|
|||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InShellFileHandle != NULL) {
|
if (InShellFileHandle != NULL) {
|
||||||
gEfiShellProtocol->CloseFile (InShellFileHandle);
|
gEfiShellProtocol->CloseFile (InShellFileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OutShellFileHandle != NULL) {
|
if (OutShellFileHandle != NULL) {
|
||||||
gEfiShellProtocol->CloseFile (OutShellFileHandle);
|
gEfiShellProtocol->CloseFile (OutShellFileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (InFileName);
|
SHELL_FREE_NON_NULL (InFileName);
|
||||||
SHELL_FREE_NON_NULL (InBuffer);
|
SHELL_FREE_NON_NULL (InBuffer);
|
||||||
SHELL_FREE_NON_NULL (OutBuffer);
|
SHELL_FREE_NON_NULL (OutBuffer);
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "UefiShellDebug1CommandsLib.h"
|
#include "UefiShellDebug1CommandsLib.h"
|
||||||
#include <Protocol/Decompress.h>
|
#include <Protocol/Decompress.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function for 'decompress' command.
|
Function for 'decompress' command.
|
||||||
|
|
||||||
@ -70,7 +69,7 @@ ShellCommandRunEfiDecompress (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"efidecompress", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"efidecompress", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -97,10 +96,12 @@ ShellCommandRunEfiDecompress (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", InFileName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", InFileName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellIsDirectory (OutFileName) == EFI_SUCCESS) {
|
if (ShellIsDirectory (OutFileName) == EFI_SUCCESS) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", OutFileName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"efidecompress", OutFileName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellStatus == SHELL_SUCCESS) {
|
if (ShellStatus == SHELL_SUCCESS) {
|
||||||
Status = ShellOpenFileByName (InFileName, &InFileHandle, EFI_FILE_MODE_READ, 0);
|
Status = ShellOpenFileByName (InFileName, &InFileHandle, EFI_FILE_MODE_READ, 0);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -127,7 +128,7 @@ ShellCommandRunEfiDecompress (
|
|||||||
Status = Decompress->GetInfo (Decompress, InBuffer, (UINT32)InSize, &OutSize, &ScratchSize);
|
Status = Decompress->GetInfo (Decompress, InBuffer, (UINT32)InSize, &OutSize, &ScratchSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR(Status) || OutSize == 0) {
|
if (EFI_ERROR (Status) || (OutSize == 0)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_NOPE), gShellDebug1HiiHandle, InFileName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_NOPE), gShellDebug1HiiHandle, InFileName);
|
||||||
ShellStatus = SHELL_NOT_FOUND;
|
ShellStatus = SHELL_NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
@ -138,7 +139,7 @@ ShellCommandRunEfiDecompress (
|
|||||||
} else {
|
} else {
|
||||||
OutBuffer = AllocateZeroPool (OutSize);
|
OutBuffer = AllocateZeroPool (OutSize);
|
||||||
ScratchBuffer = AllocateZeroPool (ScratchSize);
|
ScratchBuffer = AllocateZeroPool (ScratchSize);
|
||||||
if (OutBuffer == NULL || ScratchBuffer == NULL) {
|
if ((OutBuffer == NULL) || (ScratchBuffer == NULL)) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
} else {
|
} else {
|
||||||
Status = Decompress->Decompress (Decompress, InBuffer, (UINT32)InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize);
|
Status = Decompress->Decompress (Decompress, InBuffer, (UINT32)InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize);
|
||||||
@ -164,9 +165,11 @@ ShellCommandRunEfiDecompress (
|
|||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InFileHandle != NULL) {
|
if (InFileHandle != NULL) {
|
||||||
gEfiShellProtocol->CloseFile (InFileHandle);
|
gEfiShellProtocol->CloseFile (InFileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OutFileHandle != NULL) {
|
if (OutFileHandle != NULL) {
|
||||||
gEfiShellProtocol->CloseFile (OutFileHandle);
|
gEfiShellProtocol->CloseFile (OutFileHandle);
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,6 @@ HBufferImageCleanup (
|
|||||||
HDiskImageCleanup ();
|
HDiskImageCleanup ();
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,7 +249,6 @@ HBufferImagePrintLine (
|
|||||||
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINTN Pos;
|
UINTN Pos;
|
||||||
BOOLEAN Selected;
|
BOOLEAN Selected;
|
||||||
@ -270,14 +268,14 @@ HBufferImagePrintLine (
|
|||||||
//
|
//
|
||||||
// print the selected area in opposite color
|
// print the selected area in opposite color
|
||||||
//
|
//
|
||||||
if (HMainEditor.SelectStart != 0 && HMainEditor.SelectEnd != 0) {
|
if ((HMainEditor.SelectStart != 0) && (HMainEditor.SelectEnd != 0)) {
|
||||||
RowStart = (HMainEditor.SelectStart - 1) / 0x10 + 1;
|
RowStart = (HMainEditor.SelectStart - 1) / 0x10 + 1;
|
||||||
RowEnd = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
|
RowEnd = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
|
||||||
|
|
||||||
ColStart = (HMainEditor.SelectStart - 1) % 0x10 + 1;
|
ColStart = (HMainEditor.SelectStart - 1) % 0x10 + 1;
|
||||||
ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1;
|
ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1;
|
||||||
|
|
||||||
if (FRow >= RowStart && FRow <= RowEnd) {
|
if ((FRow >= RowStart) && (FRow <= RowEnd)) {
|
||||||
Selected = TRUE;
|
Selected = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +286,6 @@ HBufferImagePrintLine (
|
|||||||
if (FRow < RowEnd) {
|
if (FRow < RowEnd) {
|
||||||
ColEnd = 0x10;
|
ColEnd = 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HEditorMouseAction) {
|
if (!HEditorMouseAction) {
|
||||||
@ -298,15 +295,13 @@ HBufferImagePrintLine (
|
|||||||
L"%8X ",
|
L"%8X ",
|
||||||
((INT32)Row - 2 + HBufferImage.LowVisibleRow - 1) * 0x10
|
((INT32)Row - 2 + HBufferImage.LowVisibleRow - 1) * 0x10
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < 0x08 && Index < Line->Size; Index++) {
|
for (Index = 0; Index < 0x08 && Index < Line->Size; Index++) {
|
||||||
|
|
||||||
BeNewColor = FALSE;
|
BeNewColor = FALSE;
|
||||||
|
|
||||||
if (Selected) {
|
if (Selected) {
|
||||||
if (Index + 1 >= ColStart && Index + 1 <= ColEnd) {
|
if ((Index + 1 >= ColStart) && (Index + 1 <= ColEnd)) {
|
||||||
BeNewColor = TRUE;
|
BeNewColor = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,7 +323,6 @@ HBufferImagePrintLine (
|
|||||||
} else {
|
} else {
|
||||||
ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%x ", Line->Buffer[Index]);
|
ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L"%x ", Line->Buffer[Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
|
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
|
||||||
@ -339,11 +333,10 @@ HBufferImagePrintLine (
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (Index < 0x10 && Index < Line->Size) {
|
while (Index < 0x10 && Index < Line->Size) {
|
||||||
|
|
||||||
BeNewColor = FALSE;
|
BeNewColor = FALSE;
|
||||||
|
|
||||||
if (Selected) {
|
if (Selected) {
|
||||||
if (Index + 1 >= ColStart && Index + 1 <= ColEnd) {
|
if ((Index + 1 >= ColStart) && (Index + 1 <= ColEnd)) {
|
||||||
BeNewColor = TRUE;
|
BeNewColor = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,6 +363,7 @@ HBufferImagePrintLine (
|
|||||||
ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" ");
|
ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" ");
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// restore the original color
|
// restore the original color
|
||||||
//
|
//
|
||||||
@ -398,6 +392,7 @@ HBufferImagePrintLine (
|
|||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// restore the abundant blank in hex edit area to original color
|
// restore the abundant blank in hex edit area to original color
|
||||||
//
|
//
|
||||||
@ -489,9 +484,10 @@ HBufferImageIsInSelectedArea (
|
|||||||
//
|
//
|
||||||
// not select
|
// not select
|
||||||
//
|
//
|
||||||
if (HMainEditor.SelectStart == 0 || HMainEditor.SelectEnd == 0) {
|
if ((HMainEditor.SelectStart == 0) || (HMainEditor.SelectEnd == 0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// calculate the select area
|
// calculate the select area
|
||||||
//
|
//
|
||||||
@ -502,7 +498,7 @@ HBufferImageIsInSelectedArea (
|
|||||||
ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1;
|
ColEnd = (HMainEditor.SelectEnd - 1) % 0x10 + 1;
|
||||||
|
|
||||||
FRow = HBufferImage.LowVisibleRow + MouseRow - 2;
|
FRow = HBufferImage.LowVisibleRow + MouseRow - 2;
|
||||||
if (FRow < RowStart || FRow > RowEnd) {
|
if ((FRow < RowStart) || (FRow > RowEnd)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,7 +520,7 @@ HBufferImageIsInSelectedArea (
|
|||||||
MouseColEnd++;
|
MouseColEnd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MouseCol < MouseColStart || MouseCol > MouseColEnd) {
|
if ((MouseCol < MouseColStart) || (MouseCol > MouseColEnd)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,9 +549,7 @@ HBufferImageRestoreMousePosition (
|
|||||||
|
|
||||||
Line = NULL;
|
Line = NULL;
|
||||||
if (HMainEditor.MouseSupported) {
|
if (HMainEditor.MouseSupported) {
|
||||||
|
|
||||||
if (HBufferImageMouseNeedRefresh) {
|
if (HBufferImageMouseNeedRefresh) {
|
||||||
|
|
||||||
HBufferImageMouseNeedRefresh = FALSE;
|
HBufferImageMouseNeedRefresh = FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -563,13 +557,15 @@ HBufferImageRestoreMousePosition (
|
|||||||
// so do not need to refresh mouse position
|
// so do not need to refresh mouse position
|
||||||
//
|
//
|
||||||
if ((
|
if ((
|
||||||
HBufferImage.MousePosition.Row == HBufferImageBackupVar.MousePosition.Row &&
|
(HBufferImage.MousePosition.Row == HBufferImageBackupVar.MousePosition.Row) &&
|
||||||
HBufferImage.MousePosition.Column == HBufferImageBackupVar.MousePosition.Column
|
(HBufferImage.MousePosition.Column == HBufferImageBackupVar.MousePosition.Column)
|
||||||
) &&
|
) &&
|
||||||
HEditorMouseAction
|
HEditorMouseAction
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// backup the old screen attributes
|
// backup the old screen attributes
|
||||||
//
|
//
|
||||||
@ -585,11 +581,13 @@ HBufferImageRestoreMousePosition (
|
|||||||
if (!HBufferImageIsInSelectedArea (
|
if (!HBufferImageIsInSelectedArea (
|
||||||
HBufferImageBackupVar.MousePosition.Row,
|
HBufferImageBackupVar.MousePosition.Row,
|
||||||
HBufferImageBackupVar.MousePosition.Column
|
HBufferImageBackupVar.MousePosition.Column
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
||||||
} else {
|
} else {
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
|
gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// clear the old mouse position
|
// clear the old mouse position
|
||||||
//
|
//
|
||||||
@ -601,13 +599,13 @@ HBufferImageRestoreMousePosition (
|
|||||||
);
|
);
|
||||||
|
|
||||||
HasCharacter = TRUE;
|
HasCharacter = TRUE;
|
||||||
if (FRow > HBufferImage.NumLines || FColumn == 0) {
|
if ((FRow > HBufferImage.NumLines) || (FColumn == 0)) {
|
||||||
HasCharacter = FALSE;
|
HasCharacter = FALSE;
|
||||||
} else {
|
} else {
|
||||||
CurrentLine = HBufferImage.CurrentLine;
|
CurrentLine = HBufferImage.CurrentLine;
|
||||||
Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row);
|
Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row);
|
||||||
|
|
||||||
if (Line == NULL || FColumn > Line->Size) {
|
if ((Line == NULL) || (FColumn > Line->Size)) {
|
||||||
HasCharacter = FALSE;
|
HasCharacter = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,11 +637,13 @@ HBufferImageRestoreMousePosition (
|
|||||||
if (!HBufferImageIsInSelectedArea (
|
if (!HBufferImageIsInSelectedArea (
|
||||||
HBufferImage.MousePosition.Row,
|
HBufferImage.MousePosition.Row,
|
||||||
HBufferImage.MousePosition.Column
|
HBufferImage.MousePosition.Column
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
|
gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
|
||||||
} else {
|
} else {
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// clear the old mouse position
|
// clear the old mouse position
|
||||||
//
|
//
|
||||||
@ -655,13 +655,13 @@ HBufferImageRestoreMousePosition (
|
|||||||
);
|
);
|
||||||
|
|
||||||
HasCharacter = TRUE;
|
HasCharacter = TRUE;
|
||||||
if (FRow > HBufferImage.NumLines || FColumn == 0) {
|
if ((FRow > HBufferImage.NumLines) || (FColumn == 0)) {
|
||||||
HasCharacter = FALSE;
|
HasCharacter = FALSE;
|
||||||
} else {
|
} else {
|
||||||
CurrentLine = HBufferImage.CurrentLine;
|
CurrentLine = HBufferImage.CurrentLine;
|
||||||
Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row);
|
Line = HMoveLine (FRow - HBufferImage.BufferPosition.Row);
|
||||||
|
|
||||||
if (Line == NULL || FColumn > Line->Size) {
|
if ((Line == NULL) || (FColumn > Line->Size)) {
|
||||||
HasCharacter = FALSE;
|
HasCharacter = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,15 +689,18 @@ HBufferImageRestoreMousePosition (
|
|||||||
Value
|
Value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of HasCharacter
|
// end of HasCharacter
|
||||||
//
|
//
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of MouseNeedRefresh
|
// end of MouseNeedRefresh
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of MouseSupported
|
// end of MouseSupported
|
||||||
//
|
//
|
||||||
@ -764,8 +767,9 @@ HBufferImageRefresh (
|
|||||||
//
|
//
|
||||||
if (!HBufferImageNeedRefresh &&
|
if (!HBufferImageNeedRefresh &&
|
||||||
!HBufferImageOnlyLineNeedRefresh &&
|
!HBufferImageOnlyLineNeedRefresh &&
|
||||||
HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow
|
(HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
HBufferImageRestoreMousePosition ();
|
HBufferImageRestoreMousePosition ();
|
||||||
HBufferImageRestorePosition ();
|
HBufferImageRestorePosition ();
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -777,8 +781,7 @@ HBufferImageRefresh (
|
|||||||
//
|
//
|
||||||
// only need to refresh current line
|
// only need to refresh current line
|
||||||
//
|
//
|
||||||
if (HBufferImageOnlyLineNeedRefresh && HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow) {
|
if (HBufferImageOnlyLineNeedRefresh && (HBufferImageBackupVar.LowVisibleRow == HBufferImage.LowVisibleRow)) {
|
||||||
|
|
||||||
HBufferImagePrintLine (
|
HBufferImagePrintLine (
|
||||||
HBufferImage.CurrentLine,
|
HBufferImage.CurrentLine,
|
||||||
HBufferImage.DisplayPosition.Row,
|
HBufferImage.DisplayPosition.Row,
|
||||||
@ -790,9 +793,9 @@ HBufferImageRefresh (
|
|||||||
//
|
//
|
||||||
// the whole edit area need refresh
|
// the whole edit area need refresh
|
||||||
//
|
//
|
||||||
if (HEditorMouseAction && HMainEditor.SelectStart != 0 && HMainEditor.SelectEnd != 0) {
|
if (HEditorMouseAction && (HMainEditor.SelectStart != 0) && (HMainEditor.SelectEnd != 0)) {
|
||||||
if (HMainEditor.SelectStart != HMainEditorBackupVar.SelectStart) {
|
if (HMainEditor.SelectStart != HMainEditorBackupVar.SelectStart) {
|
||||||
if (HMainEditor.SelectStart >= HMainEditorBackupVar.SelectStart && HMainEditorBackupVar.SelectStart != 0) {
|
if ((HMainEditor.SelectStart >= HMainEditorBackupVar.SelectStart) && (HMainEditorBackupVar.SelectStart != 0)) {
|
||||||
StartRow = (HMainEditorBackupVar.SelectStart - 1) / 0x10 + 1;
|
StartRow = (HMainEditorBackupVar.SelectStart - 1) / 0x10 + 1;
|
||||||
} else {
|
} else {
|
||||||
StartRow = (HMainEditor.SelectStart - 1) / 0x10 + 1;
|
StartRow = (HMainEditor.SelectStart - 1) / 0x10 + 1;
|
||||||
@ -806,6 +809,7 @@ HBufferImageRefresh (
|
|||||||
} else {
|
} else {
|
||||||
EndRow = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
|
EndRow = (HMainEditor.SelectEnd - 1) / 0x10 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// swap
|
// swap
|
||||||
//
|
//
|
||||||
@ -819,7 +823,6 @@ HBufferImageRefresh (
|
|||||||
|
|
||||||
StartRow = 2 + StartRow - HBufferImage.LowVisibleRow;
|
StartRow = 2 + StartRow - HBufferImage.LowVisibleRow;
|
||||||
EndRow = 2 + EndRow - HBufferImage.LowVisibleRow;
|
EndRow = 2 + EndRow - HBufferImage.LowVisibleRow;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// not mouse selection actions
|
// not mouse selection actions
|
||||||
@ -828,6 +831,7 @@ HBufferImageRefresh (
|
|||||||
StartRow = 2;
|
StartRow = 2;
|
||||||
EndRow = (HMainEditor.ScreenSize.Row - 1);
|
EndRow = (HMainEditor.ScreenSize.Row - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// no line
|
// no line
|
||||||
//
|
//
|
||||||
@ -837,6 +841,7 @@ HBufferImageRefresh (
|
|||||||
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
|
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get the first line that will be displayed
|
// get the first line that will be displayed
|
||||||
//
|
//
|
||||||
@ -870,6 +875,7 @@ HBufferImageRefresh (
|
|||||||
EditorClearLine (Row, HMainEditor.ScreenSize.Column, HMainEditor.ScreenSize.Row);
|
EditorClearLine (Row, HMainEditor.ScreenSize.Column, HMainEditor.ScreenSize.Row);
|
||||||
Row++;
|
Row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// while not file end and not screen full
|
// while not file end and not screen full
|
||||||
//
|
//
|
||||||
@ -1101,15 +1107,15 @@ HBufferImageCharToHex (
|
|||||||
//
|
//
|
||||||
// change the character to hex
|
// change the character to hex
|
||||||
//
|
//
|
||||||
if (Char >= L'0' && Char <= L'9') {
|
if ((Char >= L'0') && (Char <= L'9')) {
|
||||||
return (Char - L'0');
|
return (Char - L'0');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Char >= L'a' && Char <= L'f') {
|
if ((Char >= L'a') && (Char <= L'f')) {
|
||||||
return (Char - L'a' + 10);
|
return (Char - L'a' + 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Char >= L'A' && Char <= L'F') {
|
if ((Char >= L'A') && (Char <= L'F')) {
|
||||||
return (Char - L'A' + 10);
|
return (Char - L'A' + 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1168,7 +1174,6 @@ HBufferImageAddChar (
|
|||||||
Line->Size++;
|
Line->Size++;
|
||||||
High = FALSE;
|
High = FALSE;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Old = Line->Buffer[FCol - 1];
|
Old = Line->Buffer[FCol - 1];
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1183,8 +1188,7 @@ HBufferImageAddChar (
|
|||||||
// at the low 4 bits of the last character of a full line
|
// at the low 4 bits of the last character of a full line
|
||||||
// so if no next line, need to create a new line
|
// so if no next line, need to create a new line
|
||||||
//
|
//
|
||||||
if (!High && FCol == 0x10) {
|
if (!High && (FCol == 0x10)) {
|
||||||
|
|
||||||
HBufferImageOnlyLineNeedRefresh = FALSE;
|
HBufferImageOnlyLineNeedRefresh = FALSE;
|
||||||
HBufferImageNeedRefresh = TRUE;
|
HBufferImageNeedRefresh = TRUE;
|
||||||
|
|
||||||
@ -1198,20 +1202,23 @@ HBufferImageAddChar (
|
|||||||
if (NewLine == NULL) {
|
if (NewLine == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of NULL
|
// end of NULL
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of == ListHead
|
// end of == ListHead
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of == 0x10
|
// end of == 0x10
|
||||||
//
|
//
|
||||||
// if already at end of this line, scroll it to the start of next line
|
// if already at end of this line, scroll it to the start of next line
|
||||||
//
|
//
|
||||||
if (FCol == 0x10 && !High) {
|
if ((FCol == 0x10) && !High) {
|
||||||
//
|
//
|
||||||
// definitely has next line
|
// definitely has next line
|
||||||
//
|
//
|
||||||
@ -1231,12 +1238,13 @@ HBufferImageAddChar (
|
|||||||
} else {
|
} else {
|
||||||
High = TRUE;
|
High = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of ==FALSE
|
// end of ==FALSE
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// move cursor to right
|
// move cursor to right
|
||||||
//
|
//
|
||||||
@ -1273,7 +1281,7 @@ HBufferImageDoBackspace (
|
|||||||
//
|
//
|
||||||
// already the first character
|
// already the first character
|
||||||
//
|
//
|
||||||
if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) {
|
if ((HBufferImage.BufferPosition.Row == 1) && (HBufferImage.BufferPosition.Column == 1)) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1283,7 +1291,7 @@ HBufferImageDoBackspace (
|
|||||||
|
|
||||||
Line = HBufferImage.CurrentLine;
|
Line = HBufferImage.CurrentLine;
|
||||||
LastLine = FALSE;
|
LastLine = FALSE;
|
||||||
if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) {
|
if ((Line->Link.ForwardLink == HBufferImage.ListHead) && (FileColumn > 1)) {
|
||||||
LastLine = TRUE;
|
LastLine = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1346,7 +1354,7 @@ HBufferImageDoCharInput (
|
|||||||
//
|
//
|
||||||
// DEAL WITH ASCII CHAR, filter out thing like ctrl+f
|
// DEAL WITH ASCII CHAR, filter out thing like ctrl+f
|
||||||
//
|
//
|
||||||
if (Char > 127 || Char < 32) {
|
if ((Char > 127) || (Char < 32)) {
|
||||||
Status = StatusBarSetStatusString (L"Unknown Command");
|
Status = StatusBarSetStatusString (L"Unknown Command");
|
||||||
} else {
|
} else {
|
||||||
Status = HBufferImageAddChar (Char);
|
Status = HBufferImageAddChar (Char);
|
||||||
@ -1461,7 +1469,6 @@ HBufferImageMovePosition (
|
|||||||
} else {
|
} else {
|
||||||
HBufferImage.DisplayPosition.Row += RowGap;
|
HBufferImage.DisplayPosition.Row += RowGap;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1487,7 +1494,6 @@ HBufferImageMovePosition (
|
|||||||
// let CurrentLine point to correct line;
|
// let CurrentLine point to correct line;
|
||||||
//
|
//
|
||||||
HBufferImage.CurrentLine = HMoveCurrentLine (RowGap);
|
HBufferImage.CurrentLine = HMoveCurrentLine (RowGap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1521,6 +1527,7 @@ HBufferImageScrollRight (
|
|||||||
if (FCol > Line->Size) {
|
if (FCol > Line->Size) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if already at end of this line, scroll it to the start of next line
|
// if already at end of this line, scroll it to the start of next line
|
||||||
//
|
//
|
||||||
@ -1531,7 +1538,6 @@ HBufferImageScrollRight (
|
|||||||
if (Line->Link.ForwardLink != HBufferImage.ListHead) {
|
if (Line->Link.ForwardLink != HBufferImage.ListHead) {
|
||||||
FRow++;
|
FRow++;
|
||||||
FCol = 1;
|
FCol = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1540,7 +1546,6 @@ HBufferImageScrollRight (
|
|||||||
// if not at end of this line, just move to next column
|
// if not at end of this line, just move to next column
|
||||||
//
|
//
|
||||||
FCol++;
|
FCol++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HBufferImageMovePosition (FRow, FCol, TRUE);
|
HBufferImageMovePosition (FRow, FCol, TRUE);
|
||||||
@ -1558,7 +1563,6 @@ HBufferImageScrollLeft (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
HEFI_EDITOR_LINE *Line;
|
HEFI_EDITOR_LINE *Line;
|
||||||
UINTN FRow;
|
UINTN FRow;
|
||||||
UINTN FCol;
|
UINTN FCol;
|
||||||
@ -1632,7 +1636,6 @@ HBufferImageScrollDown (
|
|||||||
FCol = Line->Size + 1;
|
FCol = Line->Size + 1;
|
||||||
HighBits = TRUE;
|
HighBits = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1666,7 +1669,6 @@ HBufferImageScrollUp (
|
|||||||
//
|
//
|
||||||
if (Line->Link.BackLink != HBufferImage.ListHead) {
|
if (Line->Link.BackLink != HBufferImage.ListHead) {
|
||||||
FRow--;
|
FRow--;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1709,6 +1711,7 @@ HBufferImagePageDown (
|
|||||||
//
|
//
|
||||||
Gap = HBufferImage.NumLines - FRow;
|
Gap = HBufferImage.NumLines - FRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get correct line
|
// get correct line
|
||||||
//
|
//
|
||||||
@ -1717,7 +1720,7 @@ HBufferImagePageDown (
|
|||||||
//
|
//
|
||||||
// if that line, is not that long, so move to the end of that line
|
// if that line, is not that long, so move to the end of that line
|
||||||
//
|
//
|
||||||
if (Line != NULL && FCol > Line->Size) {
|
if ((Line != NULL) && (FCol > Line->Size)) {
|
||||||
FCol = Line->Size + 1;
|
FCol = Line->Size + 1;
|
||||||
HighBits = TRUE;
|
HighBits = TRUE;
|
||||||
}
|
}
|
||||||
@ -1829,6 +1832,7 @@ HBufferImageEnd (
|
|||||||
FCol = Line->Size + 1;
|
FCol = Line->Size + 1;
|
||||||
HighBits = TRUE;
|
HighBits = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// move cursor position
|
// move cursor position
|
||||||
//
|
//
|
||||||
@ -1928,7 +1932,6 @@ HBufferImageDeleteCharacterFromBuffer (
|
|||||||
// so locate according to block's previous character
|
// so locate according to block's previous character
|
||||||
//
|
//
|
||||||
NewPos = Pos - 1;
|
NewPos = Pos - 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// has no character before it,
|
// has no character before it,
|
||||||
@ -1956,6 +1959,7 @@ HBufferImageDeleteCharacterFromBuffer (
|
|||||||
DeleteBuffer[Index] = BufferPtr[Pos + Index];
|
DeleteBuffer[Index] = BufferPtr[Pos + Index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// delete the part from Pos
|
// delete the part from Pos
|
||||||
//
|
//
|
||||||
@ -1986,7 +1990,7 @@ HBufferImageDeleteCharacterFromBuffer (
|
|||||||
// if current cursor position if inside select area
|
// if current cursor position if inside select area
|
||||||
// then move it to the block's NEXT character
|
// then move it to the block's NEXT character
|
||||||
//
|
//
|
||||||
if (OldPos >= Pos && OldPos < (Pos + Count)) {
|
if ((OldPos >= Pos) && (OldPos < (Pos + Count))) {
|
||||||
NewPos = Pos;
|
NewPos = Pos;
|
||||||
} else {
|
} else {
|
||||||
if (OldPos < Pos) {
|
if (OldPos < Pos) {
|
||||||
@ -2068,6 +2072,7 @@ HBufferImageAddCharacterToBuffer (
|
|||||||
for (Index = (INTN)(Size + Count - 1); Index >= (INTN)Pos; Index--) {
|
for (Index = (INTN)(Size + Count - 1); Index >= (INTN)Pos; Index--) {
|
||||||
BufferPtr[Index] = BufferPtr[Index - Count];
|
BufferPtr[Index] = BufferPtr[Index - Count];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// add the buffer
|
// add the buffer
|
||||||
//
|
//
|
||||||
@ -2112,7 +2117,6 @@ HBufferImageDoDelete (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
HEFI_EDITOR_LINE *Line;
|
HEFI_EDITOR_LINE *Line;
|
||||||
|
|
||||||
BOOLEAN LastLine;
|
BOOLEAN LastLine;
|
||||||
@ -2207,13 +2211,12 @@ HBufferImageBufferToList (
|
|||||||
Line->Buffer[TempJ] = BufferPtr[TempI];
|
Line->Buffer[TempJ] = BufferPtr[TempI];
|
||||||
TempI++;
|
TempI++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// last line is a full line, SO create a new line
|
// last line is a full line, SO create a new line
|
||||||
//
|
//
|
||||||
if (Left == 0x10 || Bytes == 0) {
|
if ((Left == 0x10) || (Bytes == 0)) {
|
||||||
Line = HBufferImageCreateLine ();
|
Line = HBufferImageCreateLine ();
|
||||||
if (Line == NULL) {
|
if (Line == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
@ -2258,7 +2261,6 @@ HBufferImageListToBuffer (
|
|||||||
// deal line by line
|
// deal line by line
|
||||||
//
|
//
|
||||||
while (Link != HBufferImage.ListHead) {
|
while (Link != HBufferImage.ListHead) {
|
||||||
|
|
||||||
Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
|
Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);
|
||||||
|
|
||||||
// @todo shouldn't this be an error???
|
// @todo shouldn't this be an error???
|
||||||
@ -2308,6 +2310,7 @@ HBufferImageAdjustMousePosition (
|
|||||||
} else {
|
} else {
|
||||||
AbsX = -TextX;
|
AbsX = -TextX;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get absolute TempY value
|
// get absolute TempY value
|
||||||
//
|
//
|
||||||
@ -2339,29 +2342,30 @@ HBufferImageAdjustMousePosition (
|
|||||||
TempY = 0;
|
TempY = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// check whether new mouse column position is beyond screen
|
// check whether new mouse column position is beyond screen
|
||||||
// if not, adjust it
|
// if not, adjust it
|
||||||
//
|
//
|
||||||
if (TempX >= 10 && TempX <= (10 + 0x10 * 3 - 1)) {
|
if ((TempX >= 10) && (TempX <= (10 + 0x10 * 3 - 1))) {
|
||||||
HBufferImage.MousePosition.Column = TempX;
|
HBufferImage.MousePosition.Column = TempX;
|
||||||
} else if (TempX < 10) {
|
} else if (TempX < 10) {
|
||||||
HBufferImage.MousePosition.Column = 10;
|
HBufferImage.MousePosition.Column = 10;
|
||||||
} else if (TempX > (10 + 0x10 * 3 - 1)) {
|
} else if (TempX > (10 + 0x10 * 3 - 1)) {
|
||||||
HBufferImage.MousePosition.Column = 10 + 0x10 * 3 - 1;
|
HBufferImage.MousePosition.Column = 10 + 0x10 * 3 - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// check whether new mouse row position is beyond screen
|
// check whether new mouse row position is beyond screen
|
||||||
// if not, adjust it
|
// if not, adjust it
|
||||||
//
|
//
|
||||||
if (TempY >= 2 && TempY <= (HMainEditor.ScreenSize.Row - 1)) {
|
if ((TempY >= 2) && (TempY <= (HMainEditor.ScreenSize.Row - 1))) {
|
||||||
HBufferImage.MousePosition.Row = TempY;
|
HBufferImage.MousePosition.Row = TempY;
|
||||||
} else if (TempY < 2) {
|
} else if (TempY < 2) {
|
||||||
HBufferImage.MousePosition.Row = 2;
|
HBufferImage.MousePosition.Row = 2;
|
||||||
} else if (TempY > (HMainEditor.ScreenSize.Row - 1)) {
|
} else if (TempY > (HMainEditor.ScreenSize.Row - 1)) {
|
||||||
HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 1);
|
HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2466,4 +2470,3 @@ HBufferImageHandleInput (
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,6 @@ HBufferImageMovePosition (
|
|||||||
IN BOOLEAN HighBits
|
IN BOOLEAN HighBits
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new line and append it to the line list.
|
Create a new line and append it to the line list.
|
||||||
Fields affected:
|
Fields affected:
|
||||||
|
@ -53,7 +53,6 @@ HClipBoardCleanup (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (HClipBoard.Buffer);
|
SHELL_FREE_NON_NULL (HClipBoard.Buffer);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -178,6 +178,7 @@ HDiskImageRead (
|
|||||||
StatusBarSetStatusString (L"Cannot Find Device");
|
StatusBarSetStatusString (L"Cannot Find Device");
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
DupDevicePath = DuplicateDevicePath (DevicePath);
|
DupDevicePath = DuplicateDevicePath (DevicePath);
|
||||||
DupDevicePathForFree = DupDevicePath;
|
DupDevicePathForFree = DupDevicePath;
|
||||||
//
|
//
|
||||||
@ -189,16 +190,18 @@ HDiskImageRead (
|
|||||||
StatusBarSetStatusString (L"Read Disk Failed");
|
StatusBarSetStatusString (L"Read Disk Failed");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
Status = gBS->OpenProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
StatusBarSetStatusString (L"Read Disk Failed");
|
StatusBarSetStatusString (L"Read Disk Failed");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if Offset exceeds LastBlock,
|
// if Offset exceeds LastBlock,
|
||||||
// return error
|
// return error
|
||||||
//
|
//
|
||||||
if (Offset > BlkIo->Media->LastBlock || Offset + Size > BlkIo->Media->LastBlock) {
|
if ((Offset > BlkIo->Media->LastBlock) || (Offset + Size > BlkIo->Media->LastBlock)) {
|
||||||
StatusBarSetStatusString (L"Invalid Offset + Size");
|
StatusBarSetStatusString (L"Invalid Offset + Size");
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
@ -246,6 +249,7 @@ HDiskImageRead (
|
|||||||
StatusBarSetStatusString (L"Read Disk Failed");
|
StatusBarSetStatusString (L"Read Disk Failed");
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize some variables
|
// initialize some variables
|
||||||
//
|
//
|
||||||
@ -275,7 +279,6 @@ HDiskImageRead (
|
|||||||
|
|
||||||
HMainEditor.SelectStart = 0;
|
HMainEditor.SelectStart = 0;
|
||||||
HMainEditor.SelectEnd = 0;
|
HMainEditor.SelectEnd = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -329,7 +332,6 @@ HDiskImageSave (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DupDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *DupDevicePath;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DupDevicePathForFree;
|
EFI_DEVICE_PATH_PROTOCOL *DupDevicePathForFree;
|
||||||
@ -353,6 +355,7 @@ HDiskImageSave (
|
|||||||
// StatusBarSetStatusString (L"Cannot Find Device");
|
// StatusBarSetStatusString (L"Cannot Find Device");
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
DupDevicePath = DuplicateDevicePath (DevicePath);
|
DupDevicePath = DuplicateDevicePath (DevicePath);
|
||||||
DupDevicePathForFree = DupDevicePath;
|
DupDevicePathForFree = DupDevicePath;
|
||||||
|
|
||||||
@ -365,6 +368,7 @@ HDiskImageSave (
|
|||||||
// StatusBarSetStatusString (L"Read Disk Failed");
|
// StatusBarSetStatusString (L"Read Disk Failed");
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
Status = gBS->OpenProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
// StatusBarSetStatusString (L"Read Disk Failed");
|
// StatusBarSetStatusString (L"Read Disk Failed");
|
||||||
@ -377,6 +381,7 @@ HDiskImageSave (
|
|||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// concatenate the line list to a buffer
|
// concatenate the line list to a buffer
|
||||||
//
|
//
|
||||||
@ -402,6 +407,7 @@ HDiskImageSave (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// now not modified
|
// now not modified
|
||||||
//
|
//
|
||||||
|
@ -84,7 +84,6 @@ HFileImageCleanup (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (HFileImage.FileName);
|
SHELL_FREE_NON_NULL (HFileImage.FileName);
|
||||||
SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName);
|
SHELL_FREE_NON_NULL (HFileImageBackupVar.FileName);
|
||||||
|
|
||||||
@ -111,6 +110,7 @@ HFileImageSetFileName (
|
|||||||
//
|
//
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// free the old file name
|
// free the old file name
|
||||||
//
|
//
|
||||||
@ -161,7 +161,7 @@ HFileImageRead (
|
|||||||
//
|
//
|
||||||
// NULL pointer is only also a failure for a non-zero file size.
|
// NULL pointer is only also a failure for a non-zero file size.
|
||||||
//
|
//
|
||||||
if ((EFI_ERROR(Status)) || (Buffer == NULL && HFileImage.Size != 0)) {
|
if ((EFI_ERROR (Status)) || ((Buffer == NULL) && (HFileImage.Size != 0))) {
|
||||||
UnicodeBuffer = CatSPrint (NULL, L"Read error on file %s: %r", FileName, Status);
|
UnicodeBuffer = CatSPrint (NULL, L"Read error on file %s: %r", FileName, Status);
|
||||||
if (UnicodeBuffer == NULL) {
|
if (UnicodeBuffer == NULL) {
|
||||||
SHELL_FREE_NON_NULL (Buffer);
|
SHELL_FREE_NON_NULL (Buffer);
|
||||||
@ -251,7 +251,6 @@ HFileImageSave (
|
|||||||
IN CHAR16 *FileName
|
IN CHAR16 *FileName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
HEFI_EDITOR_LINE *Line;
|
HEFI_EDITOR_LINE *Line;
|
||||||
CHAR16 *Str;
|
CHAR16 *Str;
|
||||||
@ -269,7 +268,7 @@ HFileImageSave (
|
|||||||
//
|
//
|
||||||
// if is the old file
|
// if is the old file
|
||||||
//
|
//
|
||||||
if (HFileImage.FileName != NULL && FileName != NULL && StrCmp (FileName, HFileImage.FileName) == 0) {
|
if ((HFileImage.FileName != NULL) && (FileName != NULL) && (StrCmp (FileName, HFileImage.FileName) == 0)) {
|
||||||
//
|
//
|
||||||
// check whether file exists on disk
|
// check whether file exists on disk
|
||||||
//
|
//
|
||||||
@ -281,6 +280,7 @@ HFileImageSave (
|
|||||||
if (HBufferImage.Modified == FALSE) {
|
if (HBufferImage.Modified == FALSE) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if file is read-only, set error
|
// if file is read-only, set error
|
||||||
//
|
//
|
||||||
@ -303,7 +303,7 @@ HFileImageSave (
|
|||||||
// the file exits, delete it
|
// the file exits, delete it
|
||||||
//
|
//
|
||||||
Status = ShellDeleteFile (&FileHandle);
|
Status = ShellDeleteFile (&FileHandle);
|
||||||
if (EFI_ERROR (Status) || Status == EFI_WARN_DELETE_FAILURE) {
|
if (EFI_ERROR (Status) || (Status == EFI_WARN_DELETE_FAILURE)) {
|
||||||
StatusBarSetStatusString (L"Write File Failed");
|
StatusBarSetStatusString (L"Write File Failed");
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
@ -320,11 +320,13 @@ HFileImageSave (
|
|||||||
if (Line->Size != 0) {
|
if (Line->Size != 0) {
|
||||||
TotalSize += Line->Size;
|
TotalSize += Line->Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of if Line -> Size != 0
|
// end of if Line -> Size != 0
|
||||||
//
|
//
|
||||||
NumLines++;
|
NumLines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of for Link
|
// end of for Link
|
||||||
//
|
//
|
||||||
@ -341,12 +343,12 @@ HFileImageSave (
|
|||||||
CopyMem (Ptr, Line->Buffer, Line->Size);
|
CopyMem (Ptr, Line->Buffer, Line->Size);
|
||||||
Ptr += Line->Size;
|
Ptr += Line->Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of if Line -> Size != 0
|
// end of if Line -> Size != 0
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -375,8 +377,9 @@ HFileImageSave (
|
|||||||
//
|
//
|
||||||
// now everything is ready , you can set the new file name to filebuffer
|
// now everything is ready , you can set the new file name to filebuffer
|
||||||
//
|
//
|
||||||
if ((BufferTypeBackup != FileTypeFileBuffer && FileName != NULL) ||
|
if (((BufferTypeBackup != FileTypeFileBuffer) && (FileName != NULL)) ||
|
||||||
(FileName != NULL && HFileImage.FileName != NULL && StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0)){
|
((FileName != NULL) && (HFileImage.FileName != NULL) && (StringNoCaseCompare (&FileName, &HFileImage.FileName) != 0)))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// not the same
|
// not the same
|
||||||
//
|
//
|
||||||
|
@ -67,7 +67,7 @@ ShellCommandRunHexEdit (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"hexedit", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"hexedit", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -91,7 +91,8 @@ ShellCommandRunHexEdit (
|
|||||||
Offset = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 2));
|
Offset = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 2));
|
||||||
Size = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 3));
|
Size = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 3));
|
||||||
}
|
}
|
||||||
if (Offset == (UINTN)-1 || Size == (UINTN)-1) {
|
|
||||||
|
if ((Offset == (UINTN)-1) || (Size == (UINTN)-1)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"hexedit", L"-d");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"hexedit", L"-d");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -109,7 +110,7 @@ ShellCommandRunHexEdit (
|
|||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
Name = ShellCommandLineGetRawValue (Package, 1);
|
Name = ShellCommandLineGetRawValue (Package, 1);
|
||||||
if (Name == NULL || !IsValidFileName(Name)) {
|
if ((Name == NULL) || !IsValidFileName (Name)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"hexedit", Name);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@ -134,8 +135,9 @@ ShellCommandRunHexEdit (
|
|||||||
Size = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 2));
|
Size = ShellStrToUintn (ShellCommandLineGetRawValue (Package, 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Name = ShellCommandLineGetRawValue (Package, 1);
|
Name = ShellCommandLineGetRawValue (Package, 1);
|
||||||
if (WhatToDo == FileTypeNone && Name != NULL) {
|
if ((WhatToDo == FileTypeNone) && (Name != NULL)) {
|
||||||
if (ShellCommandLineGetCount (Package) > 2) {
|
if (ShellCommandLineGetCount (Package) > 2) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"hexedit");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -156,10 +158,10 @@ ShellCommandRunHexEdit (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellStatus == SHELL_SUCCESS && WhatToDo == FileTypeNone) {
|
if ((ShellStatus == SHELL_SUCCESS) && (WhatToDo == FileTypeNone)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"hexedit");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
} else if (WhatToDo == FileTypeFileBuffer && ShellGetCurrentDir(NULL) == NULL) {
|
} else if ((WhatToDo == FileTypeFileBuffer) && (ShellGetCurrentDir (NULL) == NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellDebug1HiiHandle, L"hexedit");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellDebug1HiiHandle, L"hexedit");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -219,10 +221,12 @@ ShellCommandRunHexEdit (
|
|||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
HMainEditorRefresh ();
|
HMainEditorRefresh ();
|
||||||
Status = HMainEditorKeyInput ();
|
Status = HMainEditorKeyInput ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status != EFI_OUT_OF_RESOURCES) {
|
if (Status != EFI_OUT_OF_RESOURCES) {
|
||||||
//
|
//
|
||||||
// back up the status string
|
// back up the status string
|
||||||
@ -262,6 +266,7 @@ ShellCommandRunHexEdit (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#define ASCII_POSITION ((0x10 * 3) + 12)
|
#define ASCII_POSITION ((0x10 * 3) + 12)
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Row;
|
UINTN Row;
|
||||||
UINTN Column;
|
UINTN Column;
|
||||||
@ -62,7 +61,6 @@ typedef struct {
|
|||||||
UINTN Rows;
|
UINTN Rows;
|
||||||
} HEFI_EDITOR_TEXT_MODE;
|
} HEFI_EDITOR_TEXT_MODE;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CHAR16 *Name;
|
CHAR16 *Name;
|
||||||
|
|
||||||
@ -99,7 +97,6 @@ typedef struct {
|
|||||||
HEFI_EDITOR_FILE_IMAGE *FileImage;
|
HEFI_EDITOR_FILE_IMAGE *FileImage;
|
||||||
HEFI_EDITOR_DISK_IMAGE *DiskImage;
|
HEFI_EDITOR_DISK_IMAGE *DiskImage;
|
||||||
HEFI_EDITOR_MEM_IMAGE *MemImage;
|
HEFI_EDITOR_MEM_IMAGE *MemImage;
|
||||||
|
|
||||||
} HEFI_EDITOR_BUFFER_IMAGE;
|
} HEFI_EDITOR_BUFFER_IMAGE;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -89,7 +89,6 @@ EFI_STRING_ID HexMainMenuHelpInfo[] = {
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
show help menu.
|
show help menu.
|
||||||
|
|
||||||
@ -110,8 +109,12 @@ HMainCommandDisplayHelp (
|
|||||||
// print helpInfo
|
// print helpInfo
|
||||||
//
|
//
|
||||||
for (CurrentLine = 0; 0 != HexMainMenuHelpInfo[CurrentLine]; CurrentLine++) {
|
for (CurrentLine = 0; 0 != HexMainMenuHelpInfo[CurrentLine]; CurrentLine++) {
|
||||||
InfoString = HiiGetString(gShellDebug1HiiHandle, HexMainMenuHelpInfo[CurrentLine]
|
InfoString = HiiGetString (
|
||||||
, NULL);
|
gShellDebug1HiiHandle,
|
||||||
|
HexMainMenuHelpInfo[CurrentLine]
|
||||||
|
,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
ShellPrintEx (0, CurrentLine+1, L"%E%s%N", InfoString);
|
ShellPrintEx (0, CurrentLine+1, L"%E%s%N", InfoString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,13 +126,15 @@ HMainCommandDisplayHelp (
|
|||||||
if (EFI_ERROR (Status) || (EventIndex != 0)) {
|
if (EFI_ERROR (Status) || (EventIndex != 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.TextInputEx, &KeyData);
|
Status = HMainEditor.TextInputEx->ReadKeyStrokeEx (HMainEditor.TextInputEx, &KeyData);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
||||||
(KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) {
|
(KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// For consoles that don't support/report shift state,
|
// For consoles that don't support/report shift state,
|
||||||
// CTRL+W is translated to L'W' - L'A' + 1.
|
// CTRL+W is translated to L'W' - L'A' + 1.
|
||||||
@ -139,7 +144,8 @@ HMainCommandDisplayHelp (
|
|||||||
}
|
}
|
||||||
} else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
} else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
||||||
((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) &&
|
((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) &&
|
||||||
((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0)) {
|
((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// For consoles that supports/reports shift state,
|
// For consoles that supports/reports shift state,
|
||||||
// make sure that only CONTROL shift key is pressed.
|
// make sure that only CONTROL shift key is pressed.
|
||||||
@ -202,9 +208,9 @@ HMainCommandGoToOffset (
|
|||||||
// ESC pressed
|
// ESC pressed
|
||||||
//
|
//
|
||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// THE input string length should > 0
|
// THE input string length should > 0
|
||||||
//
|
//
|
||||||
@ -268,6 +274,7 @@ HMainCommandSaveBuffer (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the answer is just one character
|
// the answer is just one character
|
||||||
//
|
//
|
||||||
@ -275,6 +282,7 @@ HMainCommandSaveBuffer (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// loop for user's answer
|
// loop for user's answer
|
||||||
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
||||||
@ -323,14 +331,17 @@ HMainCommandSaveBuffer (
|
|||||||
case L'C':
|
case L'C':
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of switch
|
// end of switch
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ENDOF WHILE
|
// ENDOF WHILE
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ENDOF != FILEBUFFER
|
// ENDOF != FILEBUFFER
|
||||||
//
|
//
|
||||||
@ -369,7 +380,8 @@ HMainCommandSaveBuffer (
|
|||||||
// 7. Update File Name field in Title Bar to B
|
// 7. Update File Name field in Title Bar to B
|
||||||
// and remove the Modified flag in Title Bar.
|
// and remove the Modified flag in Title Bar.
|
||||||
//
|
//
|
||||||
Str = CatSPrint(NULL,
|
Str = CatSPrint (
|
||||||
|
NULL,
|
||||||
L"File to Save: [%s]",
|
L"File to Save: [%s]",
|
||||||
HMainEditor.BufferImage->FileImage->FileName
|
HMainEditor.BufferImage->FileImage->FileName
|
||||||
);
|
);
|
||||||
@ -397,6 +409,7 @@ HMainCommandSaveBuffer (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get new file name
|
// get new file name
|
||||||
//
|
//
|
||||||
@ -416,7 +429,8 @@ HMainCommandSaveBuffer (
|
|||||||
// if just enter pressed, so think save to current file name
|
// if just enter pressed, so think save to current file name
|
||||||
//
|
//
|
||||||
if (StrLen (InputBarGetString ()) == 0) {
|
if (StrLen (InputBarGetString ()) == 0) {
|
||||||
FileName = CatSPrint(NULL,
|
FileName = CatSPrint (
|
||||||
|
NULL,
|
||||||
L"%s",
|
L"%s",
|
||||||
HMainEditor.BufferImage->FileImage->FileName
|
HMainEditor.BufferImage->FileImage->FileName
|
||||||
);
|
);
|
||||||
@ -442,7 +456,8 @@ HMainCommandSaveBuffer (
|
|||||||
if (StringNoCaseCompare (
|
if (StringNoCaseCompare (
|
||||||
&FileName,
|
&FileName,
|
||||||
&HMainEditor.BufferImage->FileImage->FileName
|
&HMainEditor.BufferImage->FileImage->FileName
|
||||||
) == 0) {
|
) == 0)
|
||||||
|
{
|
||||||
OldFile = TRUE;
|
OldFile = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +474,6 @@ HMainCommandSaveBuffer (
|
|||||||
Status = ShellOpenFileByName (FileName, &ShellFileHandle, EFI_FILE_MODE_READ, 0);
|
Status = ShellOpenFileByName (FileName, &ShellFileHandle, EFI_FILE_MODE_READ, 0);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
Info = ShellGetFileInfo (ShellFileHandle);
|
Info = ShellGetFileInfo (ShellFileHandle);
|
||||||
|
|
||||||
ShellCloseFile (&ShellFileHandle);
|
ShellCloseFile (&ShellFileHandle);
|
||||||
@ -562,7 +576,7 @@ HMainCommandSelectStart (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HMainEditor.SelectEnd != 0 && Start > HMainEditor.SelectEnd) {
|
if ((HMainEditor.SelectEnd != 0) && (Start > HMainEditor.SelectEnd)) {
|
||||||
StatusBarSetStatusString (L"Invalid Block Start");
|
StatusBarSetStatusString (L"Invalid Block Start");
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
@ -600,7 +614,7 @@ HMainCommandSelectEnd (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HMainEditor.SelectStart != 0 && End < HMainEditor.SelectStart) {
|
if ((HMainEditor.SelectStart != 0) && (End < HMainEditor.SelectStart)) {
|
||||||
StatusBarSetStatusString (L"Invalid Block End");
|
StatusBarSetStatusString (L"Invalid Block End");
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -636,6 +650,7 @@ HMainCommandCut (
|
|||||||
StatusBarSetStatusString (L"No Block is Selected");
|
StatusBarSetStatusString (L"No Block is Selected");
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// not select, so not allowed to cut
|
// not select, so not allowed to cut
|
||||||
//
|
//
|
||||||
@ -654,6 +669,7 @@ HMainCommandCut (
|
|||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// cut the selected area
|
// cut the selected area
|
||||||
//
|
//
|
||||||
@ -696,7 +712,6 @@ HMainCommandPaste (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
BOOLEAN OnlyLineRefresh;
|
BOOLEAN OnlyLineRefresh;
|
||||||
HEFI_EDITOR_LINE *Line;
|
HEFI_EDITOR_LINE *Line;
|
||||||
UINT8 *Buffer;
|
UINT8 *Buffer;
|
||||||
@ -704,7 +719,7 @@ HMainCommandPaste (
|
|||||||
UINTN FPos;
|
UINTN FPos;
|
||||||
|
|
||||||
Count = HClipBoardGet (&Buffer);
|
Count = HClipBoardGet (&Buffer);
|
||||||
if (Count == 0 || Buffer == NULL) {
|
if ((Count == 0) || (Buffer == NULL)) {
|
||||||
StatusBarSetStatusString (L"Nothing to Paste");
|
StatusBarSetStatusString (L"Nothing to Paste");
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -712,7 +727,7 @@ HMainCommandPaste (
|
|||||||
Line = HMainEditor.BufferImage->CurrentLine;
|
Line = HMainEditor.BufferImage->CurrentLine;
|
||||||
|
|
||||||
OnlyLineRefresh = FALSE;
|
OnlyLineRefresh = FALSE;
|
||||||
if (Line->Link.ForwardLink == HMainEditor.BufferImage->ListHead && Line->Size + Count < 0x10) {
|
if ((Line->Link.ForwardLink == HMainEditor.BufferImage->ListHead) && (Line->Size + Count < 0x10)) {
|
||||||
//
|
//
|
||||||
// is at last line, and after paste will not exceed
|
// is at last line, and after paste will not exceed
|
||||||
// so only this line need to be refreshed
|
// so only this line need to be refreshed
|
||||||
@ -721,7 +736,6 @@ HMainCommandPaste (
|
|||||||
// so the whole page will need be refreshed
|
// so the whole page will need be refreshed
|
||||||
//
|
//
|
||||||
OnlyLineRefresh = TRUE;
|
OnlyLineRefresh = TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FPos = 0x10 * (HMainEditor.BufferImage->BufferPosition.Row - 1) + HMainEditor.BufferImage->BufferPosition.Column - 1;
|
FPos = 0x10 * (HMainEditor.BufferImage->BufferPosition.Row - 1) + HMainEditor.BufferImage->BufferPosition.Column - 1;
|
||||||
@ -741,7 +755,6 @@ HMainCommandPaste (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -777,7 +790,6 @@ HMainCommandExit (
|
|||||||
// whether to save the changes
|
// whether to save the changes
|
||||||
//
|
//
|
||||||
if (HMainEditor.BufferImage->Modified) {
|
if (HMainEditor.BufferImage->Modified) {
|
||||||
|
|
||||||
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
|
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
@ -827,14 +839,12 @@ HMainCommandExit (
|
|||||||
case L'c':
|
case L'c':
|
||||||
case L'C':
|
case L'C':
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HEditorExit = TRUE;
|
HEditorExit = TRUE;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -886,11 +896,11 @@ HMainCommandOpenFile (
|
|||||||
// save it first.
|
// save it first.
|
||||||
//
|
//
|
||||||
if (HMainEditor.BufferImage->Modified) {
|
if (HMainEditor.BufferImage->Modified) {
|
||||||
|
|
||||||
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
|
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the answer is just one character
|
// the answer is just one character
|
||||||
//
|
//
|
||||||
@ -898,6 +908,7 @@ HMainCommandOpenFile (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// loop for user's answer
|
// loop for user's answer
|
||||||
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
||||||
@ -959,6 +970,7 @@ HMainCommandOpenFile (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TO get the open file name
|
// TO get the open file name
|
||||||
//
|
//
|
||||||
@ -1012,6 +1024,7 @@ HMainCommandOpenFile (
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// THE input string length should > 0
|
// THE input string length should > 0
|
||||||
//
|
//
|
||||||
@ -1038,6 +1051,7 @@ HMainCommandOpenFile (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// read from disk
|
// read from disk
|
||||||
//
|
//
|
||||||
@ -1103,11 +1117,11 @@ HMainCommandOpenDisk (
|
|||||||
// whether to save it first.
|
// whether to save it first.
|
||||||
//
|
//
|
||||||
if (HMainEditor.BufferImage->Modified) {
|
if (HMainEditor.BufferImage->Modified) {
|
||||||
|
|
||||||
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
|
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the answer is just one character
|
// the answer is just one character
|
||||||
//
|
//
|
||||||
@ -1115,6 +1129,7 @@ HMainCommandOpenDisk (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// loop for user's answer
|
// loop for user's answer
|
||||||
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
||||||
@ -1176,6 +1191,7 @@ HMainCommandOpenDisk (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get disk block device name
|
// get disk block device name
|
||||||
//
|
//
|
||||||
@ -1196,9 +1212,9 @@ HMainCommandOpenDisk (
|
|||||||
// ESC pressed
|
// ESC pressed
|
||||||
//
|
//
|
||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// THE input string length should > 0
|
// THE input string length should > 0
|
||||||
//
|
//
|
||||||
@ -1211,6 +1227,7 @@ HMainCommandOpenDisk (
|
|||||||
if (DeviceName == NULL) {
|
if (DeviceName == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get starting offset
|
// get starting offset
|
||||||
//
|
//
|
||||||
@ -1231,9 +1248,9 @@ HMainCommandOpenDisk (
|
|||||||
// ESC pressed
|
// ESC pressed
|
||||||
//
|
//
|
||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// THE input string length should > 0
|
// THE input string length should > 0
|
||||||
//
|
//
|
||||||
@ -1246,6 +1263,7 @@ HMainCommandOpenDisk (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get Number of Blocks:
|
// get Number of Blocks:
|
||||||
//
|
//
|
||||||
@ -1266,9 +1284,9 @@ HMainCommandOpenDisk (
|
|||||||
// ESC pressed
|
// ESC pressed
|
||||||
//
|
//
|
||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// THE input string length should > 0
|
// THE input string length should > 0
|
||||||
//
|
//
|
||||||
@ -1298,7 +1316,6 @@ HMainCommandOpenDisk (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
|
||||||
HBufferImageRead (
|
HBufferImageRead (
|
||||||
HMainEditor.BufferImage->FileImage->FileName,
|
HMainEditor.BufferImage->FileImage->FileName,
|
||||||
HMainEditor.BufferImage->DiskImage->Name,
|
HMainEditor.BufferImage->DiskImage->Name,
|
||||||
@ -1346,11 +1363,11 @@ HMainCommandOpenMemory (
|
|||||||
// whether to save it first.
|
// whether to save it first.
|
||||||
//
|
//
|
||||||
if (HMainEditor.BufferImage->Modified) {
|
if (HMainEditor.BufferImage->Modified) {
|
||||||
|
|
||||||
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
|
Status = InputBarSetPrompt (L"Buffer modified. Save (Yes/No/Cancel) ? ");
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// the answer is just one character
|
// the answer is just one character
|
||||||
//
|
//
|
||||||
@ -1358,6 +1375,7 @@ HMainCommandOpenMemory (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// loop for user's answer
|
// loop for user's answer
|
||||||
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
||||||
@ -1419,6 +1437,7 @@ HMainCommandOpenMemory (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get starting offset
|
// get starting offset
|
||||||
//
|
//
|
||||||
@ -1439,9 +1458,9 @@ HMainCommandOpenMemory (
|
|||||||
// ESC pressed
|
// ESC pressed
|
||||||
//
|
//
|
||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// THE input string length should > 0
|
// THE input string length should > 0
|
||||||
//
|
//
|
||||||
@ -1454,6 +1473,7 @@ HMainCommandOpenMemory (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// get Number of Blocks:
|
// get Number of Blocks:
|
||||||
//
|
//
|
||||||
@ -1474,9 +1494,9 @@ HMainCommandOpenMemory (
|
|||||||
// ESC pressed
|
// ESC pressed
|
||||||
//
|
//
|
||||||
if (Status == EFI_NOT_READY) {
|
if (Status == EFI_NOT_READY) {
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// THE input string length should > 0
|
// THE input string length should > 0
|
||||||
//
|
//
|
||||||
@ -1524,8 +1544,8 @@ HMainCommandOpenMemory (
|
|||||||
);
|
);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
return EFI_SUCCESS;
|
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
MENU_ITEM_FUNCTION HexMainControlBasedMenuFunctions[] = {
|
MENU_ITEM_FUNCTION HexMainControlBasedMenuFunctions[] = {
|
||||||
@ -1695,7 +1715,7 @@ HMainEditorInit (
|
|||||||
&HandleCount,
|
&HandleCount,
|
||||||
&HandleBuffer
|
&HandleBuffer
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status) && HandleCount > 0) {
|
if (!EFI_ERROR (Status) && (HandleCount > 0)) {
|
||||||
//
|
//
|
||||||
// Try to find the first available mouse device
|
// Try to find the first available mouse device
|
||||||
//
|
//
|
||||||
@ -1710,12 +1730,13 @@ HMainEditorInit (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
FreePool (HandleBuffer);
|
FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EFI_ERROR (Status) && HMainEditor.MouseInterface != NULL) {
|
if (!EFI_ERROR (Status) && (HMainEditor.MouseInterface != NULL)) {
|
||||||
HMainEditor.MouseAccumulatorX = 0;
|
HMainEditor.MouseAccumulatorX = 0;
|
||||||
HMainEditor.MouseAccumulatorY = 0;
|
HMainEditor.MouseAccumulatorY = 0;
|
||||||
HMainEditor.MouseSupported = TRUE;
|
HMainEditor.MouseSupported = TRUE;
|
||||||
@ -1735,6 +1756,7 @@ HMainEditorInit (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = MenuBarInit (HexEditorMenuItems);
|
Status = MenuBarInit (HexEditorMenuItems);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
||||||
@ -1760,6 +1782,7 @@ HMainEditorInit (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_CLIPBOARD), gShellDebug1HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_CLIPBOARD), gShellDebug1HiiHandle);
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// clear whole screen and enable cursor
|
// clear whole screen and enable cursor
|
||||||
//
|
//
|
||||||
@ -1809,6 +1832,7 @@ HMainEditorCleanup (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_CLIPBOARD_CLEAN), gShellDebug1HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_CLIPBOARD_CLEAN), gShellDebug1HiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// restore old mode
|
// restore old mode
|
||||||
//
|
//
|
||||||
@ -1842,31 +1866,36 @@ HMainEditorRefresh (
|
|||||||
ReadChange = FALSE;
|
ReadChange = FALSE;
|
||||||
|
|
||||||
if (HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer) {
|
if (HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer) {
|
||||||
if (HMainEditor.BufferImage->DiskImage != NULL &&
|
if ((HMainEditor.BufferImage->DiskImage != NULL) &&
|
||||||
HBufferImageBackupVar.DiskImage != NULL &&
|
(HBufferImageBackupVar.DiskImage != NULL) &&
|
||||||
(HMainEditor.BufferImage->DiskImage->Offset != HBufferImageBackupVar.DiskImage->Offset ||
|
((HMainEditor.BufferImage->DiskImage->Offset != HBufferImageBackupVar.DiskImage->Offset) ||
|
||||||
HMainEditor.BufferImage->DiskImage->Size != HBufferImageBackupVar.DiskImage->Size) ){
|
(HMainEditor.BufferImage->DiskImage->Size != HBufferImageBackupVar.DiskImage->Size)))
|
||||||
|
{
|
||||||
NameChange = TRUE;
|
NameChange = TRUE;
|
||||||
}
|
}
|
||||||
} else if (HMainEditor.BufferImage->BufferType == FileTypeMemBuffer) {
|
} else if (HMainEditor.BufferImage->BufferType == FileTypeMemBuffer) {
|
||||||
if (HMainEditor.BufferImage->MemImage != NULL &&
|
if ((HMainEditor.BufferImage->MemImage != NULL) &&
|
||||||
HBufferImageBackupVar.MemImage != NULL &&
|
(HBufferImageBackupVar.MemImage != NULL) &&
|
||||||
(HMainEditor.BufferImage->MemImage->Offset != HBufferImageBackupVar.MemImage->Offset ||
|
((HMainEditor.BufferImage->MemImage->Offset != HBufferImageBackupVar.MemImage->Offset) ||
|
||||||
HMainEditor.BufferImage->MemImage->Size != HBufferImageBackupVar.MemImage->Size) ){
|
(HMainEditor.BufferImage->MemImage->Size != HBufferImageBackupVar.MemImage->Size)))
|
||||||
|
{
|
||||||
NameChange = TRUE;
|
NameChange = TRUE;
|
||||||
}
|
}
|
||||||
} else if (HMainEditor.BufferImage->BufferType == FileTypeFileBuffer) {
|
} else if (HMainEditor.BufferImage->BufferType == FileTypeFileBuffer) {
|
||||||
if ( HMainEditor.BufferImage->FileImage != NULL &&
|
if ((HMainEditor.BufferImage->FileImage != NULL) &&
|
||||||
HMainEditor.BufferImage->FileImage->FileName != NULL &&
|
(HMainEditor.BufferImage->FileImage->FileName != NULL) &&
|
||||||
HBufferImageBackupVar.FileImage != NULL &&
|
(HBufferImageBackupVar.FileImage != NULL) &&
|
||||||
HBufferImageBackupVar.FileImage->FileName != NULL &&
|
(HBufferImageBackupVar.FileImage->FileName != NULL) &&
|
||||||
StrCmp (HMainEditor.BufferImage->FileImage->FileName, HBufferImageBackupVar.FileImage->FileName) != 0 ) {
|
(StrCmp (HMainEditor.BufferImage->FileImage->FileName, HBufferImageBackupVar.FileImage->FileName) != 0))
|
||||||
|
{
|
||||||
NameChange = TRUE;
|
NameChange = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( HMainEditor.BufferImage->FileImage != NULL &&
|
|
||||||
HBufferImageBackupVar.FileImage != NULL &&
|
if ((HMainEditor.BufferImage->FileImage != NULL) &&
|
||||||
HMainEditor.BufferImage->FileImage->ReadOnly != HBufferImageBackupVar.FileImage->ReadOnly ) {
|
(HBufferImageBackupVar.FileImage != NULL) &&
|
||||||
|
(HMainEditor.BufferImage->FileImage->ReadOnly != HBufferImageBackupVar.FileImage->ReadOnly))
|
||||||
|
{
|
||||||
ReadChange = TRUE;
|
ReadChange = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1881,10 +1910,10 @@ HMainEditorRefresh (
|
|||||||
//
|
//
|
||||||
if ( HEditorFirst
|
if ( HEditorFirst
|
||||||
|| NameChange
|
|| NameChange
|
||||||
|| HMainEditor.BufferImage->BufferType != HBufferImageBackupVar.BufferType
|
|| (HMainEditor.BufferImage->BufferType != HBufferImageBackupVar.BufferType)
|
||||||
|| HBufferImageBackupVar.Modified != HMainEditor.BufferImage->Modified
|
|| (HBufferImageBackupVar.Modified != HMainEditor.BufferImage->Modified)
|
||||||
|| ReadChange ) {
|
|| ReadChange )
|
||||||
|
{
|
||||||
MainTitleBarRefresh (
|
MainTitleBarRefresh (
|
||||||
HMainEditor.BufferImage->BufferType == FileTypeFileBuffer && HMainEditor.BufferImage->FileImage != NULL ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer && HMainEditor.BufferImage->DiskImage != NULL ? HMainEditor.BufferImage->DiskImage->Name : NULL,
|
HMainEditor.BufferImage->BufferType == FileTypeFileBuffer && HMainEditor.BufferImage->FileImage != NULL ? HMainEditor.BufferImage->FileImage->FileName : HMainEditor.BufferImage->BufferType == FileTypeDiskBuffer && HMainEditor.BufferImage->DiskImage != NULL ? HMainEditor.BufferImage->DiskImage->Name : NULL,
|
||||||
HMainEditor.BufferImage->BufferType,
|
HMainEditor.BufferImage->BufferType,
|
||||||
@ -1897,11 +1926,12 @@ HMainEditorRefresh (
|
|||||||
);
|
);
|
||||||
HBufferImageRefresh ();
|
HBufferImageRefresh ();
|
||||||
}
|
}
|
||||||
if (HEditorFirst
|
|
||||||
|| HBufferImageBackupVar.DisplayPosition.Row != HMainEditor.BufferImage->DisplayPosition.Row
|
|
||||||
|| HBufferImageBackupVar.DisplayPosition.Column != HMainEditor.BufferImage->DisplayPosition.Column
|
|
||||||
|| StatusBarGetRefresh()) {
|
|
||||||
|
|
||||||
|
if ( HEditorFirst
|
||||||
|
|| (HBufferImageBackupVar.DisplayPosition.Row != HMainEditor.BufferImage->DisplayPosition.Row)
|
||||||
|
|| (HBufferImageBackupVar.DisplayPosition.Column != HMainEditor.BufferImage->DisplayPosition.Column)
|
||||||
|
|| StatusBarGetRefresh ())
|
||||||
|
{
|
||||||
StatusBarRefresh (
|
StatusBarRefresh (
|
||||||
HEditorFirst,
|
HEditorFirst,
|
||||||
HMainEditor.ScreenSize.Row,
|
HMainEditor.ScreenSize.Row,
|
||||||
@ -1942,7 +1972,6 @@ HMainEditorHandleMouseInput (
|
|||||||
OUT BOOLEAN *BeforeLeftButtonDown
|
OUT BOOLEAN *BeforeLeftButtonDown
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
INT32 TextX;
|
INT32 TextX;
|
||||||
INT32 TextY;
|
INT32 TextY;
|
||||||
UINTN FRow;
|
UINTN FRow;
|
||||||
@ -1968,7 +1997,6 @@ HMainEditorHandleMouseInput (
|
|||||||
HBufferImageAdjustMousePosition (TextX, TextY);
|
HBufferImageAdjustMousePosition (TextX, TextY);
|
||||||
|
|
||||||
Action = TRUE;
|
Action = TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MouseState.LeftButton) {
|
if (MouseState.LeftButton) {
|
||||||
@ -2003,7 +2031,6 @@ HMainEditorHandleMouseInput (
|
|||||||
}
|
}
|
||||||
|
|
||||||
HighBits = TRUE;
|
HighBits = TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FRow = HMainEditor.BufferImage->BufferPosition.Row +
|
FRow = HMainEditor.BufferImage->BufferPosition.Row +
|
||||||
@ -2046,7 +2073,6 @@ HMainEditorHandleMouseInput (
|
|||||||
FRow = 1;
|
FRow = 1;
|
||||||
FCol = 1;
|
FCol = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FCol = Line->Size;
|
FCol = Line->Size;
|
||||||
}
|
}
|
||||||
@ -2074,6 +2100,7 @@ HMainEditorHandleMouseInput (
|
|||||||
if (*BeforeLeftButtonDown) {
|
if (*BeforeLeftButtonDown) {
|
||||||
Action = TRUE;
|
Action = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// mouse up
|
// mouse up
|
||||||
//
|
//
|
||||||
@ -2128,7 +2155,6 @@ HMainEditorKeyInput (
|
|||||||
MouseDrag = FALSE;
|
MouseDrag = FALSE;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
HEditorMouseAction = FALSE;
|
HEditorMouseAction = FALSE;
|
||||||
@ -2152,7 +2178,6 @@ HMainEditorKeyInput (
|
|||||||
&MouseState
|
&MouseState
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
BeforeMouseIsDown = MouseIsDown;
|
BeforeMouseIsDown = MouseIsDown;
|
||||||
|
|
||||||
Status = HMainEditorHandleMouseInput (MouseState, &MouseIsDown);
|
Status = HMainEditorHandleMouseInput (MouseState, &MouseIsDown);
|
||||||
@ -2171,7 +2196,6 @@ HMainEditorKeyInput (
|
|||||||
FirstDown = TRUE;
|
FirstDown = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
SelectStartBackup = HMainEditor.SelectStart;
|
SelectStartBackup = HMainEditor.SelectStart;
|
||||||
SelectEndBackup = HMainEditor.SelectEnd;
|
SelectEndBackup = HMainEditor.SelectEnd;
|
||||||
|
|
||||||
@ -2194,7 +2218,8 @@ HMainEditorKeyInput (
|
|||||||
0x10 +
|
0x10 +
|
||||||
HBufferImage.BufferPosition.Column
|
HBufferImage.BufferPosition.Column
|
||||||
) >= HMainEditor.SelectStart
|
) >= HMainEditor.SelectStart
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) *
|
HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) *
|
||||||
0x10 +
|
0x10 +
|
||||||
HBufferImage.BufferPosition.Column;
|
HBufferImage.BufferPosition.Column;
|
||||||
@ -2202,6 +2227,7 @@ HMainEditorKeyInput (
|
|||||||
HMainEditor.SelectEnd = 0;
|
HMainEditor.SelectEnd = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// end of if RelativeX/Y
|
// end of if RelativeX/Y
|
||||||
//
|
//
|
||||||
@ -2222,7 +2248,8 @@ HMainEditorKeyInput (
|
|||||||
0x10 +
|
0x10 +
|
||||||
HBufferImage.BufferPosition.Column
|
HBufferImage.BufferPosition.Column
|
||||||
) >= HMainEditor.SelectStart
|
) >= HMainEditor.SelectStart
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) *
|
HMainEditor.SelectEnd = (HBufferImage.BufferPosition.Row - 1) *
|
||||||
0x10 +
|
0x10 +
|
||||||
HBufferImage.BufferPosition.Column;
|
HBufferImage.BufferPosition.Column;
|
||||||
@ -2239,7 +2266,7 @@ HMainEditorKeyInput (
|
|||||||
MouseDrag = FALSE;
|
MouseDrag = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectStartBackup != HMainEditor.SelectStart || SelectEndBackup != HMainEditor.SelectEnd) {
|
if ((SelectStartBackup != HMainEditor.SelectStart) || (SelectEndBackup != HMainEditor.SelectEnd)) {
|
||||||
if ((SelectStartBackup - 1) / 0x10 != (HMainEditor.SelectStart - 1) / 0x10) {
|
if ((SelectStartBackup - 1) / 0x10 != (HMainEditor.SelectStart - 1) / 0x10) {
|
||||||
HBufferImageNeedRefresh = TRUE;
|
HBufferImageNeedRefresh = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -2254,7 +2281,6 @@ HMainEditorKeyInput (
|
|||||||
|
|
||||||
HEditorMouseAction = TRUE;
|
HEditorMouseAction = TRUE;
|
||||||
HBufferImageMouseNeedRefresh = TRUE;
|
HBufferImageMouseNeedRefresh = TRUE;
|
||||||
|
|
||||||
} else if (Status == EFI_LOAD_ERROR) {
|
} else if (Status == EFI_LOAD_ERROR) {
|
||||||
StatusBarSetStatusString (L"Invalid Mouse Movement ");
|
StatusBarSetStatusString (L"Invalid Mouse Movement ");
|
||||||
}
|
}
|
||||||
@ -2287,11 +2313,11 @@ HMainEditorKeyInput (
|
|||||||
//
|
//
|
||||||
if (EFI_SUCCESS == MenuBarDispatchControlHotKey (&KeyData)) {
|
if (EFI_SUCCESS == MenuBarDispatchControlHotKey (&KeyData)) {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
} else if (NoShiftState && KeyData.Key.ScanCode == SCAN_NULL) {
|
} else if (NoShiftState && (KeyData.Key.ScanCode == SCAN_NULL)) {
|
||||||
Status = HBufferImageHandleInput (&KeyData.Key);
|
Status = HBufferImageHandleInput (&KeyData.Key);
|
||||||
} else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_UP) && (KeyData.Key.ScanCode <= SCAN_PAGE_DOWN))) {
|
} else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_UP) && (KeyData.Key.ScanCode <= SCAN_PAGE_DOWN))) {
|
||||||
Status = HBufferImageHandleInput (&KeyData.Key);
|
Status = HBufferImageHandleInput (&KeyData.Key);
|
||||||
} else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_F1) && KeyData.Key.ScanCode <= SCAN_F12)) {
|
} else if (NoShiftState && ((KeyData.Key.ScanCode >= SCAN_F1) && (KeyData.Key.ScanCode <= SCAN_F12))) {
|
||||||
Status = MenuBarDispatchFunctionKey (&KeyData.Key);
|
Status = MenuBarDispatchFunctionKey (&KeyData.Key);
|
||||||
} else {
|
} else {
|
||||||
StatusBarSetStatusString (L"Unknown Command");
|
StatusBarSetStatusString (L"Unknown Command");
|
||||||
@ -2299,7 +2325,7 @@ HMainEditorKeyInput (
|
|||||||
HBufferImageMouseNeedRefresh = FALSE;
|
HBufferImageMouseNeedRefresh = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status != EFI_SUCCESS && Status != EFI_OUT_OF_RESOURCES) {
|
if ((Status != EFI_SUCCESS) && (Status != EFI_OUT_OF_RESOURCES)) {
|
||||||
//
|
//
|
||||||
// not already has some error status
|
// not already has some error status
|
||||||
//
|
//
|
||||||
@ -2308,6 +2334,7 @@ HMainEditorKeyInput (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// decide if has to set length warning
|
// decide if has to set length warning
|
||||||
//
|
//
|
||||||
@ -2348,11 +2375,11 @@ HMainEditorKeyInput (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// after handling, refresh editor
|
// after handling, refresh editor
|
||||||
//
|
//
|
||||||
HMainEditorRefresh ();
|
HMainEditorRefresh ();
|
||||||
|
|
||||||
} while (Status != EFI_OUT_OF_RESOURCES && !HEditorExit);
|
} while (Status != EFI_OUT_OF_RESOURCES && !HEditorExit);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -92,7 +92,6 @@ HMemImageSetMemOffsetSize (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
HMemImage.Offset = Offset;
|
HMemImage.Offset = Offset;
|
||||||
HMemImage.Size = Size;
|
HMemImage.Size = Size;
|
||||||
|
|
||||||
@ -117,7 +116,6 @@ HMemImageRead (
|
|||||||
IN BOOLEAN Recover
|
IN BOOLEAN Recover
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
void *Buffer;
|
void *Buffer;
|
||||||
CHAR16 *Str;
|
CHAR16 *Str;
|
||||||
@ -181,7 +179,6 @@ HMemImageRead (
|
|||||||
|
|
||||||
HMainEditor.SelectStart = 0;
|
HMainEditor.SelectStart = 0;
|
||||||
HMainEditor.SelectEnd = 0;
|
HMainEditor.SelectEnd = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -208,7 +205,6 @@ HMemImageRead (
|
|||||||
HBufferImageMouseNeedRefresh = TRUE;
|
HBufferImageMouseNeedRefresh = TRUE;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,7 +223,6 @@ HMemImageSave (
|
|||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
VOID *Buffer;
|
VOID *Buffer;
|
||||||
|
|
||||||
@ -251,6 +246,7 @@ HMemImageSave (
|
|||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// write back to memory
|
// write back to memory
|
||||||
//
|
//
|
||||||
@ -267,6 +263,7 @@ HMemImageSave (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// now not modified
|
// now not modified
|
||||||
//
|
//
|
||||||
@ -274,5 +271,3 @@ HMemImageSave (
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ HLineFree (
|
|||||||
}
|
}
|
||||||
|
|
||||||
SHELL_FREE_NON_NULL (Src);
|
SHELL_FREE_NON_NULL (Src);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,7 +168,6 @@ HMoveCurrentLine (
|
|||||||
return Line;
|
return Line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free all the lines in HBufferImage.
|
Free all the lines in HBufferImage.
|
||||||
Fields affected:
|
Fields affected:
|
||||||
@ -196,7 +194,6 @@ HFreeLines (
|
|||||||
// release all the lines
|
// release all the lines
|
||||||
//
|
//
|
||||||
if (Lines != NULL) {
|
if (Lines != NULL) {
|
||||||
|
|
||||||
Line = Lines;
|
Line = Lines;
|
||||||
Link = &(Line->Link);
|
Link = &(Line->Link);
|
||||||
do {
|
do {
|
||||||
|
@ -73,6 +73,7 @@ ShellCommandRunLoadPciRom (
|
|||||||
CONST CHAR16 *Param;
|
CONST CHAR16 *Param;
|
||||||
UINTN ParamCount;
|
UINTN ParamCount;
|
||||||
EFI_SHELL_FILE_INFO *Node;
|
EFI_SHELL_FILE_INFO *Node;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local variable initializations
|
// Local variable initializations
|
||||||
//
|
//
|
||||||
@ -80,13 +81,12 @@ ShellCommandRunLoadPciRom (
|
|||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
FileList = NULL;
|
FileList = NULL;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// verify number of arguments
|
// verify number of arguments
|
||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"loadpcirom", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"loadpcirom", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -111,7 +111,8 @@ ShellCommandRunLoadPciRom (
|
|||||||
for ( ParamCount = 1, Param = ShellCommandLineGetRawValue (Package, ParamCount)
|
for ( ParamCount = 1, Param = ShellCommandLineGetRawValue (Package, ParamCount)
|
||||||
; Param != NULL
|
; Param != NULL
|
||||||
; ParamCount++, Param = ShellCommandLineGetRawValue (Package, ParamCount)
|
; ParamCount++, Param = ShellCommandLineGetRawValue (Package, ParamCount)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
Status = ShellOpenFileMetaArg ((CHAR16 *)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
|
Status = ShellOpenFileMetaArg ((CHAR16 *)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Param);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Param);
|
||||||
@ -119,24 +120,28 @@ ShellCommandRunLoadPciRom (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ShellStatus == SHELL_SUCCESS && FileList != NULL) {
|
|
||||||
|
if ((ShellStatus == SHELL_SUCCESS) && (FileList != NULL)) {
|
||||||
//
|
//
|
||||||
// loop through the list and make sure we are not aborting...
|
// loop through the list and make sure we are not aborting...
|
||||||
//
|
//
|
||||||
for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
|
for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&FileList->Link)
|
||||||
; !IsNull (&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag ()
|
; !IsNull (&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag ()
|
||||||
; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
|
; Node = (EFI_SHELL_FILE_INFO *)GetNextNode (&FileList->Link, &Node->Link)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
if (EFI_ERROR (Node->Status)) {
|
if (EFI_ERROR (Node->Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileHandleIsDirectory (Node->Handle) == EFI_SUCCESS) {
|
if (FileHandleIsDirectory (Node->Handle) == EFI_SUCCESS) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceSize = (UINTN)Node->Info->FileSize;
|
SourceSize = (UINTN)Node->Info->FileSize;
|
||||||
File1Buffer = AllocateZeroPool (SourceSize);
|
File1Buffer = AllocateZeroPool (SourceSize);
|
||||||
if (File1Buffer == NULL) {
|
if (File1Buffer == NULL) {
|
||||||
@ -144,6 +149,7 @@ ShellCommandRunLoadPciRom (
|
|||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gEfiShellProtocol->ReadFile (Node->Handle, &SourceSize, File1Buffer);
|
Status = gEfiShellProtocol->ReadFile (Node->Handle, &SourceSize, File1Buffer);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"loadpcirom", Node->FullName);
|
||||||
@ -157,15 +163,18 @@ ShellCommandRunLoadPciRom (
|
|||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOAD_PCI_ROM_RES), gShellDebug1HiiHandle, Node->FullName, Status);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOAD_PCI_ROM_RES), gShellDebug1HiiHandle, Node->FullName, Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (File1Buffer);
|
FreePool (File1Buffer);
|
||||||
}
|
}
|
||||||
} else if (ShellStatus == SHELL_SUCCESS) {
|
} else if (ShellStatus == SHELL_SUCCESS) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle, "loadpcirom");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle, "loadpcirom");
|
||||||
ShellStatus = SHELL_NOT_FOUND;
|
ShellStatus = SHELL_NOT_FOUND;
|
||||||
}
|
}
|
||||||
if (FileList != NULL && !IsListEmpty(&FileList->Link)) {
|
|
||||||
|
if ((FileList != NULL) && !IsListEmpty (&FileList->Link)) {
|
||||||
Status = ShellCloseFileMetaArg (&FileList);
|
Status = ShellCloseFileMetaArg (&FileList);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileList = NULL;
|
FileList = NULL;
|
||||||
|
|
||||||
if (Connect) {
|
if (Connect) {
|
||||||
@ -224,7 +233,6 @@ LoadEfiDriversFromRomImage (
|
|||||||
RomBarOffset = (UINTN)RomBar;
|
RomBarOffset = (UINTN)RomBar;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *)(UINTN)RomBarOffset;
|
EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *)(UINTN)RomBarOffset;
|
||||||
|
|
||||||
if (EfiRomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
|
if (EfiRomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
|
||||||
@ -237,9 +245,10 @@ LoadEfiDriversFromRomImage (
|
|||||||
// If the pointer to the PCI Data Structure is invalid, no further images can be located.
|
// If the pointer to the PCI Data Structure is invalid, no further images can be located.
|
||||||
// The PCI Data Structure must be DWORD aligned.
|
// The PCI Data Structure must be DWORD aligned.
|
||||||
//
|
//
|
||||||
if (EfiRomHeader->PcirOffset == 0 ||
|
if ((EfiRomHeader->PcirOffset == 0) ||
|
||||||
(EfiRomHeader->PcirOffset & 3) != 0 ||
|
((EfiRomHeader->PcirOffset & 3) != 0) ||
|
||||||
RomBarOffset - (UINTN)RomBar + EfiRomHeader->PcirOffset + sizeof (PCI_DATA_STRUCTURE) > RomSize) {
|
(RomBarOffset - (UINTN)RomBar + EfiRomHeader->PcirOffset + sizeof (PCI_DATA_STRUCTURE) > RomSize))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +259,7 @@ LoadEfiDriversFromRomImage (
|
|||||||
if (Pcir->Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
|
if (Pcir->Signature != PCI_DATA_STRUCTURE_SIGNATURE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageSize = Pcir->ImageLength * 512;
|
ImageSize = Pcir->ImageLength * 512;
|
||||||
if (RomBarOffset - (UINTN)RomBar + ImageSize > RomSize) {
|
if (RomBarOffset - (UINTN)RomBar + ImageSize > RomSize) {
|
||||||
break;
|
break;
|
||||||
@ -258,13 +268,12 @@ LoadEfiDriversFromRomImage (
|
|||||||
if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
|
if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
|
||||||
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) &&
|
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) &&
|
||||||
((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
|
((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
|
||||||
(EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER))) {
|
(EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)))
|
||||||
|
{
|
||||||
ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
|
ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
|
||||||
InitializationSize = EfiRomHeader->InitializationSize * 512;
|
InitializationSize = EfiRomHeader->InitializationSize * 512;
|
||||||
|
|
||||||
if (InitializationSize <= ImageSize && ImageOffset < InitializationSize) {
|
if ((InitializationSize <= ImageSize) && (ImageOffset < InitializationSize)) {
|
||||||
|
|
||||||
ImageBuffer = (VOID *)(UINTN)(RomBarOffset + ImageOffset);
|
ImageBuffer = (VOID *)(UINTN)(RomBarOffset + ImageOffset);
|
||||||
ImageLength = InitializationSize - ImageOffset;
|
ImageLength = InitializationSize - ImageOffset;
|
||||||
DecompressedImageBuffer = NULL;
|
DecompressedImageBuffer = NULL;
|
||||||
@ -343,6 +352,7 @@ LoadEfiDriversFromRomImage (
|
|||||||
if (Status == EFI_SECURITY_VIOLATION) {
|
if (Status == EFI_SECURITY_VIOLATION) {
|
||||||
gBS->UnloadImage (ImageHandle);
|
gBS->UnloadImage (ImageHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_LOAD_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_LOAD_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex);
|
||||||
// PrintToken (STRING_TOKEN (STR_LOADPCIROM_LOAD_IMAGE_ERROR), HiiHandle, ImageIndex, Status);
|
// PrintToken (STRING_TOKEN (STR_LOADPCIROM_LOAD_IMAGE_ERROR), HiiHandle, ImageIndex, Status);
|
||||||
} else {
|
} else {
|
||||||
@ -359,7 +369,6 @@ LoadEfiDriversFromRomImage (
|
|||||||
if (DecompressedImageBuffer != NULL) {
|
if (DecompressedImageBuffer != NULL) {
|
||||||
FreePool (DecompressedImageBuffer);
|
FreePool (DecompressedImageBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,11 +411,13 @@ LoadPciRomConnectAllDriversToAllControllers (
|
|||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
|
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
FreePool (HandleBuffer);
|
FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,7 @@ AddMemoryLength (
|
|||||||
if (NewEntry == NULL) {
|
if (NewEntry == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewEntry->Type = Type;
|
NewEntry->Type = Type;
|
||||||
NewEntry->NumberOfPages = 0;
|
NewEntry->NumberOfPages = 0;
|
||||||
InsertTailList (Link, &NewEntry->Link);
|
InsertTailList (Link, &NewEntry->Link);
|
||||||
@ -193,7 +194,7 @@ ShellCommandRunMemMap (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"memmap", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"memmap", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -211,6 +212,7 @@ ShellCommandRunMemMap (
|
|||||||
Descriptors = AllocateZeroPool (Size);
|
Descriptors = AllocateZeroPool (Size);
|
||||||
Status = gBS->GetMemoryMap (&Size, Descriptors, &MapKey, &ItemSize, &Version);
|
Status = gBS->GetMemoryMap (&Size, Descriptors, &MapKey, &ItemSize, &Version);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap");
|
||||||
ShellStatus = SHELL_ACCESS_DENIED;
|
ShellStatus = SHELL_ACCESS_DENIED;
|
||||||
@ -227,7 +229,8 @@ ShellCommandRunMemMap (
|
|||||||
for ( Walker = Descriptors
|
for ( Walker = Descriptors
|
||||||
; (Walker < (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Descriptors + Size)) && (Walker != NULL)
|
; (Walker < (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Descriptors + Size)) && (Walker != NULL)
|
||||||
; Walker = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Walker + ItemSize)
|
; Walker = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Walker + ItemSize)
|
||||||
){
|
)
|
||||||
|
{
|
||||||
switch (Walker->Type) {
|
switch (Walker->Type) {
|
||||||
case EfiReservedMemoryType:
|
case EfiReservedMemoryType:
|
||||||
ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiReservedMemoryType, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
|
ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiReservedMemoryType, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
|
||||||
@ -308,11 +311,13 @@ ShellCommandRunMemMap (
|
|||||||
if (!Sfo) {
|
if (!Sfo) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_ITEM_OTHER), gShellDebug1HiiHandle, Walker->Type, Walker->PhysicalStart, Walker->PhysicalStart + MultU64x64 (SIZE_4KB, Walker->NumberOfPages) - 1, Walker->NumberOfPages, Walker->Attribute);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_ITEM_OTHER), gShellDebug1HiiHandle, Walker->Type, Walker->PhysicalStart, Walker->PhysicalStart + MultU64x64 (SIZE_4KB, Walker->NumberOfPages) - 1, Walker->NumberOfPages, Walker->Attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
TotalPages += Walker->NumberOfPages;
|
TotalPages += Walker->NumberOfPages;
|
||||||
AddMemoryLength (&MemoryList, Walker->Type, Walker->NumberOfPages);
|
AddMemoryLength (&MemoryList, Walker->Type, Walker->NumberOfPages);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// print the summary
|
// print the summary
|
||||||
//
|
//
|
||||||
@ -333,21 +338,40 @@ ShellCommandRunMemMap (
|
|||||||
PersistentPagesSize = MultU64x64 (SIZE_4KB, PersistentPages);
|
PersistentPagesSize = MultU64x64 (SIZE_4KB, PersistentPages);
|
||||||
UnusableMemoryPagesSize = MultU64x64 (SIZE_4KB, UnusableMemoryPages);
|
UnusableMemoryPagesSize = MultU64x64 (SIZE_4KB, UnusableMemoryPages);
|
||||||
if (!Sfo) {
|
if (!Sfo) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM), gShellDebug1HiiHandle,
|
ShellPrintHiiEx (
|
||||||
ReservedPages, ReservedPagesSize,
|
-1,
|
||||||
LoadCodePages, LoadCodePagesSize,
|
-1,
|
||||||
LoadDataPages, LoadDataPagesSize,
|
NULL,
|
||||||
BSCodePages, BSCodePagesSize,
|
STRING_TOKEN (STR_MEMMAP_LIST_SUMM),
|
||||||
BSDataPages, BSDataPagesSize,
|
gShellDebug1HiiHandle,
|
||||||
RTCodePages, RTCodePagesSize,
|
ReservedPages,
|
||||||
RTDataPages, RTDataPagesSize,
|
ReservedPagesSize,
|
||||||
AcpiReclaimPages, AcpiReclaimPagesSize,
|
LoadCodePages,
|
||||||
AcpiNvsPages, AcpiNvsPagesSize,
|
LoadCodePagesSize,
|
||||||
MmioSpacePages, MmioSpacePagesSize,
|
LoadDataPages,
|
||||||
MmioPortPages, MmioPortPagesSize,
|
LoadDataPagesSize,
|
||||||
PalCodePages, PalCodePagesSize,
|
BSCodePages,
|
||||||
AvailPages, AvailPagesSize,
|
BSCodePagesSize,
|
||||||
PersistentPages, PersistentPagesSize
|
BSDataPages,
|
||||||
|
BSDataPagesSize,
|
||||||
|
RTCodePages,
|
||||||
|
RTCodePagesSize,
|
||||||
|
RTDataPages,
|
||||||
|
RTDataPagesSize,
|
||||||
|
AcpiReclaimPages,
|
||||||
|
AcpiReclaimPagesSize,
|
||||||
|
AcpiNvsPages,
|
||||||
|
AcpiNvsPagesSize,
|
||||||
|
MmioSpacePages,
|
||||||
|
MmioSpacePagesSize,
|
||||||
|
MmioPortPages,
|
||||||
|
MmioPortPagesSize,
|
||||||
|
PalCodePages,
|
||||||
|
PalCodePagesSize,
|
||||||
|
AvailPages,
|
||||||
|
AvailPagesSize,
|
||||||
|
PersistentPages,
|
||||||
|
PersistentPagesSize
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -355,16 +379,34 @@ ShellCommandRunMemMap (
|
|||||||
//
|
//
|
||||||
for (Link = GetFirstNode (&MemoryList); !IsNull (&MemoryList, Link); Link = GetNextNode (&MemoryList, Link)) {
|
for (Link = GetFirstNode (&MemoryList); !IsNull (&MemoryList, Link); Link = GetNextNode (&MemoryList, Link)) {
|
||||||
Entry = BASE_CR (Link, MEMORY_LENGTH_ENTRY, Link);
|
Entry = BASE_CR (Link, MEMORY_LENGTH_ENTRY, Link);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_OTHER), gShellDebug1HiiHandle,
|
ShellPrintHiiEx (
|
||||||
Entry->Type, Entry->NumberOfPages, MultU64x64 (SIZE_4KB, Entry->NumberOfPages)
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_MEMMAP_LIST_SUMM_OTHER),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
Entry->Type,
|
||||||
|
Entry->NumberOfPages,
|
||||||
|
MultU64x64 (SIZE_4KB, Entry->NumberOfPages)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM2), gShellDebug1HiiHandle,
|
ShellPrintHiiEx (
|
||||||
DivU64x32(MultU64x64(SIZE_4KB,TotalPages), SIZE_1MB), TotalPagesSize
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_MEMMAP_LIST_SUMM2),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
|
DivU64x32 (MultU64x64 (SIZE_4KB, TotalPages), SIZE_1MB),
|
||||||
|
TotalPagesSize
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO), gShellDebug1HiiHandle,
|
ShellPrintHiiEx (
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO),
|
||||||
|
gShellDebug1HiiHandle,
|
||||||
TotalPagesSize,
|
TotalPagesSize,
|
||||||
ReservedPagesSize,
|
ReservedPagesSize,
|
||||||
BSCodePagesSize,
|
BSCodePagesSize,
|
||||||
@ -385,6 +427,7 @@ ShellCommandRunMemMap (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,4 +444,3 @@ ShellCommandRunMemMap (
|
|||||||
|
|
||||||
return (ShellStatus);
|
return (ShellStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +84,11 @@ ShellMmDecodePciAddress (
|
|||||||
if (Device != NULL) {
|
if (Device != NULL) {
|
||||||
*Device = (UINT8)(((UINT32)Address) >> 16);
|
*Device = (UINT8)(((UINT32)Address) >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Function != NULL) {
|
if (Function != NULL) {
|
||||||
*Function = (UINT8)(((UINT32)Address) >> 8);
|
*Function = (UINT8)(((UINT32)Address) >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Register != NULL) {
|
if (Register != NULL) {
|
||||||
*Register = (UINT8)Address;
|
*Register = (UINT8)Address;
|
||||||
}
|
}
|
||||||
@ -100,9 +102,11 @@ ShellMmDecodePciAddress (
|
|||||||
if (Device != NULL) {
|
if (Device != NULL) {
|
||||||
*Device = (UINT8)(((UINT32)Address) >> 20);
|
*Device = (UINT8)(((UINT32)Address) >> 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Function != NULL) {
|
if (Function != NULL) {
|
||||||
*Function = (UINT8)(((UINT32)Address) >> 12);
|
*Function = (UINT8)(((UINT32)Address) >> 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Register != NULL) {
|
if (Register != NULL) {
|
||||||
*Register = (UINT32)(Address & 0xFFF);
|
*Register = (UINT32)(Address & 0xFFF);
|
||||||
}
|
}
|
||||||
@ -156,17 +160,22 @@ ShellMmAccess (
|
|||||||
ShellMmDecodePciAddress ((BOOLEAN)(AccessType == ShellMmPci), Address, &Segment, &Bus, &Device, &Function, &Register);
|
ShellMmDecodePciAddress ((BOOLEAN)(AccessType == ShellMmPci), Address, &Segment, &Bus, &Device, &Function, &Register);
|
||||||
if (Read) {
|
if (Read) {
|
||||||
Status = PciRootBridgeIo->Pci.Read (
|
Status = PciRootBridgeIo->Pci.Read (
|
||||||
PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size],
|
PciRootBridgeIo,
|
||||||
|
mShellMmRootBridgeIoWidth[Size],
|
||||||
EFI_PCI_ADDRESS (Bus, Device, Function, Register),
|
EFI_PCI_ADDRESS (Bus, Device, Function, Register),
|
||||||
1, Buffer
|
1,
|
||||||
|
Buffer
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Status = PciRootBridgeIo->Pci.Write (
|
Status = PciRootBridgeIo->Pci.Write (
|
||||||
PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size],
|
PciRootBridgeIo,
|
||||||
|
mShellMmRootBridgeIoWidth[Size],
|
||||||
EFI_PCI_ADDRESS (Bus, Device, Function, Register),
|
EFI_PCI_ADDRESS (Bus, Device, Function, Register),
|
||||||
1, Buffer
|
1,
|
||||||
|
Buffer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -174,18 +183,22 @@ ShellMmAccess (
|
|||||||
if (PciRootBridgeIo != NULL) {
|
if (PciRootBridgeIo != NULL) {
|
||||||
RootBridgeIoMem = Read ? PciRootBridgeIo->Mem.Read : PciRootBridgeIo->Mem.Write;
|
RootBridgeIoMem = Read ? PciRootBridgeIo->Mem.Read : PciRootBridgeIo->Mem.Write;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CpuIo != NULL) {
|
if (CpuIo != NULL) {
|
||||||
CpuIoMem = Read ? CpuIo->Mem.Read : CpuIo->Mem.Write;
|
CpuIoMem = Read ? CpuIo->Mem.Read : CpuIo->Mem.Write;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ShellMmIo:
|
case ShellMmIo:
|
||||||
if (PciRootBridgeIo != NULL) {
|
if (PciRootBridgeIo != NULL) {
|
||||||
RootBridgeIoMem = Read ? PciRootBridgeIo->Io.Read : PciRootBridgeIo->Io.Write;
|
RootBridgeIoMem = Read ? PciRootBridgeIo->Io.Read : PciRootBridgeIo->Io.Write;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CpuIo != NULL) {
|
if (CpuIo != NULL) {
|
||||||
CpuIoMem = Read ? CpuIo->Io.Read : CpuIo->Io.Write;
|
CpuIoMem = Read ? CpuIo->Io.Read : CpuIo->Io.Write;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
@ -196,6 +209,7 @@ ShellMmAccess (
|
|||||||
if (RootBridgeIoMem != NULL) {
|
if (RootBridgeIoMem != NULL) {
|
||||||
Status = RootBridgeIoMem (PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size], Address, 1, Buffer);
|
Status = RootBridgeIoMem (PciRootBridgeIo, mShellMmRootBridgeIoWidth[Size], Address, 1, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status) && (CpuIoMem != NULL)) {
|
if (EFI_ERROR (Status) && (CpuIoMem != NULL)) {
|
||||||
Status = CpuIoMem (CpuIo, mShellMmCpuIoWidth[Size], Address, 1, Buffer);
|
Status = CpuIoMem (CpuIo, mShellMmCpuIoWidth[Size], Address, 1, Buffer);
|
||||||
}
|
}
|
||||||
@ -209,6 +223,7 @@ ShellMmAccess (
|
|||||||
} else {
|
} else {
|
||||||
IoWrite8 ((UINTN)Address, *(UINT8 *)Buffer);
|
IoWrite8 ((UINTN)Address, *(UINT8 *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (Read) {
|
if (Read) {
|
||||||
@ -216,6 +231,7 @@ ShellMmAccess (
|
|||||||
} else {
|
} else {
|
||||||
IoWrite16 ((UINTN)Address, *(UINT16 *)Buffer);
|
IoWrite16 ((UINTN)Address, *(UINT16 *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (Read) {
|
if (Read) {
|
||||||
@ -223,6 +239,7 @@ ShellMmAccess (
|
|||||||
} else {
|
} else {
|
||||||
IoWrite32 ((UINTN)Address, *(UINT32 *)Buffer);
|
IoWrite32 ((UINTN)Address, *(UINT32 *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (Read) {
|
if (Read) {
|
||||||
@ -230,6 +247,7 @@ ShellMmAccess (
|
|||||||
} else {
|
} else {
|
||||||
IoWrite64 ((UINTN)Address, *(UINT64 *)Buffer);
|
IoWrite64 ((UINTN)Address, *(UINT64 *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
@ -243,6 +261,7 @@ ShellMmAccess (
|
|||||||
} else {
|
} else {
|
||||||
MmioWrite8 ((UINTN)Address, *(UINT8 *)Buffer);
|
MmioWrite8 ((UINTN)Address, *(UINT8 *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (Read) {
|
if (Read) {
|
||||||
@ -250,6 +269,7 @@ ShellMmAccess (
|
|||||||
} else {
|
} else {
|
||||||
MmioWrite16 ((UINTN)Address, *(UINT16 *)Buffer);
|
MmioWrite16 ((UINTN)Address, *(UINT16 *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (Read) {
|
if (Read) {
|
||||||
@ -257,6 +277,7 @@ ShellMmAccess (
|
|||||||
} else {
|
} else {
|
||||||
MmioWrite32 ((UINTN)Address, *(UINT32 *)Buffer);
|
MmioWrite32 ((UINTN)Address, *(UINT32 *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (Read) {
|
if (Read) {
|
||||||
@ -264,6 +285,7 @@ ShellMmAccess (
|
|||||||
} else {
|
} else {
|
||||||
MmioWrite64 ((UINTN)Address, *(UINT64 *)Buffer);
|
MmioWrite64 ((UINTN)Address, *(UINT64 *)Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
@ -343,7 +365,8 @@ ShellMmLocateIoProtocol (
|
|||||||
|
|
||||||
if ((((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) && (Io->SegmentNumber == Segment)) ||
|
if ((((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) && (Io->SegmentNumber == Segment)) ||
|
||||||
((AccessType == ShellMmIo) || (AccessType == ShellMmMemoryMappedIo))
|
((AccessType == ShellMmIo) || (AccessType == ShellMmMemoryMappedIo))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = Io->Configuration (Io, (VOID **)&Descriptors);
|
Status = Io->Configuration (Io, (VOID **)&Descriptors);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
while (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR) {
|
while (Descriptors->Desc != ACPI_END_TAG_DESCRIPTOR) {
|
||||||
@ -353,7 +376,8 @@ ShellMmLocateIoProtocol (
|
|||||||
if ((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) &&
|
if ((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) &&
|
||||||
((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) &&
|
((AccessType == ShellMmPci) || (AccessType == ShellMmPciExpress)) &&
|
||||||
((Bus >= Descriptors->AddrRangeMin) && (Bus <= Descriptors->AddrRangeMax))
|
((Bus >= Descriptors->AddrRangeMin) && (Bus <= Descriptors->AddrRangeMax))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
*PciRootBridgeIo = Io;
|
*PciRootBridgeIo = Io;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -363,15 +387,18 @@ ShellMmLocateIoProtocol (
|
|||||||
} else if ((((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_IO) && (AccessType == ShellMmIo)) ||
|
} else if ((((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_IO) && (AccessType == ShellMmIo)) ||
|
||||||
((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) && (AccessType == ShellMmMemoryMappedIo))
|
((Descriptors->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) && (AccessType == ShellMmMemoryMappedIo))
|
||||||
) && ((Address >= Descriptors->AddrRangeMin) && (Address <= Descriptors->AddrRangeMax))
|
) && ((Address >= Descriptors->AddrRangeMin) && (Address <= Descriptors->AddrRangeMax))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
*PciRootBridgeIo = Io;
|
*PciRootBridgeIo = Io;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Descriptors++;
|
Descriptors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
FreePool (HandleBuffer);
|
FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
@ -422,7 +449,7 @@ ShellCommandRunMm (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mm", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mm", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -439,7 +466,7 @@ ShellCommandRunMm (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
} else if (ShellCommandLineGetFlag (Package, L"-w") && ShellCommandLineGetValue (Package, L"-w") == NULL) {
|
} else if (ShellCommandLineGetFlag (Package, L"-w") && (ShellCommandLineGetValue (Package, L"-w") == NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"mm", L"-w");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"mm", L"-w");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -450,7 +477,8 @@ ShellCommandRunMm (
|
|||||||
|| ShellCommandLineGetFlag (Package, L"-io")
|
|| ShellCommandLineGetFlag (Package, L"-io")
|
||||||
|| ShellCommandLineGetFlag (Package, L"-pci")
|
|| ShellCommandLineGetFlag (Package, L"-pci")
|
||||||
|| ShellCommandLineGetFlag (Package, L"-pcie")
|
|| ShellCommandLineGetFlag (Package, L"-pcie")
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -460,7 +488,8 @@ ShellCommandRunMm (
|
|||||||
if ( ShellCommandLineGetFlag (Package, L"-io")
|
if ( ShellCommandLineGetFlag (Package, L"-io")
|
||||||
|| ShellCommandLineGetFlag (Package, L"-pci")
|
|| ShellCommandLineGetFlag (Package, L"-pci")
|
||||||
|| ShellCommandLineGetFlag (Package, L"-pcie")
|
|| ShellCommandLineGetFlag (Package, L"-pcie")
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -469,7 +498,8 @@ ShellCommandRunMm (
|
|||||||
AccessType = ShellMmIo;
|
AccessType = ShellMmIo;
|
||||||
if ( ShellCommandLineGetFlag (Package, L"-pci")
|
if ( ShellCommandLineGetFlag (Package, L"-pci")
|
||||||
|| ShellCommandLineGetFlag (Package, L"-pcie")
|
|| ShellCommandLineGetFlag (Package, L"-pcie")
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -477,7 +507,8 @@ ShellCommandRunMm (
|
|||||||
} else if (ShellCommandLineGetFlag (Package, L"-pci")) {
|
} else if (ShellCommandLineGetFlag (Package, L"-pci")) {
|
||||||
AccessType = ShellMmPci;
|
AccessType = ShellMmPci;
|
||||||
if (ShellCommandLineGetFlag (Package, L"-pcie")
|
if (ShellCommandLineGetFlag (Package, L"-pcie")
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"mm");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -499,6 +530,7 @@ ShellCommandRunMm (
|
|||||||
if (Temp != NULL) {
|
if (Temp != NULL) {
|
||||||
Size = ShellStrToUintn (Temp);
|
Size = ShellStrToUintn (Temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Size != 1) && (Size != 2) && (Size != 4) && (Size != 8)) {
|
if ((Size != 1) && (Size != 2) && (Size != 4) && (Size != 8)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"mm", Temp, L"-w");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellDebug1HiiHandle, L"mm", Temp, L"-w");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -529,6 +561,7 @@ ShellCommandRunMm (
|
|||||||
ShellStatus = SHELL_NOT_FOUND;
|
ShellStatus = SHELL_NOT_FOUND;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PciRootBridgeIo == NULL) {
|
if (PciRootBridgeIo == NULL) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE_ADDRESS_RANGE), gShellDebug1HiiHandle, L"mm", Address);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE_ADDRESS_RANGE), gShellDebug1HiiHandle, L"mm", Address);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -565,11 +598,13 @@ ShellCommandRunMm (
|
|||||||
if (!gEfiShellProtocol->BatchIsActive ()) {
|
if (!gEfiShellProtocol->BatchIsActive ()) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType], gShellDebug1HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType], gShellDebug1HiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address, Size, &Buffer);
|
ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address, Size, &Buffer);
|
||||||
|
|
||||||
if (!gEfiShellProtocol->BatchIsActive ()) {
|
if (!gEfiShellProtocol->BatchIsActive ()) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_BUF), gShellDebug1HiiHandle, Size * 2, Buffer & mShellMmMaxNumber[Size]);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_BUF), gShellDebug1HiiHandle, Size * 2, Buffer & mShellMmMaxNumber[Size]);
|
||||||
ShellPrintEx (-1, -1, L"\r\n");
|
ShellPrintEx (-1, -1, L"\r\n");
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -592,20 +627,23 @@ ShellCommandRunMm (
|
|||||||
FreePool (InputStr);
|
FreePool (InputStr);
|
||||||
InputStr = NULL;
|
InputStr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPromptForResponse (ShellPromptResponseTypeFreeform, NULL, (VOID **)&InputStr);
|
ShellPromptForResponse (ShellPromptResponseTypeFreeform, NULL, (VOID **)&InputStr);
|
||||||
|
|
||||||
if (InputStr != NULL) {
|
if (InputStr != NULL) {
|
||||||
//
|
//
|
||||||
// skip space characters
|
// skip space characters
|
||||||
//
|
//
|
||||||
for (Index = 0; InputStr[Index] == ' '; Index++);
|
for (Index = 0; InputStr[Index] == ' '; Index++) {
|
||||||
|
}
|
||||||
|
|
||||||
if (InputStr[Index] != CHAR_NULL) {
|
if (InputStr[Index] != CHAR_NULL) {
|
||||||
if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || (InputStr[Index] == 'Q')) {
|
if ((InputStr[Index] == '.') || (InputStr[Index] == 'q') || (InputStr[Index] == 'Q')) {
|
||||||
Complete = TRUE;
|
Complete = TRUE;
|
||||||
} else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, &Buffer, TRUE, TRUE)) &&
|
} else if (!EFI_ERROR (ShellConvertStringToUint64 (InputStr + Index, &Buffer, TRUE, TRUE)) &&
|
||||||
(Buffer <= mShellMmMaxNumber[Size])
|
(Buffer <= mShellMmMaxNumber[Size])
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Buffer);
|
ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, FALSE, Address, Size, &Buffer);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), gShellDebug1HiiHandle, L"mm");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), gShellDebug1HiiHandle, L"mm");
|
||||||
@ -618,14 +656,17 @@ ShellCommandRunMm (
|
|||||||
ShellPrintEx (-1, -1, L"\r\n");
|
ShellPrintEx (-1, -1, L"\r\n");
|
||||||
} while (!Complete);
|
} while (!Complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (ShellStatus == SHELL_SUCCESS);
|
ASSERT (ShellStatus == SHELL_SUCCESS);
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
if (InputStr != NULL) {
|
if (InputStr != NULL) {
|
||||||
FreePool (InputStr);
|
FreePool (InputStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Package != NULL) {
|
if (Package != NULL) {
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShellStatus;
|
return ShellStatus;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ ShellCommandRunMode (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mode", ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"mode", ProblemParam);
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
@ -71,12 +71,14 @@ ShellCommandRunMode (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewCol = ShellStrToUintn (Temp);
|
NewCol = ShellStrToUintn (Temp);
|
||||||
Temp = ShellCommandLineGetRawValue (Package, 2);
|
Temp = ShellCommandLineGetRawValue (Package, 2);
|
||||||
if (!ShellIsHexOrDecimalNumber (Temp, FALSE, FALSE)) {
|
if (!ShellIsHexOrDecimalNumber (Temp, FALSE, FALSE)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewRow = ShellStrToUintn (Temp);
|
NewRow = ShellStrToUintn (Temp);
|
||||||
|
|
||||||
for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS; LoopVar++) {
|
for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS; LoopVar++) {
|
||||||
@ -84,7 +86,8 @@ ShellCommandRunMode (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Col == NewCol && Row == NewRow) {
|
|
||||||
|
if ((Col == NewCol) && (Row == NewRow)) {
|
||||||
Status = gST->ConOut->SetMode (gST->ConOut, LoopVar);
|
Status = gST->ConOut->SetMode (gST->ConOut, LoopVar);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_SET_FAIL), gShellDebug1HiiHandle, L"mode");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_SET_FAIL), gShellDebug1HiiHandle, L"mode");
|
||||||
@ -93,6 +96,7 @@ ShellCommandRunMode (
|
|||||||
// worked fine...
|
// worked fine...
|
||||||
Done = TRUE;
|
Done = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +105,6 @@ ShellCommandRunMode (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_NO_MATCH), gShellDebug1HiiHandle, L"mode");
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_NO_MATCH), gShellDebug1HiiHandle, L"mode");
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ShellCommandLineGetCount (Package) == 1) {
|
} else if (ShellCommandLineGetCount (Package) == 1) {
|
||||||
//
|
//
|
||||||
// print out valid
|
// print out valid
|
||||||
@ -112,9 +115,11 @@ ShellCommandRunMode (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_ITEM), gShellDebug1HiiHandle, Col, Row, LoopVar == gST->ConOut->Mode->Mode ? L'*' : L' ');
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_ITEM), gShellDebug1HiiHandle, Col, Row, LoopVar == gST->ConOut->Mode->Mode ? L'*' : L' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellCommandLineFreeVarList (Package);
|
ShellCommandLineFreeVarList (Package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user