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
@ -23,15 +23,16 @@
|
||||
@sa InstallProtocolInterface
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerInstall(
|
||||
ConsoleLoggerInstall (
|
||||
IN CONST UINTN ScreensToSave,
|
||||
OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ASSERT(ConsoleInfo != NULL);
|
||||
|
||||
(*ConsoleInfo) = AllocateZeroPool(sizeof(CONSOLE_LOGGER_PRIVATE_DATA));
|
||||
ASSERT (ConsoleInfo != NULL);
|
||||
|
||||
(*ConsoleInfo) = AllocateZeroPool (sizeof (CONSOLE_LOGGER_PRIVATE_DATA));
|
||||
if ((*ConsoleInfo) == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
@ -66,18 +67,18 @@ ConsoleLoggerInstall(
|
||||
(*ConsoleInfo)->OurConOut.Mode = gST->ConOut->Mode;
|
||||
(*ConsoleInfo)->Enabled = TRUE;
|
||||
|
||||
Status = ConsoleLoggerResetBuffers(*ConsoleInfo);
|
||||
if (EFI_ERROR(Status)) {
|
||||
SHELL_FREE_NON_NULL((*ConsoleInfo));
|
||||
Status = ConsoleLoggerResetBuffers (*ConsoleInfo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SHELL_FREE_NON_NULL ((*ConsoleInfo));
|
||||
*ConsoleInfo = NULL;
|
||||
return (Status);
|
||||
}
|
||||
|
||||
Status = gBS->InstallProtocolInterface(&gImageHandle, &gEfiSimpleTextOutProtocolGuid, EFI_NATIVE_INTERFACE, (VOID*)&((*ConsoleInfo)->OurConOut));
|
||||
if (EFI_ERROR(Status)) {
|
||||
SHELL_FREE_NON_NULL((*ConsoleInfo)->Buffer);
|
||||
SHELL_FREE_NON_NULL((*ConsoleInfo)->Attributes);
|
||||
SHELL_FREE_NON_NULL((*ConsoleInfo));
|
||||
Status = gBS->InstallProtocolInterface (&gImageHandle, &gEfiSimpleTextOutProtocolGuid, EFI_NATIVE_INTERFACE, (VOID *)&((*ConsoleInfo)->OurConOut));
|
||||
if (EFI_ERROR (Status)) {
|
||||
SHELL_FREE_NON_NULL ((*ConsoleInfo)->Buffer);
|
||||
SHELL_FREE_NON_NULL ((*ConsoleInfo)->Attributes);
|
||||
SHELL_FREE_NON_NULL ((*ConsoleInfo));
|
||||
*ConsoleInfo = NULL;
|
||||
return (Status);
|
||||
}
|
||||
@ -107,22 +108,31 @@ ConsoleLoggerInstall(
|
||||
@return other The operation failed. This was from UninstallProtocolInterface.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerUninstall(
|
||||
ConsoleLoggerUninstall (
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
)
|
||||
{
|
||||
ASSERT(ConsoleInfo != NULL);
|
||||
ASSERT(ConsoleInfo->OldConOut != NULL);
|
||||
ASSERT (ConsoleInfo != NULL);
|
||||
ASSERT (ConsoleInfo->OldConOut != NULL);
|
||||
|
||||
if (ConsoleInfo->Buffer != NULL) {
|
||||
FreePool(ConsoleInfo->Buffer);
|
||||
DEBUG_CODE(ConsoleInfo->Buffer = NULL;);
|
||||
DEBUG_CODE(ConsoleInfo->BufferSize = 0;);
|
||||
FreePool (ConsoleInfo->Buffer);
|
||||
DEBUG_CODE (
|
||||
ConsoleInfo->Buffer = NULL;
|
||||
);
|
||||
DEBUG_CODE (
|
||||
ConsoleInfo->BufferSize = 0;
|
||||
);
|
||||
}
|
||||
|
||||
if (ConsoleInfo->Attributes != NULL) {
|
||||
FreePool(ConsoleInfo->Attributes);
|
||||
DEBUG_CODE(ConsoleInfo->Attributes = NULL;);
|
||||
DEBUG_CODE(ConsoleInfo->AttribSize = 0;);
|
||||
FreePool (ConsoleInfo->Attributes);
|
||||
DEBUG_CODE (
|
||||
ConsoleInfo->Attributes = NULL;
|
||||
);
|
||||
DEBUG_CODE (
|
||||
ConsoleInfo->AttribSize = 0;
|
||||
);
|
||||
}
|
||||
|
||||
gST->ConsoleOutHandle = ConsoleInfo->OldConHandle;
|
||||
@ -138,7 +148,7 @@ ConsoleLoggerUninstall(
|
||||
&gST->Hdr.CRC32
|
||||
);
|
||||
|
||||
return (gBS->UninstallProtocolInterface(gImageHandle, &gEfiSimpleTextOutProtocolGuid, (VOID*)&ConsoleInfo->OurConOut));
|
||||
return (gBS->UninstallProtocolInterface (gImageHandle, &gEfiSimpleTextOutProtocolGuid, (VOID *)&ConsoleInfo->OurConOut));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -154,7 +164,7 @@ ConsoleLoggerUninstall(
|
||||
@param[in] ConsoleInfo The pointer to the instance of the console logger information.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerDisplayHistory(
|
||||
ConsoleLoggerDisplayHistory (
|
||||
IN CONST BOOLEAN Forward,
|
||||
IN CONST UINTN Rows,
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
@ -162,7 +172,7 @@ ConsoleLoggerDisplayHistory(
|
||||
{
|
||||
UINTN RowChange;
|
||||
|
||||
ASSERT(ConsoleInfo != NULL);
|
||||
ASSERT (ConsoleInfo != NULL);
|
||||
|
||||
//
|
||||
// Calculate the row number change
|
||||
@ -202,7 +212,7 @@ ConsoleLoggerDisplayHistory(
|
||||
//
|
||||
// Clear the screen
|
||||
//
|
||||
ConsoleInfo->OldConOut->ClearScreen(ConsoleInfo->OldConOut);
|
||||
ConsoleInfo->OldConOut->ClearScreen (ConsoleInfo->OldConOut);
|
||||
|
||||
//
|
||||
// Set the new start row
|
||||
@ -216,7 +226,7 @@ ConsoleLoggerDisplayHistory(
|
||||
//
|
||||
// Change the screen
|
||||
//
|
||||
return (UpdateDisplayFromHistory(ConsoleInfo));
|
||||
return (UpdateDisplayFromHistory (ConsoleInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,11 +239,11 @@ ConsoleLoggerDisplayHistory(
|
||||
@sa UpdateDisplayFromHistory
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerStopHistory(
|
||||
ConsoleLoggerStopHistory (
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
)
|
||||
{
|
||||
ASSERT(ConsoleInfo != NULL);
|
||||
ASSERT (ConsoleInfo != NULL);
|
||||
if (ConsoleInfo->CurrentStartRow == ConsoleInfo->OriginalStartRow) {
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
@ -241,10 +251,10 @@ ConsoleLoggerStopHistory(
|
||||
//
|
||||
// Clear the screen
|
||||
//
|
||||
ConsoleInfo->OldConOut->ClearScreen(ConsoleInfo->OldConOut);
|
||||
ConsoleInfo->OldConOut->ClearScreen (ConsoleInfo->OldConOut);
|
||||
|
||||
ConsoleInfo->CurrentStartRow = ConsoleInfo->OriginalStartRow;
|
||||
return (UpdateDisplayFromHistory(ConsoleInfo));
|
||||
return (UpdateDisplayFromHistory (ConsoleInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -255,7 +265,7 @@ ConsoleLoggerStopHistory(
|
||||
@return other The operation failed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
UpdateDisplayFromHistory(
|
||||
UpdateDisplayFromHistory (
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
)
|
||||
{
|
||||
@ -273,7 +283,7 @@ UpdateDisplayFromHistory(
|
||||
CHAR16 StringSegmentEndChar;
|
||||
INT32 OrigAttribute;
|
||||
|
||||
ASSERT(ConsoleInfo != NULL);
|
||||
ASSERT (ConsoleInfo != NULL);
|
||||
TempCharHolder = CHAR_NULL;
|
||||
RetVal = EFI_SUCCESS;
|
||||
OrigAttribute = ConsoleInfo->OldConOut->Mode->Attribute;
|
||||
@ -288,14 +298,15 @@ UpdateDisplayFromHistory(
|
||||
Attributes = &ConsoleInfo->Attributes[ConsoleInfo->ColsPerScreen * ConsoleInfo->CurrentStartRow];
|
||||
for ( CurrentRow = 0
|
||||
; CurrentRow < ConsoleInfo->RowsPerScreen
|
||||
; CurrentRow++
|
||||
, Screen += (ConsoleInfo->ColsPerScreen + 2)
|
||||
, Attributes += ConsoleInfo->ColsPerScreen
|
||||
){
|
||||
; CurrentRow++,
|
||||
Screen += (ConsoleInfo->ColsPerScreen + 2),
|
||||
Attributes += ConsoleInfo->ColsPerScreen
|
||||
)
|
||||
{
|
||||
//
|
||||
// dont use the last char - prevents screen scroll
|
||||
//
|
||||
if (CurrentRow == (ConsoleInfo->RowsPerScreen-1)){
|
||||
if (CurrentRow == (ConsoleInfo->RowsPerScreen-1)) {
|
||||
TempCharHolder = Screen[ConsoleInfo->ColsPerScreen - 1];
|
||||
Screen[ConsoleInfo->ColsPerScreen - 1] = CHAR_NULL;
|
||||
}
|
||||
@ -303,7 +314,8 @@ UpdateDisplayFromHistory(
|
||||
for ( Column = 0
|
||||
; Column < ConsoleInfo->ColsPerScreen
|
||||
; Column++
|
||||
){
|
||||
)
|
||||
{
|
||||
if (Screen[Column] != CHAR_NULL) {
|
||||
CurrentAttrib = Attributes[Column];
|
||||
CurrentColumn = Column;
|
||||
@ -317,9 +329,10 @@ UpdateDisplayFromHistory(
|
||||
StringSegmentEndChar = CHAR_NULL;
|
||||
for ( StringSegmentEnd = StringSegment
|
||||
; *StringSegmentEnd != CHAR_NULL
|
||||
; StringSegmentEnd++
|
||||
, Column++
|
||||
){
|
||||
; StringSegmentEnd++,
|
||||
Column++
|
||||
)
|
||||
{
|
||||
if (Attributes[Column] != CurrentAttrib) {
|
||||
StringSegmentEndChar = *StringSegmentEnd;
|
||||
*StringSegmentEnd = CHAR_NULL;
|
||||
@ -331,12 +344,12 @@ UpdateDisplayFromHistory(
|
||||
// Now write out as much as had the same Attributes
|
||||
//
|
||||
|
||||
ConsoleInfo->OldConOut->SetAttribute(ConsoleInfo->OldConOut, CurrentAttrib);
|
||||
ConsoleInfo->OldConOut->SetCursorPosition(ConsoleInfo->OldConOut, CurrentColumn, CurrentRow);
|
||||
Status = ConsoleInfo->OldConOut->OutputString(ConsoleInfo->OldConOut, StringSegment);
|
||||
ConsoleInfo->OldConOut->SetAttribute (ConsoleInfo->OldConOut, CurrentAttrib);
|
||||
ConsoleInfo->OldConOut->SetCursorPosition (ConsoleInfo->OldConOut, CurrentColumn, CurrentRow);
|
||||
Status = ConsoleInfo->OldConOut->OutputString (ConsoleInfo->OldConOut, StringSegment);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
ASSERT(FALSE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (FALSE);
|
||||
RetVal = Status;
|
||||
}
|
||||
|
||||
@ -413,7 +426,8 @@ ConsoleLoggerReset (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
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
|
||||
@ -424,7 +438,7 @@ ConsoleLoggerReset (
|
||||
// Check that the buffers are still correct for logging
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ConsoleLoggerResetBuffers(ConsoleInfo);
|
||||
ConsoleLoggerResetBuffers (ConsoleInfo);
|
||||
if (ExtendedVerification) {
|
||||
ConsoleInfo->OriginalStartRow = 0;
|
||||
ConsoleInfo->CurrentStartRow = 0;
|
||||
@ -443,7 +457,7 @@ ConsoleLoggerReset (
|
||||
@param[in] ConsoleInfo The pointer to the instance of the console logger information.
|
||||
**/
|
||||
EFI_STATUS
|
||||
AppendStringToHistory(
|
||||
AppendStringToHistory (
|
||||
IN CONST CHAR16 *String,
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
)
|
||||
@ -453,33 +467,35 @@ AppendStringToHistory(
|
||||
UINTN PrintIndex;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT(ConsoleInfo != NULL);
|
||||
ASSERT (ConsoleInfo != NULL);
|
||||
|
||||
for ( Walker = String
|
||||
; Walker != NULL && *Walker != CHAR_NULL
|
||||
; Walker++
|
||||
){
|
||||
)
|
||||
{
|
||||
switch (*Walker) {
|
||||
case (CHAR_BACKSPACE):
|
||||
if (ConsoleInfo->HistoryMode.CursorColumn > 0) {
|
||||
ConsoleInfo->HistoryMode.CursorColumn--;
|
||||
}
|
||||
|
||||
break;
|
||||
case (CHAR_LINEFEED):
|
||||
if (ConsoleInfo->HistoryMode.CursorRow >= (INT32)((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)-1)) {
|
||||
//
|
||||
// Should never be bigger
|
||||
//
|
||||
ASSERT(ConsoleInfo->HistoryMode.CursorRow == (INT32)((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)-1));
|
||||
ASSERT (ConsoleInfo->HistoryMode.CursorRow == (INT32)((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)-1));
|
||||
|
||||
//
|
||||
// scroll history attributes 'up' 1 row and set the last row to default attribute
|
||||
//
|
||||
CopySize = ConsoleInfo->ColsPerScreen
|
||||
* ((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount) - 1)
|
||||
* sizeof(ConsoleInfo->Attributes[0]);
|
||||
ASSERT(CopySize < ConsoleInfo->AttribSize);
|
||||
CopyMem(
|
||||
* sizeof (ConsoleInfo->Attributes[0]);
|
||||
ASSERT (CopySize < ConsoleInfo->AttribSize);
|
||||
CopyMem (
|
||||
ConsoleInfo->Attributes,
|
||||
ConsoleInfo->Attributes + ConsoleInfo->ColsPerScreen,
|
||||
CopySize
|
||||
@ -488,8 +504,9 @@ AppendStringToHistory(
|
||||
for ( Index = 0
|
||||
; Index < ConsoleInfo->ColsPerScreen
|
||||
; Index++
|
||||
){
|
||||
*(ConsoleInfo->Attributes + (CopySize/sizeof(ConsoleInfo->Attributes[0])) + Index) = ConsoleInfo->HistoryMode.Attribute;
|
||||
)
|
||||
{
|
||||
*(ConsoleInfo->Attributes + (CopySize/sizeof (ConsoleInfo->Attributes[0])) + Index) = ConsoleInfo->HistoryMode.Attribute;
|
||||
}
|
||||
|
||||
//
|
||||
@ -497,9 +514,9 @@ AppendStringToHistory(
|
||||
//
|
||||
CopySize = (ConsoleInfo->ColsPerScreen + 2)
|
||||
* ((ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount) - 1)
|
||||
* sizeof(ConsoleInfo->Buffer[0]);
|
||||
ASSERT(CopySize < ConsoleInfo->BufferSize);
|
||||
CopyMem(
|
||||
* sizeof (ConsoleInfo->Buffer[0]);
|
||||
ASSERT (CopySize < ConsoleInfo->BufferSize);
|
||||
CopyMem (
|
||||
ConsoleInfo->Buffer,
|
||||
ConsoleInfo->Buffer + (ConsoleInfo->ColsPerScreen + 2),
|
||||
CopySize
|
||||
@ -508,7 +525,7 @@ AppendStringToHistory(
|
||||
//
|
||||
// Set that last row of chars to spaces
|
||||
//
|
||||
SetMem16(((UINT8*)ConsoleInfo->Buffer)+CopySize, ConsoleInfo->ColsPerScreen*sizeof(CHAR16), L' ');
|
||||
SetMem16 (((UINT8 *)ConsoleInfo->Buffer)+CopySize, ConsoleInfo->ColsPerScreen*sizeof (CHAR16), L' ');
|
||||
} else {
|
||||
//
|
||||
// we are not on the last row
|
||||
@ -521,12 +538,14 @@ AppendStringToHistory(
|
||||
//
|
||||
// are we at the end of a row?
|
||||
//
|
||||
if (ConsoleInfo->HistoryMode.CursorRow == (INT32) (ConsoleInfo->OriginalStartRow + ConsoleInfo->RowsPerScreen - 1)) {
|
||||
if (ConsoleInfo->HistoryMode.CursorRow == (INT32)(ConsoleInfo->OriginalStartRow + ConsoleInfo->RowsPerScreen - 1)) {
|
||||
ConsoleInfo->OriginalStartRow++;
|
||||
ConsoleInfo->CurrentStartRow++;
|
||||
}
|
||||
|
||||
ConsoleInfo->HistoryMode.CursorRow++;
|
||||
}
|
||||
|
||||
break;
|
||||
case (CHAR_CARRIAGE_RETURN):
|
||||
//
|
||||
@ -542,26 +561,29 @@ AppendStringToHistory(
|
||||
PrintIndex = ConsoleInfo->HistoryMode.CursorRow * ConsoleInfo->ColsPerScreen + ConsoleInfo->HistoryMode.CursorColumn;
|
||||
|
||||
for ( // no initializer needed
|
||||
; ConsoleInfo->HistoryMode.CursorColumn < (INT32) ConsoleInfo->ColsPerScreen
|
||||
; ConsoleInfo->HistoryMode.CursorColumn++
|
||||
, PrintIndex++
|
||||
, Walker++
|
||||
){
|
||||
if (*Walker == CHAR_NULL
|
||||
||*Walker == CHAR_BACKSPACE
|
||||
||*Walker == CHAR_LINEFEED
|
||||
||*Walker == CHAR_CARRIAGE_RETURN
|
||||
){
|
||||
; ConsoleInfo->HistoryMode.CursorColumn < (INT32)ConsoleInfo->ColsPerScreen
|
||||
; ConsoleInfo->HistoryMode.CursorColumn++,
|
||||
PrintIndex++,
|
||||
Walker++
|
||||
)
|
||||
{
|
||||
if ( (*Walker == CHAR_NULL)
|
||||
|| (*Walker == CHAR_BACKSPACE)
|
||||
|| (*Walker == CHAR_LINEFEED)
|
||||
|| (*Walker == CHAR_CARRIAGE_RETURN)
|
||||
)
|
||||
{
|
||||
Walker--;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// The buffer is 2*CursorRow more since it has that many \r\n characters at the end of each row.
|
||||
//
|
||||
|
||||
ASSERT(PrintIndex + ConsoleInfo->HistoryMode.CursorRow < ConsoleInfo->BufferSize);
|
||||
ASSERT (PrintIndex + ConsoleInfo->HistoryMode.CursorRow < ConsoleInfo->BufferSize);
|
||||
ConsoleInfo->Buffer[PrintIndex + (2*ConsoleInfo->HistoryMode.CursorRow)] = *Walker;
|
||||
ASSERT(PrintIndex < ConsoleInfo->AttribSize);
|
||||
ASSERT (PrintIndex < ConsoleInfo->AttribSize);
|
||||
ConsoleInfo->Attributes[PrintIndex] = ConsoleInfo->HistoryMode.Attribute;
|
||||
} // for loop
|
||||
|
||||
@ -569,7 +591,7 @@ AppendStringToHistory(
|
||||
// Add the carriage return and line feed at the end of the lines
|
||||
//
|
||||
if (ConsoleInfo->HistoryMode.CursorColumn >= (INT32)ConsoleInfo->ColsPerScreen) {
|
||||
AppendStringToHistory(L"\r\n", ConsoleInfo);
|
||||
AppendStringToHistory (L"\r\n", ConsoleInfo);
|
||||
Walker--;
|
||||
}
|
||||
|
||||
@ -597,7 +619,7 @@ AppendStringToHistory(
|
||||
rendered and were skipped.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerOutputStringSplit(
|
||||
ConsoleLoggerOutputStringSplit (
|
||||
IN CONST CHAR16 *String,
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
)
|
||||
@ -607,13 +629,13 @@ ConsoleLoggerOutputStringSplit(
|
||||
//
|
||||
// Forward the request to the original ConOut
|
||||
//
|
||||
Status = ConsoleInfo->OldConOut->OutputString (ConsoleInfo->OldConOut, (CHAR16*)String);
|
||||
Status = ConsoleInfo->OldConOut->OutputString (ConsoleInfo->OldConOut, (CHAR16 *)String);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return (Status);
|
||||
}
|
||||
|
||||
return (AppendStringToHistory(String, ConsoleInfo));
|
||||
return (AppendStringToHistory (String, ConsoleInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -625,7 +647,7 @@ ConsoleLoggerOutputStringSplit(
|
||||
@return other Break was choosen
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerDoPageBreak(
|
||||
ConsoleLoggerDoPageBreak (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
@ -633,29 +655,32 @@ ConsoleLoggerDoPageBreak(
|
||||
EFI_STATUS Status;
|
||||
|
||||
Resp = NULL;
|
||||
ASSERT(ShellInfoObject.PageBreakEnabled);
|
||||
ASSERT (ShellInfoObject.PageBreakEnabled);
|
||||
ShellInfoObject.PageBreakEnabled = FALSE;
|
||||
Status = ShellPromptForResponseHii(ShellPromptResponseTypeQuitContinue, STRING_TOKEN(STR_SHELL_QUIT_CONT), ShellInfoObject.HiiHandle, (VOID**)&Resp);
|
||||
Status = ShellPromptForResponseHii (ShellPromptResponseTypeQuitContinue, STRING_TOKEN (STR_SHELL_QUIT_CONT), ShellInfoObject.HiiHandle, (VOID **)&Resp);
|
||||
ShellInfoObject.PageBreakEnabled = TRUE;
|
||||
ASSERT(Resp != NULL);
|
||||
ASSERT (Resp != NULL);
|
||||
if (Resp == NULL) {
|
||||
return (EFI_NOT_FOUND);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Resp != NULL) {
|
||||
FreePool(Resp);
|
||||
FreePool (Resp);
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
if (*Resp == ShellPromptResponseContinue) {
|
||||
FreePool(Resp);
|
||||
FreePool (Resp);
|
||||
ShellInfoObject.ConsoleInfo->RowCounter = 0;
|
||||
// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorRow = 0;
|
||||
// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
|
||||
// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorRow = 0;
|
||||
// ShellInfoObject.ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
|
||||
|
||||
return (EFI_SUCCESS);
|
||||
} else if (*Resp == ShellPromptResponseQuit) {
|
||||
FreePool(Resp);
|
||||
FreePool (Resp);
|
||||
ShellInfoObject.ConsoleInfo->Enabled = FALSE;
|
||||
//
|
||||
// When user wants to quit, the shell should stop running the command.
|
||||
@ -663,10 +688,12 @@ ConsoleLoggerDoPageBreak(
|
||||
gBS->SignalEvent (ShellInfoObject.NewEfiShellProtocol->ExecutionBreak);
|
||||
return (EFI_DEVICE_ERROR);
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
Worker function to handle printing the output with page breaks.
|
||||
|
||||
@ -683,7 +710,7 @@ ConsoleLoggerDoPageBreak(
|
||||
rendered and were skipped.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerPrintWithPageBreak(
|
||||
ConsoleLoggerPrintWithPageBreak (
|
||||
IN CONST CHAR16 *String,
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
)
|
||||
@ -694,28 +721,30 @@ ConsoleLoggerPrintWithPageBreak(
|
||||
CHAR16 TempChar;
|
||||
|
||||
StringCopy = NULL;
|
||||
StringCopy = StrnCatGrow(&StringCopy, NULL, String, 0);
|
||||
StringCopy = StrnCatGrow (&StringCopy, NULL, String, 0);
|
||||
if (StringCopy == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
for ( Walker = StringCopy
|
||||
, LineStart = StringCopy
|
||||
for ( Walker = StringCopy,
|
||||
LineStart = StringCopy
|
||||
; Walker != NULL && *Walker != CHAR_NULL
|
||||
; Walker++
|
||||
){
|
||||
)
|
||||
{
|
||||
switch (*Walker) {
|
||||
case (CHAR_BACKSPACE):
|
||||
if (ConsoleInfo->OurConOut.Mode->CursorColumn > 0) {
|
||||
ConsoleInfo->OurConOut.Mode->CursorColumn--;
|
||||
}
|
||||
|
||||
break;
|
||||
case (CHAR_LINEFEED):
|
||||
//
|
||||
// add a temp NULL terminator
|
||||
//
|
||||
TempChar = *(Walker + 1);
|
||||
*((CHAR16*)(Walker+1)) = CHAR_NULL;
|
||||
*((CHAR16 *)(Walker+1)) = CHAR_NULL;
|
||||
|
||||
//
|
||||
// output the string
|
||||
@ -725,7 +754,7 @@ ConsoleLoggerPrintWithPageBreak(
|
||||
//
|
||||
// restore the temp NULL terminator to its original character
|
||||
//
|
||||
*((CHAR16*)(Walker+1)) = TempChar;
|
||||
*((CHAR16 *)(Walker+1)) = TempChar;
|
||||
|
||||
//
|
||||
// Update LineStart Variable
|
||||
@ -762,7 +791,7 @@ ConsoleLoggerPrintWithPageBreak(
|
||||
// add a temp NULL terminator
|
||||
//
|
||||
TempChar = *(Walker + 1);
|
||||
*((CHAR16*)(Walker+1)) = CHAR_NULL;
|
||||
*((CHAR16 *)(Walker+1)) = CHAR_NULL;
|
||||
|
||||
//
|
||||
// output the string
|
||||
@ -772,7 +801,7 @@ ConsoleLoggerPrintWithPageBreak(
|
||||
//
|
||||
// restore the temp NULL terminator to its original character
|
||||
//
|
||||
*((CHAR16*)(Walker+1)) = TempChar;
|
||||
*((CHAR16 *)(Walker+1)) = TempChar;
|
||||
|
||||
//
|
||||
// Update LineStart Variable
|
||||
@ -786,6 +815,7 @@ ConsoleLoggerPrintWithPageBreak(
|
||||
ConsoleInfo->OurConOut.Mode->CursorRow++;
|
||||
ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
|
||||
} // last column on line
|
||||
|
||||
break;
|
||||
} // switch for character
|
||||
|
||||
@ -793,21 +823,21 @@ ConsoleLoggerPrintWithPageBreak(
|
||||
// check if that was the last printable row. If yes handle PageBreak mode
|
||||
//
|
||||
if ((ConsoleInfo->RowsPerScreen) -1 == ShellInfoObject.ConsoleInfo->RowCounter) {
|
||||
if (EFI_ERROR(ConsoleLoggerDoPageBreak())) {
|
||||
if (EFI_ERROR (ConsoleLoggerDoPageBreak ())) {
|
||||
//
|
||||
// We got an error which means 'break' and halt the printing
|
||||
//
|
||||
SHELL_FREE_NON_NULL(StringCopy);
|
||||
SHELL_FREE_NON_NULL (StringCopy);
|
||||
return (EFI_DEVICE_ERROR);
|
||||
}
|
||||
}
|
||||
} // for loop
|
||||
|
||||
if (LineStart != NULL && *LineStart != CHAR_NULL) {
|
||||
if ((LineStart != NULL) && (*LineStart != CHAR_NULL)) {
|
||||
ConsoleLoggerOutputStringSplit (LineStart, ConsoleInfo);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL(StringCopy);
|
||||
SHELL_FREE_NON_NULL (StringCopy);
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
@ -840,16 +870,16 @@ ConsoleLoggerOutputString (
|
||||
UINTN EventIndex;
|
||||
CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo;
|
||||
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||
if (ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleOut) {
|
||||
return (EFI_UNSUPPORTED);
|
||||
}
|
||||
ASSERT(ShellInfoObject.ConsoleInfo == ConsoleInfo);
|
||||
|
||||
Status = gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **) &TxtInEx);
|
||||
ASSERT (ShellInfoObject.ConsoleInfo == ConsoleInfo);
|
||||
|
||||
Status = gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInputExProtocolGuid, (VOID **)&TxtInEx);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
while (ShellInfoObject.HaltOutput) {
|
||||
|
||||
ShellInfoObject.HaltOutput = FALSE;
|
||||
//
|
||||
// just get some key
|
||||
@ -857,7 +887,7 @@ ConsoleLoggerOutputString (
|
||||
Status = gBS->WaitForEvent (1, &TxtInEx->WaitForKeyEx, &EventIndex);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
Status = TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -865,7 +895,8 @@ ConsoleLoggerOutputString (
|
||||
((KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED)) ||
|
||||
(KeyData.KeyState.KeyShiftState == (EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED))
|
||||
)
|
||||
) {
|
||||
)
|
||||
{
|
||||
ShellInfoObject.HaltOutput = TRUE;
|
||||
}
|
||||
}
|
||||
@ -874,9 +905,9 @@ ConsoleLoggerOutputString (
|
||||
if (!ShellInfoObject.ConsoleInfo->Enabled) {
|
||||
return (EFI_DEVICE_ERROR);
|
||||
} else if (ShellInfoObject.PageBreakEnabled) {
|
||||
return (ConsoleLoggerPrintWithPageBreak(WString, ConsoleInfo));
|
||||
return (ConsoleLoggerPrintWithPageBreak (WString, ConsoleInfo));
|
||||
} else {
|
||||
return (ConsoleLoggerOutputStringSplit(WString, ConsoleInfo));
|
||||
return (ConsoleLoggerOutputStringSplit (WString, ConsoleInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@ -902,7 +933,8 @@ ConsoleLoggerTestString (
|
||||
)
|
||||
{
|
||||
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
|
||||
//
|
||||
@ -933,7 +965,8 @@ ConsoleLoggerQueryMode (
|
||||
)
|
||||
{
|
||||
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
|
||||
//
|
||||
@ -967,7 +1000,8 @@ ConsoleLoggerSetMode (
|
||||
EFI_STATUS Status;
|
||||
|
||||
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
|
||||
@ -979,7 +1013,7 @@ ConsoleLoggerSetMode (
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ConsoleInfo->OurConOut.Mode = ConsoleInfo->OldConOut->Mode;
|
||||
ConsoleLoggerResetBuffers(ConsoleInfo);
|
||||
ConsoleLoggerResetBuffers (ConsoleInfo);
|
||||
ConsoleInfo->OriginalStartRow = 0;
|
||||
ConsoleInfo->CurrentStartRow = 0;
|
||||
ConsoleInfo->OurConOut.ClearScreen (&ConsoleInfo->OurConOut);
|
||||
@ -1013,7 +1047,8 @@ ConsoleLoggerSetAttribute (
|
||||
EFI_STATUS Status;
|
||||
|
||||
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
|
||||
@ -1024,7 +1059,7 @@ ConsoleLoggerSetAttribute (
|
||||
// Record console output history
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ConsoleInfo->HistoryMode.Attribute = (INT32) Attribute;
|
||||
ConsoleInfo->HistoryMode.Attribute = (INT32)Attribute;
|
||||
}
|
||||
|
||||
return Status;
|
||||
@ -1058,7 +1093,7 @@ ConsoleLoggerClearScreen (
|
||||
return (EFI_UNSUPPORTED);
|
||||
}
|
||||
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
//
|
||||
// Forward the request to the original ConOut
|
||||
@ -1074,21 +1109,25 @@ ConsoleLoggerClearScreen (
|
||||
for ( Row = ConsoleInfo->OriginalStartRow
|
||||
; Row < (ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount)
|
||||
; Row++
|
||||
){
|
||||
)
|
||||
{
|
||||
for ( Column = 0
|
||||
; Column < ConsoleInfo->ColsPerScreen
|
||||
; Column++
|
||||
, Screen++
|
||||
, Attributes++
|
||||
){
|
||||
; Column++,
|
||||
Screen++,
|
||||
Attributes++
|
||||
)
|
||||
{
|
||||
*Screen = L' ';
|
||||
*Attributes = ConsoleInfo->OldConOut->Mode->Attribute;
|
||||
}
|
||||
|
||||
//
|
||||
// Skip the NULL on each column end in text buffer only
|
||||
//
|
||||
Screen += 2;
|
||||
}
|
||||
|
||||
ConsoleInfo->HistoryMode.CursorColumn = 0;
|
||||
ConsoleInfo->HistoryMode.CursorRow = 0;
|
||||
}
|
||||
@ -1124,7 +1163,7 @@ ConsoleLoggerSetCursorPosition (
|
||||
return (EFI_UNSUPPORTED);
|
||||
}
|
||||
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(This);
|
||||
ConsoleInfo = CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS (This);
|
||||
//
|
||||
// Forward the request to the original ConOut
|
||||
//
|
||||
@ -1168,7 +1207,8 @@ ConsoleLoggerEnableCursor (
|
||||
EFI_STATUS Status;
|
||||
|
||||
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
|
||||
//
|
||||
@ -1193,40 +1233,41 @@ ConsoleLoggerEnableCursor (
|
||||
history buffers.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerResetBuffers(
|
||||
ConsoleLoggerResetBuffers (
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (ConsoleInfo->Buffer != NULL) {
|
||||
FreePool(ConsoleInfo->Buffer);
|
||||
FreePool (ConsoleInfo->Buffer);
|
||||
ConsoleInfo->Buffer = NULL;
|
||||
ConsoleInfo->BufferSize = 0;
|
||||
}
|
||||
|
||||
if (ConsoleInfo->Attributes != NULL) {
|
||||
FreePool(ConsoleInfo->Attributes);
|
||||
FreePool (ConsoleInfo->Attributes);
|
||||
ConsoleInfo->Attributes = NULL;
|
||||
ConsoleInfo->AttribSize = 0;
|
||||
}
|
||||
|
||||
Status = gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &ConsoleInfo->ColsPerScreen, &ConsoleInfo->RowsPerScreen);
|
||||
if (EFI_ERROR(Status)){
|
||||
if (EFI_ERROR (Status)) {
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ConsoleInfo->BufferSize = (ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount * sizeof(ConsoleInfo->Buffer[0]);
|
||||
ConsoleInfo->AttribSize = ConsoleInfo->ColsPerScreen * ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount * sizeof(ConsoleInfo->Attributes[0]);
|
||||
ConsoleInfo->BufferSize = (ConsoleInfo->ColsPerScreen + 2) * ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount * sizeof (ConsoleInfo->Buffer[0]);
|
||||
ConsoleInfo->AttribSize = ConsoleInfo->ColsPerScreen * ConsoleInfo->RowsPerScreen * ConsoleInfo->ScreenCount * sizeof (ConsoleInfo->Attributes[0]);
|
||||
|
||||
ConsoleInfo->Buffer = (CHAR16*)AllocateZeroPool(ConsoleInfo->BufferSize);
|
||||
ConsoleInfo->Buffer = (CHAR16 *)AllocateZeroPool (ConsoleInfo->BufferSize);
|
||||
|
||||
if (ConsoleInfo->Buffer == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
ConsoleInfo->Attributes = (INT32*)AllocateZeroPool(ConsoleInfo->AttribSize);
|
||||
ConsoleInfo->Attributes = (INT32 *)AllocateZeroPool (ConsoleInfo->AttribSize);
|
||||
if (ConsoleInfo->Attributes == NULL) {
|
||||
FreePool(ConsoleInfo->Buffer);
|
||||
FreePool (ConsoleInfo->Buffer);
|
||||
ConsoleInfo->Buffer = NULL;
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('c', 'o', 'P', 'D')
|
||||
|
||||
typedef struct _CONSOLE_LOGGER_PRIVATE_DATA{
|
||||
typedef struct _CONSOLE_LOGGER_PRIVATE_DATA {
|
||||
UINTN Signature;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL OurConOut; ///< the protocol we installed onto the system table
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OldConOut; ///< old protocol to reinstall upon exiting
|
||||
@ -52,7 +52,7 @@ typedef struct _CONSOLE_LOGGER_PRIVATE_DATA{
|
||||
@sa InstallProtocolInterface
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerInstall(
|
||||
ConsoleLoggerInstall (
|
||||
IN CONST UINTN ScreensToSave,
|
||||
OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo
|
||||
);
|
||||
@ -67,7 +67,7 @@ ConsoleLoggerInstall(
|
||||
@return other The operation failed. This was from UninstallProtocolInterface.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerUninstall(
|
||||
ConsoleLoggerUninstall (
|
||||
IN OUT CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
);
|
||||
|
||||
@ -84,7 +84,7 @@ ConsoleLoggerUninstall(
|
||||
@param[in] ConsoleInfo The pointer to the instance of the console logger information.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerDisplayHistory(
|
||||
ConsoleLoggerDisplayHistory (
|
||||
IN CONST BOOLEAN Forward,
|
||||
IN CONST UINTN Rows,
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
@ -100,7 +100,7 @@ ConsoleLoggerDisplayHistory(
|
||||
@sa UpdateDisplayFromHistory
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerStopHistory(
|
||||
ConsoleLoggerStopHistory (
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
);
|
||||
|
||||
@ -112,7 +112,7 @@ ConsoleLoggerStopHistory(
|
||||
@return other The operation failed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
UpdateDisplayFromHistory(
|
||||
UpdateDisplayFromHistory (
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
);
|
||||
|
||||
@ -151,7 +151,7 @@ ConsoleLoggerReset (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConsoleLoggerOutputString(
|
||||
ConsoleLoggerOutputString (
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
|
||||
IN CHAR16 *WString
|
||||
);
|
||||
@ -309,9 +309,8 @@ ConsoleLoggerEnableCursor (
|
||||
history buffers.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ConsoleLoggerResetBuffers(
|
||||
ConsoleLoggerResetBuffers (
|
||||
IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo
|
||||
);
|
||||
|
||||
#endif //_CONSOLE_LOGGER_HEADER_
|
||||
|
||||
|
@ -53,7 +53,7 @@ ConInWaitForKey (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FileBasedSimpleTextInReset(
|
||||
FileBasedSimpleTextInReset (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
@ -71,7 +71,7 @@ FileBasedSimpleTextInReset(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FileBasedSimpleTextInReadKeyStroke(
|
||||
FileBasedSimpleTextInReadKeyStroke (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
|
||||
IN OUT EFI_INPUT_KEY *Key
|
||||
)
|
||||
@ -82,7 +82,7 @@ FileBasedSimpleTextInReadKeyStroke(
|
||||
//
|
||||
// Verify the parameters
|
||||
//
|
||||
if (Key == NULL || This == NULL) {
|
||||
if ((Key == NULL) || (This == NULL)) {
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
@ -93,13 +93,14 @@ FileBasedSimpleTextInReadKeyStroke(
|
||||
return (EFI_NOT_READY);
|
||||
}
|
||||
|
||||
Size = sizeof(CHAR16);
|
||||
Size = sizeof (CHAR16);
|
||||
|
||||
if(!AsciiRedirection) {
|
||||
CharSize = sizeof(CHAR16);
|
||||
if (!AsciiRedirection) {
|
||||
CharSize = sizeof (CHAR16);
|
||||
} else {
|
||||
CharSize = sizeof(CHAR8);
|
||||
CharSize = sizeof (CHAR8);
|
||||
}
|
||||
|
||||
//
|
||||
// Decrement the amount of free space by Size or set to zero (for odd length files)
|
||||
//
|
||||
@ -110,10 +111,11 @@ FileBasedSimpleTextInReadKeyStroke(
|
||||
}
|
||||
|
||||
Key->ScanCode = 0;
|
||||
return (ShellInfoObject.NewEfiShellProtocol->ReadFile(
|
||||
return (ShellInfoObject.NewEfiShellProtocol->ReadFile (
|
||||
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)This)->FileHandle,
|
||||
&Size,
|
||||
&Key->UnicodeChar));
|
||||
&Key->UnicodeChar
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,8 +128,8 @@ FileBasedSimpleTextInReadKeyStroke(
|
||||
@retval NULL There was insufficient memory available.
|
||||
@return A pointer to the allocated protocol structure;
|
||||
**/
|
||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL*
|
||||
CreateSimpleTextInOnFile(
|
||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *
|
||||
CreateSimpleTextInOnFile (
|
||||
IN SHELL_FILE_HANDLE FileHandleToUse,
|
||||
IN EFI_HANDLE *HandleLocation
|
||||
)
|
||||
@ -137,17 +139,17 @@ CreateSimpleTextInOnFile(
|
||||
UINT64 CurrentPosition;
|
||||
UINT64 FileSize;
|
||||
|
||||
if (HandleLocation == NULL || FileHandleToUse == NULL) {
|
||||
if ((HandleLocation == NULL) || (FileHandleToUse == NULL)) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL));
|
||||
ProtocolToReturn = AllocateZeroPool (sizeof (SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL));
|
||||
if (ProtocolToReturn == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ShellGetFileSize (FileHandleToUse, &FileSize);
|
||||
ShellGetFilePosition(FileHandleToUse, &CurrentPosition);
|
||||
ShellGetFilePosition (FileHandleToUse, &CurrentPosition);
|
||||
|
||||
//
|
||||
// Initialize the protocol members
|
||||
@ -165,21 +167,23 @@ CreateSimpleTextInOnFile(
|
||||
&ProtocolToReturn->SimpleTextIn.WaitForKey
|
||||
);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreePool(ProtocolToReturn);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (ProtocolToReturn);
|
||||
return (NULL);
|
||||
}
|
||||
///@todo possibly also install SimpleTextInputEx on the handle at this point.
|
||||
Status = gBS->InstallProtocolInterface(
|
||||
|
||||
/// @todo possibly also install SimpleTextInputEx on the handle at this point.
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&(ProtocolToReturn->TheHandle),
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&(ProtocolToReturn->SimpleTextIn));
|
||||
if (!EFI_ERROR(Status)) {
|
||||
&(ProtocolToReturn->SimpleTextIn)
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*HandleLocation = ProtocolToReturn->TheHandle;
|
||||
return ((EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)ProtocolToReturn);
|
||||
return ((EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)ProtocolToReturn);
|
||||
} else {
|
||||
FreePool(ProtocolToReturn);
|
||||
FreePool (ProtocolToReturn);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
@ -193,7 +197,7 @@ CreateSimpleTextInOnFile(
|
||||
@retval EFI_SUCCESS The object was closed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
CloseSimpleTextInOnFile(
|
||||
CloseSimpleTextInOnFile (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn
|
||||
)
|
||||
{
|
||||
@ -204,15 +208,16 @@ CloseSimpleTextInOnFile(
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
Status = gBS->CloseEvent(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn.WaitForKey);
|
||||
Status = gBS->CloseEvent (((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn.WaitForKey);
|
||||
|
||||
Status1 = gBS->UninstallProtocolInterface(
|
||||
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->TheHandle,
|
||||
Status1 = gBS->UninstallProtocolInterface (
|
||||
((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->TheHandle,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
&(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->SimpleTextIn));
|
||||
&(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn)
|
||||
);
|
||||
|
||||
FreePool(SimpleTextIn);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
FreePool (SimpleTextIn);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return (Status1);
|
||||
} else {
|
||||
return (Status);
|
||||
@ -281,11 +286,12 @@ FileBasedSimpleTextOutQueryMode (
|
||||
PassThruProtocol = ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->OriginalSimpleTextOut;
|
||||
|
||||
// Pass the QueryMode call thru to the original SimpleTextOutProtocol
|
||||
return (PassThruProtocol->QueryMode(
|
||||
return (PassThruProtocol->QueryMode (
|
||||
PassThruProtocol,
|
||||
ModeNumber,
|
||||
Columns,
|
||||
Rows));
|
||||
Rows
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,11 +413,13 @@ FileBasedSimpleTextOutOutputString (
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
Size = StrLen(WString) * sizeof(CHAR16);
|
||||
return (ShellInfoObject.NewEfiShellProtocol->WriteFile(
|
||||
|
||||
Size = StrLen (WString) * sizeof (CHAR16);
|
||||
return (ShellInfoObject.NewEfiShellProtocol->WriteFile (
|
||||
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->FileHandle,
|
||||
&Size,
|
||||
WString));
|
||||
WString
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -425,8 +433,8 @@ FileBasedSimpleTextOutOutputString (
|
||||
@retval NULL There was insufficient memory available.
|
||||
@return A pointer to the allocated protocol structure;
|
||||
**/
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*
|
||||
CreateSimpleTextOutOnFile(
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *
|
||||
CreateSimpleTextOutOnFile (
|
||||
IN SHELL_FILE_HANDLE FileHandleToUse,
|
||||
IN EFI_HANDLE *HandleLocation,
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol
|
||||
@ -435,14 +443,15 @@ CreateSimpleTextOutOnFile(
|
||||
SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ProtocolToReturn;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (HandleLocation == NULL || FileHandleToUse == NULL) {
|
||||
if ((HandleLocation == NULL) || (FileHandleToUse == NULL)) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ProtocolToReturn = AllocateZeroPool(sizeof(SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL));
|
||||
ProtocolToReturn = AllocateZeroPool (sizeof (SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL));
|
||||
if (ProtocolToReturn == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ProtocolToReturn->FileHandle = FileHandleToUse;
|
||||
ProtocolToReturn->OriginalSimpleTextOut = OriginalProtocol;
|
||||
ProtocolToReturn->SimpleTextOut.Reset = FileBasedSimpleTextOutReset;
|
||||
@ -454,11 +463,12 @@ CreateSimpleTextOutOnFile(
|
||||
ProtocolToReturn->SimpleTextOut.SetCursorPosition = FileBasedSimpleTextOutSetCursorPosition;
|
||||
ProtocolToReturn->SimpleTextOut.EnableCursor = FileBasedSimpleTextOutEnableCursor;
|
||||
ProtocolToReturn->SimpleTextOut.OutputString = FileBasedSimpleTextOutOutputString;
|
||||
ProtocolToReturn->SimpleTextOut.Mode = AllocateZeroPool(sizeof(EFI_SIMPLE_TEXT_OUTPUT_MODE));
|
||||
ProtocolToReturn->SimpleTextOut.Mode = AllocateZeroPool (sizeof (EFI_SIMPLE_TEXT_OUTPUT_MODE));
|
||||
if (ProtocolToReturn->SimpleTextOut.Mode == NULL) {
|
||||
FreePool(ProtocolToReturn);
|
||||
FreePool (ProtocolToReturn);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ProtocolToReturn->SimpleTextOut.Mode->MaxMode = OriginalProtocol->Mode->MaxMode;
|
||||
ProtocolToReturn->SimpleTextOut.Mode->Mode = OriginalProtocol->Mode->Mode;
|
||||
ProtocolToReturn->SimpleTextOut.Mode->Attribute = OriginalProtocol->Mode->Attribute;
|
||||
@ -466,17 +476,18 @@ CreateSimpleTextOutOnFile(
|
||||
ProtocolToReturn->SimpleTextOut.Mode->CursorRow = OriginalProtocol->Mode->CursorRow;
|
||||
ProtocolToReturn->SimpleTextOut.Mode->CursorVisible = OriginalProtocol->Mode->CursorVisible;
|
||||
|
||||
Status = gBS->InstallProtocolInterface(
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&(ProtocolToReturn->TheHandle),
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&(ProtocolToReturn->SimpleTextOut));
|
||||
if (!EFI_ERROR(Status)) {
|
||||
&(ProtocolToReturn->SimpleTextOut)
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*HandleLocation = ProtocolToReturn->TheHandle;
|
||||
return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)ProtocolToReturn);
|
||||
return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)ProtocolToReturn);
|
||||
} else {
|
||||
SHELL_FREE_NON_NULL(ProtocolToReturn->SimpleTextOut.Mode);
|
||||
SHELL_FREE_NON_NULL(ProtocolToReturn);
|
||||
SHELL_FREE_NON_NULL (ProtocolToReturn->SimpleTextOut.Mode);
|
||||
SHELL_FREE_NON_NULL (ProtocolToReturn);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
@ -490,19 +501,22 @@ CreateSimpleTextOutOnFile(
|
||||
@retval EFI_SUCCESS The object was closed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
CloseSimpleTextOutOnFile(
|
||||
CloseSimpleTextOutOnFile (
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (SimpleTextOut == NULL) {
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
Status = gBS->UninstallProtocolInterface(
|
||||
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->TheHandle,
|
||||
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->TheHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
&(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut));
|
||||
FreePool(SimpleTextOut->Mode);
|
||||
FreePool(SimpleTextOut);
|
||||
&(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)SimpleTextOut)->SimpleTextOut)
|
||||
);
|
||||
FreePool (SimpleTextOut->Mode);
|
||||
FreePool (SimpleTextOut);
|
||||
return (Status);
|
||||
}
|
||||
|
@ -20,8 +20,8 @@
|
||||
@retval NULL There was insufficient memory available.
|
||||
@return A pointer to the allocated protocol structure;
|
||||
**/
|
||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL*
|
||||
CreateSimpleTextInOnFile(
|
||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *
|
||||
CreateSimpleTextInOnFile (
|
||||
IN SHELL_FILE_HANDLE FileHandleToUse,
|
||||
IN EFI_HANDLE *HandleLocation
|
||||
);
|
||||
@ -35,7 +35,7 @@ CreateSimpleTextInOnFile(
|
||||
@retval EFI_SUCCESS The object was closed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
CloseSimpleTextInOnFile(
|
||||
CloseSimpleTextInOnFile (
|
||||
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn
|
||||
);
|
||||
|
||||
@ -50,8 +50,8 @@ CloseSimpleTextInOnFile(
|
||||
@retval NULL There was insufficient memory available.
|
||||
@return A pointer to the allocated protocol structure;
|
||||
**/
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*
|
||||
CreateSimpleTextOutOnFile(
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *
|
||||
CreateSimpleTextOutOnFile (
|
||||
IN SHELL_FILE_HANDLE FileHandleToUse,
|
||||
IN EFI_HANDLE *HandleLocation,
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OriginalProtocol
|
||||
@ -66,9 +66,8 @@ CreateSimpleTextOutOnFile(
|
||||
@retval EFI_SUCCESS The object was closed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
CloseSimpleTextOutOnFile(
|
||||
CloseSimpleTextOutOnFile (
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut
|
||||
);
|
||||
|
||||
#endif //_SHELL_CONSOLE_WRAPPERS_HEADER_
|
||||
|
||||
|
@ -56,4 +56,3 @@ PrintCommandHistory (
|
||||
);
|
||||
|
||||
#endif //_FILE_HANDLE_INTERNAL_HEADER_
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@
|
||||
|
||||
typedef struct {
|
||||
LIST_ENTRY Link;
|
||||
CHAR16* Buffer;
|
||||
CHAR16 *Buffer;
|
||||
} SHELL_LINE_LIST;
|
||||
|
||||
typedef struct {
|
||||
@ -48,8 +48,8 @@ extern EFI_FILE_PROTOCOL FileInterfaceNulFile;
|
||||
@retval NULL Memory could not be allocated.
|
||||
@return other a pointer to an EFI_FILE_PROTOCOL structure
|
||||
**/
|
||||
EFI_FILE_PROTOCOL*
|
||||
CreateFileInterfaceEnv(
|
||||
EFI_FILE_PROTOCOL *
|
||||
CreateFileInterfaceEnv (
|
||||
CONST CHAR16 *EnvName
|
||||
);
|
||||
|
||||
@ -62,8 +62,8 @@ CreateFileInterfaceEnv(
|
||||
@retval NULL Memory could not be allocated.
|
||||
@return other a pointer to an EFI_FILE_PROTOCOL structure
|
||||
**/
|
||||
EFI_FILE_PROTOCOL*
|
||||
CreateFileInterfaceMem(
|
||||
EFI_FILE_PROTOCOL *
|
||||
CreateFileInterfaceMem (
|
||||
IN CONST BOOLEAN Unicode
|
||||
);
|
||||
|
||||
@ -77,11 +77,10 @@ CreateFileInterfaceMem(
|
||||
@retval NULL Memory could not be allocated.
|
||||
@return other a pointer to an EFI_FILE_PROTOCOL structure
|
||||
**/
|
||||
EFI_FILE_PROTOCOL*
|
||||
CreateFileInterfaceFile(
|
||||
EFI_FILE_PROTOCOL *
|
||||
CreateFileInterfaceFile (
|
||||
IN CONST EFI_FILE_PROTOCOL *Template,
|
||||
IN CONST BOOLEAN Unicode
|
||||
);
|
||||
|
||||
#endif //_SHELL_FILE_HANDLE_WRAPPERS_HEADER_
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -62,17 +62,17 @@ typedef struct {
|
||||
} SPLIT_LIST;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Startup:1; ///< Was "-startup" found on command line.
|
||||
UINT32 NoStartup:1; ///< Was "-nostartup" found on command line.
|
||||
UINT32 NoConsoleOut:1; ///< Was "-noconsoleout" found on command line.
|
||||
UINT32 NoConsoleIn:1; ///< Was "-noconsolein" found on command line.
|
||||
UINT32 NoInterrupt:1; ///< Was "-nointerrupt" found on command line.
|
||||
UINT32 NoMap:1; ///< Was "-nomap" found on command line.
|
||||
UINT32 NoVersion:1; ///< Was "-noversion" found on command line.
|
||||
UINT32 Delay:1; ///< Was "-delay[:n] found on command line
|
||||
UINT32 Exit:1; ///< Was "-_exit" found on command line
|
||||
UINT32 NoNest:1; ///< Was "-nonest" found on command line
|
||||
UINT32 Reserved:7; ///< Extra bits
|
||||
UINT32 Startup : 1; ///< Was "-startup" found on command line.
|
||||
UINT32 NoStartup : 1; ///< Was "-nostartup" found on command line.
|
||||
UINT32 NoConsoleOut : 1; ///< Was "-noconsoleout" found on command line.
|
||||
UINT32 NoConsoleIn : 1; ///< Was "-noconsolein" found on command line.
|
||||
UINT32 NoInterrupt : 1; ///< Was "-nointerrupt" found on command line.
|
||||
UINT32 NoMap : 1; ///< Was "-nomap" found on command line.
|
||||
UINT32 NoVersion : 1; ///< Was "-noversion" found on command line.
|
||||
UINT32 Delay : 1; ///< Was "-delay[:n] found on command line
|
||||
UINT32 Exit : 1; ///< Was "-_exit" found on command line
|
||||
UINT32 NoNest : 1; ///< Was "-nonest" found on command line
|
||||
UINT32 Reserved : 7; ///< Extra bits
|
||||
} SHELL_BITS;
|
||||
|
||||
typedef union {
|
||||
@ -144,7 +144,7 @@ extern SHELL_INFO ShellInfoObject;
|
||||
@return some other error occurred
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessCommandLineToFinal(
|
||||
ProcessCommandLineToFinal (
|
||||
IN OUT CHAR16 **CmdLine
|
||||
);
|
||||
|
||||
@ -154,7 +154,7 @@ ProcessCommandLineToFinal(
|
||||
@param[in] ErrorCode the error code to put into lasterror
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetLastError(
|
||||
SetLastError (
|
||||
IN CONST SHELL_STATUS ErrorCode
|
||||
);
|
||||
|
||||
@ -164,7 +164,7 @@ SetLastError(
|
||||
@retval EFI_SUCCESS all init commands were run successfully.
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetBuiltInAlias(
|
||||
SetBuiltInAlias (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -216,7 +216,7 @@ GetDevicePathsForImageAndFile (
|
||||
@retval EFI_SUCCESS the variable is initialized.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessCommandLine(
|
||||
ProcessCommandLine (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -231,7 +231,7 @@ ProcessCommandLine(
|
||||
@retval EFI_SUCCESS The variable is initialized.
|
||||
**/
|
||||
EFI_STATUS
|
||||
DoStartupScript(
|
||||
DoStartupScript (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ImagePath,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
|
||||
);
|
||||
@ -255,8 +255,8 @@ DoShellPrompt (
|
||||
|
||||
@param Buffer Something to pass to FreePool when the shell is exiting.
|
||||
**/
|
||||
VOID*
|
||||
AddBufferToFreeList(
|
||||
VOID *
|
||||
AddBufferToFreeList (
|
||||
VOID *Buffer
|
||||
);
|
||||
|
||||
@ -266,7 +266,7 @@ AddBufferToFreeList(
|
||||
@param Buffer[in] The line buffer to add.
|
||||
**/
|
||||
VOID
|
||||
AddLineToCommandHistory(
|
||||
AddLineToCommandHistory (
|
||||
IN CONST CHAR16 *Buffer
|
||||
);
|
||||
|
||||
@ -281,7 +281,7 @@ AddLineToCommandHistory(
|
||||
@retval EFI_ABORTED the command's operation was aborted
|
||||
**/
|
||||
EFI_STATUS
|
||||
RunCommand(
|
||||
RunCommand (
|
||||
IN CONST CHAR16 *CmdLine
|
||||
);
|
||||
|
||||
@ -298,12 +298,11 @@ RunCommand(
|
||||
@retval EFI_ABORTED The command's operation was aborted.
|
||||
**/
|
||||
EFI_STATUS
|
||||
RunShellCommand(
|
||||
RunShellCommand (
|
||||
IN CONST CHAR16 *CmdLine,
|
||||
OUT EFI_STATUS *CommandStatus
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Function to process a NSH script file via SHELL_FILE_HANDLE.
|
||||
|
||||
@ -346,8 +345,8 @@ RunScriptFile (
|
||||
@return the location of the first character in the string
|
||||
@retval CHAR_NULL no instance of any character in CharacterList was found in String
|
||||
**/
|
||||
CONST CHAR16*
|
||||
FindFirstCharacter(
|
||||
CONST CHAR16 *
|
||||
FindFirstCharacter (
|
||||
IN CONST CHAR16 *String,
|
||||
IN CONST CHAR16 *CharacterList,
|
||||
IN CONST CHAR16 EscapeCharacter
|
||||
@ -359,7 +358,7 @@ FindFirstCharacter(
|
||||
@param[in] String pointer to the string to trim them off.
|
||||
**/
|
||||
EFI_STATUS
|
||||
TrimSpaces(
|
||||
TrimSpaces (
|
||||
IN CHAR16 **String
|
||||
);
|
||||
|
||||
@ -384,7 +383,4 @@ RestoreBufferList (
|
||||
IN OUT LIST_ENTRY *OldBufferList
|
||||
);
|
||||
|
||||
|
||||
|
||||
#endif //_SHELL_INTERNAL_HEADER_
|
||||
|
||||
|
@ -44,23 +44,29 @@ IsVolatileEnv (
|
||||
//
|
||||
// get the variable
|
||||
//
|
||||
Status = gRT->GetVariable((CHAR16*)EnvVarName,
|
||||
Status = gRT->GetVariable (
|
||||
(CHAR16 *)EnvVarName,
|
||||
&gShellVariableGuid,
|
||||
&Attribs,
|
||||
&Size,
|
||||
Buffer);
|
||||
Buffer
|
||||
);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
Buffer = AllocateZeroPool(Size);
|
||||
Buffer = AllocateZeroPool (Size);
|
||||
if (Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
Status = gRT->GetVariable((CHAR16*)EnvVarName,
|
||||
|
||||
Status = gRT->GetVariable (
|
||||
(CHAR16 *)EnvVarName,
|
||||
&gShellVariableGuid,
|
||||
&Attribs,
|
||||
&Size,
|
||||
Buffer);
|
||||
FreePool(Buffer);
|
||||
Buffer
|
||||
);
|
||||
FreePool (Buffer);
|
||||
}
|
||||
|
||||
//
|
||||
// not found means volatile
|
||||
//
|
||||
@ -68,6 +74,7 @@ IsVolatileEnv (
|
||||
*Volatile = TRUE;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
@ -75,7 +82,7 @@ IsVolatileEnv (
|
||||
//
|
||||
// check for the Non Volatile bit
|
||||
//
|
||||
*Volatile = !(BOOLEAN) ((Attribs & EFI_VARIABLE_NON_VOLATILE) == EFI_VARIABLE_NON_VOLATILE);
|
||||
*Volatile = !(BOOLEAN)((Attribs & EFI_VARIABLE_NON_VOLATILE) == EFI_VARIABLE_NON_VOLATILE);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -85,7 +92,7 @@ IsVolatileEnv (
|
||||
@param[in] List The pointer to pointer to list.
|
||||
**/
|
||||
VOID
|
||||
FreeEnvironmentVariableList(
|
||||
FreeEnvironmentVariableList (
|
||||
IN LIST_ENTRY *List
|
||||
)
|
||||
{
|
||||
@ -96,19 +103,22 @@ FreeEnvironmentVariableList(
|
||||
return;
|
||||
}
|
||||
|
||||
for ( Node = (ENV_VAR_LIST*)GetFirstNode(List)
|
||||
; !IsListEmpty(List)
|
||||
; Node = (ENV_VAR_LIST*)GetFirstNode(List)
|
||||
){
|
||||
ASSERT(Node != NULL);
|
||||
RemoveEntryList(&Node->Link);
|
||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (List)
|
||||
; !IsListEmpty (List)
|
||||
; Node = (ENV_VAR_LIST *)GetFirstNode (List)
|
||||
)
|
||||
{
|
||||
ASSERT (Node != NULL);
|
||||
RemoveEntryList (&Node->Link);
|
||||
if (Node->Key != NULL) {
|
||||
FreePool(Node->Key);
|
||||
FreePool (Node->Key);
|
||||
}
|
||||
|
||||
if (Node->Val != NULL) {
|
||||
FreePool(Node->Val);
|
||||
FreePool (Node->Val);
|
||||
}
|
||||
FreePool(Node);
|
||||
|
||||
FreePool (Node);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +131,7 @@ FreeEnvironmentVariableList(
|
||||
@retval EFI_SUCCESS the list was created successfully.
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetEnvironmentVariableList(
|
||||
GetEnvironmentVariableList (
|
||||
IN OUT LIST_ENTRY *ListHead
|
||||
)
|
||||
{
|
||||
@ -142,32 +152,34 @@ GetEnvironmentVariableList(
|
||||
|
||||
ValBufferSize = INIT_DATA_BUFFER_SIZE;
|
||||
NameBufferSize = INIT_NAME_BUFFER_SIZE;
|
||||
VariableName = AllocateZeroPool(NameBufferSize);
|
||||
VariableName = AllocateZeroPool (NameBufferSize);
|
||||
if (VariableName == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
*VariableName = CHAR_NULL;
|
||||
|
||||
while (!EFI_ERROR(Status)) {
|
||||
while (!EFI_ERROR (Status)) {
|
||||
NameSize = NameBufferSize;
|
||||
Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid);
|
||||
if (Status == EFI_NOT_FOUND){
|
||||
Status = gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
Status = EFI_SUCCESS;
|
||||
break;
|
||||
} else if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
NameBufferSize = NameSize > NameBufferSize * 2 ? NameSize : NameBufferSize * 2;
|
||||
SHELL_FREE_NON_NULL(VariableName);
|
||||
VariableName = AllocateZeroPool(NameBufferSize);
|
||||
SHELL_FREE_NON_NULL (VariableName);
|
||||
VariableName = AllocateZeroPool (NameBufferSize);
|
||||
if (VariableName == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
|
||||
NameSize = NameBufferSize;
|
||||
Status = gRT->GetNextVariableName(&NameSize, VariableName, &Guid);
|
||||
Status = gRT->GetNextVariableName (&NameSize, VariableName, &Guid);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR(Status) && CompareGuid(&Guid, &gShellVariableGuid)){
|
||||
VarList = AllocateZeroPool(sizeof(ENV_VAR_LIST));
|
||||
if (!EFI_ERROR (Status) && CompareGuid (&Guid, &gShellVariableGuid)) {
|
||||
VarList = AllocateZeroPool (sizeof (ENV_VAR_LIST));
|
||||
if (VarList == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
} else {
|
||||
@ -177,12 +189,13 @@ GetEnvironmentVariableList(
|
||||
//
|
||||
VarList->Val = AllocateZeroPool (ValSize + sizeof (CHAR16));
|
||||
if (VarList->Val == NULL) {
|
||||
SHELL_FREE_NON_NULL(VarList);
|
||||
SHELL_FREE_NON_NULL (VarList);
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(VariableName, &VarList->Atts, &ValSize, VarList->Val);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL){
|
||||
|
||||
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES (VariableName, &VarList->Atts, &ValSize, VarList->Val);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
ValBufferSize = ValSize > ValBufferSize * 2 ? ValSize : ValBufferSize * 2;
|
||||
SHELL_FREE_NON_NULL (VarList->Val);
|
||||
//
|
||||
@ -190,34 +203,36 @@ GetEnvironmentVariableList(
|
||||
//
|
||||
VarList->Val = AllocateZeroPool (ValBufferSize + sizeof (CHAR16));
|
||||
if (VarList->Val == NULL) {
|
||||
SHELL_FREE_NON_NULL(VarList);
|
||||
SHELL_FREE_NON_NULL (VarList);
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
|
||||
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)) {
|
||||
VarList->Key = AllocateCopyPool(StrSize(VariableName), VariableName);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
VarList->Key = AllocateCopyPool (StrSize (VariableName), VariableName);
|
||||
if (VarList->Key == NULL) {
|
||||
SHELL_FREE_NON_NULL(VarList->Val);
|
||||
SHELL_FREE_NON_NULL(VarList);
|
||||
SHELL_FREE_NON_NULL (VarList->Val);
|
||||
SHELL_FREE_NON_NULL (VarList);
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
} else {
|
||||
InsertTailList(ListHead, &VarList->Link);
|
||||
InsertTailList (ListHead, &VarList->Link);
|
||||
}
|
||||
} else {
|
||||
SHELL_FREE_NON_NULL(VarList->Val);
|
||||
SHELL_FREE_NON_NULL(VarList);
|
||||
SHELL_FREE_NON_NULL (VarList->Val);
|
||||
SHELL_FREE_NON_NULL (VarList);
|
||||
}
|
||||
} // if (VarList == NULL) ... else ...
|
||||
} // compare guid
|
||||
} // while
|
||||
|
||||
SHELL_FREE_NON_NULL (VariableName);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreeEnvironmentVariableList(ListHead);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreeEnvironmentVariableList (ListHead);
|
||||
}
|
||||
|
||||
return (Status);
|
||||
@ -236,7 +251,7 @@ GetEnvironmentVariableList(
|
||||
@retval EFI_SUCCESS the list was Set successfully.
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetEnvironmentVariableList(
|
||||
SetEnvironmentVariableList (
|
||||
IN LIST_ENTRY *ListHead
|
||||
)
|
||||
{
|
||||
@ -245,42 +260,47 @@ SetEnvironmentVariableList(
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
|
||||
InitializeListHead(&VarList.Link);
|
||||
InitializeListHead (&VarList.Link);
|
||||
|
||||
//
|
||||
// Delete all the current environment variables
|
||||
//
|
||||
Status = GetEnvironmentVariableList(&VarList.Link);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = GetEnvironmentVariableList (&VarList.Link);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
for ( Node = (ENV_VAR_LIST*)GetFirstNode(&VarList.Link)
|
||||
; !IsNull(&VarList.Link, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST*)GetNextNode(&VarList.Link, &Node->Link)
|
||||
){
|
||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&VarList.Link)
|
||||
; !IsNull (&VarList.Link, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST *)GetNextNode (&VarList.Link, &Node->Link)
|
||||
)
|
||||
{
|
||||
if (Node->Key != NULL) {
|
||||
Status = SHELL_DELETE_ENVIRONMENT_VARIABLE(Node->Key);
|
||||
}
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = SHELL_DELETE_ENVIRONMENT_VARIABLE (Node->Key);
|
||||
}
|
||||
|
||||
FreeEnvironmentVariableList(&VarList.Link);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
FreeEnvironmentVariableList (&VarList.Link);
|
||||
|
||||
//
|
||||
// set all the variables from the list
|
||||
//
|
||||
for ( Node = (ENV_VAR_LIST*)GetFirstNode(ListHead)
|
||||
; !IsNull(ListHead, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST*)GetNextNode(ListHead, &Node->Link)
|
||||
){
|
||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (ListHead)
|
||||
; !IsNull (ListHead, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST *)GetNextNode (ListHead, &Node->Link)
|
||||
)
|
||||
{
|
||||
Size = StrSize (Node->Val) - sizeof (CHAR16);
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
@ -299,7 +319,7 @@ SetEnvironmentVariableList(
|
||||
@sa SetEnvironmentVariableList
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetEnvironmentVariables(
|
||||
SetEnvironmentVariables (
|
||||
IN CONST CHAR16 **Environment
|
||||
)
|
||||
{
|
||||
@ -320,59 +340,63 @@ SetEnvironmentVariables(
|
||||
for ( CurrentCount = 0
|
||||
;
|
||||
; CurrentCount++
|
||||
){
|
||||
)
|
||||
{
|
||||
CurrentString = Environment[CurrentCount];
|
||||
if (CurrentString == NULL) {
|
||||
break;
|
||||
}
|
||||
ASSERT(StrStr(CurrentString, L"=") != NULL);
|
||||
Node = AllocateZeroPool(sizeof(ENV_VAR_LIST));
|
||||
|
||||
ASSERT (StrStr (CurrentString, L"=") != NULL);
|
||||
Node = AllocateZeroPool (sizeof (ENV_VAR_LIST));
|
||||
if (Node == NULL) {
|
||||
SetEnvironmentVariableList(&VarList->Link);
|
||||
SetEnvironmentVariableList (&VarList->Link);
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
Node->Key = AllocateZeroPool((StrStr(CurrentString, L"=") - CurrentString + 1) * sizeof(CHAR16));
|
||||
Node->Key = AllocateZeroPool ((StrStr (CurrentString, L"=") - CurrentString + 1) * sizeof (CHAR16));
|
||||
if (Node->Key == NULL) {
|
||||
SHELL_FREE_NON_NULL(Node);
|
||||
SetEnvironmentVariableList(&VarList->Link);
|
||||
SHELL_FREE_NON_NULL (Node);
|
||||
SetEnvironmentVariableList (&VarList->Link);
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
//
|
||||
// Copy the string into the Key, leaving the last character allocated as NULL to terminate
|
||||
//
|
||||
StrnCpyS( Node->Key,
|
||||
StrStr(CurrentString, L"=") - CurrentString + 1,
|
||||
StrnCpyS (
|
||||
Node->Key,
|
||||
StrStr (CurrentString, L"=") - CurrentString + 1,
|
||||
CurrentString,
|
||||
StrStr(CurrentString, L"=") - CurrentString
|
||||
StrStr (CurrentString, L"=") - CurrentString
|
||||
);
|
||||
|
||||
//
|
||||
// ValueSize = TotalSize - already removed size - size for '=' + size for terminator (the last 2 items cancel each other)
|
||||
//
|
||||
Node->Val = AllocateCopyPool(StrSize(CurrentString) - StrSize(Node->Key), CurrentString + StrLen(Node->Key) + 1);
|
||||
Node->Val = AllocateCopyPool (StrSize (CurrentString) - StrSize (Node->Key), CurrentString + StrLen (Node->Key) + 1);
|
||||
if (Node->Val == NULL) {
|
||||
SHELL_FREE_NON_NULL(Node->Key);
|
||||
SHELL_FREE_NON_NULL(Node);
|
||||
SetEnvironmentVariableList(&VarList->Link);
|
||||
SHELL_FREE_NON_NULL (Node->Key);
|
||||
SHELL_FREE_NON_NULL (Node);
|
||||
SetEnvironmentVariableList (&VarList->Link);
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
Node->Atts = EFI_VARIABLE_BOOTSERVICE_ACCESS;
|
||||
|
||||
if (VarList == NULL) {
|
||||
VarList = AllocateZeroPool(sizeof(ENV_VAR_LIST));
|
||||
VarList = AllocateZeroPool (sizeof (ENV_VAR_LIST));
|
||||
if (VarList == NULL) {
|
||||
SHELL_FREE_NON_NULL(Node->Key);
|
||||
SHELL_FREE_NON_NULL(Node->Val);
|
||||
SHELL_FREE_NON_NULL(Node);
|
||||
SHELL_FREE_NON_NULL (Node->Key);
|
||||
SHELL_FREE_NON_NULL (Node->Val);
|
||||
SHELL_FREE_NON_NULL (Node);
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
InitializeListHead(&VarList->Link);
|
||||
}
|
||||
InsertTailList(&VarList->Link, &Node->Link);
|
||||
|
||||
InitializeListHead (&VarList->Link);
|
||||
}
|
||||
|
||||
InsertTailList (&VarList->Link, &Node->Link);
|
||||
} // for loop
|
||||
|
||||
//
|
||||
@ -380,7 +404,7 @@ SetEnvironmentVariables(
|
||||
// this function also frees the memory and deletes all pre-existing
|
||||
// shell-guid based environment variables.
|
||||
//
|
||||
return (SetEnvironmentVariableList(&VarList->Link));
|
||||
return (SetEnvironmentVariableList (&VarList->Link));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -408,20 +432,22 @@ ShellFindEnvVarInList (
|
||||
{
|
||||
ENV_VAR_LIST *Node;
|
||||
|
||||
if (Key == NULL || Value == NULL || ValueSize == NULL) {
|
||||
if ((Key == NULL) || (Value == NULL) || (ValueSize == NULL)) {
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link)
|
||||
; !IsNull(&gShellEnvVarList.Link, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link)
|
||||
){
|
||||
if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
|
||||
*Value = AllocateCopyPool(StrSize(Node->Val), Node->Val);
|
||||
*ValueSize = StrSize(Node->Val);
|
||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
||||
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
||||
)
|
||||
{
|
||||
if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
|
||||
*Value = AllocateCopyPool (StrSize (Node->Val), Node->Val);
|
||||
*ValueSize = StrSize (Node->Val);
|
||||
if (Atts != NULL) {
|
||||
*Atts = Node->Atts;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -454,7 +480,7 @@ ShellAddEnvVarToList (
|
||||
CHAR16 *LocalKey;
|
||||
CHAR16 *LocalValue;
|
||||
|
||||
if (Key == NULL || Value == NULL || ValueSize == 0) {
|
||||
if ((Key == NULL) || (Value == NULL) || (ValueSize == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -466,13 +492,14 @@ ShellAddEnvVarToList (
|
||||
//
|
||||
// Update the variable value if it exists in gShellEnvVarList.
|
||||
//
|
||||
for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link)
|
||||
; !IsNull(&gShellEnvVarList.Link, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link)
|
||||
){
|
||||
if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
|
||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
||||
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
||||
)
|
||||
{
|
||||
if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
|
||||
Node->Atts = Atts;
|
||||
SHELL_FREE_NON_NULL(Node->Val);
|
||||
SHELL_FREE_NON_NULL (Node->Val);
|
||||
Node->Val = LocalValue;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -482,21 +509,23 @@ ShellAddEnvVarToList (
|
||||
// If the environment variable key doesn't exist in list just insert
|
||||
// a new node.
|
||||
//
|
||||
LocalKey = AllocateCopyPool (StrSize(Key), Key);
|
||||
LocalKey = AllocateCopyPool (StrSize (Key), Key);
|
||||
if (LocalKey == NULL) {
|
||||
FreePool (LocalValue);
|
||||
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) {
|
||||
FreePool (LocalKey);
|
||||
FreePool (LocalValue);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Node->Key = LocalKey;
|
||||
Node->Val = LocalValue;
|
||||
Node->Atts = Atts;
|
||||
InsertTailList(&gShellEnvVarList.Link, &Node->Link);
|
||||
InsertTailList (&gShellEnvVarList.Link, &Node->Link);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -521,15 +550,16 @@ ShellRemvoeEnvVarFromList (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
for ( Node = (ENV_VAR_LIST*)GetFirstNode(&gShellEnvVarList.Link)
|
||||
; !IsNull(&gShellEnvVarList.Link, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST*)GetNextNode(&gShellEnvVarList.Link, &Node->Link)
|
||||
){
|
||||
if (Node->Key != NULL && StrCmp(Key, Node->Key) == 0) {
|
||||
SHELL_FREE_NON_NULL(Node->Key);
|
||||
SHELL_FREE_NON_NULL(Node->Val);
|
||||
RemoveEntryList(&Node->Link);
|
||||
SHELL_FREE_NON_NULL(Node);
|
||||
for ( Node = (ENV_VAR_LIST *)GetFirstNode (&gShellEnvVarList.Link)
|
||||
; !IsNull (&gShellEnvVarList.Link, &Node->Link)
|
||||
; Node = (ENV_VAR_LIST *)GetNextNode (&gShellEnvVarList.Link, &Node->Link)
|
||||
)
|
||||
{
|
||||
if ((Node->Key != NULL) && (StrCmp (Key, Node->Key) == 0)) {
|
||||
SHELL_FREE_NON_NULL (Node->Key);
|
||||
SHELL_FREE_NON_NULL (Node->Val);
|
||||
RemoveEntryList (&Node->Link);
|
||||
SHELL_FREE_NON_NULL (Node);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -549,7 +579,7 @@ ShellInitEnvVarList (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
InitializeListHead(&gShellEnvVarList.Link);
|
||||
InitializeListHead (&gShellEnvVarList.Link);
|
||||
Status = GetEnvironmentVariableList (&gShellEnvVarList.Link);
|
||||
|
||||
return Status;
|
||||
@ -565,8 +595,7 @@ ShellFreeEnvVarList (
|
||||
)
|
||||
{
|
||||
FreeEnvironmentVariableList (&gShellEnvVarList.Link);
|
||||
InitializeListHead(&gShellEnvVarList.Link);
|
||||
InitializeListHead (&gShellEnvVarList.Link);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ typedef struct {
|
||||
//
|
||||
extern ENV_VAR_LIST gShellEnvVarList;
|
||||
|
||||
|
||||
/**
|
||||
Reports whether an environment variable is Volatile or Non-Volatile.
|
||||
|
||||
@ -73,7 +72,7 @@ IsVolatileEnv (
|
||||
@retval other An error occurred
|
||||
@sa SetVariable
|
||||
**/
|
||||
#define SHELL_SET_ENVIRONMENT_VARIABLE_NV(EnvVarName,BufferSize,Buffer) \
|
||||
#define SHELL_SET_ENVIRONMENT_VARIABLE_NV(EnvVarName, BufferSize, Buffer) \
|
||||
(gRT->SetVariable((CHAR16*)EnvVarName, \
|
||||
&gShellVariableGuid, \
|
||||
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS, \
|
||||
@ -93,7 +92,7 @@ IsVolatileEnv (
|
||||
@retval other An error occurred
|
||||
@sa SetVariable
|
||||
**/
|
||||
#define SHELL_GET_ENVIRONMENT_VARIABLE(EnvVarName,BufferSize,Buffer) \
|
||||
#define SHELL_GET_ENVIRONMENT_VARIABLE(EnvVarName, BufferSize, Buffer) \
|
||||
(gRT->GetVariable((CHAR16*)EnvVarName, \
|
||||
&gShellVariableGuid, \
|
||||
0, \
|
||||
@ -114,7 +113,7 @@ IsVolatileEnv (
|
||||
@retval other An error occurred
|
||||
@sa SetVariable
|
||||
**/
|
||||
#define SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(EnvVarName,Atts,BufferSize,Buffer) \
|
||||
#define SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(EnvVarName, Atts, BufferSize, Buffer) \
|
||||
(gRT->GetVariable((CHAR16*)EnvVarName, \
|
||||
&gShellVariableGuid, \
|
||||
Atts, \
|
||||
@ -134,7 +133,7 @@ IsVolatileEnv (
|
||||
@retval other An error occurred
|
||||
@sa SetVariable
|
||||
**/
|
||||
#define SHELL_SET_ENVIRONMENT_VARIABLE_V(EnvVarName,BufferSize,Buffer) \
|
||||
#define SHELL_SET_ENVIRONMENT_VARIABLE_V(EnvVarName, BufferSize, Buffer) \
|
||||
(gRT->SetVariable((CHAR16*)EnvVarName, \
|
||||
&gShellVariableGuid, \
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS, \
|
||||
@ -150,7 +149,7 @@ IsVolatileEnv (
|
||||
@retval EFI_SUCCESS the list was created successfully.
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetEnvironmentVariableList(
|
||||
GetEnvironmentVariableList (
|
||||
IN OUT LIST_ENTRY *List
|
||||
);
|
||||
|
||||
@ -167,7 +166,7 @@ GetEnvironmentVariableList(
|
||||
@retval EFI_SUCCESS The list was Set successfully.
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetEnvironmentVariableList(
|
||||
SetEnvironmentVariableList (
|
||||
IN LIST_ENTRY *List
|
||||
);
|
||||
|
||||
@ -187,7 +186,7 @@ SetEnvironmentVariableList(
|
||||
@sa SetEnvironmentVariableList
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetEnvironmentVariables(
|
||||
SetEnvironmentVariables (
|
||||
IN CONST CHAR16 **Environment
|
||||
);
|
||||
|
||||
@ -197,7 +196,7 @@ SetEnvironmentVariables(
|
||||
@param[in] List The pointer to pointer to list.
|
||||
**/
|
||||
VOID
|
||||
FreeEnvironmentVariableList(
|
||||
FreeEnvironmentVariableList (
|
||||
IN LIST_ENTRY *List
|
||||
);
|
||||
|
||||
@ -279,4 +278,3 @@ ShellFreeEnvVarList (
|
||||
);
|
||||
|
||||
#endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_
|
||||
|
||||
|
@ -17,15 +17,14 @@
|
||||
EFI_HII_HANDLE mShellManHiiHandle = NULL;
|
||||
EFI_HANDLE mShellManDriverHandle = NULL;
|
||||
|
||||
|
||||
SHELL_MAN_HII_VENDOR_DEVICE_PATH mShellManHiiDevicePath = {
|
||||
{
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
{
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
|
||||
(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
|
||||
}
|
||||
},
|
||||
SHELL_MAN_HII_GUID
|
||||
@ -34,8 +33,8 @@ SHELL_MAN_HII_VENDOR_DEVICE_PATH mShellManHiiDevicePath = {
|
||||
END_DEVICE_PATH_TYPE,
|
||||
END_ENTIRE_DEVICE_PATH_SUBTYPE,
|
||||
{
|
||||
(UINT8) (END_DEVICE_PATH_LENGTH),
|
||||
(UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
|
||||
(UINT8)(END_DEVICE_PATH_LENGTH),
|
||||
(UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -57,6 +56,7 @@ GetExecuatableFileName (
|
||||
{
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *SuffixStr;
|
||||
|
||||
if (NameString == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
@ -64,31 +64,33 @@ GetExecuatableFileName (
|
||||
//
|
||||
// Fix the file name
|
||||
//
|
||||
if (StrnCmp(NameString+StrLen(NameString)-StrLen(L".efi"), L".efi", StrLen(L".efi"))==0) {
|
||||
Buffer = AllocateCopyPool(StrSize(NameString), NameString);
|
||||
} else if (StrnCmp(NameString+StrLen(NameString)-StrLen(L".man"), L".man", StrLen(L".man"))==0) {
|
||||
Buffer = AllocateCopyPool(StrSize(NameString), NameString);
|
||||
if (StrnCmp (NameString+StrLen (NameString)-StrLen (L".efi"), L".efi", StrLen (L".efi")) == 0) {
|
||||
Buffer = AllocateCopyPool (StrSize (NameString), NameString);
|
||||
} else if (StrnCmp (NameString+StrLen (NameString)-StrLen (L".man"), L".man", StrLen (L".man")) == 0) {
|
||||
Buffer = AllocateCopyPool (StrSize (NameString), NameString);
|
||||
if (Buffer != NULL) {
|
||||
SuffixStr = Buffer+StrLen(Buffer)-StrLen(L".man");
|
||||
StrnCpyS (SuffixStr, StrSize(L".man")/sizeof(CHAR16), L".efi", StrLen(L".efi"));
|
||||
SuffixStr = Buffer+StrLen (Buffer)-StrLen (L".man");
|
||||
StrnCpyS (SuffixStr, StrSize (L".man")/sizeof (CHAR16), L".efi", StrLen (L".efi"));
|
||||
}
|
||||
} else {
|
||||
Buffer = AllocateZeroPool(StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16));
|
||||
Buffer = AllocateZeroPool (StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16));
|
||||
if (Buffer != NULL) {
|
||||
StrnCpyS( Buffer,
|
||||
(StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16),
|
||||
StrnCpyS (
|
||||
Buffer,
|
||||
(StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
|
||||
NameString,
|
||||
StrLen(NameString)
|
||||
StrLen (NameString)
|
||||
);
|
||||
StrnCatS( Buffer,
|
||||
(StrSize(NameString) + StrLen(L".efi")*sizeof(CHAR16))/sizeof(CHAR16),
|
||||
StrnCatS (
|
||||
Buffer,
|
||||
(StrSize (NameString) + StrLen (L".efi")*sizeof (CHAR16))/sizeof (CHAR16),
|
||||
L".efi",
|
||||
StrLen(L".efi")
|
||||
StrLen (L".efi")
|
||||
);
|
||||
}
|
||||
}
|
||||
return (Buffer);
|
||||
|
||||
return (Buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,34 +105,39 @@ GetExecuatableFileName (
|
||||
@return the new filename with .man as the extension.
|
||||
**/
|
||||
CHAR16 *
|
||||
GetManFileName(
|
||||
GetManFileName (
|
||||
IN CONST CHAR16 *ManFileName
|
||||
)
|
||||
{
|
||||
CHAR16 *Buffer;
|
||||
|
||||
if (ManFileName == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
//
|
||||
// Fix the file name
|
||||
//
|
||||
if (StrnCmp(ManFileName+StrLen(ManFileName)-4, L".man", 4)==0) {
|
||||
Buffer = AllocateCopyPool(StrSize(ManFileName), ManFileName);
|
||||
if (StrnCmp (ManFileName+StrLen (ManFileName)-4, L".man", 4) == 0) {
|
||||
Buffer = AllocateCopyPool (StrSize (ManFileName), ManFileName);
|
||||
} else {
|
||||
Buffer = AllocateZeroPool(StrSize(ManFileName) + 4*sizeof(CHAR16));
|
||||
Buffer = AllocateZeroPool (StrSize (ManFileName) + 4*sizeof (CHAR16));
|
||||
if (Buffer != NULL) {
|
||||
StrnCpyS( Buffer,
|
||||
(StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16),
|
||||
StrnCpyS (
|
||||
Buffer,
|
||||
(StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
|
||||
ManFileName,
|
||||
StrLen(ManFileName)
|
||||
StrLen (ManFileName)
|
||||
);
|
||||
StrnCatS( Buffer,
|
||||
(StrSize(ManFileName) + 4*sizeof(CHAR16))/sizeof(CHAR16),
|
||||
StrnCatS (
|
||||
Buffer,
|
||||
(StrSize (ManFileName) + 4*sizeof (CHAR16))/sizeof (CHAR16),
|
||||
L".man",
|
||||
4
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (Buffer);
|
||||
}
|
||||
|
||||
@ -149,7 +156,7 @@ GetManFileName(
|
||||
@retval EFI_NOT_FOUND The file was not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
SearchPathForFile(
|
||||
SearchPathForFile (
|
||||
IN CONST CHAR16 *FileName,
|
||||
OUT SHELL_FILE_HANDLE *Handle
|
||||
)
|
||||
@ -157,14 +164,15 @@ SearchPathForFile(
|
||||
CHAR16 *FullFileName;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if ( FileName == NULL
|
||||
|| Handle == NULL
|
||||
|| StrLen(FileName) == 0
|
||||
){
|
||||
if ( (FileName == NULL)
|
||||
|| (Handle == NULL)
|
||||
|| (StrLen (FileName) == 0)
|
||||
)
|
||||
{
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
FullFileName = ShellFindFilePath(FileName);
|
||||
FullFileName = ShellFindFilePath (FileName);
|
||||
if (FullFileName == NULL) {
|
||||
return (EFI_NOT_FOUND);
|
||||
}
|
||||
@ -172,8 +180,8 @@ SearchPathForFile(
|
||||
//
|
||||
// now open that file
|
||||
//
|
||||
Status = EfiShellOpenFileByName(FullFileName, Handle, EFI_FILE_MODE_READ);
|
||||
FreePool(FullFileName);
|
||||
Status = EfiShellOpenFileByName (FullFileName, Handle, EFI_FILE_MODE_READ);
|
||||
FreePool (FullFileName);
|
||||
|
||||
return (Status);
|
||||
}
|
||||
@ -197,7 +205,7 @@ SearchPathForFile(
|
||||
an allocated buffer.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ManFileFindSections(
|
||||
ManFileFindSections (
|
||||
IN SHELL_FILE_HANDLE Handle,
|
||||
IN CONST CHAR16 *Sections,
|
||||
OUT CHAR16 **HelpText,
|
||||
@ -213,10 +221,11 @@ ManFileFindSections(
|
||||
UINTN SectionLen;
|
||||
BOOLEAN Found;
|
||||
|
||||
if ( Handle == NULL
|
||||
|| HelpText == NULL
|
||||
|| HelpSize == NULL
|
||||
){
|
||||
if ( (Handle == NULL)
|
||||
|| (HelpText == NULL)
|
||||
|| (HelpSize == NULL)
|
||||
)
|
||||
{
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
@ -225,55 +234,63 @@ ManFileFindSections(
|
||||
Size = 1024;
|
||||
Found = FALSE;
|
||||
|
||||
ReadLine = AllocateZeroPool(Size);
|
||||
ReadLine = AllocateZeroPool (Size);
|
||||
if (ReadLine == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
for (;!ShellFileHandleEof(Handle);Size = 1024) {
|
||||
Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, &Ascii);
|
||||
for ( ; !ShellFileHandleEof (Handle); Size = 1024) {
|
||||
Status = ShellFileHandleReadLine (Handle, ReadLine, &Size, TRUE, &Ascii);
|
||||
if (ReadLine[0] == L'#') {
|
||||
//
|
||||
// Skip comment lines
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// ignore too small of buffer...
|
||||
//
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
} else if (StrnCmp(ReadLine, L".TH", 3) == 0) {
|
||||
} else if (StrnCmp (ReadLine, L".TH", 3) == 0) {
|
||||
//
|
||||
// we hit the end of this commands section so stop.
|
||||
//
|
||||
break;
|
||||
} else if (StrnCmp(ReadLine, L".SH", 3) == 0) {
|
||||
} else if (StrnCmp (ReadLine, L".SH", 3) == 0) {
|
||||
if (Sections == NULL) {
|
||||
CurrentlyReading = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// we found a section
|
||||
//
|
||||
if (CurrentlyReading) {
|
||||
CurrentlyReading = FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// is this a section we want to read in?
|
||||
//
|
||||
for ( SectionName = ReadLine + 3
|
||||
; *SectionName == L' '
|
||||
; SectionName++);
|
||||
SectionLen = StrLen(SectionName);
|
||||
SectionName = StrStr(Sections, SectionName);
|
||||
; SectionName++)
|
||||
{
|
||||
}
|
||||
|
||||
SectionLen = StrLen (SectionName);
|
||||
SectionName = StrStr (Sections, SectionName);
|
||||
if (SectionName == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (*(SectionName + SectionLen) == CHAR_NULL || *(SectionName + SectionLen) == L',') {
|
||||
|
||||
if ((*(SectionName + SectionLen) == CHAR_NULL) || (*(SectionName + SectionLen) == L',')) {
|
||||
CurrentlyReading = TRUE;
|
||||
}
|
||||
} else if (CurrentlyReading) {
|
||||
@ -281,15 +298,17 @@ ManFileFindSections(
|
||||
//
|
||||
// copy and save the current line.
|
||||
//
|
||||
ASSERT((*HelpText == NULL && *HelpSize == 0) || (*HelpText != NULL));
|
||||
ASSERT ((*HelpText == NULL && *HelpSize == 0) || (*HelpText != NULL));
|
||||
StrnCatGrow (HelpText, HelpSize, ReadLine, 0);
|
||||
StrnCatGrow (HelpText, HelpSize, L"\r\n", 0);
|
||||
}
|
||||
}
|
||||
FreePool(ReadLine);
|
||||
if (!Found && !EFI_ERROR(Status)) {
|
||||
|
||||
FreePool (ReadLine);
|
||||
if (!Found && !EFI_ERROR (Status)) {
|
||||
return (EFI_NOT_FOUND);
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
@ -315,7 +334,7 @@ ManFileFindSections(
|
||||
@retval FALSE Line did not contain the Title Header
|
||||
**/
|
||||
BOOLEAN
|
||||
IsTitleHeader(
|
||||
IsTitleHeader (
|
||||
IN CONST CHAR16 *Command,
|
||||
IN CHAR16 *Line,
|
||||
OUT CHAR16 **BriefDesc OPTIONAL,
|
||||
@ -340,28 +359,25 @@ IsTitleHeader(
|
||||
State = LookForThMacro;
|
||||
|
||||
do {
|
||||
|
||||
if (*Line == L'\0') {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (State) {
|
||||
|
||||
// Handle "^\s*.TH\s"
|
||||
// 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
|
||||
// title header line.
|
||||
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;
|
||||
State = LookForCommandName;
|
||||
}
|
||||
else if (*Line == L' ' || *Line == L'\t') {
|
||||
} else if ((*Line == L' ') || (*Line == L'\t')) {
|
||||
Line++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
State = Final;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Handle "\s*"
|
||||
@ -369,15 +385,15 @@ IsTitleHeader(
|
||||
// at least one white space character). Go to state CompareCommands when a
|
||||
// non-white space is seen.
|
||||
case LookForCommandName:
|
||||
if (*Line == L' ' || *Line == L'\t') {
|
||||
if ((*Line == L' ') || (*Line == L'\t')) {
|
||||
Line++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ReturnValue = TRUE; // This is *some* command's title header line.
|
||||
State = CompareCommands;
|
||||
// Do not increment Line; it points to the first character of the command
|
||||
// name on the title header line.
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Handle "(\S)\s"
|
||||
@ -385,13 +401,13 @@ IsTitleHeader(
|
||||
// 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.
|
||||
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.
|
||||
State = (BriefDesc == NULL) ? Final : GetBriefDescription;
|
||||
}
|
||||
else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {
|
||||
} else if (CharToUpper (*Line) != CharToUpper (*(Command + CommandIndex++))) {
|
||||
State = Final;
|
||||
}
|
||||
|
||||
Line++;
|
||||
break;
|
||||
|
||||
@ -399,21 +415,22 @@ IsTitleHeader(
|
||||
// Skip whitespace, '0', and '1' characters, if any, prior to the brief description.
|
||||
// Return the description to the caller.
|
||||
case GetBriefDescription:
|
||||
if (*Line != L' ' && *Line != L'\t' && *Line != L'0' && *Line != L'1') {
|
||||
*BriefSize = StrSize(Line);
|
||||
*BriefDesc = AllocateZeroPool(*BriefSize);
|
||||
if ((*Line != L' ') && (*Line != L'\t') && (*Line != L'0') && (*Line != L'1')) {
|
||||
*BriefSize = StrSize (Line);
|
||||
*BriefDesc = AllocateZeroPool (*BriefSize);
|
||||
if (*BriefDesc != NULL) {
|
||||
StrCpyS(*BriefDesc, (*BriefSize)/sizeof(CHAR16), Line);
|
||||
StrCpyS (*BriefDesc, (*BriefSize)/sizeof (CHAR16), Line);
|
||||
}
|
||||
|
||||
State = Final;
|
||||
}
|
||||
|
||||
Line++;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
} while (State < Final);
|
||||
|
||||
*Found = ReturnFound;
|
||||
@ -441,7 +458,7 @@ IsTitleHeader(
|
||||
an allocated buffer if requested.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ManFileFindTitleSection(
|
||||
ManFileFindTitleSection (
|
||||
IN SHELL_FILE_HANDLE Handle,
|
||||
IN CONST CHAR16 *Command,
|
||||
OUT CHAR16 **BriefDesc OPTIONAL,
|
||||
@ -455,10 +472,11 @@ ManFileFindTitleSection(
|
||||
BOOLEAN Found;
|
||||
UINTN Start;
|
||||
|
||||
if ( Handle == NULL
|
||||
|| Command == NULL
|
||||
|| (BriefDesc != NULL && BriefSize == NULL)
|
||||
){
|
||||
if ( (Handle == NULL)
|
||||
|| (Command == NULL)
|
||||
|| ((BriefDesc != NULL) && (BriefSize == NULL))
|
||||
)
|
||||
{
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
@ -466,7 +484,7 @@ ManFileFindTitleSection(
|
||||
Size = 1024;
|
||||
Found = FALSE;
|
||||
|
||||
ReadLine = AllocateZeroPool(Size);
|
||||
ReadLine = AllocateZeroPool (Size);
|
||||
if (ReadLine == NULL) {
|
||||
return (EFI_OUT_OF_RESOURCES);
|
||||
}
|
||||
@ -474,20 +492,21 @@ ManFileFindTitleSection(
|
||||
//
|
||||
// Do not pass any leading path information that may be present to IsTitleHeader().
|
||||
//
|
||||
Start = StrLen(Command);
|
||||
while ((Start != 0)
|
||||
Start = StrLen (Command);
|
||||
while ( (Start != 0)
|
||||
&& (*(Command + Start - 1) != L'\\')
|
||||
&& (*(Command + Start - 1) != L'/')
|
||||
&& (*(Command + Start - 1) != L':')) {
|
||||
&& (*(Command + Start - 1) != L':'))
|
||||
{
|
||||
--Start;
|
||||
}
|
||||
|
||||
for (;!ShellFileHandleEof(Handle);Size = 1024) {
|
||||
Status = ShellFileHandleReadLine(Handle, ReadLine, &Size, TRUE, Ascii);
|
||||
for ( ; !ShellFileHandleEof (Handle); Size = 1024) {
|
||||
Status = ShellFileHandleReadLine (Handle, ReadLine, &Size, TRUE, Ascii);
|
||||
//
|
||||
// ignore too small of buffer...
|
||||
//
|
||||
if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {
|
||||
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -498,7 +517,7 @@ ManFileFindTitleSection(
|
||||
}
|
||||
}
|
||||
|
||||
FreePool(ReadLine);
|
||||
FreePool (ReadLine);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
@ -533,7 +552,7 @@ ManFileFindTitleSection(
|
||||
@retval EFI_NOT_FOUND There is no help text available for Command.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessManFile(
|
||||
ProcessManFile (
|
||||
IN CONST CHAR16 *ManFileName,
|
||||
IN CONST CHAR16 *Command,
|
||||
IN CONST CHAR16 *Sections OPTIONAL,
|
||||
@ -555,10 +574,11 @@ ProcessManFile(
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
||||
|
||||
if ( ManFileName == NULL
|
||||
|| Command == NULL
|
||||
|| HelpText == NULL
|
||||
){
|
||||
if ( (ManFileName == NULL)
|
||||
|| (Command == NULL)
|
||||
|| (HelpText == NULL)
|
||||
)
|
||||
{
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
@ -577,7 +597,7 @@ ProcessManFile(
|
||||
//
|
||||
// See if it's in HII first
|
||||
//
|
||||
TempString = ShellCommandGetCommandHelp(Command);
|
||||
TempString = ShellCommandGetCommandHelp (Command);
|
||||
if (TempString != NULL) {
|
||||
FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);
|
||||
HelpSize = StrLen (TempString) * sizeof (CHAR16);
|
||||
@ -585,39 +605,41 @@ ProcessManFile(
|
||||
ShellSetFilePosition (FileHandle, 0);
|
||||
HelpSize = 0;
|
||||
BriefSize = 0;
|
||||
Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||
if (!EFI_ERROR(Status) && HelpText != NULL){
|
||||
Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||
if (!EFI_ERROR (Status) && (HelpText != NULL)) {
|
||||
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||
}
|
||||
|
||||
ShellCloseFile (&FileHandle);
|
||||
} else {
|
||||
//
|
||||
// If the image is a external app, check .MAN file first.
|
||||
//
|
||||
FileHandle = NULL;
|
||||
TempString = GetManFileName(ManFileName);
|
||||
TempString = GetManFileName (ManFileName);
|
||||
if (TempString == NULL) {
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
Status = SearchPathForFile(TempString, &FileHandle);
|
||||
if (EFI_ERROR(Status)) {
|
||||
FileDevPath = FileDevicePath(NULL, TempString);
|
||||
Status = SearchPathForFile (TempString, &FileHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FileDevPath = FileDevicePath (NULL, TempString);
|
||||
DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, FileDevPath);
|
||||
Status = InternalOpenFileDevicePath(DevPath, &FileHandle, EFI_FILE_MODE_READ, 0);
|
||||
SHELL_FREE_NON_NULL(FileDevPath);
|
||||
SHELL_FREE_NON_NULL(DevPath);
|
||||
Status = InternalOpenFileDevicePath (DevPath, &FileHandle, EFI_FILE_MODE_READ, 0);
|
||||
SHELL_FREE_NON_NULL (FileDevPath);
|
||||
SHELL_FREE_NON_NULL (DevPath);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR (Status)) {
|
||||
HelpSize = 0;
|
||||
BriefSize = 0;
|
||||
Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||
if (!EFI_ERROR(Status) && HelpText != NULL){
|
||||
Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||
if (!EFI_ERROR (Status) && (HelpText != NULL)) {
|
||||
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||
}
|
||||
ShellInfoObject.NewEfiShellProtocol->CloseFile(FileHandle);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
|
||||
ShellInfoObject.NewEfiShellProtocol->CloseFile (FileHandle);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Get help text from .MAN file success.
|
||||
//
|
||||
@ -628,23 +650,25 @@ ProcessManFile(
|
||||
//
|
||||
// Load the app image to check EFI_HII_PACKAGE_LIST_PROTOCOL.
|
||||
//
|
||||
CmdFileName = GetExecuatableFileName(TempString);
|
||||
CmdFileName = GetExecuatableFileName (TempString);
|
||||
if (CmdFileName == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// If the file in CWD then use the file name, else use the full
|
||||
// path name.
|
||||
//
|
||||
CmdFilePathName = ShellFindFilePath(CmdFileName);
|
||||
CmdFilePathName = ShellFindFilePath (CmdFileName);
|
||||
if (CmdFilePathName == NULL) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto Done;
|
||||
}
|
||||
DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath(CmdFilePathName);
|
||||
Status = gBS->LoadImage(FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);
|
||||
if(EFI_ERROR(Status)) {
|
||||
|
||||
DevPath = ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFilePath (CmdFilePathName);
|
||||
Status = gBS->LoadImage (FALSE, gImageHandle, DevPath, NULL, 0, &CmdFileImgHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// With EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created
|
||||
// with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now.
|
||||
@ -654,18 +678,20 @@ ProcessManFile(
|
||||
if (Status == EFI_SECURITY_VIOLATION) {
|
||||
gBS->UnloadImage (CmdFileImgHandle);
|
||||
}
|
||||
|
||||
*HelpText = NULL;
|
||||
goto Done;
|
||||
}
|
||||
Status = gBS->OpenProtocol(
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
CmdFileImgHandle,
|
||||
&gEfiHiiPackageListProtocolGuid,
|
||||
(VOID**)&PackageListHeader,
|
||||
(VOID **)&PackageListHeader,
|
||||
gImageHandle,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if(EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
*HelpText = NULL;
|
||||
goto Done;
|
||||
}
|
||||
@ -679,7 +705,7 @@ ProcessManFile(
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&mShellManHiiDevicePath
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
@ -695,27 +721,30 @@ ProcessManFile(
|
||||
|
||||
StringIdWalker = 1;
|
||||
do {
|
||||
SHELL_FREE_NON_NULL(TempString);
|
||||
SHELL_FREE_NON_NULL (TempString);
|
||||
if (BriefDesc != NULL) {
|
||||
SHELL_FREE_NON_NULL(*BriefDesc);
|
||||
SHELL_FREE_NON_NULL (*BriefDesc);
|
||||
}
|
||||
|
||||
TempString = HiiGetString (mShellManHiiHandle, (EFI_STRING_ID)StringIdWalker, NULL);
|
||||
if (TempString == NULL) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
FileHandle = ConvertEfiFileProtocolToShellHandle (CreateFileInterfaceMem (TRUE), NULL);
|
||||
HelpSize = StrLen (TempString) * sizeof (CHAR16);
|
||||
ShellWriteFile (FileHandle, &HelpSize, TempString);
|
||||
ShellSetFilePosition (FileHandle, 0);
|
||||
HelpSize = 0;
|
||||
BriefSize = 0;
|
||||
Status = ManFileFindTitleSection(FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||
if (!EFI_ERROR(Status) && HelpText != NULL){
|
||||
Status = ManFileFindSections(FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||
Status = ManFileFindTitleSection (FileHandle, Command, BriefDesc, &BriefSize, &Ascii);
|
||||
if (!EFI_ERROR (Status) && (HelpText != NULL)) {
|
||||
Status = ManFileFindSections (FileHandle, Sections, HelpText, &HelpSize, Ascii);
|
||||
}
|
||||
|
||||
ShellCloseFile (&FileHandle);
|
||||
if (!EFI_ERROR(Status)){
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Found what we need and return
|
||||
//
|
||||
@ -724,7 +753,6 @@ ProcessManFile(
|
||||
|
||||
StringIdWalker += 1;
|
||||
} while (StringIdWalker < 0xFFFF && TempString != NULL);
|
||||
|
||||
}
|
||||
|
||||
Done:
|
||||
@ -746,12 +774,11 @@ Done:
|
||||
Status = gBS->UnloadImage (CmdFileImgHandle);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL(TempString);
|
||||
SHELL_FREE_NON_NULL(CmdFileName);
|
||||
SHELL_FREE_NON_NULL(CmdFilePathName);
|
||||
SHELL_FREE_NON_NULL(FileDevPath);
|
||||
SHELL_FREE_NON_NULL(DevPath);
|
||||
SHELL_FREE_NON_NULL (TempString);
|
||||
SHELL_FREE_NON_NULL (CmdFileName);
|
||||
SHELL_FREE_NON_NULL (CmdFilePathName);
|
||||
SHELL_FREE_NON_NULL (FileDevPath);
|
||||
SHELL_FREE_NON_NULL (DevPath);
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
@retval EFI_NOT_FOUND There is no help text available for Command.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessManFile(
|
||||
ProcessManFile (
|
||||
IN CONST CHAR16 *ManFileName,
|
||||
IN CONST CHAR16 *Command,
|
||||
IN CONST CHAR16 *Sections OPTIONAL,
|
||||
@ -66,7 +66,7 @@ ProcessManFile(
|
||||
an allocated buffer.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ManFileFindSections(
|
||||
ManFileFindSections (
|
||||
IN SHELL_FILE_HANDLE Handle,
|
||||
IN CONST CHAR16 *Sections,
|
||||
OUT CHAR16 **HelpText,
|
||||
@ -75,4 +75,3 @@ ManFileFindSections(
|
||||
);
|
||||
|
||||
#endif //_SHELL_MAN_FILE_PARSER_HEADER_
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -75,7 +75,7 @@ CleanUpShellParametersProtocol (
|
||||
@retval EFI_OUT_OF_RESOURCES a memory allocation failed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
UpdateArgcArgv(
|
||||
UpdateArgcArgv (
|
||||
IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
|
||||
IN CONST CHAR16 *NewCommandLine,
|
||||
IN SHELL_OPERATION_TYPES Type,
|
||||
@ -93,7 +93,7 @@ UpdateArgcArgv(
|
||||
@param[in] OldArgc pointer to old number of items in Argv list
|
||||
**/
|
||||
VOID
|
||||
RestoreArgcArgv(
|
||||
RestoreArgcArgv (
|
||||
IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
|
||||
IN CHAR16 ***OldArgv,
|
||||
IN UINTN *OldArgc
|
||||
@ -126,7 +126,7 @@ typedef struct {
|
||||
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
UpdateStdInStdOutStdErr(
|
||||
UpdateStdInStdOutStdErr (
|
||||
IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
|
||||
IN CHAR16 *NewCommandLine,
|
||||
OUT SHELL_FILE_HANDLE *OldStdIn,
|
||||
@ -172,7 +172,7 @@ RestoreStdInStdOutStdErr (
|
||||
@return EFI_OUT_OF_RESOURCES a memory allocation failed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ParseCommandLineToArgs(
|
||||
ParseCommandLineToArgs (
|
||||
IN CONST CHAR16 *CommandLine,
|
||||
IN BOOLEAN StripQuotation,
|
||||
IN OUT CHAR16 ***Argv,
|
||||
@ -200,7 +200,7 @@ ParseCommandLineToArgs(
|
||||
@return EFI_NOT_FOUND A closing " could not be found on the specified string
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetNextParameter(
|
||||
GetNextParameter (
|
||||
IN OUT CHAR16 **Walker,
|
||||
IN OUT CHAR16 **TempParameter,
|
||||
IN CONST UINTN Length,
|
||||
@ -208,4 +208,3 @@ GetNextParameter(
|
||||
);
|
||||
|
||||
#endif //_SHELL_PARAMETERS_PROTOCOL_PROVIDER_HEADER_
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -87,7 +87,7 @@ CleanUpShellEnvironment (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellSetMap(
|
||||
EfiShellSetMap (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL,
|
||||
IN CONST CHAR16 *Mapping
|
||||
);
|
||||
@ -107,7 +107,7 @@ EfiShellSetMap(
|
||||
**/
|
||||
CONST EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
EfiShellGetDevicePathFromMap(
|
||||
EfiShellGetDevicePathFromMap (
|
||||
IN CONST CHAR16 *Mapping
|
||||
);
|
||||
|
||||
@ -130,7 +130,7 @@ EfiShellGetDevicePathFromMap(
|
||||
**/
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
EfiShellGetMapFromDevicePath(
|
||||
EfiShellGetMapFromDevicePath (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
@ -149,7 +149,7 @@ EfiShellGetMapFromDevicePath(
|
||||
**/
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
EfiShellGetFilePathFromDevicePath(
|
||||
EfiShellGetFilePathFromDevicePath (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
|
||||
);
|
||||
|
||||
@ -166,7 +166,7 @@ EfiShellGetFilePathFromDevicePath(
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
EFIAPI
|
||||
EfiShellGetDevicePathFromFilePath(
|
||||
EfiShellGetDevicePathFromFilePath (
|
||||
IN CONST CHAR16 *Path
|
||||
);
|
||||
|
||||
@ -208,7 +208,7 @@ EfiShellGetDevicePathFromFilePath(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellGetDeviceName(
|
||||
EfiShellGetDeviceName (
|
||||
IN EFI_HANDLE DeviceHandle,
|
||||
IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
|
||||
IN CHAR8 *Language,
|
||||
@ -232,7 +232,7 @@ EfiShellGetDeviceName(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellOpenRootByHandle(
|
||||
EfiShellOpenRootByHandle (
|
||||
IN EFI_HANDLE DeviceHandle,
|
||||
OUT SHELL_FILE_HANDLE *FileHandle
|
||||
);
|
||||
@ -255,7 +255,7 @@ EfiShellOpenRootByHandle(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellOpenRoot(
|
||||
EfiShellOpenRoot (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT SHELL_FILE_HANDLE *FileHandle
|
||||
);
|
||||
@ -287,7 +287,7 @@ EfiShellBatchIsActive (
|
||||
@retval other an error occurred.
|
||||
**/
|
||||
EFI_STATUS
|
||||
InternalOpenFileDevicePath(
|
||||
InternalOpenFileDevicePath (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL *DevicePath2,
|
||||
OUT SHELL_FILE_HANDLE *FileHandle,
|
||||
IN UINT64 OpenMode,
|
||||
@ -332,7 +332,7 @@ InternalOpenFileDevicePath(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellCreateFile(
|
||||
EfiShellCreateFile (
|
||||
IN CONST CHAR16 *FileName,
|
||||
IN UINT64 FileAttribs,
|
||||
OUT SHELL_FILE_HANDLE *FileHandle
|
||||
@ -392,7 +392,7 @@ EfiShellCreateFile(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellOpenFileByName(
|
||||
EfiShellOpenFileByName (
|
||||
IN CONST CHAR16 *FileName,
|
||||
OUT SHELL_FILE_HANDLE *FileHandle,
|
||||
IN UINT64 OpenMode
|
||||
@ -412,7 +412,7 @@ EfiShellOpenFileByName(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellDeleteFileByName(
|
||||
EfiShellDeleteFileByName (
|
||||
IN CONST CHAR16 *FileName
|
||||
);
|
||||
|
||||
@ -456,7 +456,7 @@ EfiShellEnablePageBreak (
|
||||
@retval EFI_UNSUPPORTED Nested shell invocations are not allowed.
|
||||
**/
|
||||
EFI_STATUS
|
||||
InternalShellExecuteDevicePath(
|
||||
InternalShellExecuteDevicePath (
|
||||
IN CONST EFI_HANDLE *ParentImageHandle,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN CONST CHAR16 *CommandLine OPTIONAL,
|
||||
@ -497,7 +497,7 @@ InternalShellExecuteDevicePath(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellExecute(
|
||||
EfiShellExecute (
|
||||
IN EFI_HANDLE *ParentImageHandle,
|
||||
IN CHAR16 *CommandLine OPTIONAL,
|
||||
IN CHAR16 **Environment OPTIONAL,
|
||||
@ -513,7 +513,7 @@ EfiShellExecute(
|
||||
@param FileListNode pointer to the list node to free
|
||||
**/
|
||||
VOID
|
||||
FreeShellFileInfoNode(
|
||||
FreeShellFileInfoNode (
|
||||
IN EFI_SHELL_FILE_INFO *FileListNode
|
||||
);
|
||||
|
||||
@ -531,7 +531,7 @@ FreeShellFileInfoNode(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellFreeFileList(
|
||||
EfiShellFreeFileList (
|
||||
IN EFI_SHELL_FILE_INFO **FileList
|
||||
);
|
||||
|
||||
@ -547,7 +547,7 @@ EfiShellFreeFileList(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellRemoveDupInFileList(
|
||||
EfiShellRemoveDupInFileList (
|
||||
IN EFI_SHELL_FILE_INFO **FileList
|
||||
);
|
||||
|
||||
@ -563,7 +563,7 @@ EfiShellRemoveDupInFileList(
|
||||
|
||||
**/
|
||||
EFI_SHELL_FILE_INFO *
|
||||
CreateAndPopulateShellFileInfo(
|
||||
CreateAndPopulateShellFileInfo (
|
||||
IN CONST CHAR16 *BasePath,
|
||||
IN CONST EFI_STATUS Status,
|
||||
IN CONST CHAR16 *FileName,
|
||||
@ -586,7 +586,7 @@ CreateAndPopulateShellFileInfo(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellFindFilesInDir(
|
||||
EfiShellFindFilesInDir (
|
||||
IN SHELL_FILE_HANDLE FileDirHandle,
|
||||
OUT EFI_SHELL_FILE_INFO **FileList
|
||||
);
|
||||
@ -619,7 +619,7 @@ EfiShellFindFilesInDir(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellFindFiles(
|
||||
EfiShellFindFiles (
|
||||
IN CONST CHAR16 *FilePattern,
|
||||
OUT EFI_SHELL_FILE_INFO **FileList
|
||||
);
|
||||
@ -641,7 +641,7 @@ EfiShellFindFiles(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellOpenFileList(
|
||||
EfiShellOpenFileList (
|
||||
IN CHAR16 *Path,
|
||||
IN UINT64 OpenMode,
|
||||
IN OUT EFI_SHELL_FILE_INFO **FileList
|
||||
@ -660,7 +660,7 @@ EfiShellOpenFileList(
|
||||
**/
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
EfiShellGetEnv(
|
||||
EfiShellGetEnv (
|
||||
IN CONST CHAR16 *Name
|
||||
);
|
||||
|
||||
@ -687,7 +687,7 @@ EfiShellGetEnv(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellSetEnv(
|
||||
EfiShellSetEnv (
|
||||
IN CONST CHAR16 *Name,
|
||||
IN CONST CHAR16 *Value,
|
||||
IN BOOLEAN Volatile
|
||||
@ -709,7 +709,7 @@ EfiShellSetEnv(
|
||||
**/
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
EfiShellGetCurDir(
|
||||
EfiShellGetCurDir (
|
||||
IN CONST CHAR16 *FileSystemMapping OPTIONAL
|
||||
);
|
||||
|
||||
@ -738,7 +738,7 @@ EfiShellGetCurDir(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellSetCurDir(
|
||||
EfiShellSetCurDir (
|
||||
IN CONST CHAR16 *FileSystem OPTIONAL,
|
||||
IN CONST CHAR16 *Dir
|
||||
);
|
||||
@ -770,7 +770,7 @@ EfiShellSetCurDir(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellGetHelpText(
|
||||
EfiShellGetHelpText (
|
||||
IN CONST CHAR16 *Command,
|
||||
IN CONST CHAR16 *Sections OPTIONAL,
|
||||
OUT CHAR16 **HelpText
|
||||
@ -786,7 +786,7 @@ EfiShellGetHelpText(
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
EfiShellGetPageBreak(
|
||||
EfiShellGetPageBreak (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -800,7 +800,7 @@ EfiShellGetPageBreak(
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
EfiShellIsRootShell(
|
||||
EfiShellIsRootShell (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -823,7 +823,7 @@ EfiShellIsRootShell(
|
||||
**/
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
EfiShellGetAlias(
|
||||
EfiShellGetAlias (
|
||||
IN CONST CHAR16 *Command,
|
||||
OUT BOOLEAN *Volatile OPTIONAL
|
||||
);
|
||||
@ -845,7 +845,7 @@ EfiShellGetAlias(
|
||||
@retval EFI_NOT_FOUND the Alias intended to be deleted was not found
|
||||
**/
|
||||
EFI_STATUS
|
||||
InternalSetAlias(
|
||||
InternalSetAlias (
|
||||
IN CONST CHAR16 *Command,
|
||||
IN CONST CHAR16 *Alias OPTIONAL,
|
||||
IN BOOLEAN Volatile
|
||||
@ -873,7 +873,7 @@ InternalSetAlias(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiShellSetAlias(
|
||||
EfiShellSetAlias (
|
||||
IN CONST CHAR16 *Command,
|
||||
IN CONST CHAR16 *Alias OPTIONAL,
|
||||
IN BOOLEAN Replace,
|
||||
@ -889,7 +889,7 @@ EfiShellSetAlias(
|
||||
@param FileListNode pointer to the list node to free
|
||||
**/
|
||||
VOID
|
||||
InternalFreeShellFileInfoNode(
|
||||
InternalFreeShellFileInfoNode (
|
||||
IN EFI_SHELL_FILE_INFO *FileListNode
|
||||
);
|
||||
|
||||
@ -904,7 +904,7 @@ InternalFreeShellFileInfoNode(
|
||||
@retval EFI_SUCCESS The environment variable was successfully updated.
|
||||
**/
|
||||
EFI_STATUS
|
||||
InternalEfiShellSetEnv(
|
||||
InternalEfiShellSetEnv (
|
||||
IN CONST CHAR16 *Name,
|
||||
IN CONST CHAR16 *Value,
|
||||
IN BOOLEAN Volatile
|
||||
@ -918,7 +918,7 @@ InternalEfiShellSetEnv(
|
||||
@retval EFI_OUT_OF_RESOURCES There is not enough memory available.
|
||||
**/
|
||||
EFI_STATUS
|
||||
InernalEfiShellStartMonitor(
|
||||
InernalEfiShellStartMonitor (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -931,8 +931,8 @@ InernalEfiShellStartMonitor(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
NotificationFunction(
|
||||
NotificationFunction (
|
||||
IN EFI_KEY_DATA *KeyData
|
||||
);
|
||||
#endif //_SHELL_PROTOCOL_HEADER_
|
||||
|
||||
#endif //_SHELL_PROTOCOL_HEADER_
|
||||
|
@ -34,11 +34,13 @@ ShellAppMain (
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
if (Argc == 1) {
|
||||
Print (L"Argv[1] = NULL\n");
|
||||
}
|
||||
|
||||
for (Index = 1; Index < Argc; Index++) {
|
||||
Print(L"Argv[%d]: \"%s\"\n", Index, Argv[Index]);
|
||||
Print (L"Argv[%d]: \"%s\"\n", Index, Argv[Index]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -27,6 +27,6 @@ UefiMain (
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
Print(L"ShellExecute - Pass");
|
||||
Print (L"ShellExecute - Pass");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -24,14 +24,19 @@
|
||||
**/
|
||||
INTN
|
||||
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);
|
||||
}
|
||||
if (*(INTN*)b1 < *(INTN*)b2) {
|
||||
return(-1);
|
||||
|
||||
if (*(INTN *)b1 < *(INTN *)b2) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -69,9 +74,9 @@ ShellAppMain (
|
||||
Array[8] = 1;
|
||||
Array[9] = 5;
|
||||
|
||||
Print(L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0],Array[1],Array[2],Array[3],Array[4],Array[5],Array[6],Array[7],Array[8],Array[9]);
|
||||
PerformQuickSort(Array, 10, sizeof(INTN), Test);
|
||||
Print(L"POST-SORT\r\n");
|
||||
Print(L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0],Array[1],Array[2],Array[3],Array[4],Array[5],Array[6],Array[7],Array[8],Array[9]);
|
||||
Print (L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0], Array[1], Array[2], Array[3], Array[4], Array[5], Array[6], Array[7], Array[8], Array[9]);
|
||||
PerformQuickSort (Array, 10, sizeof (INTN), Test);
|
||||
Print (L"POST-SORT\r\n");
|
||||
Print (L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0], Array[1], Array[2], Array[3], Array[4], Array[5], Array[6], Array[7], Array[8], Array[9]);
|
||||
return 0;
|
||||
}
|
||||
|
@ -72,20 +72,20 @@ PERF_CUM_DATA CumData[] = {
|
||||
};
|
||||
|
||||
/// Number of items for which we are gathering cumulative statistics.
|
||||
UINT32 const NumCum = sizeof(CumData) / sizeof(PERF_CUM_DATA);
|
||||
UINT32 const NumCum = sizeof (CumData) / sizeof (PERF_CUM_DATA);
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-v", TypeFlag}, // -v Verbose Mode
|
||||
{L"-A", TypeFlag}, // -A All, Cooked
|
||||
{L"-R", TypeFlag}, // -R RAW All
|
||||
{L"-s", TypeFlag}, // -s Summary
|
||||
{L"-x", TypeFlag}, // -x eXclude Cumulative Items
|
||||
{L"-i", TypeFlag}, // -i Display Identifier
|
||||
{L"-c", TypeValue}, // -c Display cumulative data.
|
||||
{L"-n", TypeValue}, // -n # Number of records to display for A and R
|
||||
{L"-t", TypeValue}, // -t # Threshold of interest
|
||||
{NULL, TypeMax}
|
||||
};
|
||||
{ L"-v", TypeFlag }, // -v Verbose Mode
|
||||
{ L"-A", TypeFlag }, // -A All, Cooked
|
||||
{ L"-R", TypeFlag }, // -R RAW All
|
||||
{ L"-s", TypeFlag }, // -s Summary
|
||||
{ L"-x", TypeFlag }, // -x eXclude Cumulative Items
|
||||
{ L"-i", TypeFlag }, // -i Display Identifier
|
||||
{ L"-c", TypeValue }, // -c Display cumulative data.
|
||||
{ L"-n", TypeValue }, // -n # Number of records to display for A and R
|
||||
{ L"-t", TypeValue }, // -t # Threshold of interest
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
///@}
|
||||
|
||||
@ -93,14 +93,23 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
Display the trailing Verbose information.
|
||||
**/
|
||||
VOID
|
||||
DumpStatistics( void )
|
||||
DumpStatistics (
|
||||
void
|
||||
)
|
||||
{
|
||||
EFI_STRING StringPtr;
|
||||
EFI_STRING StringPtrUnknown;
|
||||
|
||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL);
|
||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
||||
ShellPrintHiiEx (
|
||||
-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_NUMINCOMPLETE), mDpHiiHandle, SummaryData.NumIncomplete);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPHASES), mDpHiiHandle, SummaryData.NumSummary);
|
||||
@ -121,7 +130,7 @@ GetBootPerformanceTable (
|
||||
{
|
||||
FIRMWARE_PERFORMANCE_TABLE *FirmwarePerformanceTable;
|
||||
|
||||
FirmwarePerformanceTable = (FIRMWARE_PERFORMANCE_TABLE *) EfiLocateFirstAcpiTable (
|
||||
FirmwarePerformanceTable = (FIRMWARE_PERFORMANCE_TABLE *)EfiLocateFirstAcpiTable (
|
||||
EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE
|
||||
);
|
||||
if (FirmwarePerformanceTable == NULL) {
|
||||
@ -129,8 +138,8 @@ GetBootPerformanceTable (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
mBootPerformanceTable = (UINT8*) (UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer;
|
||||
mBootPerformanceTableSize = ((BOOT_PERFORMANCE_TABLE *) mBootPerformanceTable)->Header.Length;
|
||||
mBootPerformanceTable = (UINT8 *)(UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer;
|
||||
mBootPerformanceTableSize = ((BOOT_PERFORMANCE_TABLE *)mBootPerformanceTable)->Header.Length;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -153,6 +162,7 @@ GetHandleFormModuleGuid (
|
||||
if (IsZeroGuid (ModuleGuid)) {
|
||||
*Handle = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Try to get the Handle from the cached array.
|
||||
//
|
||||
@ -162,6 +172,7 @@ GetHandleFormModuleGuid (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Index >= mCachePairCount) {
|
||||
*Handle = NULL;
|
||||
}
|
||||
@ -203,7 +214,7 @@ BuildCachedGuidHandleTable (
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID**) &LoadedImage
|
||||
(VOID **)&LoadedImage
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
@ -212,7 +223,7 @@ BuildCachedGuidHandleTable (
|
||||
Status = gBS->OpenProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
(VOID **) &DriverBinding,
|
||||
(VOID **)&DriverBinding,
|
||||
NULL,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@ -224,32 +235,35 @@ BuildCachedGuidHandleTable (
|
||||
Status = gBS->HandleProtocol (
|
||||
DriverBinding->ImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID**) &LoadedImage
|
||||
(VOID **)&LoadedImage
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status) && LoadedImage != NULL) {
|
||||
if (!EFI_ERROR (Status) && (LoadedImage != NULL)) {
|
||||
//
|
||||
// Get Module Guid from DevicePath.
|
||||
//
|
||||
if (LoadedImage->FilePath != NULL &&
|
||||
LoadedImage->FilePath->Type == MEDIA_DEVICE_PATH &&
|
||||
LoadedImage->FilePath->SubType == MEDIA_PIWG_FW_FILE_DP
|
||||
) {
|
||||
FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LoadedImage->FilePath;
|
||||
if ((LoadedImage->FilePath != NULL) &&
|
||||
(LoadedImage->FilePath->Type == MEDIA_DEVICE_PATH) &&
|
||||
(LoadedImage->FilePath->SubType == MEDIA_PIWG_FW_FILE_DP)
|
||||
)
|
||||
{
|
||||
FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)LoadedImage->FilePath;
|
||||
TempGuid = &FvFilePath->FvFileName;
|
||||
|
||||
mCacheHandleGuidTable[mCachePairCount].Handle = HandleBuffer[Index];
|
||||
CopyGuid (&mCacheHandleGuidTable[mCachePairCount].ModuleGuid, TempGuid);
|
||||
mCachePairCount ++;
|
||||
mCachePairCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
HandleBuffer = NULL;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -280,6 +294,7 @@ GetMeasurementInfo (
|
||||
} else {
|
||||
Measurement->EndTimeStamp = ((FPDT_GUID_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||
}
|
||||
|
||||
switch (Measurement->Identifier) {
|
||||
case MODULE_START_ID:
|
||||
case MODULE_END_ID:
|
||||
@ -290,22 +305,23 @@ GetMeasurementInfo (
|
||||
Measurement->Token = ALit_START_IMAGE;
|
||||
Measurement->Module = ALit_START_IMAGE;
|
||||
}
|
||||
|
||||
break;
|
||||
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);
|
||||
} else {
|
||||
GetHandleFormModuleGuid(ModuleGuid, &StartHandle);
|
||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||
Measurement->Handle = StartHandle;
|
||||
//
|
||||
// When no perf entry to record the PEI and DXE phase,
|
||||
// For start image, we need detect the PEIM and non PEIM here.
|
||||
//
|
||||
if (Measurement->Token == NULL) {
|
||||
if (StartHandle == NULL && !IsZeroGuid (ModuleGuid)) {
|
||||
if ((StartHandle == NULL) && !IsZeroGuid (ModuleGuid)) {
|
||||
Measurement->Token = ALit_PEIM;
|
||||
Measurement->Module = ALit_PEIM;
|
||||
Measurement->Handle = ModuleGuid;
|
||||
@ -315,6 +331,7 @@ GetMeasurementInfo (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FPDT_DYNAMIC_STRING_EVENT_TYPE:
|
||||
@ -325,6 +342,7 @@ GetMeasurementInfo (
|
||||
} else {
|
||||
Measurement->EndTimeStamp = ((FPDT_DYNAMIC_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||
}
|
||||
|
||||
switch (Measurement->Identifier) {
|
||||
case MODULE_START_ID:
|
||||
case MODULE_END_ID:
|
||||
@ -333,6 +351,7 @@ GetMeasurementInfo (
|
||||
} else if (mDxePhase) {
|
||||
Measurement->Token = ALit_START_IMAGE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MODULE_LOADIMAGE_START_ID:
|
||||
@ -362,17 +381,17 @@ GetMeasurementInfo (
|
||||
|
||||
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);
|
||||
} else {
|
||||
GetHandleFormModuleGuid(ModuleGuid, &StartHandle);
|
||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||
Measurement->Handle = StartHandle;
|
||||
//
|
||||
// When no perf entry to record the PEI and DXE phase,
|
||||
// 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 (StartHandle == NULL && !IsZeroGuid (ModuleGuid)) {
|
||||
if ((Measurement->Token == NULL) && ((Measurement->Identifier == MODULE_START_ID) || (Measurement->Identifier == MODULE_END_ID))) {
|
||||
if ((StartHandle == NULL) && !IsZeroGuid (ModuleGuid)) {
|
||||
Measurement->Token = ALit_PEIM;
|
||||
Measurement->Handle = ModuleGuid;
|
||||
} else {
|
||||
@ -380,6 +399,7 @@ GetMeasurementInfo (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FPDT_GUID_QWORD_EVENT_TYPE:
|
||||
@ -390,6 +410,7 @@ GetMeasurementInfo (
|
||||
} else {
|
||||
Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||
}
|
||||
|
||||
switch (Measurement->Identifier) {
|
||||
case MODULE_DB_START_ID:
|
||||
Measurement->Token = ALit_DB_START;
|
||||
@ -415,9 +436,10 @@ GetMeasurementInfo (
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
GetHandleFormModuleGuid(ModuleGuid, &StartHandle);
|
||||
|
||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||
Measurement->Handle = StartHandle;
|
||||
break;
|
||||
|
||||
@ -425,10 +447,11 @@ GetMeasurementInfo (
|
||||
ModuleGuid = &(((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Guid);
|
||||
Measurement->Identifier = ((UINT32)((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->ProgressID);
|
||||
if (IsStart) {
|
||||
Measurement->StartTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD*)RecordHeader)->Timestamp;
|
||||
Measurement->StartTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||
} else {
|
||||
Measurement->EndTimeStamp = ((FPDT_GUID_QWORD_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||
}
|
||||
|
||||
//
|
||||
// Currently only "DB:Start:" end record with FPDT_GUID_QWORD_STRING_EVENT_TYPE.
|
||||
//
|
||||
@ -438,9 +461,10 @@ GetMeasurementInfo (
|
||||
Measurement->Module = ALit_DB_START;
|
||||
break;
|
||||
default:
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
GetHandleFormModuleGuid(ModuleGuid, &StartHandle);
|
||||
|
||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||
Measurement->Handle = StartHandle;
|
||||
break;
|
||||
|
||||
@ -452,9 +476,10 @@ GetMeasurementInfo (
|
||||
} else {
|
||||
Measurement->EndTimeStamp = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->Timestamp;
|
||||
}
|
||||
|
||||
Measurement->Token = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String;
|
||||
Measurement->Module = ((FPDT_DUAL_GUID_STRING_EVENT_RECORD *)RecordHeader)->String;
|
||||
GetHandleFormModuleGuid(ModuleGuid, &StartHandle);
|
||||
GetHandleFormModuleGuid (ModuleGuid, &StartHandle);
|
||||
Measurement->Handle = StartHandle;
|
||||
break;
|
||||
|
||||
@ -478,25 +503,28 @@ SearchMeasurement (
|
||||
|
||||
for (Index = mMeasurementNum - 1; Index >= 0; Index--) {
|
||||
if (AsciiStrCmp (EndMeasureMent->Token, ALit_PEIM) == 0) {
|
||||
if (mMeasurementList[Index].EndTimeStamp == 0 && EndMeasureMent->Handle!= NULL && mMeasurementList[Index].Handle != NULL&&
|
||||
CompareGuid(mMeasurementList[Index].Handle, EndMeasureMent->Handle) &&
|
||||
if ((mMeasurementList[Index].EndTimeStamp == 0) && (EndMeasureMent->Handle != NULL) && (mMeasurementList[Index].Handle != NULL) &&
|
||||
CompareGuid (mMeasurementList[Index].Handle, EndMeasureMent->Handle) &&
|
||||
(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;
|
||||
break;
|
||||
}
|
||||
} 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].Module, EndMeasureMent->Module) == 0) &&
|
||||
mMeasurementList[Index].Identifier == PERF_CROSSMODULE_START_ID) {
|
||||
(mMeasurementList[Index].Identifier == PERF_CROSSMODULE_START_ID))
|
||||
{
|
||||
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
|
||||
break;
|
||||
}
|
||||
} 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].Module, EndMeasureMent->Module) == 0)) {
|
||||
(AsciiStrCmp (mMeasurementList[Index].Module, EndMeasureMent->Module) == 0))
|
||||
{
|
||||
mMeasurementList[Index].EndTimeStamp = EndMeasureMent->EndTimeStamp;
|
||||
break;
|
||||
}
|
||||
@ -528,7 +556,7 @@ BuildMeasurementList (
|
||||
PerformanceTablePtr = (mBootPerformanceTable + TableLength);
|
||||
|
||||
while (TableLength < mBootPerformanceTableSize) {
|
||||
RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER*) PerformanceTablePtr;
|
||||
RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)PerformanceTablePtr;
|
||||
StartRecordEvent = (UINT8 *)RecordHeader;
|
||||
StartProgressId = ((FPDT_GUID_EVENT_RECORD *)StartRecordEvent)->ProgressID;
|
||||
|
||||
@ -539,14 +567,15 @@ BuildMeasurementList (
|
||||
//
|
||||
if (StartProgressId == 0) {
|
||||
GetMeasurementInfo (RecordHeader, FALSE, &(mMeasurementList[mMeasurementNum]));
|
||||
mMeasurementNum ++;
|
||||
} else if (((StartProgressId >= PERF_EVENTSIGNAL_START_ID && ((StartProgressId & 0x000F) == 0)) ||
|
||||
(StartProgressId < PERF_EVENTSIGNAL_START_ID && ((StartProgressId & 0x0001) != 0)))) {
|
||||
mMeasurementNum++;
|
||||
} else if ((((StartProgressId >= PERF_EVENTSIGNAL_START_ID) && ((StartProgressId & 0x000F) == 0)) ||
|
||||
((StartProgressId < PERF_EVENTSIGNAL_START_ID) && ((StartProgressId & 0x0001) != 0))))
|
||||
{
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
if(StartProgressId == PERF_CROSSMODULE_START_ID ){
|
||||
if (StartProgressId == PERF_CROSSMODULE_START_ID ) {
|
||||
if (AsciiStrCmp (((FPDT_DYNAMIC_STRING_EVENT_RECORD *)StartRecordEvent)->String, ALit_PEI) == 0) {
|
||||
mPeiPhase = TRUE;
|
||||
} else if (AsciiStrCmp (((FPDT_DYNAMIC_STRING_EVENT_RECORD *)StartRecordEvent)->String, ALit_DXE) == 0) {
|
||||
@ -554,17 +583,20 @@ BuildMeasurementList (
|
||||
mPeiPhase = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Get measurement info form the start record to the mMeasurementList.
|
||||
GetMeasurementInfo (RecordHeader, TRUE, &(mMeasurementList[mMeasurementNum]));
|
||||
mMeasurementNum ++;
|
||||
mMeasurementNum++;
|
||||
} else {
|
||||
ZeroMem(&MeasureMent, sizeof(MEASUREMENT_RECORD));
|
||||
ZeroMem (&MeasureMent, sizeof (MEASUREMENT_RECORD));
|
||||
GetMeasurementInfo (RecordHeader, FALSE, &MeasureMent);
|
||||
SearchMeasurement (&MeasureMent);
|
||||
}
|
||||
|
||||
TableLength += RecordHeader->Length;
|
||||
PerformanceTablePtr += RecordHeader->Length;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -655,17 +687,17 @@ RunDp (
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Process Command Line arguments
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &ParamPackage, NULL, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_ARG), mDpHiiHandle);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetCount(ParamPackage) > 1){
|
||||
} else if (ShellCommandLineGetCount (ParamPackage) > 1) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_MANY), mDpHiiHandle);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
@ -674,7 +706,7 @@ RunDp (
|
||||
// Boolean options
|
||||
//
|
||||
VerboseMode = ShellCommandLineGetFlag (ParamPackage, L"-v");
|
||||
SummaryMode = (BOOLEAN) (ShellCommandLineGetFlag (ParamPackage, L"-S") || ShellCommandLineGetFlag (ParamPackage, L"-s"));
|
||||
SummaryMode = (BOOLEAN)(ShellCommandLineGetFlag (ParamPackage, L"-S") || ShellCommandLineGetFlag (ParamPackage, L"-s"));
|
||||
AllMode = ShellCommandLineGetFlag (ParamPackage, L"-A");
|
||||
RawMode = ShellCommandLineGetFlag (ParamPackage, L"-R");
|
||||
ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x");
|
||||
@ -697,13 +729,14 @@ RunDp (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_NO_RAW_ALL), mDpHiiHandle);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
Status = ShellConvertStringToUint64(CmdLineArg, &Intermediate, FALSE, TRUE);
|
||||
|
||||
Status = ShellConvertStringToUint64 (CmdLineArg, &Intermediate, FALSE, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_NUM_ARG), mDpHiiHandle, L"-n");
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
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);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
@ -719,7 +752,7 @@ RunDp (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_FEW), mDpHiiHandle);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
Status = ShellConvertStringToUint64(CmdLineArg, &Intermediate, FALSE, TRUE);
|
||||
Status = ShellConvertStringToUint64 (CmdLineArg, &Intermediate, FALSE, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_NUM_ARG), mDpHiiHandle, L"-t");
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
@ -742,6 +775,7 @@ RunDp (
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
CustomCumulativeData->MinDur = PERF_MAXDUR;
|
||||
CustomCumulativeData->MaxDur = 0;
|
||||
CustomCumulativeData->Count = 0;
|
||||
@ -752,6 +786,7 @@ RunDp (
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);
|
||||
}
|
||||
}
|
||||
@ -762,7 +797,7 @@ RunDp (
|
||||
//
|
||||
|
||||
//
|
||||
//1. Get FPDT from ACPI table.
|
||||
// 1. Get FPDT from ACPI table.
|
||||
//
|
||||
Status = GetBootPerformanceTable ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -771,16 +806,16 @@ RunDp (
|
||||
}
|
||||
|
||||
//
|
||||
//2. Cache the ModuleGuid and hanlde mapping table.
|
||||
// 2. Cache the ModuleGuid and hanlde mapping table.
|
||||
//
|
||||
Status = BuildCachedGuidHandleTable();
|
||||
Status = BuildCachedGuidHandleTable ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellStatus = Status;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
//3. Build the measurement array form the FPDT records.
|
||||
// 3. Build the measurement array form the FPDT records.
|
||||
//
|
||||
Status = BuildMeasurementList ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -806,7 +841,7 @@ RunDp (
|
||||
// StartCount = Value loaded into the counter when it starts counting
|
||||
// EndCount = Value counter counts to before it needs to be reset
|
||||
//
|
||||
Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **) &PerformanceProperty);
|
||||
Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **)&PerformanceProperty);
|
||||
if (EFI_ERROR (Status) || (PerformanceProperty == NULL)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOUND), mDpHiiHandle);
|
||||
goto Done;
|
||||
@ -827,11 +862,19 @@ RunDp (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_KHZ), mDpHiiHandle, TimerInfo.Frequency);
|
||||
|
||||
if (VerboseMode && !RawMode) {
|
||||
StringPtr = HiiGetString (mDpHiiHandle,
|
||||
(EFI_STRING_ID) (TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)), NULL);
|
||||
StringPtr = HiiGetString (
|
||||
mDpHiiHandle,
|
||||
(EFI_STRING_ID)(TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)),
|
||||
NULL
|
||||
);
|
||||
ASSERT (StringPtr != NULL);
|
||||
// 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,
|
||||
TimerInfo.StartCount,
|
||||
TimerInfo.EndCount
|
||||
@ -839,40 +882,40 @@ RunDp (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_VERBOSE_THRESHOLD), mDpHiiHandle, mInterestThreshold);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
**** Print Sections based on command line options
|
||||
****
|
||||
**** Option modes have the following priority:
|
||||
**** v Verbose -- Valid in combination with any other options
|
||||
**** t Threshold -- Modifies All, Raw, and Cooked output
|
||||
**** Default is 0 for All and Raw mode
|
||||
**** Default is DEFAULT_THRESHOLD for "Cooked" mode
|
||||
**** n Number2Display Used by All and Raw mode. Otherwise ignored.
|
||||
**** A All -- R and S options are ignored
|
||||
**** R Raw -- S option is ignored
|
||||
**** s Summary -- Modifies "Cooked" output only
|
||||
**** Cooked (Default)
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
**** Print Sections based on command line options
|
||||
****
|
||||
**** Option modes have the following priority:
|
||||
**** v Verbose -- Valid in combination with any other options
|
||||
**** t Threshold -- Modifies All, Raw, and Cooked output
|
||||
**** Default is 0 for All and Raw mode
|
||||
**** Default is DEFAULT_THRESHOLD for "Cooked" mode
|
||||
**** n Number2Display Used by All and Raw mode. Otherwise ignored.
|
||||
**** A All -- R and S options are ignored
|
||||
**** R Raw -- S option is ignored
|
||||
**** s Summary -- Modifies "Cooked" output only
|
||||
**** Cooked (Default)
|
||||
****************************************************************************/
|
||||
GatherStatistics (CustomCumulativeData);
|
||||
if (CumulativeMode) {
|
||||
ProcessCumulative (CustomCumulativeData);
|
||||
} else if (AllMode) {
|
||||
Status = DumpAllTrace( Number2Display, ExcludeMode);
|
||||
Status = DumpAllTrace (Number2Display, ExcludeMode);
|
||||
if (Status == EFI_ABORTED) {
|
||||
ShellStatus = SHELL_ABORTED;
|
||||
goto Done;
|
||||
}
|
||||
} else if (RawMode) {
|
||||
Status = DumpRawTrace( Number2Display, ExcludeMode);
|
||||
Status = DumpRawTrace (Number2Display, ExcludeMode);
|
||||
if (Status == EFI_ABORTED) {
|
||||
ShellStatus = SHELL_ABORTED;
|
||||
goto Done;
|
||||
}
|
||||
} else {
|
||||
//------------- Begin Cooked Mode Processing
|
||||
// ------------- Begin Cooked Mode Processing
|
||||
ProcessPhases ();
|
||||
if ( ! SummaryMode) {
|
||||
Status = ProcessHandles ( ExcludeMode);
|
||||
if ( !SummaryMode) {
|
||||
Status = ProcessHandles (ExcludeMode);
|
||||
if (Status == EFI_ABORTED) {
|
||||
ShellStatus = SHELL_ABORTED;
|
||||
goto Done;
|
||||
@ -892,19 +935,22 @@ RunDp (
|
||||
|
||||
ProcessCumulative (NULL);
|
||||
}
|
||||
} //------------- End of Cooked Mode Processing
|
||||
} // ------------- End of Cooked Mode Processing
|
||||
|
||||
if ( VerboseMode || SummaryMode) {
|
||||
DumpStatistics();
|
||||
DumpStatistics ();
|
||||
}
|
||||
|
||||
Done:
|
||||
if (ParamPackage != NULL) {
|
||||
ShellCommandLineFreeVarList (ParamPackage);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (StringPtr);
|
||||
if (CustomCumulativeData != NULL) {
|
||||
SHELL_FREE_NON_NULL (CustomCumulativeData->Name);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (CustomCumulativeData);
|
||||
|
||||
SHELL_FREE_NON_NULL (mMeasurementList);
|
||||
@ -916,7 +962,6 @@ Done:
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieve HII package list from ImageHandle and publish to HII database.
|
||||
|
||||
@ -962,5 +1007,6 @@ InitializeHiiPackage (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return HiiHandle;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#ifndef _DP_H_
|
||||
#define _DP_H_
|
||||
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Guid/Performance.h>
|
||||
@ -54,7 +53,7 @@ extern EFI_HII_HANDLE mDpHiiHandle;
|
||||
#define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
|
||||
|
||||
/// Determine whether 0 <= C < L. If L == 0, return true regardless of C.
|
||||
#define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) )
|
||||
#define WITHIN_LIMIT(C, L) ( ((L) == 0) || ((C) < (L)) )
|
||||
|
||||
/// Structure for storing Timer specific information.
|
||||
typedef struct {
|
||||
@ -137,4 +136,5 @@ EFI_HII_HANDLE
|
||||
InitializeHiiPackage (
|
||||
EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
#endif // _DP_H_
|
||||
|
@ -36,6 +36,7 @@ DpAppInitialize (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
mDpHiiHandle = InitializeHiiPackage (ImageHandle);
|
||||
if (mDpHiiHandle == NULL) {
|
||||
return EFI_ABORTED;
|
||||
|
@ -82,6 +82,7 @@ DpCommandInitialize (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
mDpHiiHandle = InitializeHiiPackage (ImageHandle);
|
||||
if (mDpHiiHandle == NULL) {
|
||||
return EFI_ABORTED;
|
||||
@ -109,9 +110,10 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
DpUnload (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
ImageHandle,
|
||||
&gEfiShellDynamicCommandProtocolGuid,
|
||||
@ -120,6 +122,7 @@ DpUnload (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
HiiRemovePackages (mDpHiiHandle);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef _DP_INTELNAL_H_
|
||||
#define _DP_INTELNAL_H_
|
||||
|
||||
@ -75,7 +76,7 @@ GetDuration (
|
||||
@retval FALSE The measurement record is NOT for an EFI Phase.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsPhase(
|
||||
IsPhase (
|
||||
IN MEASUREMENT_RECORD *Measurement
|
||||
);
|
||||
|
||||
@ -89,7 +90,7 @@ IsPhase(
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
IsCorePerf(
|
||||
IsCorePerf (
|
||||
IN MEASUREMENT_RECORD *Measurement
|
||||
);
|
||||
|
||||
@ -164,7 +165,7 @@ DurationInMicroSeconds (
|
||||
@retval >=0 Return value is the index into CumData where Token is found.
|
||||
**/
|
||||
INTN
|
||||
GetCumulativeItem(
|
||||
GetCumulativeItem (
|
||||
IN MEASUREMENT_RECORD *Measurement
|
||||
);
|
||||
|
||||
@ -186,7 +187,7 @@ GetCumulativeItem(
|
||||
|
||||
**/
|
||||
VOID
|
||||
GatherStatistics(
|
||||
GatherStatistics (
|
||||
IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
|
||||
);
|
||||
|
||||
@ -212,7 +213,7 @@ GatherStatistics(
|
||||
@return Others from a call to gBS->LocateHandleBuffer().
|
||||
**/
|
||||
EFI_STATUS
|
||||
DumpAllTrace(
|
||||
DumpAllTrace (
|
||||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
);
|
||||
@ -237,7 +238,7 @@ DumpAllTrace(
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
EFI_STATUS
|
||||
DumpRawTrace(
|
||||
DumpRawTrace (
|
||||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
);
|
||||
@ -247,11 +248,10 @@ DumpRawTrace(
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessPhases(
|
||||
ProcessPhases (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Gather and print Handle data.
|
||||
|
||||
@ -262,11 +262,10 @@ ProcessPhases(
|
||||
@return Others from a call to gBS->LocateHandleBuffer().
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessHandles(
|
||||
ProcessHandles (
|
||||
IN BOOLEAN ExcludeFlag
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Gather and print PEIM data.
|
||||
|
||||
@ -276,7 +275,7 @@ ProcessHandles(
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessPeims(
|
||||
ProcessPeims (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -292,7 +291,7 @@ ProcessPeims(
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessGlobal(
|
||||
ProcessGlobal (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -308,7 +307,7 @@ ProcessGlobal(
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessCumulative(
|
||||
ProcessCumulative (
|
||||
IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
|
||||
);
|
||||
|
||||
|
@ -59,14 +59,14 @@ GetPerformanceMeasurementRecord (
|
||||
return 0;
|
||||
}
|
||||
|
||||
*Handle = (VOID *) (UINTN) mMeasurementList[LogEntryKey].Handle;
|
||||
*Handle = (VOID *)(UINTN)mMeasurementList[LogEntryKey].Handle;
|
||||
*Token = mMeasurementList[LogEntryKey].Token;
|
||||
*Module = mMeasurementList[LogEntryKey].Module;
|
||||
*StartTimeStamp = mMeasurementList[LogEntryKey].StartTimeStamp;
|
||||
*EndTimeStamp = mMeasurementList[LogEntryKey].EndTimeStamp;
|
||||
*Identifier = mMeasurementList[LogEntryKey].Identifier;
|
||||
|
||||
LogEntryKey ++;
|
||||
LogEntryKey++;
|
||||
|
||||
return LogEntryKey;
|
||||
}
|
||||
@ -89,7 +89,7 @@ GetPerformanceMeasurementRecord (
|
||||
|
||||
**/
|
||||
VOID
|
||||
GatherStatistics(
|
||||
GatherStatistics (
|
||||
IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
|
||||
)
|
||||
{
|
||||
@ -106,7 +106,8 @@ GatherStatistics(
|
||||
&Measurement.Module,
|
||||
&Measurement.StartTimeStamp,
|
||||
&Measurement.EndTimeStamp,
|
||||
&Measurement.Identifier)) != 0)
|
||||
&Measurement.Identifier
|
||||
)) != 0)
|
||||
{
|
||||
++SummaryData.NumTrace; // Count the number of TRACE Measurement records
|
||||
if (Measurement.EndTimeStamp == 0) {
|
||||
@ -118,11 +119,11 @@ GatherStatistics(
|
||||
++SummaryData.NumHandles; // Count the number of measurements with non-NULL handles
|
||||
}
|
||||
|
||||
if (IsPhase( &Measurement)) {
|
||||
if (IsPhase (&Measurement)) {
|
||||
++SummaryData.NumSummary; // Count the number of major phases
|
||||
}
|
||||
else { // !IsPhase
|
||||
if(Measurement.Handle == NULL) {
|
||||
} else {
|
||||
// !IsPhase
|
||||
if (Measurement.Handle == NULL) {
|
||||
++SummaryData.NumGlobal;
|
||||
}
|
||||
}
|
||||
@ -139,6 +140,7 @@ GatherStatistics(
|
||||
if ( Duration < CumData[TIndex].MinDur ) {
|
||||
CumData[TIndex].MinDur = Duration;
|
||||
}
|
||||
|
||||
if ( Duration > CumData[TIndex].MaxDur ) {
|
||||
CumData[TIndex].MaxDur = Duration;
|
||||
}
|
||||
@ -153,6 +155,7 @@ GatherStatistics(
|
||||
if (Duration < CustomCumulativeData->MinDur) {
|
||||
CustomCumulativeData->MinDur = Duration;
|
||||
}
|
||||
|
||||
if (Duration > CustomCumulativeData->MaxDur) {
|
||||
CustomCumulativeData->MaxDur = Duration;
|
||||
}
|
||||
@ -182,7 +185,7 @@ GatherStatistics(
|
||||
@return Others from a call to gBS->LocateHandleBuffer().
|
||||
**/
|
||||
EFI_STATUS
|
||||
DumpAllTrace(
|
||||
DumpAllTrace (
|
||||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
)
|
||||
@ -203,8 +206,14 @@ DumpAllTrace(
|
||||
|
||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
||||
(IncFlag == NULL) ? StringPtrUnknown : IncFlag);
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||
mDpHiiHandle,
|
||||
(IncFlag == NULL) ? StringPtrUnknown : IncFlag
|
||||
);
|
||||
FreePool (StringPtrUnknown);
|
||||
|
||||
// Get Handle information
|
||||
@ -212,8 +221,7 @@ DumpAllTrace(
|
||||
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// We have successfully populated the HandleBuffer
|
||||
// Display ALL Measurement Records
|
||||
// Up to Limit lines displayed
|
||||
@ -231,7 +239,7 @@ DumpAllTrace(
|
||||
LogEntryKey = 0;
|
||||
Count = 0;
|
||||
Index = 0;
|
||||
while ( WITHIN_LIMIT(Count, Limit) &&
|
||||
while ( WITHIN_LIMIT (Count, Limit) &&
|
||||
((LogEntryKey = GetPerformanceMeasurementRecord (
|
||||
LogEntryKey,
|
||||
&Measurement.Handle,
|
||||
@ -239,7 +247,8 @@ DumpAllTrace(
|
||||
&Measurement.Module,
|
||||
&Measurement.StartTimeStamp,
|
||||
&Measurement.EndTimeStamp,
|
||||
&Measurement.Identifier)) != 0)
|
||||
&Measurement.Identifier
|
||||
)) != 0)
|
||||
)
|
||||
{
|
||||
++Index; // Count every record. First record is 1.
|
||||
@ -247,17 +256,19 @@ DumpAllTrace(
|
||||
SHELL_FREE_NON_NULL (IncFlag);
|
||||
if (Measurement.EndTimeStamp != 0) {
|
||||
Duration = GetDuration (&Measurement);
|
||||
ElapsedTime = DurationInMicroSeconds ( Duration );
|
||||
ElapsedTime = DurationInMicroSeconds (Duration);
|
||||
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_INCOMPLETE), NULL); // Mark incomplete records
|
||||
}
|
||||
|
||||
if (((Measurement.EndTimeStamp != 0) && (ElapsedTime < mInterestThreshold)) ||
|
||||
((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))
|
||||
) { // Ignore "uninteresting" or excluded records
|
||||
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
||||
) // Ignore "uninteresting" or excluded records
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
++Count; // Count the number of records printed
|
||||
|
||||
// If Handle is non-zero, see if we can determine a name for the driver
|
||||
@ -282,7 +293,12 @@ DumpAllTrace(
|
||||
mUnicodeToken[13] = 0;
|
||||
|
||||
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
|
||||
IncFlag,
|
||||
Measurement.Handle,
|
||||
@ -292,7 +308,12 @@ DumpAllTrace(
|
||||
Measurement.Identifier
|
||||
);
|
||||
} 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
|
||||
IncFlag,
|
||||
Measurement.Handle,
|
||||
@ -301,15 +322,18 @@ DumpAllTrace(
|
||||
ElapsedTime
|
||||
);
|
||||
}
|
||||
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (IncFlag);
|
||||
|
||||
return Status;
|
||||
@ -336,7 +360,7 @@ DumpAllTrace(
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
EFI_STATUS
|
||||
DumpRawTrace(
|
||||
DumpRawTrace (
|
||||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
)
|
||||
@ -356,8 +380,14 @@ DumpRawTrace(
|
||||
|
||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||
mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||
);
|
||||
FreePool (StringPtr);
|
||||
FreePool (StringPtrUnknown);
|
||||
|
||||
@ -372,7 +402,7 @@ DumpRawTrace(
|
||||
LogEntryKey = 0;
|
||||
Count = 0;
|
||||
Index = 0;
|
||||
while ( WITHIN_LIMIT(Count, Limit) &&
|
||||
while ( WITHIN_LIMIT (Count, Limit) &&
|
||||
((LogEntryKey = GetPerformanceMeasurementRecord (
|
||||
LogEntryKey,
|
||||
&Measurement.Handle,
|
||||
@ -380,24 +410,33 @@ DumpRawTrace(
|
||||
&Measurement.Module,
|
||||
&Measurement.StartTimeStamp,
|
||||
&Measurement.EndTimeStamp,
|
||||
&Measurement.Identifier)) != 0)
|
||||
&Measurement.Identifier
|
||||
)) != 0)
|
||||
)
|
||||
{
|
||||
++Index; // Count every record. First record is 1.
|
||||
ElapsedTime = 0;
|
||||
if (Measurement.EndTimeStamp != 0) {
|
||||
Duration = GetDuration (&Measurement);
|
||||
ElapsedTime = DurationInMicroSeconds ( Duration );
|
||||
ElapsedTime = DurationInMicroSeconds (Duration);
|
||||
}
|
||||
|
||||
if ((ElapsedTime < mInterestThreshold) ||
|
||||
((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))
|
||||
) { // Ignore "uninteresting" or Excluded records
|
||||
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
||||
) // Ignore "uninteresting" or Excluded records
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
++Count; // Count the number of records printed
|
||||
|
||||
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
|
||||
Measurement.Handle,
|
||||
Measurement.StartTimeStamp,
|
||||
@ -407,7 +446,12 @@ DumpRawTrace(
|
||||
Measurement.Identifier
|
||||
);
|
||||
} 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
|
||||
Measurement.Handle,
|
||||
Measurement.StartTimeStamp,
|
||||
@ -416,11 +460,13 @@ DumpRawTrace(
|
||||
Measurement.Module
|
||||
);
|
||||
}
|
||||
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -429,7 +475,7 @@ DumpRawTrace(
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessPhases(
|
||||
ProcessPhases (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
@ -456,8 +502,14 @@ ProcessPhases(
|
||||
//
|
||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||
mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||
);
|
||||
FreePool (StringPtr);
|
||||
FreePool (StringPtrUnknown);
|
||||
|
||||
@ -469,13 +521,16 @@ ProcessPhases(
|
||||
&Measurement.Module,
|
||||
&Measurement.StartTimeStamp,
|
||||
&Measurement.EndTimeStamp,
|
||||
&Measurement.Identifier)) != 0)
|
||||
&Measurement.Identifier
|
||||
)) != 0)
|
||||
{
|
||||
if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
|
||||
if (Measurement.EndTimeStamp == 0) {
|
||||
// Skip "incomplete" records
|
||||
continue;
|
||||
}
|
||||
|
||||
Duration = GetDuration (&Measurement);
|
||||
if ( Measurement.Handle != NULL
|
||||
if ( (Measurement.Handle != NULL)
|
||||
&& (AsciiStrCmp (Measurement.Token, ALit_BdsTO) == 0)
|
||||
)
|
||||
{
|
||||
@ -496,7 +551,7 @@ ProcessPhases(
|
||||
// print SEC phase duration time
|
||||
//
|
||||
if (SecTime > 0) {
|
||||
ElapsedTime = DurationInMicroSeconds ( SecTime ); // Calculate elapsed time in microseconds
|
||||
ElapsedTime = DurationInMicroSeconds (SecTime); // Calculate elapsed time in microseconds
|
||||
Total += DivU64x32 (ElapsedTime, 1000); // Accumulate time in milliseconds
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SEC_PHASE), mDpHiiHandle, ElapsedTime);
|
||||
}
|
||||
@ -543,7 +598,7 @@ ProcessPhases(
|
||||
@return Others from a call to gBS->LocateHandleBuffer().
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessHandles(
|
||||
ProcessHandles (
|
||||
IN BOOLEAN ExcludeFlag
|
||||
)
|
||||
{
|
||||
@ -561,25 +616,31 @@ ProcessHandles(
|
||||
|
||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||
mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||
);
|
||||
FreePool (StringPtr);
|
||||
FreePool (StringPtrUnknown);
|
||||
|
||||
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status);
|
||||
}
|
||||
else {
|
||||
#if DP_DEBUG == 2
|
||||
Print (L"There are %,d Handles defined.\n", (Size / sizeof(HandleBuffer[0])));
|
||||
#endif
|
||||
} else {
|
||||
#if DP_DEBUG == 2
|
||||
Print (L"There are %,d Handles defined.\n", (Size / sizeof (HandleBuffer[0])));
|
||||
#endif
|
||||
|
||||
if (mShowId) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION2), mDpHiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION), mDpHiiHandle);
|
||||
}
|
||||
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
||||
|
||||
LogEntryKey = 0;
|
||||
@ -591,18 +652,21 @@ ProcessHandles(
|
||||
&Measurement.Module,
|
||||
&Measurement.StartTimeStamp,
|
||||
&Measurement.EndTimeStamp,
|
||||
&Measurement.Identifier)) != 0)
|
||||
&Measurement.Identifier
|
||||
)) != 0)
|
||||
{
|
||||
Count++;
|
||||
Duration = GetDuration (&Measurement);
|
||||
ElapsedTime = DurationInMicroSeconds ( Duration );
|
||||
ElapsedTime = DurationInMicroSeconds (Duration);
|
||||
if ((ElapsedTime < mInterestThreshold) ||
|
||||
(Measurement.EndTimeStamp == 0) ||
|
||||
(!IsCorePerf (&Measurement)) ||
|
||||
((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))
|
||||
) { // Ignore "uninteresting" or excluded records
|
||||
((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))
|
||||
) // Ignore "uninteresting" or excluded records
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mGaugeString[0] = 0; // Empty driver name by default
|
||||
AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));
|
||||
// See if the Handle is in the HandleBuffer
|
||||
@ -612,13 +676,19 @@ ProcessHandles(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that the argument strings are not too long.
|
||||
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
|
||||
mUnicodeToken[11] = 0;
|
||||
if (mGaugeString[0] != 0) {
|
||||
// Display the record if it has a valid handle.
|
||||
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
|
||||
Index + 1, // 1 based, Which handle is being printed
|
||||
mGaugeString,
|
||||
@ -627,7 +697,12 @@ ProcessHandles(
|
||||
Measurement.Identifier
|
||||
);
|
||||
} 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
|
||||
Index + 1, // 1 based, Which handle is being printed
|
||||
mGaugeString,
|
||||
@ -636,15 +711,18 @@ ProcessHandles(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -657,9 +735,9 @@ ProcessHandles(
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessPeims(
|
||||
ProcessPeims (
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
MEASUREMENT_RECORD Measurement;
|
||||
UINT64 Duration;
|
||||
@ -674,8 +752,14 @@ ProcessPeims(
|
||||
|
||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr);
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||
mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||
);
|
||||
FreePool (StringPtr);
|
||||
FreePool (StringPtrUnknown);
|
||||
|
||||
@ -684,6 +768,7 @@ ProcessPeims(
|
||||
} else {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), mDpHiiHandle);
|
||||
}
|
||||
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
||||
TIndex = 0;
|
||||
LogEntryKey = 0;
|
||||
@ -694,39 +779,53 @@ ProcessPeims(
|
||||
&Measurement.Module,
|
||||
&Measurement.StartTimeStamp,
|
||||
&Measurement.EndTimeStamp,
|
||||
&Measurement.Identifier)) != 0)
|
||||
&Measurement.Identifier
|
||||
)) != 0)
|
||||
{
|
||||
TIndex++;
|
||||
if ((Measurement.EndTimeStamp == 0) ||
|
||||
(AsciiStrCmp (Measurement.Token, ALit_PEIM) != 0)
|
||||
) {
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Duration = GetDuration (&Measurement);
|
||||
ElapsedTime = DurationInMicroSeconds ( Duration ); // Calculate elapsed time in microseconds
|
||||
ElapsedTime = DurationInMicroSeconds (Duration); // Calculate elapsed time in microseconds
|
||||
if (ElapsedTime >= mInterestThreshold) {
|
||||
// PEIM FILE Handle is the start address of its FFS file that contains its file guid.
|
||||
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
|
||||
Measurement.Handle, // file guid
|
||||
ElapsedTime,
|
||||
Measurement.Identifier
|
||||
);
|
||||
} 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
|
||||
Measurement.Handle, // file guid
|
||||
ElapsedTime
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -742,9 +841,9 @@ ProcessPeims(
|
||||
@retval EFI_ABORTED The user aborts the operation.
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessGlobal(
|
||||
ProcessGlobal (
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
MEASUREMENT_RECORD Measurement;
|
||||
UINT64 Duration;
|
||||
@ -759,8 +858,14 @@ ProcessGlobal(
|
||||
|
||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown: StringPtr);
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||
mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||
);
|
||||
FreePool (StringPtr);
|
||||
FreePool (StringPtrUnknown);
|
||||
|
||||
@ -769,6 +874,7 @@ ProcessGlobal(
|
||||
} else {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), mDpHiiHandle);
|
||||
}
|
||||
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);
|
||||
|
||||
Index = 1;
|
||||
@ -781,22 +887,28 @@ ProcessGlobal(
|
||||
&Measurement.Module,
|
||||
&Measurement.StartTimeStamp,
|
||||
&Measurement.EndTimeStamp,
|
||||
&Measurement.Identifier)) != 0)
|
||||
&Measurement.Identifier
|
||||
)) != 0)
|
||||
{
|
||||
AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE (mGaugeString));
|
||||
AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));
|
||||
mGaugeString[25] = 0;
|
||||
mUnicodeToken[31] = 0;
|
||||
if ( ! ( IsPhase( &Measurement) ||
|
||||
if ( !(IsPhase (&Measurement) ||
|
||||
IsCorePerf (&Measurement) ||
|
||||
(Measurement.EndTimeStamp == 0)
|
||||
))
|
||||
{
|
||||
Duration = GetDuration (&Measurement);
|
||||
ElapsedTime = DurationInMicroSeconds ( Duration );
|
||||
ElapsedTime = DurationInMicroSeconds (Duration);
|
||||
if (ElapsedTime >= mInterestThreshold) {
|
||||
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,
|
||||
mGaugeString,
|
||||
mUnicodeToken,
|
||||
@ -804,7 +916,12 @@ ProcessGlobal(
|
||||
Measurement.Identifier
|
||||
);
|
||||
} else {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS), mDpHiiHandle,
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DP_GLOBAL_VARS),
|
||||
mDpHiiHandle,
|
||||
Index,
|
||||
mGaugeString,
|
||||
mUnicodeToken,
|
||||
@ -813,12 +930,15 @@ ProcessGlobal(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
Status = EFI_ABORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
Index++;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -834,7 +954,7 @@ ProcessGlobal(
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessCumulative(
|
||||
ProcessCumulative (
|
||||
IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
|
||||
)
|
||||
{
|
||||
@ -848,8 +968,14 @@ ProcessCumulative(
|
||||
|
||||
StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
||||
StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown: StringPtr);
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DP_SECTION_HEADER),
|
||||
mDpHiiHandle,
|
||||
(StringPtr == NULL) ? StringPtrUnknown : StringPtr
|
||||
);
|
||||
FreePool (StringPtr);
|
||||
FreePool (StringPtrUnknown);
|
||||
|
||||
@ -860,12 +986,17 @@ ProcessCumulative(
|
||||
for ( TIndex = 0; TIndex < NumCum; ++TIndex) {
|
||||
if (CumData[TIndex].Count != 0) {
|
||||
AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count);
|
||||
AvgDur = DurationInMicroSeconds(AvgDur);
|
||||
Dur = DurationInMicroSeconds(CumData[TIndex].Duration);
|
||||
MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur);
|
||||
MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur);
|
||||
AvgDur = DurationInMicroSeconds (AvgDur);
|
||||
Dur = DurationInMicroSeconds (CumData[TIndex].Duration);
|
||||
MaxDur = DurationInMicroSeconds (CumData[TIndex].MaxDur);
|
||||
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].Count,
|
||||
Dur,
|
||||
@ -892,7 +1023,13 @@ ProcessCumulative(
|
||||
MaxDur = 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->Count,
|
||||
Dur,
|
||||
|
@ -72,6 +72,7 @@ GetDuration (
|
||||
DEBUG ((DEBUG_ERROR, ALit_TimerLibError));
|
||||
Duration = 0;
|
||||
}
|
||||
|
||||
return Duration;
|
||||
}
|
||||
|
||||
@ -87,7 +88,7 @@ GetDuration (
|
||||
@retval FALSE The measurement record is NOT for an EFI Phase.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsPhase(
|
||||
IsPhase (
|
||||
IN MEASUREMENT_RECORD *Measurement
|
||||
)
|
||||
{
|
||||
@ -112,7 +113,7 @@ IsPhase(
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
IsCorePerf(
|
||||
IsCorePerf (
|
||||
IN MEASUREMENT_RECORD *Measurement
|
||||
)
|
||||
{
|
||||
@ -162,8 +163,9 @@ DpGetShortPdbFileName (
|
||||
StrnCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ", 1);
|
||||
} else {
|
||||
StartIndex = 0;
|
||||
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
|
||||
;
|
||||
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++) {
|
||||
}
|
||||
|
||||
for (IndexA = 0; PdbFileName[IndexA] != 0; IndexA++) {
|
||||
if ((PdbFileName[IndexA] == '\\') || (PdbFileName[IndexA] == '/')) {
|
||||
StartIndex = IndexA + 1;
|
||||
@ -176,7 +178,7 @@ DpGetShortPdbFileName (
|
||||
|
||||
IndexU = 0;
|
||||
for (IndexA = StartIndex; IndexA < EndIndex; IndexA++) {
|
||||
UnicodeBuffer[IndexU] = (CHAR16) PdbFileName[IndexA];
|
||||
UnicodeBuffer[IndexU] = (CHAR16)PdbFileName[IndexA];
|
||||
IndexU++;
|
||||
if (IndexU >= DP_GAUGE_STRING_LENGTH) {
|
||||
UnicodeBuffer[DP_GAUGE_STRING_LENGTH] = 0;
|
||||
@ -231,14 +233,14 @@ DpGetNameFromHandle (
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **) &Image
|
||||
(VOID **)&Image
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
&gEfiDriverBindingProtocolGuid,
|
||||
(VOID **) &DriverBinding,
|
||||
(VOID **)&DriverBinding,
|
||||
NULL,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@ -247,7 +249,7 @@ DpGetNameFromHandle (
|
||||
Status = gBS->HandleProtocol (
|
||||
DriverBinding->ImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **) &Image
|
||||
(VOID **)&Image
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -267,14 +269,14 @@ DpGetNameFromHandle (
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiComponentName2ProtocolGuid,
|
||||
(VOID **) &ComponentName2
|
||||
(VOID **)&ComponentName2
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Firstly use platform language setting, secondly use driver's first supported language.
|
||||
//
|
||||
GetVariable2 (L"PlatformLang", &gEfiGlobalVariableGuid, (VOID**)&PlatformLanguage, NULL);
|
||||
BestLanguage = GetBestLanguage(
|
||||
GetVariable2 (L"PlatformLang", &gEfiGlobalVariableGuid, (VOID **)&PlatformLanguage, NULL);
|
||||
BestLanguage = GetBestLanguage (
|
||||
ComponentName2->SupportedLanguages,
|
||||
FALSE,
|
||||
(PlatformLanguage != NULL) ? PlatformLanguage : "",
|
||||
@ -299,7 +301,7 @@ DpGetNameFromHandle (
|
||||
Status = gBS->HandleProtocol (
|
||||
Handle,
|
||||
&gEfiLoadedImageDevicePathProtocolGuid,
|
||||
(VOID **) &LoadedImageDevicePath
|
||||
(VOID **)&LoadedImageDevicePath
|
||||
);
|
||||
if (!EFI_ERROR (Status) && (LoadedImageDevicePath != NULL)) {
|
||||
DevicePath = LoadedImageDevicePath;
|
||||
@ -313,10 +315,11 @@ DpGetNameFromHandle (
|
||||
//
|
||||
NameGuid = NULL;
|
||||
while (!IsDevicePathEndType (DevicePath)) {
|
||||
NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);
|
||||
NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevicePath);
|
||||
if (NameGuid != NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
DevicePath = NextDevicePathNode (DevicePath);
|
||||
}
|
||||
|
||||
@ -330,7 +333,7 @@ DpGetNameFromHandle (
|
||||
NameGuid,
|
||||
EFI_SECTION_USER_INTERFACE,
|
||||
0,
|
||||
(VOID **) &NameString,
|
||||
(VOID **)&NameString,
|
||||
&StringSize
|
||||
);
|
||||
|
||||
@ -347,6 +350,7 @@ DpGetNameFromHandle (
|
||||
//
|
||||
UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
//
|
||||
@ -406,17 +410,18 @@ DurationInMicroSeconds (
|
||||
@retval >=0 Return value is the index into CumData where Token is found.
|
||||
**/
|
||||
INTN
|
||||
GetCumulativeItem(
|
||||
GetCumulativeItem (
|
||||
IN MEASUREMENT_RECORD *Measurement
|
||||
)
|
||||
{
|
||||
INTN Index;
|
||||
|
||||
for( Index = 0; Index < (INTN)NumCum; ++Index) {
|
||||
for ( Index = 0; Index < (INTN)NumCum; ++Index) {
|
||||
if (AsciiStrCmp (Measurement->Token, CumData[Index].Name) == 0) {
|
||||
return Index; // Exit, we found a match
|
||||
}
|
||||
}
|
||||
|
||||
// If the for loop exits, Token was not found.
|
||||
return -1; // Indicate failure
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef _LITERALS_H_
|
||||
#define _LITERALS_H_
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
&& (Code <= HTTP_STATUS_307_TEMPORARY_REDIRECT)) \
|
||||
|| (Code == HTTP_STATUS_308_PERMANENT_REDIRECT))
|
||||
|
||||
#define CLOSE_HTTP_HANDLE(ControllerHandle,HttpChildHandle) \
|
||||
#define CLOSE_HTTP_HANDLE(ControllerHandle, HttpChildHandle) \
|
||||
do { \
|
||||
if (HttpChildHandle) { \
|
||||
CloseProtocolAndDestroyServiceChild ( \
|
||||
@ -94,11 +94,11 @@ typedef enum {
|
||||
//
|
||||
// Improve readability by using these macros.
|
||||
//
|
||||
#define PRINT_HII(token,...) \
|
||||
#define PRINT_HII(token, ...) \
|
||||
ShellPrintHiiEx (\
|
||||
-1, -1, NULL, token, mHttpHiiHandle, __VA_ARGS__)
|
||||
|
||||
#define PRINT_HII_APP(token,value) \
|
||||
#define PRINT_HII_APP(token, value) \
|
||||
PRINT_HII (token, HTTP_APP_NAME, value)
|
||||
|
||||
//
|
||||
@ -150,13 +150,13 @@ STATIC CONST CHAR16 *ErrStatusDesc[] =
|
||||
};
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-i", TypeValue},
|
||||
{L"-k", TypeFlag},
|
||||
{L"-l", TypeValue},
|
||||
{L"-m", TypeFlag},
|
||||
{L"-s", TypeValue},
|
||||
{L"-t", TypeValue},
|
||||
{NULL , TypeMax}
|
||||
{ L"-i", TypeValue },
|
||||
{ L"-k", TypeFlag },
|
||||
{ L"-l", TypeValue },
|
||||
{ L"-m", TypeFlag },
|
||||
{ L"-s", TypeValue },
|
||||
{ L"-t", TypeValue },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
//
|
||||
@ -328,7 +328,7 @@ TrimSpaces (
|
||||
//
|
||||
do {
|
||||
Len = StrLen (Str);
|
||||
if (!Len || (Str[Len - 1] != L' ' && Str[Len - 1] != '\t')) {
|
||||
if (!Len || ((Str[Len - 1] != L' ') && (Str[Len - 1] != '\t'))) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -408,7 +408,7 @@ EfiGetEpochDays (
|
||||
//
|
||||
UINTN EpochDays;
|
||||
|
||||
a = (14 - Time->Month) / 12 ;
|
||||
a = (14 - Time->Month) / 12;
|
||||
y = Time->Year + 4800 - a;
|
||||
m = Time->Month + (12 * a) - 3;
|
||||
|
||||
@ -522,7 +522,7 @@ RunHttp (
|
||||
TRUE
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED)
|
||||
if ( (Status == EFI_VOLUME_CORRUPTED)
|
||||
&& (ProblemParam != NULL))
|
||||
{
|
||||
PRINT_HII_APP (STRING_TOKEN (STR_GEN_PROBLEM), ProblemParam);
|
||||
@ -629,7 +629,8 @@ RunHttp (
|
||||
Walker = RemoteFilePath + StrLen (RemoteFilePath);
|
||||
while ((--Walker) >= RemoteFilePath) {
|
||||
if ((*Walker == L'\\') ||
|
||||
(*Walker == L'/' ) ) {
|
||||
(*Walker == L'/'))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -659,7 +660,7 @@ RunHttp (
|
||||
UserNicName = ShellCommandLineGetValue (CheckPackage, L"-i");
|
||||
|
||||
ValueStr = ShellCommandLineGetValue (CheckPackage, L"-l");
|
||||
if ((ValueStr != NULL)
|
||||
if ( (ValueStr != NULL)
|
||||
&& (!StringToUint16 (
|
||||
ValueStr,
|
||||
&Context.HttpConfigData.AccessPoint.IPv4Node->LocalPort
|
||||
@ -674,7 +675,7 @@ RunHttp (
|
||||
ValueStr = ShellCommandLineGetValue (CheckPackage, L"-s");
|
||||
if (ValueStr != NULL) {
|
||||
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);
|
||||
goto Error;
|
||||
}
|
||||
@ -841,7 +842,7 @@ GetNicName (
|
||||
&gEfiManagedNetworkServiceBindingProtocolGuid,
|
||||
&gEfiManagedNetworkProtocolGuid,
|
||||
&MnpHandle,
|
||||
(VOID**)&Mnp
|
||||
(VOID **)&Mnp
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
@ -1017,13 +1018,13 @@ WaitForCompletion (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
while (! *CallBackComplete
|
||||
while ( !*CallBackComplete
|
||||
&& (!EFI_ERROR (Status))
|
||||
&& EFI_ERROR (gBS->CheckEvent (WaitEvt)))
|
||||
{
|
||||
Status = Context->Http->Poll (Context->Http);
|
||||
if (!Context->ContentDownloaded
|
||||
&& CallBackComplete == &gResponseCallbackComplete)
|
||||
if ( !Context->ContentDownloaded
|
||||
&& (CallBackComplete == &gResponseCallbackComplete))
|
||||
{
|
||||
//
|
||||
// An HTTP server may just send a response redirection header.
|
||||
@ -1032,7 +1033,7 @@ WaitForCompletion (
|
||||
// Note that at this point Response may not has been populated,
|
||||
// so it needs to be checked first.
|
||||
//
|
||||
if (Context->ResponseToken.Message
|
||||
if ( Context->ResponseToken.Message
|
||||
&& Context->ResponseToken.Message->Data.Response
|
||||
&& (NEED_REDIRECTION (
|
||||
Context->ResponseToken.Message->Data.Response->StatusCode
|
||||
@ -1265,7 +1266,6 @@ SavePortion (
|
||||
NbOfKb
|
||||
);
|
||||
|
||||
|
||||
ShellPrintEx (-1, -1, L"%s", Progress);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -1351,7 +1351,7 @@ SetHostURI (
|
||||
Walker = Location;
|
||||
|
||||
for (Step = FirstStep; Step < 2; Step++) {
|
||||
for (; *Walker != '/' && *Walker != '\0'; Walker++) {
|
||||
for ( ; *Walker != '/' && *Walker != '\0'; Walker++) {
|
||||
Idx++;
|
||||
}
|
||||
|
||||
@ -1466,7 +1466,7 @@ ParseMsg (
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if ((Data == NULL)
|
||||
if ( (Data == NULL)
|
||||
|| (EventType == BodyParseEventOnComplete)
|
||||
|| (Context == NULL))
|
||||
{
|
||||
@ -1476,7 +1476,6 @@ ParseMsg (
|
||||
return SavePortion (Context, Length, Data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get HTTP server response and collect the whole body as a file.
|
||||
Set appropriate status in Context (REQ_OK, REQ_REPEAT, REQ_ERROR).
|
||||
@ -1642,7 +1641,7 @@ GetResponse (
|
||||
|
||||
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))
|
||||
{
|
||||
//
|
||||
@ -1680,12 +1679,12 @@ GetResponse (
|
||||
ResponseMessage.Body
|
||||
);
|
||||
}
|
||||
} while (!HttpIsMessageComplete (MsgParser)
|
||||
} while ( !HttpIsMessageComplete (MsgParser)
|
||||
&& !EFI_ERROR (Status)
|
||||
&& ResponseMessage.BodyLength);
|
||||
|
||||
if (Context->Status != REQ_NEED_REPEAT
|
||||
&& Status == EFI_SUCCESS
|
||||
if ( (Context->Status != REQ_NEED_REPEAT)
|
||||
&& (Status == EFI_SUCCESS)
|
||||
&& CanMeasureTime)
|
||||
{
|
||||
if (!EFI_ERROR (gRT->GetTime (&EndTime, NULL))) {
|
||||
@ -1780,7 +1779,7 @@ DownloadFile (
|
||||
&gEfiHttpServiceBindingProtocolGuid,
|
||||
&gEfiHttpProtocolGuid,
|
||||
&HttpChildHandle,
|
||||
(VOID**)&Context->Http
|
||||
(VOID **)&Context->Http
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -1814,7 +1813,8 @@ DownloadFile (
|
||||
&DownloadUrl,
|
||||
&UrlSize,
|
||||
Context->Uri,
|
||||
StrLen (Context->Uri));
|
||||
StrLen (Context->Uri)
|
||||
);
|
||||
|
||||
PRINT_HII (STRING_TOKEN (STR_HTTP_DOWNLOADING), DownloadUrl);
|
||||
|
||||
@ -1828,7 +1828,6 @@ DownloadFile (
|
||||
if (Status) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
} while (Context->Status == REQ_NEED_REPEAT);
|
||||
|
||||
if (Context->Status) {
|
||||
|
@ -89,4 +89,5 @@ EFI_HII_HANDLE
|
||||
InitializeHiiPackage (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
#endif // _HTTP_H_
|
||||
|
@ -118,7 +118,7 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
HttpUnload (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
@ -208,26 +208,34 @@ CheckPacket (
|
||||
|
||||
EFI_MTFTP4_CONFIG_DATA DefaultMtftp4ConfigData = {
|
||||
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, 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
|
||||
6, // TryCount - The number of times to transmit request packets and wait for a response.
|
||||
4 // TimeoutValue - Retransmission timeout in seconds.
|
||||
};
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-i", TypeValue},
|
||||
{L"-l", TypeValue},
|
||||
{L"-r", TypeValue},
|
||||
{L"-c", TypeValue},
|
||||
{L"-t", TypeValue},
|
||||
{L"-s", TypeValue},
|
||||
{L"-w", TypeValue},
|
||||
{NULL , TypeMax}
|
||||
};
|
||||
{ L"-i", TypeValue },
|
||||
{ L"-l", TypeValue },
|
||||
{ L"-r", TypeValue },
|
||||
{ L"-c", TypeValue },
|
||||
{ L"-t", TypeValue },
|
||||
{ L"-s", TypeValue },
|
||||
{ L"-w", TypeValue },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
///
|
||||
/// The default block size (512) of tftp is defined in the RFC1350.
|
||||
@ -319,15 +327,22 @@ RunTftp (
|
||||
Status = ShellCommandLineParse (ParamList, &CheckPackage, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) &&
|
||||
(ProblemParam != NULL) ) {
|
||||
(ProblemParam != NULL))
|
||||
{
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), mTftpHiiHandle,
|
||||
L"tftp", ProblemParam
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PROBLEM),
|
||||
mTftpHiiHandle,
|
||||
L"tftp",
|
||||
ProblemParam
|
||||
);
|
||||
FreePool (ProblemParam);
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
goto Error;
|
||||
}
|
||||
|
||||
@ -337,15 +352,24 @@ RunTftp (
|
||||
ParamCount = ShellCommandLineGetCount (CheckPackage);
|
||||
if (ParamCount > 4) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY),
|
||||
mTftpHiiHandle, L"tftp"
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_TOO_MANY),
|
||||
mTftpHiiHandle,
|
||||
L"tftp"
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
|
||||
if (ParamCount < 3) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW),
|
||||
mTftpHiiHandle, L"tftp"
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_TOO_FEW),
|
||||
mTftpHiiHandle,
|
||||
L"tftp"
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
@ -359,20 +383,26 @@ RunTftp (
|
||||
Status = NetLibStrToIp4 (ValueStr, &Mtftp4ConfigData.ServerIp);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle, L"tftp", ValueStr
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle,
|
||||
L"tftp",
|
||||
ValueStr
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
|
||||
RemoteFilePath = ShellCommandLineGetRawValue (CheckPackage, 2);
|
||||
ASSERT(RemoteFilePath != NULL);
|
||||
ASSERT (RemoteFilePath != NULL);
|
||||
FilePathSize = StrLen (RemoteFilePath) + 1;
|
||||
AsciiRemoteFilePath = AllocatePool (FilePathSize);
|
||||
if (AsciiRemoteFilePath == NULL) {
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
UnicodeStrToAsciiStrS (RemoteFilePath, AsciiRemoteFilePath, FilePathSize);
|
||||
|
||||
if (ParamCount == 4) {
|
||||
@ -381,10 +411,12 @@ RunTftp (
|
||||
Walker = RemoteFilePath + StrLen (RemoteFilePath);
|
||||
while ((--Walker) >= RemoteFilePath) {
|
||||
if ((*Walker == L'\\') ||
|
||||
(*Walker == L'/' ) ) {
|
||||
(*Walker == L'/'))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mLocalFilePath = Walker + 1;
|
||||
}
|
||||
|
||||
@ -423,10 +455,16 @@ RunTftp (
|
||||
if (!StringToUint16 (ValueStr, &Mtftp4ConfigData.TimeoutValue)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
if (Mtftp4ConfigData.TimeoutValue == 0) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle, L"tftp", ValueStr
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle,
|
||||
L"tftp",
|
||||
ValueStr
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
@ -437,10 +475,16 @@ RunTftp (
|
||||
if (!StringToUint16 (ValueStr, &BlockSize)) {
|
||||
goto Error;
|
||||
}
|
||||
if (BlockSize < MTFTP_MIN_BLKSIZE || BlockSize > MTFTP_MAX_BLKSIZE) {
|
||||
|
||||
if ((BlockSize < MTFTP_MIN_BLKSIZE) || (BlockSize > MTFTP_MAX_BLKSIZE)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle, L"tftp", ValueStr
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle,
|
||||
L"tftp",
|
||||
ValueStr
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
@ -451,10 +495,16 @@ RunTftp (
|
||||
if (!StringToUint16 (ValueStr, &WindowSize)) {
|
||||
goto Error;
|
||||
}
|
||||
if (WindowSize < MTFTP_MIN_WINDOWSIZE || WindowSize > MTFTP_MAX_WINDOWSIZE) {
|
||||
|
||||
if ((WindowSize < MTFTP_MIN_WINDOWSIZE) || (WindowSize > MTFTP_MAX_WINDOWSIZE)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle, L"tftp", ValueStr
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle,
|
||||
L"tftp",
|
||||
ValueStr
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
@ -473,7 +523,10 @@ RunTftp (
|
||||
);
|
||||
if (EFI_ERROR (Status) || (HandleCount == 0)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NO_NIC),
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_ERR_NO_NIC),
|
||||
mTftpHiiHandle
|
||||
);
|
||||
goto Error;
|
||||
@ -481,14 +534,20 @@ RunTftp (
|
||||
|
||||
for (NicNumber = 0;
|
||||
(NicNumber < HandleCount) && (ShellStatus != SHELL_SUCCESS);
|
||||
NicNumber++) {
|
||||
NicNumber++)
|
||||
{
|
||||
ControllerHandle = Handles[NicNumber];
|
||||
|
||||
Status = GetNicName (ControllerHandle, NicNumber, NicName);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NAME),
|
||||
mTftpHiiHandle, NicNumber, Status
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_ERR_NIC_NAME),
|
||||
mTftpHiiHandle,
|
||||
NicNumber,
|
||||
Status
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@ -497,6 +556,7 @@ RunTftp (
|
||||
if (StrCmp (NicName, UserNicName) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NicFound = TRUE;
|
||||
}
|
||||
|
||||
@ -505,12 +565,17 @@ RunTftp (
|
||||
&gEfiMtftp4ServiceBindingProtocolGuid,
|
||||
&gEfiMtftp4ProtocolGuid,
|
||||
&Mtftp4ChildHandle,
|
||||
(VOID**)&Mtftp4
|
||||
(VOID **)&Mtftp4
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_OPEN_PROTOCOL),
|
||||
mTftpHiiHandle, NicName, Status
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_ERR_OPEN_PROTOCOL),
|
||||
mTftpHiiHandle,
|
||||
NicName,
|
||||
Status
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@ -518,8 +583,13 @@ RunTftp (
|
||||
Status = Mtftp4->Configure (Mtftp4, &Mtftp4ConfigData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_CONFIGURE),
|
||||
mTftpHiiHandle, NicName, Status
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_ERR_CONFIGURE),
|
||||
mTftpHiiHandle,
|
||||
NicName,
|
||||
Status
|
||||
);
|
||||
goto NextHandle;
|
||||
}
|
||||
@ -527,8 +597,14 @@ RunTftp (
|
||||
Status = GetFileSize (Mtftp4, AsciiRemoteFilePath, &FileSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_FILE_SIZE),
|
||||
mTftpHiiHandle, RemoteFilePath, NicName, Status
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_ERR_FILE_SIZE),
|
||||
mTftpHiiHandle,
|
||||
RemoteFilePath,
|
||||
NicName,
|
||||
Status
|
||||
);
|
||||
goto NextHandle;
|
||||
}
|
||||
@ -536,15 +612,21 @@ RunTftp (
|
||||
Status = DownloadFile (Mtftp4, RemoteFilePath, AsciiRemoteFilePath, FileSize, BlockSize, WindowSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD),
|
||||
mTftpHiiHandle, RemoteFilePath, NicName, Status
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD),
|
||||
mTftpHiiHandle,
|
||||
RemoteFilePath,
|
||||
NicName,
|
||||
Status
|
||||
);
|
||||
goto NextHandle;
|
||||
}
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
NextHandle:
|
||||
NextHandle:
|
||||
|
||||
CloseProtocolAndDestroyServiceChild (
|
||||
ControllerHandle,
|
||||
@ -556,22 +638,27 @@ RunTftp (
|
||||
|
||||
if ((UserNicName != NULL) && (!NicFound)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND),
|
||||
mTftpHiiHandle, UserNicName
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND),
|
||||
mTftpHiiHandle,
|
||||
UserNicName
|
||||
);
|
||||
}
|
||||
|
||||
Error:
|
||||
Error:
|
||||
|
||||
ShellCommandLineFreeVarList (CheckPackage);
|
||||
if (AsciiRemoteFilePath != NULL) {
|
||||
FreePool (AsciiRemoteFilePath);
|
||||
}
|
||||
|
||||
if (Handles != NULL) {
|
||||
FreePool (Handles);
|
||||
}
|
||||
|
||||
if ((ShellStatus != SHELL_SUCCESS) && (EFI_ERROR(Status))) {
|
||||
if ((ShellStatus != SHELL_SUCCESS) && (EFI_ERROR (Status))) {
|
||||
ShellStatus = Status & ~MAX_BIT;
|
||||
}
|
||||
|
||||
@ -599,8 +686,13 @@ StringToUint16 (
|
||||
Val = ShellStrToUintn (ValueStr);
|
||||
if (Val > MAX_UINT16) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle, L"tftp", ValueStr
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_PARAM_INV),
|
||||
mTftpHiiHandle,
|
||||
L"tftp",
|
||||
ValueStr
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
@ -645,7 +737,7 @@ GetNicName (
|
||||
&gEfiManagedNetworkServiceBindingProtocolGuid,
|
||||
&gEfiManagedNetworkProtocolGuid,
|
||||
&MnpHandle,
|
||||
(VOID**)&Mnp
|
||||
(VOID **)&Mnp
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
@ -661,7 +753,7 @@ GetNicName (
|
||||
IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH,
|
||||
SnpMode.IfType == NET_IFTYPE_ETHERNET ?
|
||||
L"eth%d" :
|
||||
L"unk%d" ,
|
||||
L"unk%d",
|
||||
NicNumber
|
||||
);
|
||||
|
||||
@ -810,7 +902,7 @@ GetFileSize (
|
||||
UINT32 OptCnt;
|
||||
UINT8 OptBuf[128];
|
||||
|
||||
ReqOpt[0].OptionStr = (UINT8*)"tsize";
|
||||
ReqOpt[0].OptionStr = (UINT8 *)"tsize";
|
||||
OptBuf[0] = '0';
|
||||
OptBuf[1] = 0;
|
||||
ReqOpt[0].ValueStr = OptBuf;
|
||||
@ -818,7 +910,7 @@ GetFileSize (
|
||||
Status = Mtftp4->GetInfo (
|
||||
Mtftp4,
|
||||
NULL,
|
||||
(UINT8*)FilePath,
|
||||
(UINT8 *)FilePath,
|
||||
NULL,
|
||||
1,
|
||||
ReqOpt,
|
||||
@ -834,7 +926,7 @@ GetFileSize (
|
||||
Mtftp4,
|
||||
PktLen,
|
||||
Packet,
|
||||
(UINT32 *) &OptCnt,
|
||||
(UINT32 *)&OptCnt,
|
||||
&TableOfOptions
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -847,16 +939,18 @@ GetFileSize (
|
||||
*FileSize = AsciiStrDecimalToUintn ((CHAR8 *)Option->ValueStr);
|
||||
break;
|
||||
}
|
||||
|
||||
OptCnt--;
|
||||
Option++;
|
||||
}
|
||||
|
||||
FreePool (TableOfOptions);
|
||||
|
||||
if (OptCnt == 0) {
|
||||
Status = EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Error :
|
||||
Error:
|
||||
|
||||
return Status;
|
||||
}
|
||||
@ -902,13 +996,14 @@ DownloadFile (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
TftpContext->FileSize = FileSize;
|
||||
TftpContext->DownloadedNbOfBytes = 0;
|
||||
TftpContext->LastReportedNbOfBytes = 0;
|
||||
|
||||
Mtftp4Token.Filename = (UINT8*)AsciiFilePath;
|
||||
Mtftp4Token.Filename = (UINT8 *)AsciiFilePath;
|
||||
Mtftp4Token.CheckPacket = CheckPacket;
|
||||
Mtftp4Token.Context = (VOID*)TftpContext;
|
||||
Mtftp4Token.Context = (VOID *)TftpContext;
|
||||
Mtftp4Token.OptionCount = 0;
|
||||
Mtftp4Token.OptionList = AllocatePool (sizeof (EFI_MTFTP4_OPTION) * 2);
|
||||
if (Mtftp4Token.OptionList == NULL) {
|
||||
@ -917,22 +1012,26 @@ DownloadFile (
|
||||
}
|
||||
|
||||
if (BlockSize != MTFTP_DEFAULT_BLKSIZE) {
|
||||
Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *) "blksize";
|
||||
AsciiSPrint ((CHAR8 *) BlksizeBuf, sizeof (BlksizeBuf), "%d", BlockSize);
|
||||
Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *)"blksize";
|
||||
AsciiSPrint ((CHAR8 *)BlksizeBuf, sizeof (BlksizeBuf), "%d", BlockSize);
|
||||
Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr = BlksizeBuf;
|
||||
Mtftp4Token.OptionCount ++;
|
||||
Mtftp4Token.OptionCount++;
|
||||
}
|
||||
|
||||
if (WindowSize != MTFTP_DEFAULT_WINDOWSIZE) {
|
||||
Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *) "windowsize";
|
||||
AsciiSPrint ((CHAR8 *) WindowsizeBuf, sizeof (WindowsizeBuf), "%d", WindowSize);
|
||||
Mtftp4Token.OptionList[Mtftp4Token.OptionCount].OptionStr = (UINT8 *)"windowsize";
|
||||
AsciiSPrint ((CHAR8 *)WindowsizeBuf, sizeof (WindowsizeBuf), "%d", WindowSize);
|
||||
Mtftp4Token.OptionList[Mtftp4Token.OptionCount].ValueStr = WindowsizeBuf;
|
||||
Mtftp4Token.OptionCount ++;
|
||||
Mtftp4Token.OptionCount++;
|
||||
}
|
||||
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_DOWNLOADING),
|
||||
mTftpHiiHandle, FilePath
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_DOWNLOADING),
|
||||
mTftpHiiHandle,
|
||||
FilePath
|
||||
);
|
||||
|
||||
//
|
||||
@ -952,15 +1051,23 @@ DownloadFile (
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL),
|
||||
mTftpHiiHandle, L"tftp", mLocalFilePath
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL),
|
||||
mTftpHiiHandle,
|
||||
L"tftp",
|
||||
mLocalFilePath
|
||||
);
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Status = Mtftp4->ReadFile (Mtftp4, &Mtftp4Token);
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF),
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_CRLF),
|
||||
mTftpHiiHandle
|
||||
);
|
||||
|
||||
@ -969,7 +1076,7 @@ DownloadFile (
|
||||
//
|
||||
ShellCloseFile (&mFileHandle);
|
||||
|
||||
Error :
|
||||
Error:
|
||||
if (TftpContext != NULL) {
|
||||
FreePool (TftpContext);
|
||||
}
|
||||
@ -1016,7 +1123,7 @@ CheckPacket (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Context = (DOWNLOAD_CONTEXT*)Token->Context;
|
||||
Context = (DOWNLOAD_CONTEXT *)Token->Context;
|
||||
|
||||
//
|
||||
// The data in the packet are prepended with two UINT16 :
|
||||
@ -1025,18 +1132,27 @@ CheckPacket (
|
||||
//
|
||||
DownloadLen = (UINTN)PacketLen - sizeof (Packet->OpCode) - sizeof (Packet->Data.Block);
|
||||
|
||||
ShellSetFilePosition(mFileHandle, Context->DownloadedNbOfBytes);
|
||||
ShellSetFilePosition (mFileHandle, Context->DownloadedNbOfBytes);
|
||||
Status = ShellWriteFile (mFileHandle, &DownloadLen, Packet->Data.Data);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Context->DownloadedNbOfBytes > 0) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF),
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_GEN_CRLF),
|
||||
mTftpHiiHandle
|
||||
);
|
||||
}
|
||||
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_WRITE),
|
||||
mTftpHiiHandle, mLocalFilePath, Status
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_TFTP_ERR_WRITE),
|
||||
mTftpHiiHandle,
|
||||
mLocalFilePath,
|
||||
Status
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
@ -1059,12 +1175,14 @@ CheckPacket (
|
||||
ShellPrintEx (-1, -1, L"%s", mTftpProgressDelete);
|
||||
|
||||
Status = StrCpyS (Progress, TFTP_PROGRESS_MESSAGE_SIZE, mTftpProgressFrame);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
for (Index = 1; Index < Step; Index++) {
|
||||
Progress[Index] = L'=';
|
||||
}
|
||||
|
||||
Progress[Step] = L'>';
|
||||
|
||||
UnicodeSPrint (
|
||||
@ -1125,5 +1243,6 @@ InitializeHiiPackage (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return HiiHandle;
|
||||
}
|
||||
|
@ -66,4 +66,5 @@ EFI_HII_HANDLE
|
||||
InitializeHiiPackage (
|
||||
EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
#endif // _TFTP_H_
|
||||
|
@ -37,6 +37,7 @@ TftpAppInitialize (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
|
||||
if (mTftpHiiHandle == NULL) {
|
||||
return EFI_ABORTED;
|
||||
|
@ -83,6 +83,7 @@ TftpCommandInitialize (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
|
||||
if (mTftpHiiHandle == NULL) {
|
||||
return EFI_ABORTED;
|
||||
@ -110,9 +111,10 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
TftpUnload (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
ImageHandle,
|
||||
&gEfiShellDynamicCommandProtocolGuid,
|
||||
@ -121,6 +123,7 @@ TftpUnload (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
HiiRemovePackages (mTftpHiiHandle);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -21,8 +21,8 @@
|
||||
UINTN
|
||||
EFIAPI
|
||||
ShellDumpBufferToFile (
|
||||
IN CONST CHAR16* FileNameBuffer,
|
||||
IN CONST VOID* Buffer,
|
||||
IN CONST CHAR16 *FileNameBuffer,
|
||||
IN CONST VOID *Buffer,
|
||||
IN CONST UINTN BufferSize
|
||||
);
|
||||
|
||||
|
@ -43,4 +43,3 @@ BcfgLibraryUnregisterBcfgCommand (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AddNewGuidNameMapping(
|
||||
AddNewGuidNameMapping (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN CONST CHAR16 *TheName,
|
||||
IN CONST CHAR8 *Lang OPTIONAL
|
||||
@ -43,9 +43,9 @@ AddNewGuidNameMapping(
|
||||
@return The pointer to a string of the name. The caller
|
||||
is responsible to free this memory.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
GetStringNameFromGuid(
|
||||
GetStringNameFromGuid (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN CONST CHAR8 *Lang OPTIONAL
|
||||
);
|
||||
@ -63,7 +63,7 @@ GetStringNameFromGuid(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetGuidFromStringName(
|
||||
GetGuidFromStringName (
|
||||
IN CONST CHAR16 *Name,
|
||||
IN CONST CHAR8 *Lang OPTIONAL,
|
||||
OUT EFI_GUID **Guid
|
||||
@ -85,9 +85,9 @@ GetGuidFromStringName(
|
||||
@return The pointer to string.
|
||||
@retval NULL An error was encountered.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
GetProtocolInformationDump(
|
||||
GetProtocolInformationDump (
|
||||
IN CONST EFI_HANDLE TheHandle,
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN CONST BOOLEAN Verbose
|
||||
@ -105,9 +105,9 @@ GetProtocolInformationDump(
|
||||
@retval NULL The name could not be found.
|
||||
@return A pointer to the string name. Do not de-allocate the memory.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
GetStringNameFromHandle(
|
||||
GetStringNameFromHandle (
|
||||
IN CONST EFI_HANDLE TheHandle,
|
||||
IN CONST CHAR8 *Language
|
||||
);
|
||||
@ -290,7 +290,7 @@ ParseHandleDatabaseByRelationshipWithType (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ParseHandleDatabaseForChildDevices(
|
||||
ParseHandleDatabaseForChildDevices (
|
||||
IN CONST EFI_HANDLE DriverHandle,
|
||||
IN UINTN *MatchingHandleCount,
|
||||
OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
|
||||
@ -309,13 +309,12 @@ ParseHandleDatabaseForChildDevices(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ParseHandleDatabaseForChildControllers(
|
||||
ParseHandleDatabaseForChildControllers (
|
||||
IN CONST EFI_HANDLE ControllerHandle,
|
||||
OUT UINTN *MatchingHandleCount,
|
||||
OUT EFI_HANDLE **MatchingHandleBuffer OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
@ -329,7 +328,7 @@ ParseHandleDatabaseForChildControllers(
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
ConvertHandleToHandleIndex(
|
||||
ConvertHandleToHandleIndex (
|
||||
IN CONST EFI_HANDLE TheHandle
|
||||
);
|
||||
|
||||
@ -344,7 +343,7 @@ ConvertHandleToHandleIndex(
|
||||
**/
|
||||
EFI_HANDLE
|
||||
EFIAPI
|
||||
ConvertHandleIndexToHandle(
|
||||
ConvertHandleIndexToHandle (
|
||||
IN CONST UINTN TheIndex
|
||||
);
|
||||
|
||||
@ -359,7 +358,7 @@ ConvertHandleIndexToHandle(
|
||||
@retval NULL A memory allocation failed.
|
||||
@return A NULL terminated list of handles.
|
||||
**/
|
||||
EFI_HANDLE*
|
||||
EFI_HANDLE *
|
||||
EFIAPI
|
||||
GetHandleListByProtocol (
|
||||
IN CONST EFI_GUID *ProtocolGuid OPTIONAL
|
||||
@ -376,13 +375,12 @@ GetHandleListByProtocol (
|
||||
@retval NULL ProtocolGuids was NULL.
|
||||
@return A NULL terminated list of EFI_HANDLEs.
|
||||
**/
|
||||
EFI_HANDLE*
|
||||
EFI_HANDLE *
|
||||
EFIAPI
|
||||
GetHandleListByProtocolList (
|
||||
IN CONST EFI_GUID **ProtocolGuids
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Return all supported GUIDs.
|
||||
|
||||
|
@ -31,4 +31,3 @@ ShellAppMain (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
// The extern global protocol poionters.
|
||||
//
|
||||
extern EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation;
|
||||
extern CONST CHAR16* SupportLevel[];
|
||||
extern CONST CHAR16 *SupportLevel[];
|
||||
|
||||
//
|
||||
// The map list objects.
|
||||
@ -185,13 +185,12 @@ ShellCommandRunCommandHandler (
|
||||
@retval other The name of the MAN file.
|
||||
@sa SHELL_GET_MAN_FILENAME
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
ShellCommandGetManFileNameHandler (
|
||||
IN CONST CHAR16 *CommandString
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
LIST_ENTRY Link;
|
||||
CHAR16 *CommandString;
|
||||
@ -206,7 +205,7 @@ typedef struct {
|
||||
|
||||
@return A linked list of all available shell commands.
|
||||
**/
|
||||
CONST COMMAND_LIST*
|
||||
CONST COMMAND_LIST *
|
||||
EFIAPI
|
||||
ShellCommandGetCommandList (
|
||||
IN CONST BOOLEAN Sort
|
||||
@ -245,7 +244,7 @@ ShellCommandRegisterAlias (
|
||||
|
||||
@return A linked list of all requested shell aliases.
|
||||
**/
|
||||
CONST ALIAS_LIST*
|
||||
CONST ALIAS_LIST *
|
||||
EFIAPI
|
||||
ShellCommandGetInitAliasList (
|
||||
VOID
|
||||
@ -287,7 +286,7 @@ ShellCommandIsCommandOnList (
|
||||
@retval NULL No help text was found.
|
||||
@return The string of the help text. The caller required to free.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
ShellCommandGetCommandHelp (
|
||||
IN CONST CHAR16 *CommandString
|
||||
@ -327,8 +326,6 @@ ShellCommandSetEchoState (
|
||||
IN BOOLEAN State
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Indicate that the current shell or script should exit.
|
||||
|
||||
@ -402,7 +399,7 @@ typedef struct {
|
||||
@retval NULL A script file is not currently running.
|
||||
@return A pointer to the current script file object.
|
||||
**/
|
||||
SCRIPT_FILE*
|
||||
SCRIPT_FILE *
|
||||
EFIAPI
|
||||
ShellCommandGetCurrentScriptFile (
|
||||
VOID
|
||||
@ -419,7 +416,7 @@ ShellCommandGetCurrentScriptFile (
|
||||
@return A pointer to the current running script file after this
|
||||
change. It is NULL if removing the final script.
|
||||
**/
|
||||
SCRIPT_FILE*
|
||||
SCRIPT_FILE *
|
||||
EFIAPI
|
||||
ShellCommandSetNewScript (
|
||||
IN SCRIPT_FILE *Script OPTIONAL
|
||||
@ -466,9 +463,9 @@ typedef enum {
|
||||
@retval NULL a memory allocation failed.
|
||||
@return a new map name string
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
ShellCommandCreateNewMappingName(
|
||||
ShellCommandCreateNewMappingName (
|
||||
IN CONST SHELL_MAPPING_TYPE Type
|
||||
);
|
||||
|
||||
@ -513,7 +510,7 @@ ShellCommandConsistMappingUnInitialize (
|
||||
@retval NULL A consistent mapped name could not be created.
|
||||
@return A pointer to a string allocated from pool with the device name.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
ShellCommandConsistMappingGenMappingName (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
@ -528,7 +525,7 @@ ShellCommandConsistMappingGenMappingName (
|
||||
|
||||
@return the node on the list.
|
||||
**/
|
||||
SHELL_MAP_LIST*
|
||||
SHELL_MAP_LIST *
|
||||
EFIAPI
|
||||
ShellCommandFindMapItem (
|
||||
IN CONST CHAR16 *MapKey
|
||||
@ -553,7 +550,7 @@ ShellCommandFindMapItem (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellCommandAddMapItemAndUpdatePath(
|
||||
ShellCommandAddMapItemAndUpdatePath (
|
||||
IN CONST CHAR16 *Name,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN CONST UINT64 Flags,
|
||||
@ -574,7 +571,7 @@ ShellCommandAddMapItemAndUpdatePath(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellCommandCreateInitialMappingsAndPaths(
|
||||
ShellCommandCreateInitialMappingsAndPaths (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -596,9 +593,9 @@ ShellCommandUpdateMapping (
|
||||
|
||||
@return a EFI_FILE_PROTOCOL* representing the same file.
|
||||
**/
|
||||
EFI_FILE_PROTOCOL*
|
||||
EFI_FILE_PROTOCOL *
|
||||
EFIAPI
|
||||
ConvertShellHandleToEfiFileProtocol(
|
||||
ConvertShellHandleToEfiFileProtocol (
|
||||
IN CONST SHELL_FILE_HANDLE Handle
|
||||
);
|
||||
|
||||
@ -612,7 +609,7 @@ ConvertShellHandleToEfiFileProtocol(
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ShellFileHandleRemove(
|
||||
ShellFileHandleRemove (
|
||||
IN CONST SHELL_FILE_HANDLE Handle
|
||||
);
|
||||
|
||||
@ -626,7 +623,7 @@ ShellFileHandleRemove(
|
||||
**/
|
||||
SHELL_FILE_HANDLE
|
||||
EFIAPI
|
||||
ConvertEfiFileProtocolToShellHandle(
|
||||
ConvertEfiFileProtocolToShellHandle (
|
||||
IN CONST EFI_FILE_PROTOCOL *Handle,
|
||||
IN CONST CHAR16 *Path
|
||||
);
|
||||
@ -638,13 +635,12 @@ ConvertEfiFileProtocolToShellHandle(
|
||||
|
||||
@return A pointer to the path for the file.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
ShellFileHandleGetPath(
|
||||
ShellFileHandleGetPath (
|
||||
IN CONST SHELL_FILE_HANDLE Handle
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Function to determine if a SHELL_FILE_HANDLE is at the end of the file.
|
||||
|
||||
@ -659,7 +655,7 @@ ShellFileHandleGetPath(
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ShellFileHandleEof(
|
||||
ShellFileHandleEof (
|
||||
IN SHELL_FILE_HANDLE Handle
|
||||
);
|
||||
|
||||
@ -705,7 +701,7 @@ DumpHex (
|
||||
@param[in] DataSize The size in bytes of UserData.
|
||||
@param[in] UserData The data to print out.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
CatSDumpHex (
|
||||
IN CHAR16 *Buffer,
|
||||
@ -795,4 +791,5 @@ ShellSortFileList (
|
||||
OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL,
|
||||
IN SHELL_SORT_FILE_LIST Order
|
||||
);
|
||||
|
||||
#endif //_SHELL_COMMAND_LIB_
|
||||
|
@ -58,9 +58,9 @@ extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
|
||||
Path. The caller must free this memory when it is no
|
||||
longer needed.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
FullyQualifyPath(
|
||||
FullyQualifyPath (
|
||||
IN CONST CHAR16 *Path
|
||||
);
|
||||
|
||||
@ -78,7 +78,7 @@ FullyQualifyPath(
|
||||
|
||||
@return The information about the file.
|
||||
**/
|
||||
EFI_FILE_INFO*
|
||||
EFI_FILE_INFO *
|
||||
EFIAPI
|
||||
ShellGetFileInfo (
|
||||
IN SHELL_FILE_HANDLE FileHandle
|
||||
@ -141,7 +141,7 @@ ShellSetFileInfo (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellOpenFileByDevicePath(
|
||||
ShellOpenFileByDevicePath (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
|
||||
OUT SHELL_FILE_HANDLE *FileHandle,
|
||||
IN UINT64 OpenMode,
|
||||
@ -179,7 +179,7 @@ ShellOpenFileByDevicePath(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellOpenFileByName(
|
||||
ShellOpenFileByName (
|
||||
IN CONST CHAR16 *FileName,
|
||||
OUT SHELL_FILE_HANDLE *FileHandle,
|
||||
IN UINT64 OpenMode,
|
||||
@ -215,7 +215,7 @@ ShellOpenFileByName(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellCreateDirectory(
|
||||
ShellCreateDirectory (
|
||||
IN CONST CHAR16 *DirectoryName,
|
||||
OUT SHELL_FILE_HANDLE *FileHandle
|
||||
);
|
||||
@ -251,7 +251,7 @@ ShellCreateDirectory(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellReadFile(
|
||||
ShellReadFile (
|
||||
IN SHELL_FILE_HANDLE FileHandle,
|
||||
IN OUT UINTN *ReadSize,
|
||||
OUT VOID *Buffer
|
||||
@ -285,7 +285,7 @@ ShellReadFile(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellWriteFile(
|
||||
ShellWriteFile (
|
||||
IN SHELL_FILE_HANDLE FileHandle,
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN VOID *Buffer
|
||||
@ -451,7 +451,7 @@ ShellFindFirstFile (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellFindNextFile(
|
||||
ShellFindNextFile (
|
||||
IN SHELL_FILE_HANDLE DirHandle,
|
||||
IN OUT EFI_FILE_INFO *Buffer,
|
||||
IN OUT BOOLEAN *NoFile
|
||||
@ -486,7 +486,7 @@ ShellGetFileSize (
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ShellGetExecutionBreakFlag(
|
||||
ShellGetExecutionBreakFlag (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -501,7 +501,7 @@ ShellGetExecutionBreakFlag(
|
||||
@retval NULL The named environment variable does not exist.
|
||||
@return != NULL The pointer to the value of the environment variable.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
ShellGetEnvironmentVariable (
|
||||
IN CONST CHAR16 *EnvKey
|
||||
@ -589,10 +589,10 @@ ShellExecute (
|
||||
@retval NULL The directory does not exist.
|
||||
@retval != NULL The directory.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
ShellGetCurrentDir (
|
||||
IN CHAR16 * CONST DeviceName OPTIONAL
|
||||
IN CHAR16 *CONST DeviceName OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@ -711,7 +711,6 @@ typedef struct {
|
||||
SHELL_PARAM_TYPE Type;
|
||||
} SHELL_PARAM_ITEM;
|
||||
|
||||
|
||||
/// Helper structure for no parameters (besides -? and -b)
|
||||
extern SHELL_PARAM_ITEM EmptyParamList[];
|
||||
|
||||
@ -753,7 +752,7 @@ ShellCommandLineParseEx (
|
||||
);
|
||||
|
||||
/// Make it easy to upgrade from older versions of the shell library.
|
||||
#define ShellCommandLineParse(CheckList,CheckPackage,ProblemParam,AutoPageBreak) ShellCommandLineParseEx(CheckList,CheckPackage,ProblemParam,AutoPageBreak,FALSE)
|
||||
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak) ShellCommandLineParseEx(CheckList,CheckPackage,ProblemParam,AutoPageBreak,FALSE)
|
||||
|
||||
/**
|
||||
Frees shell variable list that was returned from ShellCommandLineParse.
|
||||
@ -788,8 +787,8 @@ ShellCommandLineFreeVarList (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
ShellCommandLineGetFlag (
|
||||
IN CONST LIST_ENTRY * CONST CheckPackage,
|
||||
IN CONST CHAR16 * CONST KeyString
|
||||
IN CONST LIST_ENTRY *CONST CheckPackage,
|
||||
IN CONST CHAR16 *CONST KeyString
|
||||
);
|
||||
|
||||
/**
|
||||
@ -805,7 +804,7 @@ ShellCommandLineGetFlag (
|
||||
@retval NULL The flag is not on the command line.
|
||||
@retval !=NULL The pointer to unicode string of the value.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
ShellCommandLineGetValue (
|
||||
IN CONST LIST_ENTRY *CheckPackage,
|
||||
@ -825,10 +824,10 @@ ShellCommandLineGetValue (
|
||||
@retval NULL The flag is not on the command line.
|
||||
@retval !=NULL The pointer to unicode string of the value.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
ShellCommandLineGetRawValue (
|
||||
IN CONST LIST_ENTRY * CONST CheckPackage,
|
||||
IN CONST LIST_ENTRY *CONST CheckPackage,
|
||||
IN UINTN Position
|
||||
);
|
||||
|
||||
@ -844,7 +843,7 @@ ShellCommandLineGetRawValue (
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
ShellCommandLineGetCount(
|
||||
ShellCommandLineGetCount (
|
||||
IN CONST LIST_ENTRY *CheckPackage
|
||||
);
|
||||
|
||||
@ -919,7 +918,7 @@ ShellInitialize (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellPrintEx(
|
||||
ShellPrintEx (
|
||||
IN INT32 Col OPTIONAL,
|
||||
IN INT32 Row OPTIONAL,
|
||||
IN CONST CHAR16 *Format,
|
||||
@ -960,7 +959,7 @@ ShellPrintEx(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellPrintHiiEx(
|
||||
ShellPrintHiiEx (
|
||||
IN INT32 Col OPTIONAL,
|
||||
IN INT32 Row OPTIONAL,
|
||||
IN CONST CHAR8 *Language OPTIONAL,
|
||||
@ -982,7 +981,7 @@ ShellPrintHiiEx(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellIsDirectory(
|
||||
ShellIsDirectory (
|
||||
IN CONST CHAR16 *DirName
|
||||
);
|
||||
|
||||
@ -1001,7 +1000,7 @@ ShellIsDirectory(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellIsFile(
|
||||
ShellIsFile (
|
||||
IN CONST CHAR16 *Name
|
||||
);
|
||||
|
||||
@ -1020,7 +1019,7 @@ ShellIsFile(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellIsFileInPath(
|
||||
ShellIsFileInPath (
|
||||
IN CONST CHAR16 *Name
|
||||
);
|
||||
|
||||
@ -1038,7 +1037,7 @@ ShellIsFileInPath(
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
ShellStrToUintn(
|
||||
ShellStrToUintn (
|
||||
IN CONST CHAR16 *String
|
||||
);
|
||||
|
||||
@ -1055,7 +1054,7 @@ ShellStrToUintn(
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
ShellHexStrToUintn(
|
||||
ShellHexStrToUintn (
|
||||
IN CONST CHAR16 *String
|
||||
);
|
||||
|
||||
@ -1091,7 +1090,7 @@ ShellHexStrToUintn(
|
||||
|
||||
@return The Destination after appending the Source.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
StrnCatGrow (
|
||||
IN OUT CHAR16 **Destination,
|
||||
@ -1129,7 +1128,7 @@ StrnCatGrow (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellCopySearchAndReplace(
|
||||
ShellCopySearchAndReplace (
|
||||
IN CHAR16 CONST *SourceString,
|
||||
IN OUT CHAR16 *NewString,
|
||||
IN UINTN NewSize,
|
||||
@ -1301,7 +1300,7 @@ ShellIsHexOrDecimalNumber (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellConvertStringToUint64(
|
||||
ShellConvertStringToUint64 (
|
||||
IN CONST CHAR16 *String,
|
||||
OUT UINT64 *Value,
|
||||
IN CONST BOOLEAN ForceHex,
|
||||
@ -1319,7 +1318,7 @@ ShellConvertStringToUint64(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellFileExists(
|
||||
ShellFileExists (
|
||||
IN CONST CHAR16 *Name
|
||||
);
|
||||
|
||||
@ -1338,9 +1337,9 @@ ShellFileExists(
|
||||
|
||||
@sa ShellFileHandleReadLine
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
ShellFileHandleReturnLine(
|
||||
ShellFileHandleReturnLine (
|
||||
IN SHELL_FILE_HANDLE Handle,
|
||||
IN OUT BOOLEAN *Ascii
|
||||
);
|
||||
@ -1373,7 +1372,7 @@ ShellFileHandleReturnLine(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellFileHandleReadLine(
|
||||
ShellFileHandleReadLine (
|
||||
IN SHELL_FILE_HANDLE Handle,
|
||||
IN OUT CHAR16 *Buffer,
|
||||
IN OUT UINTN *Size,
|
||||
@ -1406,7 +1405,7 @@ ShellFileHandleReadLine(
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ShellDeleteFileByName(
|
||||
ShellDeleteFileByName (
|
||||
IN CONST CHAR16 *FileName
|
||||
);
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_
|
||||
#define _SHELL_ENVIRONMENT_2_PROTOCOL_H_
|
||||
|
||||
@ -24,7 +23,7 @@
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_DUMP_PROTOCOL_INFO) (
|
||||
(EFIAPI *SHELLENV_DUMP_PROTOCOL_INFO)(
|
||||
IN EFI_HANDLE Handle,
|
||||
IN VOID *Interface
|
||||
);
|
||||
@ -45,7 +44,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_INTERNAL_COMMAND) (
|
||||
(EFIAPI *SHELLENV_INTERNAL_COMMAND)(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
@ -62,7 +61,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLCMD_GET_LINE_HELP) (
|
||||
(EFIAPI *SHELLCMD_GET_LINE_HELP)(
|
||||
IN OUT CHAR16 **Str
|
||||
);
|
||||
|
||||
@ -129,7 +128,7 @@ GUID for the shell environment2 extension (main GUID above).
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_EXECUTE) (
|
||||
(EFIAPI *SHELLENV_EXECUTE)(
|
||||
IN EFI_HANDLE *ParentImageHandle,
|
||||
IN CHAR16 *CommandLine,
|
||||
IN BOOLEAN DebugOutput
|
||||
@ -147,7 +146,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
CHAR16 *
|
||||
(EFIAPI *SHELLENV_GET_ENV) (
|
||||
(EFIAPI *SHELLENV_GET_ENV)(
|
||||
IN CHAR16 *Name
|
||||
);
|
||||
|
||||
@ -163,7 +162,7 @@ CHAR16 *
|
||||
**/
|
||||
typedef
|
||||
CHAR16 *
|
||||
(EFIAPI *SHELLENV_GET_MAP) (
|
||||
(EFIAPI *SHELLENV_GET_MAP)(
|
||||
IN CHAR16 *Name
|
||||
);
|
||||
|
||||
@ -184,7 +183,7 @@ CHAR16 *
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_ADD_CMD) (
|
||||
(EFIAPI *SHELLENV_ADD_CMD)(
|
||||
IN SHELLENV_INTERNAL_COMMAND Handler,
|
||||
IN CHAR16 *Cmd,
|
||||
IN SHELLCMD_GET_LINE_HELP GetLineHelp
|
||||
@ -206,7 +205,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_ADD_PROT) (
|
||||
(EFIAPI *SHELLENV_ADD_PROT)(
|
||||
IN EFI_GUID *Protocol,
|
||||
IN SHELLENV_DUMP_PROTOCOL_INFO DumpToken OPTIONAL,
|
||||
IN SHELLENV_DUMP_PROTOCOL_INFO DumpInfo OPTIONAL,
|
||||
@ -227,8 +226,8 @@ VOID
|
||||
@retval NULL The Name was not found, and GenId was not TRUE.
|
||||
**/
|
||||
typedef
|
||||
CHAR16*
|
||||
(EFIAPI *SHELLENV_GET_PROT) (
|
||||
CHAR16 *
|
||||
(EFIAPI *SHELLENV_GET_PROT)(
|
||||
IN EFI_GUID *Protocol,
|
||||
IN BOOLEAN GenId
|
||||
);
|
||||
@ -249,8 +248,8 @@ CHAR16*
|
||||
|
||||
**/
|
||||
typedef
|
||||
CHAR16*
|
||||
(EFIAPI *SHELLENV_CUR_DIR) (
|
||||
CHAR16 *
|
||||
(EFIAPI *SHELLENV_CUR_DIR)(
|
||||
IN CHAR16 *DeviceName OPTIONAL
|
||||
);
|
||||
|
||||
@ -275,7 +274,7 @@ CHAR16*
|
||||
@sa SHELLENV_FREE_FILE_LIST
|
||||
**/typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_FILE_META_ARG) (
|
||||
(EFIAPI *SHELLENV_FILE_META_ARG)(
|
||||
IN CHAR16 *Arg,
|
||||
IN OUT LIST_ENTRY *ListHead
|
||||
);
|
||||
@ -289,7 +288,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_FREE_FILE_LIST) (
|
||||
(EFIAPI *SHELLENV_FREE_FILE_LIST)(
|
||||
IN OUT LIST_ENTRY *ListHead
|
||||
);
|
||||
|
||||
@ -308,8 +307,8 @@ EFI_STATUS
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_SHELL_INTERFACE*
|
||||
(EFIAPI *SHELLENV_NEW_SHELL) (
|
||||
EFI_SHELL_INTERFACE *
|
||||
(EFIAPI *SHELLENV_NEW_SHELL)(
|
||||
IN EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
@ -325,7 +324,7 @@ EFI_SHELL_INTERFACE*
|
||||
**/
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *SHELLENV_BATCH_IS_ACTIVE) (
|
||||
(EFIAPI *SHELLENV_BATCH_IS_ACTIVE)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -335,7 +334,7 @@ BOOLEAN
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_FREE_RESOURCES) (
|
||||
(EFIAPI *SHELLENV_FREE_RESOURCES)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -352,7 +351,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_ENABLE_PAGE_BREAK) (
|
||||
(EFIAPI *SHELLENV_ENABLE_PAGE_BREAK)(
|
||||
IN INT32 StartRow,
|
||||
IN BOOLEAN AutoWrap
|
||||
);
|
||||
@ -365,7 +364,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_DISABLE_PAGE_BREAK) (
|
||||
(EFIAPI *SHELLENV_DISABLE_PAGE_BREAK)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -377,7 +376,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *SHELLENV_GET_PAGE_BREAK) (
|
||||
(EFIAPI *SHELLENV_GET_PAGE_BREAK)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -393,7 +392,7 @@ BOOLEAN
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_SET_KEY_FILTER) (
|
||||
(EFIAPI *SHELLENV_SET_KEY_FILTER)(
|
||||
IN UINT32 KeyFilter
|
||||
);
|
||||
|
||||
@ -409,7 +408,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
UINT32
|
||||
(EFIAPI *SHELLENV_GET_KEY_FILTER) (
|
||||
(EFIAPI *SHELLENV_GET_KEY_FILTER)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -425,7 +424,7 @@ UINT32
|
||||
**/
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *SHELLENV_GET_EXECUTION_BREAK) (
|
||||
(EFIAPI *SHELLENV_GET_EXECUTION_BREAK)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -435,7 +434,7 @@ BOOLEAN
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_INCREMENT_SHELL_NESTING_LEVEL) (
|
||||
(EFIAPI *SHELLENV_INCREMENT_SHELL_NESTING_LEVEL)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -444,7 +443,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_DECREMENT_SHELL_NESTING_LEVEL) (
|
||||
(EFIAPI *SHELLENV_DECREMENT_SHELL_NESTING_LEVEL)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -457,7 +456,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *SHELLENV_IS_ROOT_SHELL) (
|
||||
(EFIAPI *SHELLENV_IS_ROOT_SHELL)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -476,7 +475,7 @@ BOOLEAN
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *SHELLENV_CLOSE_CONSOLE_PROXY) (
|
||||
(EFIAPI *SHELLENV_CLOSE_CONSOLE_PROXY)(
|
||||
IN EFI_HANDLE ConInHandle,
|
||||
IN OUT EFI_SIMPLE_TEXT_INPUT_PROTOCOL **ConIn,
|
||||
IN EFI_HANDLE ConOutHandle,
|
||||
@ -486,6 +485,7 @@ VOID
|
||||
//
|
||||
// declarations of handle enumerator
|
||||
//
|
||||
|
||||
/**
|
||||
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
|
||||
@ -493,7 +493,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *INIT_HANDLE_ENUMERATOR) (
|
||||
(EFIAPI *INIT_HANDLE_ENUMERATOR)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -514,7 +514,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *NEXT_HANDLE) (
|
||||
(EFIAPI *NEXT_HANDLE)(
|
||||
IN OUT EFI_HANDLE **Handle
|
||||
);
|
||||
|
||||
@ -534,7 +534,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SKIP_HANDLE) (
|
||||
(EFIAPI *SKIP_HANDLE)(
|
||||
IN UINTN SkipNum
|
||||
);
|
||||
|
||||
@ -552,7 +552,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *RESET_HANDLE_ENUMERATOR) (
|
||||
(EFIAPI *RESET_HANDLE_ENUMERATOR)(
|
||||
IN UINTN EnumIndex
|
||||
);
|
||||
|
||||
@ -567,7 +567,7 @@ UINTN
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *CLOSE_HANDLE_ENUMERATOR) (
|
||||
(EFIAPI *CLOSE_HANDLE_ENUMERATOR)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -582,7 +582,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
UINTN
|
||||
(EFIAPI *GET_NUM) (
|
||||
(EFIAPI *GET_NUM)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -621,12 +621,12 @@ typedef struct {
|
||||
//
|
||||
UINTN NoHandles; ///< The number of handles producing this protocol.
|
||||
EFI_HANDLE *Handles; ///< The array of handles.
|
||||
|
||||
} PROTOCOL_INFO;
|
||||
|
||||
//
|
||||
// Declarations of protocol info enumerator.
|
||||
//
|
||||
|
||||
/**
|
||||
This is an internal shell function to initialize the protocol enumerator.
|
||||
|
||||
@ -636,7 +636,7 @@ typedef struct {
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *INIT_PROTOCOL_INFO_ENUMERATOR) (
|
||||
(EFIAPI *INIT_PROTOCOL_INFO_ENUMERATOR)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -657,7 +657,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *NEXT_PROTOCOL_INFO) (
|
||||
(EFIAPI *NEXT_PROTOCOL_INFO)(
|
||||
IN OUT PROTOCOL_INFO **ProtocolInfo
|
||||
);
|
||||
|
||||
@ -673,7 +673,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SKIP_PROTOCOL_INFO) (
|
||||
(EFIAPI *SKIP_PROTOCOL_INFO)(
|
||||
IN UINTN SkipNum
|
||||
);
|
||||
|
||||
@ -688,11 +688,10 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *RESET_PROTOCOL_INFO_ENUMERATOR) (
|
||||
(EFIAPI *RESET_PROTOCOL_INFO_ENUMERATOR)(
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
This function is an internal shell function for enumeration of protocols.
|
||||
|
||||
@ -704,7 +703,7 @@ VOID
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *CLOSE_PROTOCOL_INFO_ENUMERATOR) (
|
||||
(EFIAPI *CLOSE_PROTOCOL_INFO_ENUMERATOR)(
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -752,7 +751,7 @@ typedef struct {
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *GET_DEVICE_NAME) (
|
||||
(EFIAPI *GET_DEVICE_NAME)(
|
||||
IN EFI_HANDLE DeviceHandle,
|
||||
IN BOOLEAN UseComponentName,
|
||||
IN BOOLEAN UseDevicePath,
|
||||
@ -778,7 +777,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *GET_SHELL_MODE) (
|
||||
(EFIAPI *GET_SHELL_MODE)(
|
||||
OUT CHAR16 **Mode
|
||||
);
|
||||
|
||||
@ -798,8 +797,8 @@ EFI_STATUS
|
||||
@retval NULL The operation could not be completed.
|
||||
**/
|
||||
typedef
|
||||
EFI_DEVICE_PATH_PROTOCOL*
|
||||
(EFIAPI *SHELLENV_NAME_TO_PATH) (
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
(EFIAPI *SHELLENV_NAME_TO_PATH)(
|
||||
IN CHAR16 *Path
|
||||
);
|
||||
|
||||
@ -827,8 +826,8 @@ EFI_DEVICE_PATH_PROTOCOL*
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_GET_FS_NAME) (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * DevPath,
|
||||
(EFIAPI *SHELLENV_GET_FS_NAME)(
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath,
|
||||
IN BOOLEAN ConsistMapping,
|
||||
OUT CHAR16 **Name
|
||||
);
|
||||
@ -855,7 +854,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_FILE_META_ARG_NO_WILDCARD) (
|
||||
(EFIAPI *SHELLENV_FILE_META_ARG_NO_WILDCARD)(
|
||||
IN CHAR16 *Arg,
|
||||
IN OUT LIST_ENTRY *ListHead
|
||||
);
|
||||
@ -877,8 +876,8 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_DEL_DUP_FILE) (
|
||||
IN LIST_ENTRY * ListHead
|
||||
(EFIAPI *SHELLENV_DEL_DUP_FILE)(
|
||||
IN LIST_ENTRY *ListHead
|
||||
);
|
||||
|
||||
/**
|
||||
@ -905,7 +904,7 @@ EFI_STATUS
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SHELLENV_GET_FS_DEVICE_PATH) (
|
||||
(EFIAPI *SHELLENV_GET_FS_DEVICE_PATH)(
|
||||
IN CHAR16 *Name,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevPath
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -99,8 +99,8 @@
|
||||
#include <Protocol/DriverConfiguration.h>
|
||||
#include <Protocol/DriverConfiguration2.h>
|
||||
#include <Protocol/DevicePathUtilities.h>
|
||||
//#include <Protocol/FirmwareVolume.h>
|
||||
//#include <Protocol/FirmwareVolume2.h>
|
||||
// #include <Protocol/FirmwareVolume.h>
|
||||
// #include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/DriverFamilyOverride.h>
|
||||
#include <Protocol/Pcd.h>
|
||||
#include <Protocol/TcgService.h>
|
||||
@ -207,7 +207,6 @@ typedef struct {
|
||||
UINT64 Compatibilities;
|
||||
} EFI_FIRMWARE_IMAGE_DESCRIPTOR_V1;
|
||||
|
||||
|
||||
///
|
||||
/// EFI_FIRMWARE_IMAGE_DESCRIPTOR in UEFI spec > 2.4a and < 2.5
|
||||
///
|
||||
@ -270,7 +269,7 @@ typedef struct {
|
||||
LIST_ENTRY Link;
|
||||
EFI_HANDLE TheHandle;
|
||||
UINTN TheIndex;
|
||||
}HANDLE_LIST;
|
||||
} HANDLE_LIST;
|
||||
|
||||
typedef struct {
|
||||
HANDLE_LIST List;
|
||||
@ -284,11 +283,10 @@ CHAR16 *
|
||||
IN CONST BOOLEAN Verbose
|
||||
);
|
||||
|
||||
typedef struct _GUID_INFO_BLOCK{
|
||||
typedef struct _GUID_INFO_BLOCK {
|
||||
EFI_STRING_ID StringId;
|
||||
EFI_GUID *GuidId;
|
||||
DUMP_PROTOCOL_INFO DumpInfo;
|
||||
} GUID_INFO_BLOCK;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -114,7 +114,7 @@ BOOLEAN
|
||||
EFIAPI
|
||||
VerifyChecksum (
|
||||
IN BOOLEAN Log,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -140,22 +140,29 @@ VerifyChecksum (
|
||||
if (GetColourHighlighting ()) {
|
||||
gST->ConOut->SetAttribute (
|
||||
gST->ConOut,
|
||||
EFI_TEXT_ATTR (EFI_GREEN,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
||||
EFI_TEXT_ATTR (
|
||||
EFI_GREEN,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Print (L"Table Checksum : OK\n\n");
|
||||
} else {
|
||||
IncrementErrorCount ();
|
||||
if (GetColourHighlighting ()) {
|
||||
gST->ConOut->SetAttribute (
|
||||
gST->ConOut,
|
||||
EFI_TEXT_ATTR (EFI_RED,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
||||
EFI_TEXT_ATTR (
|
||||
EFI_RED,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Print (L"Table Checksum : FAILED (0x%X)\n\n", Checksum);
|
||||
}
|
||||
|
||||
if (GetColourHighlighting ()) {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
|
||||
}
|
||||
@ -173,7 +180,7 @@ VerifyChecksum (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpRaw (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -216,6 +223,7 @@ DumpRaw (
|
||||
if ((Length & 0x0F) <= 8) {
|
||||
PartLineChars += 2;
|
||||
}
|
||||
|
||||
while (PartLineChars > 0) {
|
||||
Print (L" ");
|
||||
PartLineChars--;
|
||||
@ -236,8 +244,8 @@ DumpRaw (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpUint8 (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (Format, *Ptr);
|
||||
@ -252,11 +260,11 @@ DumpUint8 (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpUint16 (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (Format, *(UINT16*)Ptr);
|
||||
Print (Format, *(UINT16 *)Ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -268,11 +276,11 @@ DumpUint16 (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpUint32 (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (Format, *(UINT32*)Ptr);
|
||||
Print (Format, *(UINT32 *)Ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,8 +292,8 @@ DumpUint32 (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpUint64 (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
// Some fields are not aligned and this causes alignment faults
|
||||
@ -293,10 +301,10 @@ DumpUint64 (
|
||||
// Perform word access so that LDRD instructions are not generated.
|
||||
UINT64 Val;
|
||||
|
||||
Val = *(UINT32*)(Ptr + sizeof (UINT32));
|
||||
Val = *(UINT32 *)(Ptr + sizeof (UINT32));
|
||||
|
||||
Val = LShiftU64(Val,32);
|
||||
Val |= (UINT64)*(UINT32*)Ptr;
|
||||
Val = LShiftU64 (Val, 32);
|
||||
Val |= (UINT64)*(UINT32 *)Ptr;
|
||||
|
||||
Print (Format, Val);
|
||||
}
|
||||
@ -313,8 +321,8 @@ DumpUint64 (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump3Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (
|
||||
@ -337,8 +345,8 @@ Dump3Chars (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump4Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (
|
||||
@ -362,8 +370,8 @@ Dump4Chars (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump6Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (
|
||||
@ -389,8 +397,8 @@ Dump6Chars (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump8Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (
|
||||
@ -418,8 +426,8 @@ Dump8Chars (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump12Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (
|
||||
@ -455,8 +463,8 @@ VOID
|
||||
EFIAPI
|
||||
PrintFieldName (
|
||||
IN UINT32 Indent,
|
||||
IN CONST CHAR16* FieldName
|
||||
)
|
||||
IN CONST CHAR16 *FieldName
|
||||
)
|
||||
{
|
||||
Print (
|
||||
L"%*a%-*s : ",
|
||||
@ -498,12 +506,12 @@ EFIAPI
|
||||
ParseAcpi (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT32 Indent,
|
||||
IN CONST CHAR8* AsciiName OPTIONAL,
|
||||
IN UINT8* Ptr,
|
||||
IN CONST CHAR8 *AsciiName OPTIONAL,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length,
|
||||
IN CONST ACPI_PARSER* Parser,
|
||||
IN CONST ACPI_PARSER *Parser,
|
||||
IN UINT32 ParserItems
|
||||
)
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 Offset;
|
||||
@ -519,17 +527,20 @@ ParseAcpi (
|
||||
// Increment the Indent
|
||||
gIndent += Indent;
|
||||
|
||||
if (Trace && (AsciiName != NULL)){
|
||||
if (Trace && (AsciiName != NULL)) {
|
||||
HighLight = GetColourHighlighting ();
|
||||
|
||||
if (HighLight) {
|
||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||
gST->ConOut->SetAttribute (
|
||||
gST->ConOut,
|
||||
EFI_TEXT_ATTR(EFI_YELLOW,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
||||
EFI_TEXT_ATTR (
|
||||
EFI_YELLOW,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Print (
|
||||
L"%*a%-*a :\n",
|
||||
gIndent,
|
||||
@ -544,7 +555,6 @@ ParseAcpi (
|
||||
|
||||
for (Index = 0; Index < ParserItems; Index++) {
|
||||
if ((Offset + Parser[Index].Length) > Length) {
|
||||
|
||||
// For fields outside the buffer length provided, reset any pointers
|
||||
// which were supposed to be updated by this function call
|
||||
if (Parser[Index].ItemPtr != NULL) {
|
||||
@ -556,7 +566,8 @@ ParseAcpi (
|
||||
}
|
||||
|
||||
if (GetConsistencyChecking () &&
|
||||
(Offset != Parser[Index].Offset)) {
|
||||
(Offset != Parser[Index].Offset))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nERROR: %a: Offset Mismatch for %s\n"
|
||||
@ -597,17 +608,20 @@ ParseAcpi (
|
||||
);
|
||||
} // switch
|
||||
}
|
||||
|
||||
// Validating only makes sense if we are tracing
|
||||
// the parsed table entries, to report by table name.
|
||||
if (GetConsistencyChecking () &&
|
||||
(Parser[Index].FieldValidator != NULL)) {
|
||||
(Parser[Index].FieldValidator != NULL))
|
||||
{
|
||||
Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
} // if (Trace)
|
||||
|
||||
if (Parser[Index].ItemPtr != NULL) {
|
||||
*Parser[Index].ItemPtr = (VOID*)Ptr;
|
||||
*Parser[Index].ItemPtr = (VOID *)Ptr;
|
||||
}
|
||||
|
||||
Ptr += Parser[Index].Length;
|
||||
@ -625,11 +639,11 @@ ParseAcpi (
|
||||
the GAS structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GasParser[] = {
|
||||
{L"Address Space ID", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Register Bit Width", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Register Bit Offset", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Access Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}
|
||||
{ L"Address Space ID", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Register Bit Width", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Register Bit Offset", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Access Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -644,7 +658,7 @@ STATIC CONST ACPI_PARSER GasParser[] = {
|
||||
UINT32
|
||||
EFIAPI
|
||||
DumpGasStruct (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Indent,
|
||||
IN UINT32 Length
|
||||
)
|
||||
@ -669,8 +683,8 @@ DumpGasStruct (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpGas (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
DumpGasStruct (Ptr, 2, sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE));
|
||||
@ -686,7 +700,7 @@ DumpGas (
|
||||
UINT32
|
||||
EFIAPI
|
||||
DumpAcpiHeader (
|
||||
IN UINT8* Ptr
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
return ParseAcpi (
|
||||
@ -715,10 +729,10 @@ DumpAcpiHeader (
|
||||
UINT32
|
||||
EFIAPI
|
||||
ParseAcpiHeader (
|
||||
IN UINT8* Ptr,
|
||||
OUT CONST UINT32** Signature,
|
||||
OUT CONST UINT32** Length,
|
||||
OUT CONST UINT8** Revision
|
||||
IN UINT8 *Ptr,
|
||||
OUT CONST UINT32 **Signature,
|
||||
OUT CONST UINT32 **Length,
|
||||
OUT CONST UINT8 **Revision
|
||||
)
|
||||
{
|
||||
UINT32 BytesParsed;
|
||||
|
@ -51,7 +51,7 @@ BOOLEAN
|
||||
EFIAPI
|
||||
VerifyChecksum (
|
||||
IN BOOLEAN Log,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
);
|
||||
|
||||
@ -64,7 +64,7 @@ VerifyChecksum (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpRaw (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
);
|
||||
|
||||
@ -77,8 +77,8 @@ DumpRaw (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpUint8 (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -90,8 +90,8 @@ DumpUint8 (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpUint16 (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -103,8 +103,8 @@ DumpUint16 (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpUint32 (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -116,8 +116,8 @@ DumpUint32 (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpUint64 (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -132,8 +132,8 @@ DumpUint64 (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump3Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -148,8 +148,8 @@ Dump3Chars (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump4Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -164,8 +164,8 @@ Dump4Chars (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump6Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -180,8 +180,8 @@ Dump6Chars (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump8Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -196,8 +196,8 @@ Dump8Chars (
|
||||
VOID
|
||||
EFIAPI
|
||||
Dump12Chars (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -216,7 +216,7 @@ VOID
|
||||
EFIAPI
|
||||
PrintFieldName (
|
||||
IN UINT32 Indent,
|
||||
IN CONST CHAR16* FieldName
|
||||
IN CONST CHAR16 *FieldName
|
||||
);
|
||||
|
||||
/**
|
||||
@ -226,7 +226,7 @@ PrintFieldName (
|
||||
the 'Format' member of ACPI_PARSER.
|
||||
@param [in] Ptr Pointer to the start of the buffer.
|
||||
**/
|
||||
typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16* Format, UINT8* Ptr);
|
||||
typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16 *Format, UINT8 *Ptr);
|
||||
|
||||
/**
|
||||
This function pointer is the template for validating an ACPI table field.
|
||||
@ -236,7 +236,7 @@ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16* Format, UINT8* Ptr);
|
||||
the 'Context' member of the ACPI_PARSER.
|
||||
e.g. this could be a pointer to the ACPI table header.
|
||||
**/
|
||||
typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context);
|
||||
typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, VOID *Context);
|
||||
|
||||
/**
|
||||
The ACPI_PARSER structure describes the fields of an ACPI table and
|
||||
@ -258,10 +258,9 @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context);
|
||||
representing the field data.
|
||||
**/
|
||||
typedef struct AcpiParser {
|
||||
|
||||
/// String describing the ACPI table field
|
||||
/// (Field column from ACPI table spec)
|
||||
CONST CHAR16* NameStr;
|
||||
CONST CHAR16 *NameStr;
|
||||
|
||||
/// The length of the field.
|
||||
/// (Byte Length column from ACPI table spec)
|
||||
@ -273,7 +272,7 @@ typedef struct AcpiParser {
|
||||
|
||||
/// Optional Print() style format string for tracing the data. If not
|
||||
/// used this must be set to NULL.
|
||||
CONST CHAR16* Format;
|
||||
CONST CHAR16 *Format;
|
||||
|
||||
/// Optional pointer to a print formatter function which
|
||||
/// is typically used to trace complex field information.
|
||||
@ -286,7 +285,7 @@ typedef struct AcpiParser {
|
||||
/// a pointer to the field data. This value is set after the FieldValidator
|
||||
/// has been called and therefore should not be used by the FieldValidator.
|
||||
/// If unused this must be set to NULL.
|
||||
VOID** ItemPtr;
|
||||
VOID **ItemPtr;
|
||||
|
||||
/// Optional pointer to a field validator function.
|
||||
/// The function should directly report any appropriate error or warning
|
||||
@ -299,7 +298,7 @@ typedef struct AcpiParser {
|
||||
/// additional information about the ACPI table and make
|
||||
/// decisions about the field being validated.
|
||||
/// e.g. this could be a pointer to the ACPI table header
|
||||
VOID* Context;
|
||||
VOID *Context;
|
||||
} ACPI_PARSER;
|
||||
|
||||
/**
|
||||
@ -308,23 +307,23 @@ typedef struct AcpiParser {
|
||||
**/
|
||||
typedef struct AcpiDescriptionHeaderInfo {
|
||||
/// ACPI table signature
|
||||
UINT32* Signature;
|
||||
UINT32 *Signature;
|
||||
/// Length of the ACPI table
|
||||
UINT32* Length;
|
||||
UINT32 *Length;
|
||||
/// Revision
|
||||
UINT8* Revision;
|
||||
UINT8 *Revision;
|
||||
/// Checksum
|
||||
UINT8* Checksum;
|
||||
UINT8 *Checksum;
|
||||
/// OEM Id - length is 6 bytes
|
||||
UINT8* OemId;
|
||||
UINT8 *OemId;
|
||||
/// OEM table Id
|
||||
UINT64* OemTableId;
|
||||
UINT64 *OemTableId;
|
||||
/// OEM revision Id
|
||||
UINT32* OemRevision;
|
||||
UINT32 *OemRevision;
|
||||
/// Creator Id
|
||||
UINT32* CreatorId;
|
||||
UINT32 *CreatorId;
|
||||
/// Creator revision
|
||||
UINT32* CreatorRevision;
|
||||
UINT32 *CreatorRevision;
|
||||
} ACPI_DESCRIPTION_HEADER_INFO;
|
||||
|
||||
/**
|
||||
@ -358,10 +357,10 @@ EFIAPI
|
||||
ParseAcpi (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT32 Indent,
|
||||
IN CONST CHAR8* AsciiName OPTIONAL,
|
||||
IN UINT8* Ptr,
|
||||
IN CONST CHAR8 *AsciiName OPTIONAL,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length,
|
||||
IN CONST ACPI_PARSER* Parser,
|
||||
IN CONST ACPI_PARSER *Parser,
|
||||
IN UINT32 ParserItems
|
||||
);
|
||||
|
||||
@ -410,7 +409,7 @@ ParseAcpi (
|
||||
UINT32
|
||||
EFIAPI
|
||||
DumpGasStruct (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Indent,
|
||||
IN UINT32 Length
|
||||
);
|
||||
@ -424,8 +423,8 @@ DumpGasStruct (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpGas (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -438,7 +437,7 @@ DumpGas (
|
||||
UINT32
|
||||
EFIAPI
|
||||
DumpAcpiHeader (
|
||||
IN UINT8* Ptr
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -457,10 +456,10 @@ DumpAcpiHeader (
|
||||
UINT32
|
||||
EFIAPI
|
||||
ParseAcpiHeader (
|
||||
IN UINT8* Ptr,
|
||||
OUT CONST UINT32** Signature,
|
||||
OUT CONST UINT32** Length,
|
||||
OUT CONST UINT8** Revision
|
||||
IN UINT8 *Ptr,
|
||||
OUT CONST UINT32 **Signature,
|
||||
OUT CONST UINT32 **Length,
|
||||
OUT CONST UINT8 **Revision
|
||||
);
|
||||
|
||||
/**
|
||||
@ -479,7 +478,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiAest (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -500,7 +499,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiBgrt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -521,7 +520,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiDbg2 (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -542,7 +541,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiDsdt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -563,7 +562,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiFacs (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -584,7 +583,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiFadt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -609,7 +608,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiGtdt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -635,7 +634,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiHmat (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -664,7 +663,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiIort (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -693,7 +692,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiMadt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -714,7 +713,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiMcfg (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -736,7 +735,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiPcct (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -757,7 +756,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiPptt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -780,7 +779,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiRsdp (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -804,7 +803,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiSlit (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -825,7 +824,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiSpcr (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -852,7 +851,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiSrat (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -873,7 +872,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiSsdt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -893,7 +892,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiXsdt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "AcpiView.h"
|
||||
#include "AcpiViewConfig.h"
|
||||
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#include "Arm/SbbrValidator.h"
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#include "Arm/SbbrValidator.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -139,7 +139,7 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
GetParser (
|
||||
IN UINT32 Signature,
|
||||
OUT PARSE_ACPI_TABLE_PROC * ParserProc
|
||||
OUT PARSE_ACPI_TABLE_PROC *ParserProc
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
@ -179,15 +179,15 @@ GetParser (
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessAcpiTable (
|
||||
IN UINT8* Ptr
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN Trace;
|
||||
CONST UINT32* AcpiTableSignature;
|
||||
CONST UINT32* AcpiTableLength;
|
||||
CONST UINT8* AcpiTableRevision;
|
||||
CONST UINT8* SignaturePtr;
|
||||
CONST UINT32 *AcpiTableSignature;
|
||||
CONST UINT32 *AcpiTableLength;
|
||||
CONST UINT8 *AcpiTableRevision;
|
||||
CONST UINT8 *SignaturePtr;
|
||||
PARSE_ACPI_TABLE_PROC ParserProc;
|
||||
|
||||
ParseAcpiHeader (
|
||||
@ -209,7 +209,7 @@ ProcessAcpiTable (
|
||||
// Do not process the ACPI table any further if the table length read
|
||||
// is invalid. The ACPI table should at least contain the table header.
|
||||
if (*AcpiTableLength < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
|
||||
SignaturePtr = (CONST UINT8*)AcpiTableSignature;
|
||||
SignaturePtr = (CONST UINT8 *)AcpiTableSignature;
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid %c%c%c%c table length. Length = %d\n",
|
||||
@ -227,11 +227,12 @@ ProcessAcpiTable (
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (GetMandatoryTableValidate ()) {
|
||||
ArmSbbrIncrementTableCount (*AcpiTableSignature);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Status = GetParser (*AcpiTableSignature, &ParserProc);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -239,6 +240,7 @@ ProcessAcpiTable (
|
||||
if (Trace) {
|
||||
DumpAcpiHeader (Ptr);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,9 @@
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI * PARSE_ACPI_TABLE_PROC) (
|
||||
(EFIAPI *PARSE_ACPI_TABLE_PROC)(
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
);
|
||||
@ -101,7 +101,7 @@ DeregisterParser (
|
||||
VOID
|
||||
EFIAPI
|
||||
ProcessAcpiTable (
|
||||
IN UINT8* Ptr
|
||||
IN UINT8 *Ptr
|
||||
);
|
||||
|
||||
/**
|
||||
@ -121,7 +121,7 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
GetParser (
|
||||
IN UINT32 Signature,
|
||||
OUT PARSE_ACPI_TABLE_PROC * ParserProc
|
||||
OUT PARSE_ACPI_TABLE_PROC *ParserProc
|
||||
);
|
||||
|
||||
#endif // ACPITABLEPARSER_H_
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include "AcpiView.h"
|
||||
#include "AcpiViewConfig.h"
|
||||
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#include "Arm/SbbrValidator.h"
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#include "Arm/SbbrValidator.h"
|
||||
#endif
|
||||
|
||||
STATIC UINT32 mTableCount;
|
||||
@ -42,7 +42,7 @@ STATIC UINT32 mBinTableCount;
|
||||
STATIC
|
||||
BOOLEAN
|
||||
DumpAcpiTableToFile (
|
||||
IN CONST UINT8* Ptr,
|
||||
IN CONST UINT8 *Ptr,
|
||||
IN CONST UINTN Length
|
||||
)
|
||||
{
|
||||
@ -78,7 +78,7 @@ DumpAcpiTableToFile (
|
||||
BOOLEAN
|
||||
ProcessTableReportOptions (
|
||||
IN CONST UINT32 Signature,
|
||||
IN CONST UINT8* TablePtr,
|
||||
IN CONST UINT8 *TablePtr,
|
||||
IN CONST UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -92,7 +92,7 @@ ProcessTableReportOptions (
|
||||
// set local variables to suppress incorrect compiler/analyzer warnings
|
||||
//
|
||||
OriginalAttribute = 0;
|
||||
SignaturePtr = (UINT8*)(UINTN)&Signature;
|
||||
SignaturePtr = (UINT8 *)(UINTN)&Signature;
|
||||
Log = FALSE;
|
||||
HighLight = GetColourHighlighting ();
|
||||
GetSelectedAcpiTable (&SelectedTable);
|
||||
@ -106,6 +106,7 @@ ProcessTableReportOptions (
|
||||
Log = TRUE;
|
||||
SelectedTable->Found = TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
case ReportTableList:
|
||||
if (mTableCount == 0) {
|
||||
@ -113,15 +114,19 @@ ProcessTableReportOptions (
|
||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||
gST->ConOut->SetAttribute (
|
||||
gST->ConOut,
|
||||
EFI_TEXT_ATTR(EFI_CYAN,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
||||
EFI_TEXT_ATTR (
|
||||
EFI_CYAN,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Print (L"\nInstalled Table(s):\n");
|
||||
if (HighLight) {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
Print (
|
||||
L"\t%4d. %c%c%c%c\n",
|
||||
++mTableCount,
|
||||
@ -136,6 +141,7 @@ ProcessTableReportOptions (
|
||||
SelectedTable->Found = TRUE;
|
||||
DumpAcpiTableToFile (TablePtr, Length);
|
||||
}
|
||||
|
||||
break;
|
||||
case ReportMax:
|
||||
// We should never be here.
|
||||
@ -148,10 +154,13 @@ ProcessTableReportOptions (
|
||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||
gST->ConOut->SetAttribute (
|
||||
gST->ConOut,
|
||||
EFI_TEXT_ATTR(EFI_LIGHTBLUE,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
|
||||
EFI_TEXT_ATTR (
|
||||
EFI_LIGHTBLUE,
|
||||
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Print (
|
||||
L"\n\n --------------- %c%c%c%c Table --------------- \n\n",
|
||||
SignaturePtr[0],
|
||||
@ -167,8 +176,6 @@ ProcessTableReportOptions (
|
||||
return Log;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
This function iterates the configuration table entries in the
|
||||
system table, retrieves the RSDP pointer and starts parsing the ACPI tables.
|
||||
@ -182,17 +189,17 @@ ProcessTableReportOptions (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AcpiView (
|
||||
IN EFI_SYSTEM_TABLE* SystemTable
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
EFI_CONFIGURATION_TABLE* EfiConfigurationTable;
|
||||
EFI_CONFIGURATION_TABLE *EfiConfigurationTable;
|
||||
BOOLEAN FoundAcpiTable;
|
||||
UINTN OriginalAttribute;
|
||||
UINTN PrintAttribute;
|
||||
EREPORT_OPTION ReportOption;
|
||||
UINT8* RsdpPtr;
|
||||
UINT8 *RsdpPtr;
|
||||
UINT32 RsdpLength;
|
||||
UINT8 RsdpRevision;
|
||||
PARSE_ACPI_TABLE_PROC RsdpParserProc;
|
||||
@ -219,8 +226,11 @@ AcpiView (
|
||||
// Search the table for an entry that matches the ACPI Table Guid
|
||||
FoundAcpiTable = FALSE;
|
||||
for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
|
||||
if (CompareGuid (&gEfiAcpiTableGuid,
|
||||
&(SystemTable->ConfigurationTable[Index].VendorGuid))) {
|
||||
if (CompareGuid (
|
||||
&gEfiAcpiTableGuid,
|
||||
&(SystemTable->ConfigurationTable[Index].VendorGuid)
|
||||
))
|
||||
{
|
||||
EfiConfigurationTable = &SystemTable->ConfigurationTable[Index];
|
||||
FoundAcpiTable = TRUE;
|
||||
break;
|
||||
@ -228,7 +238,7 @@ AcpiView (
|
||||
}
|
||||
|
||||
if (FoundAcpiTable) {
|
||||
RsdpPtr = (UINT8*)EfiConfigurationTable->VendorTable;
|
||||
RsdpPtr = (UINT8 *)EfiConfigurationTable->VendorTable;
|
||||
|
||||
// The RSDP revision is 1 byte starting at offset 15
|
||||
RsdpRevision = *(RsdpPtr + RSDP_REVISION_OFFSET);
|
||||
@ -240,14 +250,15 @@ AcpiView (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (GetMandatoryTableValidate ()) {
|
||||
ArmSbbrResetTableCounts ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// The RSDP length is 4 bytes starting at offset 20
|
||||
RsdpLength = *(UINT32*)(RsdpPtr + RSDP_LENGTH_OFFSET);
|
||||
RsdpLength = *(UINT32 *)(RsdpPtr + RSDP_LENGTH_OFFSET);
|
||||
|
||||
Trace = ProcessTableReportOptions (RSDP_TABLE_INFO, RsdpPtr, RsdpLength);
|
||||
|
||||
@ -265,7 +276,6 @@ AcpiView (
|
||||
RsdpLength,
|
||||
RsdpRevision
|
||||
);
|
||||
|
||||
} else {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
@ -274,20 +284,23 @@ AcpiView (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (GetMandatoryTableValidate ()) {
|
||||
ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ());
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
ReportOption = GetReportOption ();
|
||||
if (ReportTableList != ReportOption) {
|
||||
if (((ReportSelected == ReportOption) ||
|
||||
(ReportDumpBinFile == ReportOption)) &&
|
||||
(!SelectedTable->Found)) {
|
||||
(!SelectedTable->Found))
|
||||
{
|
||||
Print (L"\nRequested ACPI Table not found.\n");
|
||||
} else if (GetConsistencyChecking () &&
|
||||
(ReportDumpBinFile != ReportOption)) {
|
||||
(ReportDumpBinFile != ReportOption))
|
||||
{
|
||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||
|
||||
Print (L"\nTable Statistics:\n");
|
||||
@ -301,6 +314,7 @@ AcpiView (
|
||||
OriginalAttribute;
|
||||
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
|
||||
}
|
||||
|
||||
Print (L"\t%d Error(s)\n", GetErrorCount ());
|
||||
|
||||
if (GetColourHighlighting ()) {
|
||||
@ -313,6 +327,7 @@ AcpiView (
|
||||
|
||||
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
|
||||
}
|
||||
|
||||
Print (L"\t%d Warning(s)\n", GetWarningCount ());
|
||||
|
||||
if (GetColourHighlighting ()) {
|
||||
@ -320,5 +335,6 @@ AcpiView (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ GetWarningCount (
|
||||
BOOLEAN
|
||||
ProcessTableReportOptions (
|
||||
IN CONST UINT32 Signature,
|
||||
IN CONST UINT8* TablePtr,
|
||||
IN CONST UINT8 *TablePtr,
|
||||
IN CONST UINT32 Length
|
||||
);
|
||||
|
||||
@ -88,7 +88,7 @@ ProcessTableReportOptions (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AcpiView (
|
||||
IN EFI_SYSTEM_TABLE* SystemTable
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
#endif // ACPIVIEW_H_
|
||||
|
@ -60,14 +60,16 @@ ConvertStrToAcpiSignature (
|
||||
|
||||
// Convert to Upper case and convert to ASCII
|
||||
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'));
|
||||
} else {
|
||||
Ptr[Index] = (CHAR8)Str[Index];
|
||||
}
|
||||
|
||||
Index++;
|
||||
}
|
||||
return *(UINT32 *) Ptr;
|
||||
|
||||
return *(UINT32 *)Ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,7 +137,7 @@ SetReportOption (
|
||||
**/
|
||||
typedef struct {
|
||||
UINT32 Type; ///< 32bit signature of the selected ACPI table.
|
||||
CONST CHAR16* Name; ///< User friendly name of the selected ACPI table.
|
||||
CONST CHAR16 *Name; ///< User friendly name of the selected ACPI table.
|
||||
BOOLEAN Found; ///< The selected table has been found in the system.
|
||||
} SELECTED_ACPI_TABLE;
|
||||
|
||||
@ -149,7 +149,7 @@ typedef struct {
|
||||
VOID
|
||||
EFIAPI
|
||||
GetSelectedAcpiTable (
|
||||
OUT SELECTED_ACPI_TABLE** SelectedAcpiTable
|
||||
OUT SELECTED_ACPI_TABLE **SelectedAcpiTable
|
||||
);
|
||||
|
||||
/**
|
||||
@ -162,7 +162,7 @@ GetSelectedAcpiTable (
|
||||
VOID
|
||||
EFIAPI
|
||||
SelectAcpiTable (
|
||||
CONST CHAR16* TableName
|
||||
CONST CHAR16 *TableName
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@
|
||||
/**
|
||||
SBBR specification version strings
|
||||
**/
|
||||
STATIC CONST CHAR8* ArmSbbrVersions[ArmSbbrVersionMax] = {
|
||||
STATIC CONST CHAR8 *ArmSbbrVersions[ArmSbbrVersionMax] = {
|
||||
"1.0", // ArmSbbrVersion_1_0
|
||||
"1.1", // ArmSbbrVersion_1_1
|
||||
"1.2" // ArmSbbrVersion_1_2
|
||||
@ -85,15 +85,15 @@ STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
|
||||
defined as 'mandatory' in any SBBR version.
|
||||
**/
|
||||
STATIC ACPI_TABLE_COUNTER ArmSbbrTableCounts[] = {
|
||||
{EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0},
|
||||
{EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, 0},
|
||||
{EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0},
|
||||
{EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, 0},
|
||||
{EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, 0},
|
||||
{EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, 0},
|
||||
{EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, 0},
|
||||
{EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, 0},
|
||||
{EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE, 0}
|
||||
{ EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0 },
|
||||
{ EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, 0 },
|
||||
{ EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0 },
|
||||
{ EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, 0 },
|
||||
{ EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, 0 },
|
||||
{ EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, 0 },
|
||||
{ EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, 0 },
|
||||
{ EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, 0 },
|
||||
{ EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE, 0 }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -160,7 +160,7 @@ ArmSbbrReqsValidate (
|
||||
UINT32 Table;
|
||||
UINT32 Index;
|
||||
UINT32 MandatoryTable;
|
||||
CONST UINT8* SignaturePtr;
|
||||
CONST UINT8 *SignaturePtr;
|
||||
BOOLEAN IsArmSbbrViolated;
|
||||
|
||||
if (Version >= ArmSbbrVersionMax) {
|
||||
@ -172,12 +172,13 @@ ArmSbbrReqsValidate (
|
||||
// Go through the list of mandatory tables for the input SBBR version
|
||||
for (Table = 0; Table < ArmSbbrReqs[Version].TableCount; Table++) {
|
||||
MandatoryTable = ArmSbbrReqs[Version].Tables[Table];
|
||||
SignaturePtr = (CONST UINT8*)(UINTN)&MandatoryTable;
|
||||
SignaturePtr = (CONST UINT8 *)(UINTN)&MandatoryTable;
|
||||
|
||||
// Locate the instance count for the table with the given signature
|
||||
Index = 0;
|
||||
while ((Index < ARRAY_SIZE (ArmSbbrTableCounts)) &&
|
||||
(ArmSbbrTableCounts[Index].Signature != MandatoryTable)) {
|
||||
(ArmSbbrTableCounts[Index].Signature != MandatoryTable))
|
||||
{
|
||||
Index++;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ typedef struct AcpiTableCounter {
|
||||
ACPI table SBBR requirements.
|
||||
**/
|
||||
typedef struct AcpiSbbrReq {
|
||||
CONST UINT32* Tables; /// List of required tables
|
||||
CONST UINT32 *Tables; /// List of required tables
|
||||
CONST UINT32 TableCount; /// Number of elements in Tables
|
||||
} ACPI_SBBR_REQ;
|
||||
|
||||
|
@ -19,15 +19,15 @@
|
||||
|
||||
// Local variables
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
STATIC UINT8* AestNodeType;
|
||||
STATIC UINT16* AestNodeLength;
|
||||
STATIC UINT32* NodeDataOffset;
|
||||
STATIC UINT32* NodeInterfaceOffset;
|
||||
STATIC UINT32* NodeInterruptArrayOffset;
|
||||
STATIC UINT32* NodeInterruptCount;
|
||||
STATIC UINT32* ProcessorId;
|
||||
STATIC UINT8* ProcessorFlags;
|
||||
STATIC UINT8* ProcessorResourceType;
|
||||
STATIC UINT8 *AestNodeType;
|
||||
STATIC UINT16 *AestNodeLength;
|
||||
STATIC UINT32 *NodeDataOffset;
|
||||
STATIC UINT32 *NodeInterfaceOffset;
|
||||
STATIC UINT32 *NodeInterruptArrayOffset;
|
||||
STATIC UINT32 *NodeInterruptCount;
|
||||
STATIC UINT32 *ProcessorId;
|
||||
STATIC UINT8 *ProcessorFlags;
|
||||
STATIC UINT8 *ProcessorResourceType;
|
||||
|
||||
/**
|
||||
Validate Processor Flags.
|
||||
@ -40,16 +40,18 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateProcessorFlags (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
// If the global or shared node flag is set then the ACPI Processor ID
|
||||
// field must be set to 0 and ignored.
|
||||
if (((*Ptr & 0x3) != 0) && (*ProcessorId != 0)) {
|
||||
IncrementErrorCount ();
|
||||
Print (L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global"
|
||||
L" or shared nodes.");
|
||||
Print (
|
||||
L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global"
|
||||
L" or shared nodes."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,13 +66,13 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateGicInterfaceType (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT32 GicInterfaceType;
|
||||
|
||||
GicInterfaceType = *(UINT32*)Ptr;
|
||||
GicInterfaceType = *(UINT32 *)Ptr;
|
||||
if (GicInterfaceType > 3) {
|
||||
IncrementErrorCount ();
|
||||
Print (L"\nError: Invalid GIC Interface type %d", GicInterfaceType);
|
||||
@ -88,8 +90,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateInterfaceType (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*Ptr > 1) {
|
||||
@ -109,8 +111,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateInterruptType (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*Ptr > 1) {
|
||||
@ -130,8 +132,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateInterruptFlags (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if ((*Ptr & 0xfe) != 0) {
|
||||
@ -149,8 +151,8 @@ ValidateInterruptFlags (
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpVendorSpecificData (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
Print (
|
||||
@ -191,19 +193,19 @@ STATIC CONST ACPI_PARSER AestParser[] = {
|
||||
An ACPI_PARSER array describing the AEST Node Header.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = {
|
||||
{L"Type", 1, 0, L"%d", NULL, (VOID**)&AestNodeType, NULL, NULL},
|
||||
{L"Length", 2, 1, L"%d", NULL, (VOID**)&AestNodeLength, NULL, NULL},
|
||||
{L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Node Data Offset", 4, 4, L"%d", NULL, (VOID**)&NodeDataOffset, NULL, NULL},
|
||||
{L"Node Interface Offset", 4, 8, L"%d", NULL,
|
||||
(VOID**)&NodeInterfaceOffset, NULL, NULL},
|
||||
{L"Node Interrupt Array Offset", 4, 12, L"%d", NULL,
|
||||
(VOID**)&NodeInterruptArrayOffset, NULL, NULL},
|
||||
{L"Node Interrupt Count", 4, 16, L"%d", NULL,
|
||||
(VOID**)&NodeInterruptCount, NULL, NULL},
|
||||
{L"Timestamp Rate", 8, 20, L"%ld", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Error Injection Countdown Rate", 8, 36, L"%ld", NULL, NULL, NULL, NULL}
|
||||
{ L"Type", 1, 0, L"%d", NULL, (VOID **)&AestNodeType, NULL, NULL },
|
||||
{ L"Length", 2, 1, L"%d", NULL, (VOID **)&AestNodeLength, NULL, NULL },
|
||||
{ L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Node Data Offset", 4, 4, L"%d", NULL, (VOID **)&NodeDataOffset, NULL, NULL },
|
||||
{ L"Node Interface Offset", 4, 8, L"%d", NULL,
|
||||
(VOID **)&NodeInterfaceOffset, NULL, NULL },
|
||||
{ L"Node Interrupt Array Offset", 4, 12, L"%d", NULL,
|
||||
(VOID **)&NodeInterruptArrayOffset, NULL, NULL },
|
||||
{ L"Node Interrupt Count", 4, 16, L"%d", NULL,
|
||||
(VOID **)&NodeInterruptCount, NULL, NULL },
|
||||
{ L"Timestamp Rate", 8, 20, L"%ld", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Error Injection Countdown Rate", 8, 36, L"%ld", NULL, NULL, NULL, NULL }
|
||||
// Node specific data...
|
||||
// Node interface...
|
||||
// Node interrupt array...
|
||||
@ -213,15 +215,15 @@ STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = {
|
||||
An ACPI_PARSER array describing the Processor error node specific data.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestProcessorStructure[] = {
|
||||
{L"ACPI Processor ID", 4, 0, L"0x%x", NULL, (VOID**)&ProcessorId, NULL, NULL},
|
||||
{L"Resource Type", 1, 4, L"%d", NULL, (VOID**)&ProcessorResourceType, NULL,
|
||||
NULL},
|
||||
{L"Reserved", 1, 5, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 1, 6, L"0x%x", NULL, (VOID**)&ProcessorFlags,
|
||||
ValidateProcessorFlags, NULL},
|
||||
{L"Revision", 1, 7, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Processor Affinity Level Indicator", 8, 8, L"0x%lx", NULL, NULL, NULL,
|
||||
NULL},
|
||||
{ L"ACPI Processor ID", 4, 0, L"0x%x", NULL, (VOID **)&ProcessorId, NULL, NULL },
|
||||
{ L"Resource Type", 1, 4, L"%d", NULL, (VOID **)&ProcessorResourceType, NULL,
|
||||
NULL },
|
||||
{ L"Reserved", 1, 5, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 1, 6, L"0x%x", NULL, (VOID **)&ProcessorFlags,
|
||||
ValidateProcessorFlags, NULL },
|
||||
{ L"Revision", 1, 7, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Processor Affinity Level Indicator", 8, 8, L"0x%lx", NULL, NULL, NULL,
|
||||
NULL },
|
||||
// Resource specific data...
|
||||
};
|
||||
|
||||
@ -229,83 +231,83 @@ STATIC CONST ACPI_PARSER AestProcessorStructure[] = {
|
||||
An ACPI_PARSER array describing the processor cache resource substructure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestProcessorCacheResourceSubstructure[] = {
|
||||
{L"Cache reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL}
|
||||
{ L"Cache reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the processor TLB resource substructure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestProcessorTlbResourceSubstructure[] = {
|
||||
{L"TLB reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL}
|
||||
{ L"TLB reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the processor generic resource substructure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestProcessorGenericResourceSubstructure[] = {
|
||||
{L"Vendor-defined data", 4, 0, L"%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Vendor-defined data", 4, 0, L"%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the memory controller structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestMemoryControllerStructure[] = {
|
||||
{L"Proximity Domain", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Proximity Domain", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the SMMU structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestSmmuStructure[] = {
|
||||
{L"IORT Node reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SubComponent reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"IORT Node reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SubComponent reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the vendor-defined structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestVendorDefinedStructure[] = {
|
||||
{L"Hardware ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Unique ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Vendor-specific data", 16, 8, NULL, DumpVendorSpecificData, NULL, NULL}
|
||||
{ L"Hardware ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Unique ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Vendor-specific data", 16, 8, NULL, DumpVendorSpecificData, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the GIC structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestGicStructure[] = {
|
||||
{L"GIC Interface Type", 4, 0, L"0x%x", NULL, NULL, ValidateGicInterfaceType,
|
||||
NULL},
|
||||
{L"GIC Interface reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"GIC Interface Type", 4, 0, L"0x%x", NULL, NULL, ValidateGicInterfaceType,
|
||||
NULL },
|
||||
{ L"GIC Interface reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the node interface.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestNodeInterface[] = {
|
||||
{L"Interface Type", 1, 0, L"%d", NULL, NULL, ValidateInterfaceType, NULL},
|
||||
{L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Start Error Record Index", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Number of Error Records", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Error Records Implemented", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Error Records Support", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Addressing mode", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}
|
||||
{ L"Interface Type", 1, 0, L"%d", NULL, NULL, ValidateInterfaceType, NULL },
|
||||
{ L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Start Error Record Index", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Number of Error Records", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Error Records Implemented", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Error Records Support", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Addressing mode", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the node interrupts.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER AestNodeInterrupt[] = {
|
||||
{L"Interrupt Type", 1, 0, L"%d", NULL, NULL, ValidateInterruptType, NULL},
|
||||
{L"Reserved", 2, 1, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Interrupt Flags", 1, 3, L"0x%x", NULL, NULL, ValidateInterruptFlags, NULL},
|
||||
{L"Interrupt GSIV", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved1", 3, 9, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
|
||||
{ L"Interrupt Type", 1, 0, L"%d", NULL, NULL, ValidateInterruptType, NULL },
|
||||
{ L"Reserved", 2, 1, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Interrupt Flags", 1, 3, L"0x%x", NULL, NULL, ValidateInterruptFlags, NULL },
|
||||
{ L"Interrupt GSIV", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved1", 3, 9, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -318,7 +320,7 @@ STATIC CONST ACPI_PARSER AestNodeInterrupt[] = {
|
||||
STATIC
|
||||
VOID
|
||||
DumpProcessorNode (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -337,7 +339,8 @@ DumpProcessorNode (
|
||||
// successfully read.
|
||||
if ((ProcessorId == NULL) ||
|
||||
(ProcessorResourceType == NULL) ||
|
||||
(ProcessorFlags == NULL)) {
|
||||
(ProcessorFlags == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient Processor Error Node length. Length = %d.\n",
|
||||
@ -393,7 +396,7 @@ DumpProcessorNode (
|
||||
STATIC
|
||||
VOID
|
||||
DumpMemoryControllerNode (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -416,7 +419,7 @@ DumpMemoryControllerNode (
|
||||
STATIC
|
||||
VOID
|
||||
DumpSmmuNode (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -439,7 +442,7 @@ DumpSmmuNode (
|
||||
STATIC
|
||||
VOID
|
||||
DumpVendorDefinedNode (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -462,7 +465,7 @@ DumpVendorDefinedNode (
|
||||
STATIC
|
||||
VOID
|
||||
DumpGicNode (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -485,7 +488,7 @@ DumpGicNode (
|
||||
STATIC
|
||||
VOID
|
||||
DumpNodeInterface (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -509,7 +512,7 @@ DumpNodeInterface (
|
||||
STATIC
|
||||
VOID
|
||||
DumpNodeInterrupts (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length,
|
||||
IN UINT32 InterruptCount
|
||||
)
|
||||
@ -521,7 +524,7 @@ DumpNodeInterrupts (
|
||||
if (Length < (InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT))) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Node not long enough for Interrupt Array.\n"\
|
||||
L"ERROR: Node not long enough for Interrupt Array.\n" \
|
||||
L" Length left = %d, Required = %d, Interrupt Count = %d\n",
|
||||
Length,
|
||||
(InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT)),
|
||||
@ -547,7 +550,7 @@ DumpNodeInterrupts (
|
||||
Length - Offset,
|
||||
PARSER_PARAMS (AestNodeInterrupt)
|
||||
);
|
||||
} //for
|
||||
} // for
|
||||
}
|
||||
|
||||
/**
|
||||
@ -564,7 +567,7 @@ DumpNodeInterrupts (
|
||||
STATIC
|
||||
VOID
|
||||
DumpAestNodeStructure (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length,
|
||||
IN UINT8 NodeType,
|
||||
IN UINT32 DataOffset,
|
||||
@ -575,7 +578,7 @@ DumpAestNodeStructure (
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT32 RemainingLength;
|
||||
UINT8* NodeDataPtr;
|
||||
UINT8 *NodeDataPtr;
|
||||
|
||||
Offset = ParseAcpi (
|
||||
TRUE,
|
||||
@ -589,7 +592,7 @@ DumpAestNodeStructure (
|
||||
if ((Offset > DataOffset) || (DataOffset > Length)) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Node Data Offset: %d.\n"\
|
||||
L"ERROR: Invalid Node Data Offset: %d.\n" \
|
||||
L" It should be between %d and %d.\n",
|
||||
DataOffset,
|
||||
Offset,
|
||||
@ -600,7 +603,7 @@ DumpAestNodeStructure (
|
||||
if ((Offset > InterfaceOffset) || (InterfaceOffset > Length)) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Node Interface Offset: %d.\n"\
|
||||
L"ERROR: Invalid Node Interface Offset: %d.\n" \
|
||||
L" It should be between %d and %d.\n",
|
||||
InterfaceOffset,
|
||||
Offset,
|
||||
@ -611,7 +614,7 @@ DumpAestNodeStructure (
|
||||
if ((Offset > InterruptArrayOffset) || (InterruptArrayOffset > Length)) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Node Interrupt Array Offset: %d.\n"\
|
||||
L"ERROR: Invalid Node Interrupt Array Offset: %d.\n" \
|
||||
L" It should be between %d and %d.\n",
|
||||
InterruptArrayOffset,
|
||||
Offset,
|
||||
@ -676,13 +679,13 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiAest (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT8* NodePtr;
|
||||
UINT8 *NodePtr;
|
||||
|
||||
if (!Trace) {
|
||||
return;
|
||||
@ -716,10 +719,11 @@ ParseAcpiAest (
|
||||
(NodeDataOffset == NULL) ||
|
||||
(NodeInterfaceOffset == NULL) ||
|
||||
(NodeInterruptArrayOffset == NULL) ||
|
||||
(NodeInterruptCount == NULL)) {
|
||||
(NodeInterruptCount == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient length left for Node Structure.\n"\
|
||||
L"ERROR: Insufficient length left for Node Structure.\n" \
|
||||
L" Length left = %d.\n",
|
||||
AcpiTableLength - Offset
|
||||
);
|
||||
@ -728,7 +732,8 @@ ParseAcpiAest (
|
||||
|
||||
// Validate AEST Node length
|
||||
if ((*AestNodeLength == 0) ||
|
||||
((Offset + (*AestNodeLength)) > AcpiTableLength)) {
|
||||
((Offset + (*AestNodeLength)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid AEST Node length. " \
|
||||
|
@ -21,12 +21,12 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER BgrtParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Version", 2, 36, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Status", 1, 38, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Image Type", 1, 39, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Image Address", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Image Offset X", 4, 48, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Image Offset Y", 4, 52, L"%d", NULL, NULL, NULL, NULL}
|
||||
{ L"Version", 2, 36, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Status", 1, 38, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Image Type", 1, 39, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Image Address", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Image Offset X", 4, 48, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Image Offset Y", 4, 52, L"%d", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -45,7 +45,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiBgrt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
|
@ -14,16 +14,16 @@
|
||||
#include "AcpiTableParser.h"
|
||||
|
||||
// Local variables pointing to the table fields
|
||||
STATIC CONST UINT32* OffsetDbgDeviceInfo;
|
||||
STATIC CONST UINT32* NumberDbgDeviceInfo;
|
||||
STATIC CONST UINT16* DbgDevInfoLen;
|
||||
STATIC CONST UINT8* GasCount;
|
||||
STATIC CONST UINT16* NameSpaceStringLength;
|
||||
STATIC CONST UINT16* NameSpaceStringOffset;
|
||||
STATIC CONST UINT16* OEMDataLength;
|
||||
STATIC CONST UINT16* OEMDataOffset;
|
||||
STATIC CONST UINT16* BaseAddrRegOffset;
|
||||
STATIC CONST UINT16* AddrSizeOffset;
|
||||
STATIC CONST UINT32 *OffsetDbgDeviceInfo;
|
||||
STATIC CONST UINT32 *NumberDbgDeviceInfo;
|
||||
STATIC CONST UINT16 *DbgDevInfoLen;
|
||||
STATIC CONST UINT8 *GasCount;
|
||||
STATIC CONST UINT16 *NameSpaceStringLength;
|
||||
STATIC CONST UINT16 *NameSpaceStringOffset;
|
||||
STATIC CONST UINT16 *OEMDataLength;
|
||||
STATIC CONST UINT16 *OEMDataOffset;
|
||||
STATIC CONST UINT16 *BaseAddrRegOffset;
|
||||
STATIC CONST UINT16 *AddrSizeOffset;
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
/**
|
||||
@ -37,13 +37,13 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateNameSpaceStrLen (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT16 NameSpaceStrLen;
|
||||
|
||||
NameSpaceStrLen = *(UINT16*)Ptr;
|
||||
NameSpaceStrLen = *(UINT16 *)Ptr;
|
||||
|
||||
if (NameSpaceStrLen < 2) {
|
||||
IncrementErrorCount ();
|
||||
@ -58,43 +58,43 @@ ValidateNameSpaceStrLen (
|
||||
/// An ACPI_PARSER array describing the ACPI DBG2 table.
|
||||
STATIC CONST ACPI_PARSER Dbg2Parser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"OffsetDbgDeviceInfo", 4, 36, L"0x%x", NULL,
|
||||
(VOID**)&OffsetDbgDeviceInfo, NULL, NULL},
|
||||
{L"NumberDbgDeviceInfo", 4, 40, L"%d", NULL,
|
||||
(VOID**)&NumberDbgDeviceInfo, NULL, NULL}
|
||||
{ L"OffsetDbgDeviceInfo", 4, 36, L"0x%x", NULL,
|
||||
(VOID **)&OffsetDbgDeviceInfo, NULL, NULL },
|
||||
{ L"NumberDbgDeviceInfo", 4, 40, L"%d", NULL,
|
||||
(VOID **)&NumberDbgDeviceInfo, NULL, NULL }
|
||||
};
|
||||
|
||||
/// An ACPI_PARSER array describing the debug device information structure
|
||||
/// header.
|
||||
STATIC CONST ACPI_PARSER DbgDevInfoHeaderParser[] = {
|
||||
{L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 2, 1, L"%d", NULL, (VOID**)&DbgDevInfoLen, NULL, NULL}
|
||||
{ L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 2, 1, L"%d", NULL, (VOID **)&DbgDevInfoLen, NULL, NULL }
|
||||
};
|
||||
|
||||
/// An ACPI_PARSER array describing the debug device information.
|
||||
STATIC CONST ACPI_PARSER DbgDevInfoParser[] = {
|
||||
{L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{ L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Generic Address Registers Count", 1, 3, L"0x%x", NULL,
|
||||
(VOID**)&GasCount, NULL, NULL},
|
||||
{L"NameSpace String Length", 2, 4, L"%d", NULL,
|
||||
(VOID**)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL},
|
||||
{L"NameSpace String Offset", 2, 6, L"0x%x", NULL,
|
||||
(VOID**)&NameSpaceStringOffset, NULL, NULL},
|
||||
{L"OEM Data Length", 2, 8, L"%d", NULL, (VOID**)&OEMDataLength,
|
||||
NULL, NULL},
|
||||
{L"OEM Data Offset", 2, 10, L"0x%x", NULL, (VOID**)&OEMDataOffset,
|
||||
NULL, NULL},
|
||||
{ L"Generic Address Registers Count", 1, 3, L"0x%x", NULL,
|
||||
(VOID **)&GasCount, NULL, NULL },
|
||||
{ L"NameSpace String Length", 2, 4, L"%d", NULL,
|
||||
(VOID **)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL },
|
||||
{ L"NameSpace String Offset", 2, 6, L"0x%x", NULL,
|
||||
(VOID **)&NameSpaceStringOffset, NULL, NULL },
|
||||
{ L"OEM Data Length", 2, 8, L"%d", NULL, (VOID **)&OEMDataLength,
|
||||
NULL, NULL },
|
||||
{ L"OEM Data Offset", 2, 10, L"0x%x", NULL, (VOID **)&OEMDataOffset,
|
||||
NULL, NULL },
|
||||
|
||||
{L"Port Type", 2, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Port SubType", 2, 14, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 16, L"%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Port Type", 2, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Port SubType", 2, 14, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 16, L"%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Base Address Register Offset", 2, 18, L"0x%x", NULL,
|
||||
(VOID**)&BaseAddrRegOffset, NULL, NULL},
|
||||
{L"Address Size Offset", 2, 20, L"0x%x", NULL,
|
||||
(VOID**)&AddrSizeOffset, NULL, NULL}
|
||||
{ L"Base Address Register Offset", 2, 18, L"0x%x", NULL,
|
||||
(VOID **)&BaseAddrRegOffset, NULL, NULL },
|
||||
{ L"Address Size Offset", 2, 20, L"0x%x", NULL,
|
||||
(VOID **)&AddrSizeOffset, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -107,7 +107,7 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpDbgDeviceInfo (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length
|
||||
)
|
||||
{
|
||||
@ -131,7 +131,8 @@ DumpDbgDeviceInfo (
|
||||
(OEMDataLength == NULL) ||
|
||||
(OEMDataOffset == NULL) ||
|
||||
(BaseAddrRegOffset == NULL) ||
|
||||
(AddrSizeOffset == NULL)) {
|
||||
(AddrSizeOffset == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient Debug Device Information Structure length. " \
|
||||
@ -145,7 +146,8 @@ DumpDbgDeviceInfo (
|
||||
Index = 0;
|
||||
Offset = *BaseAddrRegOffset;
|
||||
while ((Index++ < *GasCount) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
PrintFieldName (4, L"BaseAddressRegister");
|
||||
Offset += (UINT16)DumpGasStruct (
|
||||
Ptr + Offset,
|
||||
@ -171,9 +173,10 @@ DumpDbgDeviceInfo (
|
||||
Index = 0;
|
||||
Offset = *AddrSizeOffset;
|
||||
while ((Index++ < *GasCount) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
PrintFieldName (4, L"Address Size");
|
||||
Print (L"0x%x\n", *((UINT32*)(Ptr + Offset)));
|
||||
Print (L"0x%x\n", *((UINT32 *)(Ptr + Offset)));
|
||||
Offset += sizeof (UINT32);
|
||||
}
|
||||
|
||||
@ -182,10 +185,12 @@ DumpDbgDeviceInfo (
|
||||
Offset = *NameSpaceStringOffset;
|
||||
PrintFieldName (4, L"NameSpace String");
|
||||
while ((Index++ < *NameSpaceStringLength) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
Print (L"%c", *(Ptr + Offset));
|
||||
Offset++;
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
|
||||
// OEM Data
|
||||
@ -194,13 +199,16 @@ DumpDbgDeviceInfo (
|
||||
Offset = *OEMDataOffset;
|
||||
PrintFieldName (4, L"OEM Data");
|
||||
while ((Index++ < *OEMDataLength) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
Print (L"%x ", *(Ptr + Offset));
|
||||
if ((Index & 7) == 0) {
|
||||
Print (L"\n%-*s ", OUTPUT_FIELD_COLUMN_WIDTH, L"");
|
||||
}
|
||||
|
||||
Offset++;
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
}
|
||||
}
|
||||
@ -221,7 +229,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiDbg2 (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
@ -245,7 +253,8 @@ ParseAcpiDbg2 (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((OffsetDbgDeviceInfo == NULL) ||
|
||||
(NumberDbgDeviceInfo == NULL)) {
|
||||
(NumberDbgDeviceInfo == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient table length. AcpiTableLength = %d\n",
|
||||
@ -258,7 +267,6 @@ ParseAcpiDbg2 (
|
||||
Index = 0;
|
||||
|
||||
while (Index++ < *NumberDbgDeviceInfo) {
|
||||
|
||||
// Parse the Debug Device Information Structure header to obtain Length
|
||||
ParseAcpi (
|
||||
FALSE,
|
||||
@ -284,7 +292,8 @@ ParseAcpiDbg2 (
|
||||
|
||||
// Validate Debug Device Information Structure length
|
||||
if ((*DbgDevInfoLen == 0) ||
|
||||
((Offset + (*DbgDevInfoLen)) > AcpiTableLength)) {
|
||||
((Offset + (*DbgDevInfoLen)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Debug Device Information Structure length. " \
|
||||
|
@ -29,7 +29,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiDsdt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
|
@ -17,22 +17,22 @@
|
||||
An ACPI_PARSER array describing the ACPI FACS Table.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER FacsParser[] = {
|
||||
{L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL},
|
||||
{L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
|
||||
{L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
|
||||
NULL},
|
||||
{L"Reserved", 8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
|
||||
NULL},
|
||||
{L"Reserved", 8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
|
||||
NULL}
|
||||
{ L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL },
|
||||
{ L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL },
|
||||
{ L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
|
||||
NULL },
|
||||
{ L"Reserved", 8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
|
||||
NULL },
|
||||
{ L"Reserved", 8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
|
||||
NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -51,7 +51,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiFacs (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
|
@ -15,12 +15,12 @@
|
||||
#include "AcpiView.h"
|
||||
|
||||
// Local variables
|
||||
STATIC CONST UINT32* DsdtAddress;
|
||||
STATIC CONST UINT64* X_DsdtAddress;
|
||||
STATIC CONST UINT32* Flags;
|
||||
STATIC CONST UINT32* FirmwareCtrl;
|
||||
STATIC CONST UINT64* X_FirmwareCtrl;
|
||||
STATIC CONST UINT8* FadtMinorRevision;
|
||||
STATIC CONST UINT32 *DsdtAddress;
|
||||
STATIC CONST UINT64 *X_DsdtAddress;
|
||||
STATIC CONST UINT32 *Flags;
|
||||
STATIC CONST UINT32 *FirmwareCtrl;
|
||||
STATIC CONST UINT64 *X_FirmwareCtrl;
|
||||
STATIC CONST UINT8 *FadtMinorRevision;
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
/**
|
||||
@ -63,18 +63,19 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateFirmwareCtrl (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
)
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (*(UINT32*)Ptr != 0) {
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (*(UINT32 *)Ptr != 0) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nERROR: Firmware Control must be zero for ARM platforms."
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,18 +89,19 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateXFirmwareCtrl (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
)
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (*(UINT64*)Ptr != 0) {
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (*(UINT64 *)Ptr != 0) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nERROR: X Firmware Control must be zero for ARM platforms."
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,18 +115,19 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateFlags (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
)
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (((*(UINT32*)Ptr) & HW_REDUCED_ACPI) == 0) {
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (((*(UINT32 *)Ptr) & HW_REDUCED_ACPI) == 0) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms."
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,64 +135,64 @@ ValidateFlags (
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER FadtParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID**)&FirmwareCtrl,
|
||||
ValidateFirmwareCtrl, NULL},
|
||||
{L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL},
|
||||
{L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL},
|
||||
{L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SCI_INT", 2, 46, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SMI_CMD", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ACPI_ENABLE", 1, 52, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ACPI_DISABLE", 1, 53, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"S4BIOS_REQ", 1, 54, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PSTATE_CNT", 1, 55, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM1a_EVT_BLK", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM1b_EVT_BLK", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM1a_CNT_BLK", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM1b_CNT_BLK", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM2_CNT_BLK", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM_TMR_BLK", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"GPE0_BLK", 4, 80, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"GPE1_BLK", 4, 84, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM1_EVT_LEN", 1, 88, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM1_CNT_LEN", 1, 89, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM2_CNT_LEN", 1, 90, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PM_TMR_LEN", 1, 91, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"GPE0_BLK_LEN", 1, 92, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"GPE1_BLK_LEN", 1, 93, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"GPE1_BASE", 1, 94, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"CST_CNT", 1, 95, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"P_LVL2_LAT", 2, 96, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"P_LVL3_LAT", 2, 98, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"FLUSH_SIZE", 2, 100, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"FLUSH_STRIDE", 2, 102, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"DUTY_OFFSET", 1, 104, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"DUTY_WIDTH", 1, 105, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"DAY_ALRM", 1, 106, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"MON_ALRM", 1, 107, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 112, L"0x%x", NULL, (VOID**)&Flags, ValidateFlags, NULL},
|
||||
{L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID**)&FadtMinorRevision,
|
||||
NULL, NULL},
|
||||
{L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID**)&X_FirmwareCtrl,
|
||||
ValidateXFirmwareCtrl, NULL},
|
||||
{L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID**)&X_DsdtAddress, NULL, NULL},
|
||||
{L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"X_PM1b_EVT_BLK", 12, 160, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"X_PM1a_CNT_BLK", 12, 172, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"X_PM1b_CNT_BLK", 12, 184, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"X_PM2_CNT_BLK", 12, 196, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"X_PM_TMR_BLK", 12, 208, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"X_GPE0_BLK", 12, 220, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"X_GPE1_BLK", 12, 232, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"SLEEP_CONTROL_REG", 12, 244, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"SLEEP_STATUS_REG", 12, 256, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL}
|
||||
{ L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID **)&FirmwareCtrl,
|
||||
ValidateFirmwareCtrl, NULL },
|
||||
{ L"DSDT", 4, 40, L"0x%x", NULL, (VOID **)&DsdtAddress, NULL, NULL },
|
||||
{ L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SCI_INT", 2, 46, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SMI_CMD", 4, 48, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ACPI_ENABLE", 1, 52, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ACPI_DISABLE", 1, 53, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"S4BIOS_REQ", 1, 54, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PSTATE_CNT", 1, 55, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM1a_EVT_BLK", 4, 56, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM1b_EVT_BLK", 4, 60, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM1a_CNT_BLK", 4, 64, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM1b_CNT_BLK", 4, 68, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM2_CNT_BLK", 4, 72, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM_TMR_BLK", 4, 76, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"GPE0_BLK", 4, 80, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"GPE1_BLK", 4, 84, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM1_EVT_LEN", 1, 88, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM1_CNT_LEN", 1, 89, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM2_CNT_LEN", 1, 90, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PM_TMR_LEN", 1, 91, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"GPE0_BLK_LEN", 1, 92, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"GPE1_BLK_LEN", 1, 93, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"GPE1_BASE", 1, 94, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"CST_CNT", 1, 95, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"P_LVL2_LAT", 2, 96, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"P_LVL3_LAT", 2, 98, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"FLUSH_SIZE", 2, 100, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"FLUSH_STRIDE", 2, 102, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"DUTY_OFFSET", 1, 104, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"DUTY_WIDTH", 1, 105, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"DAY_ALRM", 1, 106, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"MON_ALRM", 1, 107, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 112, L"0x%x", NULL, (VOID **)&Flags, ValidateFlags, NULL },
|
||||
{ L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID **)&FadtMinorRevision,
|
||||
NULL, NULL },
|
||||
{ L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID **)&X_FirmwareCtrl,
|
||||
ValidateXFirmwareCtrl, NULL },
|
||||
{ L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID **)&X_DsdtAddress, NULL, NULL },
|
||||
{ L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"X_PM1b_EVT_BLK", 12, 160, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"X_PM1a_CNT_BLK", 12, 172, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"X_PM1b_CNT_BLK", 12, 184, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"X_PM2_CNT_BLK", 12, 196, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"X_PM_TMR_BLK", 12, 208, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"X_GPE0_BLK", 12, 220, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"X_GPE1_BLK", 12, 232, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"SLEEP_CONTROL_REG", 12, 244, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"SLEEP_STATUS_REG", 12, 256, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -207,14 +210,14 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiFadt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8* DsdtPtr;
|
||||
UINT8* FirmwareCtrlPtr;
|
||||
UINT8 *DsdtPtr;
|
||||
UINT8 *FirmwareCtrlPtr;
|
||||
UINT32 FacsSignature;
|
||||
UINT32 FacsLength;
|
||||
UINT8 FacsRevision;
|
||||
@ -245,9 +248,9 @@ ParseAcpiFadt (
|
||||
// If X_FIRMWARE_CTRL is not zero then use X_FIRMWARE_CTRL and ignore
|
||||
// FIRMWARE_CTRL, else use FIRMWARE_CTRL.
|
||||
if ((X_FirmwareCtrl != NULL) && (*X_FirmwareCtrl != 0)) {
|
||||
FirmwareCtrlPtr = (UINT8*)(UINTN)(*X_FirmwareCtrl);
|
||||
FirmwareCtrlPtr = (UINT8 *)(UINTN)(*X_FirmwareCtrl);
|
||||
} else if ((FirmwareCtrl != NULL) && (*FirmwareCtrl != 0)) {
|
||||
FirmwareCtrlPtr = (UINT8*)(UINTN)(*FirmwareCtrl);
|
||||
FirmwareCtrlPtr = (UINT8 *)(UINTN)(*FirmwareCtrl);
|
||||
} else {
|
||||
FirmwareCtrlPtr = NULL;
|
||||
// if HW_REDUCED_ACPI flag is not set, both FIRMWARE_CTRL and
|
||||
@ -255,10 +258,13 @@ ParseAcpiFadt (
|
||||
// present.
|
||||
if ((Trace) &&
|
||||
(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 ();
|
||||
Print (L"ERROR: No FACS table found, "
|
||||
L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n");
|
||||
Print (
|
||||
L"ERROR: No FACS table found, "
|
||||
L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,13 +272,13 @@ ParseAcpiFadt (
|
||||
// The FACS table does not have a standard ACPI table header. Therefore,
|
||||
// the signature, length and version needs to be initially parsed.
|
||||
// The FACS signature is 4 bytes starting at offset 0.
|
||||
FacsSignature = *(UINT32*)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET);
|
||||
FacsSignature = *(UINT32 *)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET);
|
||||
|
||||
// The FACS length is 4 bytes starting at offset 4.
|
||||
FacsLength = *(UINT32*)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET);
|
||||
FacsLength = *(UINT32 *)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET);
|
||||
|
||||
// The FACS version is 1 byte starting at offset 32.
|
||||
FacsRevision = *(UINT8*)(FirmwareCtrlPtr + FACS_VERSION_OFFSET);
|
||||
FacsRevision = *(UINT8 *)(FirmwareCtrlPtr + FACS_VERSION_OFFSET);
|
||||
|
||||
Trace = ProcessTableReportOptions (
|
||||
FacsSignature,
|
||||
@ -298,12 +304,12 @@ ParseAcpiFadt (
|
||||
|
||||
// If X_DSDT is valid then use X_DSDT and ignore DSDT, else use DSDT.
|
||||
if ((X_DsdtAddress != NULL) && (*X_DsdtAddress != 0)) {
|
||||
DsdtPtr = (UINT8*)(UINTN)(*X_DsdtAddress);
|
||||
DsdtPtr = (UINT8 *)(UINTN)(*X_DsdtAddress);
|
||||
} else if ((DsdtAddress != NULL) && (*DsdtAddress != 0)) {
|
||||
DsdtPtr = (UINT8*)(UINTN)(*DsdtAddress);
|
||||
DsdtPtr = (UINT8 *)(UINTN)(*DsdtAddress);
|
||||
} else {
|
||||
// Both DSDT and X_DSDT cannot be invalid.
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (Trace) {
|
||||
// The DSDT Table is mandatory for ARM systems
|
||||
// as the CPU information MUST be presented in
|
||||
@ -311,7 +317,8 @@ ParseAcpiFadt (
|
||||
IncrementErrorCount ();
|
||||
Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
||||
#define GT_BLOCK_TIMER_COUNT_MAX 8
|
||||
|
||||
// Local variables
|
||||
STATIC CONST UINT32* GtdtPlatformTimerCount;
|
||||
STATIC CONST UINT32* GtdtPlatformTimerOffset;
|
||||
STATIC CONST UINT8* PlatformTimerType;
|
||||
STATIC CONST UINT16* PlatformTimerLength;
|
||||
STATIC CONST UINT32* GtBlockTimerCount;
|
||||
STATIC CONST UINT32* GtBlockTimerOffset;
|
||||
STATIC CONST UINT32 *GtdtPlatformTimerCount;
|
||||
STATIC CONST UINT32 *GtdtPlatformTimerOffset;
|
||||
STATIC CONST UINT8 *PlatformTimerType;
|
||||
STATIC CONST UINT16 *PlatformTimerLength;
|
||||
STATIC CONST UINT32 *GtBlockTimerCount;
|
||||
STATIC CONST UINT32 *GtBlockTimerOffset;
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
/**
|
||||
@ -37,13 +37,13 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateGtBlockTimerCount (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT32 BlockTimerCount;
|
||||
|
||||
BlockTimerCount = *(UINT32*)Ptr;
|
||||
BlockTimerCount = *(UINT32 *)Ptr;
|
||||
|
||||
if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) {
|
||||
IncrementErrorCount ();
|
||||
@ -66,13 +66,13 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateGtFrameNumber (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT8 FrameNumber;
|
||||
|
||||
FrameNumber = *(UINT8*)Ptr;
|
||||
FrameNumber = *(UINT8 *)Ptr;
|
||||
|
||||
if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) {
|
||||
IncrementErrorCount ();
|
||||
@ -89,80 +89,80 @@ ValidateGtFrameNumber (
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GtdtParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"CntControlBase Physical Address", 8, 36, L"0x%lx", NULL, NULL,
|
||||
NULL, NULL},
|
||||
{L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"CntControlBase Physical Address",8, 36, L"0x%lx", NULL, NULL,
|
||||
NULL, NULL },
|
||||
{ L"Reserved", 4, 44, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
{ L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
{ L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
|
||||
{L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
{ L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
|
||||
{L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
{ L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
|
||||
{L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
{ L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
|
||||
{L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Platform Timer Count", 4, 88, L"%d", NULL,
|
||||
(VOID**)&GtdtPlatformTimerCount, NULL, NULL},
|
||||
{L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
|
||||
(VOID**)&GtdtPlatformTimerOffset, NULL, NULL},
|
||||
{L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Platform Timer Count", 4, 88, L"%d", NULL,
|
||||
(VOID **)&GtdtPlatformTimerCount, NULL, NULL },
|
||||
{ L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
|
||||
(VOID **)&GtdtPlatformTimerOffset,NULL, NULL },
|
||||
{ L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
{ L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL,NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Platform timer header.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = {
|
||||
{L"Type", 1, 0, NULL, NULL, (VOID**)&PlatformTimerType, NULL, NULL},
|
||||
{L"Length", 2, 1, NULL, NULL, (VOID**)&PlatformTimerLength, NULL, NULL},
|
||||
{L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL}
|
||||
{ L"Type", 1, 0, NULL, NULL, (VOID **)&PlatformTimerType, NULL, NULL },
|
||||
{ L"Length", 2, 1, NULL, NULL, (VOID **)&PlatformTimerLength, NULL, NULL },
|
||||
{ L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Platform GT Block.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GtBlockParser[] = {
|
||||
{L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL},
|
||||
{L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Timer Count", 4, 12, L"%d", NULL, (VOID**)&GtBlockTimerCount,
|
||||
ValidateGtBlockTimerCount, NULL},
|
||||
{L"Timer Offset", 4, 16, L"%d", NULL, (VOID**)&GtBlockTimerOffset, NULL,
|
||||
NULL}
|
||||
{ L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Timer Count", 4, 12, L"%d", NULL, (VOID **)&GtBlockTimerCount,
|
||||
ValidateGtBlockTimerCount, NULL },
|
||||
{ L"Timer Offset", 4, 16, L"%d", NULL, (VOID **)&GtBlockTimerOffset, NULL,
|
||||
NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the GT Block timer.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {
|
||||
{L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, NULL},
|
||||
{L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
|
||||
{L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL,
|
||||
NULL},
|
||||
{L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, NULL },
|
||||
{ L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL },
|
||||
{ L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL,
|
||||
NULL },
|
||||
{ L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Platform Watchdog.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {
|
||||
{L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL},
|
||||
{L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL },
|
||||
{ L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -174,7 +174,7 @@ STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {
|
||||
STATIC
|
||||
VOID
|
||||
DumpGTBlock (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length
|
||||
)
|
||||
{
|
||||
@ -193,7 +193,8 @@ DumpGTBlock (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((GtBlockTimerCount == NULL) ||
|
||||
(GtBlockTimerOffset == NULL)) {
|
||||
(GtBlockTimerOffset == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
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
|
||||
// Structure buffer length. Whichever is minimum.
|
||||
while ((Index++ < *GtBlockTimerCount) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
Offset += ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -229,7 +231,7 @@ DumpGTBlock (
|
||||
STATIC
|
||||
VOID
|
||||
DumpWatchdogTimer (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length
|
||||
)
|
||||
{
|
||||
@ -263,14 +265,14 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiGtdt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
UINT32 Offset;
|
||||
UINT8* TimerPtr;
|
||||
UINT8 *TimerPtr;
|
||||
|
||||
if (!Trace) {
|
||||
return;
|
||||
@ -288,7 +290,8 @@ ParseAcpiGtdt (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((GtdtPlatformTimerCount == NULL) ||
|
||||
(GtdtPlatformTimerOffset == NULL)) {
|
||||
(GtdtPlatformTimerOffset == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
|
||||
@ -304,7 +307,8 @@ ParseAcpiGtdt (
|
||||
// Parse the specified number of Platform Timer Structures or the GTDT
|
||||
// buffer length. Whichever is minimum.
|
||||
while ((Index++ < *GtdtPlatformTimerCount) &&
|
||||
(Offset < AcpiTableLength)) {
|
||||
(Offset < AcpiTableLength))
|
||||
{
|
||||
// Parse the Platform Timer Header to obtain Length and Type
|
||||
ParseAcpi (
|
||||
FALSE,
|
||||
@ -318,7 +322,8 @@ ParseAcpiGtdt (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((PlatformTimerType == NULL) ||
|
||||
(PlatformTimerLength == NULL)) {
|
||||
(PlatformTimerLength == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
@ -330,7 +335,8 @@ ParseAcpiGtdt (
|
||||
|
||||
// Validate Platform Timer Structure length
|
||||
if ((*PlatformTimerLength == 0) ||
|
||||
((Offset + (*PlatformTimerLength)) > AcpiTableLength)) {
|
||||
((Offset + (*PlatformTimerLength)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Platform Timer Structure length. " \
|
||||
|
@ -24,24 +24,24 @@
|
||||
#define MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX 10
|
||||
|
||||
// Local variables
|
||||
STATIC CONST UINT16* HmatStructureType;
|
||||
STATIC CONST UINT32* HmatStructureLength;
|
||||
STATIC CONST UINT16 *HmatStructureType;
|
||||
STATIC CONST UINT32 *HmatStructureLength;
|
||||
|
||||
STATIC CONST UINT32* NumberInitiatorProximityDomain;
|
||||
STATIC CONST UINT32* NumberTargetProximityDomain;
|
||||
STATIC CONST UINT32 *NumberInitiatorProximityDomain;
|
||||
STATIC CONST UINT32 *NumberTargetProximityDomain;
|
||||
STATIC CONST
|
||||
EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_FLAGS*
|
||||
SllbiFlags;
|
||||
EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_FLAGS *
|
||||
SllbiFlags;
|
||||
|
||||
STATIC CONST UINT8* SllbiDataType;
|
||||
STATIC CONST UINT16* NumberSMBIOSHandles;
|
||||
STATIC CONST UINT8 *SllbiDataType;
|
||||
STATIC CONST UINT16 *NumberSMBIOSHandles;
|
||||
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
/**
|
||||
Names of System Locality Latency Bandwidth Information (SLLBI) data types
|
||||
**/
|
||||
STATIC CONST CHAR16* SllbiNames[] = {
|
||||
STATIC CONST CHAR16 *SllbiNames[] = {
|
||||
L"Access %sLatency%s",
|
||||
L"Read %sLatency%s",
|
||||
L"Write %sLatency%s",
|
||||
@ -61,15 +61,15 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateCacheAttributes (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*
|
||||
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
|
||||
Attributes;
|
||||
|
||||
Attributes =
|
||||
(EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*)Ptr;
|
||||
(EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *)Ptr;
|
||||
|
||||
if (Attributes->TotalCacheLevels > 0x3) {
|
||||
IncrementErrorCount ();
|
||||
@ -78,6 +78,7 @@ ValidateCacheAttributes (
|
||||
Attributes->TotalCacheLevels
|
||||
);
|
||||
}
|
||||
|
||||
if (Attributes->CacheLevel > 0x3) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
@ -85,6 +86,7 @@ ValidateCacheAttributes (
|
||||
Attributes->CacheLevel
|
||||
);
|
||||
}
|
||||
|
||||
if (Attributes->CacheAssociativity > 0x2) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
@ -92,6 +94,7 @@ ValidateCacheAttributes (
|
||||
Attributes->CacheAssociativity
|
||||
);
|
||||
}
|
||||
|
||||
if (Attributes->WritePolicy > 0x2) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
@ -111,15 +114,15 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpCacheAttributes (
|
||||
IN CONST CHAR16* Format OPTIONAL,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format OPTIONAL,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*
|
||||
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
|
||||
Attributes;
|
||||
|
||||
Attributes =
|
||||
(EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*)Ptr;
|
||||
(EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *)Ptr;
|
||||
|
||||
Print (L"\n");
|
||||
PrintFieldName (4, L"Total Cache Levels");
|
||||
@ -139,16 +142,16 @@ DumpCacheAttributes (
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER HmatParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Reserved", 4, 36, NULL, NULL, NULL, NULL, NULL}
|
||||
{ L"Reserved", 4,36, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the HMAT structure header.
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER HmatStructureHeaderParser[] = {
|
||||
{L"Type", 2, 0, NULL, NULL, (VOID**)&HmatStructureType, NULL, NULL},
|
||||
{L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL},
|
||||
{L"Length", 4, 4, NULL, NULL, (VOID**)&HmatStructureLength, NULL, NULL}
|
||||
{ L"Type", 2, 0, NULL, NULL, (VOID **)&HmatStructureType, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 4, 4, NULL, NULL, (VOID **)&HmatStructureLength, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -156,16 +159,16 @@ STATIC CONST ACPI_PARSER HmatStructureHeaderParser[] = {
|
||||
Structure - Type 0.
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER MemProximityDomainAttributeParser[] = {
|
||||
{L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 10, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Proximity Dom for initiator", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Proximity Dom for memory", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
|
||||
{ L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 10, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Proximity Dom for initiator", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Proximity Dom for memory", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -173,19 +176,19 @@ STATIC CONST ACPI_PARSER MemProximityDomainAttributeParser[] = {
|
||||
Information Structure - Type 1.
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER SllbiParser[] = {
|
||||
{L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 1, 8, L"0x%x", NULL, (VOID**)&SllbiFlags, NULL, NULL},
|
||||
{L"Data type", 1, 9, L"0x%x", NULL, (VOID**)&SllbiDataType, NULL, NULL},
|
||||
{L"Min Transfer Size", 1, 10, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 1, 11, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Initiator Proximity Dom Count", 4, 12, L"%d", NULL,
|
||||
(VOID**)&NumberInitiatorProximityDomain, NULL, NULL},
|
||||
{L"Target Proximity Dom Count", 4, 16, L"%d", NULL,
|
||||
(VOID**)&NumberTargetProximityDomain, NULL, NULL},
|
||||
{L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Entry Base Unit", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}
|
||||
{ L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 1, 8, L"0x%x", NULL, (VOID **)&SllbiFlags, NULL, NULL },
|
||||
{ L"Data type", 1, 9, L"0x%x", NULL, (VOID **)&SllbiDataType, NULL, NULL },
|
||||
{ L"Min Transfer Size", 1, 10, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 1, 11, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Initiator Proximity Dom Count", 4, 12, L"%d", NULL,
|
||||
(VOID **)&NumberInitiatorProximityDomain, NULL, NULL },
|
||||
{ L"Target Proximity Dom Count", 4, 16, L"%d", NULL,
|
||||
(VOID **)&NumberTargetProximityDomain, NULL, NULL },
|
||||
{ L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Entry Base Unit", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL }
|
||||
// initiator Proximity Domain list ...
|
||||
// target Proximity Domain list ...
|
||||
// Latency/Bandwidth matrix ...
|
||||
@ -196,17 +199,17 @@ STATIC CONST ACPI_PARSER SllbiParser[] = {
|
||||
Structure - Type 2.
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = {
|
||||
{L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Proximity Dom for memory", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Memory Side Cache Size", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Cache Attributes", 4, 24, NULL, DumpCacheAttributes, NULL,
|
||||
ValidateCacheAttributes, NULL},
|
||||
{L"Reserved", 2, 28, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SMBIOS Handle Count", 2, 30, L"%d", NULL,
|
||||
(VOID**)&NumberSMBIOSHandles, NULL, NULL}
|
||||
{ L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Proximity Dom for memory", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Memory Side Cache Size", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Cache Attributes", 4, 24, NULL, DumpCacheAttributes, NULL,
|
||||
ValidateCacheAttributes, NULL },
|
||||
{ L"Reserved", 2, 28, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SMBIOS Handle Count", 2, 30, L"%d", NULL,
|
||||
(VOID **)&NumberSMBIOSHandles, NULL, NULL }
|
||||
// SMBIOS handles List ...
|
||||
};
|
||||
|
||||
@ -222,7 +225,7 @@ STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = {
|
||||
STATIC
|
||||
VOID
|
||||
DumpMpda (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
@ -248,13 +251,13 @@ DumpMpda (
|
||||
STATIC
|
||||
VOID
|
||||
DumpSllbi (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
CONST UINT32* InitiatorProximityDomainList;
|
||||
CONST UINT32* TargetProximityDomainList;
|
||||
CONST UINT16* LatencyBandwidthMatrix;
|
||||
CONST UINT32 *InitiatorProximityDomainList;
|
||||
CONST UINT32 *TargetProximityDomainList;
|
||||
CONST UINT16 *LatencyBandwidthMatrix;
|
||||
UINT32 Offset;
|
||||
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
|
||||
CHAR16 SecondBuffer[OUTPUT_FIELD_COLUMN_WIDTH];
|
||||
@ -278,7 +281,8 @@ DumpSllbi (
|
||||
if ((SllbiFlags == NULL) ||
|
||||
(SllbiDataType == NULL) ||
|
||||
(NumberInitiatorProximityDomain == NULL) ||
|
||||
(NumberTargetProximityDomain == NULL)) {
|
||||
(NumberTargetProximityDomain == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
@ -306,10 +310,10 @@ DumpSllbi (
|
||||
return;
|
||||
}
|
||||
|
||||
InitiatorProximityDomainList = (UINT32*) (Ptr + Offset);
|
||||
InitiatorProximityDomainList = (UINT32 *)(Ptr + Offset);
|
||||
TargetProximityDomainList = InitiatorProximityDomainList +
|
||||
*NumberInitiatorProximityDomain;
|
||||
LatencyBandwidthMatrix = (UINT16*) (TargetProximityDomainList +
|
||||
LatencyBandwidthMatrix = (UINT16 *)(TargetProximityDomainList +
|
||||
*NumberTargetProximityDomain);
|
||||
|
||||
// Display each element of the Initiator Proximity Domain list
|
||||
@ -350,6 +354,7 @@ DumpSllbi (
|
||||
Print (L"Error: Unkown Data Type. DataType = 0x%x.\n", *SllbiDataType);
|
||||
return;
|
||||
}
|
||||
|
||||
StrCpyS (Buffer, sizeof (Buffer), SllbiNames[*SllbiDataType]);
|
||||
|
||||
// Adjust base name depending on Memory Hierarchy in this Structure
|
||||
@ -381,7 +386,6 @@ DumpSllbi (
|
||||
SllbiFlags->MemoryHierarchy
|
||||
);
|
||||
return;
|
||||
|
||||
} // switch
|
||||
|
||||
if (*NumberTargetProximityDomain <= MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX) {
|
||||
@ -400,34 +404,41 @@ DumpSllbi (
|
||||
|
||||
for (IndexTarget = 0;
|
||||
IndexTarget < *NumberTargetProximityDomain;
|
||||
IndexTarget++) {
|
||||
IndexTarget++)
|
||||
{
|
||||
Print (L" %2d", IndexTarget);
|
||||
}
|
||||
|
||||
Print (L"\n ---+");
|
||||
for (IndexTarget = 0;
|
||||
IndexTarget < *NumberTargetProximityDomain;
|
||||
IndexTarget++) {
|
||||
IndexTarget++)
|
||||
{
|
||||
Print (L"------");
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
|
||||
TargetStartOffset = 0;
|
||||
for (IndexInitiator = 0;
|
||||
IndexInitiator < *NumberInitiatorProximityDomain;
|
||||
IndexInitiator++) {
|
||||
IndexInitiator++)
|
||||
{
|
||||
Print (L" %2d |", IndexInitiator);
|
||||
for (IndexTarget = 0;
|
||||
IndexTarget < *NumberTargetProximityDomain;
|
||||
IndexTarget++) {
|
||||
IndexTarget++)
|
||||
{
|
||||
Print (
|
||||
L" %5d",
|
||||
LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
|
||||
);
|
||||
} // for Target
|
||||
|
||||
Print (L"\n");
|
||||
TargetStartOffset += (*NumberTargetProximityDomain);
|
||||
} // for Initiator
|
||||
|
||||
Print (L"\n");
|
||||
} else {
|
||||
// Display the latency/bandwidth matrix as a list
|
||||
@ -441,10 +452,12 @@ DumpSllbi (
|
||||
TargetStartOffset = 0;
|
||||
for (IndexInitiator = 0;
|
||||
IndexInitiator < *NumberInitiatorProximityDomain;
|
||||
IndexInitiator++) {
|
||||
IndexInitiator++)
|
||||
{
|
||||
for (IndexTarget = 0;
|
||||
IndexTarget < *NumberTargetProximityDomain;
|
||||
IndexTarget++) {
|
||||
IndexTarget++)
|
||||
{
|
||||
UnicodeSPrint (
|
||||
SecondBuffer,
|
||||
sizeof (SecondBuffer),
|
||||
@ -459,6 +472,7 @@ DumpSllbi (
|
||||
LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
|
||||
);
|
||||
} // for Target
|
||||
|
||||
TargetStartOffset += (*NumberTargetProximityDomain);
|
||||
} // for Initiator
|
||||
}
|
||||
@ -474,11 +488,11 @@ DumpSllbi (
|
||||
STATIC
|
||||
VOID
|
||||
DumpMsci (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length
|
||||
)
|
||||
{
|
||||
CONST UINT16* SMBIOSHandlesList;
|
||||
CONST UINT16 *SMBIOSHandlesList;
|
||||
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
|
||||
UINT32 Offset;
|
||||
UINT16 Index;
|
||||
@ -515,7 +529,7 @@ DumpMsci (
|
||||
return;
|
||||
}
|
||||
|
||||
SMBIOSHandlesList = (UINT16*) (Ptr + Offset);
|
||||
SMBIOSHandlesList = (UINT16 *)(Ptr + Offset);
|
||||
|
||||
for (Index = 0; Index < *NumberSMBIOSHandles; Index++) {
|
||||
UnicodeSPrint (
|
||||
@ -554,13 +568,13 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiHmat (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT8* HmatStructurePtr;
|
||||
UINT8 *HmatStructurePtr;
|
||||
|
||||
if (!Trace) {
|
||||
return;
|
||||
@ -591,7 +605,8 @@ ParseAcpiHmat (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((HmatStructureType == NULL) ||
|
||||
(HmatStructureLength == NULL)) {
|
||||
(HmatStructureLength == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
@ -603,7 +618,8 @@ ParseAcpiHmat (
|
||||
|
||||
// Validate HMAT Structure length.
|
||||
if ((*HmatStructureLength == 0) ||
|
||||
((Offset + (*HmatStructureLength)) > AcpiTableLength)) {
|
||||
((Offset + (*HmatStructureLength)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid HMAT Structure length. " \
|
||||
|
@ -18,20 +18,20 @@
|
||||
// Local variables
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
STATIC CONST UINT32* IortNodeCount;
|
||||
STATIC CONST UINT32* IortNodeOffset;
|
||||
STATIC CONST UINT32 *IortNodeCount;
|
||||
STATIC CONST UINT32 *IortNodeOffset;
|
||||
|
||||
STATIC CONST UINT8* IortNodeType;
|
||||
STATIC CONST UINT16* IortNodeLength;
|
||||
STATIC CONST UINT32* IortIdMappingCount;
|
||||
STATIC CONST UINT32* IortIdMappingOffset;
|
||||
STATIC CONST UINT8 *IortNodeType;
|
||||
STATIC CONST UINT16 *IortNodeLength;
|
||||
STATIC CONST UINT32 *IortIdMappingCount;
|
||||
STATIC CONST UINT32 *IortIdMappingOffset;
|
||||
|
||||
STATIC CONST UINT32* InterruptContextCount;
|
||||
STATIC CONST UINT32* InterruptContextOffset;
|
||||
STATIC CONST UINT32* PmuInterruptCount;
|
||||
STATIC CONST UINT32* PmuInterruptOffset;
|
||||
STATIC CONST UINT32 *InterruptContextCount;
|
||||
STATIC CONST UINT32 *InterruptContextOffset;
|
||||
STATIC CONST UINT32 *PmuInterruptCount;
|
||||
STATIC CONST UINT32 *PmuInterruptOffset;
|
||||
|
||||
STATIC CONST UINT32* ItsCount;
|
||||
STATIC CONST UINT32 *ItsCount;
|
||||
|
||||
/**
|
||||
This function validates the ID Mapping array count for the ITS node.
|
||||
@ -44,11 +44,11 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateItsIdMappingCount (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*(UINT32*)Ptr != 0) {
|
||||
if (*(UINT32 *)Ptr != 0) {
|
||||
IncrementErrorCount ();
|
||||
Print (L"\nERROR: IORT ID Mapping count must be zero.");
|
||||
}
|
||||
@ -66,11 +66,11 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidatePmcgIdMappingCount (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*(UINT32*)Ptr > 1) {
|
||||
if (*(UINT32 *)Ptr > 1) {
|
||||
IncrementErrorCount ();
|
||||
Print (L"\nERROR: IORT ID Mapping count must not be greater than 1.");
|
||||
}
|
||||
@ -87,11 +87,11 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateItsIdArrayReference (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*(UINT32*)Ptr != 0) {
|
||||
if (*(UINT32 *)Ptr != 0) {
|
||||
IncrementErrorCount ();
|
||||
Print (L"\nERROR: IORT ID Mapping offset must be zero.");
|
||||
}
|
||||
@ -121,11 +121,11 @@ ValidateItsIdArrayReference (
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IortParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Number of IORT Nodes", 4, 36, L"%d", NULL,
|
||||
(VOID**)&IortNodeCount, NULL, NULL},
|
||||
{L"Offset to Array of IORT Nodes", 4, 40, L"0x%x", NULL,
|
||||
(VOID**)&IortNodeOffset, NULL, NULL},
|
||||
{L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Number of IORT Nodes", 4, 36, L"%d", NULL,
|
||||
(VOID **)&IortNodeCount, NULL, NULL },
|
||||
{ L"Offset to Array of IORT Nodes",4, 40, L"0x%x", NULL,
|
||||
(VOID **)&IortNodeOffset, NULL, NULL },
|
||||
{ L"Reserved", 4, 44, L"0x%x", NULL,NULL,NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -140,45 +140,45 @@ STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = {
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = {
|
||||
PARSE_IORT_NODE_HEADER (NULL, NULL),
|
||||
{L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Span", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Model", 4, 32, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reference to Global Interrupt Array", 4, 40, L"0x%x", NULL, NULL, NULL,
|
||||
NULL},
|
||||
{L"Number of context interrupts", 4, 44, L"%d", NULL,
|
||||
(VOID**)&InterruptContextCount, NULL, NULL},
|
||||
{L"Reference to Context Interrupt Array", 4, 48, L"0x%x", NULL,
|
||||
(VOID**)&InterruptContextOffset, NULL, NULL},
|
||||
{L"Number of PMU Interrupts", 4, 52, L"%d", NULL,
|
||||
(VOID**)&PmuInterruptCount, NULL, NULL},
|
||||
{L"Reference to PMU Interrupt Array", 4, 56, L"0x%x", NULL,
|
||||
(VOID**)&PmuInterruptOffset, NULL, NULL},
|
||||
{ L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Span", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Model", 4, 32, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reference to Global Interrupt Array",4, 40, L"0x%x", NULL, NULL, NULL,
|
||||
NULL },
|
||||
{ L"Number of context interrupts", 4, 44, L"%d", NULL,
|
||||
(VOID **)&InterruptContextCount, NULL, NULL },
|
||||
{ L"Reference to Context Interrupt Array",4, 48, L"0x%x", NULL,
|
||||
(VOID **)&InterruptContextOffset, NULL, NULL },
|
||||
{ L"Number of PMU Interrupts", 4, 52, L"%d", NULL,
|
||||
(VOID **)&PmuInterruptCount, NULL, NULL },
|
||||
{ L"Reference to PMU Interrupt Array",4, 56, L"0x%x", NULL,
|
||||
(VOID **)&PmuInterruptOffset, NULL, NULL },
|
||||
|
||||
// Interrupt Array
|
||||
{L"SMMU_NSgIrpt", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SMMU_NSgIrpt interrupt flags", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SMMU_NSgCfgIrpt", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SMMU_NSgCfgIrpt interrupt flags", 4, 72, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"SMMU_NSgIrpt", 4, 60, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SMMU_NSgIrpt interrupt flags", 4, 64, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SMMU_NSgCfgIrpt", 4, 68, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SMMU_NSgCfgIrpt interrupt flags",4, 72, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER InterruptArrayParser[] = {
|
||||
{L"Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the IORT ID Mapping.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IortNodeIdMappingParser[] = {
|
||||
{L"Input base", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Number of IDs", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Output base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Input base", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Number of IDs", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Output base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -186,17 +186,17 @@ STATIC CONST ACPI_PARSER IortNodeIdMappingParser[] = {
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = {
|
||||
PARSE_IORT_NODE_HEADER (NULL, NULL),
|
||||
{L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"VATOS Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Model", 4, 40, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Event", 4, 44, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Proximity domain", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Device ID mapping index", 4, 64, L"%d", NULL, NULL, NULL, NULL}
|
||||
{ L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"VATOS Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Model", 4, 40, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Event", 4, 44, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Proximity domain", 4, 60, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Device ID mapping index", 4, 64, L"%d", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -207,7 +207,7 @@ STATIC CONST ACPI_PARSER IortNodeItsParser[] = {
|
||||
ValidateItsIdMappingCount,
|
||||
ValidateItsIdArrayReference
|
||||
),
|
||||
{L"Number of ITSs", 4, 16, L"%d", NULL, (VOID**)&ItsCount, NULL}
|
||||
{ L"Number of ITSs", 4,16, L"%d", NULL, (VOID **)&ItsCount, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -222,9 +222,9 @@ STATIC CONST ACPI_PARSER ItsIdParser[] = {
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = {
|
||||
PARSE_IORT_NODE_HEADER (NULL, NULL),
|
||||
{L"Node Flags", 4, 16, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Memory access properties", 8, 20, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Device memory address size limit", 1, 28, L"%d", NULL, NULL, NULL, NULL}
|
||||
{ L"Node Flags", 4, 16, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Memory access properties",8, 20, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Device memory address size limit",1, 28, L"%d", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -232,11 +232,11 @@ STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = {
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = {
|
||||
PARSE_IORT_NODE_HEADER (NULL, NULL),
|
||||
{L"Memory access properties", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Memory access size limit", 1, 32, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
|
||||
{ L"Memory access properties",8, 16, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Memory access size limit",1, 32, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -244,10 +244,10 @@ STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = {
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
|
||||
PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL),
|
||||
{L"Page 0 Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
|
||||
{ L"Page 0 Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -260,7 +260,7 @@ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
|
||||
STATIC
|
||||
VOID
|
||||
DumpIortNodeIdMappings (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 Length,
|
||||
IN UINT32 MappingCount
|
||||
)
|
||||
@ -273,7 +273,8 @@ DumpIortNodeIdMappings (
|
||||
Offset = 0;
|
||||
|
||||
while ((Index < MappingCount) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
@ -304,7 +305,7 @@ DumpIortNodeIdMappings (
|
||||
STATIC
|
||||
VOID
|
||||
DumpIortNodeSmmuV1V2 (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length,
|
||||
IN UINT32 MappingCount,
|
||||
IN UINT32 MappingOffset
|
||||
@ -328,7 +329,8 @@ DumpIortNodeSmmuV1V2 (
|
||||
if ((InterruptContextCount == NULL) ||
|
||||
(InterruptContextOffset == NULL) ||
|
||||
(PmuInterruptCount == NULL) ||
|
||||
(PmuInterruptOffset == NULL)) {
|
||||
(PmuInterruptOffset == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient SMMUv1/2 node length. Length = %d\n",
|
||||
@ -341,7 +343,8 @@ DumpIortNodeSmmuV1V2 (
|
||||
Index = 0;
|
||||
|
||||
while ((Index < *InterruptContextCount) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
@ -363,7 +366,8 @@ DumpIortNodeSmmuV1V2 (
|
||||
Index = 0;
|
||||
|
||||
while ((Index < *PmuInterruptCount) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
@ -400,7 +404,7 @@ DumpIortNodeSmmuV1V2 (
|
||||
STATIC
|
||||
VOID
|
||||
DumpIortNodeSmmuV3 (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length,
|
||||
IN UINT32 MappingCount,
|
||||
IN UINT32 MappingOffset
|
||||
@ -431,7 +435,7 @@ DumpIortNodeSmmuV3 (
|
||||
STATIC
|
||||
VOID
|
||||
DumpIortNodeIts (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length
|
||||
)
|
||||
{
|
||||
@ -462,7 +466,8 @@ DumpIortNodeIts (
|
||||
Index = 0;
|
||||
|
||||
while ((Index < *ItsCount) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
AsciiSPrint (
|
||||
Buffer,
|
||||
sizeof (Buffer),
|
||||
@ -481,7 +486,6 @@ DumpIortNodeIts (
|
||||
}
|
||||
|
||||
// Note: ITS does not have the ID Mappings Array
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -496,7 +500,7 @@ DumpIortNodeIts (
|
||||
STATIC
|
||||
VOID
|
||||
DumpIortNodeNamedComponent (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length,
|
||||
IN UINT32 MappingCount,
|
||||
IN UINT32 MappingOffset
|
||||
@ -517,10 +521,12 @@ DumpIortNodeNamedComponent (
|
||||
PrintFieldName (2, L"Device Object Name");
|
||||
|
||||
while ((*(Ptr + Offset) != 0) &&
|
||||
(Offset < Length)) {
|
||||
(Offset < Length))
|
||||
{
|
||||
Print (L"%c", *(Ptr + Offset));
|
||||
Offset++;
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
|
||||
DumpIortNodeIdMappings (
|
||||
@ -542,7 +548,7 @@ DumpIortNodeNamedComponent (
|
||||
STATIC
|
||||
VOID
|
||||
DumpIortNodeRootComplex (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length,
|
||||
IN UINT32 MappingCount,
|
||||
IN UINT32 MappingOffset
|
||||
@ -576,11 +582,11 @@ DumpIortNodeRootComplex (
|
||||
STATIC
|
||||
VOID
|
||||
DumpIortNodePmcg (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT16 Length,
|
||||
IN UINT32 MappingCount,
|
||||
IN UINT32 MappingOffset
|
||||
)
|
||||
)
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
@ -621,14 +627,14 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiIort (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT32 Index;
|
||||
UINT8* NodePtr;
|
||||
UINT8 *NodePtr;
|
||||
|
||||
if (!Trace) {
|
||||
return;
|
||||
@ -646,7 +652,8 @@ ParseAcpiIort (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((IortNodeCount == NULL) ||
|
||||
(IortNodeOffset == NULL)) {
|
||||
(IortNodeOffset == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
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.
|
||||
// Whichever is minimum.
|
||||
while ((Index++ < *IortNodeCount) &&
|
||||
(Offset < AcpiTableLength)) {
|
||||
(Offset < AcpiTableLength))
|
||||
{
|
||||
// Parse the IORT Node Header
|
||||
ParseAcpi (
|
||||
FALSE,
|
||||
@ -678,7 +686,8 @@ ParseAcpiIort (
|
||||
if ((IortNodeType == NULL) ||
|
||||
(IortNodeLength == NULL) ||
|
||||
(IortIdMappingCount == NULL) ||
|
||||
(IortIdMappingOffset == NULL)) {
|
||||
(IortIdMappingOffset == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
@ -690,7 +699,8 @@ ParseAcpiIort (
|
||||
|
||||
// Validate IORT Node length
|
||||
if ((*IortNodeLength == 0) ||
|
||||
((Offset + (*IortNodeLength)) > AcpiTableLength)) {
|
||||
((Offset + (*IortNodeLength)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid IORT Node length. " \
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "MadtParser.h"
|
||||
|
||||
// Local Variables
|
||||
STATIC CONST UINT8* MadtInterruptControllerType;
|
||||
STATIC CONST UINT8* MadtInterruptControllerLength;
|
||||
STATIC CONST UINT8 *MadtInterruptControllerType;
|
||||
STATIC CONST UINT8 *MadtInterruptControllerLength;
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
/**
|
||||
@ -34,11 +34,11 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateGICDSystemVectorBase (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
)
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*(UINT32*)Ptr != 0) {
|
||||
if (*(UINT32 *)Ptr != 0) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nERROR: System Vector Base must be zero."
|
||||
@ -57,13 +57,13 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateSpeOverflowInterrupt (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT16 SpeOverflowInterrupt;
|
||||
|
||||
SpeOverflowInterrupt = *(UINT16*)Ptr;
|
||||
SpeOverflowInterrupt = *(UINT16 *)Ptr;
|
||||
|
||||
// SPE not supported by this processor
|
||||
if (SpeOverflowInterrupt == 0) {
|
||||
@ -73,7 +73,8 @@ ValidateSpeOverflowInterrupt (
|
||||
if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) ||
|
||||
((SpeOverflowInterrupt > ARM_PPI_ID_MAX) &&
|
||||
(SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) ||
|
||||
(SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) {
|
||||
(SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID "
|
||||
@ -85,7 +86,7 @@ ValidateSpeOverflowInterrupt (
|
||||
ARM_PPI_ID_EXTENDED_MAX
|
||||
);
|
||||
} else if (SpeOverflowInterrupt != ARM_PPI_ID_PMBIRQ) {
|
||||
IncrementWarningCount();
|
||||
IncrementWarningCount ();
|
||||
Print (
|
||||
L"\nWARNING: SPE Overflow Interrupt ID of %d is not compliant with SBSA "
|
||||
L"Level 3 PPI ID assignment: %d.",
|
||||
@ -99,137 +100,136 @@ ValidateSpeOverflowInterrupt (
|
||||
An ACPI_PARSER array describing the GICC Interrupt Controller Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GicCParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"CPU Interface Number", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ACPI Processor UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Parking Protocol Version", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"CPU Interface Number", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ACPI Processor UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Parking Protocol Version", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Performance Interrupt GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Parked Address", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Physical Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"GICV", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"GICH", 8, 48, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"VGIC Maintenance interrupt", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"GICR Base Address", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL,
|
||||
NULL},
|
||||
{L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SPE overflow Interrupt", 2, 78, L"0x%x", NULL, NULL,
|
||||
ValidateSpeOverflowInterrupt, NULL}
|
||||
{ L"Performance Interrupt GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Parked Address", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Physical Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"GICV", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"GICH", 8, 48, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"VGIC Maintenance interrupt", 4, 56, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"GICR Base Address", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL,
|
||||
NULL },
|
||||
{ L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SPE overflow Interrupt", 2, 78, L"0x%x", NULL, NULL,
|
||||
ValidateSpeOverflowInterrupt, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the GICD Interrupt Controller Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GicDParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"GIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"System Vector Base", 4, 16, L"0x%x", NULL, NULL,
|
||||
ValidateGICDSystemVectorBase, NULL},
|
||||
{L"GIC Version", 1, 20, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
|
||||
{ L"GIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"System Vector Base", 4, 16, L"0x%x", NULL, NULL,
|
||||
ValidateGICDSystemVectorBase, NULL },
|
||||
{ L"GIC Version", 1, 20, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the MSI Frame Interrupt Controller Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GicMSIFrameParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"MSI Frame ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"MSI Frame ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the GICR Interrupt Controller Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GicRParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Discovery Range Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL,
|
||||
NULL},
|
||||
{L"Discovery Range Length", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Discovery Range Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL,
|
||||
NULL },
|
||||
{ L"Discovery Range Length", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the GIC ITS Interrupt Controller Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER GicITSParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"GIC ITS ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"GIC ITS ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the IO APIC Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IoApic[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"I/O APIC ID", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"I/O APIC Address", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Global System Interrupt Base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"I/O APIC ID", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"I/O APIC Address", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Global System Interrupt Base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Interrupt Source Override Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER InterruptSourceOverride[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Bus", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Source", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Global System Interrupt", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Bus", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Source", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Global System Interrupt", 4, 4, 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.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER ProcessorLocalX2Apic[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"X2APIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"X2APIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Local x2APIC NMI Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER LocalX2ApicNmi[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"ACPI Processor UID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Local x2APIC LINT#", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 3, 9, L"0x%x%x%x", Dump3Chars, NULL, NULL, NULL}
|
||||
{ L"ACPI Processor UID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Local x2APIC LINT#", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 3, 9, L"0x%x%x%x", Dump3Chars, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -237,19 +237,19 @@ STATIC CONST ACPI_PARSER LocalX2ApicNmi[] = {
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER MadtParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Local Interrupt Controller Address", 4, 36, L"0x%x", NULL, NULL, NULL,
|
||||
NULL},
|
||||
{L"Flags", 4, 40, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Local Interrupt Controller Address",4, 36, L"0x%x", NULL, NULL, NULL,
|
||||
NULL },
|
||||
{ L"Flags", 4, 40, L"0x%x", NULL, NULL, NULL,NULL}
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the MADT Interrupt Controller Structure Header Structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = {
|
||||
{NULL, 1, 0, NULL, NULL, (VOID**)&MadtInterruptControllerType, NULL, NULL},
|
||||
{L"Length", 1, 1, NULL, NULL, (VOID**)&MadtInterruptControllerLength, NULL,
|
||||
NULL},
|
||||
{L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL}
|
||||
{ NULL, 1, 0, NULL, NULL, (VOID **)&MadtInterruptControllerType, NULL, NULL },
|
||||
{ L"Length", 1, 1, NULL, NULL, (VOID **)&MadtInterruptControllerLength, NULL,
|
||||
NULL },
|
||||
{ L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -276,13 +276,13 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiMadt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT8* InterruptContollerPtr;
|
||||
UINT8 *InterruptContollerPtr;
|
||||
UINT32 GICDCount;
|
||||
|
||||
GICDCount = 0;
|
||||
@ -315,7 +315,8 @@ ParseAcpiMadt (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((MadtInterruptControllerType == NULL) ||
|
||||
(MadtInterruptControllerLength == NULL)) {
|
||||
(MadtInterruptControllerLength == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
@ -327,7 +328,8 @@ ParseAcpiMadt (
|
||||
|
||||
// Validate Interrupt Controller Structure length
|
||||
if ((*MadtInterruptControllerLength == 0) ||
|
||||
((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength)) {
|
||||
((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Interrupt Controller Structure length. " \
|
||||
@ -340,7 +342,8 @@ ParseAcpiMadt (
|
||||
}
|
||||
|
||||
switch (*MadtInterruptControllerType) {
|
||||
case EFI_ACPI_6_3_GIC: {
|
||||
case EFI_ACPI_6_3_GIC:
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -352,7 +355,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
case EFI_ACPI_6_3_GICD: {
|
||||
case EFI_ACPI_6_3_GICD:
|
||||
{
|
||||
if (++GICDCount > 1) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
@ -361,6 +365,7 @@ ParseAcpiMadt (
|
||||
GICDCount
|
||||
);
|
||||
}
|
||||
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -372,7 +377,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
case EFI_ACPI_6_3_GIC_MSI_FRAME: {
|
||||
case EFI_ACPI_6_3_GIC_MSI_FRAME:
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -384,7 +390,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
case EFI_ACPI_6_3_GICR: {
|
||||
case EFI_ACPI_6_3_GICR:
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -396,7 +403,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
case EFI_ACPI_6_3_GIC_ITS: {
|
||||
case EFI_ACPI_6_3_GIC_ITS:
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -408,7 +416,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
case EFI_ACPI_6_3_IO_APIC: {
|
||||
case EFI_ACPI_6_3_IO_APIC:
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -420,7 +429,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE: {
|
||||
case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE:
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -432,7 +442,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC: {
|
||||
case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -444,7 +455,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
case EFI_ACPI_6_3_LOCAL_X2APIC_NMI: {
|
||||
case EFI_ACPI_6_3_LOCAL_X2APIC_NMI:
|
||||
{
|
||||
ParseAcpi (
|
||||
TRUE,
|
||||
2,
|
||||
@ -456,7 +468,8 @@ ParseAcpiMadt (
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
default:
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Unknown Interrupt Controller Structure,"
|
||||
|
@ -21,18 +21,18 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER McfgParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Reserved", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{ L"Reserved", 8,36, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the PCI configuration Space Base Address structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = {
|
||||
{L"Base Address", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"PCI Segment Group No.", 2, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Start Bus No.", 1, 10, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"End Bus No.", 1, 11, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Base Address", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI Segment Group No.", 2, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Start Bus No.", 1, 10, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"End Bus No.", 1, 11, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -51,14 +51,14 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiMcfg (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT32 PciCfgOffset;
|
||||
UINT8* PciCfgSpacePtr;
|
||||
UINT8 *PciCfgSpacePtr;
|
||||
|
||||
if (!Trace) {
|
||||
return;
|
||||
|
@ -19,10 +19,10 @@
|
||||
// Local variables
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
STATIC UINT32* PccGlobalFlags;
|
||||
STATIC UINT8* PccSubspaceLength;
|
||||
STATIC UINT8* PccSubspaceType;
|
||||
STATIC UINT8* ExtendedPccSubspaceInterruptFlags;
|
||||
STATIC UINT32 *PccGlobalFlags;
|
||||
STATIC UINT8 *PccSubspaceLength;
|
||||
STATIC UINT8 *PccSubspaceType;
|
||||
STATIC UINT8 *ExtendedPccSubspaceInterruptFlags;
|
||||
|
||||
/**
|
||||
This function validates the length coded on 4 bytes of a shared memory range
|
||||
@ -35,16 +35,16 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateRangeLength4 (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*(UINT32*)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) {
|
||||
if (*(UINT32 *)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nError: Shared memory range length is too short.\n"
|
||||
L"Length is %u when it should be greater than or equal to %u",
|
||||
*(UINT32*)Ptr,
|
||||
*(UINT32 *)Ptr,
|
||||
MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN
|
||||
);
|
||||
}
|
||||
@ -61,16 +61,16 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateRangeLength8 (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*(UINT64*)Ptr <= MIN_MEMORY_RANGE_LENGTH) {
|
||||
if (*(UINT64 *)Ptr <= MIN_MEMORY_RANGE_LENGTH) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nError: Shared memory range length is too short.\n"
|
||||
L"Length is %u when it should be greater than %u",
|
||||
*(UINT64*)Ptr,
|
||||
*(UINT64 *)Ptr,
|
||||
MIN_MEMORY_RANGE_LENGTH
|
||||
);
|
||||
}
|
||||
@ -87,14 +87,14 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidatePccMemoryIoGas (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
switch (*(UINT8*)Ptr) {
|
||||
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
|
||||
switch (*(UINT8 *)Ptr) {
|
||||
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
|
||||
case EFI_ACPI_6_4_SYSTEM_IO:
|
||||
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
|
||||
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
|
||||
case EFI_ACPI_6_4_SYSTEM_MEMORY:
|
||||
return;
|
||||
default:
|
||||
@ -114,14 +114,14 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidatePccGas (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
switch (*(UINT8*)Ptr) {
|
||||
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
|
||||
switch (*(UINT8 *)Ptr) {
|
||||
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
|
||||
case EFI_ACPI_6_4_SYSTEM_IO:
|
||||
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
|
||||
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
|
||||
case EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE:
|
||||
case EFI_ACPI_6_4_SYSTEM_MEMORY:
|
||||
return;
|
||||
@ -142,8 +142,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidatePccDoorbellGas (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
// For slave subspaces this field is optional, if not present the field
|
||||
@ -152,7 +152,8 @@ ValidatePccDoorbellGas (
|
||||
if (IsZeroBuffer (
|
||||
Ptr,
|
||||
sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
|
||||
)) {
|
||||
))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -172,8 +173,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidatePccIntAckGas (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
// If the subspace does not support interrupts or the interrupt is
|
||||
@ -184,11 +185,13 @@ ValidatePccIntAckGas (
|
||||
EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) ||
|
||||
((*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))
|
||||
{
|
||||
if (IsZeroBuffer (
|
||||
Ptr,
|
||||
sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
|
||||
)) {
|
||||
))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -207,8 +210,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidatePccErrStatusGas (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
// This field is ignored by the OSPM on slave channels.
|
||||
@ -230,15 +233,16 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidatePlatInterrupt (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
// If a slave subspace is present in the PCCT, then the global Platform
|
||||
// Interrupt flag must be set to 1.
|
||||
if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
|
||||
((*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 ();
|
||||
Print (
|
||||
L"\nError: Global Platform interrupt flag must be set to 1" \
|
||||
@ -252,8 +256,8 @@ ValidatePlatInterrupt (
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER PcctParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Flags", 4, 36, NULL, NULL, (VOID**)&PccGlobalFlags, NULL, NULL},
|
||||
{L"Reserved", 8, 40, NULL, NULL, NULL, NULL, NULL}
|
||||
{ L"Flags", 4, 36, NULL, NULL, (VOID **)&PccGlobalFlags, NULL, NULL },
|
||||
{ L"Reserved", 8, 40, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -270,17 +274,17 @@ STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {
|
||||
PCC_SUBSPACE_HEADER (),
|
||||
{L"Reserved", 6, 2, L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL, NULL},
|
||||
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
|
||||
NULL},
|
||||
{L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccMemoryIoGas,
|
||||
NULL},
|
||||
{L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL}
|
||||
{ L"Reserved", 6, 2, L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL, NULL },
|
||||
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
|
||||
NULL },
|
||||
{ L"Doorbell Register",12, 24, NULL, DumpGas, NULL, ValidatePccMemoryIoGas,
|
||||
NULL },
|
||||
{ L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL },
|
||||
{ L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL },
|
||||
{ L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -289,19 +293,19 @@ STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] = {
|
||||
PCC_SUBSPACE_HEADER (),
|
||||
{L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
|
||||
NULL},
|
||||
{L"Doorbell Register", 12, 24, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL},
|
||||
{L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL}
|
||||
{ L"Platform Interrupt",4, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Platform Interrupt Flags",1, 6, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
|
||||
NULL },
|
||||
{ L"Doorbell Register",12, 24, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL },
|
||||
{ L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL },
|
||||
{ L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL },
|
||||
{ L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -310,24 +314,24 @@ STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] = {
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] = {
|
||||
PCC_SUBSPACE_HEADER (),
|
||||
{L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
|
||||
NULL},
|
||||
{L"Doorbell Register", 12, 24, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL},
|
||||
{L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Platform Interrupt Ack Register", 12, 62, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL},
|
||||
{L"Platform Interrupt Ack Preserve", 8, 74, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Platform Interrupt Ack Write", 8, 82, L"0x%lx", NULL, NULL,
|
||||
NULL, NULL},
|
||||
{ L"Platform Interrupt",4, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Platform Interrupt Flags",1, 6, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
|
||||
NULL },
|
||||
{ L"Doorbell Register",12, 24, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL },
|
||||
{ L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL },
|
||||
{ L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL },
|
||||
{ L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL },
|
||||
{ L"Platform Interrupt Ack Register",12, 62, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL },
|
||||
{ L"Platform Interrupt Ack Preserve",8, 74, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Platform Interrupt Ack Write",8, 82, L"0x%lx", NULL, NULL,
|
||||
NULL, NULL },
|
||||
};
|
||||
|
||||
/**
|
||||
@ -335,36 +339,36 @@ STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] = {
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {
|
||||
PCC_SUBSPACE_HEADER (),
|
||||
{L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL,
|
||||
ValidatePlatInterrupt, NULL},
|
||||
{L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL,
|
||||
(VOID**)&ExtendedPccSubspaceInterruptFlags, NULL, NULL},
|
||||
{L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Memory Range Length", 4, 16, L"0x%x", NULL, NULL, ValidateRangeLength4,
|
||||
NULL},
|
||||
{L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
|
||||
ValidatePccDoorbellGas, NULL},
|
||||
{L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Nominal Latency", 4, 48, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Maximum Periodic Access Rate", 4, 52, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Minimum Request Turnaround Time", 4, 56, L"%u", NULL, NULL, NULL, NULL},
|
||||
{L"Platform Interrupt Ack Register", 12, 60, NULL, DumpGas, NULL,
|
||||
ValidatePccIntAckGas, NULL},
|
||||
{L"Platform Interrupt Ack Preserve", 8, 72, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Platform Interrupt Ack Set", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 8, 88, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Cmd Complete Check Reg Addr", 12, 96, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL},
|
||||
{L"Cmd Complete Check Mask", 8, 108, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Cmd Update Reg Addr", 12, 116, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL},
|
||||
{L"Cmd Update Preserve mask", 8, 128, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Cmd Update Set mask", 8, 136, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Error Status Register", 12, 144, NULL, DumpGas, NULL,
|
||||
ValidatePccErrStatusGas, NULL},
|
||||
{L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{ L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL,
|
||||
ValidatePlatInterrupt, NULL },
|
||||
{ L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL,
|
||||
(VOID **)&ExtendedPccSubspaceInterruptFlags,NULL, NULL },
|
||||
{ L"Reserved", 1, 7, L"0x%x", NULL, NULL,NULL, NULL },
|
||||
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Memory Range Length", 4, 16, L"0x%x", NULL, NULL,ValidateRangeLength4,
|
||||
NULL },
|
||||
{ L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
|
||||
ValidatePccDoorbellGas, NULL },
|
||||
{ L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Nominal Latency", 4, 48, L"%u", NULL, NULL,NULL, NULL },
|
||||
{ L"Maximum Periodic Access Rate", 4, 52, L"%u", NULL, NULL,NULL, NULL },
|
||||
{ L"Minimum Request Turnaround Time", 4, 56, L"%u", NULL, NULL,NULL, NULL },
|
||||
{ L"Platform Interrupt Ack Register", 12, 60, NULL, DumpGas, NULL,
|
||||
ValidatePccIntAckGas, NULL },
|
||||
{ L"Platform Interrupt Ack Preserve", 8, 72, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Platform Interrupt Ack Set", 8, 80, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Reserved", 8, 88, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Cmd Complete Check Reg Addr", 12, 96, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL },
|
||||
{ L"Cmd Complete Check Mask", 8, 108, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Cmd Update Reg Addr", 12, 116, NULL, DumpGas, NULL,
|
||||
ValidatePccGas, NULL },
|
||||
{ L"Cmd Update Preserve mask", 8, 128, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Cmd Update Set mask", 8, 136, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
{ L"Error Status Register", 12, 144, NULL, DumpGas, NULL,
|
||||
ValidatePccErrStatusGas, NULL },
|
||||
{ L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL,NULL, NULL },
|
||||
};
|
||||
|
||||
/**
|
||||
@ -373,21 +377,21 @@ STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {
|
||||
*/
|
||||
STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
|
||||
PCC_SUBSPACE_HEADER (),
|
||||
{L"Version", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Shared Memory Range Length", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
|
||||
ValidatePccMemoryIoGas, NULL},
|
||||
{L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Command Complete Check Register", 12, 48, NULL, DumpGas, NULL,
|
||||
ValidatePccMemoryIoGas, NULL},
|
||||
{L"Command Complete Check Mask", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Error Status Register", 12, 68, NULL, DumpGas, NULL,
|
||||
ValidatePccMemoryIoGas, NULL},
|
||||
{L"Error Status Mask", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"Nominal Latency", 4, 88, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Minimum Request Turnaround Time", 4, 92, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Version", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Shared Memory Range Length",8, 12, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
|
||||
ValidatePccMemoryIoGas,NULL },
|
||||
{ L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Command Complete Check Register",12, 48, NULL, DumpGas, NULL,
|
||||
ValidatePccMemoryIoGas,NULL },
|
||||
{ L"Command Complete Check Mask",8, 60, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Error Status Register",12, 68, NULL, DumpGas, NULL,
|
||||
ValidatePccMemoryIoGas,NULL },
|
||||
{ L"Error Status Mask", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"Nominal Latency", 4, 88, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Minimum Request Turnaround Time",4, 92, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -399,7 +403,7 @@ STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
|
||||
STATIC
|
||||
VOID
|
||||
DumpPccSubspaceType0 (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -422,7 +426,7 @@ DumpPccSubspaceType0 (
|
||||
STATIC
|
||||
VOID
|
||||
DumpPccSubspaceType1 (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -445,7 +449,7 @@ DumpPccSubspaceType1 (
|
||||
STATIC
|
||||
VOID
|
||||
DumpPccSubspaceType2 (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -468,7 +472,7 @@ DumpPccSubspaceType2 (
|
||||
STATIC
|
||||
VOID
|
||||
DumpPccSubspaceType3 (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -491,7 +495,7 @@ DumpPccSubspaceType3 (
|
||||
STATIC
|
||||
VOID
|
||||
DumpPccSubspaceType4 (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -514,7 +518,7 @@ DumpPccSubspaceType4 (
|
||||
STATIC
|
||||
VOID
|
||||
DumpPccSubspaceType5 (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -545,13 +549,13 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiPcct (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT8* PccSubspacePtr;
|
||||
UINT8 *PccSubspacePtr;
|
||||
UINTN SubspaceCount;
|
||||
|
||||
if (!Trace) {
|
||||
@ -584,7 +588,8 @@ ParseAcpiPcct (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((PccSubspaceType == NULL) ||
|
||||
(PccSubspaceLength == NULL)) {
|
||||
(PccSubspaceLength == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
@ -596,7 +601,8 @@ ParseAcpiPcct (
|
||||
|
||||
// Validate Structure length
|
||||
if ((*PccSubspaceLength == 0) ||
|
||||
((Offset + (*PccSubspaceLength)) > AcpiTableLength)) {
|
||||
((Offset + (*PccSubspaceLength)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Structure length. " \
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include "PpttParser.h"
|
||||
|
||||
// Local variables
|
||||
STATIC CONST UINT8* ProcessorTopologyStructureType;
|
||||
STATIC CONST UINT8* ProcessorTopologyStructureLength;
|
||||
STATIC CONST UINT32* NumberOfPrivateResources;
|
||||
STATIC CONST UINT8 *ProcessorTopologyStructureType;
|
||||
STATIC CONST UINT8 *ProcessorTopologyStructureLength;
|
||||
STATIC CONST UINT32 *NumberOfPrivateResources;
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
/**
|
||||
@ -34,12 +34,13 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateCacheNumberOfSets (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT32 NumberOfSets;
|
||||
NumberOfSets = *(UINT32*)Ptr;
|
||||
|
||||
NumberOfSets = *(UINT32 *)Ptr;
|
||||
|
||||
if (NumberOfSets == 0) {
|
||||
IncrementErrorCount ();
|
||||
@ -47,7 +48,7 @@ ValidateCacheNumberOfSets (
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
if (NumberOfSets > PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
@ -68,8 +69,8 @@ ValidateCacheNumberOfSets (
|
||||
);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,12 +85,13 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateCacheAssociativity (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT8 Associativity;
|
||||
Associativity = *(UINT8*)Ptr;
|
||||
|
||||
Associativity = *(UINT8 *)Ptr;
|
||||
|
||||
if (Associativity == 0) {
|
||||
IncrementErrorCount ();
|
||||
@ -109,21 +111,22 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateCacheLineSize (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
// Reference: ARM Architecture Reference Manual ARMv8 (D.a)
|
||||
// Section D12.2.25: CCSIDR_EL1, Current Cache Size ID Register
|
||||
// LineSize, bits [2:0]
|
||||
// (Log2(Number of bytes in cache line)) - 4.
|
||||
|
||||
UINT16 LineSize;
|
||||
LineSize = *(UINT16*)Ptr;
|
||||
LineSize = *(UINT16 *)Ptr;
|
||||
|
||||
if ((LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) ||
|
||||
(LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX)) {
|
||||
(LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nERROR: The cache line size must be between %d and %d bytes"
|
||||
@ -138,7 +141,8 @@ ValidateCacheLineSize (
|
||||
IncrementErrorCount ();
|
||||
Print (L"\nERROR: The cache line size is not a power of 2.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,15 +156,16 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateCacheAttributes (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
// Reference: Advanced Configuration and Power Interface (ACPI) Specification
|
||||
// Version 6.2 Errata A, September 2017
|
||||
// Table 5-153: Cache Type Structure
|
||||
UINT8 Attributes;
|
||||
Attributes = *(UINT8*)Ptr;
|
||||
|
||||
Attributes = *(UINT8 *)Ptr;
|
||||
|
||||
if ((Attributes & 0xE0) != 0) {
|
||||
IncrementErrorCount ();
|
||||
@ -183,59 +188,59 @@ STATIC CONST ACPI_PARSER PpttParser[] = {
|
||||
An ACPI_PARSER array describing the processor topology structure header.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER ProcessorTopologyStructureHeaderParser[] = {
|
||||
{L"Type", 1, 0, NULL, NULL, (VOID**)&ProcessorTopologyStructureType,
|
||||
NULL, NULL},
|
||||
{L"Length", 1, 1, NULL, NULL, (VOID**)&ProcessorTopologyStructureLength,
|
||||
NULL, NULL},
|
||||
{L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL}
|
||||
{ L"Type", 1, 0, NULL, NULL, (VOID **)&ProcessorTopologyStructureType,
|
||||
NULL, NULL },
|
||||
{ L"Length", 1, 1, NULL, NULL, (VOID **)&ProcessorTopologyStructureLength,
|
||||
NULL, NULL },
|
||||
{ L"Reserved", 2, 2, NULL, NULL, NULL, NULL,NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Processor Hierarchy Node Structure - Type 0.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER ProcessorHierarchyNodeStructureParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Number of private resources", 4, 16, L"%d", NULL,
|
||||
(VOID**)&NumberOfPrivateResources, NULL, NULL}
|
||||
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Number of private resources", 4, 16, L"%d", NULL,
|
||||
(VOID **)&NumberOfPrivateResources, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Cache Type Structure - Type 1.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets, NULL},
|
||||
{L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity, NULL},
|
||||
{L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL},
|
||||
{L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL}
|
||||
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets, NULL },
|
||||
{ L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity, NULL },
|
||||
{ L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL },
|
||||
{ L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the ID Type Structure - Type 2.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER IdStructureParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"VENDOR_ID", 4, 4, NULL, Dump4Chars, NULL, NULL, NULL},
|
||||
{L"LEVEL_1_ID", 8, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"LEVEL_2_ID", 8, 16, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"MAJOR_REV", 2, 24, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"MINOR_REV", 2, 26, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"SPIN_REV", 2, 28, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"VENDOR_ID", 4, 4, NULL, Dump4Chars, NULL, NULL, NULL },
|
||||
{ L"LEVEL_1_ID", 8, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"LEVEL_2_ID", 8, 16, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"MAJOR_REV", 2, 24, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"MINOR_REV", 2, 26, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"SPIN_REV", 2, 28, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
/**
|
||||
@ -248,7 +253,7 @@ STATIC CONST ACPI_PARSER IdStructureParser[] = {
|
||||
STATIC
|
||||
VOID
|
||||
DumpProcessorHierarchyNodeStructure (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -304,7 +309,7 @@ DumpProcessorHierarchyNodeStructure (
|
||||
PrintFieldName (4, Buffer);
|
||||
Print (
|
||||
L"0x%x\n",
|
||||
*((UINT32*)(Ptr + Offset))
|
||||
*((UINT32 *)(Ptr + Offset))
|
||||
);
|
||||
|
||||
Offset += sizeof (UINT32);
|
||||
@ -321,7 +326,7 @@ DumpProcessorHierarchyNodeStructure (
|
||||
STATIC
|
||||
VOID
|
||||
DumpCacheTypeStructure (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -344,7 +349,7 @@ DumpCacheTypeStructure (
|
||||
STATIC
|
||||
VOID
|
||||
DumpIDStructure (
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT8 Length
|
||||
)
|
||||
{
|
||||
@ -379,13 +384,13 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiPptt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT8* ProcessorTopologyStructurePtr;
|
||||
UINT8 *ProcessorTopologyStructurePtr;
|
||||
|
||||
if (!Trace) {
|
||||
return;
|
||||
@ -416,7 +421,8 @@ ParseAcpiPptt (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((ProcessorTopologyStructureType == NULL) ||
|
||||
(ProcessorTopologyStructureLength == NULL)) {
|
||||
(ProcessorTopologyStructureLength == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
@ -428,7 +434,8 @@ ParseAcpiPptt (
|
||||
|
||||
// Validate Processor Topology Structure length
|
||||
if ((*ProcessorTopologyStructureLength == 0) ||
|
||||
((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) {
|
||||
((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Processor Topology Structure length. " \
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "AcpiTableParser.h"
|
||||
|
||||
// Local Variables
|
||||
STATIC CONST UINT64* XsdtAddress;
|
||||
STATIC CONST UINT64 *XsdtAddress;
|
||||
|
||||
/**
|
||||
This function validates the RSDT Address.
|
||||
@ -26,11 +26,11 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateRsdtAddress (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
// Reference: Server Base Boot Requirements System Software on ARM Platforms
|
||||
// Section: 4.2.1.1 RSDP
|
||||
// Root System Description Pointer (RSDP), ACPI ? 5.2.5.
|
||||
@ -38,7 +38,7 @@ ValidateRsdtAddress (
|
||||
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
|
||||
UINT32 RsdtAddr;
|
||||
|
||||
RsdtAddr = *(UINT32*)Ptr;
|
||||
RsdtAddr = *(UINT32 *)Ptr;
|
||||
|
||||
if (RsdtAddr != 0) {
|
||||
IncrementErrorCount ();
|
||||
@ -47,7 +47,8 @@ ValidateRsdtAddress (
|
||||
RsdtAddr
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,11 +62,11 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateXsdtAddress (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
// Reference: Server Base Boot Requirements System Software on ARM Platforms
|
||||
// Section: 4.2.1.1 RSDP
|
||||
// Root System Description Pointer (RSDP), ACPI ? 5.2.5.
|
||||
@ -73,7 +74,7 @@ ValidateXsdtAddress (
|
||||
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
|
||||
UINT64 XsdtAddr;
|
||||
|
||||
XsdtAddr = *(UINT64*)Ptr;
|
||||
XsdtAddr = *(UINT64 *)Ptr;
|
||||
|
||||
if (XsdtAddr == 0) {
|
||||
IncrementErrorCount ();
|
||||
@ -82,23 +83,24 @@ ValidateXsdtAddress (
|
||||
XsdtAddr
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
An array describing the ACPI RSDP Table.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER RsdpParser[] = {
|
||||
{L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL},
|
||||
{L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL},
|
||||
{L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL},
|
||||
{L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID**)&XsdtAddress,
|
||||
ValidateXsdtAddress, NULL},
|
||||
{L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
|
||||
{ L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL },
|
||||
{ L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL },
|
||||
{ L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL },
|
||||
{ L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID **)&XsdtAddress,
|
||||
ValidateXsdtAddress, NULL },
|
||||
{ L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -119,7 +121,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiRsdp (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
@ -160,5 +162,5 @@ ParseAcpiRsdp (
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessAcpiTable ((UINT8*)(UINTN)(*XsdtAddress));
|
||||
ProcessAcpiTable ((UINT8 *)(UINTN)(*XsdtAddress));
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "AcpiTableParser.h"
|
||||
|
||||
// Local Variables
|
||||
STATIC CONST UINT64* SlitSystemLocalityCount;
|
||||
STATIC CONST UINT64 *SlitSystemLocalityCount;
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
/**
|
||||
@ -23,8 +23,8 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SlitParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Number of System Localities", 8, 36, L"0x%lx", NULL,
|
||||
(VOID**)&SlitSystemLocalityCount, NULL, NULL}
|
||||
{ L"Number of System Localities", 8, 36, L"0x%lx", NULL,
|
||||
(VOID **)&SlitSystemLocalityCount,NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -51,7 +51,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiSlit (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
@ -60,7 +60,7 @@ ParseAcpiSlit (
|
||||
UINT32 Count;
|
||||
UINT32 Index;
|
||||
UINT32 LocalityCount;
|
||||
UINT8* LocalityPtr;
|
||||
UINT8 *LocalityPtr;
|
||||
CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi
|
||||
|
||||
if (!Trace) {
|
||||
@ -144,12 +144,14 @@ ParseAcpiSlit (
|
||||
for (Index = 0; Index < LocalityCount; Index++) {
|
||||
Print (L" (%3d) ", Index);
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
for (Count = 0; Count< LocalityCount; Count++) {
|
||||
for (Count = 0; Count < LocalityCount; Count++) {
|
||||
Print (L" (%3d) ", Count);
|
||||
for (Index = 0; Index < LocalityCount; Index++) {
|
||||
Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index));
|
||||
}
|
||||
|
||||
Print (L"\n");
|
||||
}
|
||||
}
|
||||
@ -158,7 +160,7 @@ ParseAcpiSlit (
|
||||
for (Count = 0; Count < LocalityCount; Count++) {
|
||||
for (Index = 0; Index < LocalityCount; Index++) {
|
||||
// Element[x][x] must be equal to 10
|
||||
if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index) != 10)) {
|
||||
if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count, Index) != 10)) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
|
||||
@ -168,9 +170,11 @@ ParseAcpiSlit (
|
||||
SLIT_ELEMENT (LocalityPtr, Count, Index)
|
||||
);
|
||||
}
|
||||
|
||||
// Element[i][j] must be equal to Element[j][i]
|
||||
if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=
|
||||
SLIT_ELEMENT (LocalityPtr, Index, Count)) {
|
||||
SLIT_ELEMENT (LocalityPtr, Index, Count))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
|
||||
|
@ -29,24 +29,26 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateInterruptType (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
UINT8 InterruptType;
|
||||
|
||||
InterruptType = *Ptr;
|
||||
|
||||
if (InterruptType !=
|
||||
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) {
|
||||
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC)
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms",
|
||||
InterruptType
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,11 +62,11 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateIrq (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||
UINT8 Irq;
|
||||
|
||||
Irq = *Ptr;
|
||||
@ -76,7 +78,8 @@ ValidateIrq (
|
||||
Irq
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,27 +87,27 @@ ValidateIrq (
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SpcrParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Interface Type", 1, 36, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 3, 37, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
|
||||
{L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL},
|
||||
{L"Interrupt Type", 1, 52, L"%d", NULL, NULL, ValidateInterruptType, NULL},
|
||||
{L"IRQ", 1, 53, L"%d", NULL, NULL, ValidateIrq, NULL},
|
||||
{L"Global System Interrupt", 4, 54, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Baud Rate", 1, 58, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Parity", 1, 59, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Stop Bits", 1, 60, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Flow Control", 1, 61, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Terminal Type", 1, 62, L"%d", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 1, 63, L"%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Interface Type", 1, 36, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 3, 37, L"%x %x %x", Dump3Chars, NULL, NULL, NULL },
|
||||
{ L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL },
|
||||
{ L"Interrupt Type", 1, 52, L"%d", NULL, NULL, ValidateInterruptType, NULL },
|
||||
{ L"IRQ", 1, 53, L"%d", NULL, NULL, ValidateIrq, NULL },
|
||||
{ L"Global System Interrupt", 4, 54, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Baud Rate", 1, 58, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Parity", 1, 59, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Stop Bits", 1, 60, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Flow Control", 1, 61, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Terminal Type", 1, 62, L"%d", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 1, 63, L"%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"PCI Device ID", 2, 64, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PCI Vendor ID", 2, 66, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PCI Bus Number", 1, 68, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PCI Device Number", 1, 69, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PCI Function Number", 1, 70, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PCI Flags", 4, 71, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PCI Segment", 1, 75, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL}
|
||||
{ L"PCI Device ID", 2, 64, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI Vendor ID", 2, 66, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI Bus Number", 1, 68, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI Device Number", 1, 69, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI Function Number", 1, 70, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI Flags", 4, 71, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI Segment", 1, 75, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -123,7 +126,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiSpcr (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
|
@ -16,9 +16,9 @@
|
||||
#include "AcpiViewConfig.h"
|
||||
|
||||
// Local Variables
|
||||
STATIC CONST UINT8* SratRAType;
|
||||
STATIC CONST UINT8* SratRALength;
|
||||
STATIC CONST UINT8* SratDeviceHandleType;
|
||||
STATIC CONST UINT8 *SratRAType;
|
||||
STATIC CONST UINT8 *SratRALength;
|
||||
STATIC CONST UINT8 *SratDeviceHandleType;
|
||||
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
||||
|
||||
/**
|
||||
@ -32,11 +32,11 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateSratReserved (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
if (*(UINT32*)Ptr != 1) {
|
||||
if (*(UINT32 *)Ptr != 1) {
|
||||
IncrementErrorCount ();
|
||||
Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n");
|
||||
}
|
||||
@ -54,8 +54,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
ValidateSratDeviceHandleType (
|
||||
IN UINT8* Ptr,
|
||||
IN VOID* Context
|
||||
IN UINT8 *Ptr,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT8 DeviceHandleType;
|
||||
@ -82,8 +82,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpSratPciBdfNumber (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
|
||||
@ -144,19 +144,19 @@ DumpSratPciBdfNumber (
|
||||
An ACPI_PARSER array describing the Device Handle - ACPI
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = {
|
||||
{L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},
|
||||
{L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL },
|
||||
{ L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Device Handle - PCI
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = {
|
||||
{L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL},
|
||||
{L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,
|
||||
NULL, NULL, NULL}
|
||||
{ L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL },
|
||||
{ L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,
|
||||
NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -170,8 +170,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpSratDeviceHandle (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
if (SratDeviceHandleType == NULL) {
|
||||
@ -213,8 +213,8 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
DumpSratApicProximity (
|
||||
IN CONST CHAR16* Format,
|
||||
IN UINT8* Ptr
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINT8 *Ptr
|
||||
)
|
||||
{
|
||||
UINT32 ProximityDomain;
|
||||
@ -229,106 +229,106 @@ DumpSratApicProximity (
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratParser[] = {
|
||||
PARSE_ACPI_HEADER (&AcpiHdrInfo),
|
||||
{L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL},
|
||||
{L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}
|
||||
{ L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL },
|
||||
{ L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Resource Allocation structure header.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratResourceAllocationParser[] = {
|
||||
{L"Type", 1, 0, NULL, NULL, (VOID**)&SratRAType, NULL, NULL},
|
||||
{L"Length", 1, 1, NULL, NULL, (VOID**)&SratRALength, NULL, NULL}
|
||||
{ L"Type", 1, 0, NULL, NULL, (VOID **)&SratRAType, NULL, NULL },
|
||||
{ L"Length", 1, 1, NULL, NULL, (VOID **)&SratRALength, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the GICC Affinity structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratGicCAffinityParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the GIC ITS Affinity structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Generic Initiator Affinity Structure
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Device Handle Type", 1, 3, L"%d", NULL, (VOID**)&SratDeviceHandleType,
|
||||
ValidateSratDeviceHandleType, NULL},
|
||||
{L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Device Handle Type", 1, 3, L"%d", NULL, (VOID **)&SratDeviceHandleType,
|
||||
ValidateSratDeviceHandleType, NULL },
|
||||
{ L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Memory Affinity structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratMemAffinityParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
|
||||
{ L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the APIC/SAPIC Affinity structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity,
|
||||
NULL, NULL, NULL},
|
||||
{L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity,
|
||||
NULL, NULL, NULL },
|
||||
{ L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
An ACPI_PARSER array describing the Processor Local x2APIC Affinity structure.
|
||||
**/
|
||||
STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = {
|
||||
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
|
||||
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
|
||||
{L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}
|
||||
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
|
||||
{ L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -353,13 +353,13 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiSrat (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT8* ResourcePtr;
|
||||
UINT8 *ResourcePtr;
|
||||
UINT32 GicCAffinityIndex;
|
||||
UINT32 GicITSAffinityIndex;
|
||||
UINT32 GenericInitiatorAffinityIndex;
|
||||
@ -403,7 +403,8 @@ ParseAcpiSrat (
|
||||
// Check if the values used to control the parsing logic have been
|
||||
// successfully read.
|
||||
if ((SratRAType == NULL) ||
|
||||
(SratRALength == NULL)) {
|
||||
(SratRALength == NULL))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Insufficient remaining table buffer length to read the " \
|
||||
@ -415,7 +416,8 @@ ParseAcpiSrat (
|
||||
|
||||
// Validate Static Resource Allocation Structure length
|
||||
if ((*SratRALength == 0) ||
|
||||
((Offset + (*SratRALength)) > AcpiTableLength)) {
|
||||
((Offset + (*SratRALength)) > AcpiTableLength))
|
||||
{
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid Static Resource Allocation Structure length. " \
|
||||
|
@ -29,7 +29,7 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiSsdt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
|
@ -30,7 +30,7 @@ CONST ACPI_DESCRIPTION_HEADER_INFO *
|
||||
EFIAPI
|
||||
GetAcpiXsdtHeaderInfo (
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
return &AcpiHdrInfo;
|
||||
}
|
||||
@ -49,14 +49,14 @@ VOID
|
||||
EFIAPI
|
||||
ParseAcpiXsdt (
|
||||
IN BOOLEAN Trace,
|
||||
IN UINT8* Ptr,
|
||||
IN UINT8 *Ptr,
|
||||
IN UINT32 AcpiTableLength,
|
||||
IN UINT8 AcpiTableRevision
|
||||
)
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT32 TableOffset;
|
||||
UINT64* TablePointer;
|
||||
UINT64 *TablePointer;
|
||||
UINTN EntryIndex;
|
||||
CHAR16 Buffer[32];
|
||||
|
||||
@ -73,23 +73,23 @@ ParseAcpiXsdt (
|
||||
|
||||
if (Trace) {
|
||||
EntryIndex = 0;
|
||||
TablePointer = (UINT64*)(Ptr + TableOffset);
|
||||
TablePointer = (UINT64 *)(Ptr + TableOffset);
|
||||
while (Offset < AcpiTableLength) {
|
||||
CONST UINT32* Signature;
|
||||
CONST UINT32* Length;
|
||||
CONST UINT8* Revision;
|
||||
CONST UINT32 *Signature;
|
||||
CONST UINT32 *Length;
|
||||
CONST UINT8 *Revision;
|
||||
|
||||
if ((UINT64*)(UINTN)(*TablePointer) != NULL) {
|
||||
UINT8* SignaturePtr;
|
||||
if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
|
||||
UINT8 *SignaturePtr;
|
||||
|
||||
ParseAcpiHeader (
|
||||
(UINT8*)(UINTN)(*TablePointer),
|
||||
(UINT8 *)(UINTN)(*TablePointer),
|
||||
&Signature,
|
||||
&Length,
|
||||
&Revision
|
||||
);
|
||||
|
||||
SignaturePtr = (UINT8*)Signature;
|
||||
SignaturePtr = (UINT8 *)Signature;
|
||||
|
||||
UnicodeSPrint (
|
||||
Buffer,
|
||||
@ -114,7 +114,7 @@ ParseAcpiXsdt (
|
||||
Print (L"0x%lx\n", *TablePointer);
|
||||
|
||||
// Validate the table pointers are not NULL
|
||||
if ((UINT64*)(UINTN)(*TablePointer) == NULL) {
|
||||
if ((UINT64 *)(UINTN)(*TablePointer) == NULL) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
L"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n",
|
||||
@ -122,6 +122,7 @@ ParseAcpiXsdt (
|
||||
*TablePointer
|
||||
);
|
||||
}
|
||||
|
||||
Offset += sizeof (UINT64);
|
||||
TablePointer++;
|
||||
} // while
|
||||
@ -129,11 +130,12 @@ ParseAcpiXsdt (
|
||||
|
||||
// Process the tables
|
||||
Offset = TableOffset;
|
||||
TablePointer = (UINT64*)(Ptr + TableOffset);
|
||||
TablePointer = (UINT64 *)(Ptr + TableOffset);
|
||||
while (Offset < AcpiTableLength) {
|
||||
if ((UINT64*)(UINTN)(*TablePointer) != NULL) {
|
||||
ProcessAcpiTable ((UINT8*)(UINTN)(*TablePointer));
|
||||
if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
|
||||
ProcessAcpiTable ((UINT8 *)(UINTN)(*TablePointer));
|
||||
}
|
||||
|
||||
Offset += sizeof (UINT64);
|
||||
TablePointer++;
|
||||
} // while
|
||||
|
@ -32,13 +32,13 @@ EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;
|
||||
An array of acpiview command line parameters.
|
||||
**/
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-q", TypeFlag},
|
||||
{L"-d", TypeFlag},
|
||||
{L"-h", TypeFlag},
|
||||
{L"-l", TypeFlag},
|
||||
{L"-s", TypeValue},
|
||||
{L"-r", TypeValue},
|
||||
{NULL, TypeMax}
|
||||
{ L"-q", TypeFlag },
|
||||
{ L"-d", TypeFlag },
|
||||
{ L"-h", TypeFlag },
|
||||
{ L"-l", TypeFlag },
|
||||
{ L"-s", TypeValue },
|
||||
{ L"-r", TypeValue },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -47,29 +47,29 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
STATIC
|
||||
CONST
|
||||
ACPI_TABLE_PARSER ParserList[] = {
|
||||
{EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE, ParseAcpiAest},
|
||||
{EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, ParseAcpiBgrt},
|
||||
{EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2},
|
||||
{EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
|
||||
ParseAcpiDsdt},
|
||||
{EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, ParseAcpiFacs},
|
||||
{EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt},
|
||||
{EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt},
|
||||
{EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE, ParseAcpiHmat},
|
||||
{EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE, ParseAcpiIort},
|
||||
{EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt},
|
||||
{EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
|
||||
ParseAcpiMcfg},
|
||||
{EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
|
||||
ParseAcpiPcct},
|
||||
{EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
|
||||
ParseAcpiPptt},
|
||||
{RSDP_TABLE_INFO, ParseAcpiRsdp},
|
||||
{EFI_ACPI_6_2_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE, ParseAcpiSlit},
|
||||
{EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, ParseAcpiSpcr},
|
||||
{EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE, ParseAcpiSrat},
|
||||
{EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiSsdt},
|
||||
{EFI_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiXsdt}
|
||||
{ EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE, ParseAcpiAest },
|
||||
{ EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, ParseAcpiBgrt },
|
||||
{ EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2 },
|
||||
{ EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
|
||||
ParseAcpiDsdt },
|
||||
{ EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, ParseAcpiFacs },
|
||||
{ EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt },
|
||||
{ EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt },
|
||||
{ EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE, ParseAcpiHmat },
|
||||
{ EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE, ParseAcpiIort },
|
||||
{ EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt },
|
||||
{ EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
|
||||
ParseAcpiMcfg },
|
||||
{ EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
|
||||
ParseAcpiPcct },
|
||||
{ EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
|
||||
ParseAcpiPptt },
|
||||
{ RSDP_TABLE_INFO, ParseAcpiRsdp },
|
||||
{ EFI_ACPI_6_2_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE, ParseAcpiSlit },
|
||||
{ EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, ParseAcpiSpcr },
|
||||
{ EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE, ParseAcpiSrat },
|
||||
{ EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiSsdt },
|
||||
{ EFI_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiXsdt }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -101,6 +101,7 @@ RegisterAllParsers (
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -116,8 +117,8 @@ RegisterAllParsers (
|
||||
UINTN
|
||||
EFIAPI
|
||||
ShellDumpBufferToFile (
|
||||
IN CONST CHAR16* FileNameBuffer,
|
||||
IN CONST VOID* Buffer,
|
||||
IN CONST CHAR16 *FileNameBuffer,
|
||||
IN CONST VOID *Buffer,
|
||||
IN CONST UINTN BufferSize
|
||||
)
|
||||
{
|
||||
@ -148,7 +149,7 @@ ShellDumpBufferToFile (
|
||||
Status = ShellWriteFile (
|
||||
DumpFileHandle,
|
||||
&TransferBytes,
|
||||
(VOID *) Buffer
|
||||
(VOID *)Buffer
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -167,7 +168,7 @@ ShellDumpBufferToFile (
|
||||
|
||||
@return The string pointer to the file name.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
EFIAPI
|
||||
ShellCommandGetManFileNameAcpiView (
|
||||
VOID
|
||||
@ -190,16 +191,16 @@ SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunAcpiView (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE* SystemTable
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
SHELL_STATUS ShellStatus;
|
||||
LIST_ENTRY* Package;
|
||||
CHAR16* ProblemParam;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_FILE_HANDLE TmpDumpFileHandle;
|
||||
CONST CHAR16* MandatoryTableSpecStr;
|
||||
CONST CHAR16* SelectedTableName;
|
||||
CONST CHAR16 *MandatoryTableSpecStr;
|
||||
CONST CHAR16 *SelectedTableName;
|
||||
|
||||
// Set configuration defaults
|
||||
AcpiConfigSetDefaults ();
|
||||
@ -210,7 +211,7 @@ ShellCommandRunAcpiView (
|
||||
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
@ -224,6 +225,7 @@ ShellCommandRunAcpiView (
|
||||
} else {
|
||||
Print (L"acpiview: Error processing input parameter(s)\n");
|
||||
}
|
||||
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
if (ShellCommandLineGetCount (Package) > 1) {
|
||||
@ -246,7 +248,8 @@ ShellCommandRunAcpiView (
|
||||
L"acpiview"
|
||||
);
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-s") &&
|
||||
ShellCommandLineGetValue (Package, L"-s") == NULL) {
|
||||
(ShellCommandLineGetValue (Package, L"-s") == NULL))
|
||||
{
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
@ -258,7 +261,8 @@ ShellCommandRunAcpiView (
|
||||
);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-r") &&
|
||||
ShellCommandLineGetValue (Package, L"-r") == NULL) {
|
||||
(ShellCommandLineGetValue (Package, L"-r") == NULL))
|
||||
{
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
@ -270,7 +274,8 @@ ShellCommandRunAcpiView (
|
||||
);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if ((ShellCommandLineGetFlag (Package, L"-s") &&
|
||||
ShellCommandLineGetFlag (Package, L"-l"))) {
|
||||
ShellCommandLineGetFlag (Package, L"-l")))
|
||||
{
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
@ -281,7 +286,8 @@ ShellCommandRunAcpiView (
|
||||
);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-d") &&
|
||||
!ShellCommandLineGetFlag (Package, L"-s")) {
|
||||
!ShellCommandLineGetFlag (Package, L"-s"))
|
||||
{
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
@ -349,6 +355,7 @@ ShellCommandRunAcpiView (
|
||||
);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// Delete Temporary file.
|
||||
ShellDeleteFile (&TmpDumpFileHandle);
|
||||
} // -d
|
||||
@ -367,6 +374,7 @@ Done:
|
||||
if (Package != NULL) {
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
@ -390,6 +398,7 @@ UefiShellAcpiViewCommandLibConstructor (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
gShellAcpiViewHiiHandle = NULL;
|
||||
|
||||
// Check Shell Profile Debug1 bit of the profiles mask
|
||||
@ -412,6 +421,7 @@ UefiShellAcpiViewCommandLibConstructor (
|
||||
if (gShellAcpiViewHiiHandle == NULL) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
// Install our Shell command handler
|
||||
ShellCommandRegisterCommandName (
|
||||
L"acpiview",
|
||||
@ -443,5 +453,6 @@ UefiShellAcpiViewCommandLibDestructor (
|
||||
if (gShellAcpiViewHiiHandle != NULL) {
|
||||
HiiRemovePackages (gShellAcpiViewHiiHandle);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -51,14 +51,15 @@ ShellCEntryLib (
|
||||
EfiShellParametersProtocol = NULL;
|
||||
EfiShellInterface = NULL;
|
||||
|
||||
Status = SystemTable->BootServices->OpenProtocol(ImageHandle,
|
||||
Status = SystemTable->BootServices->OpenProtocol (
|
||||
ImageHandle,
|
||||
&gEfiShellParametersProtocolGuid,
|
||||
(VOID **)&EfiShellParametersProtocol,
|
||||
ImageHandle,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// use shell 2.0 interface
|
||||
//
|
||||
@ -70,14 +71,15 @@ ShellCEntryLib (
|
||||
//
|
||||
// try to get shell 1.0 interface instead.
|
||||
//
|
||||
Status = SystemTable->BootServices->OpenProtocol(ImageHandle,
|
||||
Status = SystemTable->BootServices->OpenProtocol (
|
||||
ImageHandle,
|
||||
&gEfiShellInterfaceGuid,
|
||||
(VOID **)&EfiShellInterface,
|
||||
ImageHandle,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// use shell 1.0 interface
|
||||
//
|
||||
@ -86,8 +88,9 @@ ShellCEntryLib (
|
||||
EfiShellInterface->Argv
|
||||
);
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return ReturnFromMain;
|
||||
}
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Protocol/SimpleFileSystem.h>
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
MTDTypeUnknown,
|
||||
MTDTypeFloppy,
|
||||
@ -62,10 +60,9 @@ typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
SERIAL_DECODE_FUNCTION SerialFun;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
Concatenates a formatted unicode string to allocated pool.
|
||||
The caller must free the resulting buffer.
|
||||
@ -112,13 +109,14 @@ CatPrint (
|
||||
Str->Str
|
||||
);
|
||||
}
|
||||
|
||||
if (NewStr == NULL) {
|
||||
FreePool (AppendStr);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Str->Str = NewStr;
|
||||
StrCatS (Str->Str, StringSize/sizeof(CHAR16), AppendStr);
|
||||
StrCatS (Str->Str, StringSize/sizeof (CHAR16), AppendStr);
|
||||
Str->Len = StringSize;
|
||||
|
||||
FreePool (AppendStr);
|
||||
@ -197,6 +195,7 @@ AppendCSDNum (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
if (MappingItem->Digital) {
|
||||
@ -288,11 +287,11 @@ AppendCSDStr (
|
||||
// 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
|
||||
//
|
||||
if (*Index >= '0' && *Index <= '9') {
|
||||
if ((*Index >= '0') && (*Index <= '9')) {
|
||||
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');
|
||||
} else if (*Index >= 'A' && *Index <= 'F') {
|
||||
} else if ((*Index >= 'A') && (*Index <= 'F')) {
|
||||
Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'A' + 'k');
|
||||
}
|
||||
|
||||
@ -302,7 +301,7 @@ AppendCSDStr (
|
||||
}
|
||||
}
|
||||
|
||||
MappingItem->Digital = (BOOLEAN)!(MappingItem->Digital);
|
||||
MappingItem->Digital = (BOOLEAN) !(MappingItem->Digital);
|
||||
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
@ -355,17 +354,17 @@ DevPathCompareAcpi (
|
||||
ACPI_HID_DEVICE_PATH *Acpi1;
|
||||
ACPI_HID_DEVICE_PATH *Acpi2;
|
||||
|
||||
if (DevicePath1 == NULL || DevicePath2 == NULL) {
|
||||
if ((DevicePath1 == NULL) || (DevicePath2 == NULL)) {
|
||||
return (-2);
|
||||
}
|
||||
|
||||
Acpi1 = (ACPI_HID_DEVICE_PATH *) DevicePath1;
|
||||
Acpi2 = (ACPI_HID_DEVICE_PATH *) DevicePath2;
|
||||
if (Acpi1->HID > Acpi2->HID || (Acpi1->HID == Acpi2->HID && Acpi1->UID > Acpi2->UID)) {
|
||||
Acpi1 = (ACPI_HID_DEVICE_PATH *)DevicePath1;
|
||||
Acpi2 = (ACPI_HID_DEVICE_PATH *)DevicePath2;
|
||||
if ((Acpi1->HID > Acpi2->HID) || ((Acpi1->HID == Acpi2->HID) && (Acpi1->UID > Acpi2->UID))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Acpi1->HID == Acpi2->HID && Acpi1->UID == Acpi2->UID) {
|
||||
if ((Acpi1->HID == Acpi2->HID) && (Acpi1->UID == Acpi2->UID)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -391,16 +390,16 @@ DevPathComparePci (
|
||||
PCI_DEVICE_PATH *Pci1;
|
||||
PCI_DEVICE_PATH *Pci2;
|
||||
|
||||
ASSERT(DevicePath1 != NULL);
|
||||
ASSERT(DevicePath2 != NULL);
|
||||
ASSERT (DevicePath1 != NULL);
|
||||
ASSERT (DevicePath2 != NULL);
|
||||
|
||||
Pci1 = (PCI_DEVICE_PATH *) DevicePath1;
|
||||
Pci2 = (PCI_DEVICE_PATH *) DevicePath2;
|
||||
if (Pci1->Device > Pci2->Device || (Pci1->Device == Pci2->Device && Pci1->Function > Pci2->Function)) {
|
||||
Pci1 = (PCI_DEVICE_PATH *)DevicePath1;
|
||||
Pci2 = (PCI_DEVICE_PATH *)DevicePath2;
|
||||
if ((Pci1->Device > Pci2->Device) || ((Pci1->Device == Pci2->Device) && (Pci1->Function > Pci2->Function))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Pci1->Device == Pci2->Device && Pci1->Function == Pci2->Function) {
|
||||
if ((Pci1->Device == Pci2->Device) && (Pci1->Function == Pci2->Function)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -427,8 +426,8 @@ DevPathCompareDefault (
|
||||
UINTN DevPathSize1;
|
||||
UINTN DevPathSize2;
|
||||
|
||||
ASSERT(DevicePath1 != NULL);
|
||||
ASSERT(DevicePath2 != NULL);
|
||||
ASSERT (DevicePath1 != NULL);
|
||||
ASSERT (DevicePath2 != NULL);
|
||||
|
||||
DevPathSize1 = DevicePathNodeLength (DevicePath1);
|
||||
DevPathSize2 = DevicePathNodeLength (DevicePath2);
|
||||
@ -460,10 +459,10 @@ DevPathSerialHardDrive (
|
||||
{
|
||||
HARDDRIVE_DEVICE_PATH *Hd;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Hd = (HARDDRIVE_DEVICE_PATH *) DevicePathNode;
|
||||
Hd = (HARDDRIVE_DEVICE_PATH *)DevicePathNode;
|
||||
if (MappingItem->Mtd == MTDTypeUnknown) {
|
||||
MappingItem->Mtd = MTDTypeHardDisk;
|
||||
}
|
||||
@ -490,10 +489,10 @@ DevPathSerialAtapi (
|
||||
{
|
||||
ATAPI_DEVICE_PATH *Atapi;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Atapi = (ATAPI_DEVICE_PATH *) DevicePathNode;
|
||||
Atapi = (ATAPI_DEVICE_PATH *)DevicePathNode;
|
||||
return AppendCSDNum (MappingItem, (Atapi->PrimarySecondary * 2 + Atapi->SlaveMaster));
|
||||
}
|
||||
|
||||
@ -516,10 +515,10 @@ DevPathSerialCdRom (
|
||||
{
|
||||
CDROM_DEVICE_PATH *Cd;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Cd = (CDROM_DEVICE_PATH *) DevicePathNode;
|
||||
Cd = (CDROM_DEVICE_PATH *)DevicePathNode;
|
||||
MappingItem->Mtd = MTDTypeCDRom;
|
||||
return AppendCSDNum (MappingItem, Cd->BootEntry);
|
||||
}
|
||||
@ -544,14 +543,15 @@ DevPathSerialFibre (
|
||||
EFI_STATUS Status;
|
||||
FIBRECHANNEL_DEVICE_PATH *Fibre;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Fibre = (FIBRECHANNEL_DEVICE_PATH *) DevicePathNode;
|
||||
Fibre = (FIBRECHANNEL_DEVICE_PATH *)DevicePathNode;
|
||||
Status = AppendCSDNum (MappingItem, Fibre->WWN);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Fibre->Lun);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -575,20 +575,23 @@ DevPathSerialUart (
|
||||
EFI_STATUS Status;
|
||||
UART_DEVICE_PATH *Uart;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Uart = (UART_DEVICE_PATH *) DevicePathNode;
|
||||
Uart = (UART_DEVICE_PATH *)DevicePathNode;
|
||||
Status = AppendCSDNum (MappingItem, Uart->BaudRate);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Uart->DataBits);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Uart->Parity);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Uart->StopBits);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -615,11 +618,10 @@ DevPathSerialUsb (
|
||||
EFI_STATUS Status;
|
||||
USB_INTERFACE_DESCRIPTOR InterfaceDesc;
|
||||
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
|
||||
Usb = (USB_DEVICE_PATH *) DevicePathNode;
|
||||
Usb = (USB_DEVICE_PATH *)DevicePathNode;
|
||||
Status = AppendCSDNum (MappingItem, Usb->ParentPortNumber);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Usb->InterfaceNumber);
|
||||
@ -629,19 +631,19 @@ DevPathSerialUsb (
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (PcdGetBool(PcdUsbExtendedDecode)) {
|
||||
Status = gBS->LocateDevicePath( &gEfiUsbIoProtocolGuid, &DevicePath, &TempHandle );
|
||||
if (PcdGetBool (PcdUsbExtendedDecode)) {
|
||||
Status = gBS->LocateDevicePath (&gEfiUsbIoProtocolGuid, &DevicePath, &TempHandle);
|
||||
UsbIo = NULL;
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = gBS->OpenProtocol(TempHandle, &gEfiUsbIoProtocolGuid, (VOID**)&UsbIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = gBS->OpenProtocol (TempHandle, &gEfiUsbIoProtocolGuid, (VOID **)&UsbIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
ASSERT(UsbIo != NULL);
|
||||
Status = UsbIo->UsbGetInterfaceDescriptor(UsbIo, &InterfaceDesc);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (InterfaceDesc.InterfaceClass == USB_MASS_STORE_CLASS && MappingItem->Mtd == MTDTypeUnknown) {
|
||||
switch (InterfaceDesc.InterfaceSubClass){
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ASSERT (UsbIo != NULL);
|
||||
Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if ((InterfaceDesc.InterfaceClass == USB_MASS_STORE_CLASS) && (MappingItem->Mtd == MTDTypeUnknown)) {
|
||||
switch (InterfaceDesc.InterfaceSubClass) {
|
||||
case USB_MASS_STORE_SCSI:
|
||||
MappingItem->Mtd = MTDTypeHardDisk;
|
||||
break;
|
||||
@ -657,6 +659,7 @@ DevPathSerialUsb (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -685,34 +688,36 @@ DevPathSerialVendor (
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *NewBuffer;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Vendor = (VENDOR_DEVICE_PATH *) DevicePathNode;
|
||||
Vendor = (VENDOR_DEVICE_PATH *)DevicePathNode;
|
||||
Status = AppendCSDGuid (MappingItem, &Vendor->Guid);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (CompareGuid (&gEfiSasDevicePathGuid, &Vendor->Guid)) {
|
||||
Sas = (SAS_DEVICE_PATH *) Vendor;
|
||||
Sas = (SAS_DEVICE_PATH *)Vendor;
|
||||
Status = AppendCSDNum (MappingItem, Sas->SasAddress);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Sas->Lun);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Sas->DeviceTopology);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Sas->RelativeTargetPort);
|
||||
}
|
||||
} else {
|
||||
TargetNameLength = MIN(DevicePathNodeLength (DevicePathNode) - sizeof (VENDOR_DEVICE_PATH), PcdGet32(PcdShellVendorExtendedDecode));
|
||||
TargetNameLength = MIN (DevicePathNodeLength (DevicePathNode) - sizeof (VENDOR_DEVICE_PATH), PcdGet32 (PcdShellVendorExtendedDecode));
|
||||
if (TargetNameLength != 0) {
|
||||
//
|
||||
// String is 2 chars per data byte, plus NULL terminator
|
||||
//
|
||||
Buffer = AllocateZeroPool (((TargetNameLength * 2) + 1) * sizeof(CHAR16));
|
||||
Buffer = AllocateZeroPool (((TargetNameLength * 2) + 1) * sizeof (CHAR16));
|
||||
if (Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -721,11 +726,12 @@ DevPathSerialVendor (
|
||||
// Build the string data
|
||||
//
|
||||
for (Index = 0; Index < TargetNameLength; Index++) {
|
||||
NewBuffer = CatSPrint (Buffer, L"%02x", *((UINT8*)Vendor + sizeof (VENDOR_DEVICE_PATH) + Index));
|
||||
NewBuffer = CatSPrint (Buffer, L"%02x", *((UINT8 *)Vendor + sizeof (VENDOR_DEVICE_PATH) + Index));
|
||||
if (NewBuffer == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
|
||||
Buffer = NewBuffer;
|
||||
}
|
||||
|
||||
@ -736,9 +742,10 @@ DevPathSerialVendor (
|
||||
Status = AppendCSDStr (MappingItem, Buffer);
|
||||
}
|
||||
|
||||
FreePool(Buffer);
|
||||
FreePool (Buffer);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -761,10 +768,10 @@ DevPathSerialLun (
|
||||
{
|
||||
DEVICE_LOGICAL_UNIT_DEVICE_PATH *Lun;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Lun = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *) DevicePathNode;
|
||||
Lun = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *)DevicePathNode;
|
||||
return AppendCSDNum (MappingItem, Lun->Lun);
|
||||
}
|
||||
|
||||
@ -788,17 +795,19 @@ DevPathSerialSata (
|
||||
EFI_STATUS Status;
|
||||
SATA_DEVICE_PATH *Sata;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Sata = (SATA_DEVICE_PATH *) DevicePathNode;
|
||||
Sata = (SATA_DEVICE_PATH *)DevicePathNode;
|
||||
Status = AppendCSDNum (MappingItem, Sata->HBAPortNumber);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Sata->PortMultiplierPortNumber);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Sata->Lun);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -826,41 +835,47 @@ DevPathSerialIScsi (
|
||||
UINTN TargetNameLength;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
if (PcdGetBool(PcdShellDecodeIScsiMapNames)) {
|
||||
IScsi = (ISCSI_DEVICE_PATH *) DevicePathNode;
|
||||
if (PcdGetBool (PcdShellDecodeIScsiMapNames)) {
|
||||
IScsi = (ISCSI_DEVICE_PATH *)DevicePathNode;
|
||||
Status = AppendCSDNum (MappingItem, IScsi->NetworkProtocol);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, IScsi->LoginOption);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, IScsi->Lun);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, IScsi->TargetPortalGroupTag);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
TargetNameLength = DevicePathNodeLength (DevicePathNode) - sizeof (ISCSI_DEVICE_PATH);
|
||||
if (TargetNameLength > 0) {
|
||||
TargetName = AllocateZeroPool ((TargetNameLength + 1) * sizeof (CHAR16));
|
||||
if (TargetName == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
} else {
|
||||
IScsiTargetName = (UINT8 *) (IScsi + 1);
|
||||
IScsiTargetName = (UINT8 *)(IScsi + 1);
|
||||
for (Index = 0; Index < TargetNameLength; Index++) {
|
||||
TargetName[Index] = (CHAR16) IScsiTargetName[Index];
|
||||
TargetName[Index] = (CHAR16)IScsiTargetName[Index];
|
||||
}
|
||||
|
||||
Status = AppendCSDStr (MappingItem, TargetName);
|
||||
FreePool (TargetName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -883,10 +898,10 @@ DevPathSerialI2O (
|
||||
{
|
||||
I2O_DEVICE_PATH *DevicePath_I20;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
DevicePath_I20 = (I2O_DEVICE_PATH *) DevicePathNode;
|
||||
DevicePath_I20 = (I2O_DEVICE_PATH *)DevicePathNode;
|
||||
return AppendCSDNum (MappingItem, DevicePath_I20->Tid);
|
||||
}
|
||||
|
||||
@ -913,18 +928,18 @@ DevPathSerialMacAddr (
|
||||
CHAR16 Buffer[64];
|
||||
CHAR16 *PBuffer;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Mac = (MAC_ADDR_DEVICE_PATH *) DevicePathNode;
|
||||
Mac = (MAC_ADDR_DEVICE_PATH *)DevicePathNode;
|
||||
|
||||
HwAddressSize = sizeof (EFI_MAC_ADDRESS);
|
||||
if (Mac->IfType == 0x01 || Mac->IfType == 0x00) {
|
||||
if ((Mac->IfType == 0x01) || (Mac->IfType == 0x00)) {
|
||||
HwAddressSize = 6;
|
||||
}
|
||||
|
||||
for (Index = 0, PBuffer = Buffer; Index < HwAddressSize; Index++, PBuffer += 2) {
|
||||
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN) Mac->MacAddress.Addr[Index]);
|
||||
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)Mac->MacAddress.Addr[Index]);
|
||||
}
|
||||
|
||||
return AppendCSDStr (MappingItem, Buffer);
|
||||
@ -953,24 +968,27 @@ DevPathSerialInfiniBand (
|
||||
CHAR16 Buffer[64];
|
||||
CHAR16 *PBuffer;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
InfiniBand = (INFINIBAND_DEVICE_PATH *) DevicePathNode;
|
||||
InfiniBand = (INFINIBAND_DEVICE_PATH *)DevicePathNode;
|
||||
for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) {
|
||||
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN) InfiniBand->PortGid[Index]);
|
||||
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)InfiniBand->PortGid[Index]);
|
||||
}
|
||||
|
||||
Status = AppendCSDStr (MappingItem, Buffer);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, InfiniBand->ServiceId);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, InfiniBand->TargetPortId);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, InfiniBand->DeviceId);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -995,38 +1013,41 @@ DevPathSerialIPv4 (
|
||||
IPv4_DEVICE_PATH *Ip;
|
||||
CHAR16 Buffer[10];
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Ip = (IPv4_DEVICE_PATH *) DevicePathNode;
|
||||
Ip = (IPv4_DEVICE_PATH *)DevicePathNode;
|
||||
UnicodeSPrint (
|
||||
Buffer,
|
||||
0,
|
||||
L"%02x%02x%02x%02x",
|
||||
(UINTN) Ip->LocalIpAddress.Addr[0],
|
||||
(UINTN) Ip->LocalIpAddress.Addr[1],
|
||||
(UINTN) Ip->LocalIpAddress.Addr[2],
|
||||
(UINTN) Ip->LocalIpAddress.Addr[3]
|
||||
(UINTN)Ip->LocalIpAddress.Addr[0],
|
||||
(UINTN)Ip->LocalIpAddress.Addr[1],
|
||||
(UINTN)Ip->LocalIpAddress.Addr[2],
|
||||
(UINTN)Ip->LocalIpAddress.Addr[3]
|
||||
);
|
||||
Status = AppendCSDStr (MappingItem, Buffer);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Ip->LocalPort);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
UnicodeSPrint (
|
||||
Buffer,
|
||||
0,
|
||||
L"%02x%02x%02x%02x",
|
||||
(UINTN) Ip->RemoteIpAddress.Addr[0],
|
||||
(UINTN) Ip->RemoteIpAddress.Addr[1],
|
||||
(UINTN) Ip->RemoteIpAddress.Addr[2],
|
||||
(UINTN) Ip->RemoteIpAddress.Addr[3]
|
||||
(UINTN)Ip->RemoteIpAddress.Addr[0],
|
||||
(UINTN)Ip->RemoteIpAddress.Addr[1],
|
||||
(UINTN)Ip->RemoteIpAddress.Addr[2],
|
||||
(UINTN)Ip->RemoteIpAddress.Addr[3]
|
||||
);
|
||||
Status = AppendCSDStr (MappingItem, Buffer);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Ip->RemotePort);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -1053,28 +1074,31 @@ DevPathSerialIPv6 (
|
||||
CHAR16 Buffer[64];
|
||||
CHAR16 *PBuffer;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Ip = (IPv6_DEVICE_PATH *) DevicePathNode;
|
||||
Ip = (IPv6_DEVICE_PATH *)DevicePathNode;
|
||||
for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) {
|
||||
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN) Ip->LocalIpAddress.Addr[Index]);
|
||||
UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)Ip->LocalIpAddress.Addr[Index]);
|
||||
}
|
||||
|
||||
Status = AppendCSDStr (MappingItem, Buffer);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Ip->LocalPort);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
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]);
|
||||
}
|
||||
|
||||
Status = AppendCSDStr (MappingItem, Buffer);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Ip->RemotePort);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -1098,14 +1122,15 @@ DevPathSerialScsi (
|
||||
EFI_STATUS Status;
|
||||
SCSI_DEVICE_PATH *Scsi;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Scsi = (SCSI_DEVICE_PATH *) DevicePathNode;
|
||||
Scsi = (SCSI_DEVICE_PATH *)DevicePathNode;
|
||||
Status = AppendCSDNum (MappingItem, Scsi->Pun);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = AppendCSDNum (MappingItem, Scsi->Lun);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -1129,10 +1154,10 @@ DevPathSerial1394 (
|
||||
F1394_DEVICE_PATH *DevicePath_F1394;
|
||||
CHAR16 Buffer[20];
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
DevicePath_F1394 = (F1394_DEVICE_PATH *) DevicePathNode;
|
||||
DevicePath_F1394 = (F1394_DEVICE_PATH *)DevicePathNode;
|
||||
UnicodeSPrint (Buffer, 0, L"%lx", DevicePath_F1394->Guid);
|
||||
return AppendCSDStr (MappingItem, Buffer);
|
||||
}
|
||||
@ -1156,16 +1181,17 @@ DevPathSerialAcpi (
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) DevicePathNode;
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *)DevicePathNode;
|
||||
if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
|
||||
if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) {
|
||||
MappingItem->Mtd = MTDTypeFloppy;
|
||||
return AppendCSDNum (MappingItem, Acpi->UID);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1333,14 +1359,14 @@ IsHIDevicePathNode (
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
|
||||
ASSERT(DevicePathNode != NULL);
|
||||
ASSERT (DevicePathNode != NULL);
|
||||
|
||||
if (DevicePathNode->Type == HARDWARE_DEVICE_PATH) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (DevicePathNode->Type == ACPI_DEVICE_PATH) {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) DevicePathNode;
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *)DevicePathNode;
|
||||
switch (EISA_ID_TO_NUM (Acpi->HID)) {
|
||||
case 0x0301:
|
||||
case 0x0401:
|
||||
@ -1373,7 +1399,7 @@ GetHIDevicePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
||||
|
||||
ASSERT(DevicePath != NULL);
|
||||
ASSERT (DevicePath != NULL);
|
||||
|
||||
NonHIDevicePathNodeCount = 0;
|
||||
|
||||
@ -1399,10 +1425,11 @@ GetHIDevicePath (
|
||||
} else {
|
||||
NonHIDevicePathNodeCount++;
|
||||
}
|
||||
|
||||
//
|
||||
// Next device path node
|
||||
//
|
||||
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (DevicePath);
|
||||
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)NextDevicePathNode (DevicePath);
|
||||
}
|
||||
|
||||
return HIDevicePath;
|
||||
@ -1427,8 +1454,8 @@ GetDeviceConsistMappingInfo (
|
||||
UINTN Index;
|
||||
EFI_DEVICE_PATH_PROTOCOL *OriginalDevicePath;
|
||||
|
||||
ASSERT(DevicePath != NULL);
|
||||
ASSERT(MappingItem != NULL);
|
||||
ASSERT (DevicePath != NULL);
|
||||
ASSERT (MappingItem != NULL);
|
||||
|
||||
SetMem (&MappingItem->Csd, sizeof (POOL_PRINT), 0);
|
||||
OriginalDevicePath = DevicePath;
|
||||
@ -1439,10 +1466,10 @@ GetDeviceConsistMappingInfo (
|
||||
// initialize with generic function in case nothing is found
|
||||
//
|
||||
for (SerialFun = DevPathSerialDefault, Index = 0; DevPathConsistMappingTable[Index].SerialFun != NULL; Index += 1) {
|
||||
|
||||
if (DevicePathType (DevicePath) == DevPathConsistMappingTable[Index].Type &&
|
||||
DevicePathSubType (DevicePath) == DevPathConsistMappingTable[Index].SubType
|
||||
) {
|
||||
if ((DevicePathType (DevicePath) == DevPathConsistMappingTable[Index].Type) &&
|
||||
(DevicePathSubType (DevicePath) == DevPathConsistMappingTable[Index].SubType)
|
||||
)
|
||||
{
|
||||
SerialFun = DevPathConsistMappingTable[Index].SerialFun;
|
||||
break;
|
||||
}
|
||||
@ -1457,7 +1484,7 @@ GetDeviceConsistMappingInfo (
|
||||
//
|
||||
// Next device path node
|
||||
//
|
||||
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (DevicePath);
|
||||
DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)NextDevicePathNode (DevicePath);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -1496,14 +1523,14 @@ ShellCommandConsistMappingInitialize (
|
||||
&HandleNum,
|
||||
&HandleBuffer
|
||||
);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
TempTable = AllocateZeroPool ((HandleNum + 1) * sizeof (EFI_DEVICE_PATH_PROTOCOL *));
|
||||
if (TempTable == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
for (HandleLoop = 0 ; HandleLoop < HandleNum ; HandleLoop++) {
|
||||
for (HandleLoop = 0; HandleLoop < HandleNum; HandleLoop++) {
|
||||
DevicePath = DevicePathFromHandle (HandleBuffer[HandleLoop]);
|
||||
if (DevicePath == NULL) {
|
||||
continue;
|
||||
@ -1514,16 +1541,18 @@ ShellCommandConsistMappingInitialize (
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = gBS->HandleProtocol( HandleBuffer[HandleLoop],
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[HandleLoop],
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **)&BlockIo
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = gBS->HandleProtocol( HandleBuffer[HandleLoop],
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[HandleLoop],
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
(VOID **)&SimpleFileSystem
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (HIDevicePath);
|
||||
continue;
|
||||
}
|
||||
@ -1541,8 +1570,10 @@ ShellCommandConsistMappingInitialize (
|
||||
}
|
||||
}
|
||||
|
||||
for (Index = 0; TempTable[Index] != NULL; Index++);
|
||||
PerformQuickSort(TempTable, Index, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare);
|
||||
for (Index = 0; TempTable[Index] != NULL; Index++) {
|
||||
}
|
||||
|
||||
PerformQuickSort (TempTable, Index, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
|
||||
*Table = TempTable;
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
@ -1569,7 +1600,7 @@ ShellCommandConsistMappingUnInitialize (
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
ASSERT(Table != NULL);
|
||||
ASSERT (Table != NULL);
|
||||
|
||||
for (Index = 0; Table[Index] != NULL; Index++) {
|
||||
FreePool (Table[Index]);
|
||||
@ -1605,8 +1636,8 @@ ShellCommandConsistMappingGenMappingName (
|
||||
EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT(DevicePath != NULL);
|
||||
ASSERT(Table != NULL);
|
||||
ASSERT (DevicePath != NULL);
|
||||
ASSERT (Table != NULL);
|
||||
|
||||
HIDevicePath = GetHIDevicePath (DevicePath);
|
||||
if (HIDevicePath == NULL) {
|
||||
@ -1645,16 +1676,18 @@ ShellCommandConsistMappingGenMappingName (
|
||||
}
|
||||
|
||||
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);
|
||||
FreePool (MappingInfo.Csd.Str);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status) && Str.Str != NULL) {
|
||||
if (!EFI_ERROR (Status) && (Str.Str != NULL)) {
|
||||
Status = CatPrint (&Str, L":");
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
SHELL_FREE_NON_NULL (Str.Str);
|
||||
return NULL;
|
||||
@ -1678,15 +1711,15 @@ ShellCommandFindMapItem (
|
||||
{
|
||||
SHELL_MAP_LIST *MapListItem;
|
||||
|
||||
for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode(&gShellMapList.Link)
|
||||
; !IsNull(&gShellMapList.Link, &MapListItem->Link)
|
||||
; MapListItem = (SHELL_MAP_LIST *)GetNextNode(&gShellMapList.Link, &MapListItem->Link)
|
||||
){
|
||||
if (gUnicodeCollation->StriColl(gUnicodeCollation,MapListItem->MapName,(CHAR16*)MapKey) == 0) {
|
||||
for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
|
||||
; !IsNull (&gShellMapList.Link, &MapListItem->Link)
|
||||
; MapListItem = (SHELL_MAP_LIST *)GetNextNode (&gShellMapList.Link, &MapListItem->Link)
|
||||
)
|
||||
{
|
||||
if (gUnicodeCollation->StriColl (gUnicodeCollation, MapListItem->MapName, (CHAR16 *)MapKey) == 0) {
|
||||
return (MapListItem);
|
||||
}
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,7 +41,7 @@
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/OrderedCollectionLib.h>
|
||||
|
||||
typedef struct{
|
||||
typedef struct {
|
||||
LIST_ENTRY Link;
|
||||
CHAR16 *CommandString;
|
||||
SHELL_GET_MAN_FILENAME GetManFileName;
|
||||
@ -81,4 +81,3 @@ typedef struct {
|
||||
} SHELL_SORT_UNIQUE_NAME;
|
||||
|
||||
#endif //_UEFI_COMMAND_LIB_INTERNAL_HEADER_
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
#include "UefiShellDebug1CommandsLib.h"
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-n", TypeValue},
|
||||
{L"-s", TypeValue},
|
||||
{NULL, TypeMax}
|
||||
};
|
||||
{ L"-n", TypeValue },
|
||||
{ L"-s", TypeValue },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
OutOfDiffPoint,
|
||||
@ -43,7 +43,7 @@ typedef struct {
|
||||
|
||||
**/
|
||||
VOID
|
||||
PrintDifferentPoint(
|
||||
PrintDifferentPoint (
|
||||
CONST CHAR16 *FileName,
|
||||
CHAR16 *FileTag,
|
||||
UINT8 *Buffer,
|
||||
@ -73,7 +73,7 @@ PrintDifferentPoint(
|
||||
// Print data in char-format.
|
||||
//
|
||||
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]);
|
||||
} else {
|
||||
//
|
||||
@ -165,15 +165,20 @@ FileBufferReadByte (
|
||||
|
||||
if (FileBuffer->Left == 0) {
|
||||
ReadSize = FileBuffer->Allocated;
|
||||
Status = gEfiShellProtocol->ReadFile (FileHandle, &ReadSize,
|
||||
FileBuffer->Data);
|
||||
Status = gEfiShellProtocol->ReadFile (
|
||||
FileHandle,
|
||||
&ReadSize,
|
||||
FileBuffer->Data
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (ReadSize == 0) {
|
||||
*BytesRead = 0;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
FileBuffer->Next = 0;
|
||||
FileBuffer->Left = ReadSize;
|
||||
}
|
||||
@ -248,63 +253,65 @@ ShellCommandRunComp (
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"comp", ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"comp", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
} else {
|
||||
if (ShellCommandLineGetCount(Package) > 3) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"comp");
|
||||
if (ShellCommandLineGetCount (Package) > 3) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"comp");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetCount(Package) < 3) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"comp");
|
||||
} else if (ShellCommandLineGetCount (Package) < 3) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"comp");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
TempParam = ShellCommandLineGetRawValue(Package, 1);
|
||||
ASSERT(TempParam != NULL);
|
||||
FileName1 = ShellFindFilePath(TempParam);
|
||||
TempParam = ShellCommandLineGetRawValue (Package, 1);
|
||||
ASSERT (TempParam != NULL);
|
||||
FileName1 = ShellFindFilePath (TempParam);
|
||||
if (FileName1 == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
} else {
|
||||
Status = ShellOpenFileByName(FileName1, &FileHandle1, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
|
||||
Status = ShellOpenFileByName (FileName1, &FileHandle1, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
TempParam = ShellCommandLineGetRawValue(Package, 2);
|
||||
ASSERT(TempParam != NULL);
|
||||
FileName2 = ShellFindFilePath(TempParam);
|
||||
|
||||
TempParam = ShellCommandLineGetRawValue (Package, 2);
|
||||
ASSERT (TempParam != NULL);
|
||||
FileName2 = ShellFindFilePath (TempParam);
|
||||
if (FileName2 == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
} else {
|
||||
Status = ShellOpenFileByName(FileName2, &FileHandle2, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
|
||||
Status = ShellOpenFileByName (FileName2, &FileHandle2, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam);
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
Status = gEfiShellProtocol->GetFileSize(FileHandle1, &Size1);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = gEfiShellProtocol->GetFileSize(FileHandle2, &Size2);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = gEfiShellProtocol->GetFileSize (FileHandle1, &Size1);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
Status = gEfiShellProtocol->GetFileSize (FileHandle2, &Size2);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (ShellCommandLineGetFlag (Package, L"-n")) {
|
||||
TempParam = ShellCommandLineGetValue (Package, L"-n");
|
||||
@ -316,7 +323,7 @@ ShellCommandRunComp (
|
||||
DifferentCount = MAX_UINTN;
|
||||
} else {
|
||||
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");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
@ -331,7 +338,7 @@ ShellCommandRunComp (
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
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");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
@ -348,8 +355,9 @@ ShellCommandRunComp (
|
||||
DataFromFile2 = AllocateZeroPool ((UINTN)DifferentBytes);
|
||||
FileBufferInit (&FileBuffer1);
|
||||
FileBufferInit (&FileBuffer2);
|
||||
if (DataFromFile1 == NULL || DataFromFile2 == NULL ||
|
||||
FileBuffer1.Data == NULL || FileBuffer2.Data == NULL) {
|
||||
if ((DataFromFile1 == NULL) || (DataFromFile2 == NULL) ||
|
||||
(FileBuffer1.Data == NULL) || (FileBuffer2.Data == NULL))
|
||||
{
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
SHELL_FREE_NON_NULL (DataFromFile1);
|
||||
SHELL_FREE_NON_NULL (DataFromFile2);
|
||||
@ -364,11 +372,19 @@ ShellCommandRunComp (
|
||||
DataSizeFromFile2 = 1;
|
||||
OneByteFromFile1 = 0;
|
||||
OneByteFromFile2 = 0;
|
||||
Status = FileBufferReadByte (FileHandle1, &FileBuffer1,
|
||||
&DataSizeFromFile1, &OneByteFromFile1);
|
||||
Status = FileBufferReadByte (
|
||||
FileHandle1,
|
||||
&FileBuffer1,
|
||||
&DataSizeFromFile1,
|
||||
&OneByteFromFile1
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
Status = FileBufferReadByte (FileHandle2, &FileBuffer2,
|
||||
&DataSizeFromFile2, &OneByteFromFile2);
|
||||
Status = FileBufferReadByte (
|
||||
FileHandle2,
|
||||
&FileBuffer2,
|
||||
&DataSizeFromFile2,
|
||||
&OneByteFromFile2
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
TempAddress++;
|
||||
@ -378,9 +394,10 @@ ShellCommandRunComp (
|
||||
// 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.
|
||||
//
|
||||
if ( (DataSizeFromFile1 == 0 && InsertPosition1 == 0 && DataSizeFromFile2 == 0 && InsertPosition2 == 0) ||
|
||||
(ReadStatus == InPrevDiffPoint && (DataSizeFromFile1 == 0 || DataSizeFromFile2 == 0))
|
||||
) {
|
||||
if (((DataSizeFromFile1 == 0) && (InsertPosition1 == 0) && (DataSizeFromFile2 == 0) && (InsertPosition2 == 0)) ||
|
||||
((ReadStatus == InPrevDiffPoint) && ((DataSizeFromFile1 == 0) || (DataSizeFromFile2 == 0)))
|
||||
)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -391,6 +408,7 @@ ShellCommandRunComp (
|
||||
if (DataSizeFromFile1 == 1) {
|
||||
DataFromFile1[InsertPosition1++] = OneByteFromFile1;
|
||||
}
|
||||
|
||||
if (DataSizeFromFile2 == 1) {
|
||||
DataFromFile2[InsertPosition2++] = OneByteFromFile2;
|
||||
}
|
||||
@ -399,6 +417,7 @@ ShellCommandRunComp (
|
||||
if (DataSizeFromFile1 == 1) {
|
||||
DataFromFile1[InsertPosition1++] = OneByteFromFile1;
|
||||
}
|
||||
|
||||
if (DataSizeFromFile2 == 1) {
|
||||
DataFromFile2[InsertPosition2++] = OneByteFromFile2;
|
||||
}
|
||||
@ -411,11 +430,11 @@ ShellCommandRunComp (
|
||||
//
|
||||
// ReadStatus should be always equal InDiffPoint.
|
||||
//
|
||||
if ( InsertPosition1 == DifferentBytes ||
|
||||
InsertPosition2 == DifferentBytes ||
|
||||
(DataSizeFromFile1 == 0 && DataSizeFromFile2 == 0)
|
||||
) {
|
||||
|
||||
if ((InsertPosition1 == DifferentBytes) ||
|
||||
(InsertPosition2 == DifferentBytes) ||
|
||||
((DataSizeFromFile1 == 0) && (DataSizeFromFile2 == 0))
|
||||
)
|
||||
{
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_DIFFERENCE_POINT), gShellDebug1HiiHandle, ++DiffPointNumber);
|
||||
PrintDifferentPoint (FileName1, L"File1", DataFromFile1, InsertPosition1, 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.
|
||||
//
|
||||
if (InsertPosition1 == 0 || InsertPosition2 == 0) {
|
||||
if ((InsertPosition1 == 0) || (InsertPosition2 == 0)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -438,7 +457,7 @@ ShellCommandRunComp (
|
||||
//
|
||||
// Try to find a new different point in the rest of DataFromFile.
|
||||
//
|
||||
for (; Index < MAX (InsertPosition1,InsertPosition2); Index++) {
|
||||
for ( ; Index < MAX (InsertPosition1, InsertPosition2); Index++) {
|
||||
if (DataFromFile1[Index] != DataFromFile2[Index]) {
|
||||
ReadStatus = InDiffPoint;
|
||||
DiffPointAddress += Index;
|
||||
@ -469,24 +488,26 @@ ShellCommandRunComp (
|
||||
FileBufferUninit (&FileBuffer2);
|
||||
|
||||
if (DiffPointNumber == 0) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_PASS), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_PASS), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellStatus = SHELL_NOT_EQUAL;
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_FAIL), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_FAIL), gShellDebug1HiiHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
SHELL_FREE_NON_NULL(FileName1);
|
||||
SHELL_FREE_NON_NULL(FileName2);
|
||||
|
||||
SHELL_FREE_NON_NULL (FileName1);
|
||||
SHELL_FREE_NON_NULL (FileName2);
|
||||
|
||||
if (FileHandle1 != NULL) {
|
||||
gEfiShellProtocol->CloseFile(FileHandle1);
|
||||
gEfiShellProtocol->CloseFile (FileHandle1);
|
||||
}
|
||||
|
||||
if (FileHandle2 != NULL) {
|
||||
gEfiShellProtocol->CloseFile(FileHandle2);
|
||||
gEfiShellProtocol->CloseFile (FileHandle2);
|
||||
}
|
||||
|
||||
return (ShellStatus);
|
||||
|
@ -49,9 +49,9 @@ typedef INT16 NODE;
|
||||
#define NT (CODE_BIT + 3)
|
||||
#define TBIT 5
|
||||
#if NT > NP
|
||||
#define NPT NT
|
||||
#define NPT NT
|
||||
#else
|
||||
#define NPT NP
|
||||
#define NPT NP
|
||||
#endif
|
||||
//
|
||||
// Function Prototypes
|
||||
@ -63,7 +63,7 @@ typedef INT16 NODE;
|
||||
@param[in] Data The dword to put.
|
||||
**/
|
||||
VOID
|
||||
PutDword(
|
||||
PutDword (
|
||||
IN UINT32 Data
|
||||
);
|
||||
|
||||
@ -142,7 +142,7 @@ MakeCrcTable (
|
||||
}
|
||||
}
|
||||
|
||||
mCrcTable[LoopVar1] = (UINT16) LoopVar4;
|
||||
mCrcTable[LoopVar1] = (UINT16)LoopVar4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,19 +157,19 @@ PutDword (
|
||||
)
|
||||
{
|
||||
if (mDst < mDstUpperLimit) {
|
||||
*mDst++ = (UINT8) (((UINT8) (Data)) & 0xff);
|
||||
*mDst++ = (UINT8)(((UINT8)(Data)) & 0xff);
|
||||
}
|
||||
|
||||
if (mDst < mDstUpperLimit) {
|
||||
*mDst++ = (UINT8) (((UINT8) (Data >> 0x08)) & 0xff);
|
||||
*mDst++ = (UINT8)(((UINT8)(Data >> 0x08)) & 0xff);
|
||||
}
|
||||
|
||||
if (mDst < mDstUpperLimit) {
|
||||
*mDst++ = (UINT8) (((UINT8) (Data >> 0x10)) & 0xff);
|
||||
*mDst++ = (UINT8)(((UINT8)(Data >> 0x10)) & 0xff);
|
||||
}
|
||||
|
||||
if (mDst < mDstUpperLimit) {
|
||||
*mDst++ = (UINT8) (((UINT8) (Data >> 0x18)) & 0xff);
|
||||
*mDst++ = (UINT8)(((UINT8)(Data >> 0x18)) & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ InitSlide (
|
||||
|
||||
mAvail = 1;
|
||||
for (LoopVar1 = 1; LoopVar1 < WNDSIZ - 1; LoopVar1++) {
|
||||
mNext[LoopVar1] = (NODE) (LoopVar1 + 1);
|
||||
mNext[LoopVar1] = (NODE)(LoopVar1 + 1);
|
||||
}
|
||||
|
||||
mNext[WNDSIZ - 1] = NIL;
|
||||
@ -296,7 +296,7 @@ MakeChild (
|
||||
|
||||
NODE LoopVar10;
|
||||
|
||||
LoopVar12 = (NODE) HASH (LoopVar6, LoopVar5);
|
||||
LoopVar12 = (NODE)HASH (LoopVar6, LoopVar5);
|
||||
LoopVar10 = mNext[LoopVar12];
|
||||
mNext[LoopVar12] = LoopVar4;
|
||||
mNext[LoopVar4] = LoopVar10;
|
||||
@ -330,7 +330,7 @@ Split (
|
||||
mNext[New] = LoopVar10;
|
||||
mPrev[LoopVar10] = New;
|
||||
mParent[New] = mParent[Old];
|
||||
mLevel[New] = (UINT8) mMatchLen;
|
||||
mLevel[New] = (UINT8)mMatchLen;
|
||||
mPosition[New] = mPos;
|
||||
MakeChild (New, mText[mMatchPos + mMatchLen], Old);
|
||||
MakeChild (New, mText[mPos + mMatchLen], mPos);
|
||||
@ -365,7 +365,7 @@ InsertNode (
|
||||
// in DeleteNode() later.
|
||||
//
|
||||
mMatchLen--;
|
||||
LoopVar4 = (NODE) ((mMatchPos + 1) | WNDSIZ);
|
||||
LoopVar4 = (NODE)((mMatchPos + 1) | WNDSIZ);
|
||||
LoopVar6 = mParent[LoopVar4];
|
||||
while (LoopVar6 == NIL) {
|
||||
LoopVar4 = mNext[LoopVar4];
|
||||
@ -384,35 +384,36 @@ InsertNode (
|
||||
}
|
||||
|
||||
if (LoopVar10 < WNDSIZ) {
|
||||
mPosition[LoopVar10] = (NODE) (mPos | PERC_FLAG);
|
||||
mPosition[LoopVar10] = (NODE)(mPos | PERC_FLAG);
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Locate the target tree
|
||||
//
|
||||
LoopVar6 = (NODE) (mText[mPos] + WNDSIZ);
|
||||
LoopVar6 = (NODE)(mText[mPos] + WNDSIZ);
|
||||
LoopVar5 = mText[mPos + 1];
|
||||
LoopVar4 = Child (LoopVar6, LoopVar5);
|
||||
if (LoopVar4 == NIL) {
|
||||
MakeChild (LoopVar6, LoopVar5, mPos);
|
||||
mMatchLen = 1;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
mMatchLen = 2;
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse down the tree to find a match.
|
||||
// Update Position value along the route.
|
||||
// Node split or creation is involved.
|
||||
//
|
||||
for (;;) {
|
||||
for ( ; ;) {
|
||||
if (LoopVar4 >= WNDSIZ) {
|
||||
LoopVar2 = MAXMATCH;
|
||||
mMatchPos = LoopVar4;
|
||||
} else {
|
||||
LoopVar2 = mLevel[LoopVar4];
|
||||
mMatchPos = (NODE) (mPosition[LoopVar4] & ~PERC_FLAG);
|
||||
mMatchPos = (NODE)(mPosition[LoopVar4] & ~PERC_FLAG);
|
||||
}
|
||||
|
||||
if (mMatchPos >= mPos) {
|
||||
@ -424,7 +425,7 @@ InsertNode (
|
||||
while (mMatchLen < LoopVar2) {
|
||||
if (*TempString3 != *TempString2) {
|
||||
Split (LoopVar4);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
mMatchLen++;
|
||||
@ -441,7 +442,7 @@ InsertNode (
|
||||
LoopVar4 = Child (LoopVar6, *TempString3);
|
||||
if (LoopVar4 == NIL) {
|
||||
MakeChild (LoopVar6, *TempString3, mPos);
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
mMatchLen++;
|
||||
@ -460,7 +461,6 @@ InsertNode (
|
||||
// Special usage of 'next'
|
||||
//
|
||||
mNext[LoopVar4] = mPos;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -484,7 +484,7 @@ DeleteNode (
|
||||
NODE LoopVar9;
|
||||
|
||||
if (mParent[mPos] == NIL) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
LoopVar4 = mPrev[mPos];
|
||||
@ -494,15 +494,15 @@ DeleteNode (
|
||||
LoopVar4 = mParent[mPos];
|
||||
mParent[mPos] = NIL;
|
||||
if (LoopVar4 >= WNDSIZ) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
mChildCount[LoopVar4]--;
|
||||
if (mChildCount[LoopVar4] > 1) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
LoopVar10 = (NODE) (mPosition[LoopVar4] & ~PERC_FLAG);
|
||||
LoopVar10 = (NODE)(mPosition[LoopVar4] & ~PERC_FLAG);
|
||||
if (LoopVar10 >= mPos) {
|
||||
LoopVar10 -= WNDSIZ;
|
||||
}
|
||||
@ -510,7 +510,7 @@ DeleteNode (
|
||||
LoopVar11 = LoopVar10;
|
||||
LoopVar6 = mParent[LoopVar4];
|
||||
LoopVar9 = mPosition[LoopVar6];
|
||||
while ((LoopVar9 & PERC_FLAG) != 0){
|
||||
while ((LoopVar9 & PERC_FLAG) != 0) {
|
||||
LoopVar9 &= ~PERC_FLAG;
|
||||
if (LoopVar9 >= mPos) {
|
||||
LoopVar9 -= WNDSIZ;
|
||||
@ -520,7 +520,7 @@ DeleteNode (
|
||||
LoopVar11 = LoopVar9;
|
||||
}
|
||||
|
||||
mPosition[LoopVar6] = (NODE) (LoopVar11 | WNDSIZ);
|
||||
mPosition[LoopVar6] = (NODE)(LoopVar11 | WNDSIZ);
|
||||
LoopVar6 = mParent[LoopVar6];
|
||||
LoopVar9 = mPosition[LoopVar6];
|
||||
}
|
||||
@ -534,7 +534,7 @@ DeleteNode (
|
||||
LoopVar11 = LoopVar9;
|
||||
}
|
||||
|
||||
mPosition[LoopVar6] = (NODE) (LoopVar11 | WNDSIZ | PERC_FLAG);
|
||||
mPosition[LoopVar6] = (NODE)(LoopVar11 | WNDSIZ | PERC_FLAG);
|
||||
}
|
||||
|
||||
LoopVar11 = Child (LoopVar4, mText[LoopVar10 + mLevel[LoopVar4]]);
|
||||
@ -609,6 +609,7 @@ GetNextMatch (
|
||||
if (Temp == NULL) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
CopyMem (Temp, &mText[WNDSIZ], WNDSIZ + MAXMATCH);
|
||||
CopyMem (&mText[0], Temp, WNDSIZ + MAXMATCH);
|
||||
FreePool (Temp);
|
||||
@ -643,7 +644,7 @@ DownHeap (
|
||||
LoopVar2 = mHeap[i];
|
||||
LoopVar1 = 2 * i;
|
||||
while (LoopVar1 <= mHeapSize) {
|
||||
if (LoopVar1 < mHeapSize && mFreq[mHeap[LoopVar1]] > mFreq[mHeap[LoopVar1 + 1]]) {
|
||||
if ((LoopVar1 < mHeapSize) && (mFreq[mHeap[LoopVar1]] > mFreq[mHeap[LoopVar1 + 1]])) {
|
||||
LoopVar1++;
|
||||
}
|
||||
|
||||
@ -656,7 +657,7 @@ DownHeap (
|
||||
LoopVar1 = 2 * i;
|
||||
}
|
||||
|
||||
mHeap[i] = (INT16) LoopVar2;
|
||||
mHeap[i] = (INT16)LoopVar2;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -726,7 +727,7 @@ MakeLen (
|
||||
LoopVar2 = mLenCnt[LoopVar1];
|
||||
LoopVar2--;
|
||||
while (LoopVar2 >= 0) {
|
||||
mLen[*mSortPtr++] = (UINT8) LoopVar1;
|
||||
mLen[*mSortPtr++] = (UINT8)LoopVar1;
|
||||
LoopVar2--;
|
||||
}
|
||||
}
|
||||
@ -742,8 +743,8 @@ MakeLen (
|
||||
VOID
|
||||
MakeCode (
|
||||
IN INT32 LoopVar8,
|
||||
IN UINT8 Len[ ],
|
||||
OUT UINT16 Code[ ]
|
||||
IN UINT8 Len[],
|
||||
OUT UINT16 Code[]
|
||||
)
|
||||
{
|
||||
INT32 LoopVar1;
|
||||
@ -751,7 +752,7 @@ MakeCode (
|
||||
|
||||
Start[1] = 0;
|
||||
for (LoopVar1 = 1; LoopVar1 <= 16; LoopVar1++) {
|
||||
Start[LoopVar1 + 1] = (UINT16) ((Start[LoopVar1] + mLenCnt[LoopVar1]) << 1);
|
||||
Start[LoopVar1 + 1] = (UINT16)((Start[LoopVar1] + mLenCnt[LoopVar1]) << 1);
|
||||
}
|
||||
|
||||
for (LoopVar1 = 0; LoopVar1 < LoopVar8; LoopVar1++) {
|
||||
@ -772,9 +773,9 @@ MakeCode (
|
||||
INT32
|
||||
MakeTree (
|
||||
IN INT32 NParm,
|
||||
IN UINT16 FreqParm[ ],
|
||||
OUT UINT8 LenParm[ ],
|
||||
OUT UINT16 CodeParm[ ]
|
||||
IN UINT16 FreqParm[],
|
||||
OUT UINT8 LenParm[],
|
||||
OUT UINT16 CodeParm[]
|
||||
)
|
||||
{
|
||||
INT32 LoopVar1;
|
||||
@ -798,7 +799,7 @@ MakeTree (
|
||||
mLen[LoopVar1] = 0;
|
||||
if ((mFreq[LoopVar1]) != 0) {
|
||||
mHeapSize++;
|
||||
mHeap[mHeapSize] = (INT16) LoopVar1;
|
||||
mHeap[mHeapSize] = (INT16)LoopVar1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -818,22 +819,22 @@ MakeTree (
|
||||
do {
|
||||
LoopVar1 = mHeap[1];
|
||||
if (LoopVar1 < mTempInt32) {
|
||||
*mSortPtr++ = (UINT16) LoopVar1;
|
||||
*mSortPtr++ = (UINT16)LoopVar1;
|
||||
}
|
||||
|
||||
mHeap[1] = mHeap[mHeapSize--];
|
||||
DownHeap (1);
|
||||
LoopVar2 = mHeap[1];
|
||||
if (LoopVar2 < mTempInt32) {
|
||||
*mSortPtr++ = (UINT16) LoopVar2;
|
||||
*mSortPtr++ = (UINT16)LoopVar2;
|
||||
}
|
||||
|
||||
LoopVar3 = Avail++;
|
||||
mFreq[LoopVar3] = (UINT16) (mFreq[LoopVar1] + mFreq[LoopVar2]);
|
||||
mHeap[1] = (INT16) LoopVar3;
|
||||
mFreq[LoopVar3] = (UINT16)(mFreq[LoopVar1] + mFreq[LoopVar2]);
|
||||
mHeap[1] = (INT16)LoopVar3;
|
||||
DownHeap (1);
|
||||
mLeft[LoopVar3] = (UINT16) LoopVar1;
|
||||
mRight[LoopVar3] = (UINT16) LoopVar2;
|
||||
mLeft[LoopVar3] = (UINT16)LoopVar1;
|
||||
mRight[LoopVar3] = (UINT16)LoopVar2;
|
||||
} while (mHeapSize > 1);
|
||||
|
||||
mSortPtr = CodeParm;
|
||||
@ -863,21 +864,21 @@ PutBits (
|
||||
if (LoopVar8 < mBitCount) {
|
||||
mSubBitBuf |= x << (mBitCount -= LoopVar8);
|
||||
} else {
|
||||
|
||||
Temp = (UINT8)(mSubBitBuf | (x >> (LoopVar8 -= mBitCount)));
|
||||
if (mDst < mDstUpperLimit) {
|
||||
*mDst++ = Temp;
|
||||
}
|
||||
|
||||
mCompSize++;
|
||||
|
||||
if (LoopVar8 < UINT8_BIT) {
|
||||
mSubBitBuf = x << (mBitCount = UINT8_BIT - LoopVar8);
|
||||
} else {
|
||||
|
||||
Temp = (UINT8)(x >> (LoopVar8 - UINT8_BIT));
|
||||
if (mDst < mDstUpperLimit) {
|
||||
*mDst++ = Temp;
|
||||
}
|
||||
|
||||
mCompSize++;
|
||||
|
||||
mSubBitBuf = x << (mBitCount = 2 * UINT8_BIT - LoopVar8);
|
||||
@ -921,7 +922,7 @@ EncodeP (
|
||||
|
||||
PutBits (mPTLen[LoopVar5], mPTCode[LoopVar5]);
|
||||
if (LoopVar5 > 1) {
|
||||
PutBits(LoopVar5 - 1, LoopVar7 & (0xFFFFU >> (17 - LoopVar5)));
|
||||
PutBits (LoopVar5 - 1, LoopVar7 & (0xFFFFU >> (17 - LoopVar5)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -962,7 +963,7 @@ CountTFreq (
|
||||
}
|
||||
|
||||
if (Count <= 2) {
|
||||
mTFreq[0] = (UINT16) (mTFreq[0] + Count);
|
||||
mTFreq[0] = (UINT16)(mTFreq[0] + Count);
|
||||
} else if (Count <= 18) {
|
||||
mTFreq[1]++;
|
||||
} else if (Count == 19) {
|
||||
@ -972,7 +973,7 @@ CountTFreq (
|
||||
mTFreq[2]++;
|
||||
}
|
||||
} else {
|
||||
ASSERT((LoopVar3+2)<(2 * NT - 1));
|
||||
ASSERT ((LoopVar3+2) < (2 * NT - 1));
|
||||
mTFreq[LoopVar3 + 2]++;
|
||||
}
|
||||
}
|
||||
@ -1069,7 +1070,7 @@ WriteCLen (
|
||||
PutBits (CBIT, Count - 20);
|
||||
}
|
||||
} else {
|
||||
ASSERT((LoopVar3+2)<NPT);
|
||||
ASSERT ((LoopVar3+2) < NPT);
|
||||
PutBits (mPTLen[LoopVar3 + 2], mPTCode[LoopVar3 + 2]);
|
||||
}
|
||||
}
|
||||
@ -1095,6 +1096,7 @@ SendBlock (
|
||||
UINT32 Pos;
|
||||
|
||||
UINT32 Size;
|
||||
|
||||
Flags = 0;
|
||||
|
||||
Root = MakeTree (NC, mCFreq, mCLen, mCCode);
|
||||
@ -1133,8 +1135,9 @@ SendBlock (
|
||||
} else {
|
||||
Flags <<= 1;
|
||||
}
|
||||
if ((Flags & (1U << (UINT8_BIT - 1))) != 0){
|
||||
EncodeC(mBuf[Pos++] + (1U << UINT8_BIT));
|
||||
|
||||
if ((Flags & (1U << (UINT8_BIT - 1))) != 0) {
|
||||
EncodeC (mBuf[Pos++] + (1U << UINT8_BIT));
|
||||
LoopVar3 = mBuf[Pos++] << UINT8_BIT;
|
||||
LoopVar3 += mBuf[Pos++];
|
||||
|
||||
@ -1191,17 +1194,19 @@ CompressOutput (
|
||||
CPos = mOutputPos++;
|
||||
mBuf[CPos] = 0;
|
||||
}
|
||||
mBuf[mOutputPos++] = (UINT8) LoopVar5;
|
||||
|
||||
mBuf[mOutputPos++] = (UINT8)LoopVar5;
|
||||
mCFreq[LoopVar5]++;
|
||||
if (LoopVar5 >= (1U << UINT8_BIT)) {
|
||||
mBuf[CPos] = (UINT8)(mBuf[CPos]|mOutputMask);
|
||||
mBuf[mOutputPos++] = (UINT8)(LoopVar7 >> UINT8_BIT);
|
||||
mBuf[mOutputPos++] = (UINT8) LoopVar7;
|
||||
mBuf[mOutputPos++] = (UINT8)LoopVar7;
|
||||
LoopVar5 = 0;
|
||||
while (LoopVar7!=0) {
|
||||
while (LoopVar7 != 0) {
|
||||
LoopVar7 >>= 1;
|
||||
LoopVar5++;
|
||||
}
|
||||
|
||||
mPFreq[LoopVar5]++;
|
||||
}
|
||||
}
|
||||
@ -1263,28 +1268,32 @@ Encode (
|
||||
if (!GetNextMatch ()) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
if (mMatchLen > mRemainder) {
|
||||
mMatchLen = mRemainder;
|
||||
}
|
||||
|
||||
if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {
|
||||
if ((mMatchLen > LastMatchLen) || (LastMatchLen < THRESHOLD)) {
|
||||
//
|
||||
// Not enough benefits are gained by outputting a pointer,
|
||||
// so just output the original character
|
||||
//
|
||||
CompressOutput(mText[mPos - 1], 0);
|
||||
CompressOutput (mText[mPos - 1], 0);
|
||||
} else {
|
||||
//
|
||||
// Outputting a pointer is beneficial enough, do it.
|
||||
//
|
||||
|
||||
CompressOutput(LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
|
||||
(mPos - LastMatchPos - 2) & (WNDSIZ - 1));
|
||||
CompressOutput (
|
||||
LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
|
||||
(mPos - LastMatchPos - 2) & (WNDSIZ - 1)
|
||||
);
|
||||
LastMatchLen--;
|
||||
while (LastMatchLen > 0) {
|
||||
if (!GetNextMatch ()) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
LastMatchLen--;
|
||||
}
|
||||
|
||||
@ -1354,12 +1363,14 @@ Compress (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// Null terminate the compressed data
|
||||
//
|
||||
if (mDst < mDstUpperLimit) {
|
||||
*mDst++ = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Fill in compressed size and original size
|
||||
//
|
||||
@ -1377,6 +1388,4 @@ Compress (
|
||||
*DstSize = mCompSize + 1 + 8;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,4 +30,3 @@ Compress (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
@retval SHELL_SUCCESS The display was successful.
|
||||
**/
|
||||
SHELL_STATUS
|
||||
DisplayTheBlocks(
|
||||
DisplayTheBlocks (
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath,
|
||||
IN CONST UINT64 Lba,
|
||||
IN CONST UINT8 BlockCount
|
||||
@ -36,33 +36,33 @@ DisplayTheBlocks(
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, (EFI_DEVICE_PATH_PROTOCOL **)&DevPath, &BlockIoHandle);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, (EFI_DEVICE_PATH_PROTOCOL **)&DevPath, &BlockIoHandle);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return (SHELL_NOT_FOUND);
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, (VOID**)&BlockIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = gBS->OpenProtocol (BlockIoHandle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return (SHELL_NOT_FOUND);
|
||||
}
|
||||
|
||||
BufferSize = BlockIo->Media->BlockSize * BlockCount;
|
||||
if(BlockIo->Media->IoAlign == 0) {
|
||||
if (BlockIo->Media->IoAlign == 0) {
|
||||
BlockIo->Media->IoAlign = 1;
|
||||
}
|
||||
|
||||
if (BufferSize > 0) {
|
||||
OriginalBuffer = AllocateZeroPool(BufferSize + BlockIo->Media->IoAlign);
|
||||
Buffer = ALIGN_POINTER (OriginalBuffer,BlockIo->Media->IoAlign);
|
||||
OriginalBuffer = AllocateZeroPool (BufferSize + BlockIo->Media->IoAlign);
|
||||
Buffer = ALIGN_POINTER (OriginalBuffer, BlockIo->Media->IoAlign);
|
||||
} else {
|
||||
ShellPrintEx(-1,-1,L" BlockSize: 0x%08x, BlockCount: 0x%08x\r\n", BlockIo->Media->BlockSize, BlockCount);
|
||||
ShellPrintEx (-1, -1, L" BlockSize: 0x%08x, BlockCount: 0x%08x\r\n", BlockIo->Media->BlockSize, BlockCount);
|
||||
OriginalBuffer = NULL;
|
||||
Buffer = NULL;
|
||||
}
|
||||
|
||||
Status = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);
|
||||
if (!EFI_ERROR(Status) && Buffer != NULL) {
|
||||
ShellPrintHiiEx(
|
||||
Status = BlockIo->ReadBlocks (BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);
|
||||
if (!EFI_ERROR (Status) && (Buffer != NULL)) {
|
||||
ShellPrintHiiEx (
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
@ -73,9 +73,9 @@ DisplayTheBlocks(
|
||||
BlockIo
|
||||
);
|
||||
|
||||
DumpHex(2,0,BufferSize,Buffer);
|
||||
DumpHex (2, 0, BufferSize, Buffer);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"dblk", L"BlockIo");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_READ_FAIL), gShellDebug1HiiHandle, L"dblk", L"BlockIo");
|
||||
ShellStatus = SHELL_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ DisplayTheBlocks(
|
||||
FreePool (OriginalBuffer);
|
||||
}
|
||||
|
||||
gBS->CloseProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, gImageHandle, NULL);
|
||||
gBS->CloseProtocol (BlockIoHandle, &gEfiBlockIoProtocolGuid, gImageHandle, NULL);
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
||||
@ -117,61 +117,63 @@ ShellCommandRunDblk (
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dblk", ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dblk", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
} else {
|
||||
if (ShellCommandLineGetCount(Package) > 4) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dblk");
|
||||
if (ShellCommandLineGetCount (Package) > 4) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dblk");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetCount(Package) < 2) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"dblk");
|
||||
} else if (ShellCommandLineGetCount (Package) < 2) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"dblk");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
//
|
||||
// Parse the params
|
||||
//
|
||||
BlockName = ShellCommandLineGetRawValue(Package, 1);
|
||||
LbaString = ShellCommandLineGetRawValue(Package, 2);
|
||||
BlockCountString = ShellCommandLineGetRawValue(Package, 3);
|
||||
BlockName = ShellCommandLineGetRawValue (Package, 1);
|
||||
LbaString = ShellCommandLineGetRawValue (Package, 2);
|
||||
BlockCountString = ShellCommandLineGetRawValue (Package, 3);
|
||||
|
||||
if (LbaString == NULL) {
|
||||
Lba = 0;
|
||||
} else {
|
||||
if (!ShellIsHexOrDecimalNumber(LbaString, TRUE, FALSE)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", LbaString);
|
||||
if (!ShellIsHexOrDecimalNumber (LbaString, TRUE, FALSE)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", LbaString);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
ShellConvertStringToUint64(LbaString, &Lba, TRUE, FALSE);
|
||||
|
||||
ShellConvertStringToUint64 (LbaString, &Lba, TRUE, FALSE);
|
||||
}
|
||||
|
||||
if (BlockCountString == NULL) {
|
||||
BlockCount = 1;
|
||||
} else {
|
||||
if (!ShellIsHexOrDecimalNumber(BlockCountString, TRUE, FALSE)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString);
|
||||
if (!ShellIsHexOrDecimalNumber (BlockCountString, TRUE, FALSE)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockCountString);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
ShellConvertStringToUint64(BlockCountString, &BlockCount, TRUE, FALSE);
|
||||
|
||||
ShellConvertStringToUint64 (BlockCountString, &BlockCount, TRUE, FALSE);
|
||||
if (BlockCount > 0x10) {
|
||||
BlockCount = 0x10;
|
||||
} else if (BlockCount == 0) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -180,16 +182,16 @@ ShellCommandRunDblk (
|
||||
//
|
||||
// do the work if we have a valid block identifier
|
||||
//
|
||||
if (gEfiShellProtocol->GetDevicePathFromMap(BlockName) == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockName);
|
||||
if (gEfiShellProtocol->GetDevicePathFromMap (BlockName) == NULL) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dblk", BlockName);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
DevPath = (EFI_DEVICE_PATH_PROTOCOL*)gEfiShellProtocol->GetDevicePathFromMap(BlockName);
|
||||
if (gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &DevPath, NULL) == EFI_NOT_FOUND) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MAP_PROTOCOL), gShellDebug1HiiHandle, L"dblk", BlockName, L"BlockIo");
|
||||
DevPath = (EFI_DEVICE_PATH_PROTOCOL *)gEfiShellProtocol->GetDevicePathFromMap (BlockName);
|
||||
if (gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DevPath, NULL) == EFI_NOT_FOUND) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_MAP_PROTOCOL), gShellDebug1HiiHandle, L"dblk", BlockName, L"BlockIo");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ShellStatus = DisplayTheBlocks(gEfiShellProtocol->GetDevicePathFromMap(BlockName), Lba, (UINT8)BlockCount);
|
||||
ShellStatus = DisplayTheBlocks (gEfiShellProtocol->GetDevicePathFromMap (BlockName), Lba, (UINT8)BlockCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -197,5 +199,6 @@ ShellCommandRunDblk (
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
@ -24,13 +24,14 @@
|
||||
@return A printable character representing Char.
|
||||
**/
|
||||
CHAR16
|
||||
MakePrintable(
|
||||
MakePrintable (
|
||||
IN CONST CHAR16 Char
|
||||
)
|
||||
{
|
||||
if ((Char < 0x20 && Char > 0)||(Char > 126)) {
|
||||
if (((Char < 0x20) && (Char > 0)) || (Char > 126)) {
|
||||
return (L'?');
|
||||
}
|
||||
|
||||
return (Char);
|
||||
}
|
||||
|
||||
@ -41,7 +42,7 @@ MakePrintable(
|
||||
@param[in] Size The length of memory to display.
|
||||
**/
|
||||
SHELL_STATUS
|
||||
DisplayMmioMemory(
|
||||
DisplayMmioMemory (
|
||||
IN CONST VOID *Address,
|
||||
IN CONST UINTN Size
|
||||
)
|
||||
@ -53,33 +54,34 @@ DisplayMmioMemory(
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
Status = gBS->LocateProtocol(&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID**)&PciRbIo);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"dmem");
|
||||
Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID **)&PciRbIo);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle, L"dmem");
|
||||
return (SHELL_NOT_FOUND);
|
||||
}
|
||||
Buffer = AllocateZeroPool(Size);
|
||||
|
||||
Buffer = AllocateZeroPool (Size);
|
||||
if (Buffer == NULL) {
|
||||
return SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Status = PciRbIo->Mem.Read(PciRbIo, EfiPciWidthUint8, (UINT64)(UINTN)Address, Size, Buffer);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_ER), gShellDebug1HiiHandle, L"dmem");
|
||||
Status = PciRbIo->Mem.Read (PciRbIo, EfiPciWidthUint8, (UINT64)(UINTN)Address, Size, Buffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_ER), gShellDebug1HiiHandle, L"dmem");
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
} else {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_MMIO_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
|
||||
DumpHex(2, (UINTN)Address, Size, Buffer);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_MMIO_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
|
||||
DumpHex (2, (UINTN)Address, Size, Buffer);
|
||||
}
|
||||
|
||||
FreePool(Buffer);
|
||||
FreePool (Buffer);
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-mmio", TypeFlag},
|
||||
{NULL, TypeMax}
|
||||
};
|
||||
{ L"-mmio", TypeFlag },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'dmem' command.
|
||||
@ -116,44 +118,45 @@ ShellCommandRunDmem (
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmem", ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmem", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
} else {
|
||||
if (ShellCommandLineGetCount(Package) > 3) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmem");
|
||||
if (ShellCommandLineGetCount (Package) > 3) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmem");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
Temp1 = ShellCommandLineGetRawValue(Package, 1);
|
||||
Temp1 = ShellCommandLineGetRawValue (Package, 1);
|
||||
if (Temp1 == NULL) {
|
||||
Address = gST;
|
||||
Size = sizeof (*gST);
|
||||
} else {
|
||||
if (!ShellIsHexOrDecimalNumber(Temp1, TRUE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp1, (UINT64*)&Address, TRUE, FALSE))) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
|
||||
if (!ShellIsHexOrDecimalNumber (Temp1, TRUE, FALSE) || EFI_ERROR (ShellConvertStringToUint64 (Temp1, (UINT64 *)&Address, TRUE, FALSE))) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
Temp1 = ShellCommandLineGetRawValue(Package, 2);
|
||||
|
||||
Temp1 = ShellCommandLineGetRawValue (Package, 2);
|
||||
if (Temp1 == NULL) {
|
||||
Size = 512;
|
||||
} else {
|
||||
if (!ShellIsHexOrDecimalNumber(Temp1, FALSE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp1, &Size, TRUE, FALSE))) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
|
||||
if (!ShellIsHexOrDecimalNumber (Temp1, FALSE, FALSE) || EFI_ERROR (ShellConvertStringToUint64 (Temp1, &Size, TRUE, FALSE))) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"dmem", Temp1);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
@ -161,39 +164,48 @@ ShellCommandRunDmem (
|
||||
}
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
if (!ShellCommandLineGetFlag(Package, L"-mmio")) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
|
||||
DumpHex(2, (UINTN)Address, (UINTN)Size, Address);
|
||||
if (Address == (VOID*)gST) {
|
||||
if (!ShellCommandLineGetFlag (Package, L"-mmio")) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size);
|
||||
DumpHex (2, (UINTN)Address, (UINTN)Size, Address);
|
||||
if (Address == (VOID *)gST) {
|
||||
Acpi20TableAddress = 0;
|
||||
AcpiTableAddress = 0;
|
||||
SalTableAddress = 0;
|
||||
SmbiosTableAddress = 0;
|
||||
MpsTableAddress = 0;
|
||||
for (TableWalker = 0 ; TableWalker < gST->NumberOfTableEntries ; TableWalker++) {
|
||||
if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi20TableGuid)) {
|
||||
for (TableWalker = 0; TableWalker < gST->NumberOfTableEntries; TableWalker++) {
|
||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi20TableGuid)) {
|
||||
Acpi20TableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||
continue;
|
||||
}
|
||||
if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi10TableGuid)) {
|
||||
|
||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiAcpi10TableGuid)) {
|
||||
AcpiTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||
continue;
|
||||
}
|
||||
if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbiosTableGuid)) {
|
||||
|
||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbiosTableGuid)) {
|
||||
SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiSmbios3TableGuid)) {
|
||||
SmbiosTableAddress = (UINT64) (UINTN) gST->ConfigurationTable[TableWalker].VendorTable;
|
||||
SmbiosTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||
continue;
|
||||
}
|
||||
if (CompareGuid(&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMpsTableGuid)) {
|
||||
|
||||
if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiMpsTableGuid)) {
|
||||
MpsTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
|
||||
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,
|
||||
gST->Hdr.HeaderSize,
|
||||
gST->Hdr.Revision,
|
||||
@ -210,11 +222,10 @@ ShellCommandRunDmem (
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ShellStatus = DisplayMmioMemory(Address, (UINTN)Size);
|
||||
ShellStatus = DisplayMmioMemory (Address, (UINTN)Size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
|
@ -49,27 +49,31 @@ GetAttrType (
|
||||
if ((Atts & EFI_VARIABLE_NON_VOLATILE) != 0) {
|
||||
StrnCatGrow (&RetString, &BufLen, L"+NV", 0);
|
||||
}
|
||||
|
||||
if ((Atts & EFI_VARIABLE_RUNTIME_ACCESS) != 0) {
|
||||
StrnCatGrow (&RetString, &BufLen, L"+RT+BS", 0);
|
||||
} else if ((Atts & EFI_VARIABLE_BOOTSERVICE_ACCESS) != 0) {
|
||||
StrnCatGrow (&RetString, &BufLen, L"+BS", 0);
|
||||
}
|
||||
|
||||
if ((Atts & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) {
|
||||
StrnCatGrow (&RetString, &BufLen, L"+HR", 0);
|
||||
}
|
||||
|
||||
if ((Atts & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
||||
StrnCatGrow (&RetString, &BufLen, L"+AW", 0);
|
||||
}
|
||||
|
||||
if ((Atts & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) {
|
||||
StrnCatGrow (&RetString, &BufLen, L"+AT", 0);
|
||||
}
|
||||
|
||||
if (RetString == NULL) {
|
||||
RetString = StrnCatGrow(&RetString, &BufLen, L"Invalid", 0);
|
||||
RetString = StrnCatGrow (&RetString, &BufLen, L"Invalid", 0);
|
||||
}
|
||||
|
||||
if ((RetString != NULL) && (RetString[0] == L'+')) {
|
||||
CopyMem(RetString, RetString + 1, StrSize(RetString + 1));
|
||||
CopyMem (RetString, RetString + 1, StrSize (RetString + 1));
|
||||
}
|
||||
|
||||
return RetString;
|
||||
@ -85,7 +89,7 @@ GetAttrType (
|
||||
|
||||
@return The hex format string.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
BinaryToHexString (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN BufferSize,
|
||||
@ -105,9 +109,10 @@ BinaryToHexString (
|
||||
&HexString[StringIndex],
|
||||
HexStringSize - StringIndex * sizeof (CHAR16),
|
||||
L"%02x",
|
||||
((UINT8 *) Buffer)[Index]
|
||||
((UINT8 *)Buffer)[Index]
|
||||
);
|
||||
}
|
||||
|
||||
return HexString;
|
||||
}
|
||||
|
||||
@ -188,8 +193,9 @@ LoadVariablesFromFile (
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
|
||||
BufferSize = RemainingSize;
|
||||
Status = ShellReadFile (FileHandle, &BufferSize, (UINT32 *) Buffer + 2);
|
||||
Status = ShellReadFile (FileHandle, &BufferSize, (UINT32 *)Buffer + 2);
|
||||
if (EFI_ERROR (Status) || (BufferSize != RemainingSize)) {
|
||||
ShellStatus = SHELL_VOLUME_CORRUPTED;
|
||||
FreePool (Buffer);
|
||||
@ -199,15 +205,15 @@ LoadVariablesFromFile (
|
||||
//
|
||||
// Check Crc32
|
||||
//
|
||||
* (UINT32 *) Buffer = NameSize;
|
||||
* ((UINT32 *) Buffer + 1) = DataSize;
|
||||
*(UINT32 *)Buffer = NameSize;
|
||||
*((UINT32 *)Buffer + 1) = DataSize;
|
||||
BufferSize = RemainingSize + sizeof (NameSize) + sizeof (DataSize) - sizeof (Crc32);
|
||||
gBS->CalculateCrc32 (
|
||||
Buffer,
|
||||
BufferSize,
|
||||
&Crc32
|
||||
);
|
||||
if (Crc32 != * (UINT32 *) (Buffer + BufferSize)) {
|
||||
if (Crc32 != *(UINT32 *)(Buffer + BufferSize)) {
|
||||
FreePool (Buffer);
|
||||
ShellStatus = SHELL_VOLUME_CORRUPTED;
|
||||
break;
|
||||
@ -221,10 +227,11 @@ LoadVariablesFromFile (
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
|
||||
Variable->Signature = DMP_STORE_VARIABLE_SIGNATURE;
|
||||
Variable->Name = (CHAR16 *) (Variable + 1);
|
||||
Variable->Name = (CHAR16 *)(Variable + 1);
|
||||
Variable->DataSize = DataSize;
|
||||
Variable->Data = (UINT8 *) Variable->Name + NameSize;
|
||||
Variable->Data = (UINT8 *)Variable->Name + NameSize;
|
||||
CopyMem (Variable->Name, Buffer + sizeof (NameSize) + sizeof (DataSize), NameSize);
|
||||
CopyMem (&Variable->Guid, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize, sizeof (EFI_GUID));
|
||||
CopyMem (&Variable->Attributes, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID), sizeof (UINT32));
|
||||
@ -235,7 +242,7 @@ LoadVariablesFromFile (
|
||||
}
|
||||
|
||||
if ((Position != FileSize) || (ShellStatus != SHELL_SUCCESS)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_BAD_FILE), gShellDebug1HiiHandle, L"dmpstore");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_BAD_FILE), gShellDebug1HiiHandle, L"dmpstore");
|
||||
if (Position != FileSize) {
|
||||
ShellStatus = SHELL_VOLUME_CORRUPTED;
|
||||
}
|
||||
@ -244,18 +251,27 @@ LoadVariablesFromFile (
|
||||
for ( Link = GetFirstNode (&List)
|
||||
; !IsNull (&List, Link) && (ShellStatus == SHELL_SUCCESS)
|
||||
; Link = GetNextNode (&List, Link)
|
||||
) {
|
||||
)
|
||||
{
|
||||
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))
|
||||
) {
|
||||
)
|
||||
{
|
||||
Attributes = GetAttrType (Variable->Attributes);
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN(STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
|
||||
Attributes, &Variable->Guid, Variable->Name, Variable->DataSize
|
||||
-1,
|
||||
-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);
|
||||
|
||||
*Found = TRUE;
|
||||
Status = gRT->SetVariable (
|
||||
@ -266,7 +282,7 @@ LoadVariablesFromFile (
|
||||
Variable->Data
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_GEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", Variable->Name, Status);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_GEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", Variable->Name, Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,7 +326,7 @@ AppendSingleVariableToFile (
|
||||
UINTN BufferSize;
|
||||
EFI_STATUS Status;
|
||||
|
||||
NameSize = (UINT32) StrSize (Name);
|
||||
NameSize = (UINT32)StrSize (Name);
|
||||
BufferSize = sizeof (NameSize) + sizeof (DataSize)
|
||||
+ sizeof (*Guid)
|
||||
+ sizeof (Attributes)
|
||||
@ -326,9 +342,9 @@ AppendSingleVariableToFile (
|
||||
//
|
||||
// NameSize and DataSize
|
||||
//
|
||||
* (UINT32 *) Ptr = NameSize;
|
||||
*(UINT32 *)Ptr = NameSize;
|
||||
Ptr += sizeof (NameSize);
|
||||
*(UINT32 *) Ptr = DataSize;
|
||||
*(UINT32 *)Ptr = DataSize;
|
||||
Ptr += sizeof (DataSize);
|
||||
|
||||
//
|
||||
@ -346,7 +362,7 @@ AppendSingleVariableToFile (
|
||||
//
|
||||
// Attributes
|
||||
//
|
||||
* (UINT32 *) Ptr = Attributes;
|
||||
*(UINT32 *)Ptr = Attributes;
|
||||
Ptr += sizeof (Attributes);
|
||||
|
||||
//
|
||||
@ -358,14 +374,15 @@ AppendSingleVariableToFile (
|
||||
//
|
||||
// Crc32
|
||||
//
|
||||
gBS->CalculateCrc32 (Buffer, (UINTN) Ptr - (UINTN) Buffer, (UINT32 *) Ptr);
|
||||
gBS->CalculateCrc32 (Buffer, (UINTN)Ptr - (UINTN)Buffer, (UINT32 *)Ptr);
|
||||
|
||||
Status = ShellWriteFile (FileHandle, &BufferSize, Buffer);
|
||||
FreePool (Buffer);
|
||||
|
||||
if (!EFI_ERROR (Status) &&
|
||||
(BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize + sizeof (UINT32))
|
||||
) {
|
||||
)
|
||||
{
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -402,7 +419,7 @@ CascadeProcessVariables (
|
||||
IN CONST EFI_GUID *Guid OPTIONAL,
|
||||
IN DMP_STORE_TYPE Type,
|
||||
IN EFI_FILE_PROTOCOL *FileHandle OPTIONAL,
|
||||
IN CONST CHAR16 * CONST PrevName,
|
||||
IN CONST CHAR16 *CONST PrevName,
|
||||
IN EFI_GUID FoundVarGuid,
|
||||
IN BOOLEAN *FoundOne,
|
||||
IN BOOLEAN StandardFormatOutput
|
||||
@ -420,27 +437,27 @@ CascadeProcessVariables (
|
||||
EFI_STATUS SetStatus;
|
||||
CONST CHAR16 *GuidName;
|
||||
|
||||
if (ShellGetExecutionBreakFlag()) {
|
||||
if (ShellGetExecutionBreakFlag ()) {
|
||||
return (SHELL_ABORTED);
|
||||
}
|
||||
|
||||
NameSize = 0;
|
||||
FoundVarName = NULL;
|
||||
|
||||
if (PrevName!=NULL) {
|
||||
StrnCatGrow(&FoundVarName, &NameSize, PrevName, 0);
|
||||
if (PrevName != NULL) {
|
||||
StrnCatGrow (&FoundVarName, &NameSize, PrevName, 0);
|
||||
} else {
|
||||
FoundVarName = AllocateZeroPool(sizeof(CHAR16));
|
||||
NameSize = sizeof(CHAR16);
|
||||
FoundVarName = AllocateZeroPool (sizeof (CHAR16));
|
||||
NameSize = sizeof (CHAR16);
|
||||
}
|
||||
|
||||
Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
SHELL_FREE_NON_NULL(FoundVarName);
|
||||
SHELL_FREE_NON_NULL (FoundVarName);
|
||||
FoundVarName = AllocateZeroPool (NameSize);
|
||||
if (FoundVarName != NULL) {
|
||||
if (PrevName != NULL) {
|
||||
StrnCpyS(FoundVarName, NameSize/sizeof(CHAR16), PrevName, NameSize/sizeof(CHAR16) - 1);
|
||||
StrnCpyS (FoundVarName, NameSize/sizeof (CHAR16), PrevName, NameSize/sizeof (CHAR16) - 1);
|
||||
}
|
||||
|
||||
Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);
|
||||
@ -453,10 +470,10 @@ CascadeProcessVariables (
|
||||
// No more is fine.
|
||||
//
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
SHELL_FREE_NON_NULL(FoundVarName);
|
||||
SHELL_FREE_NON_NULL (FoundVarName);
|
||||
return (SHELL_SUCCESS);
|
||||
} else if (EFI_ERROR(Status)) {
|
||||
SHELL_FREE_NON_NULL(FoundVarName);
|
||||
} else if (EFI_ERROR (Status)) {
|
||||
SHELL_FREE_NON_NULL (FoundVarName);
|
||||
return (SHELL_DEVICE_ERROR);
|
||||
}
|
||||
|
||||
@ -465,8 +482,8 @@ CascadeProcessVariables (
|
||||
//
|
||||
ShellStatus = CascadeProcessVariables (Name, Guid, Type, FileHandle, FoundVarName, FoundVarGuid, FoundOne, StandardFormatOutput);
|
||||
|
||||
if (ShellGetExecutionBreakFlag() || (ShellStatus == SHELL_ABORTED)) {
|
||||
SHELL_FREE_NON_NULL(FoundVarName);
|
||||
if (ShellGetExecutionBreakFlag () || (ShellStatus == SHELL_ABORTED)) {
|
||||
SHELL_FREE_NON_NULL (FoundVarName);
|
||||
return (SHELL_ABORTED);
|
||||
}
|
||||
|
||||
@ -474,11 +491,12 @@ CascadeProcessVariables (
|
||||
// No matter what happened we process our own variable
|
||||
// Only continue if Guid and VariableName are each either NULL or a match
|
||||
//
|
||||
if ( ( Name == NULL
|
||||
|| gUnicodeCollation->MetaiMatch(gUnicodeCollation, FoundVarName, (CHAR16*) Name) )
|
||||
&& ( Guid == NULL
|
||||
|| CompareGuid(&FoundVarGuid, Guid) )
|
||||
) {
|
||||
if ( ( (Name == NULL)
|
||||
|| gUnicodeCollation->MetaiMatch (gUnicodeCollation, FoundVarName, (CHAR16 *)Name))
|
||||
&& ( (Guid == NULL)
|
||||
|| CompareGuid (&FoundVarGuid, Guid))
|
||||
)
|
||||
{
|
||||
DataSize = 0;
|
||||
DataBuffer = NULL;
|
||||
//
|
||||
@ -495,20 +513,31 @@ CascadeProcessVariables (
|
||||
Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Last error check then print this variable out.
|
||||
//
|
||||
if (Type == DmpStoreDisplay) {
|
||||
if (!EFI_ERROR(Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
|
||||
AttrString = GetAttrType(Atts);
|
||||
if (!EFI_ERROR (Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
|
||||
AttrString = GetAttrType (Atts);
|
||||
if (StandardFormatOutput) {
|
||||
HexString = AllocatePool ((DataSize * 2 + 1) * sizeof (CHAR16));
|
||||
if (HexString != NULL) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_VAR_SFO), gShellDebug1HiiHandle,
|
||||
FoundVarName, &FoundVarGuid, Atts, DataSize,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DMPSTORE_VAR_SFO),
|
||||
gShellDebug1HiiHandle,
|
||||
FoundVarName,
|
||||
&FoundVarGuid,
|
||||
Atts,
|
||||
DataSize,
|
||||
BinaryToHexString (
|
||||
DataBuffer, DataSize, HexString, (DataSize * 2 + 1) * sizeof (CHAR16)
|
||||
DataBuffer,
|
||||
DataSize,
|
||||
HexString,
|
||||
(DataSize * 2 + 1) * sizeof (CHAR16)
|
||||
)
|
||||
);
|
||||
FreePool (HexString);
|
||||
@ -516,35 +545,58 @@ CascadeProcessVariables (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
} else {
|
||||
Status = gEfiShellProtocol->GetGuidName(&FoundVarGuid, &GuidName);
|
||||
Status = gEfiShellProtocol->GetGuidName (&FoundVarGuid, &GuidName);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
|
||||
AttrString, &FoundVarGuid, FoundVarName, DataSize
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DMPSTORE_HEADER_LINE),
|
||||
gShellDebug1HiiHandle,
|
||||
AttrString,
|
||||
&FoundVarGuid,
|
||||
FoundVarName,
|
||||
DataSize
|
||||
);
|
||||
} else {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE2), gShellDebug1HiiHandle,
|
||||
AttrString, GuidName, FoundVarName, DataSize
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DMPSTORE_HEADER_LINE2),
|
||||
gShellDebug1HiiHandle,
|
||||
AttrString,
|
||||
GuidName,
|
||||
FoundVarName,
|
||||
DataSize
|
||||
);
|
||||
}
|
||||
|
||||
DumpHex (2, 0, DataSize, DataBuffer);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (AttrString);
|
||||
}
|
||||
} else if (Type == DmpStoreSave) {
|
||||
if (!EFI_ERROR(Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
|
||||
if (!EFI_ERROR (Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) {
|
||||
AttrString = GetAttrType (Atts);
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle,
|
||||
AttrString, &FoundVarGuid, FoundVarName, DataSize
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DMPSTORE_HEADER_LINE),
|
||||
gShellDebug1HiiHandle,
|
||||
AttrString,
|
||||
&FoundVarGuid,
|
||||
FoundVarName,
|
||||
DataSize
|
||||
);
|
||||
Status = AppendSingleVariableToFile (
|
||||
FileHandle,
|
||||
FoundVarName,
|
||||
&FoundVarGuid,
|
||||
Atts,
|
||||
(UINT32) DataSize,
|
||||
(UINT32)DataSize,
|
||||
DataBuffer
|
||||
);
|
||||
SHELL_FREE_NON_NULL (AttrString);
|
||||
@ -557,27 +609,39 @@ CascadeProcessVariables (
|
||||
if (StandardFormatOutput) {
|
||||
if (SetStatus == EFI_SUCCESS) {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_NG_SFO), gShellDebug1HiiHandle,
|
||||
FoundVarName, &FoundVarGuid
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_NG_SFO),
|
||||
gShellDebug1HiiHandle,
|
||||
FoundVarName,
|
||||
&FoundVarGuid
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ShellPrintHiiEx (
|
||||
-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_DELETE_LINE), gShellDebug1HiiHandle,
|
||||
&FoundVarGuid, FoundVarName, SetStatus
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
STRING_TOKEN (STR_DMPSTORE_DELETE_LINE),
|
||||
gShellDebug1HiiHandle,
|
||||
&FoundVarGuid,
|
||||
FoundVarName,
|
||||
SetStatus
|
||||
);
|
||||
}
|
||||
}
|
||||
SHELL_FREE_NON_NULL(DataBuffer);
|
||||
|
||||
SHELL_FREE_NON_NULL (DataBuffer);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL(FoundVarName);
|
||||
SHELL_FREE_NON_NULL (FoundVarName);
|
||||
|
||||
if (Status == EFI_DEVICE_ERROR) {
|
||||
ShellStatus = SHELL_DEVICE_ERROR;
|
||||
} else if (Status == EFI_SECURITY_VIOLATION) {
|
||||
ShellStatus = SHELL_SECURITY_VIOLATION;
|
||||
} else if (EFI_ERROR(Status)) {
|
||||
} else if (EFI_ERROR (Status)) {
|
||||
ShellStatus = SHELL_NOT_READY;
|
||||
}
|
||||
|
||||
@ -614,10 +678,10 @@ ProcessVariables (
|
||||
|
||||
Found = FALSE;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
ZeroMem (&FoundVarGuid, sizeof(EFI_GUID));
|
||||
ZeroMem (&FoundVarGuid, sizeof (EFI_GUID));
|
||||
|
||||
if (StandardFormatOutput) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"dmpstore");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"dmpstore");
|
||||
}
|
||||
|
||||
if (Type == DmpStoreLoad) {
|
||||
@ -628,43 +692,45 @@ ProcessVariables (
|
||||
|
||||
if (!Found) {
|
||||
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);
|
||||
} else if (Name != NULL && Guid == NULL) {
|
||||
} else if ((Name != NULL) && (Guid == NULL)) {
|
||||
if (StandardFormatOutput) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N_SFO), gShellDebug1HiiHandle, Name);
|
||||
} else {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N), gShellDebug1HiiHandle, L"dmpstore", Name);
|
||||
}
|
||||
} else if (Name != NULL && Guid != NULL) {
|
||||
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)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_GN), gShellDebug1HiiHandle, L"dmpstore", Guid, Name);
|
||||
} else if ((Name == NULL) && (Guid == NULL)) {
|
||||
if (StandardFormatOutput) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_SFO), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
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) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G_SFO), gShellDebug1HiiHandle, Guid);
|
||||
} else {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G), gShellDebug1HiiHandle, L"dmpstore", Guid);
|
||||
}
|
||||
}
|
||||
|
||||
return (SHELL_NOT_FOUND);
|
||||
}
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-d", TypeFlag},
|
||||
{L"-l", TypeValue},
|
||||
{L"-s", TypeValue},
|
||||
{L"-all", TypeFlag},
|
||||
{L"-guid", TypeValue},
|
||||
{L"-sfo", TypeFlag},
|
||||
{NULL, TypeMax}
|
||||
};
|
||||
{ L"-d", TypeFlag },
|
||||
{ L"-l", TypeValue },
|
||||
{ L"-s", TypeValue },
|
||||
{ L"-all", TypeFlag },
|
||||
{ L"-guid", TypeValue },
|
||||
{ L"-sfo", TypeFlag },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'dmpstore' command.
|
||||
@ -702,42 +768,43 @@ ShellCommandRunDmpStore (
|
||||
StandardFormatOutput = FALSE;
|
||||
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmpstore", ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"dmpstore", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
} else {
|
||||
if (ShellCommandLineGetCount(Package) > 2) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmpstore");
|
||||
if (ShellCommandLineGetCount (Package) > 2) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"dmpstore");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-all") && ShellCommandLineGetFlag(Package, L"-guid")) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-all", L"-guid");
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-all") && ShellCommandLineGetFlag (Package, L"-guid")) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-all", L"-guid");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-l")) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l", L"-s");
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-s") && ShellCommandLineGetFlag (Package, L"-l")) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l", L"-s");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if ((ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) && ShellCommandLineGetFlag(Package, L"-d")) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-d");
|
||||
} else if ((ShellCommandLineGetFlag (Package, L"-s") || ShellCommandLineGetFlag (Package, L"-l")) && ShellCommandLineGetFlag (Package, L"-d")) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-d");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if ((ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) && ShellCommandLineGetFlag(Package, L"-sfo")) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-sfo");
|
||||
} else if ((ShellCommandLineGetFlag (Package, L"-s") || ShellCommandLineGetFlag (Package, L"-l")) && ShellCommandLineGetFlag (Package, L"-sfo")) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"dmpstore", L"-l or -s", L"-sfo");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
//
|
||||
// Determine the GUID to search for based on -all and -guid parameters
|
||||
//
|
||||
if (!ShellCommandLineGetFlag(Package, L"-all")) {
|
||||
GuidStr = ShellCommandLineGetValue(Package, L"-guid");
|
||||
if (!ShellCommandLineGetFlag (Package, L"-all")) {
|
||||
GuidStr = ShellCommandLineGetValue (Package, L"-guid");
|
||||
if (GuidStr != NULL) {
|
||||
RStatus = StrToGuid (GuidStr, &GuidData);
|
||||
if (RETURN_ERROR (RStatus) || (GuidStr[GUID_STRING_LENGTH] != L'\0')) {
|
||||
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;
|
||||
}
|
||||
|
||||
Guid = &GuidData;
|
||||
} else {
|
||||
Guid = &gEfiGlobalVariableGuid;
|
||||
@ -749,14 +816,14 @@ ShellCommandRunDmpStore (
|
||||
//
|
||||
// Get the Name of the variable to find
|
||||
//
|
||||
Name = ShellCommandLineGetRawValue(Package, 1);
|
||||
Name = ShellCommandLineGetRawValue (Package, 1);
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
if (ShellCommandLineGetFlag(Package, L"-s")) {
|
||||
if (ShellCommandLineGetFlag (Package, L"-s")) {
|
||||
Type = DmpStoreSave;
|
||||
File = ShellCommandLineGetValue(Package, L"-s");
|
||||
File = ShellCommandLineGetValue (Package, L"-s");
|
||||
if (File == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-s");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-s");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_WRITE | EFI_FILE_MODE_READ, 0);
|
||||
@ -778,6 +845,7 @@ ShellCommandRunDmpStore (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_DELETE_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (FileInfo);
|
||||
}
|
||||
} else if (Status == EFI_NOT_FOUND) {
|
||||
@ -803,16 +871,16 @@ ShellCommandRunDmpStore (
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-l")) {
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-l")) {
|
||||
Type = DmpStoreLoad;
|
||||
File = ShellCommandLineGetValue(Package, L"-l");
|
||||
File = ShellCommandLineGetValue (Package, L"-l");
|
||||
if (File == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-l");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"dmpstore", L"-l");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"dmpstore", File);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
FileInfo = ShellGetFileInfo (FileHandle);
|
||||
@ -824,15 +892,16 @@ ShellCommandRunDmpStore (
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, L"dmpstore", File);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
FreePool (FileInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ShellCommandLineGetFlag(Package, L"-d")) {
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-d")) {
|
||||
Type = DmpStoreDelete;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetFlag (Package,L"-sfo")) {
|
||||
if (ShellCommandLineGetFlag (Package, L"-sfo")) {
|
||||
StandardFormatOutput = TRUE;
|
||||
}
|
||||
}
|
||||
@ -843,6 +912,7 @@ ShellCommandRunDmpStore (
|
||||
} else if (Type == DmpStoreLoad) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD), gShellDebug1HiiHandle, File);
|
||||
}
|
||||
|
||||
ShellStatus = ProcessVariables (Name, Guid, Type, FileHandle, StandardFormatOutput);
|
||||
if ((Type == DmpStoreLoad) || (Type == DmpStoreSave)) {
|
||||
ShellCloseFile (&FileHandle);
|
||||
@ -854,6 +924,6 @@ ShellCommandRunDmpStore (
|
||||
if (Package != NULL) {
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,8 @@ ShellCommandRunEdit (
|
||||
CHAR16 *Nfs;
|
||||
CHAR16 *Spot;
|
||||
CONST CHAR16 *TempParam;
|
||||
// SHELL_FILE_HANDLE TempHandle;
|
||||
|
||||
// SHELL_FILE_HANDLE TempHandle;
|
||||
|
||||
Buffer = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
@ -41,45 +42,47 @@ ShellCommandRunEdit (
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
} else {
|
||||
if (ShellCommandLineGetCount(Package) > 2) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"edit");
|
||||
if (ShellCommandLineGetCount (Package) > 2) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"edit");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
Cwd = gEfiShellProtocol->GetCurDir(NULL);
|
||||
Cwd = gEfiShellProtocol->GetCurDir (NULL);
|
||||
if (Cwd == NULL) {
|
||||
Cwd = ShellGetEnvironmentVariable(L"path");
|
||||
Cwd = ShellGetEnvironmentVariable (L"path");
|
||||
if (Cwd != NULL) {
|
||||
Nfs = StrnCatGrow(&Nfs, NULL, Cwd+3, 0);
|
||||
Nfs = StrnCatGrow (&Nfs, NULL, Cwd+3, 0);
|
||||
if (Nfs != NULL) {
|
||||
Spot = StrStr(Nfs, L";");
|
||||
Spot = StrStr (Nfs, L";");
|
||||
if (Spot != NULL) {
|
||||
*Spot = CHAR_NULL;
|
||||
}
|
||||
Spot = StrStr(Nfs, L"\\");
|
||||
|
||||
Spot = StrStr (Nfs, L"\\");
|
||||
if (Spot != NULL) {
|
||||
Spot[1] = CHAR_NULL;
|
||||
}
|
||||
gEfiShellProtocol->SetCurDir(NULL, Nfs);
|
||||
FreePool(Nfs);
|
||||
|
||||
gEfiShellProtocol->SetCurDir (NULL, Nfs);
|
||||
FreePool (Nfs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -89,23 +92,23 @@ ShellCommandRunEdit (
|
||||
if (EFI_ERROR (Status)) {
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_INIT_FAILED), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_MAIN_INIT_FAILED), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
MainEditorBackup ();
|
||||
|
||||
//
|
||||
// if editor launched with file named
|
||||
//
|
||||
if (ShellCommandLineGetCount(Package) == 2) {
|
||||
TempParam = ShellCommandLineGetRawValue(Package, 1);
|
||||
ASSERT(TempParam != NULL);
|
||||
if (ShellCommandLineGetCount (Package) == 2) {
|
||||
TempParam = ShellCommandLineGetRawValue (Package, 1);
|
||||
ASSERT (TempParam != NULL);
|
||||
FileBufferSetFileName (TempParam);
|
||||
// if (EFI_ERROR(ShellFileExists(MainEditor.FileBuffer->FileName))) {
|
||||
// Status = ShellOpenFileByName(MainEditor.FileBuffer->FileName, &TempHandle, EFI_FILE_MODE_CREATE|EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
|
||||
// if (!EFI_ERROR(Status)) {
|
||||
// ShellCloseFile(&TempHandle);
|
||||
// }
|
||||
// }
|
||||
// if (EFI_ERROR(ShellFileExists(MainEditor.FileBuffer->FileName))) {
|
||||
// Status = ShellOpenFileByName(MainEditor.FileBuffer->FileName, &TempHandle, EFI_FILE_MODE_CREATE|EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
|
||||
// if (!EFI_ERROR(Status)) {
|
||||
// ShellCloseFile(&TempHandle);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
Status = FileBufferRead (MainEditor.FileBuffer->FileName, FALSE);
|
||||
@ -119,7 +122,7 @@ ShellCommandRunEdit (
|
||||
//
|
||||
// back up the status string
|
||||
//
|
||||
Buffer = CatSPrint (NULL, L"%s", StatusBarGetString());
|
||||
Buffer = CatSPrint (NULL, L"%s", StatusBarGetString ());
|
||||
}
|
||||
|
||||
MainEditorCleanup ();
|
||||
@ -129,19 +132,19 @@ ShellCommandRunEdit (
|
||||
//
|
||||
if (Status == EFI_SUCCESS) {
|
||||
} else if (Status == EFI_OUT_OF_RESOURCES) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"edit");
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle, L"edit");
|
||||
} else {
|
||||
if (Buffer != NULL) {
|
||||
if (StrCmp (Buffer, L"") != 0) {
|
||||
//
|
||||
// print out the status string
|
||||
//
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_BUFFER), gShellDebug1HiiHandle, Buffer);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_MAIN_BUFFER), gShellDebug1HiiHandle, Buffer);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle);
|
||||
}
|
||||
} else {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_MAIN_UNKNOWN_EDITOR_ERR), gShellDebug1HiiHandle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +153,9 @@ ShellCommandRunEdit (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ FileBufferInit (
|
||||
//
|
||||
// basically initialize the FileBuffer
|
||||
//
|
||||
CopyMem (&FileBuffer , &FileBufferConst, sizeof (EFI_EDITOR_FILE_BUFFER));
|
||||
CopyMem (&FileBuffer, &FileBufferConst, sizeof (EFI_EDITOR_FILE_BUFFER));
|
||||
CopyMem (&FileBufferBackupVar, &FileBufferConst, sizeof (EFI_EDITOR_FILE_BUFFER));
|
||||
|
||||
//
|
||||
@ -157,7 +157,7 @@ InternalEditorMiscLineAdvance (
|
||||
UINTN Index;
|
||||
CONST EFI_EDITOR_LINE *Line;
|
||||
|
||||
if (CurrentLine == NULL || LineList == NULL) {
|
||||
if ((CurrentLine == NULL) || (LineList == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ InternalEditorMiscLineRetreat (
|
||||
UINTN Index;
|
||||
CONST EFI_EDITOR_LINE *Line;
|
||||
|
||||
if (CurrentLine == NULL || LineList == NULL) {
|
||||
if ((CurrentLine == NULL) || (LineList == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -237,10 +237,10 @@ MoveLine (
|
||||
// if > 0, the advance
|
||||
//
|
||||
if (Count <= 0) {
|
||||
AbsCount = (UINTN)ABS(Count);
|
||||
Line = InternalEditorMiscLineRetreat (AbsCount,MainEditor.FileBuffer->CurrentLine,MainEditor.FileBuffer->ListHead);
|
||||
AbsCount = (UINTN)ABS (Count);
|
||||
Line = InternalEditorMiscLineRetreat (AbsCount, MainEditor.FileBuffer->CurrentLine, MainEditor.FileBuffer->ListHead);
|
||||
} else {
|
||||
Line = InternalEditorMiscLineAdvance ((UINTN)Count,MainEditor.FileBuffer->CurrentLine,MainEditor.FileBuffer->ListHead);
|
||||
Line = InternalEditorMiscLineAdvance ((UINTN)Count, MainEditor.FileBuffer->CurrentLine, MainEditor.FileBuffer->ListHead);
|
||||
}
|
||||
|
||||
return Line;
|
||||
@ -271,20 +271,20 @@ FileBufferRestoreMousePosition (
|
||||
Line = NULL;
|
||||
|
||||
if (MainEditor.MouseSupported) {
|
||||
|
||||
if (FileBufferMouseNeedRefresh) {
|
||||
|
||||
FileBufferMouseNeedRefresh = FALSE;
|
||||
|
||||
//
|
||||
// if mouse position not moved and only mouse action
|
||||
// so do not need to refresh mouse position
|
||||
//
|
||||
if ((FileBuffer.MousePosition.Row == FileBufferBackupVar.MousePosition.Row &&
|
||||
FileBuffer.MousePosition.Column == FileBufferBackupVar.MousePosition.Column)
|
||||
&& EditorMouseAction) {
|
||||
if ( ((FileBuffer.MousePosition.Row == FileBufferBackupVar.MousePosition.Row) &&
|
||||
(FileBuffer.MousePosition.Column == FileBufferBackupVar.MousePosition.Column))
|
||||
&& EditorMouseAction)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// backup the old screen attributes
|
||||
//
|
||||
@ -307,7 +307,7 @@ FileBufferRestoreMousePosition (
|
||||
CurrentLine = FileBuffer.CurrentLine;
|
||||
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);
|
||||
|
||||
if (Line == NULL || FColumn > Line->Size) {
|
||||
if ((Line == NULL) || (FColumn > Line->Size)) {
|
||||
HasCharacter = FALSE;
|
||||
}
|
||||
|
||||
@ -329,6 +329,7 @@ FileBufferRestoreMousePosition (
|
||||
Value
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// set the new mouse position
|
||||
//
|
||||
@ -347,7 +348,7 @@ FileBufferRestoreMousePosition (
|
||||
CurrentLine = FileBuffer.CurrentLine;
|
||||
Line = MoveLine (FRow - FileBuffer.FilePosition.Row);
|
||||
|
||||
if (Line == NULL || FColumn > Line->Size) {
|
||||
if ((Line == NULL) || (FColumn > Line->Size)) {
|
||||
HasCharacter = FALSE;
|
||||
}
|
||||
|
||||
@ -369,15 +370,18 @@ FileBufferRestoreMousePosition (
|
||||
Value
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// end of HasCharacter
|
||||
//
|
||||
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
||||
}
|
||||
|
||||
//
|
||||
// end of MouseNeedRefresh
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// end of MouseSupported
|
||||
//
|
||||
@ -406,7 +410,6 @@ FileBufferFreeLines (
|
||||
// free all the lines
|
||||
//
|
||||
if (FileBuffer.Lines != NULL) {
|
||||
|
||||
Line = FileBuffer.Lines;
|
||||
Link = &(Line->Link);
|
||||
do {
|
||||
@ -419,6 +422,7 @@ FileBufferFreeLines (
|
||||
LineFree (Line);
|
||||
} while (Link != FileBuffer.ListHead);
|
||||
}
|
||||
|
||||
//
|
||||
// clean the line list related structure
|
||||
//
|
||||
@ -456,7 +460,6 @@ FileBufferCleanup (
|
||||
|
||||
SHELL_FREE_NON_NULL (FileBufferBackupVar.FileName);
|
||||
return Status;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -473,7 +476,6 @@ FileBufferPrintLine (
|
||||
IN CONST UINTN Row
|
||||
)
|
||||
{
|
||||
|
||||
CHAR16 *Buffer;
|
||||
UINTN Limit;
|
||||
CHAR16 *PrintLine;
|
||||
@ -493,7 +495,7 @@ FileBufferPrintLine (
|
||||
BufLen = (MainEditor.ScreenSize.Column + 1) * sizeof (CHAR16);
|
||||
PrintLine = AllocatePool (BufLen);
|
||||
if (PrintLine != NULL) {
|
||||
StrnCpyS (PrintLine, BufLen/sizeof(CHAR16), Buffer, MIN(Limit, MainEditor.ScreenSize.Column));
|
||||
StrnCpyS (PrintLine, BufLen/sizeof (CHAR16), Buffer, MIN (Limit, MainEditor.ScreenSize.Column));
|
||||
for (Limit = StrLen (PrintLine); Limit < MainEditor.ScreenSize.Column; Limit++) {
|
||||
PrintLine[Limit] = L' ';
|
||||
}
|
||||
@ -502,7 +504,7 @@ FileBufferPrintLine (
|
||||
|
||||
PrintLine2 = AllocatePool (BufLen * 2);
|
||||
if (PrintLine2 != NULL) {
|
||||
ShellCopySearchAndReplace(PrintLine, PrintLine2, BufLen * 2, L"%", L"^%", FALSE, FALSE);
|
||||
ShellCopySearchAndReplace (PrintLine, PrintLine2, BufLen * 2, L"%", L"^%", FALSE, FALSE);
|
||||
|
||||
ShellPrintEx (
|
||||
0,
|
||||
@ -512,6 +514,7 @@ FileBufferPrintLine (
|
||||
);
|
||||
FreePool (PrintLine2);
|
||||
}
|
||||
|
||||
FreePool (PrintLine);
|
||||
}
|
||||
|
||||
@ -563,10 +566,10 @@ FileBufferRefresh (
|
||||
//
|
||||
if (!FileBufferNeedRefresh &&
|
||||
!FileBufferOnlyLineNeedRefresh &&
|
||||
FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row &&
|
||||
FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column
|
||||
) {
|
||||
|
||||
(FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row) &&
|
||||
(FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column)
|
||||
)
|
||||
{
|
||||
FileBufferRestoreMousePosition ();
|
||||
FileBufferRestorePosition ();
|
||||
|
||||
@ -580,10 +583,10 @@ FileBufferRefresh (
|
||||
// only need to refresh current line
|
||||
//
|
||||
if (FileBufferOnlyLineNeedRefresh &&
|
||||
FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row &&
|
||||
FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column
|
||||
) {
|
||||
|
||||
(FileBufferBackupVar.LowVisibleRange.Row == FileBuffer.LowVisibleRange.Row) &&
|
||||
(FileBufferBackupVar.LowVisibleRange.Column == FileBuffer.LowVisibleRange.Column)
|
||||
)
|
||||
{
|
||||
EditorClearLine (FileBuffer.DisplayPosition.Row, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row);
|
||||
FileBufferPrintLine (
|
||||
FileBuffer.CurrentLine,
|
||||
@ -604,6 +607,7 @@ FileBufferRefresh (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// get the first line that will be displayed
|
||||
//
|
||||
@ -627,6 +631,7 @@ FileBufferRefresh (
|
||||
Link = Link->ForwardLink;
|
||||
Row++;
|
||||
} while (Link != FileBuffer.ListHead && Row <= (MainEditor.ScreenSize.Row - 1));
|
||||
|
||||
//
|
||||
// while not file end and not screen full
|
||||
//
|
||||
@ -669,6 +674,7 @@ FileBufferCreateLine (
|
||||
if (Line == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// initialize the structure
|
||||
//
|
||||
@ -680,7 +686,7 @@ FileBufferCreateLine (
|
||||
//
|
||||
// initial buffer of the line is "\0"
|
||||
//
|
||||
ASSERT(CHAR_NULL == CHAR_NULL);
|
||||
ASSERT (CHAR_NULL == CHAR_NULL);
|
||||
Line->Buffer = CatSPrint (NULL, L"\0");
|
||||
if (Line->Buffer == NULL) {
|
||||
return NULL;
|
||||
@ -717,9 +723,10 @@ FileBufferSetFileName (
|
||||
//
|
||||
// Verify the parameters
|
||||
//
|
||||
if (!IsValidFileName(Str)) {
|
||||
if (!IsValidFileName (Str)) {
|
||||
return (EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
//
|
||||
// free the old file name
|
||||
//
|
||||
@ -735,6 +742,7 @@ FileBufferSetFileName (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Free the existing file lines and reset the modified flag.
|
||||
|
||||
@ -754,7 +762,6 @@ FileBufferFree (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read a file from disk into the FileBuffer.
|
||||
|
||||
@ -809,14 +816,14 @@ FileBufferRead (
|
||||
//
|
||||
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR (Status)) {
|
||||
CreateFile = FALSE;
|
||||
if (FileHandle == NULL) {
|
||||
StatusBarSetStatusString (L"Disk Error");
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
Info = ShellGetFileInfo(FileHandle);
|
||||
Info = ShellGetFileInfo (FileHandle);
|
||||
|
||||
if (Info->Attribute & EFI_FILE_DIRECTORY) {
|
||||
StatusBarSetStatusString (L"Directory Can Not Be Edited");
|
||||
@ -829,10 +836,11 @@ FileBufferRead (
|
||||
} else {
|
||||
FileBuffer.ReadOnly = FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// get file size
|
||||
//
|
||||
FileSize = (UINTN) Info->FileSize;
|
||||
FileSize = (UINTN)Info->FileSize;
|
||||
|
||||
FreePool (Info);
|
||||
} else if (Status == EFI_NOT_FOUND) {
|
||||
@ -841,13 +849,14 @@ FileBufferRead (
|
||||
//
|
||||
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_WRITE_PROTECTED ||
|
||||
Status == EFI_ACCESS_DENIED ||
|
||||
Status == EFI_NO_MEDIA ||
|
||||
Status == EFI_MEDIA_CHANGED
|
||||
) {
|
||||
if ((Status == EFI_WRITE_PROTECTED) ||
|
||||
(Status == EFI_ACCESS_DENIED) ||
|
||||
(Status == EFI_NO_MEDIA) ||
|
||||
(Status == EFI_MEDIA_CHANGED)
|
||||
)
|
||||
{
|
||||
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");
|
||||
} else {
|
||||
StatusBarSetStatusString (L"Invalid File Name or Current-working-directory");
|
||||
@ -862,12 +871,14 @@ FileBufferRead (
|
||||
if (Status == EFI_WARN_DELETE_FAILURE) {
|
||||
Status = EFI_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
FileHandle = NULL;
|
||||
if (EFI_ERROR (Status)) {
|
||||
StatusBarSetStatusString (L"Access Denied");
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// file doesn't exist, so set CreateFile to TRUE
|
||||
//
|
||||
@ -881,12 +892,13 @@ FileBufferRead (
|
||||
if (StrCmp (FileName, FileBuffer.FileName) != 0) {
|
||||
FileBufferSetFileName (FileName);
|
||||
}
|
||||
|
||||
//
|
||||
// free the old lines
|
||||
//
|
||||
FileBufferFree ();
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// the file exists
|
||||
//
|
||||
@ -898,17 +910,19 @@ FileBufferRead (
|
||||
if (Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// read file into Buffer
|
||||
//
|
||||
Status = ShellReadFile (FileHandle, &FileSize, Buffer);
|
||||
ShellCloseFile(&FileHandle);
|
||||
ShellCloseFile (&FileHandle);
|
||||
FileHandle = NULL;
|
||||
if (EFI_ERROR (Status)) {
|
||||
StatusBarSetStatusString (L"Read File Failed");
|
||||
SHELL_FREE_NON_NULL (Buffer);
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// nothing in this file
|
||||
//
|
||||
@ -933,7 +947,7 @@ FileBufferRead (
|
||||
//
|
||||
// Unicode file
|
||||
//
|
||||
if (*(UINT16 *) Buffer == EFI_UNICODE_BYTE_ORDER_MARK) {
|
||||
if (*(UINT16 *)Buffer == EFI_UNICODE_BYTE_ORDER_MARK) {
|
||||
//
|
||||
// Unicode file's size should be even
|
||||
//
|
||||
@ -956,10 +970,12 @@ FileBufferRead (
|
||||
} else {
|
||||
FileBuffer.FileType = FileTypeAscii;
|
||||
}
|
||||
|
||||
//
|
||||
// end of AsciiBuffer ==
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// end of FileSize < 2
|
||||
// all the check ends
|
||||
@ -1038,10 +1054,12 @@ FileBufferRead (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// endif == ASCII
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// end of for LineSize
|
||||
//
|
||||
@ -1064,6 +1082,7 @@ FileBufferRead (
|
||||
SHELL_FREE_NON_NULL (Buffer);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// calculate file length
|
||||
//
|
||||
@ -1079,18 +1098,20 @@ FileBufferRead (
|
||||
RemoveEntryList (&Line->Link);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// copy this line to Line->Buffer
|
||||
//
|
||||
for (LoopVar2 = 0; LoopVar2 < LineSize; LoopVar2++) {
|
||||
if (FileBuffer.FileType == FileTypeAscii) {
|
||||
Line->Buffer[LoopVar2] = (CHAR16) AsciiBuffer[LoopVar1];
|
||||
Line->Buffer[LoopVar2] = (CHAR16)AsciiBuffer[LoopVar1];
|
||||
} else {
|
||||
Line->Buffer[LoopVar2] = UnicodeBuffer[LoopVar1];
|
||||
}
|
||||
|
||||
LoopVar1++;
|
||||
}
|
||||
|
||||
//
|
||||
// LoopVar1 now points to where CHAR_CARRIAGE_RETURN or CHAR_LINEFEED;
|
||||
//
|
||||
@ -1100,32 +1121,35 @@ FileBufferRead (
|
||||
Line->TotalSize = LineSize;
|
||||
Line->Type = Type;
|
||||
|
||||
if (Type == NewLineTypeCarriageReturnLineFeed || Type == NewLineTypeLineFeedCarriageReturn) {
|
||||
if ((Type == NewLineTypeCarriageReturnLineFeed) || (Type == NewLineTypeLineFeedCarriageReturn)) {
|
||||
LoopVar1++;
|
||||
}
|
||||
|
||||
//
|
||||
// last character is a return, SO create a new line
|
||||
//
|
||||
if (((Type == NewLineTypeCarriageReturnLineFeed || Type == NewLineTypeLineFeedCarriageReturn) && LineSizeBackup == FileSize - 2) ||
|
||||
((Type == NewLineTypeLineFeed || Type == NewLineTypeCarriageReturn) && LineSizeBackup == FileSize - 1)
|
||||
) {
|
||||
if ((((Type == NewLineTypeCarriageReturnLineFeed) || (Type == NewLineTypeLineFeedCarriageReturn)) && (LineSizeBackup == FileSize - 2)) ||
|
||||
(((Type == NewLineTypeLineFeed) || (Type == NewLineTypeCarriageReturn)) && (LineSizeBackup == FileSize - 1))
|
||||
)
|
||||
{
|
||||
Line = FileBufferCreateLine ();
|
||||
if (Line == NULL) {
|
||||
SHELL_FREE_NON_NULL (Buffer);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// end of if
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// end of LoopVar1
|
||||
//
|
||||
SHELL_FREE_NON_NULL (Buffer);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// end of if CreateFile
|
||||
//
|
||||
@ -1149,7 +1173,8 @@ Done:
|
||||
StatusBarSetStatusString (UnicodeBuffer);
|
||||
FreePool (UnicodeBuffer);
|
||||
}
|
||||
/*
|
||||
|
||||
/*
|
||||
//
|
||||
// check whether we have fs?: in filename
|
||||
//
|
||||
@ -1224,8 +1249,8 @@ Done:
|
||||
FreePool (VolumeInfo);
|
||||
RootFs->Close (RootFs);
|
||||
}
|
||||
//
|
||||
*/
|
||||
//
|
||||
*/
|
||||
//
|
||||
// has line
|
||||
//
|
||||
@ -1248,7 +1273,6 @@ Done:
|
||||
FileBufferOnlyLineNeedRefresh = FALSE;
|
||||
FileBufferMouseNeedRefresh = TRUE;
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1278,10 +1302,11 @@ GetNewLine (
|
||||
//
|
||||
// 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;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// use_cr: give 0x0d
|
||||
//
|
||||
@ -1296,8 +1321,9 @@ GetNewLine (
|
||||
}
|
||||
|
||||
*Size = NewLineSize;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// use_lf: give 0x0a
|
||||
//
|
||||
@ -1312,8 +1338,9 @@ GetNewLine (
|
||||
}
|
||||
|
||||
*Size = NewLineSize;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// use_crlf: give 0x0d 0x0a
|
||||
//
|
||||
@ -1332,8 +1359,9 @@ GetNewLine (
|
||||
}
|
||||
|
||||
*Size = NewLineSize;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// use_lfcr: give 0x0a 0x0d
|
||||
//
|
||||
@ -1352,9 +1380,8 @@ GetNewLine (
|
||||
}
|
||||
|
||||
*Size = NewLineSize;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1379,7 +1406,7 @@ UnicodeToAscii (
|
||||
// just buffer copy, not character copy
|
||||
//
|
||||
for (Index = 0; Index < Length; Index++) {
|
||||
*AStr++ = (CHAR8) *UStr++;
|
||||
*AStr++ = (CHAR8)*UStr++;
|
||||
}
|
||||
|
||||
return Index;
|
||||
@ -1433,12 +1460,10 @@ FileBufferSave (
|
||||
|
||||
Attribute = 0;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// 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
|
||||
//
|
||||
@ -1458,25 +1483,25 @@ FileBufferSave (
|
||||
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);
|
||||
|
||||
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");
|
||||
ShellCloseFile (&FileHandle);
|
||||
FreePool(Info);
|
||||
FreePool (Info);
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
if (Info != NULL) {
|
||||
Attribute = Info->Attribute & ~EFI_FILE_READ_ONLY;
|
||||
FreePool(Info);
|
||||
FreePool (Info);
|
||||
}
|
||||
|
||||
//
|
||||
// if file exits, so delete it
|
||||
//
|
||||
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");
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
@ -1494,7 +1519,7 @@ FileBufferSave (
|
||||
//
|
||||
if (FileBuffer.FileType == FileTypeUnicode) {
|
||||
Length = 2;
|
||||
Status = ShellWriteFile (FileHandle, &Length, (VOID*)&gUnicodeFileTag);
|
||||
Status = ShellWriteFile (FileHandle, &Length, (VOID *)&gUnicodeFileTag);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellDeleteFile (&FileHandle);
|
||||
return EFI_LOAD_ERROR;
|
||||
@ -1522,16 +1547,18 @@ FileBufferSave (
|
||||
if (Line->Type != NewLineTypeDefault) {
|
||||
Type = Line->Type;
|
||||
}
|
||||
|
||||
//
|
||||
// newline character is at most 4 bytes ( two Unicode characters )
|
||||
//
|
||||
Length = 4;
|
||||
if (Line->Buffer != NULL && Line->Size != 0) {
|
||||
if ((Line->Buffer != NULL) && (Line->Size != 0)) {
|
||||
if (FileBuffer.FileType == FileTypeAscii) {
|
||||
Length += Line->Size;
|
||||
} else {
|
||||
Length += (Line->Size * 2);
|
||||
}
|
||||
|
||||
//
|
||||
// end if FileTypeAscii
|
||||
//
|
||||
@ -1548,25 +1575,27 @@ FileBufferSave (
|
||||
FreePool (Cache);
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
Ptr = Cache;
|
||||
LeftSize = TotalSize;
|
||||
}
|
||||
|
||||
if (Line->Buffer != NULL && Line->Size != 0) {
|
||||
if ((Line->Buffer != NULL) && (Line->Size != 0)) {
|
||||
if (FileBuffer.FileType == FileTypeAscii) {
|
||||
UnicodeToAscii (Line->Buffer, Line->Size, Ptr);
|
||||
Length = Line->Size;
|
||||
} else {
|
||||
Length = (Line->Size * 2);
|
||||
CopyMem (Ptr, (CHAR8 *) Line->Buffer, Length);
|
||||
CopyMem (Ptr, (CHAR8 *)Line->Buffer, Length);
|
||||
}
|
||||
|
||||
//
|
||||
// end if FileTypeAscii
|
||||
//
|
||||
Ptr += Length;
|
||||
LeftSize -= Length;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// end of if Line -> Buffer != NULL && Line -> Size != 0
|
||||
//
|
||||
@ -1574,7 +1603,7 @@ FileBufferSave (
|
||||
//
|
||||
if (Link->ForwardLink != FileBuffer.ListHead) {
|
||||
GetNewLine (Type, NewLineBuffer, &NewLineSize);
|
||||
CopyMem (Ptr, (CHAR8 *) NewLineBuffer, NewLineSize);
|
||||
CopyMem (Ptr, (CHAR8 *)NewLineBuffer, NewLineSize);
|
||||
|
||||
Ptr += NewLineSize;
|
||||
LeftSize -= NewLineSize;
|
||||
@ -1595,7 +1624,7 @@ FileBufferSave (
|
||||
|
||||
FreePool (Cache);
|
||||
|
||||
ShellCloseFile(&FileHandle);
|
||||
ShellCloseFile (&FileHandle);
|
||||
|
||||
FileBuffer.FileModified = FALSE;
|
||||
|
||||
@ -1613,7 +1642,7 @@ FileBufferSave (
|
||||
//
|
||||
// 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
|
||||
//
|
||||
@ -1722,7 +1751,7 @@ LineCat (
|
||||
Str = CatSPrint (NULL, L"%s%s", Dest->Buffer, Src->Buffer);
|
||||
if (Str == NULL) {
|
||||
Dest->Buffer = NULL;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
Dest->Size = Size + Src->Size;
|
||||
@ -1781,6 +1810,7 @@ FileBufferDoBackspace (
|
||||
if (Line->Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// remove End from line list
|
||||
//
|
||||
@ -1791,7 +1821,6 @@ FileBufferDoBackspace (
|
||||
|
||||
FileBufferNeedRefresh = TRUE;
|
||||
FileBufferOnlyLineNeedRefresh = FALSE;
|
||||
|
||||
} else {
|
||||
//
|
||||
// just delete the previous character
|
||||
@ -1873,6 +1902,7 @@ FileBufferDoReturn (
|
||||
Line->Buffer[FileColumn - 1] = CHAR_NULL;
|
||||
Line->Size = FileColumn - 1;
|
||||
}
|
||||
|
||||
//
|
||||
// increase NumLines
|
||||
//
|
||||
@ -1933,6 +1963,7 @@ FileBufferDoDelete (
|
||||
if (Line->Link.ForwardLink == FileBuffer.ListHead) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// since last character,
|
||||
// so will add the next line to this line
|
||||
@ -1951,7 +1982,6 @@ FileBufferDoDelete (
|
||||
|
||||
FileBufferNeedRefresh = TRUE;
|
||||
FileBufferOnlyLineNeedRefresh = FALSE;
|
||||
|
||||
} else {
|
||||
//
|
||||
// just delete current character
|
||||
@ -2052,6 +2082,7 @@ LineStrInsert (
|
||||
|
||||
Line->TotalSize += 8;
|
||||
}
|
||||
|
||||
//
|
||||
// move the later part of the string one character right
|
||||
//
|
||||
@ -2059,6 +2090,7 @@ LineStrInsert (
|
||||
for (Index = StrSize; Index > Pos; Index--) {
|
||||
TempStringPtr[Index] = TempStringPtr[Index - 1];
|
||||
}
|
||||
|
||||
//
|
||||
// insert char into it.
|
||||
//
|
||||
@ -2098,11 +2130,12 @@ FileBufferAddChar (
|
||||
// or replace the character.
|
||||
//
|
||||
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);
|
||||
} else {
|
||||
Line->Buffer[FilePos] = Char;
|
||||
}
|
||||
|
||||
//
|
||||
// move cursor to right
|
||||
//
|
||||
@ -2156,14 +2189,13 @@ FileBufferDoCharInput (
|
||||
//
|
||||
// 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");
|
||||
} else {
|
||||
Status = FileBufferAddChar (Char);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return Status;
|
||||
@ -2204,7 +2236,6 @@ FileBufferScrollDown (
|
||||
if (FCol > Line->Size) {
|
||||
FCol = Line->Size + 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -2246,7 +2277,6 @@ FileBufferScrollUp (
|
||||
if (FCol > Line->Size) {
|
||||
FCol = Line->Size + 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -2287,6 +2317,7 @@ FileBufferPageDown (
|
||||
//
|
||||
Gap = FileBuffer.NumLines - FRow;
|
||||
}
|
||||
|
||||
//
|
||||
// get correct line
|
||||
//
|
||||
@ -2295,7 +2326,7 @@ FileBufferPageDown (
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -2350,7 +2381,7 @@ FileBufferPageUp (
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -2498,7 +2529,7 @@ FileBufferHandleInput (
|
||||
// insert
|
||||
//
|
||||
case SCAN_INSERT:
|
||||
FileBuffer.ModeInsert = (BOOLEAN)!FileBuffer.ModeInsert;
|
||||
FileBuffer.ModeInsert = (BOOLEAN) !FileBuffer.ModeInsert;
|
||||
Status = EFI_SUCCESS;
|
||||
break;
|
||||
|
||||
@ -2621,10 +2652,10 @@ MoveCurrentLine (
|
||||
UINTN AbsCount;
|
||||
|
||||
if (Count <= 0) {
|
||||
AbsCount = (UINTN)ABS(Count);
|
||||
Line = InternalEditorMiscLineRetreat (AbsCount,MainEditor.FileBuffer->CurrentLine,MainEditor.FileBuffer->ListHead);
|
||||
AbsCount = (UINTN)ABS (Count);
|
||||
Line = InternalEditorMiscLineRetreat (AbsCount, MainEditor.FileBuffer->CurrentLine, MainEditor.FileBuffer->ListHead);
|
||||
} else {
|
||||
Line = InternalEditorMiscLineAdvance ((UINTN)Count,MainEditor.FileBuffer->CurrentLine,MainEditor.FileBuffer->ListHead);
|
||||
Line = InternalEditorMiscLineAdvance ((UINTN)Count, MainEditor.FileBuffer->CurrentLine, MainEditor.FileBuffer->ListHead);
|
||||
}
|
||||
|
||||
if (Line == NULL) {
|
||||
@ -2690,7 +2721,7 @@ FileBufferMovePosition (
|
||||
//
|
||||
FileBuffer.FilePosition.Row = NewFilePosRow;
|
||||
if (RowGap < 0) {
|
||||
Abs = (UINTN)ABS(RowGap);
|
||||
Abs = (UINTN)ABS (RowGap);
|
||||
FileBuffer.DisplayPosition.Row -= Abs;
|
||||
} else {
|
||||
FileBuffer.DisplayPosition.Row += RowGap;
|
||||
@ -2744,7 +2775,6 @@ FileBufferMovePosition (
|
||||
// let CurrentLine point to correct line;
|
||||
//
|
||||
FileBuffer.CurrentLine = MoveCurrentLine (RowGap);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2779,17 +2809,19 @@ FileBufferCutLine (
|
||||
//
|
||||
// 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 AND NOTHING ON THIS LINE, SO CUT NOTHING
|
||||
//
|
||||
StatusBarSetStatusString (L"Nothing to Cut");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// if is the last line, so create a dummy line
|
||||
//
|
||||
@ -2855,6 +2887,7 @@ FileBufferPasteLine (
|
||||
if (MainEditor.CutLine == NULL) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// read only file can not be pasted on
|
||||
//
|
||||
@ -2867,6 +2900,7 @@ FileBufferPasteLine (
|
||||
if (NewLine == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// insert it above current line
|
||||
//
|
||||
@ -2962,7 +2996,7 @@ FileBufferSearch (
|
||||
Row = FileBuffer.FilePosition.Row + 1;
|
||||
while (Link != FileBuffer.ListHead) {
|
||||
Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
|
||||
// Position = StrStr (Line->Buffer, Str);
|
||||
// Position = StrStr (Line->Buffer, Str);
|
||||
CharPos = StrStr (Line->Buffer, Str);
|
||||
if (CharPos != NULL) {
|
||||
Position = CharPos - Line->Buffer + 1;
|
||||
@ -3051,6 +3085,7 @@ FileBufferReplace (
|
||||
if (FileBuffer.CurrentLine->Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// the end CHAR_NULL character;
|
||||
//
|
||||
@ -3064,6 +3099,7 @@ FileBufferReplace (
|
||||
*Buffer = *(Buffer - Gap);
|
||||
Buffer--;
|
||||
}
|
||||
|
||||
//
|
||||
// set replace into it
|
||||
//
|
||||
@ -3137,8 +3173,8 @@ FileBufferAdjustMousePosition (
|
||||
// get absolute value
|
||||
//
|
||||
|
||||
AbsX = ABS(TextX);
|
||||
AbsY = ABS(TextY);
|
||||
AbsX = ABS (TextX);
|
||||
AbsY = ABS (TextY);
|
||||
|
||||
CoordinateX = FileBuffer.MousePosition.Column;
|
||||
CoordinateY = FileBuffer.MousePosition.Row;
|
||||
@ -3162,29 +3198,30 @@ FileBufferAdjustMousePosition (
|
||||
CoordinateY = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// check whether new mouse column position is beyond screen
|
||||
// if not, adjust it
|
||||
//
|
||||
if (CoordinateX >= 1 && CoordinateX <= MainEditor.ScreenSize.Column) {
|
||||
if ((CoordinateX >= 1) && (CoordinateX <= MainEditor.ScreenSize.Column)) {
|
||||
FileBuffer.MousePosition.Column = CoordinateX;
|
||||
} else if (CoordinateX < 1) {
|
||||
FileBuffer.MousePosition.Column = 1;
|
||||
} else if (CoordinateX > MainEditor.ScreenSize.Column) {
|
||||
FileBuffer.MousePosition.Column = MainEditor.ScreenSize.Column;
|
||||
}
|
||||
|
||||
//
|
||||
// check whether new mouse row position is beyond screen
|
||||
// if not, adjust it
|
||||
//
|
||||
if (CoordinateY >= 2 && CoordinateY <= (MainEditor.ScreenSize.Row - 1)) {
|
||||
if ((CoordinateY >= 2) && (CoordinateY <= (MainEditor.ScreenSize.Row - 1))) {
|
||||
FileBuffer.MousePosition.Row = CoordinateY;
|
||||
} else if (CoordinateY < 2) {
|
||||
FileBuffer.MousePosition.Row = 2;
|
||||
} else if (CoordinateY > (MainEditor.ScreenSize.Row - 1)) {
|
||||
FileBuffer.MousePosition.Row = (MainEditor.ScreenSize.Row - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3255,6 +3292,7 @@ FileBufferReplaceAll (
|
||||
if (Line->Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// the end CHAR_NULL character;
|
||||
//
|
||||
@ -3268,8 +3306,7 @@ FileBufferReplaceAll (
|
||||
*Buffer = *(Buffer - Gap);
|
||||
Buffer--;
|
||||
}
|
||||
|
||||
} else if (ReplaceLen < SearchLen){
|
||||
} else if (ReplaceLen < SearchLen) {
|
||||
Buffer = Line->Buffer + Position + ReplaceLen;
|
||||
Gap = SearchLen - ReplaceLen;
|
||||
|
||||
@ -3278,8 +3315,9 @@ FileBufferReplaceAll (
|
||||
Buffer++;
|
||||
}
|
||||
} else {
|
||||
ASSERT(ReplaceLen == SearchLen);
|
||||
ASSERT (ReplaceLen == SearchLen);
|
||||
}
|
||||
|
||||
//
|
||||
// set replace into it
|
||||
//
|
||||
@ -3298,6 +3336,7 @@ FileBufferReplaceAll (
|
||||
Link = Link->ForwardLink;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// call refresh to fresh edit area
|
||||
//
|
||||
@ -3318,4 +3357,3 @@ FileBufferSetModified (
|
||||
{
|
||||
FileBuffer.FileModified = TRUE;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ FileBufferRefresh (
|
||||
**/
|
||||
EFI_STATUS
|
||||
FileBufferHandleInput (
|
||||
IN CONST EFI_INPUT_KEY * Key
|
||||
IN CONST EFI_INPUT_KEY *Key
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -35,7 +35,6 @@ extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar;
|
||||
|
||||
EFI_EDITOR_GLOBAL_EDITOR MainEditor;
|
||||
|
||||
|
||||
/**
|
||||
Load a file from disk to editor
|
||||
|
||||
@ -155,30 +154,30 @@ MainCommandPasteLine (
|
||||
Help info that will be displayed.
|
||||
**/
|
||||
EFI_STRING_ID MainMenuHelpInfo[] = {
|
||||
STRING_TOKEN(STR_EDIT_HELP_TITLE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_LIST_TITLE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_DIV),
|
||||
STRING_TOKEN(STR_EDIT_HELP_GO_TO_LINE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_SAVE_FILE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_EXIT),
|
||||
STRING_TOKEN(STR_EDIT_HELP_SEARCH),
|
||||
STRING_TOKEN(STR_EDIT_HELP_SEARCH_REPLACE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_CUT_LINE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_PASTE_LINE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_OPEN_FILE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_FILE_TYPE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_EXIT_HELP),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_DIV),
|
||||
0
|
||||
STRING_TOKEN (STR_EDIT_HELP_TITLE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_LIST_TITLE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_DIV),
|
||||
STRING_TOKEN (STR_EDIT_HELP_GO_TO_LINE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_SAVE_FILE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_EXIT),
|
||||
STRING_TOKEN (STR_EDIT_HELP_SEARCH),
|
||||
STRING_TOKEN (STR_EDIT_HELP_SEARCH_REPLACE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_CUT_LINE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_PASTE_LINE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_OPEN_FILE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_FILE_TYPE),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_EXIT_HELP),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN (STR_EDIT_HELP_DIV),
|
||||
0
|
||||
};
|
||||
|
||||
MENU_ITEM_FUNCTION MainControlBasedMenuFunctions[] = {
|
||||
@ -213,55 +212,55 @@ MENU_ITEM_FUNCTION MainControlBasedMenuFunctions[] = {
|
||||
|
||||
EDITOR_MENU_ITEM MainMenuItems[] = {
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_GO_TO_LINE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F1),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_GO_TO_LINE),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F1),
|
||||
MainCommandGotoLine
|
||||
},
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_SAVE_FILE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F2),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_SAVE_FILE),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F2),
|
||||
MainCommandSaveFile
|
||||
},
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_EXIT),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F3),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_EXIT),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F3),
|
||||
MainCommandExit
|
||||
},
|
||||
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_SEARCH),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F4),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_SEARCH),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F4),
|
||||
MainCommandSearch
|
||||
},
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_SEARCH_REPLACE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F5),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_SEARCH_REPLACE),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F5),
|
||||
MainCommandSearchReplace
|
||||
},
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_CUT_LINE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F6),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_CUT_LINE),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F6),
|
||||
MainCommandCutLine
|
||||
},
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_PASTE_LINE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F7),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_PASTE_LINE),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F7),
|
||||
MainCommandPasteLine
|
||||
},
|
||||
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_OPEN_FILE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F8),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_OPEN_FILE),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F8),
|
||||
MainCommandOpenFile
|
||||
},
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_FILE_TYPE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F9),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_FILE_TYPE),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F9),
|
||||
MainCommandSwitchFileType
|
||||
},
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_FILE_TYPE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F11),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_FILE_TYPE),
|
||||
STRING_TOKEN (STR_EDIT_LIBMENUBAR_F11),
|
||||
MainCommandSwitchFileType
|
||||
},
|
||||
|
||||
@ -272,7 +271,6 @@ EDITOR_MENU_ITEM MainMenuItems[] = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Load a file from disk to editor
|
||||
|
||||
@ -317,11 +315,11 @@ MainCommandOpenFile (
|
||||
// whether to save it first.
|
||||
//
|
||||
if (MainEditor.FileBuffer->FileModified) {
|
||||
|
||||
Status = InputBarSetPrompt (L"File modified. Save (Yes/No/Cancel) ? ");
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// the answer is just one character
|
||||
//
|
||||
@ -329,6 +327,7 @@ MainCommandOpenFile (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// loop for user's answer
|
||||
// valid answer is just 'y' 'Y', 'n' 'N', 'c' 'C'
|
||||
@ -336,7 +335,7 @@ MainCommandOpenFile (
|
||||
Done = FALSE;
|
||||
while (!Done) {
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC pressed
|
||||
@ -345,7 +344,7 @@ MainCommandOpenFile (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
switch (InputBarGetString()[0]) {
|
||||
switch (InputBarGetString ()[0]) {
|
||||
case L'y':
|
||||
case L'Y':
|
||||
//
|
||||
@ -375,6 +374,7 @@ MainCommandOpenFile (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TO get the open file name
|
||||
//
|
||||
@ -392,7 +392,7 @@ MainCommandOpenFile (
|
||||
|
||||
while (1) {
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC pressed
|
||||
@ -400,14 +400,15 @@ MainCommandOpenFile (
|
||||
if (Status == EFI_NOT_READY) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// The input string length should > 0
|
||||
//
|
||||
if (StrLen (InputBarGetString()) > 0) {
|
||||
if (StrLen (InputBarGetString ()) > 0) {
|
||||
//
|
||||
// CHECK if filename is valid
|
||||
//
|
||||
if (!IsValidFileName (InputBarGetString())) {
|
||||
if (!IsValidFileName (InputBarGetString ())) {
|
||||
FileBufferRead (MainEditor.FileBuffer->FileName, TRUE);
|
||||
StatusBarSetStatusString (L"Invalid File Name");
|
||||
return EFI_SUCCESS;
|
||||
@ -416,10 +417,11 @@ MainCommandOpenFile (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// read from disk
|
||||
//
|
||||
Status = FileBufferRead (InputBarGetString(), FALSE);
|
||||
Status = FileBufferRead (InputBarGetString (), FALSE);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
FileBufferRead (MainEditor.FileBuffer->FileName, TRUE);
|
||||
@ -529,7 +531,6 @@ MainCommandPasteLine (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
search string in file buffer
|
||||
|
||||
@ -576,7 +577,7 @@ MainCommandSearch (
|
||||
}
|
||||
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC
|
||||
@ -584,17 +585,19 @@ MainCommandSearch (
|
||||
if (Status == EFI_NOT_READY) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// just enter pressed
|
||||
//
|
||||
if (StrLen (InputBarGetString()) == 0) {
|
||||
if (StrLen (InputBarGetString ()) == 0) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Buffer = CatSPrint (NULL, L"%s", InputBarGetString());
|
||||
Buffer = CatSPrint (NULL, L"%s", InputBarGetString ());
|
||||
if (Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// the first time , search from current position
|
||||
//
|
||||
@ -611,6 +614,7 @@ MainCommandSearch (
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Find next
|
||||
//
|
||||
@ -629,7 +633,7 @@ MainCommandSearch (
|
||||
Done = FALSE;
|
||||
while (!Done) {
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC pressed
|
||||
@ -639,7 +643,7 @@ MainCommandSearch (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
switch (InputBarGetString()[0]) {
|
||||
switch (InputBarGetString ()[0]) {
|
||||
case L'y':
|
||||
case L'Y':
|
||||
Done = TRUE;
|
||||
@ -649,19 +653,20 @@ MainCommandSearch (
|
||||
case L'N':
|
||||
FreePool (Buffer);
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// end of which
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// end of while !Done
|
||||
// for search second, third time, search from current position + strlen
|
||||
//
|
||||
Offset = StrLen (Buffer);
|
||||
|
||||
} while (1);
|
||||
|
||||
//
|
||||
// end of do
|
||||
//
|
||||
@ -736,7 +741,7 @@ MainCommandSearchReplace (
|
||||
}
|
||||
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC
|
||||
@ -744,14 +749,15 @@ MainCommandSearchReplace (
|
||||
if (Status == EFI_NOT_READY) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// if just pressed enter
|
||||
//
|
||||
if (StrLen (InputBarGetString()) == 0) {
|
||||
if (StrLen (InputBarGetString ()) == 0) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Search = CatSPrint (NULL, L"%s", InputBarGetString());
|
||||
Search = CatSPrint (NULL, L"%s", InputBarGetString ());
|
||||
if (Search == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -772,7 +778,7 @@ MainCommandSearchReplace (
|
||||
}
|
||||
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC
|
||||
@ -781,7 +787,7 @@ MainCommandSearchReplace (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Replace = CatSPrint (NULL, L"%s", InputBarGetString());
|
||||
Replace = CatSPrint (NULL, L"%s", InputBarGetString ());
|
||||
if (Replace == NULL) {
|
||||
FreePool (Search);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@ -815,6 +821,7 @@ MainCommandSearchReplace (
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// replace or not?
|
||||
//
|
||||
@ -836,7 +843,7 @@ MainCommandSearchReplace (
|
||||
Done = FALSE;
|
||||
while (!Done) {
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC pressed
|
||||
@ -847,7 +854,7 @@ MainCommandSearchReplace (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
switch (InputBarGetString()[0]) {
|
||||
switch (InputBarGetString ()[0]) {
|
||||
case L'y':
|
||||
case L'Y':
|
||||
Done = TRUE;
|
||||
@ -872,12 +879,13 @@ MainCommandSearchReplace (
|
||||
FreePool (Search);
|
||||
FreePool (Replace);
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// end of which
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// end of while !Done
|
||||
// Decide to Replace
|
||||
@ -890,6 +898,7 @@ MainCommandSearchReplace (
|
||||
StatusBarSetStatusString (L"Read Only File Can Not Be Modified");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// replace all
|
||||
//
|
||||
@ -899,6 +908,7 @@ MainCommandSearchReplace (
|
||||
FreePool (Replace);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// replace
|
||||
//
|
||||
@ -909,6 +919,7 @@ MainCommandSearchReplace (
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Find next
|
||||
//
|
||||
@ -929,7 +940,7 @@ MainCommandSearchReplace (
|
||||
Done = FALSE;
|
||||
while (!Done) {
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC pressed
|
||||
@ -940,7 +951,7 @@ MainCommandSearchReplace (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
switch (InputBarGetString()[0]) {
|
||||
switch (InputBarGetString ()[0]) {
|
||||
case L'y':
|
||||
case L'Y':
|
||||
Done = TRUE;
|
||||
@ -951,18 +962,19 @@ MainCommandSearchReplace (
|
||||
FreePool (Search);
|
||||
FreePool (Replace);
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// end of which
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// end of while !Done
|
||||
//
|
||||
First = FALSE;
|
||||
|
||||
} while (1);
|
||||
|
||||
//
|
||||
// end of do
|
||||
//
|
||||
@ -1004,7 +1016,6 @@ MainCommandExit (
|
||||
// if file has been modified, so will prompt user whether to save the changes
|
||||
//
|
||||
if (MainEditor.FileBuffer->FileModified) {
|
||||
|
||||
Status = InputBarSetPrompt (L"File modified. Save (Yes/No/Cancel) ? ");
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@ -1017,7 +1028,7 @@ MainCommandExit (
|
||||
|
||||
while (1) {
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC pressed
|
||||
@ -1026,7 +1037,7 @@ MainCommandExit (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
switch (InputBarGetString()[0]) {
|
||||
switch (InputBarGetString ()[0]) {
|
||||
case L'y':
|
||||
case L'Y':
|
||||
//
|
||||
@ -1047,14 +1058,12 @@ MainCommandExit (
|
||||
case L'c':
|
||||
case L'C':
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorExit = TRUE;
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1086,6 +1095,7 @@ MainCommandGotoLine (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// line number's digit <= 6
|
||||
//
|
||||
@ -1095,7 +1105,7 @@ MainCommandGotoLine (
|
||||
}
|
||||
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// press ESC
|
||||
@ -1103,22 +1113,24 @@ MainCommandGotoLine (
|
||||
if (Status == EFI_NOT_READY) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// if JUST press enter
|
||||
//
|
||||
if (StrLen (InputBarGetString()) == 0) {
|
||||
if (StrLen (InputBarGetString ()) == 0) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Row = ShellStrToUintn (InputBarGetString());
|
||||
Row = ShellStrToUintn (InputBarGetString ());
|
||||
|
||||
//
|
||||
// invalid line number
|
||||
//
|
||||
if (Row > MainEditor.FileBuffer->NumLines || Row <= 0) {
|
||||
if ((Row > MainEditor.FileBuffer->NumLines) || (Row <= 0)) {
|
||||
StatusBarSetStatusString (L"No Such Line");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// move cursor to that line's start
|
||||
//
|
||||
@ -1200,22 +1212,22 @@ MainCommandSaveFile (
|
||||
}
|
||||
|
||||
Status = InputBarSetPrompt (Str);
|
||||
FreePool(Str);
|
||||
FreePool (Str);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = InputBarSetStringSize (100);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// get new file name
|
||||
//
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// if user pressed ESC
|
||||
@ -1227,10 +1239,10 @@ MainCommandSaveFile (
|
||||
//
|
||||
// if just enter pressed, so think save to current file name
|
||||
//
|
||||
if (StrLen (InputBarGetString()) == 0) {
|
||||
if (StrLen (InputBarGetString ()) == 0) {
|
||||
FileName = CatSPrint (NULL, L"%s", MainEditor.FileBuffer->FileName);
|
||||
} else {
|
||||
FileName = CatSPrint (NULL, L"%s", InputBarGetString());
|
||||
FileName = CatSPrint (NULL, L"%s", InputBarGetString ());
|
||||
}
|
||||
|
||||
if (FileName == NULL) {
|
||||
@ -1265,18 +1277,18 @@ MainCommandSaveFile (
|
||||
//
|
||||
// if the file exists
|
||||
//
|
||||
if (ShellFileExists(FileName) != EFI_NOT_FOUND) {
|
||||
if (ShellFileExists (FileName) != EFI_NOT_FOUND) {
|
||||
//
|
||||
// check for read only
|
||||
//
|
||||
Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ShellOpenFileByName (FileName, &FileHandle, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
StatusBarSetStatusString (L"Open Failed");
|
||||
FreePool (FileName);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Info = ShellGetFileInfo(FileHandle);
|
||||
Info = ShellGetFileInfo (FileHandle);
|
||||
if (Info == NULL) {
|
||||
StatusBarSetStatusString (L"Access Denied");
|
||||
FreePool (FileName);
|
||||
@ -1289,6 +1301,7 @@ MainCommandSaveFile (
|
||||
FreePool (FileName);
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
FreePool (Info);
|
||||
|
||||
//
|
||||
@ -1308,7 +1321,7 @@ MainCommandSaveFile (
|
||||
|
||||
while (TRUE) {
|
||||
Status = InputBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
|
||||
//
|
||||
// ESC pressed
|
||||
@ -1318,7 +1331,7 @@ MainCommandSaveFile (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
switch (InputBarGetString()[0]) {
|
||||
switch (InputBarGetString ()[0]) {
|
||||
case L'y':
|
||||
case L'Y':
|
||||
break;
|
||||
@ -1337,7 +1350,7 @@ MainCommandSaveFile (
|
||||
//
|
||||
// save file to disk with specified name
|
||||
//
|
||||
FileBufferSetModified();
|
||||
FileBufferSetModified ();
|
||||
Status = FileBufferSave (FileName);
|
||||
SHELL_FREE_NON_NULL (FileName);
|
||||
|
||||
@ -1364,7 +1377,7 @@ MainCommandDisplayHelp (
|
||||
// print helpInfo
|
||||
//
|
||||
for (CurrentLine = 0; 0 != MainMenuHelpInfo[CurrentLine]; CurrentLine++) {
|
||||
InfoString = HiiGetString(gShellDebug1HiiHandle, MainMenuHelpInfo[CurrentLine], NULL);
|
||||
InfoString = HiiGetString (gShellDebug1HiiHandle, MainMenuHelpInfo[CurrentLine], NULL);
|
||||
ShellPrintEx (0, CurrentLine+1, L"%E%s%N", InfoString);
|
||||
}
|
||||
|
||||
@ -1376,13 +1389,15 @@ MainCommandDisplayHelp (
|
||||
if (EFI_ERROR (Status) || (EventIndex != 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = MainEditor.TextInputEx->ReadKeyStrokeEx (MainEditor.TextInputEx, &KeyData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
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,
|
||||
// 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) &&
|
||||
((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,
|
||||
// make sure that only CONTROL shift key is pressed.
|
||||
@ -1402,6 +1418,7 @@ MainCommandDisplayHelp (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// update screen with file buffer's info
|
||||
//
|
||||
@ -1416,14 +1433,13 @@ MainCommandDisplayHelp (
|
||||
EFI_EDITOR_COLOR_ATTRIBUTES OriginalColors;
|
||||
INTN OriginalMode;
|
||||
|
||||
|
||||
//
|
||||
// basic initialization for MainEditor
|
||||
//
|
||||
EFI_EDITOR_GLOBAL_EDITOR MainEditorConst = {
|
||||
&FileBuffer,
|
||||
{
|
||||
{0, 0}
|
||||
{ 0, 0}
|
||||
},
|
||||
{
|
||||
0,
|
||||
@ -1461,7 +1477,7 @@ MainEditorInit (
|
||||
//
|
||||
MainEditor.ColorAttributes.Colors.Foreground = gST->ConOut->Mode->Attribute & 0x000000ff;
|
||||
|
||||
MainEditor.ColorAttributes.Colors.Background = (UINT8) (gST->ConOut->Mode->Attribute >> 4);
|
||||
MainEditor.ColorAttributes.Colors.Background = (UINT8)(gST->ConOut->Mode->Attribute >> 4);
|
||||
OriginalColors = MainEditor.ColorAttributes.Colors;
|
||||
|
||||
OriginalMode = gST->ConOut->Mode->Mode;
|
||||
@ -1483,7 +1499,7 @@ MainEditorInit (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleInHandle,
|
||||
&gEfiSimpleTextInputExProtocolGuid,
|
||||
(VOID**)&MainEditor.TextInputEx
|
||||
(VOID **)&MainEditor.TextInputEx
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@ -1495,7 +1511,7 @@ MainEditorInit (
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleInHandle,
|
||||
&gEfiSimplePointerProtocolGuid,
|
||||
(VOID**)&MainEditor.MouseInterface
|
||||
(VOID **)&MainEditor.MouseInterface
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
@ -1510,7 +1526,7 @@ MainEditorInit (
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
if (!EFI_ERROR (Status) && HandleCount > 0) {
|
||||
if (!EFI_ERROR (Status) && (HandleCount > 0)) {
|
||||
//
|
||||
// Try to find the first available mouse device
|
||||
//
|
||||
@ -1518,19 +1534,20 @@ MainEditorInit (
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleBuffer[Index],
|
||||
&gEfiSimplePointerProtocolGuid,
|
||||
(VOID**)&MainEditor.MouseInterface
|
||||
(VOID **)&MainEditor.MouseInterface
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status) && MainEditor.MouseInterface != NULL) {
|
||||
if (!EFI_ERROR (Status) && (MainEditor.MouseInterface != NULL)) {
|
||||
MainEditor.MouseAccumulatorX = 0;
|
||||
MainEditor.MouseAccumulatorY = 0;
|
||||
MainEditor.MouseSupported = TRUE;
|
||||
@ -1541,20 +1558,20 @@ MainEditorInit (
|
||||
//
|
||||
Status = MainTitleBarInit (L"UEFI EDIT");
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_TITLEBAR), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_LIBEDITOR_TITLEBAR), gShellDebug1HiiHandle);
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
Status = ControlHotKeyInit (MainControlBasedMenuFunctions);
|
||||
Status = MenuBarInit (MainMenuItems);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_LIBEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
Status = StatusBarInit ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_STATUSBAR), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_LIBEDITOR_STATUSBAR), gShellDebug1HiiHandle);
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
@ -1562,9 +1579,10 @@ MainEditorInit (
|
||||
|
||||
Status = FileBufferInit ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
// clear whole screen and enable cursor
|
||||
//
|
||||
@ -1599,21 +1617,23 @@ MainEditorCleanup (
|
||||
// if error, do not exit
|
||||
// just print some warning
|
||||
//
|
||||
MainTitleBarCleanup();
|
||||
StatusBarCleanup();
|
||||
InputBarCleanup();
|
||||
MainTitleBarCleanup ();
|
||||
StatusBarCleanup ();
|
||||
InputBarCleanup ();
|
||||
MenuBarCleanup ();
|
||||
|
||||
Status = FileBufferCleanup ();
|
||||
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
|
||||
//
|
||||
if (OriginalMode != gST->ConOut->Mode->Mode) {
|
||||
gST->ConOut->SetMode (gST->ConOut, OriginalMode);
|
||||
}
|
||||
|
||||
//
|
||||
// restore old screen color
|
||||
//
|
||||
@ -1643,22 +1663,22 @@ MainEditorRefresh (
|
||||
//
|
||||
// call the components refresh function
|
||||
//
|
||||
if (EditorFirst
|
||||
|| StrCmp (FileBufferBackupVar.FileName, FileBuffer.FileName) != 0
|
||||
|| FileBufferBackupVar.FileType != FileBuffer.FileType
|
||||
|| FileBufferBackupVar.FileModified != FileBuffer.FileModified
|
||||
|| FileBufferBackupVar.ReadOnly != FileBuffer.ReadOnly) {
|
||||
|
||||
if ( EditorFirst
|
||||
|| (StrCmp (FileBufferBackupVar.FileName, FileBuffer.FileName) != 0)
|
||||
|| (FileBufferBackupVar.FileType != FileBuffer.FileType)
|
||||
|| (FileBufferBackupVar.FileModified != FileBuffer.FileModified)
|
||||
|| (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);
|
||||
FileBufferRestorePosition ();
|
||||
}
|
||||
|
||||
if (EditorFirst
|
||||
|| FileBufferBackupVar.FilePosition.Row != FileBuffer.FilePosition.Row
|
||||
|| FileBufferBackupVar.FilePosition.Column != FileBuffer.FilePosition.Column
|
||||
|| FileBufferBackupVar.ModeInsert != FileBuffer.ModeInsert
|
||||
|| StatusBarGetRefresh()) {
|
||||
|
||||
if ( EditorFirst
|
||||
|| (FileBufferBackupVar.FilePosition.Row != FileBuffer.FilePosition.Row)
|
||||
|| (FileBufferBackupVar.FilePosition.Column != FileBuffer.FilePosition.Column)
|
||||
|| (FileBufferBackupVar.ModeInsert != FileBuffer.ModeInsert)
|
||||
|| StatusBarGetRefresh ())
|
||||
{
|
||||
StatusBarRefresh (EditorFirst, MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column, MainEditor.FileBuffer->FilePosition.Row, MainEditor.FileBuffer->FilePosition.Column, MainEditor.FileBuffer->ModeInsert);
|
||||
FileBufferRestorePosition ();
|
||||
}
|
||||
@ -1690,9 +1710,9 @@ GetTextX (
|
||||
INT32 Gap;
|
||||
|
||||
MainEditor.MouseAccumulatorX += GuidX;
|
||||
Gap = (MainEditor.MouseAccumulatorX * (INT32) MainEditor.ScreenSize.Column) / (INT32) (50 * (INT32) MainEditor.MouseInterface->Mode->ResolutionX);
|
||||
MainEditor.MouseAccumulatorX = (MainEditor.MouseAccumulatorX * (INT32) MainEditor.ScreenSize.Column) % (INT32) (50 * (INT32) MainEditor.MouseInterface->Mode->ResolutionX);
|
||||
MainEditor.MouseAccumulatorX = MainEditor.MouseAccumulatorX / (INT32) MainEditor.ScreenSize.Column;
|
||||
Gap = (MainEditor.MouseAccumulatorX * (INT32)MainEditor.ScreenSize.Column) / (INT32)(50 * (INT32)MainEditor.MouseInterface->Mode->ResolutionX);
|
||||
MainEditor.MouseAccumulatorX = (MainEditor.MouseAccumulatorX * (INT32)MainEditor.ScreenSize.Column) % (INT32)(50 * (INT32)MainEditor.MouseInterface->Mode->ResolutionX);
|
||||
MainEditor.MouseAccumulatorX = MainEditor.MouseAccumulatorX / (INT32)MainEditor.ScreenSize.Column;
|
||||
return Gap;
|
||||
}
|
||||
|
||||
@ -1711,9 +1731,9 @@ GetTextY (
|
||||
INT32 Gap;
|
||||
|
||||
MainEditor.MouseAccumulatorY += GuidY;
|
||||
Gap = (MainEditor.MouseAccumulatorY * (INT32) MainEditor.ScreenSize.Row) / (INT32) (50 * (INT32) MainEditor.MouseInterface->Mode->ResolutionY);
|
||||
MainEditor.MouseAccumulatorY = (MainEditor.MouseAccumulatorY * (INT32) MainEditor.ScreenSize.Row) % (INT32) (50 * (INT32) MainEditor.MouseInterface->Mode->ResolutionY);
|
||||
MainEditor.MouseAccumulatorY = MainEditor.MouseAccumulatorY / (INT32) MainEditor.ScreenSize.Row;
|
||||
Gap = (MainEditor.MouseAccumulatorY * (INT32)MainEditor.ScreenSize.Row) / (INT32)(50 * (INT32)MainEditor.MouseInterface->Mode->ResolutionY);
|
||||
MainEditor.MouseAccumulatorY = (MainEditor.MouseAccumulatorY * (INT32)MainEditor.ScreenSize.Row) % (INT32)(50 * (INT32)MainEditor.MouseInterface->Mode->ResolutionY);
|
||||
MainEditor.MouseAccumulatorY = MainEditor.MouseAccumulatorY / (INT32)MainEditor.ScreenSize.Row;
|
||||
|
||||
return Gap;
|
||||
}
|
||||
@ -1731,7 +1751,6 @@ MainEditorHandleMouseInput (
|
||||
IN EFI_SIMPLE_POINTER_STATE MouseState
|
||||
)
|
||||
{
|
||||
|
||||
INT32 TextX;
|
||||
INT32 TextY;
|
||||
UINTN FRow;
|
||||
@ -1763,14 +1782,12 @@ MainEditorHandleMouseInput (
|
||||
FileBufferAdjustMousePosition (TextX, TextY);
|
||||
|
||||
Action = TRUE;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// if left button pushed down
|
||||
//
|
||||
if (MouseState.LeftButton) {
|
||||
|
||||
FCol = MainEditor.FileBuffer->MousePosition.Column - 1 + 1;
|
||||
|
||||
FRow = MainEditor.FileBuffer->FilePosition.Row +
|
||||
@ -1806,6 +1823,7 @@ MainEditorHandleMouseInput (
|
||||
|
||||
Action = TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// mouse has action
|
||||
//
|
||||
@ -1837,7 +1855,6 @@ MainEditorKeyInput (
|
||||
BOOLEAN NoShiftState;
|
||||
|
||||
do {
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
EditorMouseAction = FALSE;
|
||||
|
||||
@ -1857,7 +1874,6 @@ MainEditorKeyInput (
|
||||
&MouseState
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
||||
Status = MainEditorHandleMouseInput (MouseState);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@ -1884,7 +1900,7 @@ MainEditorKeyInput (
|
||||
//
|
||||
// clear previous status string
|
||||
//
|
||||
StatusBarSetRefresh();
|
||||
StatusBarSetRefresh ();
|
||||
//
|
||||
// NoShiftState: TRUE when no shift key is pressed.
|
||||
//
|
||||
@ -1892,7 +1908,7 @@ MainEditorKeyInput (
|
||||
//
|
||||
// dispatch to different components' key handling function
|
||||
//
|
||||
if (EFI_NOT_FOUND != MenuBarDispatchControlHotKey(&KeyData)) {
|
||||
if (EFI_NOT_FOUND != MenuBarDispatchControlHotKey (&KeyData)) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else if (NoShiftState && ((KeyData.Key.ScanCode == SCAN_NULL) || ((KeyData.Key.ScanCode >= SCAN_UP) && (KeyData.Key.ScanCode <= SCAN_PAGE_DOWN)))) {
|
||||
Status = FileBufferHandleInput (&KeyData.Key);
|
||||
@ -1903,22 +1919,21 @@ MainEditorKeyInput (
|
||||
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
|
||||
//
|
||||
if (StatusBarGetString() != NULL && StrCmp (L"", StatusBarGetString()) == 0) {
|
||||
if ((StatusBarGetString () != NULL) && (StrCmp (L"", StatusBarGetString ()) == 0)) {
|
||||
StatusBarSetStatusString (L"Disk Error. Try Again");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
// after handling, refresh editor
|
||||
//
|
||||
MainEditorRefresh ();
|
||||
|
||||
} while (Status != EFI_OUT_OF_RESOURCES && !EditorExit);
|
||||
|
||||
return Status;
|
||||
@ -1947,6 +1962,7 @@ MainEditorSetCutLine (
|
||||
//
|
||||
LineFree (MainEditor.CutLine);
|
||||
}
|
||||
|
||||
//
|
||||
// duplicate the line to clipboard
|
||||
//
|
||||
|
@ -31,6 +31,7 @@ LineDup (
|
||||
if (Dest == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// allocate and set the line buffer
|
||||
//
|
||||
@ -63,22 +64,12 @@ LineFree (
|
||||
)
|
||||
{
|
||||
if (Src == NULL) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// free the line buffer and then the line structure itself
|
||||
//
|
||||
SHELL_FREE_NON_NULL (Src->Buffer);
|
||||
SHELL_FREE_NON_NULL (Src);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
#include "TextEditorTypes.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Free a EFI_EDITOR_LINE structure.
|
||||
|
||||
@ -36,9 +34,4 @@ LineDup (
|
||||
IN EFI_EDITOR_LINE *Src
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -91,7 +91,6 @@ typedef struct {
|
||||
EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;
|
||||
INT32 MouseAccumulatorX;
|
||||
INT32 MouseAccumulatorY;
|
||||
|
||||
} EFI_EDITOR_GLOBAL_EDITOR;
|
||||
|
||||
#endif
|
||||
|
@ -106,7 +106,6 @@ typedef union {
|
||||
UINTN Data;
|
||||
} INPUT_BAR_COLOR_UNION;
|
||||
|
||||
|
||||
/**
|
||||
The refresh function for InputBar, it will wait for user input
|
||||
|
||||
@ -152,10 +151,10 @@ InputBarRefresh (
|
||||
//
|
||||
// clear input bar
|
||||
//
|
||||
EditorClearLine (LastRow , LastColumn, LastRow);
|
||||
EditorClearLine (LastRow, LastColumn, LastRow);
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, LastRow - 1);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBINPUTBAR_MAININPUTBAR), gShellDebug1HiiHandle, mPrompt);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_EDIT_LIBINPUTBAR_MAININPUTBAR), gShellDebug1HiiHandle, mPrompt);
|
||||
|
||||
//
|
||||
// this is a selection mPrompt, cursor will stay in edit area
|
||||
@ -168,25 +167,30 @@ InputBarRefresh (
|
||||
} else {
|
||||
NoDisplay = FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// wait for user input
|
||||
//
|
||||
for (;;) {
|
||||
for ( ; ;) {
|
||||
Status = gBS->WaitForEvent (1, &mTextInEx->WaitForKeyEx, &EventIndex);
|
||||
if (EFI_ERROR (Status) || (EventIndex != 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = mTextInEx->ReadKeyStrokeEx (mTextInEx, &KeyData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
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.
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// pressed ESC
|
||||
//
|
||||
@ -195,10 +199,11 @@ InputBarRefresh (
|
||||
Status = EFI_NOT_READY;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
} else if (KeyData.Key.UnicodeChar == CHAR_BACKSPACE) {
|
||||
//
|
||||
@ -208,12 +213,10 @@ InputBarRefresh (
|
||||
Size--;
|
||||
mReturnString[Size] = CHAR_NULL;
|
||||
if (!NoDisplay) {
|
||||
|
||||
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
|
||||
//
|
||||
@ -231,22 +234,18 @@ InputBarRefresh (
|
||||
mReturnString[Size] = CHAR_NULL;
|
||||
|
||||
if (!NoDisplay) {
|
||||
|
||||
InputBarPrintInput (LastColumn, LastRow);
|
||||
|
||||
} else {
|
||||
//
|
||||
// if just choose yes/no
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
mReturnString[Size] = CHAR_NULL;
|
||||
|
||||
|
||||
//
|
||||
// restore screen attributes
|
||||
//
|
||||
@ -301,7 +300,7 @@ InputBarSetStringSize (
|
||||
SHELL_FREE_NON_NULL (mReturnString);
|
||||
|
||||
StringSize = Size;
|
||||
mReturnString = AllocateZeroPool ((StringSize + 1) * sizeof(mReturnString[0]));
|
||||
mReturnString = AllocateZeroPool ((StringSize + 1) * sizeof (mReturnString[0]));
|
||||
if (mReturnString == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -315,7 +314,7 @@ InputBarSetStringSize (
|
||||
@retval NULL No input has been received.
|
||||
@return The string that was input.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
InputBarGetString (
|
||||
VOID
|
||||
)
|
||||
|
@ -73,7 +73,7 @@ InputBarSetStringSize (
|
||||
@retval NULL No input has been received.
|
||||
@return The string that was input.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
InputBarGetString (
|
||||
VOID
|
||||
);
|
||||
|
@ -22,7 +22,7 @@ MenuBarCleanup (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
SHELL_FREE_NON_NULL(MenuItems);
|
||||
SHELL_FREE_NON_NULL (MenuItems);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,13 +40,15 @@ MenuBarInit (
|
||||
{
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -65,6 +67,7 @@ ControlHotKeyInit (
|
||||
ControlBasedMenuFunctions = Items;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Refresh function for the menu bar.
|
||||
|
||||
@ -97,17 +100,13 @@ MenuBarRefresh (
|
||||
//
|
||||
EditorClearLine (LastRow - 2, LastCol, LastRow);
|
||||
EditorClearLine (LastRow - 1, LastCol, LastRow);
|
||||
EditorClearLine (LastRow , LastCol, LastRow);
|
||||
|
||||
EditorClearLine (LastRow, LastCol, LastRow);
|
||||
|
||||
//
|
||||
// print out the menu items
|
||||
//
|
||||
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);
|
||||
if (((Col + Width) > LastCol)) {
|
||||
@ -115,7 +114,7 @@ MenuBarRefresh (
|
||||
Col = 1;
|
||||
}
|
||||
|
||||
FunctionKeyString = HiiGetString(gShellDebug1HiiHandle, Item->FunctionKeyToken, NULL);
|
||||
FunctionKeyString = HiiGetString (gShellDebug1HiiHandle, Item->FunctionKeyToken, NULL);
|
||||
|
||||
ShellPrintEx ((INT32)(Col) - 1, (INT32)(Row) - 1, L"%E%s%N %H%s%N ", FunctionKeyString, NameString);
|
||||
|
||||
@ -178,7 +177,8 @@ MenuBarDispatchControlHotKey (
|
||||
ControlIndex = MAX_UINT16;
|
||||
|
||||
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,
|
||||
// Ctrl+A is translated to 1 (UnicodeChar).
|
||||
@ -186,7 +186,8 @@ MenuBarDispatchControlHotKey (
|
||||
ControlIndex = KeyData->Key.UnicodeChar;
|
||||
} 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_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,
|
||||
// make sure only CONTROL is pressed.
|
||||
@ -197,8 +198,9 @@ MenuBarDispatchControlHotKey (
|
||||
ControlIndex = KeyData->Key.UnicodeChar - L'a' + 1;
|
||||
}
|
||||
}
|
||||
if ((SCAN_CONTROL_Z < ControlIndex)
|
||||
||(NULL == ControlBasedMenuFunctions[ControlIndex]))
|
||||
|
||||
if ( (SCAN_CONTROL_Z < ControlIndex)
|
||||
|| (NULL == ControlBasedMenuFunctions[ControlIndex]))
|
||||
{
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
@ -206,5 +208,3 @@ MenuBarDispatchControlHotKey (
|
||||
ControlBasedMenuFunctions[ControlIndex]();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#define SCAN_CONTROL_W 23
|
||||
#define SCAN_CONTROL_Z 26
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*MENU_ITEM_FUNCTION) (
|
||||
|
@ -91,6 +91,7 @@ StatusBarRefresh (
|
||||
if (!StatusStringChanged && StatusBarNeedRefresh) {
|
||||
StatusBarSetStatusString (L"\0");
|
||||
}
|
||||
|
||||
//
|
||||
// when it's called first time after editor launch, so refresh is mandatory
|
||||
//
|
||||
@ -117,7 +118,7 @@ StatusBarRefresh (
|
||||
//
|
||||
// print row, column fields
|
||||
//
|
||||
if (FileRow != (UINTN)(-1) && FileCol != (UINTN)(-1)) {
|
||||
if ((FileRow != (UINTN)(-1)) && (FileCol != (UINTN)(-1))) {
|
||||
ShellPrintEx (
|
||||
0,
|
||||
(INT32)(LastRow) - 1,
|
||||
@ -143,6 +144,7 @@ StatusBarRefresh (
|
||||
} else {
|
||||
ShellPrintEx ((INT32)(LastCol) - 21, (INT32)(LastRow) - 1, L"|%s| Help: Ctrl-E", L"OVR");
|
||||
}
|
||||
|
||||
//
|
||||
// restore the old screen attributes
|
||||
//
|
||||
@ -191,7 +193,7 @@ StatusBarSetStatusString (
|
||||
|
||||
@return The string that is used.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
StatusBarGetString (
|
||||
VOID
|
||||
)
|
||||
@ -203,7 +205,7 @@ StatusBarGetString (
|
||||
Function to set the need refresh boolean to TRUE.
|
||||
**/
|
||||
VOID
|
||||
StatusBarSetRefresh(
|
||||
StatusBarSetRefresh (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
@ -216,7 +218,7 @@ StatusBarSetRefresh(
|
||||
@retval TRUE The status bar needs to be refreshed.
|
||||
**/
|
||||
BOOLEAN
|
||||
StatusBarGetRefresh(
|
||||
StatusBarGetRefresh (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ StatusBarSetStatusString (
|
||||
|
||||
@return The string that is used.
|
||||
**/
|
||||
CONST CHAR16*
|
||||
CONST CHAR16 *
|
||||
StatusBarGetString (
|
||||
VOID
|
||||
);
|
||||
@ -79,7 +79,7 @@ StatusBarGetString (
|
||||
Function to set the need refresh boolean to TRUE.
|
||||
**/
|
||||
VOID
|
||||
StatusBarSetRefresh(
|
||||
StatusBarSetRefresh (
|
||||
VOID
|
||||
);
|
||||
|
||||
@ -89,7 +89,7 @@ StatusBarSetRefresh(
|
||||
@retval TRUE The status bar needs to be refreshed.
|
||||
**/
|
||||
BOOLEAN
|
||||
StatusBarGetRefresh(
|
||||
StatusBarGetRefresh (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
@ -34,6 +34,7 @@ MainTitleBarInit (
|
||||
//
|
||||
Title = CatSPrint (NULL, L"%s", Prompt);
|
||||
}
|
||||
|
||||
if (Title == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -94,7 +95,6 @@ MainTitleBarRefresh (
|
||||
CONST CHAR16 *FileNameTmp;
|
||||
INTN TempInteger;
|
||||
|
||||
|
||||
//
|
||||
// backup the old screen attributes
|
||||
//
|
||||
@ -121,10 +121,12 @@ MainTitleBarRefresh (
|
||||
Title
|
||||
);
|
||||
}
|
||||
|
||||
if (FileName == NULL) {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// First Extract the FileName from fullpath
|
||||
//
|
||||
@ -141,57 +143,62 @@ MainTitleBarRefresh (
|
||||
// the space for file name is 20 characters
|
||||
//
|
||||
if (StrLen (FileNameTmp) <= 20) {
|
||||
ShellPrintEx (-1,-1, L"%s ", FileNameTmp);
|
||||
ShellPrintEx (-1, -1, L"%s ", FileNameTmp);
|
||||
for (TempInteger = StrLen (FileNameTmp); TempInteger < 20; TempInteger++) {
|
||||
ShellPrintEx (-1,-1, L" ");
|
||||
ShellPrintEx (-1, -1, L" ");
|
||||
}
|
||||
|
||||
} else {
|
||||
for (TempInteger = 0; TempInteger < 17; TempInteger++) {
|
||||
ShellPrintEx (-1,-1, L"%c", FileNameTmp[TempInteger]);
|
||||
ShellPrintEx (-1, -1, L"%c", FileNameTmp[TempInteger]);
|
||||
}
|
||||
|
||||
//
|
||||
// print "..."
|
||||
//
|
||||
ShellPrintEx (-1,-1, L"... ");
|
||||
ShellPrintEx (-1, -1, L"... ");
|
||||
}
|
||||
|
||||
//
|
||||
// print file type field
|
||||
//
|
||||
switch (FileType){
|
||||
switch (FileType) {
|
||||
case FileTypeAscii:
|
||||
case FileTypeUnicode:
|
||||
if (FileType == FileTypeAscii){
|
||||
ShellPrintEx (-1,-1, L" ASCII ");
|
||||
if (FileType == FileTypeAscii) {
|
||||
ShellPrintEx (-1, -1, L" ASCII ");
|
||||
} else {
|
||||
ShellPrintEx (-1,-1, L" UNICODE ");
|
||||
ShellPrintEx (-1, -1, L" UNICODE ");
|
||||
}
|
||||
|
||||
//
|
||||
// print read-only field for text files
|
||||
//
|
||||
if (ReadOnly) {
|
||||
ShellPrintEx (-1,-1, L"ReadOnly ");
|
||||
ShellPrintEx (-1, -1, L"ReadOnly ");
|
||||
} else {
|
||||
ShellPrintEx (-1,-1, L" ");
|
||||
ShellPrintEx (-1, -1, L" ");
|
||||
}
|
||||
|
||||
break;
|
||||
case FileTypeDiskBuffer:
|
||||
case FileTypeMemBuffer:
|
||||
//
|
||||
// Print the offset.
|
||||
//
|
||||
ShellPrintEx (-1,-1, L"Offset %X | Size %X", Offset, Size);
|
||||
ShellPrintEx (-1, -1, L"Offset %X | Size %X", Offset, Size);
|
||||
case FileTypeFileBuffer:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// print modified field
|
||||
//
|
||||
if (Modified) {
|
||||
ShellPrintEx (-1,-1, L"Modified");
|
||||
ShellPrintEx (-1, -1, L"Modified");
|
||||
}
|
||||
|
||||
//
|
||||
// restore the old attribute
|
||||
//
|
||||
|
@ -52,74 +52,78 @@ ShellCommandRunEfiCompress (
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit();
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"eficompress", ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"eficompress", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
} else {
|
||||
if (ShellCommandLineGetCount(Package) > 3) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"eficompress");
|
||||
if (ShellCommandLineGetCount (Package) > 3) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"eficompress");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else if (ShellCommandLineGetCount(Package) < 3) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"eficompress");
|
||||
} else if (ShellCommandLineGetCount (Package) < 3) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"eficompress");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
TempParam = ShellCommandLineGetRawValue(Package, 1);
|
||||
ASSERT(TempParam != NULL);
|
||||
InFileName = ShellFindFilePath(TempParam);
|
||||
OutFileName = ShellCommandLineGetRawValue(Package, 2);
|
||||
TempParam = ShellCommandLineGetRawValue (Package, 1);
|
||||
ASSERT (TempParam != NULL);
|
||||
InFileName = ShellFindFilePath (TempParam);
|
||||
OutFileName = ShellCommandLineGetRawValue (Package, 2);
|
||||
if (InFileName == NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"eficompress", TempParam);
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"eficompress", TempParam);
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
} else {
|
||||
if (ShellIsDirectory(InFileName) == EFI_SUCCESS){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", InFileName);
|
||||
if (ShellIsDirectory (InFileName) == EFI_SUCCESS) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", InFileName);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
if (ShellIsDirectory(OutFileName) == EFI_SUCCESS){
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", OutFileName);
|
||||
|
||||
if (ShellIsDirectory (OutFileName) == EFI_SUCCESS) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, L"eficompress", OutFileName);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
Status = ShellOpenFileByName(InFileName, &InShellFileHandle, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue(Package, 1));
|
||||
Status = ShellOpenFileByName (InFileName, &InShellFileHandle, EFI_FILE_MODE_READ, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue (Package, 1));
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
}
|
||||
Status = ShellOpenFileByName(OutFileName, &OutShellFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue(Package, 2));
|
||||
|
||||
Status = ShellOpenFileByName (OutFileName, &OutShellFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"eficompress", ShellCommandLineGetRawValue (Package, 2));
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
Status = gEfiShellProtocol->GetFileSize(InShellFileHandle, &InSize);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
InBuffer = AllocateZeroPool((UINTN)InSize);
|
||||
Status = gEfiShellProtocol->GetFileSize (InShellFileHandle, &InSize);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
InBuffer = AllocateZeroPool ((UINTN)InSize);
|
||||
if (InBuffer == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
} else {
|
||||
InSize2 = (UINTN) InSize;
|
||||
InSize2 = (UINTN)InSize;
|
||||
Status = gEfiShellProtocol->ReadFile (InShellFileHandle, &InSize2, InBuffer);
|
||||
InSize = InSize2;
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
Status = Compress (InBuffer, InSize, OutBuffer, &OutSize);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
OutBuffer = AllocateZeroPool ((UINTN) OutSize);
|
||||
OutBuffer = AllocateZeroPool ((UINTN)OutSize);
|
||||
if (OutBuffer == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
} else {
|
||||
@ -127,14 +131,15 @@ ShellCommandRunEfiCompress (
|
||||
}
|
||||
}
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_COMPRESS_FAIL), gShellDebug1HiiHandle, Status);
|
||||
|
||||
if (EFI_ERROR (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);
|
||||
} else {
|
||||
OutSize2 = (UINTN)OutSize;
|
||||
Status = gEfiShellProtocol->WriteFile(OutShellFileHandle, &OutSize2, OutBuffer);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, L"eficompress", OutFileName);
|
||||
Status = gEfiShellProtocol->WriteFile (OutShellFileHandle, &OutSize2, OutBuffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, L"eficompress", OutFileName);
|
||||
ShellStatus = SHELL_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
@ -144,15 +149,18 @@ ShellCommandRunEfiCompress (
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
if (InShellFileHandle != NULL) {
|
||||
gEfiShellProtocol->CloseFile(InShellFileHandle);
|
||||
gEfiShellProtocol->CloseFile (InShellFileHandle);
|
||||
}
|
||||
|
||||
if (OutShellFileHandle != NULL) {
|
||||
gEfiShellProtocol->CloseFile(OutShellFileHandle);
|
||||
gEfiShellProtocol->CloseFile (OutShellFileHandle);
|
||||
}
|
||||
SHELL_FREE_NON_NULL(InFileName);
|
||||
SHELL_FREE_NON_NULL(InBuffer);
|
||||
SHELL_FREE_NON_NULL(OutBuffer);
|
||||
|
||||
SHELL_FREE_NON_NULL (InFileName);
|
||||
SHELL_FREE_NON_NULL (InBuffer);
|
||||
SHELL_FREE_NON_NULL (OutBuffer);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user